UNPKG

cesium

Version:

CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin.

2 lines (1 loc) 19.6 kB
(function(){"use strict";const{Array:ce,Object:_,Number:le,Math:A,Error:b,Uint8Array:y,Uint16Array:kt,Uint32Array:Fe,Int32Array:vt,Map:ue,DataView:x,Promise:Q,TextEncoder:he,crypto:V,postMessage:E,TransformStream:v,ReadableStream:fe,WritableStream:Ge,CompressionStream:we,DecompressionStream:pe}=self,de=void 0,R="undefined",ee="function",H=new y,O=[[],[],[],[],[],[],[],[]];for(let t=0;256>t;t++){let e=t;for(let n=0;8>n;n++)e=1&e?e>>>1^3988292384:e>>>1;O[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const n=O[e-1][t];O[e][t]=n>>>8^O[0][255&n]}const[ge,He,Je,$e,Ye,Qe,et,tt]=O;class te{constructor(e){this.t=e||-1}append(e){let n=0|this.t;const s=0|e.length;let r=0;if(s>=8&&e.buffer){const i=new x(e.buffer,e.byteOffset,s),a=s-8;for(;a>=r;r+=8){const o=n^i.getInt32(r,!0),c=i.getInt32(r+4,!0);n=tt[255&o]^et[o>>>8&255]^Qe[o>>>16&255]^Ye[o>>>24&255]^$e[255&c]^Je[c>>>8&255]^He[c>>>16&255]^ge[c>>>24&255]}}for(;s>r;r++)n=n>>>8^ge[255&(n^e[r])];this.t=n}get(){return~this.t}}class ye extends v{constructor(){let e;const n=new te;super({transform(s,r){n.append(s),r.enqueue(s)},flush(){const s=new y(4);new x(s.buffer).setUint32(0,n.get()),e.value=s}}),e=this}}const k={concat(t,e){if(t.length===0||e.length===0)return t.concat(e);const n=t[t.length-1],s=k.o(n);return s===32?t.concat(e):k.i(e,s,0|n,t.slice(0,t.length-1))},l(t){const e=t.length;if(e===0)return 0;const n=t[e-1];return 32*(e-1)+k.o(n)},u(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,A.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=k.h(e,t[n-1]&2147483648>>e-1,1)),t},h:(t,e,n)=>t===32?e:(n?0|e:e<<32-t)+1099511627776*t,o:t=>A.round(t/1099511627776)||32,i(t,e,n,s){for(s===void 0&&(s=[]);e>=32;e-=32)s.push(n),n=0;if(e===0)return s.concat(t);for(let a=0;a<t.length;a++)s.push(n|t[a]>>>e),n=t[a]<<32-e;const r=t.length?t[t.length-1]:0,i=k.o(r);return s.push(k.h(e+i&31,e+i>32?n:s.pop(),1)),s}},J={bytes:{p(t){const e=k.l(t)/8,n=new y(e);let s;for(let r=0;e>r;r++)3&r||(s=t[r/4]),n[r]=s>>>24,s<<=8;return n},m(t){const e=[];let n,s=0;for(n=0;n<t.length;n++)s=s<<8|t[n],3&~n||(e.push(s),s=0);return 3&n&&e.push(k.h(8*(3&n),s)),e}}},nt=class{constructor(t){const e=this;e.blockSize=512,e.S=[1732584193,4023233417,2562383102,271733878,3285377520],e.k=[1518500249,1859775393,2400959708,3395469782],t?(e.v=t.v.slice(0),e.C=t.C.slice(0),e.I=t.I):e.reset()}reset(){const t=this;return t.v=t.S.slice(0),t.C=[],t.I=0,t}update(t){const e=this;typeof t=="string"&&(t=J.A.m(t));const n=e.C=k.concat(e.C,t),s=e.I,r=e.I=s+k.l(t);if(r>9007199254740991)throw new b("Cannot hash more than 2^53 - 1 bits");const i=new Fe(n);let a=0;for(let o=e.blockSize+s-(e.blockSize+s&e.blockSize-1);r>=o;o+=e.blockSize)e.P(i.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}R(){const t=this;let e=t.C;const n=t.v;e=k.concat(e,[k.h(1,1)]);for(let s=e.length+2;15&s;s++)e.push(0);for(e.push(A.floor(t.I/4294967296)),e.push(0|t.I);e.length;)t.P(e.splice(0,16));return t.reset(),n}U(t,e,n,s){return t>19?t>39?t>59?t>79?void 0:e^n^s:e&n|e&s|n&s:e^n^s:e&n|~e&s}W(t,e){return e<<t|e>>>32-t}P(t){const e=this,n=e.v,s=ce(80);for(let l=0;16>l;l++)s[l]=t[l];let r=n[0],i=n[1],a=n[2],o=n[3],c=n[4];for(let l=0;79>=l;l++){16>l||(s[l]=e.W(1,s[l-3]^s[l-8]^s[l-14]^s[l-16]));const u=e.W(5,r)+e.U(l,i,a,o)+c+s[l]+e.k[A.floor(l/20)]|0;c=o,o=a,a=e.W(30,i),i=r,r=u}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+c|0}},K={importKey:t=>new K.D(J.bytes.m(t)),M(t,e,n,s){if(n=n||1e4,0>s||0>n)throw new b("invalid params to pbkdf2");const r=1+(s>>5)<<2;let i,a,o,c,l;const u=new ArrayBuffer(r),h=new x(u);let f=0;const d=k;for(e=J.bytes.m(e),l=1;(r||1)>f;l++){for(i=a=t.encrypt(d.concat(e,[l])),o=1;n>o;o++)for(a=t.encrypt(a),c=0;c<a.length;c++)i[c]^=a[c];for(o=0;(r||1)>f&&o<i.length;o++)h.setInt32(f,i[o]),f+=4}return u.slice(0,s/8)},D:class{constructor(t){const e=this,n=e._=nt,s=[[],[]];e.B=[new n,new n];const r=e.B[0].blockSize/32;t.length>r&&(t=new n().update(t).R());for(let i=0;r>i;i++)s[0][i]=909522486^t[i],s[1][i]=1549556828^t[i];e.B[0].update(s[0]),e.B[1].update(s[1]),e.T=new n(e.B[0])}reset(){const t=this;t.T=new t._(t.B[0]),t.V=!1}update(t){this.V=!0,this.T.update(t)}digest(){const t=this,e=t.T.R(),n=new t._(t.B[1]).update(e).R();return t.reset(),n}encrypt(t){if(this.V)throw new b("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},st=typeof V!=R&&typeof V.getRandomValues==ee,me="Invalid password",be="Invalid signature",Se="zipjs-abort-check-password";function ze(t){if(st)return V.getRandomValues(t);throw new b("Crypto API not supported")}const M=16,ke={name:"PBKDF2"},rt=_.assign({hash:{name:"HMAC"}},ke),ne=_.assign({iterations:1e3,hash:{name:"SHA-1"}},ke),it=["deriveBits"],Z=[8,12,16],L=[16,24,32],P=10,ot=[0,0,0,0],$=typeof V!=R,N=$&&V.subtle,ve=$&&typeof N!=R,B=J.bytes,at=class{constructor(t){const e=this;e.K=[[[],[],[],[],[]],[[],[],[],[],[]]],e.K[0][0][0]||e.j();const n=e.K[0][4],s=e.K[1],r=t.length;let i,a,o,c=1;if(r!==4&&r!==6&&r!==8)throw new b("invalid aes key size");for(e.k=[a=t.slice(0),o=[]],i=r;4*r+28>i;i++){let l=a[i-1];(i%r===0||r===8&&i%r===4)&&(l=n[l>>>24]<<24^n[l>>16&255]<<16^n[l>>8&255]<<8^n[255&l],i%r===0&&(l=l<<8^l>>>24^c<<24,c=c<<1^283*(c>>7))),a[i]=a[i-r]^l}for(let l=0;i;l++,i--){const u=a[3&l?i:i-4];o[l]=4>=i||4>l?u:s[0][n[u>>>24]]^s[1][n[u>>16&255]]^s[2][n[u>>8&255]]^s[3][n[255&u]]}}encrypt(t){return this.L(t,0)}decrypt(t){return this.L(t,1)}j(){const t=this.K[0],e=this.K[1],n=t[4],s=e[4],r=[],i=[];let a,o,c,l;for(let u=0;256>u;u++)i[(r[u]=u<<1^283*(u>>7))^u]=u;for(let u=a=0;!n[u];u^=o||1,a=i[a]||1){let h=a^a<<1^a<<2^a<<3^a<<4;h=h>>8^255&h^99,n[u]=h,s[h]=u,l=r[c=r[o=r[u]]];let f=16843009*l^65537*c^257*o^16843008*u,d=257*r[h]^16843008*h;for(let w=0;4>w;w++)t[w][u]=d=d<<24^d>>>8,e[w][h]=f=f<<24^f>>>8}for(let u=0;5>u;u++)t[u]=t[u].slice(0),e[u]=e[u].slice(0)}L(t,e){if(t.length!==4)throw new b("invalid aes block size");const n=this.k[e],s=n.length/4-2,r=[0,0,0,0],i=this.K[e],a=i[0],o=i[1],c=i[2],l=i[3],u=i[4];let h,f,d,w=t[0]^n[0],p=t[e?3:1]^n[1],g=t[2]^n[2],m=t[e?1:3]^n[3],z=4;for(let I=0;s>I;I++)h=a[w>>>24]^o[p>>16&255]^c[g>>8&255]^l[255&m]^n[z],f=a[p>>>24]^o[g>>16&255]^c[m>>8&255]^l[255&w]^n[z+1],d=a[g>>>24]^o[m>>16&255]^c[w>>8&255]^l[255&p]^n[z+2],m=a[m>>>24]^o[w>>16&255]^c[p>>8&255]^l[255&g]^n[z+3],z+=4,w=h,p=f,g=d;for(let I=0;4>I;I++)r[e?3&-I:I]=u[w>>>24]<<24^u[p>>16&255]<<16^u[g>>8&255]<<8^u[255&m]^n[z++],h=w,w=p,p=g,g=m,m=h;return r}},ct=class{constructor(t,e){this.O=t,this.H=e,this.Z=e}reset(){this.Z=this.H}update(t){return this.F(this.O,t,this.Z)}N(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,s=255&t;e===255?(e=0,n===255?(n=0,s===255?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}return t}q(t){(t[0]=this.N(t[0]))===0&&(t[1]=this.N(t[1]))}F(t,e,n){let s;if(!(s=e.length))return[];const r=k.l(e);for(let i=0;s>i;i+=4){this.q(n);const a=t.encrypt(n);e[i]^=a[0],e[i+1]^=a[1],e[i+2]^=a[2],e[i+3]^=a[3]}return k.u(e,r)}},lt=K.D;let _e=$&&ve&&typeof N.importKey==ee,Ce=$&&ve&&typeof N.deriveBits==ee;class ut extends v{constructor({password:e,rawPassword:n,encryptionStrength:s,checkPasswordOnly:r}){super({start(){Ie(this,e,n,s)},async transform(i,a){const o=this,{password:c,strength:l,G:u,ready:h}=o;c?(await(async(d,w,p,g)=>{const m=await Be(d,w,p,C(g,0,Z[w])),z=C(g,Z[w]);if(m[0]!=z[0]||m[1]!=z[1])throw new b(me)})(o,l,c,C(i,0,Z[l]+2)),i=C(i,Z[l]+2),r?a.error(new b(Se)):u()):await h;const f=new y(i.length-P-(i.length-P)%M);a.enqueue(Ae(o,i,f,0,P,!0))},async flush(i){const{J:a,X:o,pending:c,ready:l}=this;if(o&&a){await l;const u=C(c,0,c.length-P),h=C(c,c.length-P);let f=H;if(u.length){const p=j(B,u);o.update(p);const g=a.update(p);f=X(B,g)}const d=C(X(B,o.digest()),0,P);let w=c.length<P?1:0;for(let p=0;P>p;p++)w|=d[p]^h[p];if(w)throw new b(be);i.enqueue(f)}}})}}class ht extends v{constructor({password:e,rawPassword:n,encryptionStrength:s}){let r;super({start(){Ie(this,e,n,s)},async transform(i,a){const o=this,{password:c,strength:l,G:u,ready:h}=o;let f=H;c?(f=await(async(w,p,g)=>{const m=ze(new y(Z[p]));return se(m,await Be(w,p,g,m))})(o,l,c),u()):await h;const d=new y(f.length+i.length-i.length%M);d.set(f,0),a.enqueue(Ae(o,i,d,f.length,0))},async flush(i){const{J:a,X:o,pending:c,ready:l}=this;if(o&&a){await l;let u=H;if(c.length){const h=a.update(j(B,c));o.update(h),u=X(B,h)}r.signature=X(B,o.digest()).slice(0,P),i.enqueue(se(u,r.signature))}}}),r=this}}function Ie(t,e,n,s){_.assign(t,{ready:new Q(r=>t.G=r),password:ft(e,n),strength:s-1,pending:H})}function Ae(t,e,n,s,r,i){const{J:a,X:o,pending:c}=t;c.length&&(e=se(c,e));const l=e.length-r;let u;for(n=((h,f)=>{if(f&&f>h.length){const d=h;(h=new y(f)).set(d,0)}return h})(n,s+(l-l%M)),u=0;l-M>=u;u+=M){const h=j(B,C(e,u,u+M));i&&o.update(h);const f=a.update(h);i||o.update(f),n.set(X(B,f),u+s)}return t.pending=C(e,u),n}async function Be(t,e,n,s){t.password=null;const r=await(async(u,h,f,d,w)=>{if(!_e)return K.importKey(h);try{return await N.importKey("raw",h,f,!1,w)}catch{return _e=!1,K.importKey(h)}})(0,n,rt,0,it),i=await(async(u,h,f)=>{if(!Ce)return K.M(h,u.salt,ne.iterations,f);try{return await N.deriveBits(u,h,f)}catch{return Ce=!1,K.M(h,u.salt,ne.iterations,f)}})(_.assign({salt:s},ne),r,8*(2*L[e]+2)),a=new y(i),o=j(B,C(a,0,L[e])),c=j(B,C(a,L[e],2*L[e])),l=C(a,2*L[e]);return _.assign(t,{keys:{key:o,Y:c,passwordVerification:l},J:new ct(new at(o),ce.from(ot)),X:new lt(c)}),l}function ft(t,e){return e===de?(n=>{if(typeof he==R){const s=new y((n=unescape(encodeURIComponent(n))).length);for(let r=0;r<s.length;r++)s[r]=n.charCodeAt(r);return s}return new he().encode(n)})(t):e}function se(t,e){let n=t;return t.length+e.length&&(n=new y(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function C(t,e,n){return t.subarray(e,n)}function X(t,e){return t.p(e)}function j(t,e){return t.m(e)}class wt extends v{constructor({password:e,rawPassword:n,passwordVerification:s,checkPasswordOnly:r}){super({start(){Pe(this,e,n,s)},transform(i,a){const o=this;if(o.password||o.rawPassword){const c=qe(o,i.subarray(0,12));if(o.password=o.rawPassword=null,(c.at(-1)^o.passwordVerification)!=0)throw new b(me);i=i.subarray(12)}r?a.error(new b(Se)):a.enqueue(qe(o,i))}})}}class pt extends v{constructor({password:e,rawPassword:n,passwordVerification:s}){super({start(){Pe(this,e,n,s)},transform(r,i){const a=this;let o,c;if(a.password||a.rawPassword){a.password=a.rawPassword=null;const l=ze(new y(12));l[11]=a.passwordVerification,o=new y(r.length+l.length),o.set(Te(a,l),0),c=12}else o=new y(r.length),c=0;o.set(Te(a,r),c),i.enqueue(o)}})}}function Pe(t,e,n,s){_.assign(t,{password:e,rawPassword:n,passwordVerification:s}),((r,i,a)=>{const o=[305419896,591751049,878082192];if(_.assign(r,{keys:o,$:new te(o[0]),tt:new te(o[2])}),a)for(let c=0;c<a.length;c++)Y(r,a[c]);else for(let c=0;c<i.length;c++)Y(r,i.charCodeAt(c))})(t,e,n)}function qe(t,e){const n=new y(e.length);for(let s=0;s<e.length;s++)n[s]=We(t)^e[s],Y(t,n[s]);return n}function Te(t,e){const n=new y(e.length);for(let s=0;s<e.length;s++)n[s]=We(t)^e[s],Y(t,e[s]);return n}function Y(t,e){let[,n]=t.keys;t.$.append([e]);const s=~t.$.get();n=Ue(A.imul(Ue(n+Re(s)),134775813)+1),t.tt.append([n>>>24]);const r=~t.tt.get();t.keys=[s,n,r]}function We(t){const e=2|t.keys[2];return Re(A.imul(e,1^e)>>>8)}function Re(t){return 255&t}function Ue(t){return 4294967295&t}class dt extends v{constructor(e,{chunkSize:n,CompressionStreamZlib:s,CompressionStream:r}){super({});const{compressed:i,encrypted:a,useCompressionStream:o,zipCrypto:c,signed:l,level:u,deflate64:h}=e,f=this;let d,w,p,g=super.readable;const m=l&&i&&!h&&(!a||c)&&!(!o||!r);a&&!c||!l||m||(d=new ye,g=T(g,d)),i&&(m?(p=new gt,g=Me(g,new r("gzip")),g=T(g,p)):g=Ke(g,o,{level:u,chunkSize:n},r,s,r)),a&&(c?g=T(g,new pt(e)):(w=new ht(e),g=T(g,w))),xe(f,g,()=>{let z;a&&!c&&(z=w.signature),a&&!c||!l||(z=m?p.signature:new x(d.value.buffer).getUint32(0)),f.signature=z})}}class gt extends v{constructor(){let e,n=10,s=new y(0);super({transform(r,i){if(n){const f=A.min(n,r.length);if(n-=f,!(r=r.subarray(f)).length)return}const a=s.length+r.length;if(8>=a){const f=new y(a);return f.set(s),f.set(r,s.length),void(s=f)}const o=a-8,c=new y(o),l=A.min(o,s.length);c.set(s.subarray(0,l),0),o>l&&c.set(r.subarray(0,o-l),l),i.enqueue(c);const u=new y(8),h=s.length-l;h&&u.set(s.subarray(l),0),u.set(r.subarray(o-l),h),s=u},flush(){const r=new x(s.buffer,s.byteOffset,s.byteLength);e.signature=r.getUint32(0,!0),e.uncompressedSize=r.getUint32(4,!0)}}),e=this}}class yt extends v{constructor(e,{chunkSize:n,DecompressionStreamZlib:s,DecompressionStream:r}){super({});const{zipCrypto:i,encrypted:a,signed:o,signature:c,compressed:l,useCompressionStream:u,deflate64:h}=e;let f,d,w=super.readable;a&&(i?w=T(w,new wt(e)):(d=new ut(e),w=T(w,d))),l&&(w=Ke(w,u,{chunkSize:n,deflate64:h},r,s,r),w=(p=>{const g=p.getReader();return new fe({async pull(m){let z;try{z=await g.read()}catch(U){if(U&&U.message)throw U;const je=new b("Invalid compressed data");throw je.cause=U,je}const{value:I,done:G}=z;G?m.close():m.enqueue(I)},cancel:m=>g.cancel(m)})})(w)),a&&!i||!o||(f=new ye,w=T(w,f)),xe(this,w,()=>{if((!a||i)&&o){const p=new x(f.value.buffer);if(c!=p.getUint32(0,!1))throw new b(be)}})}}function xe(t,e,n){e=T(e,new v({flush:n})),_.defineProperty(t,"readable",{get:()=>e})}function Ke(t,e,n,s,r,i){const a=e&&s?s:r||i,o=n.deflate64?"deflate64-raw":"deflate-raw";let c;try{c=new a(o,n)}catch(l){if(!e)throw l;if(r)c=new r(o,n);else{if(!i)throw l;c=new i(o,n)}}return Me(t,c)}function T(t,e){return t.pipeThrough(e)}function Me(t,e){const n=e.writable.getWriter(),s=t.getReader();return(async()=>{try{for(;;){await n.ready;const r=await s.read();if(r.done){await n.close();break}await n.write(r.value)}}catch(r){await(async(i,a)=>{try{await i.abort(a)}catch{}})(n,r),await(async(i,a)=>{try{await i.cancel(a)}catch{}})(s,r)}})(),e.readable}const De="data",Ve="close";class mt extends v{constructor(e,n){super({});const s=this,{codecType:r}=e;let i;r.startsWith("deflate")?i=dt:r.startsWith("inflate")&&(i=yt),s.outputSize=0;let a=0;const o=new i(e,n),c=super.readable,l=new v({transform(h,f){h&&h.length&&(a+=h.length,f.enqueue(h))},flush(){_.assign(s,{inputSize:a})}}),u=new v({transform(h,f){if(h&&h.length&&(f.enqueue(h),s.outputSize+=h.length,e.outputSize!==de&&s.outputSize>e.outputSize))throw new b("Invalid uncompressed size")},flush(){const{signature:h}=o;_.assign(s,{signature:h,inputSize:a})}});_.defineProperty(s,"readable",{get:()=>c.pipeThrough(l).pipeThrough(o).pipeThrough(u)})}}class bt extends v{constructor(e){let n;1>e&&(e=65536),super({transform:(s,r)=>{if(n){const a=new y(n.length+s.length);a.set(n),a.set(s,n.length),s=a,n=null}let i=0;for(;s.length-i>e;)r.enqueue(s.slice(i,i+e)),i+=e;n=i?s.slice(i):s},flush(s){n&&n.length&&s.enqueue(n)}})}}let Ee=2;try{typeof navigator!=R&&navigator.hardwareConcurrency&&(Ee=navigator.hardwareConcurrency)}catch{}const St={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:65536,maxWorkers:Ee,terminateWorkerTimeout:5e3,workerStarvationTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,CompressionStream:typeof we!=R&&we,DecompressionStream:typeof pe!=R&&pe};_.assign({},St);const re=new ue,ie=new ue;let oe,S,D,q,F,W=0;async function zt(t){let e,n;try{const{options:s,config:r}=t;if(!s.useCompressionStream)try{await self.initModule(t.config)}catch{s.useCompressionStream=!0}r.CompressionStream=self.CompressionStream,r.DecompressionStream=self.DecompressionStream;const i={highWaterMark:1},a=t.readable||new fe({async pull(h){const f=new Q(p=>re.set(W,p));ae({type:"pull",messageId:W}),W=(W+1)%le.MAX_SAFE_INTEGER;const{value:d,done:w}=await f;h.enqueue(d),w&&h.close()}},i);n=t.writable||new Ge({async write(h){let f;const d=new Q(w=>f=w);ie.set(W,f),ae({type:De,value:h,messageId:W}),W=(W+1)%le.MAX_SAFE_INTEGER,await d}},i),e=new mt(s,r),oe=new AbortController;const{signal:o}=oe;await a.pipeThrough(e).pipeThrough(new bt((h=>A.max(h.chunkSize,64))(r))).pipeTo(n,{signal:o,preventClose:!0,preventAbort:!0}),await n.getWriter().close();const{signature:c,inputSize:l,outputSize:u}=e;ae({type:Ve,result:{signature:c,inputSize:l,outputSize:u}})}catch(s){if(s.outputSize=e?e.outputSize:0,n&&!n.locked)try{await n.getWriter().close()}catch{}Oe(s)}}function ae(t){let{value:e}=t;if(e)if(e.length)try{e=new y(e),t.value=e.buffer,E(t,[t.value])}catch{E(t)}else E(t);else E(t)}function Oe(t=new b("Unknown error")){const{message:e,stack:n,code:s,name:r,outputSize:i}=t;E({error:{message:e,stack:n,code:s,name:r,outputSize:i}})}function Ze(t,e,n={}){const s=typeof n.level=="number"?n.level:-1,r=typeof n.outBuffer=="number"?n.outBuffer:65536,i=typeof n.inBufferSize=="number"?n.inBufferSize:65536;return new v({start(){try{let o;if(this.et=D(r),this.in=D(i),this.inBufferSize=i,!this.et||!this.in)throw new b("allocation failed");if(this.nt=new y(r),t?(this.st=S.deflate_process,this.rt=S.deflate_last_consumed,this.ot=S.deflate_end,this.it=S.deflate_new(),o=e==="gzip"?S.deflate_init_gzip(this.it,s):e==="deflate-raw"?S.deflate_init_raw(this.it,s):S.deflate_init(this.it,s)):e==="deflate64-raw"?(this.st=S.inflate9_process,this.rt=S.inflate9_last_consumed,this.ot=S.inflate9_end,this.it=S.inflate9_new(),o=S.inflate9_init_raw(this.it)):(this.st=S.inflate_process,this.rt=S.inflate_last_consumed,this.ot=S.inflate_end,this.it=S.inflate_new(),o=e==="deflate-raw"?S.inflate_init_raw(this.it):e==="gzip"?S.inflate_init_gzip(this.it):S.inflate_init(this.it)),o!==0)throw new b("init failed:"+o)}catch(o){throw a(this),o}},transform(o,c){try{const l=o,u=new y(F.buffer),h=this.st,f=this.rt,d=this.et,w=this.nt;let p=0;for(;p<l.length;){const g=A.min(l.length-p,32768);if((!this.in||this.inBufferSize<g)&&(this.in&&q&&(q(this.in),this.in=0),this.in=D(g),this.inBufferSize=g,!this.in))throw new b("allocation failed");u.set(l.subarray(p,p+g),this.in);const m=h(this.it,this.in,g,d,r,0),z=16777215&m;if(z&&(w.set(u.subarray(d,d+z),0),c.enqueue(w.slice(0,z))),!t){const G=m>>24&255,U=128&G?G-256:G;if(0>U)throw new b("process error:"+U)}const I=f(this.it);if(I===0)break;p+=I}}catch(l){a(this),c.error(l)}},flush(o){try{const c=new y(F.buffer),l=this.st,u=this.et,h=this.nt;for(;;){const f=l(this.it,0,0,u,r,4),d=16777215&f,w=f>>24&255;if(!t){const p=128&w?w-256:w;if(0>p)throw new b("process error:"+p)}if(d&&(h.set(c.subarray(u,u+d),0),o.enqueue(h.slice(0,d))),w===1||d===0)break}}catch(c){o.error(c)}finally{const c=a(this);c!==0&&o.error(new b("end error:"+c))}},cancel(){a(this)}});function a(o){let c=0;return o.it&&o.ot&&(c=o.ot(o.it)),o.it=0,o.in&&q&&q(o.in),o.in=0,o.et&&q&&q(o.et),o.et=0,c}}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:s,done:r}=t;try{if(e=="start"&&zt(t),e==De){const i=re.get(n);re.delete(n),i({value:new y(s),done:r})}if(e=="ack"){const i=ie.get(n);ie.delete(n),i()}e==Ve&&oe.abort()}catch(i){Oe(i)}});class Le{constructor(e="deflate",n){return Ze(!0,e,n)}}class Ne{constructor(e="deflate",n){return Ze(!1,e,n)}}Le.ct=!0,Ne.ct=!0;let Xe=!1;self.initModule=async t=>{try{const e=await(async(n,{baseURI:s})=>{if(!Xe){let r,i;try{try{i=new URL(n,s)}catch{}r=await(await fetch(i)).arrayBuffer()}catch(a){if(!n.startsWith("data:application/wasm;base64,"))throw a;r=(o=>{const c=o.split(",")[1],l=atob(c),u=l.length,h=new y(u);for(let f=0;u>f;++f)h[f]=l.charCodeAt(f);return h.buffer})(n)}(a=>{if(S=a,{malloc:D,free:q,memory:F}=S,typeof D!="function"||typeof q!="function"||!F)throw S=D=q=F=null,new b("Invalid WASM module")})((await WebAssembly.instantiate(r)).instance.exports),Xe=!0}})(t.wasmURI,t);return t.CompressionStreamZlib=Le,t.DecompressionStreamZlib=Ne,e}catch{}}})();