qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/snappyJs.js

13 lines
2.1 KiB
JavaScript
Raw Permalink Normal View History

2023-11-07 10:04:37 +08:00
define((function(){"use strict";
/**
* Modules in this bundle
* @license
*
* snappyjs:
* license: MIT (http://opensource.org/licenses/MIT)
* author: Zhipeng Jia
* version: 0.6.0
*
* This header is generated by licensify (https://github.com/twada/licensify)
*/var r=[0,255,65535,16777215,4294967295];function e(r,e,n,t,f){var o;for(o=0;o<f;o++)n[t+o]=r[e+o]}function n(r,e,n,t){var f;for(f=0;f<t;f++)r[e+f]=r[e-n+f]}function t(r){this.array=r,this.pos=0}function f(){return"object"==typeof process&&"object"==typeof process.versions&&void 0!==process.versions.node}function o(r){return r instanceof Uint8Array&&(!f()||!Buffer.isBuffer(r))}function i(r){return r instanceof ArrayBuffer}t.prototype.readUncompressedLength=function(){for(var r,e,n=0,t=0;t<32&&this.pos<this.array.length;){if(r=this.array[this.pos],this.pos+=1,(e=127&r)<<t>>>t!==e)return-1;if(n|=e<<t,r<128)return n;t+=7}return-1},t.prototype.uncompressToBuffer=function(t){for(var f,o,i,s,a=this.array,u=a.length,p=this.pos,c=0;p<a.length;)if(f=a[p],p+=1,0==(3&f)){if((o=1+(f>>>2))>60){if(p+3>=u)return!1;i=o-60,o=1+((o=a[p]+(a[p+1]<<8)+(a[p+2]<<16)+(a[p+3]<<24))&r[i]),p+=i}if(p+o>u)return!1;e(a,p,t,c,o),p+=o,c+=o}else{switch(3&f){case 1:o=4+(f>>>2&7),s=a[p]+(f>>>5<<8),p+=1;break;case 2:if(p+1>=u)return!1;o=1+(f>>>2),s=a[p]+(a[p+1]<<8),p+=2;break;case 3:if(p+3>=u)return!1;o=1+(f>>>2),s=a[p]+(a[p+1]<<8)+(a[p+2]<<16)+(a[p+3]<<24),p+=4}if(0===s||s>c)return!1;n(t,c,s,o),c+=o}return!0};return function(r){if(!(o(r)||i(r)||(e=r,f()&&Buffer.isBuffer(e))))throw new TypeError("Argument compressed must be type of ArrayBuffer, Buffer, or Uint8Array");var e,n=!1,s=!1;o(r)?n=!0:i(r)&&(s=!0,r=new Uint8Array(r));var a,u,p=new t(r),c=p.readUncompressedLength();if(-1===c)throw new Error("Invalid Snappy bitstream");if(n){if(a=new Uint8Array(c),!p.uncompressToBuffer(a))throw new Error("Invalid Snappy bitstream")}else if(s){if(a=new ArrayBuffer(c),u=new Uint8Array(a),!p.uncompressToBuffer(u))throw new Error("Invalid Snappy bitstream")}else if(a=Buffer.alloc(c),!p.uncompressToBuffer(a))throw new Error("Invalid Snappy bitstream");return a}}));