/**
 * @license
 * Copyright 2019 Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Xe(e){return{id:e}}const pa=Xe("encodeCompressedSegmentationUint32"),ga=Xe("encodeCompressedSegmentationUint64");/**
 * @license
 * Copyright 2019 Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Cn=new Map;function Sn(e){e.onmessage=r=>{{const v=r.data.port;if(v!==void 0){Sn(v);return}}const{t,id:n,args:i}=r.data;Cn.get(t)(...i).then(({value:v,transfer:l})=>e.postMessage({id:n,value:v},l),v=>e.postMessage({id:n,error:v instanceof Error?v.message:v.toString()}))}}Sn(self);function Ye(e,r){Cn.set(e.id,r)}/**
 * @license
 * Copyright 2016 Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const ma=2;function ba(){return new Map}function ya(e,r,t,n,i,a){if(i>0)switch(i){case 1:for(let v=0,l=0;v<a;++v){let g=0;g|=n[t[l+0]]<<0,g|=n[t[l+1]]<<1,g|=n[t[l+2]]<<2,g|=n[t[l+3]]<<3,g|=n[t[l+4]]<<4,g|=n[t[l+5]]<<5,g|=n[t[l+6]]<<6,g|=n[t[l+7]]<<7,g|=n[t[l+8]]<<8,g|=n[t[l+9]]<<9,g|=n[t[l+10]]<<10,g|=n[t[l+11]]<<11,g|=n[t[l+12]]<<12,g|=n[t[l+13]]<<13,g|=n[t[l+14]]<<14,g|=n[t[l+15]]<<15,g|=n[t[l+16]]<<16,g|=n[t[l+17]]<<17,g|=n[t[l+18]]<<18,g|=n[t[l+19]]<<19,g|=n[t[l+20]]<<20,g|=n[t[l+21]]<<21,g|=n[t[l+22]]<<22,g|=n[t[l+23]]<<23,g|=n[t[l+24]]<<24,g|=n[t[l+25]]<<25,g|=n[t[l+26]]<<26,g|=n[t[l+27]]<<27,g|=n[t[l+28]]<<28,g|=n[t[l+29]]<<29,g|=n[t[l+30]]<<30,g|=n[t[l+31]]<<31,e[r+v]=g,l+=32}break;case 2:for(let v=0,l=0;v<a;++v){let g=0;g|=n[t[l+0]]<<0,g|=n[t[l+1]]<<2,g|=n[t[l+2]]<<4,g|=n[t[l+3]]<<6,g|=n[t[l+4]]<<8,g|=n[t[l+5]]<<10,g|=n[t[l+6]]<<12,g|=n[t[l+7]]<<14,g|=n[t[l+8]]<<16,g|=n[t[l+9]]<<18,g|=n[t[l+10]]<<20,g|=n[t[l+11]]<<22,g|=n[t[l+12]]<<24,g|=n[t[l+13]]<<26,g|=n[t[l+14]]<<28,g|=n[t[l+15]]<<30,e[r+v]=g,l+=16}break;case 4:for(let v=0,l=0;v<a;++v){let g=0;g|=n[t[l+0]]<<0,g|=n[t[l+1]]<<4,g|=n[t[l+2]]<<8,g|=n[t[l+3]]<<12,g|=n[t[l+4]]<<16,g|=n[t[l+5]]<<20,g|=n[t[l+6]]<<24,g|=n[t[l+7]]<<28,e[r+v]=g,l+=8}break;case 8:for(let v=0,l=0;v<a;++v){let g=0;g|=n[t[l+0]]<<0,g|=n[t[l+1]]<<8,g|=n[t[l+2]]<<16,g|=n[t[l+3]]<<24,e[r+v]=g,l+=4}break;case 16:for(let v=0,l=0;v<a;++v){let g=0;g|=n[t[l+0]]<<0,g|=n[t[l+1]]<<16,e[r+v]=g,l+=2}break;case 32:for(let v=0,l=0;v<a;++v){let g=0;g|=n[t[l+0]]<<0,e[r+v]=g,l+=1}break}}function Pn(e,r,t,n,i,a,v,l,g){let f;if(i===1)f=0;else for(f=1;1<<f<i;)f*=2;const y=Math.ceil(f*n/32),se=e.length;let X=y,S=!1;const Y=Array.prototype.join.call(a.subarray(0,i*g),",");let j=t.get(Y);j===void 0&&(S=!0,X+=i*g,j=se+y-r,t.set(Y,j)),e.resize(se+X);const K=e.data;if(ya(K,se,v,l,f,y),S){let U=se+y;for(let Z=0,F=i*g;Z<F;++Z)K[U++]=a[Z]}return[f,j]}function xa(e,r,t,n,i,a,v){const l=ba(),g=new Array(3);let f=ma;for(let re=0;re<3;++re){const Q=g[re]=Math.ceil(n[re]/r[re]);f*=Q}const y=g[0],se=g[1],X=g[2],S=n[0],Y=n[1],j=n[2],K=r[0],U=r[1],Z=r[2],F=e.length;let D=F;const ee=[0,0,0];e.resize(F+f);const he=a[0],B=a[1],fe=a[2];for(let re=0;re<X;++re){ee[2]=Math.min(Z,j-re*Z);for(let Q=0;Q<se;++Q){ee[1]=Math.min(U,Y-Q*U);for(let ae=0;ae<y;++ae){ee[0]=Math.min(K,S-ae*K);const Ae=re*Z*fe+Q*U*B+ae*K*he,Ie=e.length-F,[we,C]=v(t,i+Ae,a,r,ee,F,l,e),$=e.data;$[D++]=C|we<<24,$[D++]=Ie}}}}function Ln(e,r,t,n,i,a,v){const l=e.length,g=n[3];e.resize(l+g);for(let f=0;f<g;++f)e.data[l+f]=e.length,xa(e,r,t,n,i+a[3]*f,a,v)}function zn(e,r=1){const t=e.length,n=new Array(t);let i=n[0]=r;for(let a=1;a<t;++a)i*=e[a-1],n[a]=i;return n}function ka(e,r,t){const n=new e.constructor(e.length);for(let i=0;i<r*t;i+=t)for(let a=0;a<t;a++){const v=i/t;n[a*r+v]=e[i+a]}return n}let $t,Pr,Lr,zr,Mr;const ot=1;function Aa(e,r,t,n,i,a,v,l){const g=i[0],f=i[1],y=i[2],se=n[0],X=n[1],S=n[2],Y=t[0];let j=t[1],K=t[2];if(K-=j*f,j-=Y*g,g*f*y===0)return[0,0];const U=se*X*S+31;($t===void 0||$t.length<U)&&($t=new Uint32Array(U),Pr=new Uint32Array(U*ot),Lr=new Uint32Array(U*ot),zr=new Uint32Array(U),Mr=new Uint32Array(U));const Z=$t.subarray(0,U);Z.fill(0);const F=Pr,D=Lr,ee=zr,he=Mr;let B=0;{let re=e[r]+1>>>0,Q=r,ae=0;const Ae=se-g,Ie=se*X-se*f;for(let we=0;we<y;++we,Q+=K,ae+=Ie)for(let C=0;C<f;++C,Q+=j,ae+=Ae)for(let $=0;$<g;++$,Q+=Y){const le=e[Q];le!==re&&(re=F[B*1]=le,ee[B]=B++),Z[ae++]=B}}ee.subarray(0,B).sort((re,Q)=>F[re]-F[Q]);let fe=-1;{let re=F[ee[0]*ot]+1>>>0;for(let Q=0;Q<B;++Q){const ae=ee[Q],Ae=ae*ot,Ie=F[Ae];if(Ie!==re){++fe;const we=fe*ot;re=D[we]=Ie}he[ae+1]=fe}++fe}return Pn(l,a,v,se*X*S,fe,D,Z,he,ot)}function Ea(e,r,t,n,i=0,a=zn(n,1)){return Ln(e,r,t,n,i,a,Aa)}let Nt,Dr,Or,Ur,Rr;const ct=2;function Ta(e,r,t,n,i,a,v,l){const g=i[0],f=i[1],y=i[2],se=n[0],X=n[1],S=n[2],Y=t[0];let j=t[1],K=t[2];if(K-=j*f,j-=Y*g,g*f*y===0)return[0,0];const U=se*X*S+31;(Nt===void 0||Nt.length<U)&&(Nt=new Uint32Array(U),Dr=new Uint32Array(U*ct),Or=new Uint32Array(U*ct),Ur=new Uint32Array(U),Rr=new Uint32Array(U));const Z=Nt.subarray(0,U);Z.fill(0);const F=Dr,D=Or,ee=Ur,he=Rr;let B=0;{let re=e[r]+1>>>0,Q=0,ae=r,Ae=0;const Ie=se-g,we=se*X-se*f;for(let C=0;C<y;++C,ae+=K,Ae+=we)for(let $=0;$<f;++$,ae+=j,Ae+=Ie)for(let le=0;le<g;++le,ae+=Y){const W=e[ae],P=e[ae+1];(W!==re||P!==Q)&&(re=F[B*2]=W,Q=F[B*2+1]=P,ee[B]=B++),Z[Ae++]=B}}ee.subarray(0,B).sort((re,Q)=>{const ae=F[2*re+1],Ae=F[2*Q+1],Ie=F[2*re],we=F[2*Q];return ae-Ae||Ie-we});let fe=-1;{let re=F[ee[0]*ct]+1>>>0,Q=0;for(let ae=0;ae<B;++ae){const Ae=ee[ae],Ie=Ae*ct,we=F[Ie],C=F[Ie+1];if(we!==re||C!==Q){++fe;const $=fe*ct;re=D[$]=we,Q=D[$+1]=C}he[Ae+1]=fe}++fe}return Pn(l,a,v,se*X*S,fe,D,Z,he,ct)}function Ia(e,r,t,n,i=0,a=zn(n,2)){return Ln(e,r,t,n,i,a,Ta)}/**
 * @license
 * Copyright 2016 Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Mn{constructor(r=16){this.length=0,this.data=new Uint32Array(r)}resize(r){const{data:t}=this;if(r>t.length){const n=new Uint32Array(Math.max(r,t.length*2));n.set(t.subarray(0,this.length)),this.data=n}this.length=r}get view(){const{data:r}=this;return new Uint32Array(r.buffer,r.byteOffset,this.length)}shrinkToFit(){this.data=new Uint32Array(this.view)}clear(){this.length=0}appendArray(r){const{length:t}=this;this.resize(t+r.length),this.data.set(r,t)}eraseRange(r,t){this.data.copyWithin(r,t,this.length),this.length-=t-r}}const vt=new Mn(2e4);Ye(pa,async(e,r,t)=>(vt.clear(),Ea(vt,t,e,r),{value:vt.view}));Ye(ga,async(e,r,t)=>(vt.clear(),Ia(vt,t,e,r),{value:vt.view}));const Ca=Xe("decodeJpeg");/**
 * @license
 * Copyright 2015 Mozilla Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Et;(function(e){var r=function(){var Y=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),j=4017,K=799,U=3406,Z=2276,F=1567,D=3784,ee=5793,he=2896;function B(){}function fe(we,C){for(var $=0,le=[],W,P,_e=16;_e>0&&!we[_e-1];)_e--;le.push({children:[],index:0});var L=le[0],E;for(W=0;W<_e;W++){for(P=0;P<we[W];P++){for(L=le.pop(),L.children[L.index]=C[$];L.index>0;)L=le.pop();for(L.index++,le.push(L);le.length<=W;)le.push(E={children:[],index:0}),L.children[L.index]=E.children,L=E;$++}W+1<_e&&(le.push(E={children:[],index:0}),L.children[L.index]=E.children,L=E)}return le[0].children}function re(we,C,$){return 64*((we.blocksPerLine+1)*C+$)}function Q(we,C,$,le,W,P,_e,L,E){$.precision,$.samplesPerLine,$.scanLines;var M=$.mcusPerLine,N=$.progressive;$.maxH,$.maxV;var w=C,c=0,m=0;function s(){if(m>0)return m--,c>>m&1;if(c=we[C++],c===255){var G=we[C++];if(G)throw"unexpected marker: "+(c<<8|G).toString(16)}return m=7,c>>>7}function u(G){for(var ie=G;;){if(ie=ie[s()],typeof ie=="number")return ie;if(typeof ie!="object")throw"invalid huffman sequence"}}function b(G){for(var ie=0;G>0;)ie=ie<<1|s(),G--;return ie}function o(G){if(G===1)return s()===1?1:-1;var ie=b(G);return ie>=1<<G-1?ie:ie+(-1<<G)+1}function _(G,ie){var oe=u(G.huffmanTableDC),ge=oe===0?0:o(oe);G.blockData[ie]=G.pred+=ge;for(var ue=1;ue<64;){var be=u(G.huffmanTableAC),me=be&15,xe=be>>4;if(me===0){if(xe<15)break;ue+=16;continue}ue+=xe;var ye=Y[ue];G.blockData[ie+ye]=o(me),ue++}}function d(G,ie){var oe=u(G.huffmanTableDC),ge=oe===0?0:o(oe)<<E;G.blockData[ie]=G.pred+=ge}function h(G,ie){G.blockData[ie]|=s()<<E}var p=0;function k(G,ie){if(p>0){p--;return}for(var oe=P,ge=_e;oe<=ge;){var ue=u(G.huffmanTableAC),be=ue&15,me=ue>>4;if(be===0){if(me<15){p=b(me)+(1<<me)-1;break}oe+=16;continue}oe+=me;var xe=Y[oe];G.blockData[ie+xe]=o(be)*(1<<E),oe++}}var T=0,z;function A(G,ie){for(var oe=P,ge=_e,ue=0,be,me;oe<=ge;){var xe=Y[oe];switch(T){case 0:if(me=u(G.huffmanTableAC),be=me&15,ue=me>>4,be===0)ue<15?(p=b(ue)+(1<<ue),T=4):(ue=16,T=1);else{if(be!==1)throw"invalid ACn encoding";z=o(be),T=ue?2:3}continue;case 1:case 2:G.blockData[ie+xe]?G.blockData[ie+xe]+=s()<<E:(ue--,ue===0&&(T=T===2?3:0));break;case 3:G.blockData[ie+xe]?G.blockData[ie+xe]+=s()<<E:(G.blockData[ie+xe]=z<<E,T=0);break;case 4:G.blockData[ie+xe]&&(G.blockData[ie+xe]+=s()<<E);break}oe++}T===4&&(p--,p===0&&(T=0))}function x(G,ie,oe,ge,ue){var be=oe/M|0,me=oe%M,xe=be*G.v+ge,ye=me*G.h+ue,Ee=re(G,xe,ye);ie(G,Ee)}function I(G,ie,oe){var ge=oe/G.blocksPerLine|0,ue=oe%G.blocksPerLine,be=re(G,ge,ue);ie(G,be)}var R=le.length,J,H,ne,V,ce,q;N?P===0?q=L===0?d:h:q=L===0?k:A:q=_;var O=0,ve,te;R===1?te=le[0].blocksPerLine*le[0].blocksPerColumn:te=M*$.mcusPerColumn,W||(W=te);for(var pe,de;O<te;){for(H=0;H<R;H++)le[H].pred=0;if(p=0,R===1)for(J=le[0],ce=0;ce<W;ce++)I(J,q,O),O++;else for(ce=0;ce<W;ce++){for(H=0;H<R;H++)for(J=le[H],pe=J.h,de=J.v,ne=0;ne<de;ne++)for(V=0;V<pe;V++)x(J,q,O,ne,V);O++}if(m=0,ve=we[C]<<8|we[C+1],ve<=65280)throw"marker was not found";if(ve>=65488&&ve<=65495)C+=2;else break}return C-w}function ae(we,C,$){for(var le=we.quantizationTable,W=we.blockData,P,_e,L,E,M,N,w,c,m,s,u,b,o,_,d,h,p,k=0;k<64;k+=8){if(m=W[C+k],s=W[C+k+1],u=W[C+k+2],b=W[C+k+3],o=W[C+k+4],_=W[C+k+5],d=W[C+k+6],h=W[C+k+7],m*=le[k],!(s|u|b|o|_|d|h)){p=ee*m+512>>10,$[k]=p,$[k+1]=p,$[k+2]=p,$[k+3]=p,$[k+4]=p,$[k+5]=p,$[k+6]=p,$[k+7]=p;continue}s*=le[k+1],u*=le[k+2],b*=le[k+3],o*=le[k+4],_*=le[k+5],d*=le[k+6],h*=le[k+7],P=ee*m+128>>8,_e=ee*o+128>>8,L=u,E=d,M=he*(s-h)+128>>8,c=he*(s+h)+128>>8,N=b<<4,w=_<<4,P=P+_e+1>>1,_e=P-_e,p=L*D+E*F+128>>8,L=L*F-E*D+128>>8,E=p,M=M+w+1>>1,w=M-w,c=c+N+1>>1,N=c-N,P=P+E+1>>1,E=P-E,_e=_e+L+1>>1,L=_e-L,p=M*Z+c*U+2048>>12,M=M*U-c*Z+2048>>12,c=p,p=N*K+w*j+2048>>12,N=N*j-w*K+2048>>12,w=p,$[k]=P+c,$[k+7]=P-c,$[k+1]=_e+w,$[k+6]=_e-w,$[k+2]=L+N,$[k+5]=L-N,$[k+3]=E+M,$[k+4]=E-M}for(var T=0;T<8;++T){if(m=$[T],s=$[T+8],u=$[T+16],b=$[T+24],o=$[T+32],_=$[T+40],d=$[T+48],h=$[T+56],!(s|u|b|o|_|d|h)){p=ee*m+8192>>14,p=p<-2040?0:p>=2024?255:p+2056>>4,W[C+T]=p,W[C+T+8]=p,W[C+T+16]=p,W[C+T+24]=p,W[C+T+32]=p,W[C+T+40]=p,W[C+T+48]=p,W[C+T+56]=p;continue}P=ee*m+2048>>12,_e=ee*o+2048>>12,L=u,E=d,M=he*(s-h)+2048>>12,c=he*(s+h)+2048>>12,N=b,w=_,P=(P+_e+1>>1)+4112,_e=P-_e,p=L*D+E*F+2048>>12,L=L*F-E*D+2048>>12,E=p,M=M+w+1>>1,w=M-w,c=c+N+1>>1,N=c-N,P=P+E+1>>1,E=P-E,_e=_e+L+1>>1,L=_e-L,p=M*Z+c*U+2048>>12,M=M*U-c*Z+2048>>12,c=p,p=N*K+w*j+2048>>12,N=N*j-w*K+2048>>12,w=p,m=P+c,h=P-c,s=_e+w,d=_e-w,u=L+N,_=L-N,b=E+M,o=E-M,m=m<16?0:m>=4080?255:m>>4,s=s<16?0:s>=4080?255:s>>4,u=u<16?0:u>=4080?255:u>>4,b=b<16?0:b>=4080?255:b>>4,o=o<16?0:o>=4080?255:o>>4,_=_<16?0:_>=4080?255:_>>4,d=d<16?0:d>=4080?255:d>>4,h=h<16?0:h>=4080?255:h>>4,W[C+T]=m,W[C+T+8]=s,W[C+T+16]=u,W[C+T+24]=b,W[C+T+32]=o,W[C+T+40]=_,W[C+T+48]=d,W[C+T+56]=h}}function Ae(we,C){for(var $=C.blocksPerLine,le=C.blocksPerColumn,W=new Int16Array(64),P=0;P<le;P++)for(var _e=0;_e<$;_e++){var L=re(C,P,_e);ae(C,L,W)}return C.blockData}function Ie(we){return we<=0?0:we>=255?255:we}return B.prototype={parse:function(C){function $(){var ue=C[P]<<8|C[P+1];return P+=2,ue}function le(){var ue=$(),be=C.subarray(P,P+ue-2);return P+=be.length,be}function W(ue){for(var be=Math.ceil(ue.samplesPerLine/8/ue.maxH),me=Math.ceil(ue.scanLines/8/ue.maxV),xe=0;xe<ue.components.length;xe++){te=ue.components[xe];var ye=Math.ceil(Math.ceil(ue.samplesPerLine/8)*te.h/ue.maxH),Ee=Math.ceil(Math.ceil(ue.scanLines/8)*te.v/ue.maxV),Ce=be*te.h,$e=me*te.v,lt=64*$e*(Ce+1);te.blockData=new Int16Array(lt),te.blocksPerLine=ye,te.blocksPerColumn=Ee}ue.mcusPerLine=be,ue.mcusPerColumn=me}var P=0;C.length;var _e=null,L=null,E,M,N=[],w=[],c=[],m=$();if(m!==65496)throw"SOI not found";for(m=$();m!==65497;){var s,u,b;switch(m){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var o=le();m===65504&&o[0]===74&&o[1]===70&&o[2]===73&&o[3]===70&&o[4]===0&&(_e={version:{major:o[5],minor:o[6]},densityUnits:o[7],xDensity:o[8]<<8|o[9],yDensity:o[10]<<8|o[11],thumbWidth:o[12],thumbHeight:o[13],thumbData:o.subarray(14,14+3*o[12]*o[13])}),m===65518&&o[0]===65&&o[1]===100&&o[2]===111&&o[3]===98&&o[4]===101&&o[5]===0&&(L={version:o[6],flags0:o[7]<<8|o[8],flags1:o[9]<<8|o[10],transformCode:o[11]});break;case 65499:for(var _=$(),d=_+P-2,h;P<d;){var p=C[P++],k=new Uint16Array(64);if(p>>4)if(p>>4===1)for(u=0;u<64;u++)h=Y[u],k[h]=$();else throw"DQT: invalid table spec";else for(u=0;u<64;u++)h=Y[u],k[h]=C[P++];N[p&15]=k}break;case 65472:case 65473:case 65474:if(E)throw"Only single frame JPEGs supported";$(),E={},E.extended=m===65473,E.progressive=m===65474,E.precision=C[P++],E.scanLines=$(),E.samplesPerLine=$(),E.components=[],E.componentIds={};var T=C[P++],z,A=0,x=0;for(s=0;s<T;s++){z=C[P];var I=C[P+1]>>4,R=C[P+1]&15;A<I&&(A=I),x<R&&(x=R);var J=C[P+2];b=E.components.push({h:I,v:R,quantizationTable:N[J]}),E.componentIds[z]=b-1,P+=3}E.maxH=A,E.maxV=x,W(E);break;case 65476:var H=$();for(s=2;s<H;){var ne=C[P++],V=new Uint8Array(16),ce=0;for(u=0;u<16;u++,P++)ce+=V[u]=C[P];var q=new Uint8Array(ce);for(u=0;u<ce;u++,P++)q[u]=C[P];s+=17+ce,(ne>>4?w:c)[ne&15]=fe(V,q)}break;case 65501:$(),M=$();break;case 65498:$();var O=C[P++],ve=[],te;for(s=0;s<O;s++){var pe=E.componentIds[C[P++]];te=E.components[pe];var de=C[P++];te.huffmanTableDC=c[de>>4],te.huffmanTableAC=w[de&15],ve.push(te)}var G=C[P++],ie=C[P++],oe=C[P++],ge=Q(C,P,E,ve,M,G,ie,oe>>4,oe&15);P+=ge;break;case 65535:C[P]!==255&&P--;break;default:if(C[P-3]===255&&C[P-2]>=192&&C[P-2]<=254){P-=3;break}throw"unknown JPEG marker "+m.toString(16)}m=$()}for(this.width=E.samplesPerLine,this.height=E.scanLines,this.jfif=_e,this.adobe=L,this.components=[],s=0;s<E.components.length;s++)te=E.components[s],this.components.push({output:Ae(E,te),scaleX:te.h/E.maxH,scaleY:te.v/E.maxV,blocksPerLine:te.blocksPerLine,blocksPerColumn:te.blocksPerColumn});this.numComponents=this.components.length},_getLinearizedBlockData:function(C,$){var le=this.width/C,W=this.height/$,P,_e,L,E,M,N,w,c,m,s,u=0,b,o=this.components.length,_=C*$*o,d=new Uint8Array(_),h=new Uint32Array(C),p=4294967288;for(w=0;w<o;w++){for(P=this.components[w],_e=P.scaleX*le,L=P.scaleY*W,u=w,b=P.output,E=P.blocksPerLine+1<<3,M=0;M<C;M++)c=0|M*_e,h[M]=(c&p)<<3|c&7;for(N=0;N<$;N++)for(c=0|N*L,s=E*(c&p)|(c&7)<<3,M=0;M<C;M++)d[u]=b[s+h[M]],u+=o}var k=this.decodeTransform;if(k)for(w=0;w<_;)for(c=0,m=0;c<o;c++,w++,m+=2)d[w]=(d[w]*k[m]>>8)+k[m+1];return d},_isColorConversionNeeded:function(){return this.adobe&&this.adobe.transformCode?!0:this.numComponents===3},_convertYccToRgb:function(C){for(var $,le,W,P=0,_e=C.length;P<_e;P+=3)$=C[P],le=C[P+1],W=C[P+2],C[P]=Ie($-179.456+1.402*W),C[P+1]=Ie($+135.459-.344*le-.714*W),C[P+2]=Ie($-226.816+1.772*le);return C},_convertYcckToRgb:function(C){for(var $,le,W,P,_e=0,L=0,E=C.length;L<E;L+=4){$=C[L],le=C[L+1],W=C[L+2],P=C[L+3];var M=-122.67195406894+le*(-660635669420364e-19*le+.000437130475926232*W-54080610064599e-18*$+.00048449797120281*P-.154362151871126)+W*(-.000957964378445773*W+.000817076911346625*$-.00477271405408747*P+1.53380253221734)+$*(.000961250184130688*$-.00266257332283933*P+.48357088451265)+P*(-.000336197177618394*P+.484791561490776),N=107.268039397724+le*(219927104525741e-19*le-.000640992018297945*W+.000659397001245577*$+.000426105652938837*P-.176491792462875)+W*(-.000778269941513683*W+.00130872261408275*$+.000770482631801132*P-.151051492775562)+$*(.00126935368114843*$-.00265090189010898*P+.25802910206845)+P*(-.000318913117588328*P-.213742400323665),w=-20.810012546947+le*(-.000570115196973677*le-263409051004589e-19*W+.0020741088115012*$-.00288260236853442*P+.814272968359295)+W*(-153496057440975e-19*W-.000132689043961446*$+.000560833691242812*P-.195152027534049)+$*(.00174418132927582*$-.00255243321439347*P+.116935020465145)+P*(-.000343531996510555*P+.24165260232407);C[_e++]=Ie(M),C[_e++]=Ie(N),C[_e++]=Ie(w)}return C},_convertYcckToCmyk:function(C){for(var $,le,W,P=0,_e=C.length;P<_e;P+=4)$=C[P],le=C[P+1],W=C[P+2],C[P]=Ie(434.456-$-1.402*W),C[P+1]=Ie(119.541-$+.344*le+.714*W),C[P+2]=Ie(481.816-$-1.772*le);return C},_convertCmykToRgb:function(C){for(var $,le,W,P,_e=0,L=-255*255*255,E=1/255/255,M=0,N=C.length;M<N;M+=4){$=C[M],le=C[M+1],W=C[M+2],P=C[M+3];var w=$*(-4.387332384609988*$+54.48615194189176*le+18.82290502165302*W+212.25662451639585*P-72734.4411664936)+le*(1.7149763477362134*le-5.6096736904047315*W-17.873870861415444*P-1401.7366389350734)+W*(-2.5217340131683033*W-21.248923337353073*P+4465.541406466231)-P*(21.86122147463605*P+48317.86113160301),c=$*(8.841041422036149*$+60.118027045597366*le+6.871425592049007*W+31.159100130055922*P-20220.756542821975)+le*(-15.310361306967817*le+17.575251261109482*W+131.35250912493976*P-48691.05921601825)+W*(4.444339102852739*W+9.8632861493405*P-6341.191035517494)-P*(20.737325471181034*P+47890.15695978492),m=$*(.8842522430003296*$+8.078677503112928*le+30.89978309703729*W-.23883238689178934*P-3616.812083916688)+le*(10.49593273432072*le+63.02378494754052*W+50.606957656360734*P-28620.90484698408)+W*(.03296041114873217*W+115.60384449646641*P-49363.43385999684)-P*(22.33816807309886*P+45932.16563550634);C[_e++]=w>=0?255:w<=L?0:255+w*E|0,C[_e++]=c>=0?255:c<=L?0:255+c*E|0,C[_e++]=m>=0?255:m<=L?0:255+m*E|0}return C},getData:function(C,$,le){if(this.numComponents>4)throw"Unsupported color mode";var W=this._getLinearizedBlockData(C,$);if(this.numComponents===3)return this._convertYccToRgb(W);if(this.numComponents===4){if(this._isColorConversionNeeded())return le?this._convertYcckToRgb(W):this._convertYcckToCmyk(W);if(le)return this._convertCmykToRgb(W)}return W}},B}(),t=function(){var Y=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}];function j(K,U,Z){this.data=K,this.bp=U,this.dataEnd=Z,this.chigh=K[U],this.clow=0,this.byteIn(),this.chigh=this.chigh<<7&65535|this.clow>>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}return j.prototype={byteIn:function(){var U=this.data,Z=this.bp;if(U[Z]===255){var F=U[Z+1];F>143?(this.clow+=65280,this.ct=8):(Z++,this.clow+=U[Z]<<9,this.ct=7,this.bp=Z)}else Z++,this.clow+=Z<this.dataEnd?U[Z]<<8:65280,this.ct=8,this.bp=Z;this.clow>65535&&(this.chigh+=this.clow>>16,this.clow&=65535)},readBit:function(U,Z){var F=U[Z]>>1,D=U[Z]&1,ee=Y[F],he=ee.qe,B,fe=this.a-he;if(this.chigh<he)fe<he?(fe=he,B=D,F=ee.nmps):(fe=he,B=1^D,ee.switchFlag===1&&(D=B),F=ee.nlps);else{if(this.chigh-=he,fe&32768)return this.a=fe,D;fe<he?(B=1^D,ee.switchFlag===1&&(D=B),F=ee.nlps):(B=D,F=ee.nmps)}do this.ct===0&&this.byteIn(),fe<<=1,this.chigh=this.chigh<<1&65535|this.clow>>15&1,this.clow=this.clow<<1&65535,this.ct--;while(!(fe&32768));return this.a=fe,U[Z]=F<<1|D,B}},j}(),n=function(){var Y={LL:0,LH:1,HL:1,HH:2};function j(){this.failOnCorruptedImage=!1}j.prototype={parse:function(c){var m=l(c,0);if(m===65359){this.parseCodestream(c,0,c.length);return}for(var s=0,u=c.length;s<u;){var b=8,o=g(c,s),_=g(c,s+4);if(s+=b,o===1&&(o=g(c,s)*4294967296+g(c,s+4),s+=8,b+=8),o===0&&(o=u-s+b),o<b)throw new Error("JPX Error: Invalid box field size");var d=o-b,h=!0;switch(_){case 1785737832:h=!1;break;case 1668246642:var p=c[s];if(c[s+1],c[s+2],p===1){var k=g(c,s+3);switch(k){case 16:case 17:case 18:break;default:se("Unknown colorspace "+k);break}}else p===2&&X("ICC profile not supported");break;case 1785737827:this.parseCodestream(c,s,s+d);break;case 1783636e3:g(c,s)!==218793738&&se("Invalid JP2 signature");break;case 1783634458:case 1718909296:case 1920099697:case 1919251232:case 1768449138:break;default:var T=String.fromCharCode(_>>24&255,_>>16&255,_>>8&255,_&255);se("Unsupported header type "+_+" ("+T+")");break}h&&(s+=d)}},parseImageProperties:function(c){for(var m=c.getByte();m>=0;){var s=m;m=c.getByte();var u=s<<8|m;if(u===65361){c.skip(4);var b=c.getInt32()>>>0,o=c.getInt32()>>>0,_=c.getInt32()>>>0,d=c.getInt32()>>>0;c.skip(16);var h=c.getUint16();this.width=b-_,this.height=o-d,this.componentsCount=h,this.bitsPerComponent=8;return}}throw new Error("JPX Error: No size marker found in JPX stream")},parseCodestream:function(c,m,s){var u={};try{for(var b=!1,o=m;o+1<s;){var _=l(c,o);o+=2;var d=0,h,p,k,T,z,A;switch(_){case 65359:u.mainHeader=!0;break;case 65497:break;case 65361:d=l(c,o);var x={};x.Xsiz=g(c,o+4),x.Ysiz=g(c,o+8),x.XOsiz=g(c,o+12),x.YOsiz=g(c,o+16),x.XTsiz=g(c,o+20),x.YTsiz=g(c,o+24),x.XTOsiz=g(c,o+28),x.YTOsiz=g(c,o+32);var I=l(c,o+36);x.Csiz=I;var R=[];h=o+38;for(var J=0;J<I;J++){var H={precision:(c[h]&127)+1,isSigned:!!(c[h]&128),XRsiz:c[h+1],YRsiz:c[h+1]};K(H,x),R.push(H)}u.SIZ=x,u.components=R,U(u,R),u.QCC=[],u.COC=[];break;case 65372:d=l(c,o);var ne={};switch(h=o+2,p=c[h++],p&31){case 0:T=8,z=!0;break;case 1:T=16,z=!1;break;case 2:T=16,z=!0;break;default:throw new Error("JPX Error: Invalid SQcd value "+p)}for(ne.noQuantization=T===8,ne.scalarExpounded=z,ne.guardBits=p>>5,k=[];h<d+o;){var V={};T===8?(V.epsilon=c[h++]>>3,V.mu=0):(V.epsilon=c[h]>>3,V.mu=(c[h]&7)<<8|c[h+1],h+=2),k.push(V)}ne.SPqcds=k,u.mainHeader?u.QCD=ne:(u.currentTile.QCD=ne,u.currentTile.QCC=[]);break;case 65373:d=l(c,o);var ce={};h=o+2;var q;switch(u.SIZ.Csiz<257?q=c[h++]:(q=l(c,h),h+=2),p=c[h++],p&31){case 0:T=8,z=!0;break;case 1:T=16,z=!1;break;case 2:T=16,z=!0;break;default:throw new Error("JPX Error: Invalid SQcd value "+p)}for(ce.noQuantization=T===8,ce.scalarExpounded=z,ce.guardBits=p>>5,k=[];h<d+o;)V={},T===8?(V.epsilon=c[h++]>>3,V.mu=0):(V.epsilon=c[h]>>3,V.mu=(c[h]&7)<<8|c[h+1],h+=2),k.push(V);ce.SPqcds=k,u.mainHeader?u.QCC[q]=ce:u.currentTile.QCC[q]=ce;break;case 65362:d=l(c,o);var O={};h=o+2;var ve=c[h++];O.entropyCoderWithCustomPrecincts=!!(ve&1),O.sopMarkerUsed=!!(ve&2),O.ephMarkerUsed=!!(ve&4),O.progressionOrder=c[h++],O.layersCount=l(c,h),h+=2,O.multipleComponentTransform=c[h++],O.decompositionLevelsCount=c[h++],O.xcb=(c[h++]&15)+2,O.ycb=(c[h++]&15)+2;var te=c[h++];if(O.selectiveArithmeticCodingBypass=!!(te&1),O.resetContextProbabilities=!!(te&2),O.terminationOnEachCodingPass=!!(te&4),O.verticalyStripe=!!(te&8),O.predictableTermination=!!(te&16),O.segmentationSymbolUsed=!!(te&32),O.reversibleTransformation=c[h++],O.entropyCoderWithCustomPrecincts){for(var pe=[];h<d+o;){var de=c[h++];pe.push({PPx:de&15,PPy:de>>4})}O.precinctsSizes=pe}var G=[];if(O.selectiveArithmeticCodingBypass&&G.push("selectiveArithmeticCodingBypass"),O.resetContextProbabilities&&G.push("resetContextProbabilities"),O.terminationOnEachCodingPass&&G.push("terminationOnEachCodingPass"),O.verticalyStripe&&G.push("verticalyStripe"),O.predictableTermination&&G.push("predictableTermination"),G.length>0)throw b=!0,new Error("JPX Error: Unsupported COD options ("+G.join(", ")+")");u.mainHeader?u.COD=O:(u.currentTile.COD=O,u.currentTile.COC=[]);break;case 65424:d=l(c,o),A={},A.index=l(c,o+2),A.length=g(c,o+4),A.dataEnd=A.length+o-2,A.partIndex=c[o+8],A.partsCount=c[o+9],u.mainHeader=!1,A.partIndex===0&&(A.COD=u.COD,A.COC=u.COC.slice(0),A.QCD=u.QCD,A.QCC=u.QCC.slice(0)),u.currentTile=A;break;case 65427:A=u.currentTile,A.partIndex===0&&(W(u,A.index),Ie(u)),d=A.dataEnd-o,we(u,c,o,d);break;case 65365:case 65367:case 65368:case 65380:d=l(c,o);break;case 65363:throw new Error("JPX Error: Codestream code 0xFF53 (COC) is not implemented");default:throw new Error("JPX Error: Unknown codestream code: "+_.toString(16))}o+=d}}catch(ie){if(b||this.failOnCorruptedImage)throw ie;se("Trying to recover from "+ie.message)}this.tiles=le(u),this.width=u.SIZ.Xsiz-u.SIZ.XOsiz,this.height=u.SIZ.Ysiz-u.SIZ.YOsiz,this.componentsCount=u.SIZ.Csiz}};function K(w,c){w.x0=Math.ceil(c.XOsiz/w.XRsiz),w.x1=Math.ceil(c.Xsiz/w.XRsiz),w.y0=Math.ceil(c.YOsiz/w.YRsiz),w.y1=Math.ceil(c.Ysiz/w.YRsiz),w.width=w.x1-w.x0,w.height=w.y1-w.y0}function U(w,c){for(var m=w.SIZ,s,u=[],b=Math.ceil((m.Xsiz-m.XTOsiz)/m.XTsiz),o=Math.ceil((m.Ysiz-m.YTOsiz)/m.YTsiz),_=0;_<o;_++)for(var d=0;d<b;d++)s={},s.tx0=Math.max(m.XTOsiz+d*m.XTsiz,m.XOsiz),s.ty0=Math.max(m.YTOsiz+_*m.YTsiz,m.YOsiz),s.tx1=Math.min(m.XTOsiz+(d+1)*m.XTsiz,m.Xsiz),s.ty1=Math.min(m.YTOsiz+(_+1)*m.YTsiz,m.Ysiz),s.width=s.tx1-s.tx0,s.height=s.ty1-s.ty0,s.components=[],u.push(s);w.tiles=u;for(var h=m.Csiz,p=0,k=h;p<k;p++)for(var T=c[p],z=0,A=u.length;z<A;z++){var x={};s=u[z],x.tcx0=Math.ceil(s.tx0/T.XRsiz),x.tcy0=Math.ceil(s.ty0/T.YRsiz),x.tcx1=Math.ceil(s.tx1/T.XRsiz),x.tcy1=Math.ceil(s.ty1/T.YRsiz),x.width=x.tcx1-x.tcx0,x.height=x.tcy1-x.tcy0,s.components[p]=x}}function Z(w,c,m){var s=c.codingStyleParameters,u={};return s.entropyCoderWithCustomPrecincts?(u.PPx=s.precinctsSizes[m].PPx,u.PPy=s.precinctsSizes[m].PPy):(u.PPx=15,u.PPy=15),u.xcb_=m>0?Math.min(s.xcb,u.PPx-1):Math.min(s.xcb,u.PPx),u.ycb_=m>0?Math.min(s.ycb,u.PPy-1):Math.min(s.ycb,u.PPy),u}function F(w,c,m){var s=1<<m.PPx,u=1<<m.PPy,b=c.resLevel===0,o=1<<m.PPx+(b?0:-1),_=1<<m.PPy+(b?0:-1),d=c.trx1>c.trx0?Math.ceil(c.trx1/s)-Math.floor(c.trx0/s):0,h=c.try1>c.try0?Math.ceil(c.try1/u)-Math.floor(c.try0/u):0,p=d*h;c.precinctParameters={precinctWidth:s,precinctHeight:u,numprecinctswide:d,numprecinctshigh:h,numprecincts:p,precinctWidthInSubband:o,precinctHeightInSubband:_}}function D(w,c,m){var s=m.xcb_,u=m.ycb_,b=1<<s,o=1<<u,_=c.tbx0>>s,d=c.tby0>>u,h=c.tbx1+b-1>>s,p=c.tby1+o-1>>u,k=c.resolution.precinctParameters,T=[],z=[],A,x,I,R;for(x=d;x<p;x++)for(A=_;A<h;A++){I={cbx:A,cby:x,tbx0:b*A,tby0:o*x,tbx1:b*(A+1),tby1:o*(x+1)},I.tbx0_=Math.max(c.tbx0,I.tbx0),I.tby0_=Math.max(c.tby0,I.tby0),I.tbx1_=Math.min(c.tbx1,I.tbx1),I.tby1_=Math.min(c.tby1,I.tby1);var J=Math.floor((I.tbx0_-c.tbx0)/k.precinctWidthInSubband),H=Math.floor((I.tby0_-c.tby0)/k.precinctHeightInSubband);if(R=J+H*k.numprecinctswide,I.precinctNumber=R,I.subbandType=c.type,I.Lblock=3,!(I.tbx1_<=I.tbx0_||I.tby1_<=I.tby0_)){T.push(I);var ne=z[R];ne!==void 0?(A<ne.cbxMin?ne.cbxMin=A:A>ne.cbxMax&&(ne.cbxMax=A),x<ne.cbyMin?ne.cbxMin=x:x>ne.cbyMax&&(ne.cbyMax=x)):z[R]=ne={cbxMin:A,cbyMin:x,cbxMax:A,cbyMax:x},I.precinct=ne}}c.codeblockParameters={codeblockWidth:s,codeblockHeight:u,numcodeblockwide:h-_+1,numcodeblockhigh:p-d+1},c.codeblocks=T,c.precincts=z}function ee(w,c,m){for(var s=[],u=w.subbands,b=0,o=u.length;b<o;b++)for(var _=u[b],d=_.codeblocks,h=0,p=d.length;h<p;h++){var k=d[h];k.precinctNumber===c&&s.push(k)}return{layerNumber:m,codeblocks:s}}function he(w){for(var c=w.SIZ,m=w.currentTile.index,s=w.tiles[m],u=s.codingStyleDefaultParameters.layersCount,b=c.Csiz,o=0,_=0;_<b;_++)o=Math.max(o,s.components[_].codingStyleParameters.decompositionLevelsCount);var d=0,h=0,p=0,k=0;this.nextPacket=function(){for(;d<u;d++){for(;h<=o;h++){for(;p<b;p++){var z=s.components[p];if(!(h>z.codingStyleParameters.decompositionLevelsCount)){for(var A=z.resolutions[h],x=A.precinctParameters.numprecincts;k<x;){var I=ee(A,k,d);return k++,I}k=0}}p=0}h=0}throw new Error("JPX Error: Out of packets")}}function B(w){for(var c=w.SIZ,m=w.currentTile.index,s=w.tiles[m],u=s.codingStyleDefaultParameters.layersCount,b=c.Csiz,o=0,_=0;_<b;_++)o=Math.max(o,s.components[_].codingStyleParameters.decompositionLevelsCount);var d=0,h=0,p=0,k=0;this.nextPacket=function(){for(;d<=o;d++){for(;h<u;h++){for(;p<b;p++){var z=s.components[p];if(!(d>z.codingStyleParameters.decompositionLevelsCount)){for(var A=z.resolutions[d],x=A.precinctParameters.numprecincts;k<x;){var I=ee(A,k,h);return k++,I}k=0}}p=0}h=0}throw new Error("JPX Error: Out of packets")}}function fe(w){var c=w.SIZ,m=w.currentTile.index,s=w.tiles[m],u=s.codingStyleDefaultParameters.layersCount,b=c.Csiz,o,_,d,h,p=0;for(d=0;d<b;d++){var k=s.components[d];p=Math.max(p,k.codingStyleParameters.decompositionLevelsCount)}var T=new Int32Array(p+1);for(_=0;_<=p;++_){var z=0;for(d=0;d<b;++d){var A=s.components[d].resolutions;_<A.length&&(z=Math.max(z,A[_].precinctParameters.numprecincts))}T[_]=z}o=0,_=0,d=0,h=0,this.nextPacket=function(){for(;_<=p;_++){for(;h<T[_];h++){for(;d<b;d++){var I=s.components[d];if(!(_>I.codingStyleParameters.decompositionLevelsCount)){var R=I.resolutions[_],J=R.precinctParameters.numprecincts;if(!(h>=J)){for(;o<u;){var H=ee(R,h,o);return o++,H}o=0}}}d=0}h=0}throw new Error("JPX Error: Out of packets")}}function re(w){var c=w.SIZ,m=w.currentTile.index,s=w.tiles[m],u=s.codingStyleDefaultParameters.layersCount,b=c.Csiz,o=Ae(s),_=o,d=0,h=0,p=0,k=0,T=0;this.nextPacket=function(){for(;T<_.maxNumHigh;T++){for(;k<_.maxNumWide;k++){for(;p<b;p++){for(var A=s.components[p],x=A.codingStyleParameters.decompositionLevelsCount;h<=x;h++){var I=A.resolutions[h],R=o.components[p].resolutions[h],J=ae(k,T,R,_,I);if(J!==null){for(;d<u;){var H=ee(I,J,d);return d++,H}d=0}}h=0}p=0}k=0}throw new Error("JPX Error: Out of packets")}}function Q(w){var c=w.SIZ,m=w.currentTile.index,s=w.tiles[m],u=s.codingStyleDefaultParameters.layersCount,b=c.Csiz,o=Ae(s),_=0,d=0,h=0,p=0,k=0;this.nextPacket=function(){for(;h<b;++h){for(var z=s.components[h],A=o.components[h],x=z.codingStyleParameters.decompositionLevelsCount;k<A.maxNumHigh;k++){for(;p<A.maxNumWide;p++){for(;d<=x;d++){var I=z.resolutions[d],R=A.resolutions[d],J=ae(p,k,R,A,I);if(J!==null){for(;_<u;){var H=ee(I,J,_);return _++,H}_=0}}d=0}p=0}k=0}throw new Error("JPX Error: Out of packets")}}function ae(w,c,m,s,u){var b=w*s.minWidth,o=c*s.minHeight;if(b%m.width!==0||o%m.height!==0)return null;var _=o/m.width*u.precinctParameters.numprecinctswide;return b/m.height+_}function Ae(w){for(var c=w.components.length,m=Number.MAX_VALUE,s=Number.MAX_VALUE,u=0,b=0,o=new Array(c),_=0;_<c;_++){for(var d=w.components[_],h=d.codingStyleParameters.decompositionLevelsCount,p=new Array(h+1),k=Number.MAX_VALUE,T=Number.MAX_VALUE,z=0,A=0,x=1,I=h;I>=0;--I){var R=d.resolutions[I],J=x*R.precinctParameters.precinctWidth,H=x*R.precinctParameters.precinctHeight;k=Math.min(k,J),T=Math.min(T,H),z=Math.max(z,R.precinctParameters.numprecinctswide),A=Math.max(A,R.precinctParameters.numprecinctshigh),p[I]={width:J,height:H},x<<=1}m=Math.min(m,k),s=Math.min(s,T),u=Math.max(u,z),b=Math.max(b,A),o[_]={resolutions:p,minWidth:k,minHeight:T,maxNumWide:z,maxNumHigh:A}}return{components:o,minWidth:m,minHeight:s,maxNumWide:u,maxNumHigh:b}}function Ie(w){for(var c=w.SIZ,m=w.currentTile.index,s=w.tiles[m],u=c.Csiz,b=0;b<u;b++){for(var o=s.components[b],_=o.codingStyleParameters.decompositionLevelsCount,d=[],h=[],p=0;p<=_;p++){var k=Z(w,o,p),T={},z=1<<_-p;T.trx0=Math.ceil(o.tcx0/z),T.try0=Math.ceil(o.tcy0/z),T.trx1=Math.ceil(o.tcx1/z),T.try1=Math.ceil(o.tcy1/z),T.resLevel=p,F(w,T,k),d.push(T);var A;if(p===0)A={},A.type="LL",A.tbx0=Math.ceil(o.tcx0/z),A.tby0=Math.ceil(o.tcy0/z),A.tbx1=Math.ceil(o.tcx1/z),A.tby1=Math.ceil(o.tcy1/z),A.resolution=T,D(w,A,k),h.push(A),T.subbands=[A];else{var x=1<<_-p+1,I=[];A={},A.type="HL",A.tbx0=Math.ceil(o.tcx0/x-.5),A.tby0=Math.ceil(o.tcy0/x),A.tbx1=Math.ceil(o.tcx1/x-.5),A.tby1=Math.ceil(o.tcy1/x),A.resolution=T,D(w,A,k),h.push(A),I.push(A),A={},A.type="LH",A.tbx0=Math.ceil(o.tcx0/x),A.tby0=Math.ceil(o.tcy0/x-.5),A.tbx1=Math.ceil(o.tcx1/x),A.tby1=Math.ceil(o.tcy1/x-.5),A.resolution=T,D(w,A,k),h.push(A),I.push(A),A={},A.type="HH",A.tbx0=Math.ceil(o.tcx0/x-.5),A.tby0=Math.ceil(o.tcy0/x-.5),A.tbx1=Math.ceil(o.tcx1/x-.5),A.tby1=Math.ceil(o.tcy1/x-.5),A.resolution=T,D(w,A,k),h.push(A),I.push(A),T.subbands=I}}o.resolutions=d,o.subbands=h}var R=s.codingStyleDefaultParameters.progressionOrder;switch(R){case 0:s.packetsIterator=new he(w);break;case 1:s.packetsIterator=new B(w);break;case 2:s.packetsIterator=new fe(w);break;case 3:s.packetsIterator=new re(w);break;case 4:s.packetsIterator=new Q(w);break;default:throw new Error("JPX Error: Unsupported progression order "+R)}}function we(w,c,m,s){var u=0,b,o=0,_=!1;function d(Ce){for(;o<Ce;){var $e=c[m+u];u++,_?(b=b<<7|$e,o+=7,_=!1):(b=b<<8|$e,o+=8),$e===255&&(_=!0)}return o-=Ce,b>>>o&(1<<Ce)-1}function h(Ce){return c[m+u-1]===255&&c[m+u]===Ce?(p(1),!0):c[m+u]===255&&c[m+u+1]===Ce?(p(2),!0):!1}function p(Ce){u+=Ce}function k(){o=0,_&&(u++,_=!1)}function T(){if(d(1)===0)return 1;if(d(1)===0)return 2;var Ce=d(2);return Ce<3?Ce+3:(Ce=d(5),Ce<31?Ce+6:(Ce=d(7),Ce+37))}for(var z=w.currentTile.index,A=w.tiles[z],x=w.COD.sopMarkerUsed,I=w.COD.ephMarkerUsed,R=A.packetsIterator;u<s;){k(),x&&h(145)&&p(4);var J=R.nextPacket();if(d(1)){for(var H=J.layerNumber,ne=[],V,ce=0,q=J.codeblocks.length;ce<q;ce++){V=J.codeblocks[ce];var O=V.precinct,ve=V.cbx-O.cbxMin,te=V.cby-O.cbyMin,pe=!1,de=!1,G;if(V.included!==void 0)pe=!!d(1);else{O=V.precinct;var ie,oe;if(O.inclusionTree!==void 0)ie=O.inclusionTree;else{var ge=O.cbxMax-O.cbxMin+1,ue=O.cbyMax-O.cbyMin+1;ie=new _e(ge,ue,H),oe=new P(ge,ue),O.inclusionTree=ie,O.zeroBitPlanesTree=oe}if(ie.reset(ve,te,H))for(;;)if(d(1)){if(G=!ie.nextLevel(),G){V.included=!0,pe=de=!0;break}}else{ie.incrementValue(H);break}}if(pe){if(de){for(oe=O.zeroBitPlanesTree,oe.reset(ve,te);;)if(d(1)){if(G=!oe.nextLevel(),G)break}else oe.incrementValue();V.zeroBitPlanes=oe.value}for(var be=T();d(1);)V.Lblock++;var me=a(be),xe=(be<1<<me?me-1:me)+V.Lblock,ye=d(xe);ne.push({codeblock:V,codingpasses:be,dataLength:ye})}}for(k(),I&&h(146);ne.length>0;){var Ee=ne.shift();V=Ee.codeblock,V.data===void 0&&(V.data=[]),V.data.push({data:c,start:m+u,end:m+u+Ee.dataLength,codingpasses:Ee.codingpasses}),u+=Ee.dataLength}}}return u}function C(w,c,m,s,u,b,o,_){for(var d=s.tbx0,h=s.tby0,p=s.tbx1-s.tbx0,k=s.codeblocks,T=s.type.charAt(0)==="H"?1:0,z=s.type.charAt(1)==="H"?c:0,A=0,x=k.length;A<x;++A){var I=k[A],R=I.tbx1_-I.tbx0_,J=I.tby1_-I.tby0_;if(!(R===0||J===0)&&I.data!==void 0){var H,ne;H=new L(R,J,I.subbandType,I.zeroBitPlanes,b),ne=2;var V=I.data,ce=0,q=0,O,ve,te;for(O=0,ve=V.length;O<ve;O++)te=V[O],ce+=te.end-te.start,q+=te.codingpasses;var pe=new Uint8Array(ce),de=0;for(O=0,ve=V.length;O<ve;O++){te=V[O];var G=te.data.subarray(te.start,te.end);pe.set(G,de),de+=G.length}var ie=new t(pe,0,ce);for(H.setDecoder(ie),O=0;O<q;O++){switch(ne){case 0:H.runSignificancePropogationPass();break;case 1:H.runMagnitudeRefinementPass();break;case 2:H.runCleanupPass(),_&&H.checkSegmentationSymbol();break}ne=(ne+1)%3}var oe=I.tbx0_-d+(I.tby0_-h)*p,ge=H.coefficentsSign,ue=H.coefficentsMagnitude,be=H.bitsDecoded,me=o?0:.5,xe,ye,Ee;de=0;var Ce=s.type!=="LL";for(O=0;O<J;O++){var $e=oe/p|0,lt=2*$e*(c-p)+T+z;for(xe=0;xe<R;xe++){if(ye=ue[de],ye!==0){ye=(ye+me)*u,ge[de]!==0&&(ye=-ye),Ee=be[de];var Sr=Ce?lt+(oe<<1):oe;o&&Ee>=b?w[Sr]=ye:w[Sr]=ye*(1<<b-Ee)}oe++,de++}oe+=p-R}}}}function $(w,c,m){for(var s=c.components[m],u=s.codingStyleParameters,b=s.quantizationParameters,o=u.decompositionLevelsCount,_=b.SPqcds,d=b.scalarExpounded,h=b.guardBits,p=u.segmentationSymbolUsed,k=w.components[m].precision,T=u.reversibleTransformation,z=T?new N:new M,A=[],x=0,I=0;I<=o;I++){for(var R=s.resolutions[I],J=R.trx1-R.trx0,H=R.try1-R.try0,ne=new Float32Array(J*H),V=0,ce=R.subbands.length;V<ce;V++){var q,O;d?(q=_[x].mu,O=_[x].epsilon,x++):(q=_[0].mu,O=_[0].epsilon+(I>0?1-I:0));var ve=R.subbands[V],te=Y[ve.type],pe=T?1:Math.pow(2,k+te-O)*(1+q/2048),de=h+O-1;C(ne,J,H,ve,pe,de,T,p)}A.push({width:J,height:H,items:ne})}var G=z.calculate(A,s.tcx0,s.tcy0);return{left:s.tcx0,top:s.tcy0,width:G.width,height:G.height,items:G.items}}function le(w){for(var c=w.SIZ,m=w.components,s=c.Csiz,u=[],b=0,o=w.tiles.length;b<o;b++){var _=w.tiles[b],d=[],h;for(h=0;h<s;h++)d[h]=$(w,_,h);var p=d[0],k=new Uint8Array(p.items.length*s),T={left:p.left,top:p.top,width:p.width,height:p.height,items:k},z,A,x,I,R,J=0,H,ne,V,ce,q,O,ve,te,pe,de;if(_.codingStyleDefaultParameters.multipleComponentTransform){var G=s===4,ie=d[0].items,oe=d[1].items,ge=d[2].items,ue=G?d[3].items:null;z=m[0].precision-8,A=(128<<z)+.5,x=255*(1<<z),R=x*.5,I=-R;var be=_.components[0],me=s-3;if(ne=ie.length,be.codingStyleParameters.reversibleTransformation)for(H=0;H<ne;H++,J+=me)V=ie[H]+A,ce=oe[H],q=ge[H],ve=V-(q+ce>>2),O=ve+q,te=ve+ce,k[J++]=O<=0?0:O>=x?255:O>>z,k[J++]=ve<=0?0:ve>=x?255:ve>>z,k[J++]=te<=0?0:te>=x?255:te>>z;else for(H=0;H<ne;H++,J+=me)V=ie[H]+A,ce=oe[H],q=ge[H],O=V+1.402*q,ve=V-.34413*ce-.71414*q,te=V+1.772*ce,k[J++]=O<=0?0:O>=x?255:O>>z,k[J++]=ve<=0?0:ve>=x?255:ve>>z,k[J++]=te<=0?0:te>=x?255:te>>z;if(G)for(H=0,J=3;H<ne;H++,J+=4)pe=ue[H],k[J]=pe<=I?0:pe>=R?255:pe+A>>z}else for(h=0;h<s;h++){var xe=d[h].items;for(z=m[h].precision-8,A=(128<<z)+.5,x=127.5*(1<<z),I=-x,J=h,H=0,ne=xe.length;H<ne;H++)de=xe[H],k[J]=de<=I?0:de>=x?255:de+A>>z,J+=s}u.push(T)}return u}function W(w,c){for(var m=w.SIZ,s=m.Csiz,u=w.tiles[c],b=0;b<s;b++){var o=u.components[b],_=w.currentTile.QCC[b]!==void 0?w.currentTile.QCC[b]:w.currentTile.QCD;o.quantizationParameters=_;var d=w.currentTile.COC[b]!==void 0?w.currentTile.COC[b]:w.currentTile.COD;o.codingStyleParameters=d}u.codingStyleDefaultParameters=w.currentTile.COD}var P=function(){function c(m,s){var u=a(Math.max(m,s))+1;this.levels=[];for(var b=0;b<u;b++){var o={width:m,height:s,items:[]};this.levels.push(o),m=Math.ceil(m/2),s=Math.ceil(s/2)}}return c.prototype={reset:function(s,u){for(var b=0,o=0,_;b<this.levels.length;){_=this.levels[b];var d=s+u*_.width;if(_.items[d]!==void 0){o=_.items[d];break}_.index=d,s>>=1,u>>=1,b++}b--,_=this.levels[b],_.items[_.index]=o,this.currentLevel=b,delete this.value},incrementValue:function(){var s=this.levels[this.currentLevel];s.items[s.index]++},nextLevel:function(){var s=this.currentLevel,u=this.levels[s],b=u.items[u.index];return s--,s<0?(this.value=b,!1):(this.currentLevel=s,u=this.levels[s],u.items[u.index]=b,!0)}},c}(),_e=function(){function c(m,s,u){var b=a(Math.max(m,s))+1;this.levels=[];for(var o=0;o<b;o++){for(var _=new Uint8Array(m*s),d=0,h=_.length;d<h;d++)_[d]=u;var p={width:m,height:s,items:_};this.levels.push(p),m=Math.ceil(m/2),s=Math.ceil(s/2)}}return c.prototype={reset:function(s,u,b){for(var o=0;o<this.levels.length;){var _=this.levels[o],d=s+u*_.width;_.index=d;var h=_.items[d];if(h===255)break;if(h>b)return this.currentLevel=o,this.propagateValues(),!1;s>>=1,u>>=1,o++}return this.currentLevel=o-1,!0},incrementValue:function(s){var u=this.levels[this.currentLevel];u.items[u.index]=s+1,this.propagateValues()},propagateValues:function(){for(var s=this.currentLevel,u=this.levels[s],b=u.items[u.index];--s>=0;)u=this.levels[s],u.items[u.index]=b},nextLevel:function(){var s=this.currentLevel,u=this.levels[s],b=u.items[u.index];return u.items[u.index]=255,s--,s<0?!1:(this.currentLevel=s,u=this.levels[s],u.items[u.index]=b,!0)}},c}(),L=function(){var c=17,m=18,s=new Uint8Array([0,5,8,0,3,7,8,0,4,7,8,0,0,0,0,0,1,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8]),u=new Uint8Array([0,3,4,0,5,7,7,0,8,8,8,0,0,0,0,0,1,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8]),b=new Uint8Array([0,1,2,0,1,2,2,0,2,2,2,0,0,0,0,0,3,4,5,0,4,5,5,0,5,5,5,0,0,0,0,0,6,7,7,0,7,7,7,0,7,7,7,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8]);function o(_,d,h,p,k){this.width=_,this.height=d,this.contextLabelTable=h==="HH"?b:h==="HL"?u:s;var T=_*d;this.neighborsSignificance=new Uint8Array(T),this.coefficentsSign=new Uint8Array(T),this.coefficentsMagnitude=k>14?new Uint32Array(T):k>6?new Uint16Array(T):new Uint8Array(T),this.processingFlags=new Uint8Array(T);var z=new Uint8Array(T);if(p!==0)for(var A=0;A<T;A++)z[A]=p;this.bitsDecoded=z,this.reset()}return o.prototype={setDecoder:function(d){this.decoder=d},reset:function(){this.contexts=new Int8Array(19),this.contexts[0]=8,this.contexts[c]=92,this.contexts[m]=6},setNeighborsSignificance:function(d,h,p){var k=this.neighborsSignificance,T=this.width,z=this.height,A=h>0,x=h+1<T,I;d>0&&(I=p-T,A&&(k[I-1]+=16),x&&(k[I+1]+=16),k[I]+=4),d+1<z&&(I=p+T,A&&(k[I-1]+=16),x&&(k[I+1]+=16),k[I]+=4),A&&(k[p-1]+=1),x&&(k[p+1]+=1),k[p]|=128},runSignificancePropogationPass:function(){for(var d=this.decoder,h=this.width,p=this.height,k=this.coefficentsMagnitude,T=this.coefficentsSign,z=this.neighborsSignificance,A=this.processingFlags,x=this.contexts,I=this.contextLabelTable,R=this.bitsDecoded,J=-2,H=1,ne=2,V=0;V<p;V+=4)for(var ce=0;ce<h;ce++)for(var q=V*h+ce,O=0;O<4;O++,q+=h){var ve=V+O;if(ve>=p)break;if(A[q]&=J,!(k[q]||!z[q])){var te=I[z[q]],pe=d.readBit(x,te);if(pe){var de=this.decodeSignBit(ve,ce,q);T[q]=de,k[q]=1,this.setNeighborsSignificance(ve,ce,q),A[q]|=ne}R[q]++,A[q]|=H}}},decodeSignBit:function(d,h,p){var k=this.width,T=this.height,z=this.coefficentsMagnitude,A=this.coefficentsSign,x,I,R,J,H,ne;J=h>0&&z[p-1]!==0,h+1<k&&z[p+1]!==0?(R=A[p+1],J?(I=A[p-1],x=1-R-I):x=1-R-R):J?(I=A[p-1],x=1-I-I):x=0;var V=3*x;return J=d>0&&z[p-k]!==0,d+1<T&&z[p+k]!==0?(R=A[p+k],J?(I=A[p-k],x=1-R-I+V):x=1-R-R+V):J?(I=A[p-k],x=1-I-I+V):x=V,x>=0?(H=9+x,ne=this.decoder.readBit(this.contexts,H)):(H=9-x,ne=this.decoder.readBit(this.contexts,H)^1),ne},runMagnitudeRefinementPass:function(){for(var d=this.decoder,h=this.width,p=this.height,k=this.coefficentsMagnitude,T=this.neighborsSignificance,z=this.contexts,A=this.bitsDecoded,x=this.processingFlags,I=1,R=2,J=h*p,H=h*4,ne=0,V;ne<J;ne=V){V=Math.min(J,ne+H);for(var ce=0;ce<h;ce++)for(var q=ne+ce;q<V;q+=h)if(!(!k[q]||x[q]&I)){var O=16;if(x[q]&R){x[q]^=R;var ve=T[q]&127;O=ve===0?15:14}var te=d.readBit(z,O);k[q]=k[q]<<1|te,A[q]++,x[q]|=I}}},runCleanupPass:function(){for(var d=this.decoder,h=this.width,p=this.height,k=this.neighborsSignificance,T=this.coefficentsMagnitude,z=this.coefficentsSign,A=this.contexts,x=this.contextLabelTable,I=this.bitsDecoded,R=this.processingFlags,J=1,H=2,ne=h,V=h*2,ce=h*3,q,O=0;O<p;O=q){q=Math.min(O+4,p);for(var ve=O*h,te=O+3<p,pe=0;pe<h;pe++){var de=ve+pe,G=te&&R[de]===0&&R[de+ne]===0&&R[de+V]===0&&R[de+ce]===0&&k[de]===0&&k[de+ne]===0&&k[de+V]===0&&k[de+ce]===0,ie=0,oe=de,ge=O,ue;if(G){var be=d.readBit(A,m);if(!be){I[de]++,I[de+ne]++,I[de+V]++,I[de+ce]++;continue}ie=d.readBit(A,c)<<1|d.readBit(A,c),ie!==0&&(ge=O+ie,oe+=ie*h),ue=this.decodeSignBit(ge,pe,oe),z[oe]=ue,T[oe]=1,this.setNeighborsSignificance(ge,pe,oe),R[oe]|=H,oe=de;for(var me=O;me<=ge;me++,oe+=h)I[oe]++;ie++}for(ge=O+ie;ge<q;ge++,oe+=h)if(!(T[oe]||R[oe]&J)){var xe=x[k[oe]],ye=d.readBit(A,xe);ye===1&&(ue=this.decodeSignBit(ge,pe,oe),z[oe]=ue,T[oe]=1,this.setNeighborsSignificance(ge,pe,oe),R[oe]|=H),I[oe]++}}}},checkSegmentationSymbol:function(){var d=this.decoder,h=this.contexts,p=d.readBit(h,c)<<3|d.readBit(h,c)<<2|d.readBit(h,c)<<1|d.readBit(h,c);if(p!==10)throw new Error("JPX Error: Invalid segmentation symbol")}},o}(),E=function(){function c(){}return c.prototype.calculate=function(s,u,b){for(var o=s[0],_=1,d=s.length;_<d;_++)o=this.iterate(o,s[_],u,b);return o},c.prototype.extend=function(s,u,b){var o=u-1,_=u+1,d=u+b-2,h=u+b;s[o--]=s[_++],s[h++]=s[d--],s[o--]=s[_++],s[h++]=s[d--],s[o--]=s[_++],s[h++]=s[d--],s[o]=s[_],s[h]=s[d]},c.prototype.iterate=function(s,u,b,o){var _=s.width,d=s.height,h=s.items,p=u.width,k=u.height,T=u.items,z,A,x,I,R,J;for(x=0,z=0;z<d;z++)for(I=z*2*p,A=0;A<_;A++,x++,I+=2)T[I]=h[x];h=s.items=null;var H=4,ne=new Float32Array(p+2*H);if(p===1){if(b&1)for(J=0,x=0;J<k;J++,x+=p)T[x]*=.5}else for(J=0,x=0;J<k;J++,x+=p)ne.set(T.subarray(x,x+p),H),this.extend(ne,H,p),this.filter(ne,H,p),T.set(ne.subarray(H,H+p),x);var V=16,ce=[];for(z=0;z<V;z++)ce.push(new Float32Array(k+2*H));var q,O=0;if(s=H+k,k===1){if(o&1)for(R=0;R<p;R++)T[R]*=.5}else for(R=0;R<p;R++){if(O===0){for(V=Math.min(p-R,V),x=R,I=H;I<s;x+=p,I++)for(q=0;q<V;q++)ce[q][I]=T[x+q];O=V}O--;var ve=ce[O];if(this.extend(ve,H,k),this.filter(ve,H,k),O===0)for(x=R-V+1,I=H;I<s;x+=p,I++)for(q=0;q<V;q++)T[x+q]=ce[q][I]}return{width:p,height:k,items:T}},c}(),M=function(){function c(){E.call(this)}return c.prototype=Object.create(E.prototype),c.prototype.filter=function(s,u,b){var o=b>>1;u=u|0;var _,d,h,p,k=-1.586134342059924,T=-.052980118572961,z=.882911075530934,A=.443506852043971,x=1.230174104914001,I=1/x;for(_=u-3,d=o+4;d--;_+=2)s[_]*=I;for(_=u-2,h=A*s[_-1],d=o+3;d--&&(p=A*s[_+1],s[_]=x*s[_]-h-p,d--);_+=2)_+=2,h=A*s[_+1],s[_]=x*s[_]-h-p;for(_=u-1,h=z*s[_-1],d=o+2;d--&&(p=z*s[_+1],s[_]-=h+p,d--);_+=2)_+=2,h=z*s[_+1],s[_]-=h+p;for(_=u,h=T*s[_-1],d=o+1;d--&&(p=T*s[_+1],s[_]-=h+p,d--);_+=2)_+=2,h=T*s[_+1],s[_]-=h+p;if(o!==0)for(_=u+1,h=k*s[_-1],d=o;d--&&(p=k*s[_+1],s[_]-=h+p,d--);_+=2)_+=2,h=k*s[_+1],s[_]-=h+p},c}(),N=function(){function c(){E.call(this)}return c.prototype=Object.create(E.prototype),c.prototype.filter=function(s,u,b){var o=b>>1;u=u|0;var _,d;for(_=u,d=o+1;d--;_+=2)s[_]-=s[_-1]+s[_+1]+2>>2;for(_=u+1,d=o;d--;_+=2)s[_]+=s[_-1]+s[_+1]>>1},c}();return j}(),i=function(){function Y(){}Y.prototype={getContexts:function(L){return L in this?this[L]:this[L]=new Int8Array(65536)}};function j(L,E,M){this.data=L,this.start=E,this.end=M}j.prototype={get decoder(){var L=new t(this.data,this.start,this.end);return f(this,"decoder",L)},get contextCache(){var L=new Y;return f(this,"contextCache",L)}};function K(L,E,M){var N=L.getContexts(E),w=1;function c(u){for(var b=0,o=0;o<u;o++){var _=M.readBit(N,w);w=w<256?w<<1|_:(w<<1|_)&511|256,b=b<<1|_}return b>>>0}var m=c(1),s=c(1)?c(1)?c(1)?c(1)?c(1)?c(32)+4436:c(12)+340:c(8)+84:c(6)+20:c(4)+4:c(2);return m===0?s:s>0?-s:null}function U(L,E,M){for(var N=L.getContexts("IAID"),w=1,c=0;c<M;c++){var m=E.readBit(N,w);w=w<<1|m}return M<31?w&(1<<M)-1:w&2147483647}var Z=["SymbolDictionary",null,null,null,"IntermediateTextRegion",null,"ImmediateTextRegion","ImmediateLosslessTextRegion",null,null,null,null,null,null,null,null,"patternDictionary",null,null,null,"IntermediateHalftoneRegion",null,"ImmediateHalftoneRegion","ImmediateLosslessHalftoneRegion",null,null,null,null,null,null,null,null,null,null,null,null,"IntermediateGenericRegion",null,"ImmediateGenericRegion","ImmediateLosslessGenericRegion","IntermediateGenericRefinementRegion",null,"ImmediateGenericRefinementRegion","ImmediateLosslessGenericRefinementRegion",null,null,null,null,"PageInformation","EndOfPage","EndOfStripe","EndOfFile","Profiles","Tables",null,null,null,null,null,null,null,null,"Extension"],F=[[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:2,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-2,y:0},{x:-1,y:0}],[{x:-3,y:-1},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}]],D=[{coding:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:-1,y:1},{x:0,y:1},{x:1,y:1}]},{coding:[{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:0,y:1},{x:1,y:1}]}],ee=[39717,1941,229,405],he=[32,8];function B(L,E,M){var N=M.decoder,w=M.contextCache.getContexts("GB"),c,m,s,u,b,o,_,d=[],h=31735;for(m=0;m<E;m++)for(b=d[m]=new Uint8Array(L),o=m<1?b:d[m-1],_=m<2?b:d[m-2],c=_[0]<<13|_[1]<<12|_[2]<<11|o[0]<<7|o[1]<<6|o[2]<<5|o[3]<<4,s=0;s<L;s++)b[s]=u=N.readBit(w,c),c=(c&h)<<1|(s+3<L?_[s+3]<<11:0)|(s+4<L?o[s+4]<<4:0)|u;return d}function fe(L,E,M,N,w,c,m,s){if(L&&y("JBIG2 error: MMR encoding is not supported"),N===0&&!c&&!w&&m.length===4&&m[0].x===3&&m[0].y===-1&&m[1].x===-3&&m[1].y===-1&&m[2].x===2&&m[2].y===-2&&m[3].x===-2&&m[3].y===-2)return B(E,M,s);var u=!!c,b=F[N].concat(m);b.sort(function(Ee,Ce){return Ee.y-Ce.y||Ee.x-Ce.x});var o=b.length,_=new Int8Array(o),d=new Int8Array(o),h=[],p=0,k=0,T=0,z=0,A,x;for(x=0;x<o;x++)_[x]=b[x].x,d[x]=b[x].y,k=Math.min(k,b[x].x),T=Math.max(T,b[x].x),z=Math.min(z,b[x].y),x<o-1&&b[x].y===b[x+1].y&&b[x].x===b[x+1].x-1?p|=1<<o-1-x:h.push(x);var I=h.length,R=new Int8Array(I),J=new Int8Array(I),H=new Uint16Array(I);for(A=0;A<I;A++)x=h[A],R[A]=b[x].x,J[A]=b[x].y,H[A]=1<<o-1-x;for(var ne=-k,V=-z,ce=E-T,q=ee[N],O=new Uint8Array(E),ve=[],te=s.decoder,pe=s.contextCache.getContexts("GB"),de=0,G,ie,oe,ge=0,ue,be,me=0;me<M;me++){if(w){var xe=te.readBit(pe,q);if(de^=xe,de){ve.push(O);continue}}for(O=new Uint8Array(O),ve.push(O),G=0;G<E;G++){if(u&&c[me][G]){O[G]=0;continue}if(G>=ne&&G<ce&&me>=V)for(ge=ge<<1&p,x=0;x<I;x++)ie=me+J[x],oe=G+R[x],ue=ve[ie][oe],ue&&(ue=H[x],ge|=ue);else for(ge=0,be=o-1,x=0;x<o;x++,be--)oe=G+_[x],oe>=0&&oe<E&&(ie=me+d[x],ie>=0&&(ue=ve[ie][oe],ue&&(ge|=ue<<be)));var ye=te.readBit(pe,ge);O[G]=ye}}return ve}function re(L,E,M,N,w,c,m,s,u){var b=D[M].coding;M===0&&(b=b.concat([s[0]]));var o=b.length,_=new Int32Array(o),d=new Int32Array(o),h;for(h=0;h<o;h++)_[h]=b[h].x,d[h]=b[h].y;var p=D[M].reference;M===0&&(p=p.concat([s[1]]));var k=p.length,T=new Int32Array(k),z=new Int32Array(k);for(h=0;h<k;h++)T[h]=p[h].x,z[h]=p[h].y;for(var A=N[0].length,x=N.length,I=he[M],R=[],J=u.decoder,H=u.contextCache.getContexts("GR"),ne=0,V=0;V<E;V++){if(m){var ce=J.readBit(H,I);ne^=ce,ne&&y("JBIG2 error: prediction is not supported")}var q=new Uint8Array(L);R.push(q);for(var O=0;O<L;O++){var ve,te,pe=0;for(h=0;h<o;h++)ve=V+d[h],te=O+_[h],ve<0||te<0||te>=L?pe<<=1:pe=pe<<1|R[ve][te];for(h=0;h<k;h++)ve=V+z[h]+c,te=O+T[h]+w,ve<0||ve>=x||te<0||te>=A?pe<<=1:pe=pe<<1|N[ve][te];var de=J.readBit(H,pe);q[O]=de}}return R}function Q(L,E,M,N,w,c,m,s,u,b,o){L&&y("JBIG2 error: huffman is not supported");for(var _=[],d=0,h=a(M.length+N),p=o.decoder,k=o.contextCache;_.length<N;){var T=K(k,"IADH",p);d+=T;for(var z=0;;){var A=K(k,"IADW",p);if(A===null)break;z+=A;var x;if(E){var I=K(k,"IAAI",p);if(I>1)x=ae(L,E,z,d,0,I,1,M.concat(_),h,0,0,1,0,c,u,b,o);else{var R=U(k,p,h),J=K(k,"IARDX",p),H=K(k,"IARDY",p),ne=R<M.length?M[R]:_[R-M.length];x=re(z,d,u,ne,J,H,!1,b,o)}}else x=fe(!1,z,d,m,!1,null,s,o);_.push(x)}}for(var V=[],ce=[],q=!1,O=M.length+N;ce.length<O;){for(var ve=K(k,"IAEX",p);ve--;)ce.push(q);q=!q}for(var te=0,pe=M.length;te<pe;te++)ce[te]&&V.push(M[te]);for(var de=0;de<N;te++,de++)ce[te]&&V.push(_[de]);return V}function ae(L,E,M,N,w,c,m,s,u,b,o,_,d,h,p,k,T){L&&y("JBIG2 error: huffman is not supported");var z=[],A,x;for(A=0;A<N;A++){if(x=new Uint8Array(M),w)for(var I=0;I<M;I++)x[I]=w;z.push(x)}var R=T.decoder,J=T.contextCache,H=-K(J,"IADT",R),ne=0;for(A=0;A<c;){var V=K(J,"IADT",R);H+=V;var ce=K(J,"IAFS",R);ne+=ce;var q=ne;do{var O=m===1?0:K(J,"IAIT",R),ve=m*H+O,te=U(J,R,u),pe=E&&K(J,"IARI",R),de=s[te],G=de[0].length,ie=de.length;if(pe){var oe=K(J,"IARDW",R),ge=K(J,"IARDH",R),ue=K(J,"IARDX",R),be=K(J,"IARDY",R);G+=oe,ie+=ge,de=re(G,ie,p,de,(oe>>1)+ue,(ge>>1)+be,!1,k,T)}var me=ve-(_&1?0:ie),xe=q-(_&2?G:0),ye,Ee,Ce;if(b){for(ye=0;ye<ie;ye++)if(x=z[xe+ye],!!x){Ce=de[ye];var $e=Math.min(M-me,G);switch(d){case 0:for(Ee=0;Ee<$e;Ee++)x[me+Ee]|=Ce[Ee];break;case 2:for(Ee=0;Ee<$e;Ee++)x[me+Ee]^=Ce[Ee];break;default:y("JBIG2 error: operator "+d+" is not supported")}}q+=ie-1}else{for(Ee=0;Ee<ie;Ee++)if(x=z[me+Ee],!!x)switch(Ce=de[Ee],d){case 0:for(ye=0;ye<G;ye++)x[xe+ye]|=Ce[ye];break;case 2:for(ye=0;ye<G;ye++)x[xe+ye]^=Ce[ye];break;default:y("JBIG2 error: operator "+d+" is not supported")}q+=G-1}A++;var lt=K(J,"IADS",R);if(lt===null)break;q+=lt+o}while(!0)}return z}function Ae(L,E){var M={};M.number=g(L,E);var N=L[E+4],w=N&63;Z[w]||y("JBIG2 error: invalid segment type: "+w),M.type=w,M.typeName=Z[w],M.deferredNonRetain=!!(N&128);var c=!!(N&64),m=L[E+5],s=m>>5&7,u=[m&31],b=E+6;if(m===7){s=g(L,b-1)&536870911,b+=3;var o=s+7>>3;for(u[0]=L[b++];--o>0;)u.push(L[b++])}else(m===5||m===6)&&y("JBIG2 error: invalid referred-to flags");M.retainBits=u;var _=M.number<=256?1:M.number<=65536?2:4,d=[],h,p;for(h=0;h<s;h++){var k=_===1?L[b]:_===2?l(L,b):g(L,b);d.push(k),b+=_}if(M.referredTo=d,c?(M.pageAssociation=g(L,b),b+=4):M.pageAssociation=L[b++],M.length=g(L,b),b+=4,M.length===4294967295)if(w===38){var T=we(L,b),z=L[b+C],A=!!(z&1),x=6,I=new Uint8Array(x);for(A||(I[0]=255,I[1]=172),I[2]=T.height>>>24&255,I[3]=T.height>>16&255,I[4]=T.height>>8&255,I[5]=T.height&255,h=b,p=L.length;h<p;h++){for(var R=0;R<x&&I[R]===L[h+R];)R++;if(R===x){M.length=h+x;break}}M.length===4294967295&&y("JBIG2 error: segment end was not found")}else y("JBIG2 error: invalid unknown segment length");return M.headerEnd=b,M}function Ie(L,E,M,N){for(var w=[],c=M;c<N;){var m=Ae(E,c);c=m.headerEnd;var s={header:m,data:E};if(L.randomAccess||(s.start=c,c+=m.length,s.end=c),w.push(s),m.type===51)break}if(L.randomAccess)for(var u=0,b=w.length;u<b;u++)w[u].start=c,c+=w[u].header.length,w[u].end=c;return w}function we(L,E){return{width:g(L,E),height:g(L,E+4),x:g(L,E+8),y:g(L,E+12),combinationOperator:L[E+16]&7}}var C=17;function $(L,E){var M=L.header,N=L.data,w=L.start,c=L.end,m,s,u,b;switch(M.type){case 0:var o={},_=l(N,w);if(o.huffman=!!(_&1),o.refinement=!!(_&2),o.huffmanDHSelector=_>>2&3,o.huffmanDWSelector=_>>4&3,o.bitmapSizeSelector=_>>6&1,o.aggregationInstancesSelector=_>>7&1,o.bitmapCodingContextUsed=!!(_&256),o.bitmapCodingContextRetained=!!(_&512),o.template=_>>10&3,o.refinementTemplate=_>>12&1,w+=2,!o.huffman){for(b=o.template===0?4:1,s=[],u=0;u<b;u++)s.push({x:v(N,w),y:v(N,w+1)}),w+=2;o.at=s}if(o.refinement&&!o.refinementTemplate){for(s=[],u=0;u<2;u++)s.push({x:v(N,w),y:v(N,w+1)}),w+=2;o.refinementAt=s}o.numberOfExportedSymbols=g(N,w),w+=4,o.numberOfNewSymbols=g(N,w),w+=4,m=[o,M.number,M.referredTo,N,w,c];break;case 6:case 7:var d={};d.info=we(N,w),w+=C;var h=l(N,w);if(w+=2,d.huffman=!!(h&1),d.refinement=!!(h&2),d.stripSize=1<<(h>>2&3),d.referenceCorner=h>>4&3,d.transposed=!!(h&64),d.combinationOperator=h>>7&3,d.defaultPixelValue=h>>9&1,d.dsOffset=h<<17>>27,d.refinementTemplate=h>>15&1,d.huffman){var p=l(N,w);w+=2,d.huffmanFS=p&3,d.huffmanDS=p>>2&3,d.huffmanDT=p>>4&3,d.huffmanRefinementDW=p>>6&3,d.huffmanRefinementDH=p>>8&3,d.huffmanRefinementDX=p>>10&3,d.huffmanRefinementDY=p>>12&3,d.huffmanRefinementSizeSelector=!!(p&14)}if(d.refinement&&!d.refinementTemplate){for(s=[],u=0;u<2;u++)s.push({x:v(N,w),y:v(N,w+1)}),w+=2;d.refinementAt=s}d.numberOfSymbolInstances=g(N,w),w+=4,d.huffman&&y("JBIG2 error: huffman is not supported"),m=[d,M.referredTo,N,w,c];break;case 38:case 39:var k={};k.info=we(N,w),w+=C;var T=N[w++];if(k.mmr=!!(T&1),k.template=T>>1&3,k.prediction=!!(T&8),!k.mmr){for(b=k.template===0?4:1,s=[],u=0;u<b;u++)s.push({x:v(N,w),y:v(N,w+1)}),w+=2;k.at=s}m=[k,N,w,c];break;case 48:var z={width:g(N,w),height:g(N,w+4),resolutionX:g(N,w+8),resolutionY:g(N,w+12)};z.height===4294967295&&delete z.height;var A=N[w+16];l(N,w+17),z.lossless=!!(A&1),z.refinement=!!(A&2),z.defaultPixelValue=A>>2&1,z.combinationOperator=A>>3&3,z.requiresBuffer=!!(A&32),z.combinationOperatorOverride=!!(A&64),m=[z];break;case 49:break;case 50:break;case 51:break;case 62:break;default:y("JBIG2 error: segment type "+M.typeName+"("+M.type+") is not implemented")}var x="on"+M.typeName;x in E&&E[x].apply(E,m)}function le(L,E){for(var M=0,N=L.length;M<N;M++)$(L[M],E)}function W(L){for(var E=new P,M=0,N=L.length;M<N;M++){var w=L[M],c=Ie({},w.data,w.start,w.end);le(c,E)}return E}function P(){}P.prototype={onPageInformation:function(E){this.currentPageInfo=E;var M=E.width+7>>3,N=new Uint8Array(M*E.height);if(E.defaultPixelValue)for(var w=0,c=N.length;w<c;w++)N[w]=255;this.buffer=N},drawBitmap:function(E,M){var N=this.currentPageInfo,w=E.width,c=E.height,m=N.width+7>>3,s=N.combinationOperatorOverride?E.combinationOperator:N.combinationOperator,u=this.buffer,b=128>>(E.x&7),o=E.y*m+(E.x>>3),_,d,h,p;switch(s){case 0:for(_=0;_<c;_++){for(h=b,p=o,d=0;d<w;d++)M[_][d]&&(u[p]|=h),h>>=1,h||(h=128,p++);o+=m}break;case 2:for(_=0;_<c;_++){for(h=b,p=o,d=0;d<w;d++)M[_][d]&&(u[p]^=h),h>>=1,h||(h=128,p++);o+=m}break;default:y("JBIG2 error: operator "+s+" is not supported")}},onImmediateGenericRegion:function(E,M,N,w){var c=E.info,m=new j(M,N,w),s=fe(E.mmr,c.width,c.height,E.template,E.prediction,null,E.at,m);this.drawBitmap(c,s)},onImmediateLosslessGenericRegion:function(){this.onImmediateGenericRegion.apply(this,arguments)},onSymbolDictionary:function(E,M,N,w,c,m){var s;E.huffman&&y("JBIG2 error: huffman is not supported");var u=this.symbols;u||(this.symbols=u={});for(var b=[],o=0,_=N.length;o<_;o++)b=b.concat(u[N[o]]);var d=new j(w,c,m);u[M]=Q(E.huffman,E.refinement,b,E.numberOfNewSymbols,E.numberOfExportedSymbols,s,E.template,E.at,E.refinementTemplate,E.refinementAt,d)},onImmediateTextRegion:function(E,M,N,w,c){for(var m=E.info,s,u=this.symbols,b=[],o=0,_=M.length;o<_;o++)b=b.concat(u[M[o]]);var d=a(b.length),h=new j(N,w,c),p=ae(E.huffman,E.refinement,m.width,m.height,E.defaultPixelValue,E.numberOfSymbolInstances,E.stripSize,b,d,E.transposed,E.dsOffset,E.referenceCorner,E.combinationOperator,s,E.refinementTemplate,E.refinementAt,h);this.drawBitmap(m,p)},onImmediateLosslessTextRegion:function(){this.onImmediateTextRegion.apply(this,arguments)}};function _e(){}return _e.prototype={parseChunks:function(E){return W(E)}},_e}();function a(S){for(var Y=1,j=0;S>Y;)Y<<=1,j++;return j}function v(S,Y){return S[Y]<<24>>24}function l(S,Y){return S[Y]<<8|S[Y+1]}function g(S,Y){return(S[Y]<<24|S[Y+1]<<16|S[Y+2]<<8|S[Y+3])>>>0}function f(S,Y,j){return Object.defineProperty(S,Y,{value:j,enumerable:!0,configurable:!0,writable:!1}),j}var y=function(){throw console.error.apply(console,arguments),new Error("PDFJS error: "+arguments[0])},se=function(){console.warn.apply(console,arguments)},X=function(){console.info.apply(console,arguments)};i.prototype.parse=function(he){var j=0,K=he.length;(he[j]!==151||he[j+1]!==74||he[j+2]!==66||he[j+3]!==50||he[j+4]!==13||he[j+5]!==10||he[j+6]!==26||he[j+7]!==10)&&y("JBIG2 error: invalid header"),j+=8;var U=he[j++];U&2||(g(he,j),j+=4);for(var Z=this.parseChunks([{data:he,start:j,end:K}]),F=Z.currentPageInfo.width,D=Z.currentPageInfo.height,ee=Z.buffer,he=new Uint8Array(F*D),B=0,fe=0,re=0;re<D;re++)for(var Q=0,ae,Ae=0;Ae<F;Ae++)Q||(Q=128,ae=ee[fe++]),he[B++]=ae&Q?0:255,Q>>=1;this.width=F,this.height=D,this.data=he},e.JpegImage=r,e.JpxImage=n,e.Jbig2Image=i})(Et||(Et={}));var Sa=Et.JpegImage;Et.JpxImage;Et.Jbig2Image;Ye(Ca,async(e,r,t,n,i)=>{const a=new Sa;if(a.parse(e),r!==void 0&&t!==void 0&&a.width*a.height!==r*t)throw new Error(`JPEG data does not have the expected dimensions: width=${a.width}, height=${a.height}, expected width=${r}, expected height=${t}`);if(r=a.width,t=a.height,n!==void 0&&a.numComponents!==n)throw new Error(`JPEG data does not have the expected number of components: components=${a.numComponents}, expected=${n}`);n=a.numComponents;let v;if(a.numComponents===1)v=a.getData(a.width,a.height,!1);else if(a.numComponents===3)if(v=a.getData(a.width,a.height,!1),i){const l=r*t,g=new Uint8Array(l);for(let f=0;f<l;++f)g[f]=v[f*3];v=g}else v=ka(v,a.width*a.height,3);else throw new Error(`JPEG data has an unsupported number of components: components=${a.numComponents}`);return{value:{width:r,height:t,numComponents:n,uint8Array:v},transfer:[v.buffer]}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const Pa=4,$r=0,Nr=1,La=2;function wt(e){let r=e.length;for(;--r>=0;)e[r]=0}const za=0,Dn=1,Ma=2,Da=3,Oa=258,xr=29,Dt=256,Tt=Dt+1+xr,ut=30,kr=19,On=2*Tt+1,je=15,qt=16,Ua=7,Ar=256,Un=16,Rn=17,$n=18,ur=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Jt=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Ra=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Nn=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$a=512,Ge=new Array((Tt+2)*2);wt(Ge);const xt=new Array(ut*2);wt(xt);const It=new Array($a);wt(It);const Ct=new Array(Oa-Da+1);wt(Ct);const Er=new Array(xr);wt(Er);const Gt=new Array(ut);wt(Gt);function jt(e,r,t,n,i){this.static_tree=e,this.extra_bits=r,this.extra_base=t,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}let Zn,Fn,Hn;function er(e,r){this.dyn_tree=e,this.max_code=0,this.stat_desc=r}const Xn=e=>e<256?It[e]:It[256+(e>>>7)],St=(e,r)=>{e.pending_buf[e.pending++]=r&255,e.pending_buf[e.pending++]=r>>>8&255},Me=(e,r,t)=>{e.bi_valid>qt-t?(e.bi_buf|=r<<e.bi_valid&65535,St(e,e.bi_buf),e.bi_buf=r>>qt-e.bi_valid,e.bi_valid+=t-qt):(e.bi_buf|=r<<e.bi_valid&65535,e.bi_valid+=t)},Ze=(e,r,t)=>{Me(e,t[r*2],t[r*2+1])},Yn=(e,r)=>{let t=0;do t|=e&1,e>>>=1,t<<=1;while(--r>0);return t>>>1},Na=e=>{e.bi_valid===16?(St(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},Za=(e,r)=>{const t=r.dyn_tree,n=r.max_code,i=r.stat_desc.static_tree,a=r.stat_desc.has_stree,v=r.stat_desc.extra_bits,l=r.stat_desc.extra_base,g=r.stat_desc.max_length;let f,y,se,X,S,Y,j=0;for(X=0;X<=je;X++)e.bl_count[X]=0;for(t[e.heap[e.heap_max]*2+1]=0,f=e.heap_max+1;f<On;f++)y=e.heap[f],X=t[t[y*2+1]*2+1]+1,X>g&&(X=g,j++),t[y*2+1]=X,!(y>n)&&(e.bl_count[X]++,S=0,y>=l&&(S=v[y-l]),Y=t[y*2],e.opt_len+=Y*(X+S),a&&(e.static_len+=Y*(i[y*2+1]+S)));if(j!==0){do{for(X=g-1;e.bl_count[X]===0;)X--;e.bl_count[X]--,e.bl_count[X+1]+=2,e.bl_count[g]--,j-=2}while(j>0);for(X=g;X!==0;X--)for(y=e.bl_count[X];y!==0;)se=e.heap[--f],!(se>n)&&(t[se*2+1]!==X&&(e.opt_len+=(X-t[se*2+1])*t[se*2],t[se*2+1]=X),y--)}},Jn=(e,r,t)=>{const n=new Array(je+1);let i=0,a,v;for(a=1;a<=je;a++)i=i+t[a-1]<<1,n[a]=i;for(v=0;v<=r;v++){let l=e[v*2+1];l!==0&&(e[v*2]=Yn(n[l]++,l))}},Fa=()=>{let e,r,t,n,i;const a=new Array(je+1);for(t=0,n=0;n<xr-1;n++)for(Er[n]=t,e=0;e<1<<ur[n];e++)Ct[t++]=n;for(Ct[t-1]=n,i=0,n=0;n<16;n++)for(Gt[n]=i,e=0;e<1<<Jt[n];e++)It[i++]=n;for(i>>=7;n<ut;n++)for(Gt[n]=i<<7,e=0;e<1<<Jt[n]-7;e++)It[256+i++]=n;for(r=0;r<=je;r++)a[r]=0;for(e=0;e<=143;)Ge[e*2+1]=8,e++,a[8]++;for(;e<=255;)Ge[e*2+1]=9,e++,a[9]++;for(;e<=279;)Ge[e*2+1]=7,e++,a[7]++;for(;e<=287;)Ge[e*2+1]=8,e++,a[8]++;for(Jn(Ge,Tt+1,a),e=0;e<ut;e++)xt[e*2+1]=5,xt[e*2]=Yn(e,5);Zn=new jt(Ge,ur,Dt+1,Tt,je),Fn=new jt(xt,Jt,0,ut,je),Hn=new jt(new Array(0),Ra,0,kr,Ua)},Gn=e=>{let r;for(r=0;r<Tt;r++)e.dyn_ltree[r*2]=0;for(r=0;r<ut;r++)e.dyn_dtree[r*2]=0;for(r=0;r<kr;r++)e.bl_tree[r*2]=0;e.dyn_ltree[Ar*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Vn=e=>{e.bi_valid>8?St(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Zr=(e,r,t,n)=>{const i=r*2,a=t*2;return e[i]<e[a]||e[i]===e[a]&&n[r]<=n[t]},tr=(e,r,t)=>{const n=e.heap[t];let i=t<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Zr(r,e.heap[i+1],e.heap[i],e.depth)&&i++,!Zr(r,n,e.heap[i],e.depth));)e.heap[t]=e.heap[i],t=i,i<<=1;e.heap[t]=n},Fr=(e,r,t)=>{let n,i,a=0,v,l;if(e.sym_next!==0)do n=e.pending_buf[e.sym_buf+a++]&255,n+=(e.pending_buf[e.sym_buf+a++]&255)<<8,i=e.pending_buf[e.sym_buf+a++],n===0?Ze(e,i,r):(v=Ct[i],Ze(e,v+Dt+1,r),l=ur[v],l!==0&&(i-=Er[v],Me(e,i,l)),n--,v=Xn(n),Ze(e,v,t),l=Jt[v],l!==0&&(n-=Gt[v],Me(e,n,l)));while(a<e.sym_next);Ze(e,Ar,r)},dr=(e,r)=>{const t=r.dyn_tree,n=r.stat_desc.static_tree,i=r.stat_desc.has_stree,a=r.stat_desc.elems;let v,l,g=-1,f;for(e.heap_len=0,e.heap_max=On,v=0;v<a;v++)t[v*2]!==0?(e.heap[++e.heap_len]=g=v,e.depth[v]=0):t[v*2+1]=0;for(;e.heap_len<2;)f=e.heap[++e.heap_len]=g<2?++g:0,t[f*2]=1,e.depth[f]=0,e.opt_len--,i&&(e.static_len-=n[f*2+1]);for(r.max_code=g,v=e.heap_len>>1;v>=1;v--)tr(e,t,v);f=a;do v=e.heap[1],e.heap[1]=e.heap[e.heap_len--],tr(e,t,1),l=e.heap[1],e.heap[--e.heap_max]=v,e.heap[--e.heap_max]=l,t[f*2]=t[v*2]+t[l*2],e.depth[f]=(e.depth[v]>=e.depth[l]?e.depth[v]:e.depth[l])+1,t[v*2+1]=t[l*2+1]=f,e.heap[1]=f++,tr(e,t,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Za(e,r),Jn(t,g,e.bl_count)},Hr=(e,r,t)=>{let n,i=-1,a,v=r[0*2+1],l=0,g=7,f=4;for(v===0&&(g=138,f=3),r[(t+1)*2+1]=65535,n=0;n<=t;n++)a=v,v=r[(n+1)*2+1],!(++l<g&&a===v)&&(l<f?e.bl_tree[a*2]+=l:a!==0?(a!==i&&e.bl_tree[a*2]++,e.bl_tree[Un*2]++):l<=10?e.bl_tree[Rn*2]++:e.bl_tree[$n*2]++,l=0,i=a,v===0?(g=138,f=3):a===v?(g=6,f=3):(g=7,f=4))},Xr=(e,r,t)=>{let n,i=-1,a,v=r[0*2+1],l=0,g=7,f=4;for(v===0&&(g=138,f=3),n=0;n<=t;n++)if(a=v,v=r[(n+1)*2+1],!(++l<g&&a===v)){if(l<f)do Ze(e,a,e.bl_tree);while(--l!==0);else a!==0?(a!==i&&(Ze(e,a,e.bl_tree),l--),Ze(e,Un,e.bl_tree),Me(e,l-3,2)):l<=10?(Ze(e,Rn,e.bl_tree),Me(e,l-3,3)):(Ze(e,$n,e.bl_tree),Me(e,l-11,7));l=0,i=a,v===0?(g=138,f=3):a===v?(g=6,f=3):(g=7,f=4)}},Ha=e=>{let r;for(Hr(e,e.dyn_ltree,e.l_desc.max_code),Hr(e,e.dyn_dtree,e.d_desc.max_code),dr(e,e.bl_desc),r=kr-1;r>=3&&e.bl_tree[Nn[r]*2+1]===0;r--);return e.opt_len+=3*(r+1)+5+5+4,r},Xa=(e,r,t,n)=>{let i;for(Me(e,r-257,5),Me(e,t-1,5),Me(e,n-4,4),i=0;i<n;i++)Me(e,e.bl_tree[Nn[i]*2+1],3);Xr(e,e.dyn_ltree,r-1),Xr(e,e.dyn_dtree,t-1)},Ya=e=>{let r=4093624447,t;for(t=0;t<=31;t++,r>>>=1)if(r&1&&e.dyn_ltree[t*2]!==0)return $r;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Nr;for(t=32;t<Dt;t++)if(e.dyn_ltree[t*2]!==0)return Nr;return $r};let Yr=!1;const Ja=e=>{Yr||(Fa(),Yr=!0),e.l_desc=new er(e.dyn_ltree,Zn),e.d_desc=new er(e.dyn_dtree,Fn),e.bl_desc=new er(e.bl_tree,Hn),e.bi_buf=0,e.bi_valid=0,Gn(e)},Kn=(e,r,t,n)=>{Me(e,(za<<1)+(n?1:0),3),Vn(e),St(e,t),St(e,~t),t&&e.pending_buf.set(e.window.subarray(r,r+t),e.pending),e.pending+=t},Ga=e=>{Me(e,Dn<<1,3),Ze(e,Ar,Ge),Na(e)},Va=(e,r,t,n)=>{let i,a,v=0;e.level>0?(e.strm.data_type===La&&(e.strm.data_type=Ya(e)),dr(e,e.l_desc),dr(e,e.d_desc),v=Ha(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=t+5,t+4<=i&&r!==-1?Kn(e,r,t,n):e.strategy===Pa||a===i?(Me(e,(Dn<<1)+(n?1:0),3),Fr(e,Ge,xt)):(Me(e,(Ma<<1)+(n?1:0),3),Xa(e,e.l_desc.max_code+1,e.d_desc.max_code+1,v+1),Fr(e,e.dyn_ltree,e.dyn_dtree)),Gn(e),n&&Vn(e)},Ka=(e,r,t)=>(e.pending_buf[e.sym_buf+e.sym_next++]=r,e.pending_buf[e.sym_buf+e.sym_next++]=r>>8,e.pending_buf[e.sym_buf+e.sym_next++]=t,r===0?e.dyn_ltree[t*2]++:(e.matches++,r--,e.dyn_ltree[(Ct[t]+Dt+1)*2]++,e.dyn_dtree[Xn(r)*2]++),e.sym_next===e.sym_end);var Ba=Ja,Wa=Kn,Qa=Va,qa=Ka,ja=Ga,ei={_tr_init:Ba,_tr_stored_block:Wa,_tr_flush_block:Qa,_tr_tally:qa,_tr_align:ja};const ti=(e,r,t,n)=>{let i=e&65535|0,a=e>>>16&65535|0,v=0;for(;t!==0;){v=t>2e3?2e3:t,t-=v;do i=i+r[n++]|0,a=a+i|0;while(--v);i%=65521,a%=65521}return i|a<<16|0};var Pt=ti;const ri=()=>{let e,r=[];for(var t=0;t<256;t++){e=t;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;r[t]=e}return r},ni=new Uint32Array(ri()),ai=(e,r,t,n)=>{const i=ni,a=n+t;e^=-1;for(let v=n;v<a;v++)e=e>>>8^i[(e^r[v])&255];return e^-1};var Pe=ai,rt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},it={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:ii,_tr_stored_block:_r,_tr_flush_block:si,_tr_tally:We,_tr_align:li}=ei,{Z_NO_FLUSH:Qe,Z_PARTIAL_FLUSH:oi,Z_FULL_FLUSH:ci,Z_FINISH:Ue,Z_BLOCK:Jr,Z_OK:Le,Z_STREAM_END:Gr,Z_STREAM_ERROR:Fe,Z_DATA_ERROR:hi,Z_BUF_ERROR:rr,Z_DEFAULT_COMPRESSION:fi,Z_FILTERED:vi,Z_HUFFMAN_ONLY:Zt,Z_RLE:ui,Z_FIXED:di,Z_DEFAULT_STRATEGY:_i,Z_UNKNOWN:wi,Z_DEFLATED:Bt}=it,pi=9,gi=15,mi=8,bi=29,yi=256,wr=yi+1+bi,xi=30,ki=19,Ai=2*wr+1,Ei=15,ke=3,Be=258,He=Be+ke+1,Ti=32,dt=42,Tr=57,pr=69,gr=73,mr=91,br=103,et=113,bt=666,ze=1,pt=2,nt=3,gt=4,Ii=3,tt=(e,r)=>(e.msg=rt[r],r),Vr=e=>e*2-(e>4?9:0),Ke=e=>{let r=e.length;for(;--r>=0;)e[r]=0},Ci=e=>{let r,t,n,i=e.w_size;r=e.hash_size,n=r;do t=e.head[--n],e.head[n]=t>=i?t-i:0;while(--r);r=i,n=r;do t=e.prev[--n],e.prev[n]=t>=i?t-i:0;while(--r)};let Si=(e,r,t)=>(r<<e.hash_shift^t)&e.hash_mask,qe=Si;const De=e=>{const r=e.state;let t=r.pending;t>e.avail_out&&(t=e.avail_out),t!==0&&(e.output.set(r.pending_buf.subarray(r.pending_out,r.pending_out+t),e.next_out),e.next_out+=t,r.pending_out+=t,e.total_out+=t,e.avail_out-=t,r.pending-=t,r.pending===0&&(r.pending_out=0))},Oe=(e,r)=>{si(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,r),e.block_start=e.strstart,De(e.strm)},Te=(e,r)=>{e.pending_buf[e.pending++]=r},mt=(e,r)=>{e.pending_buf[e.pending++]=r>>>8&255,e.pending_buf[e.pending++]=r&255},yr=(e,r,t,n)=>{let i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,r.set(e.input.subarray(e.next_in,e.next_in+i),t),e.state.wrap===1?e.adler=Pt(e.adler,r,i,t):e.state.wrap===2&&(e.adler=Pe(e.adler,r,i,t)),e.next_in+=i,e.total_in+=i,i)},Bn=(e,r)=>{let t=e.max_chain_length,n=e.strstart,i,a,v=e.prev_length,l=e.nice_match;const g=e.strstart>e.w_size-He?e.strstart-(e.w_size-He):0,f=e.window,y=e.w_mask,se=e.prev,X=e.strstart+Be;let S=f[n+v-1],Y=f[n+v];e.prev_length>=e.good_match&&(t>>=2),l>e.lookahead&&(l=e.lookahead);do if(i=r,!(f[i+v]!==Y||f[i+v-1]!==S||f[i]!==f[n]||f[++i]!==f[n+1])){n+=2,i++;do;while(f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&n<X);if(a=Be-(X-n),n=X-Be,a>v){if(e.match_start=r,v=a,a>=l)break;S=f[n+v-1],Y=f[n+v]}}while((r=se[r&y])>g&&--t!==0);return v<=e.lookahead?v:e.lookahead},_t=e=>{const r=e.w_size;let t,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=r+(r-He)&&(e.window.set(e.window.subarray(r,r+r-n),0),e.match_start-=r,e.strstart-=r,e.block_start-=r,e.insert>e.strstart&&(e.insert=e.strstart),Ci(e),n+=r),e.strm.avail_in===0)break;if(t=yr(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=t,e.lookahead+e.insert>=ke)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=qe(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=qe(e,e.ins_h,e.window[i+ke-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<ke)););}while(e.lookahead<He&&e.strm.avail_in!==0)},Wn=(e,r)=>{let t=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n,i,a,v=0,l=e.strm.avail_in;do{if(n=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a||(a=e.strm.avail_out-a,i=e.strstart-e.block_start,n>i+e.strm.avail_in&&(n=i+e.strm.avail_in),n>a&&(n=a),n<t&&(n===0&&r!==Ue||r===Qe||n!==i+e.strm.avail_in)))break;v=r===Ue&&n===i+e.strm.avail_in?1:0,_r(e,0,0,v),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,De(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&(yr(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(v===0);return l-=e.strm.avail_in,l&&(l>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=l&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-l,e.strm.next_in),e.strstart),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),v?gt:r!==Qe&&r!==Ue&&e.strm.avail_in===0&&e.strstart===e.block_start?pt:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(yr(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,t=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=t||(i||r===Ue)&&r!==Qe&&e.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,v=r===Ue&&e.strm.avail_in===0&&n===i?1:0,_r(e,e.block_start,n,v),e.block_start+=n,De(e.strm)),v?nt:ze)},nr=(e,r)=>{let t,n;for(;;){if(e.lookahead<He){if(_t(e),e.lookahead<He&&r===Qe)return ze;if(e.lookahead===0)break}if(t=0,e.lookahead>=ke&&(e.ins_h=qe(e,e.ins_h,e.window[e.strstart+ke-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),t!==0&&e.strstart-t<=e.w_size-He&&(e.match_length=Bn(e,t)),e.match_length>=ke)if(n=We(e,e.strstart-e.match_start,e.match_length-ke),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=ke){e.match_length--;do e.strstart++,e.ins_h=qe(e,e.ins_h,e.window[e.strstart+ke-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=qe(e,e.ins_h,e.window[e.strstart+1]);else n=We(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Oe(e,!1),e.strm.avail_out===0))return ze}return e.insert=e.strstart<ke-1?e.strstart:ke-1,r===Ue?(Oe(e,!0),e.strm.avail_out===0?nt:gt):e.sym_next&&(Oe(e,!1),e.strm.avail_out===0)?ze:pt},ht=(e,r)=>{let t,n,i;for(;;){if(e.lookahead<He){if(_t(e),e.lookahead<He&&r===Qe)return ze;if(e.lookahead===0)break}if(t=0,e.lookahead>=ke&&(e.ins_h=qe(e,e.ins_h,e.window[e.strstart+ke-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=ke-1,t!==0&&e.prev_length<e.max_lazy_match&&e.strstart-t<=e.w_size-He&&(e.match_length=Bn(e,t),e.match_length<=5&&(e.strategy===vi||e.match_length===ke&&e.strstart-e.match_start>4096)&&(e.match_length=ke-1)),e.prev_length>=ke&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-ke,n=We(e,e.strstart-1-e.prev_match,e.prev_length-ke),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=qe(e,e.ins_h,e.window[e.strstart+ke-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=ke-1,e.strstart++,n&&(Oe(e,!1),e.strm.avail_out===0))return ze}else if(e.match_available){if(n=We(e,0,e.window[e.strstart-1]),n&&Oe(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return ze}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=We(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<ke-1?e.strstart:ke-1,r===Ue?(Oe(e,!0),e.strm.avail_out===0?nt:gt):e.sym_next&&(Oe(e,!1),e.strm.avail_out===0)?ze:pt},Pi=(e,r)=>{let t,n,i,a;const v=e.window;for(;;){if(e.lookahead<=Be){if(_t(e),e.lookahead<=Be&&r===Qe)return ze;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=ke&&e.strstart>0&&(i=e.strstart-1,n=v[i],n===v[++i]&&n===v[++i]&&n===v[++i])){a=e.strstart+Be;do;while(n===v[++i]&&n===v[++i]&&n===v[++i]&&n===v[++i]&&n===v[++i]&&n===v[++i]&&n===v[++i]&&n===v[++i]&&i<a);e.match_length=Be-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=ke?(t=We(e,1,e.match_length-ke),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(t=We(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),t&&(Oe(e,!1),e.strm.avail_out===0))return ze}return e.insert=0,r===Ue?(Oe(e,!0),e.strm.avail_out===0?nt:gt):e.sym_next&&(Oe(e,!1),e.strm.avail_out===0)?ze:pt},Li=(e,r)=>{let t;for(;;){if(e.lookahead===0&&(_t(e),e.lookahead===0)){if(r===Qe)return ze;break}if(e.match_length=0,t=We(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,t&&(Oe(e,!1),e.strm.avail_out===0))return ze}return e.insert=0,r===Ue?(Oe(e,!0),e.strm.avail_out===0?nt:gt):e.sym_next&&(Oe(e,!1),e.strm.avail_out===0)?ze:pt};function Ne(e,r,t,n,i){this.good_length=e,this.max_lazy=r,this.nice_length=t,this.max_chain=n,this.func=i}const yt=[new Ne(0,0,0,0,Wn),new Ne(4,4,8,4,nr),new Ne(4,5,16,8,nr),new Ne(4,6,32,32,nr),new Ne(4,4,16,16,ht),new Ne(8,16,32,32,ht),new Ne(8,16,128,128,ht),new Ne(8,32,128,256,ht),new Ne(32,128,258,1024,ht),new Ne(32,258,258,4096,ht)],zi=e=>{e.window_size=2*e.w_size,Ke(e.head),e.max_lazy_match=yt[e.level].max_lazy,e.good_match=yt[e.level].good_length,e.nice_match=yt[e.level].nice_length,e.max_chain_length=yt[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ke-1,e.match_available=0,e.ins_h=0};function Mi(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Bt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Ai*2),this.dyn_dtree=new Uint16Array((2*xi+1)*2),this.bl_tree=new Uint16Array((2*ki+1)*2),Ke(this.dyn_ltree),Ke(this.dyn_dtree),Ke(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Ei+1),this.heap=new Uint16Array(2*wr+1),Ke(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*wr+1),Ke(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ot=e=>{if(!e)return 1;const r=e.state;return!r||r.strm!==e||r.status!==dt&&r.status!==Tr&&r.status!==pr&&r.status!==gr&&r.status!==mr&&r.status!==br&&r.status!==et&&r.status!==bt?1:0},Qn=e=>{if(Ot(e))return tt(e,Fe);e.total_in=e.total_out=0,e.data_type=wi;const r=e.state;return r.pending=0,r.pending_out=0,r.wrap<0&&(r.wrap=-r.wrap),r.status=r.wrap===2?Tr:r.wrap?dt:et,e.adler=r.wrap===2?0:1,r.last_flush=-2,ii(r),Le},qn=e=>{const r=Qn(e);return r===Le&&zi(e.state),r},Di=(e,r)=>Ot(e)||e.state.wrap!==2?Fe:(e.state.gzhead=r,Le),jn=(e,r,t,n,i,a)=>{if(!e)return Fe;let v=1;if(r===fi&&(r=6),n<0?(v=0,n=-n):n>15&&(v=2,n-=16),i<1||i>pi||t!==Bt||n<8||n>15||r<0||r>9||a<0||a>di||n===8&&v!==1)return tt(e,Fe);n===8&&(n=9);const l=new Mi;return e.state=l,l.strm=e,l.status=dt,l.wrap=v,l.gzhead=null,l.w_bits=n,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=i+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+ke-1)/ke),l.window=new Uint8Array(l.w_size*2),l.head=new Uint16Array(l.hash_size),l.prev=new Uint16Array(l.w_size),l.lit_bufsize=1<<i+6,l.pending_buf_size=l.lit_bufsize*4,l.pending_buf=new Uint8Array(l.pending_buf_size),l.sym_buf=l.lit_bufsize,l.sym_end=(l.lit_bufsize-1)*3,l.level=r,l.strategy=a,l.method=t,qn(e)},Oi=(e,r)=>jn(e,r,Bt,gi,mi,_i),Ui=(e,r)=>{if(Ot(e)||r>Jr||r<0)return e?tt(e,Fe):Fe;const t=e.state;if(!e.output||e.avail_in!==0&&!e.input||t.status===bt&&r!==Ue)return tt(e,e.avail_out===0?rr:Fe);const n=t.last_flush;if(t.last_flush=r,t.pending!==0){if(De(e),e.avail_out===0)return t.last_flush=-1,Le}else if(e.avail_in===0&&Vr(r)<=Vr(n)&&r!==Ue)return tt(e,rr);if(t.status===bt&&e.avail_in!==0)return tt(e,rr);if(t.status===dt&&t.wrap===0&&(t.status=et),t.status===dt){let i=Bt+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Zt||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,i|=a<<6,t.strstart!==0&&(i|=Ti),i+=31-i%31,mt(t,i),t.strstart!==0&&(mt(t,e.adler>>>16),mt(t,e.adler&65535)),e.adler=1,t.status=et,De(e),t.pending!==0)return t.last_flush=-1,Le}if(t.status===Tr){if(e.adler=0,Te(t,31),Te(t,139),Te(t,8),t.gzhead)Te(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),Te(t,t.gzhead.time&255),Te(t,t.gzhead.time>>8&255),Te(t,t.gzhead.time>>16&255),Te(t,t.gzhead.time>>24&255),Te(t,t.level===9?2:t.strategy>=Zt||t.level<2?4:0),Te(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(Te(t,t.gzhead.extra.length&255),Te(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(e.adler=Pe(e.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=pr;else if(Te(t,0),Te(t,0),Te(t,0),Te(t,0),Te(t,0),Te(t,t.level===9?2:t.strategy>=Zt||t.level<2?4:0),Te(t,Ii),t.status=et,De(e),t.pending!==0)return t.last_flush=-1,Le}if(t.status===pr){if(t.gzhead.extra){let i=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let l=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+l),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>i&&(e.adler=Pe(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=l,De(e),t.pending!==0)return t.last_flush=-1,Le;i=0,a-=l}let v=new Uint8Array(t.gzhead.extra);t.pending_buf.set(v.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>i&&(e.adler=Pe(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=gr}if(t.status===gr){if(t.gzhead.name){let i=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>i&&(e.adler=Pe(e.adler,t.pending_buf,t.pending-i,i)),De(e),t.pending!==0)return t.last_flush=-1,Le;i=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,Te(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(e.adler=Pe(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=mr}if(t.status===mr){if(t.gzhead.comment){let i=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>i&&(e.adler=Pe(e.adler,t.pending_buf,t.pending-i,i)),De(e),t.pending!==0)return t.last_flush=-1,Le;i=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,Te(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(e.adler=Pe(e.adler,t.pending_buf,t.pending-i,i))}t.status=br}if(t.status===br){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(De(e),t.pending!==0))return t.last_flush=-1,Le;Te(t,e.adler&255),Te(t,e.adler>>8&255),e.adler=0}if(t.status=et,De(e),t.pending!==0)return t.last_flush=-1,Le}if(e.avail_in!==0||t.lookahead!==0||r!==Qe&&t.status!==bt){let i=t.level===0?Wn(t,r):t.strategy===Zt?Li(t,r):t.strategy===ui?Pi(t,r):yt[t.level].func(t,r);if((i===nt||i===gt)&&(t.status=bt),i===ze||i===nt)return e.avail_out===0&&(t.last_flush=-1),Le;if(i===pt&&(r===oi?li(t):r!==Jr&&(_r(t,0,0,!1),r===ci&&(Ke(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),De(e),e.avail_out===0))return t.last_flush=-1,Le}return r!==Ue?Le:t.wrap<=0?Gr:(t.wrap===2?(Te(t,e.adler&255),Te(t,e.adler>>8&255),Te(t,e.adler>>16&255),Te(t,e.adler>>24&255),Te(t,e.total_in&255),Te(t,e.total_in>>8&255),Te(t,e.total_in>>16&255),Te(t,e.total_in>>24&255)):(mt(t,e.adler>>>16),mt(t,e.adler&65535)),De(e),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Le:Gr)},Ri=e=>{if(Ot(e))return Fe;const r=e.state.status;return e.state=null,r===et?tt(e,hi):Le},$i=(e,r)=>{let t=r.length;if(Ot(e))return Fe;const n=e.state,i=n.wrap;if(i===2||i===1&&n.status!==dt||n.lookahead)return Fe;if(i===1&&(e.adler=Pt(e.adler,r,t,0)),n.wrap=0,t>=n.w_size){i===0&&(Ke(n.head),n.strstart=0,n.block_start=0,n.insert=0);let g=new Uint8Array(n.w_size);g.set(r.subarray(t-n.w_size,t),0),r=g,t=n.w_size}const a=e.avail_in,v=e.next_in,l=e.input;for(e.avail_in=t,e.next_in=0,e.input=r,_t(n);n.lookahead>=ke;){let g=n.strstart,f=n.lookahead-(ke-1);do n.ins_h=qe(n,n.ins_h,n.window[g+ke-1]),n.prev[g&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=g,g++;while(--f);n.strstart=g,n.lookahead=ke-1,_t(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=ke-1,n.match_available=0,e.next_in=v,e.input=l,e.avail_in=a,n.wrap=i,Le};var Ni=Oi,Zi=jn,Fi=qn,Hi=Qn,Xi=Di,Yi=Ui,Ji=Ri,Gi=$i,Vi="pako deflate (from Nodeca project)",kt={deflateInit:Ni,deflateInit2:Zi,deflateReset:Fi,deflateResetKeep:Hi,deflateSetHeader:Xi,deflate:Yi,deflateEnd:Ji,deflateSetDictionary:Gi,deflateInfo:Vi};const Ki=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);var Bi=function(e){const r=Array.prototype.slice.call(arguments,1);for(;r.length;){const t=r.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const n in t)Ki(t,n)&&(e[n]=t[n])}}return e},Wi=e=>{let r=0;for(let n=0,i=e.length;n<i;n++)r+=e[n].length;const t=new Uint8Array(r);for(let n=0,i=0,a=e.length;n<a;n++){let v=e[n];t.set(v,i),i+=v.length}return t},Wt={assign:Bi,flattenChunks:Wi};let ea=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{ea=!1}const Lt=new Uint8Array(256);for(let e=0;e<256;e++)Lt[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Lt[254]=Lt[254]=1;var Qi=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let r,t,n,i,a,v=e.length,l=0;for(i=0;i<v;i++)t=e.charCodeAt(i),(t&64512)===55296&&i+1<v&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),l+=t<128?1:t<2048?2:t<65536?3:4;for(r=new Uint8Array(l),a=0,i=0;a<l;i++)t=e.charCodeAt(i),(t&64512)===55296&&i+1<v&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),t<128?r[a++]=t:t<2048?(r[a++]=192|t>>>6,r[a++]=128|t&63):t<65536?(r[a++]=224|t>>>12,r[a++]=128|t>>>6&63,r[a++]=128|t&63):(r[a++]=240|t>>>18,r[a++]=128|t>>>12&63,r[a++]=128|t>>>6&63,r[a++]=128|t&63);return r};const qi=(e,r)=>{if(r<65534&&e.subarray&&ea)return String.fromCharCode.apply(null,e.length===r?e:e.subarray(0,r));let t="";for(let n=0;n<r;n++)t+=String.fromCharCode(e[n]);return t};var ji=(e,r)=>{const t=r||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,r));let n,i;const a=new Array(t*2);for(i=0,n=0;n<t;){let v=e[n++];if(v<128){a[i++]=v;continue}let l=Lt[v];if(l>4){a[i++]=65533,n+=l-1;continue}for(v&=l===2?31:l===3?15:7;l>1&&n<t;)v=v<<6|e[n++]&63,l--;if(l>1){a[i++]=65533;continue}v<65536?a[i++]=v:(v-=65536,a[i++]=55296|v>>10&1023,a[i++]=56320|v&1023)}return qi(a,i)},es=(e,r)=>{r=r||e.length,r>e.length&&(r=e.length);let t=r-1;for(;t>=0&&(e[t]&192)===128;)t--;return t<0||t===0?r:t+Lt[e[t]]>r?t:r},zt={string2buf:Qi,buf2string:ji,utf8border:es};function ts(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var ta=ts;const ra=Object.prototype.toString,{Z_NO_FLUSH:rs,Z_SYNC_FLUSH:ns,Z_FULL_FLUSH:as,Z_FINISH:is,Z_OK:Vt,Z_STREAM_END:ss,Z_DEFAULT_COMPRESSION:ls,Z_DEFAULT_STRATEGY:os,Z_DEFLATED:cs}=it;function Ut(e){this.options=Wt.assign({level:ls,method:cs,chunkSize:16384,windowBits:15,memLevel:8,strategy:os},e||{});let r=this.options;r.raw&&r.windowBits>0?r.windowBits=-r.windowBits:r.gzip&&r.windowBits>0&&r.windowBits<16&&(r.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ta,this.strm.avail_out=0;let t=kt.deflateInit2(this.strm,r.level,r.method,r.windowBits,r.memLevel,r.strategy);if(t!==Vt)throw new Error(rt[t]);if(r.header&&kt.deflateSetHeader(this.strm,r.header),r.dictionary){let n;if(typeof r.dictionary=="string"?n=zt.string2buf(r.dictionary):ra.call(r.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(r.dictionary):n=r.dictionary,t=kt.deflateSetDictionary(this.strm,n),t!==Vt)throw new Error(rt[t]);this._dict_set=!0}}Ut.prototype.push=function(e,r){const t=this.strm,n=this.options.chunkSize;let i,a;if(this.ended)return!1;for(r===~~r?a=r:a=r===!0?is:rs,typeof e=="string"?t.input=zt.string2buf(e):ra.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(n),t.next_out=0,t.avail_out=n),(a===ns||a===as)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(i=kt.deflate(t,a),i===ss)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=kt.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Vt;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Ut.prototype.onData=function(e){this.chunks.push(e)};Ut.prototype.onEnd=function(e){e===Vt&&(this.result=Wt.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Ir(e,r){const t=new Ut(r);if(t.push(e,!0),t.err)throw t.msg||rt[t.err];return t.result}function hs(e,r){return r=r||{},r.raw=!0,Ir(e,r)}function fs(e,r){return r=r||{},r.gzip=!0,Ir(e,r)}var vs=Ut,us=Ir,ds=hs,_s=fs,ws=it,ps={Deflate:vs,deflate:us,deflateRaw:ds,gzip:_s,constants:ws};const Ft=16209,gs=16191;var ms=function(r,t){let n,i,a,v,l,g,f,y,se,X,S,Y,j,K,U,Z,F,D,ee,he,B,fe,re,Q;const ae=r.state;n=r.next_in,re=r.input,i=n+(r.avail_in-5),a=r.next_out,Q=r.output,v=a-(t-r.avail_out),l=a+(r.avail_out-257),g=ae.dmax,f=ae.wsize,y=ae.whave,se=ae.wnext,X=ae.window,S=ae.hold,Y=ae.bits,j=ae.lencode,K=ae.distcode,U=(1<<ae.lenbits)-1,Z=(1<<ae.distbits)-1;e:do{Y<15&&(S+=re[n++]<<Y,Y+=8,S+=re[n++]<<Y,Y+=8),F=j[S&U];t:for(;;){if(D=F>>>24,S>>>=D,Y-=D,D=F>>>16&255,D===0)Q[a++]=F&65535;else if(D&16){ee=F&65535,D&=15,D&&(Y<D&&(S+=re[n++]<<Y,Y+=8),ee+=S&(1<<D)-1,S>>>=D,Y-=D),Y<15&&(S+=re[n++]<<Y,Y+=8,S+=re[n++]<<Y,Y+=8),F=K[S&Z];r:for(;;){if(D=F>>>24,S>>>=D,Y-=D,D=F>>>16&255,D&16){if(he=F&65535,D&=15,Y<D&&(S+=re[n++]<<Y,Y+=8,Y<D&&(S+=re[n++]<<Y,Y+=8)),he+=S&(1<<D)-1,he>g){r.msg="invalid distance too far back",ae.mode=Ft;break e}if(S>>>=D,Y-=D,D=a-v,he>D){if(D=he-D,D>y&&ae.sane){r.msg="invalid distance too far back",ae.mode=Ft;break e}if(B=0,fe=X,se===0){if(B+=f-D,D<ee){ee-=D;do Q[a++]=X[B++];while(--D);B=a-he,fe=Q}}else if(se<D){if(B+=f+se-D,D-=se,D<ee){ee-=D;do Q[a++]=X[B++];while(--D);if(B=0,se<ee){D=se,ee-=D;do Q[a++]=X[B++];while(--D);B=a-he,fe=Q}}}else if(B+=se-D,D<ee){ee-=D;do Q[a++]=X[B++];while(--D);B=a-he,fe=Q}for(;ee>2;)Q[a++]=fe[B++],Q[a++]=fe[B++],Q[a++]=fe[B++],ee-=3;ee&&(Q[a++]=fe[B++],ee>1&&(Q[a++]=fe[B++]))}else{B=a-he;do Q[a++]=Q[B++],Q[a++]=Q[B++],Q[a++]=Q[B++],ee-=3;while(ee>2);ee&&(Q[a++]=Q[B++],ee>1&&(Q[a++]=Q[B++]))}}else if(D&64){r.msg="invalid distance code",ae.mode=Ft;break e}else{F=K[(F&65535)+(S&(1<<D)-1)];continue r}break}}else if(D&64)if(D&32){ae.mode=gs;break e}else{r.msg="invalid literal/length code",ae.mode=Ft;break e}else{F=j[(F&65535)+(S&(1<<D)-1)];continue t}break}}while(n<i&&a<l);ee=Y>>3,n-=ee,Y-=ee<<3,S&=(1<<Y)-1,r.next_in=n,r.next_out=a,r.avail_in=n<i?5+(i-n):5-(n-i),r.avail_out=a<l?257+(l-a):257-(a-l),ae.hold=S,ae.bits=Y};const ft=15,Kr=852,Br=592,Wr=0,ar=1,Qr=2,bs=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ys=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),xs=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),ks=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),As=(e,r,t,n,i,a,v,l)=>{const g=l.bits;let f=0,y=0,se=0,X=0,S=0,Y=0,j=0,K=0,U=0,Z=0,F,D,ee,he,B,fe=null,re;const Q=new Uint16Array(ft+1),ae=new Uint16Array(ft+1);let Ae=null,Ie,we,C;for(f=0;f<=ft;f++)Q[f]=0;for(y=0;y<n;y++)Q[r[t+y]]++;for(S=g,X=ft;X>=1&&Q[X]===0;X--);if(S>X&&(S=X),X===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,l.bits=1,0;for(se=1;se<X&&Q[se]===0;se++);for(S<se&&(S=se),K=1,f=1;f<=ft;f++)if(K<<=1,K-=Q[f],K<0)return-1;if(K>0&&(e===Wr||X!==1))return-1;for(ae[1]=0,f=1;f<ft;f++)ae[f+1]=ae[f]+Q[f];for(y=0;y<n;y++)r[t+y]!==0&&(v[ae[r[t+y]]++]=y);if(e===Wr?(fe=Ae=v,re=20):e===ar?(fe=bs,Ae=ys,re=257):(fe=xs,Ae=ks,re=0),Z=0,y=0,f=se,B=a,Y=S,j=0,ee=-1,U=1<<S,he=U-1,e===ar&&U>Kr||e===Qr&&U>Br)return 1;for(;;){Ie=f-j,v[y]+1<re?(we=0,C=v[y]):v[y]>=re?(we=Ae[v[y]-re],C=fe[v[y]-re]):(we=96,C=0),F=1<<f-j,D=1<<Y,se=D;do D-=F,i[B+(Z>>j)+D]=Ie<<24|we<<16|C|0;while(D!==0);for(F=1<<f-1;Z&F;)F>>=1;if(F!==0?(Z&=F-1,Z+=F):Z=0,y++,--Q[f]===0){if(f===X)break;f=r[t+v[y]]}if(f>S&&(Z&he)!==ee){for(j===0&&(j=S),B+=se,Y=f-j,K=1<<Y;Y+j<X&&(K-=Q[Y+j],!(K<=0));)Y++,K<<=1;if(U+=1<<Y,e===ar&&U>Kr||e===Qr&&U>Br)return 1;ee=Z&he,i[ee]=S<<24|Y<<16|B-a|0}}return Z!==0&&(i[B+Z]=f-j<<24|64<<16|0),l.bits=S,0};var At=As;const Es=0,na=1,aa=2,{Z_FINISH:qr,Z_BLOCK:Ts,Z_TREES:Ht,Z_OK:at,Z_STREAM_END:Is,Z_NEED_DICT:Cs,Z_STREAM_ERROR:Re,Z_DATA_ERROR:ia,Z_MEM_ERROR:sa,Z_BUF_ERROR:Ss,Z_DEFLATED:jr}=it,Qt=16180,en=16181,tn=16182,rn=16183,nn=16184,an=16185,sn=16186,ln=16187,on=16188,cn=16189,Kt=16190,Je=16191,ir=16192,hn=16193,sr=16194,fn=16195,vn=16196,un=16197,dn=16198,Xt=16199,Yt=16200,_n=16201,wn=16202,pn=16203,gn=16204,mn=16205,lr=16206,bn=16207,yn=16208,Se=16209,la=16210,oa=16211,Ps=852,Ls=592,zs=15,Ms=zs,xn=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function Ds(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const st=e=>{if(!e)return 1;const r=e.state;return!r||r.strm!==e||r.mode<Qt||r.mode>oa?1:0},ca=e=>{if(st(e))return Re;const r=e.state;return e.total_in=e.total_out=r.total=0,e.msg="",r.wrap&&(e.adler=r.wrap&1),r.mode=Qt,r.last=0,r.havedict=0,r.flags=-1,r.dmax=32768,r.head=null,r.hold=0,r.bits=0,r.lencode=r.lendyn=new Int32Array(Ps),r.distcode=r.distdyn=new Int32Array(Ls),r.sane=1,r.back=-1,at},ha=e=>{if(st(e))return Re;const r=e.state;return r.wsize=0,r.whave=0,r.wnext=0,ca(e)},fa=(e,r)=>{let t;if(st(e))return Re;const n=e.state;return r<0?(t=0,r=-r):(t=(r>>4)+5,r<48&&(r&=15)),r&&(r<8||r>15)?Re:(n.window!==null&&n.wbits!==r&&(n.window=null),n.wrap=t,n.wbits=r,ha(e))},va=(e,r)=>{if(!e)return Re;const t=new Ds;e.state=t,t.strm=e,t.window=null,t.mode=Qt;const n=fa(e,r);return n!==at&&(e.state=null),n},Os=e=>va(e,Ms);let kn=!0,or,cr;const Us=e=>{if(kn){or=new Int32Array(512),cr=new Int32Array(32);let r=0;for(;r<144;)e.lens[r++]=8;for(;r<256;)e.lens[r++]=9;for(;r<280;)e.lens[r++]=7;for(;r<288;)e.lens[r++]=8;for(At(na,e.lens,0,288,or,0,e.work,{bits:9}),r=0;r<32;)e.lens[r++]=5;At(aa,e.lens,0,32,cr,0,e.work,{bits:5}),kn=!1}e.lencode=or,e.lenbits=9,e.distcode=cr,e.distbits=5},ua=(e,r,t,n)=>{let i;const a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),n>=a.wsize?(a.window.set(r.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(r.subarray(t-n,t-n+i),a.wnext),n-=i,n?(a.window.set(r.subarray(t-n,t),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},Rs=(e,r)=>{let t,n,i,a,v,l,g,f,y,se,X,S,Y,j,K=0,U,Z,F,D,ee,he,B,fe;const re=new Uint8Array(4);let Q,ae;const Ae=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(st(e)||!e.output||!e.input&&e.avail_in!==0)return Re;t=e.state,t.mode===Je&&(t.mode=ir),v=e.next_out,i=e.output,g=e.avail_out,a=e.next_in,n=e.input,l=e.avail_in,f=t.hold,y=t.bits,se=l,X=g,fe=at;e:for(;;)switch(t.mode){case Qt:if(t.wrap===0){t.mode=ir;break}for(;y<16;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}if(t.wrap&2&&f===35615){t.wbits===0&&(t.wbits=15),t.check=0,re[0]=f&255,re[1]=f>>>8&255,t.check=Pe(t.check,re,2,0),f=0,y=0,t.mode=en;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((f&255)<<8)+(f>>8))%31){e.msg="incorrect header check",t.mode=Se;break}if((f&15)!==jr){e.msg="unknown compression method",t.mode=Se;break}if(f>>>=4,y-=4,B=(f&15)+8,t.wbits===0&&(t.wbits=B),B>15||B>t.wbits){e.msg="invalid window size",t.mode=Se;break}t.dmax=1<<t.wbits,t.flags=0,e.adler=t.check=1,t.mode=f&512?cn:Je,f=0,y=0;break;case en:for(;y<16;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}if(t.flags=f,(t.flags&255)!==jr){e.msg="unknown compression method",t.mode=Se;break}if(t.flags&57344){e.msg="unknown header flags set",t.mode=Se;break}t.head&&(t.head.text=f>>8&1),t.flags&512&&t.wrap&4&&(re[0]=f&255,re[1]=f>>>8&255,t.check=Pe(t.check,re,2,0)),f=0,y=0,t.mode=tn;case tn:for(;y<32;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}t.head&&(t.head.time=f),t.flags&512&&t.wrap&4&&(re[0]=f&255,re[1]=f>>>8&255,re[2]=f>>>16&255,re[3]=f>>>24&255,t.check=Pe(t.check,re,4,0)),f=0,y=0,t.mode=rn;case rn:for(;y<16;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}t.head&&(t.head.xflags=f&255,t.head.os=f>>8),t.flags&512&&t.wrap&4&&(re[0]=f&255,re[1]=f>>>8&255,t.check=Pe(t.check,re,2,0)),f=0,y=0,t.mode=nn;case nn:if(t.flags&1024){for(;y<16;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}t.length=f,t.head&&(t.head.extra_len=f),t.flags&512&&t.wrap&4&&(re[0]=f&255,re[1]=f>>>8&255,t.check=Pe(t.check,re,2,0)),f=0,y=0}else t.head&&(t.head.extra=null);t.mode=an;case an:if(t.flags&1024&&(S=t.length,S>l&&(S=l),S&&(t.head&&(B=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(n.subarray(a,a+S),B)),t.flags&512&&t.wrap&4&&(t.check=Pe(t.check,n,S,a)),l-=S,a+=S,t.length-=S),t.length))break e;t.length=0,t.mode=sn;case sn:if(t.flags&2048){if(l===0)break e;S=0;do B=n[a+S++],t.head&&B&&t.length<65536&&(t.head.name+=String.fromCharCode(B));while(B&&S<l);if(t.flags&512&&t.wrap&4&&(t.check=Pe(t.check,n,S,a)),l-=S,a+=S,B)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=ln;case ln:if(t.flags&4096){if(l===0)break e;S=0;do B=n[a+S++],t.head&&B&&t.length<65536&&(t.head.comment+=String.fromCharCode(B));while(B&&S<l);if(t.flags&512&&t.wrap&4&&(t.check=Pe(t.check,n,S,a)),l-=S,a+=S,B)break e}else t.head&&(t.head.comment=null);t.mode=on;case on:if(t.flags&512){for(;y<16;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}if(t.wrap&4&&f!==(t.check&65535)){e.msg="header crc mismatch",t.mode=Se;break}f=0,y=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=Je;break;case cn:for(;y<32;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}e.adler=t.check=xn(f),f=0,y=0,t.mode=Kt;case Kt:if(t.havedict===0)return e.next_out=v,e.avail_out=g,e.next_in=a,e.avail_in=l,t.hold=f,t.bits=y,Cs;e.adler=t.check=1,t.mode=Je;case Je:if(r===Ts||r===Ht)break e;case ir:if(t.last){f>>>=y&7,y-=y&7,t.mode=lr;break}for(;y<3;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}switch(t.last=f&1,f>>>=1,y-=1,f&3){case 0:t.mode=hn;break;case 1:if(Us(t),t.mode=Xt,r===Ht){f>>>=2,y-=2;break e}break;case 2:t.mode=vn;break;case 3:e.msg="invalid block type",t.mode=Se}f>>>=2,y-=2;break;case hn:for(f>>>=y&7,y-=y&7;y<32;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}if((f&65535)!==(f>>>16^65535)){e.msg="invalid stored block lengths",t.mode=Se;break}if(t.length=f&65535,f=0,y=0,t.mode=sr,r===Ht)break e;case sr:t.mode=fn;case fn:if(S=t.length,S){if(S>l&&(S=l),S>g&&(S=g),S===0)break e;i.set(n.subarray(a,a+S),v),l-=S,a+=S,g-=S,v+=S,t.length-=S;break}t.mode=Je;break;case vn:for(;y<14;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}if(t.nlen=(f&31)+257,f>>>=5,y-=5,t.ndist=(f&31)+1,f>>>=5,y-=5,t.ncode=(f&15)+4,f>>>=4,y-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=Se;break}t.have=0,t.mode=un;case un:for(;t.have<t.ncode;){for(;y<3;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}t.lens[Ae[t.have++]]=f&7,f>>>=3,y-=3}for(;t.have<19;)t.lens[Ae[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,Q={bits:t.lenbits},fe=At(Es,t.lens,0,19,t.lencode,0,t.work,Q),t.lenbits=Q.bits,fe){e.msg="invalid code lengths set",t.mode=Se;break}t.have=0,t.mode=dn;case dn:for(;t.have<t.nlen+t.ndist;){for(;K=t.lencode[f&(1<<t.lenbits)-1],U=K>>>24,Z=K>>>16&255,F=K&65535,!(U<=y);){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}if(F<16)f>>>=U,y-=U,t.lens[t.have++]=F;else{if(F===16){for(ae=U+2;y<ae;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}if(f>>>=U,y-=U,t.have===0){e.msg="invalid bit length repeat",t.mode=Se;break}B=t.lens[t.have-1],S=3+(f&3),f>>>=2,y-=2}else if(F===17){for(ae=U+3;y<ae;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}f>>>=U,y-=U,B=0,S=3+(f&7),f>>>=3,y-=3}else{for(ae=U+7;y<ae;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}f>>>=U,y-=U,B=0,S=11+(f&127),f>>>=7,y-=7}if(t.have+S>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=Se;break}for(;S--;)t.lens[t.have++]=B}}if(t.mode===Se)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=Se;break}if(t.lenbits=9,Q={bits:t.lenbits},fe=At(na,t.lens,0,t.nlen,t.lencode,0,t.work,Q),t.lenbits=Q.bits,fe){e.msg="invalid literal/lengths set",t.mode=Se;break}if(t.distbits=6,t.distcode=t.distdyn,Q={bits:t.distbits},fe=At(aa,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,Q),t.distbits=Q.bits,fe){e.msg="invalid distances set",t.mode=Se;break}if(t.mode=Xt,r===Ht)break e;case Xt:t.mode=Yt;case Yt:if(l>=6&&g>=258){e.next_out=v,e.avail_out=g,e.next_in=a,e.avail_in=l,t.hold=f,t.bits=y,ms(e,X),v=e.next_out,i=e.output,g=e.avail_out,a=e.next_in,n=e.input,l=e.avail_in,f=t.hold,y=t.bits,t.mode===Je&&(t.back=-1);break}for(t.back=0;K=t.lencode[f&(1<<t.lenbits)-1],U=K>>>24,Z=K>>>16&255,F=K&65535,!(U<=y);){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}if(Z&&!(Z&240)){for(D=U,ee=Z,he=F;K=t.lencode[he+((f&(1<<D+ee)-1)>>D)],U=K>>>24,Z=K>>>16&255,F=K&65535,!(D+U<=y);){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}f>>>=D,y-=D,t.back+=D}if(f>>>=U,y-=U,t.back+=U,t.length=F,Z===0){t.mode=mn;break}if(Z&32){t.back=-1,t.mode=Je;break}if(Z&64){e.msg="invalid literal/length code",t.mode=Se;break}t.extra=Z&15,t.mode=_n;case _n:if(t.extra){for(ae=t.extra;y<ae;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}t.length+=f&(1<<t.extra)-1,f>>>=t.extra,y-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=wn;case wn:for(;K=t.distcode[f&(1<<t.distbits)-1],U=K>>>24,Z=K>>>16&255,F=K&65535,!(U<=y);){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}if(!(Z&240)){for(D=U,ee=Z,he=F;K=t.distcode[he+((f&(1<<D+ee)-1)>>D)],U=K>>>24,Z=K>>>16&255,F=K&65535,!(D+U<=y);){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}f>>>=D,y-=D,t.back+=D}if(f>>>=U,y-=U,t.back+=U,Z&64){e.msg="invalid distance code",t.mode=Se;break}t.offset=F,t.extra=Z&15,t.mode=pn;case pn:if(t.extra){for(ae=t.extra;y<ae;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}t.offset+=f&(1<<t.extra)-1,f>>>=t.extra,y-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=Se;break}t.mode=gn;case gn:if(g===0)break e;if(S=X-g,t.offset>S){if(S=t.offset-S,S>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=Se;break}S>t.wnext?(S-=t.wnext,Y=t.wsize-S):Y=t.wnext-S,S>t.length&&(S=t.length),j=t.window}else j=i,Y=v-t.offset,S=t.length;S>g&&(S=g),g-=S,t.length-=S;do i[v++]=j[Y++];while(--S);t.length===0&&(t.mode=Yt);break;case mn:if(g===0)break e;i[v++]=t.length,g--,t.mode=Yt;break;case lr:if(t.wrap){for(;y<32;){if(l===0)break e;l--,f|=n[a++]<<y,y+=8}if(X-=g,e.total_out+=X,t.total+=X,t.wrap&4&&X&&(e.adler=t.check=t.flags?Pe(t.check,i,X,v-X):Pt(t.check,i,X,v-X)),X=g,t.wrap&4&&(t.flags?f:xn(f))!==t.check){e.msg="incorrect data check",t.mode=Se;break}f=0,y=0}t.mode=bn;case bn:if(t.wrap&&t.flags){for(;y<32;){if(l===0)break e;l--,f+=n[a++]<<y,y+=8}if(t.wrap&4&&f!==(t.total&4294967295)){e.msg="incorrect length check",t.mode=Se;break}f=0,y=0}t.mode=yn;case yn:fe=Is;break e;case Se:fe=ia;break e;case la:return sa;case oa:default:return Re}return e.next_out=v,e.avail_out=g,e.next_in=a,e.avail_in=l,t.hold=f,t.bits=y,(t.wsize||X!==e.avail_out&&t.mode<Se&&(t.mode<lr||r!==qr))&&ua(e,e.output,e.next_out,X-e.avail_out),se-=e.avail_in,X-=e.avail_out,e.total_in+=se,e.total_out+=X,t.total+=X,t.wrap&4&&X&&(e.adler=t.check=t.flags?Pe(t.check,i,X,e.next_out-X):Pt(t.check,i,X,e.next_out-X)),e.data_type=t.bits+(t.last?64:0)+(t.mode===Je?128:0)+(t.mode===Xt||t.mode===sr?256:0),(se===0&&X===0||r===qr)&&fe===at&&(fe=Ss),fe},$s=e=>{if(st(e))return Re;let r=e.state;return r.window&&(r.window=null),e.state=null,at},Ns=(e,r)=>{if(st(e))return Re;const t=e.state;return t.wrap&2?(t.head=r,r.done=!1,at):Re},Zs=(e,r)=>{const t=r.length;let n,i,a;return st(e)||(n=e.state,n.wrap!==0&&n.mode!==Kt)?Re:n.mode===Kt&&(i=1,i=Pt(i,r,t,0),i!==n.check)?ia:(a=ua(e,r,t,t),a?(n.mode=la,sa):(n.havedict=1,at))};var Fs=ha,Hs=fa,Xs=ca,Ys=Os,Js=va,Gs=Rs,Vs=$s,Ks=Ns,Bs=Zs,Ws="pako inflate (from Nodeca project)",Ve={inflateReset:Fs,inflateReset2:Hs,inflateResetKeep:Xs,inflateInit:Ys,inflateInit2:Js,inflate:Gs,inflateEnd:Vs,inflateGetHeader:Ks,inflateSetDictionary:Bs,inflateInfo:Ws};function Qs(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var qs=Qs;const da=Object.prototype.toString,{Z_NO_FLUSH:js,Z_FINISH:el,Z_OK:Mt,Z_STREAM_END:hr,Z_NEED_DICT:fr,Z_STREAM_ERROR:tl,Z_DATA_ERROR:An,Z_MEM_ERROR:rl}=it;function Rt(e){this.options=Wt.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const r=this.options;r.raw&&r.windowBits>=0&&r.windowBits<16&&(r.windowBits=-r.windowBits,r.windowBits===0&&(r.windowBits=-15)),r.windowBits>=0&&r.windowBits<16&&!(e&&e.windowBits)&&(r.windowBits+=32),r.windowBits>15&&r.windowBits<48&&(r.windowBits&15||(r.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ta,this.strm.avail_out=0;let t=Ve.inflateInit2(this.strm,r.windowBits);if(t!==Mt)throw new Error(rt[t]);if(this.header=new qs,Ve.inflateGetHeader(this.strm,this.header),r.dictionary&&(typeof r.dictionary=="string"?r.dictionary=zt.string2buf(r.dictionary):da.call(r.dictionary)==="[object ArrayBuffer]"&&(r.dictionary=new Uint8Array(r.dictionary)),r.raw&&(t=Ve.inflateSetDictionary(this.strm,r.dictionary),t!==Mt)))throw new Error(rt[t])}Rt.prototype.push=function(e,r){const t=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let a,v,l;if(this.ended)return!1;for(r===~~r?v=r:v=r===!0?el:js,da.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(n),t.next_out=0,t.avail_out=n),a=Ve.inflate(t,v),a===fr&&i&&(a=Ve.inflateSetDictionary(t,i),a===Mt?a=Ve.inflate(t,v):a===An&&(a=fr));t.avail_in>0&&a===hr&&t.state.wrap>0&&e[t.next_in]!==0;)Ve.inflateReset(t),a=Ve.inflate(t,v);switch(a){case tl:case An:case fr:case rl:return this.onEnd(a),this.ended=!0,!1}if(l=t.avail_out,t.next_out&&(t.avail_out===0||a===hr))if(this.options.to==="string"){let g=zt.utf8border(t.output,t.next_out),f=t.next_out-g,y=zt.buf2string(t.output,g);t.next_out=f,t.avail_out=n-f,f&&t.output.set(t.output.subarray(g,g+f),0),this.onData(y)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===Mt&&l===0)){if(a===hr)return a=Ve.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Rt.prototype.onData=function(e){this.chunks.push(e)};Rt.prototype.onEnd=function(e){e===Mt&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Wt.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Cr(e,r){const t=new Rt(r);if(t.push(e),t.err)throw t.msg||rt[t.err];return t.result}function nl(e,r){return r=r||{},r.raw=!0,Cr(e,r)}var al=Rt,il=Cr,sl=nl,ll=Cr,ol=it,cl={Inflate:al,inflate:il,inflateRaw:sl,ungzip:ll,constants:ol};const{Deflate:hl,deflate:fl,deflateRaw:vl,gzip:ul}=ps,{Inflate:dl,inflate:_l,inflateRaw:wl,ungzip:pl}=cl;var gl=hl,ml=fl,bl=vl,yl=ul,xl=dl,kl=_l,Al=wl,El=pl,Tl=it,_a={Deflate:gl,deflate:ml,deflateRaw:bl,gzip:yl,Inflate:xl,inflate:kl,inflateRaw:Al,ungzip:El,constants:Tl};const Il=Xe("decodeGzip");Ye(Il,async e=>{const r=_a.inflate(e);return{value:r,transfer:[r.buffer]}});const Cl=Xe("decodePng");/**
 * @license
 * Copyright 2022 William Silvermsith
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const En={emscripten_notify_memory_growth:()=>{},proc_exit:e=>{throw`proc exit: ${e}`}},Sl=(async()=>{const e=(await WebAssembly.instantiateStreaming(fetch(new URL(""+new URL("libpng-Chxj7rK9.wasm",import.meta.url).href,import.meta.url)),{env:En,wasi_snapshot_preview1:En})).instance;return e.exports._initialize(),e})(),vr=[137,80,78,71,13,10,26,10],Pl=["I","H","D","R"];function Ll(e){function r(U,Z){return U.every((F,D)=>F===Z[D])}if(e.length<12)throw new Error("png: Invalid image size: {buffer.length}");if(!r(vr,e))throw new Error("png: didn't match magic numbers: {buffer.slice(0,8)}");const n=new DataView(e.buffer,vr.length),i=n.getUint32(0,!1);if(e.length<vr.length+i+12)throw new Error("png: Invalid image size: {buffer.length}");const v=[4,5,6,7].map(U=>String.fromCharCode(n.getUint8(U)));if(!r(v,Pl))throw new Error(`png: Invalid header code (should be IHDR): ${v}`);const l=n.getUint32(8,!1),g=n.getUint32(12,!1),f=n.getUint8(16),y=n.getUint8(17),se=n.getUint8(18),X=n.getUint8(19),S=n.getUint8(20);if(l===0||g===0)throw new Error(`png: 0 is not a valid width or height. width: ${l} height: ${g}`);if(se!==0)throw new Error(`png: Invalid compression method Only 0 is supported (DEFLATE). Got: ${se}`);if(X!==0)throw new Error(`png: Invalid filter method. Only 0 (adaptive filtering) is supported. Got: ${X}`);if(S>1)throw new Error(`png: invalid interlace method. Only 0 (no interlace) and 1 (adam7) are supported. Got: ${S}`);const Y=[1,2,4,8,16];if(Y.indexOf(f)===-1)throw new Error(`png: invalid bit depth. Got: ${f} Valid Depths: ${Y}`);let j=f<=8?1:2,K=1;if(y!==0)if(y===2){if(f!==8&&f!==16)throw new Error(`png: invalid bit depth for RGB colorspace. Got: ${f}`);K=3}else if(y===3)j=1,K=3;else if(y===6){if(f!==8&&f!==16)throw new Error(`png: invalid bit depth for RGBA colorspace. Got: ${f}`);K=4}else if(y===4){if(f!==8&&f!==16)throw new Error(`png: invalid bit depth for grayscale + alpha channel colorspace. Got: ${f}`);K=4}else throw new Error(`png: Invalid color space: ${y}`);return{sx:l,sy:g,dataWidth:j,numChannels:K}}async function zl(e,r,t,n,i,a){const v=await Sl;let{sx:l,sy:g,dataWidth:f,numChannels:y}=Ll(e);if(a&&(f=1,y=1),r!==void 0&&l!==r||t!==void 0&&g!==t||n!==void 0&&n!==y||i!==f)throw new Error(`png: Image decode parameters did not match expected chunk parameters.
         Expected: width: ${r} height: ${t} channels: ${n} bytes per pixel: ${i} 
         Decoded:  width: ${l} height: ${g} channels: ${y} bytes per pixel: ${f}
         Convert to Grayscale? ${a}
        `);const se=l*g*f*y;if(se<0)throw new Error(`png: Failed to decode png image size. image size: ${se}`);const X=v.exports.malloc(e.byteLength),S=v.exports.malloc(se);new Uint8Array(v.exports.memory.buffer).set(e,X);const j=v.exports.png_decompress(X,e.byteLength,S,se,a);try{if(j!==0)throw new Error(`png: Failed to decode png image. decoder code: ${j}`);const K=new Uint8Array(v.exports.memory.buffer,S,se);return{width:l,height:g,numComponents:y,uint8Array:K.slice(0)}}finally{v.exports.free(X),v.exports.free(S)}}Ye(Cl,async(e,r,t,n,i,a)=>{const v=await zl(e,r,t,n,i,a);return{value:v,transfer:[v.uint8Array.buffer]}});const Ml=Xe("decodeBlosc");Ye(Ml,async e=>{const{default:r}=await import("./blosc-I2b7moDt.js"),n=await r.fromConfig({id:"blosc"}).decode(e);return{value:n,transfer:[n.buffer]}});const Dl=Xe("decodeZstd");Ye(Dl,async e=>{const{default:r}=await import("./zstd-t6yMuxkO.js"),n=await r.fromConfig({id:"blosc"}).decode(e);return{value:n,transfer:[n.buffer]}});const Ol=Xe("parseOBJFromArrayBuffer");/**
 * @license
 * Copyright 2016 Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ul{constructor(r=16){this.length=0,this.data=new Float32Array(r)}resize(r){const{data:t}=this;if(r>t.length){const n=new Float32Array(Math.max(r,t.length*2));n.set(t.subarray(0,this.length)),this.data=n}this.length=r}get view(){const{data:r}=this;return new Float32Array(r.buffer,r.byteOffset,this.length)}shrinkToFit(){this.data=new Float32Array(this.view)}clear(){this.length=0}appendArray(r){const{length:t}=this;this.resize(t+r.length),this.data.set(r,t)}eraseRange(r,t){this.data.copyWithin(r,t,this.length),this.length-=t-r}}function Rl(e){const r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return r.length>2&&r[0]===31&&r[1]===139}function wa(e){let r;return e instanceof ArrayBuffer?r=new Uint8Array(e):r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Rl(r)?_a.inflate(r):r}Ye(Ol,async e=>{e=wa(e);let r=new TextDecoder().decode(e);r=r.replace(/#.*/g,"");const t=new Ul,n=new Mn;for(const v of r.matchAll(/^v\s+([-0-9.eE]+)\s+([-0-9.eE]+)\s+([-0-9.eE]+)\s*$/gm))t.appendArray([parseFloat(v[1]),parseFloat(v[2]),parseFloat(v[3])]);for(const v of r.matchAll(/^f\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s*$/gm))n.appendArray([parseInt(v[1],10)-1,parseInt(v[2],10)-1,parseInt(v[3],10)-1]);t.shrinkToFit(),n.shrinkToFit();const i={info:{numVertices:t.length/3,numTriangles:n.length/3,vertexAttributes:[]},vertexPositions:t.view,indices:n.view,vertexAttributes:[]},a=i.vertexPositions.byteLength+i.indices.byteLength;return console.log(i),{value:{data:i,size:a},transfer:[i.indices.buffer,i.vertexPositions.buffer]}});const $l=Xe("decodeCompresso");/**
 * @license
 * Copyright 2021 William Silvermsith
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Tn={emscripten_notify_memory_growth:()=>{},proc_exit:e=>{throw`proc exit: ${e}`}},Nl=(async()=>{const e=(await WebAssembly.instantiateStreaming(fetch(new URL(""+new URL("compresso-fyb2BI_u.wasm",import.meta.url).href,import.meta.url)),{env:Tn,wasi_snapshot_preview1:Tn})).instance;return e.exports._initialize(),e})();function Zl(e){if(!(e[0]===99&&e[1]===112&&e[2]===115&&e[3]===111))throw new Error("compresso: didn't match magic numbers");if(e[4]>1)throw new Error("compresso: didn't match format version");const n=new DataView(e.buffer,0),i=e[5],a=n.getUint16(6,!0),v=n.getUint16(8,!0),l=n.getUint16(10,!0);return{sx:a,sy:v,sz:l,dataWidth:i}}async function Fl(e){const r=await Nl,{sx:t,sy:n,sz:i,dataWidth:a}=Zl(e),v=t*n*i,l=v*a;if(l<0)throw new Error(`Failed to decode compresso image. image size: ${l}`);const g=r.exports.malloc(l),f=r.exports.malloc(e.byteLength);new Uint8Array(r.exports.memory.buffer).set(e,f);const se=r.exports.compresso_decompress(f,e.byteLength,g);try{if(se!==0)throw new Error(`Failed to decode compresso image. decoder code: ${se}`);return new Uint8Array(r.exports.memory.buffer,g,v*a).slice(0)}finally{r.exports.free(f),r.exports.free(g)}}Ye($l,async e=>{const r=await Fl(e);return{value:r,transfer:[r.buffer]}});const Hl=Xe("parseVTKFromArrayBuffer");/**
 * @license
 * Copyright 2016 Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Xl=1e3,Yl=/^[ \t]*#[ \t]+vtk[ \t]+DataFile[ \t]+Version[ \t]+([^\s]+)[ \t]*\n(.*)\n[ \t]*(ASCII|BINARY)[ \t]*\n[ \t]*DATASET[ \t]+([^ ]+)[ \t]*\n/,Jl=/^[ \t]*POINT_DATA[ \t]+([0-9]+)[ \t]*$/,Gl=/^[ \t]*POINTS[ \t]+([0-9]+)[ \t]+([^\s]+)[ \t]*$/,Vl=/^[ \t]*SCALARS[ \t]+([^\s]+)[ \t]+([^\s]+)(?:[ \t]+([0-9]+))?[ \t]*$/,Kl=/^[ \t]*LOOKUP_TABLE[ \t]+([^\s]+)[ \t]*$/,Bl=/^[ \t]*POLYGONS[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]*$/,Wl=/^[ \t]*3[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]*$/,In=/^[ \t]*$/;class Ql{constructor(r,t,n,i,a,v){this.header=r,this.numVertices=t,this.vertexPositions=n,this.numTriangles=i,this.indices=a,this.vertexAttributes=v}}function ql(e){let r=e.vertexPositions.byteLength+e.indices.byteLength;for(const t of e.vertexAttributes)r+=t.data.byteLength;return r}function jl(e,r){const i=new TextDecoder().decode(r).split(`
`),a=i.length;let v=0,l=-1,g,f=-1,y;const se=new Array;function X(U,Z,F,D){const ee=RegExp("^[ 	]*"+"([^s]+)[ 	]+".repeat(F-1)+"([^s]+)[ 	]*$");if(a-v<Z)throw new Error(`VTK data ended unexpectedly while parsing ${U}.`);const he=new Float32Array(Z*F);let B=0;for(let fe=0;fe<Z;++fe){const re=i[v++],Q=re.match(ee);if(Q===null)throw new Error(`Failed to parse ${U} line ${fe}: ${JSON.stringify(re)}.`);for(let ae=0;ae<F;++ae)he[B++]=parseFloat(Q[ae+1])}return he}function S(U,Z){if(y!==void 0)throw new Error("POINTS specified more than once.");l=U,g=X("POINTS",U,3)}function Y(U,Z){if(y!==void 0)throw new Error("VERTICES specified more than once.");if(a-v<U)throw new Error("VTK data ended unexpectedly");if(Z!==U*4)throw new Error("Only triangular faces are supported.");f=U,y=new Uint32Array(U*3);let F=0;for(let D=0;D<U;++D){const ee=i[v++].match(Wl);if(ee===null)throw new Error(`Failed to parse indices for face ${D}`);y[F++]=parseInt(ee[1],10),y[F++]=parseInt(ee[2],10),y[F++]=parseInt(ee[3],10)}}function j(U,Z,F){if(v===a)throw new Error("Expected LOOKUP_TABLE directive.");const D=i[v++],ee=D.match(Kl);if(ee===null)throw new Error(`Expected LOOKUP_TABLE directive in ${JSON.stringify(D)}.`);const he=ee[1],B=X(`SCALARS(${U})`,l,F);se.push({name:U,data:B,numComponents:F,dataType:Z,tableName:he})}function K(U){if(l!==U)throw new Error(`Number of vertices specified in POINT_DATA section (${U}) must match number of points (${l}).`);for(;v<a;){const Z=i[v];if(Z.match(In)){++v;continue}const F=Z.match(Vl);if(F!==null){let D;F[3]===void 0?D=1:D=parseInt(F[3],10),++v,j(F[1],F[2],D)}}}for(;v<a;){const U=i[v];if(U.match(In)){++v;continue}let Z;if(Z=U.match(Gl),Z!==null){++v,S(parseInt(Z[1],10),Z[2]);continue}if(Z=U.match(Bl),Z!==null){++v,Y(parseInt(Z[1],10),parseInt(Z[2],10));continue}if(Z=U.match(Jl),Z!==null){++v,K(parseInt(Z[1],10));break}throw new Error(`Failed to parse VTK line ${JSON.stringify(U)}.`)}if(g===void 0)throw new Error("Vertex positions not specified.");if(y===void 0)throw new Error("Indices not specified.");return new Ql(e,l,g,f,y,se)}const eo=new Map([["POLYDATA",jl]]);function to(e){const n=new TextDecoder().decode(new Uint8Array(e.buffer,e.byteOffset,Math.min(e.byteLength,Xl))).match(Yl);if(n===null)throw new Error("Failed to parse VTK file header.");const i=n[0].length,a=n[4],v=n[3],l={version:n[1],comment:n[2],datasetType:a,dataFormat:v},g=new Uint8Array(e.buffer,e.byteOffset+i,e.byteLength-i);if(v==="ASCII"){const f=eo.get(a);if(f===void 0)throw new Error(`VTK dataset type ${JSON.stringify(a)} is not supported.`);return f(l,g)}throw new Error(`VTK data format ${JSON.stringify(v)} is not supported.`)}Ye(Hl,async e=>{const r=to(wa(e));return{value:{data:r,size:ql(r)},transfer:[r.indices.buffer,r.vertexPositions.buffer,...Array.from(r.vertexAttributes.values()).map(t=>t.data.buffer)]}});
