var mr={3941:(le,Je,ge)=>{le.exports=ge.p+"compresso.0d45ed2ede4537f701f8.wasm"},3200:(le,Je,ge)=>{le.exports=ge.p+"libpng.4e1203f419dab329d4f3.wasm"},8483:(le,Je,ge)=>{/**
 * @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 Ee(c){return{id:c}}/**
 * @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 Se=Ee("encodeCompressedSegmentationUint32"),Ue=Ee("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 Fe=new Map;function He(c){self.onmessage=f=>{const{t:h,id:l,args:I}=f.data;Fe.get(h)(...I).then(({value:P,transfer:y})=>c.postMessage({id:l,value:P},{transfer:y}),P=>c.postMessage({id:l,error:P instanceof Error?P.message:P.toString()}))},self.postMessage(null)}He(self);function De(c,f){Fe.set(c.id,f)}/**
 * @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 Ve=2;function gr(){return new Map}function wr(c,f,h,l,I,x){if(I>0)switch(I){case 1:for(let P=0,y=0;P<x;++P){let g=0;g|=l[h[y+0]]<<0,g|=l[h[y+1]]<<1,g|=l[h[y+2]]<<2,g|=l[h[y+3]]<<3,g|=l[h[y+4]]<<4,g|=l[h[y+5]]<<5,g|=l[h[y+6]]<<6,g|=l[h[y+7]]<<7,g|=l[h[y+8]]<<8,g|=l[h[y+9]]<<9,g|=l[h[y+10]]<<10,g|=l[h[y+11]]<<11,g|=l[h[y+12]]<<12,g|=l[h[y+13]]<<13,g|=l[h[y+14]]<<14,g|=l[h[y+15]]<<15,g|=l[h[y+16]]<<16,g|=l[h[y+17]]<<17,g|=l[h[y+18]]<<18,g|=l[h[y+19]]<<19,g|=l[h[y+20]]<<20,g|=l[h[y+21]]<<21,g|=l[h[y+22]]<<22,g|=l[h[y+23]]<<23,g|=l[h[y+24]]<<24,g|=l[h[y+25]]<<25,g|=l[h[y+26]]<<26,g|=l[h[y+27]]<<27,g|=l[h[y+28]]<<28,g|=l[h[y+29]]<<29,g|=l[h[y+30]]<<30,g|=l[h[y+31]]<<31,c[f+P]=g,y+=32}break;case 2:for(let P=0,y=0;P<x;++P){let g=0;g|=l[h[y+0]]<<0,g|=l[h[y+1]]<<2,g|=l[h[y+2]]<<4,g|=l[h[y+3]]<<6,g|=l[h[y+4]]<<8,g|=l[h[y+5]]<<10,g|=l[h[y+6]]<<12,g|=l[h[y+7]]<<14,g|=l[h[y+8]]<<16,g|=l[h[y+9]]<<18,g|=l[h[y+10]]<<20,g|=l[h[y+11]]<<22,g|=l[h[y+12]]<<24,g|=l[h[y+13]]<<26,g|=l[h[y+14]]<<28,g|=l[h[y+15]]<<30,c[f+P]=g,y+=16}break;case 4:for(let P=0,y=0;P<x;++P){let g=0;g|=l[h[y+0]]<<0,g|=l[h[y+1]]<<4,g|=l[h[y+2]]<<8,g|=l[h[y+3]]<<12,g|=l[h[y+4]]<<16,g|=l[h[y+5]]<<20,g|=l[h[y+6]]<<24,g|=l[h[y+7]]<<28,c[f+P]=g,y+=8}break;case 8:for(let P=0,y=0;P<x;++P){let g=0;g|=l[h[y+0]]<<0,g|=l[h[y+1]]<<8,g|=l[h[y+2]]<<16,g|=l[h[y+3]]<<24,c[f+P]=g,y+=4}break;case 16:for(let P=0,y=0;P<x;++P){let g=0;g|=l[h[y+0]]<<0,g|=l[h[y+1]]<<16,c[f+P]=g,y+=2}break;case 32:for(let P=0,y=0;P<x;++P){let g=0;g|=l[h[y+0]]<<0,c[f+P]=g,y+=1}break}}function Ke(c,f,h,l,I,x,P,y,g){let z;if(I===1)z=0;else for(z=1;1<<z<I;)z*=2;const N=Math.ceil(z*l/32),te=c.length;let Ae=N,de=!1;const me=Array.prototype.join.call(x.subarray(0,I*g),",");let K=h.get(me);K===void 0&&(de=!0,Ae+=I*g,K=te+N-f,h.set(me,K)),c.resize(te+Ae);const ie=c.data;if(wr(ie,te,P,y,z,N),de){let X=te+N;for(let G=0,Z=I*g;G<Z;++G)ie[X++]=x[G]}return[z,K]}function dr(c,f,h,l,I,x,P){const y=gr(),g=new Array(3);let z=Ve;for(let we=0;we<3;++we){const be=g[we]=Math.ceil(l[we]/f[we]);z*=be}const N=g[0],te=g[1],Ae=g[2],de=l[0],me=l[1],K=l[2],ie=f[0],X=f[1],G=f[2],Z=c.length;let ue=Z;const ce=[0,0,0];c.resize(Z+z);const Te=x[0],he=x[1],Ce=x[2];for(let we=0;we<Ae;++we){ce[2]=Math.min(G,K-we*G);for(let be=0;be<te;++be){ce[1]=Math.min(X,me-be*X);for(let ye=0;ye<N;++ye){ce[0]=Math.min(ie,de-ye*ie);const _e=we*G*Ce+be*X*he+ye*ie*Te,Me=c.length-Z,[pe,M]=P(h,I+_e,x,f,ce,Z,y,c),O=c.data;O[ue++]=M|pe<<24,O[ue++]=Me}}}}function Re(c,f,h,l,I,x,P){const y=c.length,g=l[3];c.resize(y+g);for(let z=0;z<g;++z)c.data[y+z]=c.length,dr(c,f,h,l,I+x[3]*z,x,P)}/**
 * @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.
 */function nt(c,f,h,l){for(;f<h;){const I=c[f];if(l(I)){++f;continue}--h,c[f]=c[h],c[h]=I}return h}function at(c,f){const h=c.length;let l=0;for(let I=0;I<h;++I)f(c[I],I,c)&&(c[l]=c[I],++l);c.length=l}function it(c,f){if(c.length===f)return c;const h=new c.constructor(f);return h.set(c),h}function qe(c,f=1){const h=c.length,l=new Array(h);let I=l[0]=f;for(let x=1;x<h;++x)I*=c[x-1],l[x]=I;return l}function yr(c,f,h){const l=new c.constructor(c.length);for(let I=0;I<f*h;I+=h)for(let x=0;x<h;x++){const P=I/h;l[x*f+P]=c[I+x]}return l}function st(c,f,h,l){const I=c.length/f,x=c.length*h*l,P=new c.constructor(x),y=c.length*l,g=f,z=f*l;for(let N=0;N<I;++N)for(let te=0;te<f;++te){const Ae=c[N*f+te],de=N*z+te;for(let me=0;me<h;++me)for(let K=0;K<l;++K)P[me*y+K*g+de]=Ae}return P}function ot(c,f,h,l=0,I=c.length){for(;l<I;){const x=l+I-1>>1,P=h(f,c[x]);if(P>0)l=x+1;else if(P<0)I=x;else return x}return~l}function lt(c,f,h){let l=f-c;for(;l>0;){const I=Math.floor(l/2),x=c+I;h(x)?l=I:(c=x+1,l-=I+1)}return c}function br(c,f){const h=[];for(let l=0,I=c.length;l<I;++l)c[l]===f&&h.push(l);return h}function ct(c,f){const h=[];h.length=f;for(const l of c)h[l]=!0;return br(h,void 0)}function ht(c,f){const h=c.length;if(f.length!==h)return!1;for(let l=0;l<h;++l)if(c[l]!==f[l])return!1;return!0}function vt(c,f,h=(l,I)=>l===I){const l=c.length;if(f.length!==l)return!1;for(let I=0;I<l;++I)if(!h(c[I],f[I]))return!1;return!0}function ft(c,f,h){const l=[];if(h===f){for(let I=0;I<c;++I)l[I]=I;return l}l[h]=f;for(let I=0,x=0;I<c;){if(I===f){++I;continue}x===h&&++x,l[x++]=I++}return l}function ut(c,f,h){for(let l=0,I=h.length;l<I;++l){const x=h[l];x!==-1&&(c[x]=f[l])}return c}function mt(c,f,h){for(let l=0,I=h.length;l<I;++l){const x=h[l];x!==-1&&(c[l]=f[x])}return c}function pt(c){const f=[];for(let h=0,l=c.length;h<l;++h){const I=c[h];for(let x=0,P=I.length;x<P;++x){let y=f[x];y===void 0&&(y=f[x]=[]),y.push(I[x])}}return f}function gt(c,f){const h=[];let l=0;for(let x=0,P=f.length;x<P;++x){const{retainCount:y,deleteCount:g,insertCount:z}=f[x];y!==0&&(h.push(c.slice(l,l+y)),l+=y),l+=g,z!==0&&h.push(new Array(z))}const I=c.length;return l!==I&&h.push(c.slice(l)),new Array(0).concat(...h)}function wt(c,f,h){const l=[];let I=0,x=0;const P=c.length,y=f.length;for(;I<P&&x<y;){let g;const z=c[I],N=f[x];if(g=h(z,N),g===0){let te=1;for(++I,++x;I<P&&x<y&&(g=h(c[I],f[x]))===0;)++te,++I,++x;l.push({retainCount:te,deleteCount:0,insertCount:0});continue}if(g<0){let te=1;for(;++I<P&&(g=h(c[I],N))<0;)++te;l.push({retainCount:0,deleteCount:te,insertCount:0});continue}if(g>0){let te=1;for(;++x<y&&(g=h(z,f[x]))>0;)++te;l.push({retainCount:0,deleteCount:0,insertCount:te})}}return(I<P||x<y)&&l.push({retainCount:0,deleteCount:P-I,insertCount:y-x}),l}function dt(c,f,h){const l=[];let I=0,x=0;const P=c.length,y=f.length;for(;I<P;){let g=0;for(;I<P&&x<y&&h(c[I],f[x]);)++g,++I,++x;g!==0&&l.push({retainCount:g,deleteCount:0,insertCount:0});let z=0;for(;I<P&&(x===y||!h(c[I],f[x]));)++z,++I;z!==0&&l.push({retainCount:0,deleteCount:z,insertCount:0})}return x!==y&&l.push({retainCount:0,deleteCount:0,insertCount:y-x}),l}function yt(c,f,h,l,I,x){let P=0,y=0;if(c!==0&&f!==0)for(;;){const g=h(P,y);if(g<0){if(l(P),++P===c)break}else if(g>0){if(I(y),++y===f)break}else if(x(P,y),++P,++y,P===c||y===f)break}for(;P<c;)l(P),++P;for(;y<f;)I(y),++y}/**
 * @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.
 */let Ne,Be,je,er,rr;const Xe=1;function tr(c,f,h,l,I,x,P,y){const g=I[0],z=I[1],N=I[2],te=l[0],Ae=l[1],de=l[2],me=h[0];let K=h[1],ie=h[2];if(ie-=K*z,K-=me*g,g*z*N===0)return[0,0];const X=te*Ae*de+31;(Ne===void 0||Ne.length<X)&&(Ne=new Uint32Array(X),Be=new Uint32Array(X*Xe),je=new Uint32Array(X*Xe),er=new Uint32Array(X),rr=new Uint32Array(X));const G=Ne.subarray(0,X);G.fill(0);const Z=Be,ue=je,ce=er,Te=rr;let he=0;{let we=c[f]+1>>>0,be=f,ye=0;const _e=te-g,Me=te*Ae-te*z;for(let pe=0;pe<N;++pe,be+=ie,ye+=Me)for(let M=0;M<z;++M,be+=K,ye+=_e)for(let O=0;O<g;++O,be+=me){const Y=c[be];Y!==we&&(we=Z[he*1]=Y,ce[he]=he++),G[ye++]=he}}ce.subarray(0,he).sort((we,be)=>Z[we]-Z[be]);let Ce=-1;{let we=Z[ce[0]*Xe]+1>>>0;for(let be=0;be<he;++be){const ye=ce[be],_e=ye*Xe,Me=Z[_e];if(Me!==we){++Ce;const pe=Ce*Xe;we=ue[pe]=Me}Te[ye+1]=Ce}++Ce}return Ke(y,x,P,te*Ae*de,Ce,ue,G,Te,Xe)}function bt(c,f,h,l,I=0,x=getFortranOrderStrides(l,1)){return encodeChannelCommon(c,f,h,l,I,x,tr)}function Cr(c,f,h,l,I=0,x=qe(l,1)){return Re(c,f,h,l,I,x,tr)}/**
 * @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.
 */let Ze,nr,ar,ir,sr;const Ge=2;function or(c,f,h,l,I,x,P,y){const g=I[0],z=I[1],N=I[2],te=l[0],Ae=l[1],de=l[2],me=h[0];let K=h[1],ie=h[2];if(ie-=K*z,K-=me*g,g*z*N===0)return[0,0];const X=te*Ae*de+31;(Ze===void 0||Ze.length<X)&&(Ze=new Uint32Array(X),nr=new Uint32Array(X*Ge),ar=new Uint32Array(X*Ge),ir=new Uint32Array(X),sr=new Uint32Array(X));const G=Ze.subarray(0,X);G.fill(0);const Z=nr,ue=ar,ce=ir,Te=sr;let he=0;{let we=c[f]+1>>>0,be=0,ye=f,_e=0;const Me=te-g,pe=te*Ae-te*z;for(let M=0;M<N;++M,ye+=ie,_e+=pe)for(let O=0;O<z;++O,ye+=K,_e+=Me)for(let Y=0;Y<g;++Y,ye+=me){const J=c[ye],k=c[ye+1];(J!==we||k!==be)&&(we=Z[he*2]=J,be=Z[he*2+1]=k,ce[he]=he++),G[_e++]=he}}ce.subarray(0,he).sort((we,be)=>{const ye=Z[2*we+1],_e=Z[2*be+1],Me=Z[2*we],pe=Z[2*be];return ye-_e||Me-pe});let Ce=-1;{let we=Z[ce[0]*Ge]+1>>>0,be=0;for(let ye=0;ye<he;++ye){const _e=ce[ye],Me=_e*Ge,pe=Z[Me],M=Z[Me+1];if(pe!==we||M!==be){++Ce;const O=Ce*Ge;we=ue[O]=pe,be=ue[O+1]=M}Te[_e+1]=Ce}++Ce}return Ke(y,x,P,te*Ae*de,Ce,ue,G,Te,Ge)}function Ct(c,f,h,l,I=0,x=getFortranOrderStrides(l,2)){return encodeChannelCommon(c,f,h,l,I,x,or)}function xr(c,f,h,l,I=0,x=qe(l,2)){return Re(c,f,h,l,I,x,or)}/**
 * @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 lr{constructor(f=16){this.length=0,this.data=new Uint32Array(f)}resize(f){const{data:h}=this;if(f>h.length){const l=new Uint32Array(Math.max(f,h.length*2));l.set(h.subarray(0,this.length)),this.data=l}this.length=f}get view(){const{data:f}=this;return new Uint32Array(f.buffer,f.byteOffset,this.length)}shrinkToFit(){this.data=new Uint32Array(this.view)}clear(){this.length=0}appendArray(f){const{length:h}=this;this.resize(h+f.length),this.data.set(f,h)}eraseRange(f,h){this.data.copyWithin(f,h,this.length),this.length-=h-f}}/**
 * @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 $e=new lr(2e4);De(Se,async(c,f,h)=>($e.clear(),Cr($e,h,c,f),{value:$e.view})),De(Ue,async(c,f,h)=>($e.clear(),xr($e,h,c,f),{value:$e.view}));/**
 * @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 Ir=Ee("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.
 */function Pr(c,f){if(c.indexOf("data:")===0){for(var h=c.indexOf("base64,")+7,l=atob(c.substring(h)),I=new Uint8Array(l.length),x=l.length-1;x>=0;x--)I[x]=l.charCodeAt(x);f(I.buffer);return}var P=new XMLHttpRequest;P.open("GET",c,!0),P.responseType="arraybuffer",P.onload=function(){f(P.response)},P.send(null)}var xt=function(){function f(){this._src=null,this._parser=new Ye.JpegImage,this.onload=null}return f.prototype={get src(){return this._src},set src(h){this.load(h)},get width(){return this._parser.width},get height(){return this._parser.height},load:function(l){this._src=l,Pr(l,function(I){this.parse(new Uint8Array(I)),this.onload&&this.onload()}.bind(this))},parse:function(h){this._parser.parse(h)},getData:function(h,l){return this._parser.getData(h,l,!1)},copyToImageData:function(l){if(this._parser.numComponents===2||this._parser.numComponents>4)throw new Error("Unsupported amount of components");var I=l.width,x=l.height,P=I*x*4,y=l.data,g,z;if(this._parser.numComponents===1){var N=this._parser.getData(I,x,!1);for(g=0,z=0;g<P;){var te=N[z++];y[g++]=te,y[g++]=te,y[g++]=te,y[g++]=255}return}var Ae=this._parser.getData(I,x,!0);for(g=0,z=0;g<P;)y[g++]=Ae[z++],y[g++]=Ae[z++],y[g++]=Ae[z++],y[g++]=255}},f}(),Ye;(function(c){"use strict";var f=function(){var me=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]),K=4017,ie=799,X=3406,G=2276,Z=1567,ue=3784,ce=5793,Te=2896;function he(){}function Ce(pe,M){for(var O=0,Y=[],J,k,se=16;se>0&&!pe[se-1];)se--;Y.push({children:[],index:0});var j=Y[0],A;for(J=0;J<se;J++){for(k=0;k<pe[J];k++){for(j=Y.pop(),j.children[j.index]=M[O];j.index>0;)j=Y.pop();for(j.index++,Y.push(j);Y.length<=J;)Y.push(A={children:[],index:0}),j.children[j.index]=A.children,j=A;O++}J+1<se&&(Y.push(A={children:[],index:0}),j.children[j.index]=A.children,j=A)}return Y[0].children}function we(pe,M,O){return 64*((pe.blocksPerLine+1)*M+O)}function be(pe,M,O,Y,J,k,se,j,A){var L=O.precision,T=O.samplesPerLine,v=O.scanLines,r=O.mcusPerLine,m=O.progressive,e=O.maxH,s=O.maxV,p=M,n=0,a=0;function t(){if(a>0)return a--,n>>a&1;if(n=pe[M++],n===255){var V=pe[M++];if(V)throw"unexpected marker: "+(n<<8|V).toString(16)}return a=7,n>>>7}function i(V){for(var ae=V;;){if(ae=ae[t()],typeof ae=="number")return ae;if(typeof ae!="object")throw"invalid huffman sequence"}}function o(V){for(var ae=0;V>0;)ae=ae<<1|t(),V--;return ae}function u(V){if(V===1)return t()===1?1:-1;var ae=o(V);return ae>=1<<V-1?ae:ae+(-1<<V)+1}function C(V,ae){var B=i(V.huffmanTableDC),xe=B===0?0:u(B);V.blockData[ae]=V.pred+=xe;for(var fe=1;fe<64;){var ne=i(V.huffmanTableAC),ke=ne&15,Oe=ne>>4;if(ke===0){if(Oe<15)break;fe+=16;continue}fe+=Oe;var ze=me[fe];V.blockData[ae+ze]=u(ke),fe++}}function _(V,ae){var B=i(V.huffmanTableDC),xe=B===0?0:u(B)<<A;V.blockData[ae]=V.pred+=xe}function w(V,ae){V.blockData[ae]|=t()<<A}var b=0;function d(V,ae){if(b>0){b--;return}for(var B=k,xe=se;B<=xe;){var fe=i(V.huffmanTableAC),ne=fe&15,ke=fe>>4;if(ne===0){if(ke<15){b=o(ke)+(1<<ke)-1;break}B+=16;continue}B+=ke;var Oe=me[B];V.blockData[ae+Oe]=u(ne)*(1<<A),B++}}var S=0,D;function U(V,ae){for(var B=k,xe=se,fe=0,ne,ke;B<=xe;){var Oe=me[B];switch(S){case 0:if(ke=i(V.huffmanTableAC),ne=ke&15,fe=ke>>4,ne===0)fe<15?(b=o(fe)+(1<<fe),S=4):(fe=16,S=1);else{if(ne!==1)throw"invalid ACn encoding";D=u(ne),S=fe?2:3}continue;case 1:case 2:V.blockData[ae+Oe]?V.blockData[ae+Oe]+=t()<<A:(fe--,fe===0&&(S=S===2?3:0));break;case 3:V.blockData[ae+Oe]?V.blockData[ae+Oe]+=t()<<A:(V.blockData[ae+Oe]=D<<A,S=0);break;case 4:V.blockData[ae+Oe]&&(V.blockData[ae+Oe]+=t()<<A);break}B++}S===4&&(b--,b===0&&(S=0))}function $(V,ae,B,xe,fe){var ne=B/r|0,ke=B%r,Oe=ne*V.v+xe,ze=ke*V.h+fe,We=we(V,Oe,ze);ae(V,We)}function F(V,ae,B){var xe=B/V.blocksPerLine|0,fe=B%V.blocksPerLine,ne=we(V,xe,fe);ae(V,ne)}var q=Y.length,H,E,Q,ee,ve,R;m?k===0?R=j===0?_:w:R=j===0?d:U:R=C;var W=0,oe,re;q===1?re=Y[0].blocksPerLine*Y[0].blocksPerColumn:re=r*O.mcusPerColumn,J||(J=re);for(var Pe,Le;W<re;){for(E=0;E<q;E++)Y[E].pred=0;if(b=0,q===1)for(H=Y[0],ve=0;ve<J;ve++)F(H,R,W),W++;else for(ve=0;ve<J;ve++){for(E=0;E<q;E++)for(H=Y[E],Pe=H.h,Le=H.v,Q=0;Q<Le;Q++)for(ee=0;ee<Pe;ee++)$(H,R,W,Q,ee);W++}if(a=0,oe=pe[M]<<8|pe[M+1],oe<=65280)throw"marker was not found";if(oe>=65488&&oe<=65495)M+=2;else break}return M-p}function ye(pe,M,O){for(var Y=pe.quantizationTable,J=pe.blockData,k,se,j,A,L,T,v,r,m,e,s,p,n,a,t,i,o,u=0;u<64;u+=8){if(m=J[M+u],e=J[M+u+1],s=J[M+u+2],p=J[M+u+3],n=J[M+u+4],a=J[M+u+5],t=J[M+u+6],i=J[M+u+7],m*=Y[u],!(e|s|p|n|a|t|i)){o=ce*m+512>>10,O[u]=o,O[u+1]=o,O[u+2]=o,O[u+3]=o,O[u+4]=o,O[u+5]=o,O[u+6]=o,O[u+7]=o;continue}e*=Y[u+1],s*=Y[u+2],p*=Y[u+3],n*=Y[u+4],a*=Y[u+5],t*=Y[u+6],i*=Y[u+7],k=ce*m+128>>8,se=ce*n+128>>8,j=s,A=t,L=Te*(e-i)+128>>8,r=Te*(e+i)+128>>8,T=p<<4,v=a<<4,k=k+se+1>>1,se=k-se,o=j*ue+A*Z+128>>8,j=j*Z-A*ue+128>>8,A=o,L=L+v+1>>1,v=L-v,r=r+T+1>>1,T=r-T,k=k+A+1>>1,A=k-A,se=se+j+1>>1,j=se-j,o=L*G+r*X+2048>>12,L=L*X-r*G+2048>>12,r=o,o=T*ie+v*K+2048>>12,T=T*K-v*ie+2048>>12,v=o,O[u]=k+r,O[u+7]=k-r,O[u+1]=se+v,O[u+6]=se-v,O[u+2]=j+T,O[u+5]=j-T,O[u+3]=A+L,O[u+4]=A-L}for(var C=0;C<8;++C){if(m=O[C],e=O[C+8],s=O[C+16],p=O[C+24],n=O[C+32],a=O[C+40],t=O[C+48],i=O[C+56],!(e|s|p|n|a|t|i)){o=ce*m+8192>>14,o=o<-2040?0:o>=2024?255:o+2056>>4,J[M+C]=o,J[M+C+8]=o,J[M+C+16]=o,J[M+C+24]=o,J[M+C+32]=o,J[M+C+40]=o,J[M+C+48]=o,J[M+C+56]=o;continue}k=ce*m+2048>>12,se=ce*n+2048>>12,j=s,A=t,L=Te*(e-i)+2048>>12,r=Te*(e+i)+2048>>12,T=p,v=a,k=(k+se+1>>1)+4112,se=k-se,o=j*ue+A*Z+2048>>12,j=j*Z-A*ue+2048>>12,A=o,L=L+v+1>>1,v=L-v,r=r+T+1>>1,T=r-T,k=k+A+1>>1,A=k-A,se=se+j+1>>1,j=se-j,o=L*G+r*X+2048>>12,L=L*X-r*G+2048>>12,r=o,o=T*ie+v*K+2048>>12,T=T*K-v*ie+2048>>12,v=o,m=k+r,i=k-r,e=se+v,t=se-v,s=j+T,a=j-T,p=A+L,n=A-L,m=m<16?0:m>=4080?255:m>>4,e=e<16?0:e>=4080?255:e>>4,s=s<16?0:s>=4080?255:s>>4,p=p<16?0:p>=4080?255:p>>4,n=n<16?0:n>=4080?255:n>>4,a=a<16?0:a>=4080?255:a>>4,t=t<16?0:t>=4080?255:t>>4,i=i<16?0:i>=4080?255:i>>4,J[M+C]=m,J[M+C+8]=e,J[M+C+16]=s,J[M+C+24]=p,J[M+C+32]=n,J[M+C+40]=a,J[M+C+48]=t,J[M+C+56]=i}}function _e(pe,M){for(var O=M.blocksPerLine,Y=M.blocksPerColumn,J=new Int16Array(64),k=0;k<Y;k++)for(var se=0;se<O;se++){var j=we(M,k,se);ye(M,j,J)}return M.blockData}function Me(pe){return pe<=0?0:pe>=255?255:pe}return he.prototype={parse:function(M){function O(){var B=M[k]<<8|M[k+1];return k+=2,B}function Y(){var B=O(),xe=M.subarray(k,k+B-2);return k+=xe.length,xe}function J(B){for(var xe=Math.ceil(B.samplesPerLine/8/B.maxH),fe=Math.ceil(B.scanLines/8/B.maxV),ne=0;ne<B.components.length;ne++){W=B.components[ne];var ke=Math.ceil(Math.ceil(B.samplesPerLine/8)*W.h/B.maxH),Oe=Math.ceil(Math.ceil(B.scanLines/8)*W.v/B.maxV),ze=xe*W.h,We=fe*W.v,tt=64*We*(ze+1);W.blockData=new Int16Array(tt),W.blocksPerLine=ke,W.blocksPerColumn=Oe}B.mcusPerLine=xe,B.mcusPerColumn=fe}var k=0,se=M.length,j=null,A=null,L=null,T,v,r=[],m=[],e=[],s=O();if(s!==65496)throw"SOI not found";for(s=O();s!==65497;){var p,n,a;switch(s){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 t=Y();s===65504&&t[0]===74&&t[1]===70&&t[2]===73&&t[3]===70&&t[4]===0&&(j={version:{major:t[5],minor:t[6]},densityUnits:t[7],xDensity:t[8]<<8|t[9],yDensity:t[10]<<8|t[11],thumbWidth:t[12],thumbHeight:t[13],thumbData:t.subarray(14,14+3*t[12]*t[13])}),s===65518&&t[0]===65&&t[1]===100&&t[2]===111&&t[3]===98&&t[4]===101&&t[5]===0&&(A={version:t[6],flags0:t[7]<<8|t[8],flags1:t[9]<<8|t[10],transformCode:t[11]});break;case 65499:for(var i=O(),o=i+k-2,u;k<o;){var C=M[k++],_=new Uint16Array(64);if(C>>4)if(C>>4===1)for(n=0;n<64;n++)u=me[n],_[u]=O();else throw"DQT: invalid table spec";else for(n=0;n<64;n++)u=me[n],_[u]=M[k++];r[C&15]=_}break;case 65472:case 65473:case 65474:if(T)throw"Only single frame JPEGs supported";O(),T={},T.extended=s===65473,T.progressive=s===65474,T.precision=M[k++],T.scanLines=O(),T.samplesPerLine=O(),T.components=[],T.componentIds={};var w=M[k++],b,d=0,S=0;for(p=0;p<w;p++){b=M[k];var D=M[k+1]>>4,U=M[k+1]&15;d<D&&(d=D),S<U&&(S=U);var $=M[k+2];a=T.components.push({h:D,v:U,quantizationTable:r[$]}),T.componentIds[b]=a-1,k+=3}T.maxH=d,T.maxV=S,J(T);break;case 65476:var F=O();for(p=2;p<F;){var q=M[k++],H=new Uint8Array(16),E=0;for(n=0;n<16;n++,k++)E+=H[n]=M[k];var Q=new Uint8Array(E);for(n=0;n<E;n++,k++)Q[n]=M[k];p+=17+E,(q>>4?m:e)[q&15]=Ce(H,Q)}break;case 65501:O(),v=O();break;case 65498:var ee=O(),ve=M[k++],R=[],W;for(p=0;p<ve;p++){var oe=T.componentIds[M[k++]];W=T.components[oe];var re=M[k++];W.huffmanTableDC=e[re>>4],W.huffmanTableAC=m[re&15],R.push(W)}var Pe=M[k++],Le=M[k++],V=M[k++],ae=be(M,k,T,R,v,Pe,Le,V>>4,V&15);k+=ae;break;case 65535:M[k]!==255&&k--;break;default:if(M[k-3]===255&&M[k-2]>=192&&M[k-2]<=254){k-=3;break}throw"unknown JPEG marker "+s.toString(16)}s=O()}for(this.width=T.samplesPerLine,this.height=T.scanLines,this.jfif=j,this.adobe=A,this.components=[],p=0;p<T.components.length;p++)W=T.components[p],this.components.push({output:_e(T,W),scaleX:W.h/T.maxH,scaleY:W.v/T.maxV,blocksPerLine:W.blocksPerLine,blocksPerColumn:W.blocksPerColumn});this.numComponents=this.components.length},_getLinearizedBlockData:function(M,O){var Y=this.width/M,J=this.height/O,k,se,j,A,L,T,v,r,m,e,s=0,p,n=this.components.length,a=M*O*n,t=new Uint8Array(a),i=new Uint32Array(M),o=4294967288;for(v=0;v<n;v++){for(k=this.components[v],se=k.scaleX*Y,j=k.scaleY*J,s=v,p=k.output,A=k.blocksPerLine+1<<3,L=0;L<M;L++)r=0|L*se,i[L]=(r&o)<<3|r&7;for(T=0;T<O;T++)for(r=0|T*j,e=A*(r&o)|(r&7)<<3,L=0;L<M;L++)t[s]=p[e+i[L]],s+=n}var u=this.decodeTransform;if(u)for(v=0;v<a;)for(r=0,m=0;r<n;r++,v++,m+=2)t[v]=(t[v]*u[m]>>8)+u[m+1];return t},_isColorConversionNeeded:function(){return this.adobe&&this.adobe.transformCode?!0:this.numComponents===3},_convertYccToRgb:function(M){for(var O,Y,J,k=0,se=M.length;k<se;k+=3)O=M[k],Y=M[k+1],J=M[k+2],M[k]=Me(O-179.456+1.402*J),M[k+1]=Me(O+135.459-.344*Y-.714*J),M[k+2]=Me(O-226.816+1.772*Y);return M},_convertYcckToRgb:function(M){for(var O,Y,J,k,se=0,j=0,A=M.length;j<A;j+=4){O=M[j],Y=M[j+1],J=M[j+2],k=M[j+3];var L=-122.67195406894+Y*(-660635669420364e-19*Y+.000437130475926232*J-54080610064599e-18*O+.00048449797120281*k-.154362151871126)+J*(-.000957964378445773*J+.000817076911346625*O-.00477271405408747*k+1.53380253221734)+O*(.000961250184130688*O-.00266257332283933*k+.48357088451265)+k*(-.000336197177618394*k+.484791561490776),T=107.268039397724+Y*(219927104525741e-19*Y-.000640992018297945*J+.000659397001245577*O+.000426105652938837*k-.176491792462875)+J*(-.000778269941513683*J+.00130872261408275*O+.000770482631801132*k-.151051492775562)+O*(.00126935368114843*O-.00265090189010898*k+.25802910206845)+k*(-.000318913117588328*k-.213742400323665),v=-20.810012546947+Y*(-.000570115196973677*Y-263409051004589e-19*J+.0020741088115012*O-.00288260236853442*k+.814272968359295)+J*(-153496057440975e-19*J-.000132689043961446*O+.000560833691242812*k-.195152027534049)+O*(.00174418132927582*O-.00255243321439347*k+.116935020465145)+k*(-.000343531996510555*k+.24165260232407);M[se++]=Me(L),M[se++]=Me(T),M[se++]=Me(v)}return M},_convertYcckToCmyk:function(M){for(var O,Y,J,k=0,se=M.length;k<se;k+=4)O=M[k],Y=M[k+1],J=M[k+2],M[k]=Me(434.456-O-1.402*J),M[k+1]=Me(119.541-O+.344*Y+.714*J),M[k+2]=Me(481.816-O-1.772*Y);return M},_convertCmykToRgb:function(M){for(var O,Y,J,k,se=0,j=-255*255*255,A=1/255/255,L=0,T=M.length;L<T;L+=4){O=M[L],Y=M[L+1],J=M[L+2],k=M[L+3];var v=O*(-4.387332384609988*O+54.48615194189176*Y+18.82290502165302*J+212.25662451639585*k-72734.4411664936)+Y*(1.7149763477362134*Y-5.6096736904047315*J-17.873870861415444*k-1401.7366389350734)+J*(-2.5217340131683033*J-21.248923337353073*k+4465.541406466231)-k*(21.86122147463605*k+48317.86113160301),r=O*(8.841041422036149*O+60.118027045597366*Y+6.871425592049007*J+31.159100130055922*k-20220.756542821975)+Y*(-15.310361306967817*Y+17.575251261109482*J+131.35250912493976*k-48691.05921601825)+J*(4.444339102852739*J+9.8632861493405*k-6341.191035517494)-k*(20.737325471181034*k+47890.15695978492),m=O*(.8842522430003296*O+8.078677503112928*Y+30.89978309703729*J-.23883238689178934*k-3616.812083916688)+Y*(10.49593273432072*Y+63.02378494754052*J+50.606957656360734*k-28620.90484698408)+J*(.03296041114873217*J+115.60384449646641*k-49363.43385999684)-k*(22.33816807309886*k+45932.16563550634);M[se++]=v>=0?255:v<=j?0:255+v*A|0,M[se++]=r>=0?255:r<=j?0:255+r*A|0,M[se++]=m>=0?255:m<=j?0:255+m*A|0}return M},getData:function(M,O,Y){if(this.numComponents>4)throw"Unsupported color mode";var J=this._getLinearizedBlockData(M,O);if(this.numComponents===3)return this._convertYccToRgb(J);if(this.numComponents===4){if(this._isColorConversionNeeded())return Y?this._convertYcckToRgb(J):this._convertYcckToCmyk(J);if(Y)return this._convertCmykToRgb(J)}return J}},he}(),h=function(){var me=[{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 K(ie,X,G){this.data=ie,this.bp=X,this.dataEnd=G,this.chigh=ie[X],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 K.prototype={byteIn:function(){var X=this.data,G=this.bp;if(X[G]===255){var Z=X[G+1];Z>143?(this.clow+=65280,this.ct=8):(G++,this.clow+=X[G]<<9,this.ct=7,this.bp=G)}else G++,this.clow+=G<this.dataEnd?X[G]<<8:65280,this.ct=8,this.bp=G;this.clow>65535&&(this.chigh+=this.clow>>16,this.clow&=65535)},readBit:function(X,G){var Z=X[G]>>1,ue=X[G]&1,ce=me[Z],Te=ce.qe,he,Ce=this.a-Te;if(this.chigh<Te)Ce<Te?(Ce=Te,he=ue,Z=ce.nmps):(Ce=Te,he=1^ue,ce.switchFlag===1&&(ue=he),Z=ce.nlps);else{if(this.chigh-=Te,Ce&32768)return this.a=Ce,ue;Ce<Te?(he=1^ue,ce.switchFlag===1&&(ue=he),Z=ce.nlps):(he=ue,Z=ce.nmps)}do this.ct===0&&this.byteIn(),Ce<<=1,this.chigh=this.chigh<<1&65535|this.clow>>15&1,this.clow=this.clow<<1&65535,this.ct--;while(!(Ce&32768));return this.a=Ce,X[G]=Z<<1|ue,he}},K}(),l=function(){var me={LL:0,LH:1,HL:1,HH:2};function K(){this.failOnCorruptedImage=!1}K.prototype={parse:function(r){var m=y(r,0);if(m===65359){this.parseCodestream(r,0,r.length);return}for(var e=0,s=r.length;e<s;){var p=8,n=g(r,e),a=g(r,e+4);if(e+=p,n===1&&(n=g(r,e)*4294967296+g(r,e+4),e+=8,p+=8),n===0&&(n=s-e+p),n<p)throw new Error("JPX Error: Invalid box field size");var t=n-p,i=!0;switch(a){case 1785737832:i=!1;break;case 1668246642:var o=r[e],u=r[e+1],C=r[e+2];if(o===1){var _=g(r,e+3);switch(_){case 16:case 17:case 18:break;default:te("Unknown colorspace "+_);break}}else o===2&&Ae("ICC profile not supported");break;case 1785737827:this.parseCodestream(r,e,e+t);break;case 1783636e3:g(r,e)!==218793738&&te("Invalid JP2 signature");break;case 1783634458:case 1718909296:case 1920099697:case 1919251232:case 1768449138:break;default:var w=String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255);te("Unsupported header type "+a+" ("+w+")");break}i&&(e+=t)}},parseImageProperties:function(r){for(var m=r.getByte();m>=0;){var e=m;m=r.getByte();var s=e<<8|m;if(s===65361){r.skip(4);var p=r.getInt32()>>>0,n=r.getInt32()>>>0,a=r.getInt32()>>>0,t=r.getInt32()>>>0;r.skip(16);var i=r.getUint16();this.width=p-a,this.height=n-t,this.componentsCount=i,this.bitsPerComponent=8;return}}throw new Error("JPX Error: No size marker found in JPX stream")},parseCodestream:function(r,m,e){var s={};try{for(var p=!1,n=m;n+1<e;){var a=y(r,n);n+=2;var t=0,i,o,u,C,_,w;switch(a){case 65359:s.mainHeader=!0;break;case 65497:break;case 65361:t=y(r,n);var b={};b.Xsiz=g(r,n+4),b.Ysiz=g(r,n+8),b.XOsiz=g(r,n+12),b.YOsiz=g(r,n+16),b.XTsiz=g(r,n+20),b.YTsiz=g(r,n+24),b.XTOsiz=g(r,n+28),b.YTOsiz=g(r,n+32);var d=y(r,n+36);b.Csiz=d;var S=[];i=n+38;for(var D=0;D<d;D++){var U={precision:(r[i]&127)+1,isSigned:!!(r[i]&128),XRsiz:r[i+1],YRsiz:r[i+1]};ie(U,b),S.push(U)}s.SIZ=b,s.components=S,X(s,S),s.QCC=[],s.COC=[];break;case 65372:t=y(r,n);var $={};switch(i=n+2,o=r[i++],o&31){case 0:C=8,_=!0;break;case 1:C=16,_=!1;break;case 2:C=16,_=!0;break;default:throw new Error("JPX Error: Invalid SQcd value "+o)}for($.noQuantization=C===8,$.scalarExpounded=_,$.guardBits=o>>5,u=[];i<t+n;){var F={};C===8?(F.epsilon=r[i++]>>3,F.mu=0):(F.epsilon=r[i]>>3,F.mu=(r[i]&7)<<8|r[i+1],i+=2),u.push(F)}$.SPqcds=u,s.mainHeader?s.QCD=$:(s.currentTile.QCD=$,s.currentTile.QCC=[]);break;case 65373:t=y(r,n);var q={};i=n+2;var H;switch(s.SIZ.Csiz<257?H=r[i++]:(H=y(r,i),i+=2),o=r[i++],o&31){case 0:C=8,_=!0;break;case 1:C=16,_=!1;break;case 2:C=16,_=!0;break;default:throw new Error("JPX Error: Invalid SQcd value "+o)}for(q.noQuantization=C===8,q.scalarExpounded=_,q.guardBits=o>>5,u=[];i<t+n;)F={},C===8?(F.epsilon=r[i++]>>3,F.mu=0):(F.epsilon=r[i]>>3,F.mu=(r[i]&7)<<8|r[i+1],i+=2),u.push(F);q.SPqcds=u,s.mainHeader?s.QCC[H]=q:s.currentTile.QCC[H]=q;break;case 65362:t=y(r,n);var E={};i=n+2;var Q=r[i++];E.entropyCoderWithCustomPrecincts=!!(Q&1),E.sopMarkerUsed=!!(Q&2),E.ephMarkerUsed=!!(Q&4),E.progressionOrder=r[i++],E.layersCount=y(r,i),i+=2,E.multipleComponentTransform=r[i++],E.decompositionLevelsCount=r[i++],E.xcb=(r[i++]&15)+2,E.ycb=(r[i++]&15)+2;var ee=r[i++];if(E.selectiveArithmeticCodingBypass=!!(ee&1),E.resetContextProbabilities=!!(ee&2),E.terminationOnEachCodingPass=!!(ee&4),E.verticalyStripe=!!(ee&8),E.predictableTermination=!!(ee&16),E.segmentationSymbolUsed=!!(ee&32),E.reversibleTransformation=r[i++],E.entropyCoderWithCustomPrecincts){for(var ve=[];i<t+n;){var R=r[i++];ve.push({PPx:R&15,PPy:R>>4})}E.precinctsSizes=ve}var W=[];if(E.selectiveArithmeticCodingBypass&&W.push("selectiveArithmeticCodingBypass"),E.resetContextProbabilities&&W.push("resetContextProbabilities"),E.terminationOnEachCodingPass&&W.push("terminationOnEachCodingPass"),E.verticalyStripe&&W.push("verticalyStripe"),E.predictableTermination&&W.push("predictableTermination"),W.length>0)throw p=!0,new Error("JPX Error: Unsupported COD options ("+W.join(", ")+")");s.mainHeader?s.COD=E:(s.currentTile.COD=E,s.currentTile.COC=[]);break;case 65424:t=y(r,n),w={},w.index=y(r,n+2),w.length=g(r,n+4),w.dataEnd=w.length+n-2,w.partIndex=r[n+8],w.partsCount=r[n+9],s.mainHeader=!1,w.partIndex===0&&(w.COD=s.COD,w.COC=s.COC.slice(0),w.QCD=s.QCD,w.QCC=s.QCC.slice(0)),s.currentTile=w;break;case 65427:w=s.currentTile,w.partIndex===0&&(J(s,w.index),Me(s)),t=w.dataEnd-n,pe(s,r,n,t);break;case 65365:case 65367:case 65368:case 65380:t=y(r,n);break;case 65363:throw new Error("JPX Error: Codestream code 0xFF53 (COC) is not implemented");default:throw new Error("JPX Error: Unknown codestream code: "+a.toString(16))}n+=t}}catch(oe){if(p||this.failOnCorruptedImage)throw oe;te("Trying to recover from "+oe.message)}this.tiles=Y(s),this.width=s.SIZ.Xsiz-s.SIZ.XOsiz,this.height=s.SIZ.Ysiz-s.SIZ.YOsiz,this.componentsCount=s.SIZ.Csiz}};function ie(v,r){v.x0=Math.ceil(r.XOsiz/v.XRsiz),v.x1=Math.ceil(r.Xsiz/v.XRsiz),v.y0=Math.ceil(r.YOsiz/v.YRsiz),v.y1=Math.ceil(r.Ysiz/v.YRsiz),v.width=v.x1-v.x0,v.height=v.y1-v.y0}function X(v,r){for(var m=v.SIZ,e,s=[],p=Math.ceil((m.Xsiz-m.XTOsiz)/m.XTsiz),n=Math.ceil((m.Ysiz-m.YTOsiz)/m.YTsiz),a=0;a<n;a++)for(var t=0;t<p;t++)e={},e.tx0=Math.max(m.XTOsiz+t*m.XTsiz,m.XOsiz),e.ty0=Math.max(m.YTOsiz+a*m.YTsiz,m.YOsiz),e.tx1=Math.min(m.XTOsiz+(t+1)*m.XTsiz,m.Xsiz),e.ty1=Math.min(m.YTOsiz+(a+1)*m.YTsiz,m.Ysiz),e.width=e.tx1-e.tx0,e.height=e.ty1-e.ty0,e.components=[],s.push(e);v.tiles=s;for(var i=m.Csiz,o=0,u=i;o<u;o++)for(var C=r[o],_=0,w=s.length;_<w;_++){var b={};e=s[_],b.tcx0=Math.ceil(e.tx0/C.XRsiz),b.tcy0=Math.ceil(e.ty0/C.YRsiz),b.tcx1=Math.ceil(e.tx1/C.XRsiz),b.tcy1=Math.ceil(e.ty1/C.YRsiz),b.width=b.tcx1-b.tcx0,b.height=b.tcy1-b.tcy0,e.components[o]=b}}function G(v,r,m){var e=r.codingStyleParameters,s={};return e.entropyCoderWithCustomPrecincts?(s.PPx=e.precinctsSizes[m].PPx,s.PPy=e.precinctsSizes[m].PPy):(s.PPx=15,s.PPy=15),s.xcb_=m>0?Math.min(e.xcb,s.PPx-1):Math.min(e.xcb,s.PPx),s.ycb_=m>0?Math.min(e.ycb,s.PPy-1):Math.min(e.ycb,s.PPy),s}function Z(v,r,m){var e=1<<m.PPx,s=1<<m.PPy,p=r.resLevel===0,n=1<<m.PPx+(p?0:-1),a=1<<m.PPy+(p?0:-1),t=r.trx1>r.trx0?Math.ceil(r.trx1/e)-Math.floor(r.trx0/e):0,i=r.try1>r.try0?Math.ceil(r.try1/s)-Math.floor(r.try0/s):0,o=t*i;r.precinctParameters={precinctWidth:e,precinctHeight:s,numprecinctswide:t,numprecinctshigh:i,numprecincts:o,precinctWidthInSubband:n,precinctHeightInSubband:a}}function ue(v,r,m){var e=m.xcb_,s=m.ycb_,p=1<<e,n=1<<s,a=r.tbx0>>e,t=r.tby0>>s,i=r.tbx1+p-1>>e,o=r.tby1+n-1>>s,u=r.resolution.precinctParameters,C=[],_=[],w,b,d,S;for(b=t;b<o;b++)for(w=a;w<i;w++){d={cbx:w,cby:b,tbx0:p*w,tby0:n*b,tbx1:p*(w+1),tby1:n*(b+1)},d.tbx0_=Math.max(r.tbx0,d.tbx0),d.tby0_=Math.max(r.tby0,d.tby0),d.tbx1_=Math.min(r.tbx1,d.tbx1),d.tby1_=Math.min(r.tby1,d.tby1);var D=Math.floor((d.tbx0_-r.tbx0)/u.precinctWidthInSubband),U=Math.floor((d.tby0_-r.tby0)/u.precinctHeightInSubband);if(S=D+U*u.numprecinctswide,d.precinctNumber=S,d.subbandType=r.type,d.Lblock=3,!(d.tbx1_<=d.tbx0_||d.tby1_<=d.tby0_)){C.push(d);var $=_[S];$!==void 0?(w<$.cbxMin?$.cbxMin=w:w>$.cbxMax&&($.cbxMax=w),b<$.cbyMin?$.cbxMin=b:b>$.cbyMax&&($.cbyMax=b)):_[S]=$={cbxMin:w,cbyMin:b,cbxMax:w,cbyMax:b},d.precinct=$}}r.codeblockParameters={codeblockWidth:e,codeblockHeight:s,numcodeblockwide:i-a+1,numcodeblockhigh:o-t+1},r.codeblocks=C,r.precincts=_}function ce(v,r,m){for(var e=[],s=v.subbands,p=0,n=s.length;p<n;p++)for(var a=s[p],t=a.codeblocks,i=0,o=t.length;i<o;i++){var u=t[i];u.precinctNumber===r&&e.push(u)}return{layerNumber:m,codeblocks:e}}function Te(v){for(var r=v.SIZ,m=v.currentTile.index,e=v.tiles[m],s=e.codingStyleDefaultParameters.layersCount,p=r.Csiz,n=0,a=0;a<p;a++)n=Math.max(n,e.components[a].codingStyleParameters.decompositionLevelsCount);var t=0,i=0,o=0,u=0;this.nextPacket=function(){for(;t<s;t++){for(;i<=n;i++){for(;o<p;o++){var _=e.components[o];if(!(i>_.codingStyleParameters.decompositionLevelsCount)){for(var w=_.resolutions[i],b=w.precinctParameters.numprecincts;u<b;){var d=ce(w,u,t);return u++,d}u=0}}o=0}i=0}throw new Error("JPX Error: Out of packets")}}function he(v){for(var r=v.SIZ,m=v.currentTile.index,e=v.tiles[m],s=e.codingStyleDefaultParameters.layersCount,p=r.Csiz,n=0,a=0;a<p;a++)n=Math.max(n,e.components[a].codingStyleParameters.decompositionLevelsCount);var t=0,i=0,o=0,u=0;this.nextPacket=function(){for(;t<=n;t++){for(;i<s;i++){for(;o<p;o++){var _=e.components[o];if(!(t>_.codingStyleParameters.decompositionLevelsCount)){for(var w=_.resolutions[t],b=w.precinctParameters.numprecincts;u<b;){var d=ce(w,u,i);return u++,d}u=0}}o=0}i=0}throw new Error("JPX Error: Out of packets")}}function Ce(v){var r=v.SIZ,m=v.currentTile.index,e=v.tiles[m],s=e.codingStyleDefaultParameters.layersCount,p=r.Csiz,n,a,t,i,o=0;for(t=0;t<p;t++){var u=e.components[t];o=Math.max(o,u.codingStyleParameters.decompositionLevelsCount)}var C=new Int32Array(o+1);for(a=0;a<=o;++a){var _=0;for(t=0;t<p;++t){var w=e.components[t].resolutions;a<w.length&&(_=Math.max(_,w[a].precinctParameters.numprecincts))}C[a]=_}n=0,a=0,t=0,i=0,this.nextPacket=function(){for(;a<=o;a++){for(;i<C[a];i++){for(;t<p;t++){var d=e.components[t];if(!(a>d.codingStyleParameters.decompositionLevelsCount)){var S=d.resolutions[a],D=S.precinctParameters.numprecincts;if(!(i>=D)){for(;n<s;){var U=ce(S,i,n);return n++,U}n=0}}}t=0}i=0}throw new Error("JPX Error: Out of packets")}}function we(v){var r=v.SIZ,m=v.currentTile.index,e=v.tiles[m],s=e.codingStyleDefaultParameters.layersCount,p=r.Csiz,n=_e(e),a=n,t=0,i=0,o=0,u=0,C=0;this.nextPacket=function(){for(;C<a.maxNumHigh;C++){for(;u<a.maxNumWide;u++){for(;o<p;o++){for(var w=e.components[o],b=w.codingStyleParameters.decompositionLevelsCount;i<=b;i++){var d=w.resolutions[i],S=n.components[o].resolutions[i],D=ye(u,C,S,a,d);if(D!==null){for(;t<s;){var U=ce(d,D,t);return t++,U}t=0}}i=0}o=0}u=0}throw new Error("JPX Error: Out of packets")}}function be(v){var r=v.SIZ,m=v.currentTile.index,e=v.tiles[m],s=e.codingStyleDefaultParameters.layersCount,p=r.Csiz,n=_e(e),a=0,t=0,i=0,o=0,u=0;this.nextPacket=function(){for(;i<p;++i){for(var _=e.components[i],w=n.components[i],b=_.codingStyleParameters.decompositionLevelsCount;u<w.maxNumHigh;u++){for(;o<w.maxNumWide;o++){for(;t<=b;t++){var d=_.resolutions[t],S=w.resolutions[t],D=ye(o,u,S,w,d);if(D!==null){for(;a<s;){var U=ce(d,D,a);return a++,U}a=0}}t=0}o=0}u=0}throw new Error("JPX Error: Out of packets")}}function ye(v,r,m,e,s){var p=v*e.minWidth,n=r*e.minHeight;if(p%m.width!==0||n%m.height!==0)return null;var a=n/m.width*s.precinctParameters.numprecinctswide;return p/m.height+a}function _e(v){for(var r=v.components.length,m=Number.MAX_VALUE,e=Number.MAX_VALUE,s=0,p=0,n=new Array(r),a=0;a<r;a++){for(var t=v.components[a],i=t.codingStyleParameters.decompositionLevelsCount,o=new Array(i+1),u=Number.MAX_VALUE,C=Number.MAX_VALUE,_=0,w=0,b=1,d=i;d>=0;--d){var S=t.resolutions[d],D=b*S.precinctParameters.precinctWidth,U=b*S.precinctParameters.precinctHeight;u=Math.min(u,D),C=Math.min(C,U),_=Math.max(_,S.precinctParameters.numprecinctswide),w=Math.max(w,S.precinctParameters.numprecinctshigh),o[d]={width:D,height:U},b<<=1}m=Math.min(m,u),e=Math.min(e,C),s=Math.max(s,_),p=Math.max(p,w),n[a]={resolutions:o,minWidth:u,minHeight:C,maxNumWide:_,maxNumHigh:w}}return{components:n,minWidth:m,minHeight:e,maxNumWide:s,maxNumHigh:p}}function Me(v){for(var r=v.SIZ,m=v.currentTile.index,e=v.tiles[m],s=r.Csiz,p=0;p<s;p++){for(var n=e.components[p],a=n.codingStyleParameters.decompositionLevelsCount,t=[],i=[],o=0;o<=a;o++){var u=G(v,n,o),C={},_=1<<a-o;C.trx0=Math.ceil(n.tcx0/_),C.try0=Math.ceil(n.tcy0/_),C.trx1=Math.ceil(n.tcx1/_),C.try1=Math.ceil(n.tcy1/_),C.resLevel=o,Z(v,C,u),t.push(C);var w;if(o===0)w={},w.type="LL",w.tbx0=Math.ceil(n.tcx0/_),w.tby0=Math.ceil(n.tcy0/_),w.tbx1=Math.ceil(n.tcx1/_),w.tby1=Math.ceil(n.tcy1/_),w.resolution=C,ue(v,w,u),i.push(w),C.subbands=[w];else{var b=1<<a-o+1,d=[];w={},w.type="HL",w.tbx0=Math.ceil(n.tcx0/b-.5),w.tby0=Math.ceil(n.tcy0/b),w.tbx1=Math.ceil(n.tcx1/b-.5),w.tby1=Math.ceil(n.tcy1/b),w.resolution=C,ue(v,w,u),i.push(w),d.push(w),w={},w.type="LH",w.tbx0=Math.ceil(n.tcx0/b),w.tby0=Math.ceil(n.tcy0/b-.5),w.tbx1=Math.ceil(n.tcx1/b),w.tby1=Math.ceil(n.tcy1/b-.5),w.resolution=C,ue(v,w,u),i.push(w),d.push(w),w={},w.type="HH",w.tbx0=Math.ceil(n.tcx0/b-.5),w.tby0=Math.ceil(n.tcy0/b-.5),w.tbx1=Math.ceil(n.tcx1/b-.5),w.tby1=Math.ceil(n.tcy1/b-.5),w.resolution=C,ue(v,w,u),i.push(w),d.push(w),C.subbands=d}}n.resolutions=t,n.subbands=i}var S=e.codingStyleDefaultParameters.progressionOrder;switch(S){case 0:e.packetsIterator=new Te(v);break;case 1:e.packetsIterator=new he(v);break;case 2:e.packetsIterator=new Ce(v);break;case 3:e.packetsIterator=new we(v);break;case 4:e.packetsIterator=new be(v);break;default:throw new Error("JPX Error: Unsupported progression order "+S)}}function pe(v,r,m,e){var s=0,p,n=0,a=!1;function t(ne){for(;n<ne;){var ke=r[m+s];s++,a?(p=p<<7|ke,n+=7,a=!1):(p=p<<8|ke,n+=8),ke===255&&(a=!0)}return n-=ne,p>>>n&(1<<ne)-1}function i(ne){return r[m+s-1]===255&&r[m+s]===ne?(o(1),!0):r[m+s]===255&&r[m+s+1]===ne?(o(2),!0):!1}function o(ne){s+=ne}function u(){n=0,a&&(s++,a=!1)}function C(){if(t(1)===0)return 1;if(t(1)===0)return 2;var ne=t(2);return ne<3?ne+3:(ne=t(5),ne<31?ne+6:(ne=t(7),ne+37))}for(var _=v.currentTile.index,w=v.tiles[_],b=v.COD.sopMarkerUsed,d=v.COD.ephMarkerUsed,S=w.packetsIterator;s<e;){u(),b&&i(145)&&o(4);var D=S.nextPacket();if(t(1)){for(var U=D.layerNumber,$=[],F,q=0,H=D.codeblocks.length;q<H;q++){F=D.codeblocks[q];var E=F.precinct,Q=F.cbx-E.cbxMin,ee=F.cby-E.cbyMin,ve=!1,R=!1,W;if(F.included!==void 0)ve=!!t(1);else{E=F.precinct;var oe,re;if(E.inclusionTree!==void 0)oe=E.inclusionTree;else{var Pe=E.cbxMax-E.cbxMin+1,Le=E.cbyMax-E.cbyMin+1;oe=new se(Pe,Le,U),re=new k(Pe,Le),E.inclusionTree=oe,E.zeroBitPlanesTree=re}if(oe.reset(Q,ee,U))for(;;)if(t(1)){if(W=!oe.nextLevel(),W){F.included=!0,ve=R=!0;break}}else{oe.incrementValue(U);break}}if(ve){if(R){for(re=E.zeroBitPlanesTree,re.reset(Q,ee);;)if(t(1)){if(W=!re.nextLevel(),W)break}else re.incrementValue();F.zeroBitPlanes=re.value}for(var V=C();t(1);)F.Lblock++;var ae=x(V),B=(V<1<<ae?ae-1:ae)+F.Lblock,xe=t(B);$.push({codeblock:F,codingpasses:V,dataLength:xe})}}for(u(),d&&i(146);$.length>0;){var fe=$.shift();F=fe.codeblock,F.data===void 0&&(F.data=[]),F.data.push({data:r,start:m+s,end:m+s+fe.dataLength,codingpasses:fe.codingpasses}),s+=fe.dataLength}}}return s}function M(v,r,m,e,s,p,n,a){for(var t=e.tbx0,i=e.tby0,o=e.tbx1-e.tbx0,u=e.codeblocks,C=e.type.charAt(0)==="H"?1:0,_=e.type.charAt(1)==="H"?r:0,w=0,b=u.length;w<b;++w){var d=u[w],S=d.tbx1_-d.tbx0_,D=d.tby1_-d.tby0_;if(!(S===0||D===0)&&d.data!==void 0){var U,$;U=new j(S,D,d.subbandType,d.zeroBitPlanes,p),$=2;var F=d.data,q=0,H=0,E,Q,ee;for(E=0,Q=F.length;E<Q;E++)ee=F[E],q+=ee.end-ee.start,H+=ee.codingpasses;var ve=new Uint8Array(q),R=0;for(E=0,Q=F.length;E<Q;E++){ee=F[E];var W=ee.data.subarray(ee.start,ee.end);ve.set(W,R),R+=W.length}var oe=new h(ve,0,q);for(U.setDecoder(oe),E=0;E<H;E++){switch($){case 0:U.runSignificancePropogationPass();break;case 1:U.runMagnitudeRefinementPass();break;case 2:U.runCleanupPass(),a&&U.checkSegmentationSymbol();break}$=($+1)%3}var re=d.tbx0_-t+(d.tby0_-i)*o,Pe=U.coefficentsSign,Le=U.coefficentsMagnitude,V=U.bitsDecoded,ae=n?0:.5,B,xe,fe;R=0;var ne=e.type!=="LL";for(E=0;E<D;E++){var ke=re/o|0,Oe=2*ke*(r-o)+C+_;for(B=0;B<S;B++){if(xe=Le[R],xe!==0){xe=(xe+ae)*s,Pe[R]!==0&&(xe=-xe),fe=V[R];var ze=ne?Oe+(re<<1):re;n&&fe>=p?v[ze]=xe:v[ze]=xe*(1<<p-fe)}re++,R++}re+=o-S}}}}function O(v,r,m){for(var e=r.components[m],s=e.codingStyleParameters,p=e.quantizationParameters,n=s.decompositionLevelsCount,a=p.SPqcds,t=p.scalarExpounded,i=p.guardBits,o=s.segmentationSymbolUsed,u=v.components[m].precision,C=s.reversibleTransformation,_=C?new T:new L,w=[],b=0,d=0;d<=n;d++){for(var S=e.resolutions[d],D=S.trx1-S.trx0,U=S.try1-S.try0,$=new Float32Array(D*U),F=0,q=S.subbands.length;F<q;F++){var H,E;t?(H=a[b].mu,E=a[b].epsilon,b++):(H=a[0].mu,E=a[0].epsilon+(d>0?1-d:0));var Q=S.subbands[F],ee=me[Q.type],ve=C?1:Math.pow(2,u+ee-E)*(1+H/2048),R=i+E-1;M($,D,U,Q,ve,R,C,o)}w.push({width:D,height:U,items:$})}var W=_.calculate(w,e.tcx0,e.tcy0);return{left:e.tcx0,top:e.tcy0,width:W.width,height:W.height,items:W.items}}function Y(v){for(var r=v.SIZ,m=v.components,e=r.Csiz,s=[],p=0,n=v.tiles.length;p<n;p++){var a=v.tiles[p],t=[],i;for(i=0;i<e;i++)t[i]=O(v,a,i);var o=t[0],u=new Uint8Array(o.items.length*e),C={left:o.left,top:o.top,width:o.width,height:o.height,items:u},_,w,b,d,S,D=0,U,$,F,q,H,E,Q,ee,ve,R;if(a.codingStyleDefaultParameters.multipleComponentTransform){var W=e===4,oe=t[0].items,re=t[1].items,Pe=t[2].items,Le=W?t[3].items:null;_=m[0].precision-8,w=(128<<_)+.5,b=255*(1<<_),S=b*.5,d=-S;var V=a.components[0],ae=e-3;if($=oe.length,V.codingStyleParameters.reversibleTransformation)for(U=0;U<$;U++,D+=ae)F=oe[U]+w,q=re[U],H=Pe[U],Q=F-(H+q>>2),E=Q+H,ee=Q+q,u[D++]=E<=0?0:E>=b?255:E>>_,u[D++]=Q<=0?0:Q>=b?255:Q>>_,u[D++]=ee<=0?0:ee>=b?255:ee>>_;else for(U=0;U<$;U++,D+=ae)F=oe[U]+w,q=re[U],H=Pe[U],E=F+1.402*H,Q=F-.34413*q-.71414*H,ee=F+1.772*q,u[D++]=E<=0?0:E>=b?255:E>>_,u[D++]=Q<=0?0:Q>=b?255:Q>>_,u[D++]=ee<=0?0:ee>=b?255:ee>>_;if(W)for(U=0,D=3;U<$;U++,D+=4)ve=Le[U],u[D]=ve<=d?0:ve>=S?255:ve+w>>_}else for(i=0;i<e;i++){var B=t[i].items;for(_=m[i].precision-8,w=(128<<_)+.5,b=127.5*(1<<_),d=-b,D=i,U=0,$=B.length;U<$;U++)R=B[U],u[D]=R<=d?0:R>=b?255:R+w>>_,D+=e}s.push(C)}return s}function J(v,r){for(var m=v.SIZ,e=m.Csiz,s=v.tiles[r],p=0;p<e;p++){var n=s.components[p],a=v.currentTile.QCC[p]!==void 0?v.currentTile.QCC[p]:v.currentTile.QCD;n.quantizationParameters=a;var t=v.currentTile.COC[p]!==void 0?v.currentTile.COC[p]:v.currentTile.COD;n.codingStyleParameters=t}s.codingStyleDefaultParameters=v.currentTile.COD}var k=function(){function r(m,e){var s=x(Math.max(m,e))+1;this.levels=[];for(var p=0;p<s;p++){var n={width:m,height:e,items:[]};this.levels.push(n),m=Math.ceil(m/2),e=Math.ceil(e/2)}}return r.prototype={reset:function(e,s){for(var p=0,n=0,a;p<this.levels.length;){a=this.levels[p];var t=e+s*a.width;if(a.items[t]!==void 0){n=a.items[t];break}a.index=t,e>>=1,s>>=1,p++}p--,a=this.levels[p],a.items[a.index]=n,this.currentLevel=p,delete this.value},incrementValue:function(){var e=this.levels[this.currentLevel];e.items[e.index]++},nextLevel:function(){var e=this.currentLevel,s=this.levels[e],p=s.items[s.index];return e--,e<0?(this.value=p,!1):(this.currentLevel=e,s=this.levels[e],s.items[s.index]=p,!0)}},r}(),se=function(){function r(m,e,s){var p=x(Math.max(m,e))+1;this.levels=[];for(var n=0;n<p;n++){for(var a=new Uint8Array(m*e),t=0,i=a.length;t<i;t++)a[t]=s;var o={width:m,height:e,items:a};this.levels.push(o),m=Math.ceil(m/2),e=Math.ceil(e/2)}}return r.prototype={reset:function(e,s,p){for(var n=0;n<this.levels.length;){var a=this.levels[n],t=e+s*a.width;a.index=t;var i=a.items[t];if(i===255)break;if(i>p)return this.currentLevel=n,this.propagateValues(),!1;e>>=1,s>>=1,n++}return this.currentLevel=n-1,!0},incrementValue:function(e){var s=this.levels[this.currentLevel];s.items[s.index]=e+1,this.propagateValues()},propagateValues:function(){for(var e=this.currentLevel,s=this.levels[e],p=s.items[s.index];--e>=0;)s=this.levels[e],s.items[s.index]=p},nextLevel:function(){var e=this.currentLevel,s=this.levels[e],p=s.items[s.index];return s.items[s.index]=255,e--,e<0?!1:(this.currentLevel=e,s=this.levels[e],s.items[s.index]=p,!0)}},r}(),j=function(){var r=17,m=18,e=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]),s=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]),p=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 n(a,t,i,o,u){this.width=a,this.height=t,this.contextLabelTable=i==="HH"?p:i==="HL"?s:e;var C=a*t;this.neighborsSignificance=new Uint8Array(C),this.coefficentsSign=new Uint8Array(C),this.coefficentsMagnitude=u>14?new Uint32Array(C):u>6?new Uint16Array(C):new Uint8Array(C),this.processingFlags=new Uint8Array(C);var _=new Uint8Array(C);if(o!==0)for(var w=0;w<C;w++)_[w]=o;this.bitsDecoded=_,this.reset()}return n.prototype={setDecoder:function(t){this.decoder=t},reset:function(){this.contexts=new Int8Array(19),this.contexts[0]=8,this.contexts[r]=92,this.contexts[m]=6},setNeighborsSignificance:function(t,i,o){var u=this.neighborsSignificance,C=this.width,_=this.height,w=i>0,b=i+1<C,d;t>0&&(d=o-C,w&&(u[d-1]+=16),b&&(u[d+1]+=16),u[d]+=4),t+1<_&&(d=o+C,w&&(u[d-1]+=16),b&&(u[d+1]+=16),u[d]+=4),w&&(u[o-1]+=1),b&&(u[o+1]+=1),u[o]|=128},runSignificancePropogationPass:function(){for(var t=this.decoder,i=this.width,o=this.height,u=this.coefficentsMagnitude,C=this.coefficentsSign,_=this.neighborsSignificance,w=this.processingFlags,b=this.contexts,d=this.contextLabelTable,S=this.bitsDecoded,D=-2,U=1,$=2,F=0;F<o;F+=4)for(var q=0;q<i;q++)for(var H=F*i+q,E=0;E<4;E++,H+=i){var Q=F+E;if(Q>=o)break;if(w[H]&=D,!(u[H]||!_[H])){var ee=d[_[H]],ve=t.readBit(b,ee);if(ve){var R=this.decodeSignBit(Q,q,H);C[H]=R,u[H]=1,this.setNeighborsSignificance(Q,q,H),w[H]|=$}S[H]++,w[H]|=U}}},decodeSignBit:function(t,i,o){var u=this.width,C=this.height,_=this.coefficentsMagnitude,w=this.coefficentsSign,b,d,S,D,U,$;D=i>0&&_[o-1]!==0,i+1<u&&_[o+1]!==0?(S=w[o+1],D?(d=w[o-1],b=1-S-d):b=1-S-S):D?(d=w[o-1],b=1-d-d):b=0;var F=3*b;return D=t>0&&_[o-u]!==0,t+1<C&&_[o+u]!==0?(S=w[o+u],D?(d=w[o-u],b=1-S-d+F):b=1-S-S+F):D?(d=w[o-u],b=1-d-d+F):b=F,b>=0?(U=9+b,$=this.decoder.readBit(this.contexts,U)):(U=9-b,$=this.decoder.readBit(this.contexts,U)^1),$},runMagnitudeRefinementPass:function(){for(var t=this.decoder,i=this.width,o=this.height,u=this.coefficentsMagnitude,C=this.neighborsSignificance,_=this.contexts,w=this.bitsDecoded,b=this.processingFlags,d=1,S=2,D=i*o,U=i*4,$=0,F;$<D;$=F){F=Math.min(D,$+U);for(var q=0;q<i;q++)for(var H=$+q;H<F;H+=i)if(!(!u[H]||b[H]&d)){var E=16;if(b[H]&S){b[H]^=S;var Q=C[H]&127;E=Q===0?15:14}var ee=t.readBit(_,E);u[H]=u[H]<<1|ee,w[H]++,b[H]|=d}}},runCleanupPass:function(){for(var t=this.decoder,i=this.width,o=this.height,u=this.neighborsSignificance,C=this.coefficentsMagnitude,_=this.coefficentsSign,w=this.contexts,b=this.contextLabelTable,d=this.bitsDecoded,S=this.processingFlags,D=1,U=2,$=i,F=i*2,q=i*3,H,E=0;E<o;E=H){H=Math.min(E+4,o);for(var Q=E*i,ee=E+3<o,ve=0;ve<i;ve++){var R=Q+ve,W=ee&&S[R]===0&&S[R+$]===0&&S[R+F]===0&&S[R+q]===0&&u[R]===0&&u[R+$]===0&&u[R+F]===0&&u[R+q]===0,oe=0,re=R,Pe=E,Le;if(W){var V=t.readBit(w,m);if(!V){d[R]++,d[R+$]++,d[R+F]++,d[R+q]++;continue}oe=t.readBit(w,r)<<1|t.readBit(w,r),oe!==0&&(Pe=E+oe,re+=oe*i),Le=this.decodeSignBit(Pe,ve,re),_[re]=Le,C[re]=1,this.setNeighborsSignificance(Pe,ve,re),S[re]|=U,re=R;for(var ae=E;ae<=Pe;ae++,re+=i)d[re]++;oe++}for(Pe=E+oe;Pe<H;Pe++,re+=i)if(!(C[re]||S[re]&D)){var B=b[u[re]],xe=t.readBit(w,B);xe===1&&(Le=this.decodeSignBit(Pe,ve,re),_[re]=Le,C[re]=1,this.setNeighborsSignificance(Pe,ve,re),S[re]|=U),d[re]++}}}},checkSegmentationSymbol:function(){var t=this.decoder,i=this.contexts,o=t.readBit(i,r)<<3|t.readBit(i,r)<<2|t.readBit(i,r)<<1|t.readBit(i,r);if(o!==10)throw new Error("JPX Error: Invalid segmentation symbol")}},n}(),A=function(){function r(){}return r.prototype.calculate=function(e,s,p){for(var n=e[0],a=1,t=e.length;a<t;a++)n=this.iterate(n,e[a],s,p);return n},r.prototype.extend=function(e,s,p){var n=s-1,a=s+1,t=s+p-2,i=s+p;e[n--]=e[a++],e[i++]=e[t--],e[n--]=e[a++],e[i++]=e[t--],e[n--]=e[a++],e[i++]=e[t--],e[n]=e[a],e[i]=e[t]},r.prototype.iterate=function(e,s,p,n){var a=e.width,t=e.height,i=e.items,o=s.width,u=s.height,C=s.items,_,w,b,d,S,D;for(b=0,_=0;_<t;_++)for(d=_*2*o,w=0;w<a;w++,b++,d+=2)C[d]=i[b];i=e.items=null;var U=4,$=new Float32Array(o+2*U);if(o===1){if(p&1)for(D=0,b=0;D<u;D++,b+=o)C[b]*=.5}else for(D=0,b=0;D<u;D++,b+=o)$.set(C.subarray(b,b+o),U),this.extend($,U,o),this.filter($,U,o),C.set($.subarray(U,U+o),b);var F=16,q=[];for(_=0;_<F;_++)q.push(new Float32Array(u+2*U));var H,E=0;if(e=U+u,u===1){if(n&1)for(S=0;S<o;S++)C[S]*=.5}else for(S=0;S<o;S++){if(E===0){for(F=Math.min(o-S,F),b=S,d=U;d<e;b+=o,d++)for(H=0;H<F;H++)q[H][d]=C[b+H];E=F}E--;var Q=q[E];if(this.extend(Q,U,u),this.filter(Q,U,u),E===0)for(b=S-F+1,d=U;d<e;b+=o,d++)for(H=0;H<F;H++)C[b+H]=q[H][d]}return{width:o,height:u,items:C}},r}(),L=function(){function r(){A.call(this)}return r.prototype=Object.create(A.prototype),r.prototype.filter=function(e,s,p){var n=p>>1;s=s|0;var a,t,i,o,u=-1.586134342059924,C=-.052980118572961,_=.882911075530934,w=.443506852043971,b=1.230174104914001,d=1/b;for(a=s-3,t=n+4;t--;a+=2)e[a]*=d;for(a=s-2,i=w*e[a-1],t=n+3;t--&&(o=w*e[a+1],e[a]=b*e[a]-i-o,t--);a+=2)a+=2,i=w*e[a+1],e[a]=b*e[a]-i-o;for(a=s-1,i=_*e[a-1],t=n+2;t--&&(o=_*e[a+1],e[a]-=i+o,t--);a+=2)a+=2,i=_*e[a+1],e[a]-=i+o;for(a=s,i=C*e[a-1],t=n+1;t--&&(o=C*e[a+1],e[a]-=i+o,t--);a+=2)a+=2,i=C*e[a+1],e[a]-=i+o;if(n!==0)for(a=s+1,i=u*e[a-1],t=n;t--&&(o=u*e[a+1],e[a]-=i+o,t--);a+=2)a+=2,i=u*e[a+1],e[a]-=i+o},r}(),T=function(){function r(){A.call(this)}return r.prototype=Object.create(A.prototype),r.prototype.filter=function(e,s,p){var n=p>>1;s=s|0;var a,t;for(a=s,t=n+1;t--;a+=2)e[a]-=e[a-1]+e[a+1]+2>>2;for(a=s+1,t=n;t--;a+=2)e[a]+=e[a-1]+e[a+1]>>1},r}();return K}(),I=function(){function me(){}me.prototype={getContexts:function(A){return A in this?this[A]:this[A]=new Int8Array(65536)}};function K(A,L,T){this.data=A,this.start=L,this.end=T}K.prototype={get decoder(){var A=new h(this.data,this.start,this.end);return z(this,"decoder",A)},get contextCache(){var A=new me;return z(this,"contextCache",A)}};function ie(A,L,T){var v=A.getContexts(L),r=1;function m(p){for(var n=0,a=0;a<p;a++){var t=T.readBit(v,r);r=r<256?r<<1|t:(r<<1|t)&511|256,n=n<<1|t}return n>>>0}var e=m(1),s=m(1)?m(1)?m(1)?m(1)?m(1)?m(32)+4436:m(12)+340:m(8)+84:m(6)+20:m(4)+4:m(2);return e===0?s:s>0?-s:null}function X(A,L,T){for(var v=A.getContexts("IAID"),r=1,m=0;m<T;m++){var e=L.readBit(v,r);r=r<<1|e}return T<31?r&(1<<T)-1:r&2147483647}var G=["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"],Z=[[{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}]],ue=[{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}]}],ce=[39717,1941,229,405],Te=[32,8];function he(A,L,T){var v=T.decoder,r=T.contextCache.getContexts("GB"),m,e,s,p,n,a,t,i=[],o=31735;for(e=0;e<L;e++)for(n=i[e]=new Uint8Array(A),a=e<1?n:i[e-1],t=e<2?n:i[e-2],m=t[0]<<13|t[1]<<12|t[2]<<11|a[0]<<7|a[1]<<6|a[2]<<5|a[3]<<4,s=0;s<A;s++)n[s]=p=v.readBit(r,m),m=(m&o)<<1|(s+3<A?t[s+3]<<11:0)|(s+4<A?a[s+4]<<4:0)|p;return i}function Ce(A,L,T,v,r,m,e,s){if(A&&N("JBIG2 error: MMR encoding is not supported"),v===0&&!m&&!r&&e.length===4&&e[0].x===3&&e[0].y===-1&&e[1].x===-3&&e[1].y===-1&&e[2].x===2&&e[2].y===-2&&e[3].x===-2&&e[3].y===-2)return he(L,T,s);var p=!!m,n=Z[v].concat(e);n.sort(function(ne,ke){return ne.y-ke.y||ne.x-ke.x});var a=n.length,t=new Int8Array(a),i=new Int8Array(a),o=[],u=0,C=0,_=0,w=0,b,d;for(d=0;d<a;d++)t[d]=n[d].x,i[d]=n[d].y,C=Math.min(C,n[d].x),_=Math.max(_,n[d].x),w=Math.min(w,n[d].y),d<a-1&&n[d].y===n[d+1].y&&n[d].x===n[d+1].x-1?u|=1<<a-1-d:o.push(d);var S=o.length,D=new Int8Array(S),U=new Int8Array(S),$=new Uint16Array(S);for(b=0;b<S;b++)d=o[b],D[b]=n[d].x,U[b]=n[d].y,$[b]=1<<a-1-d;for(var F=-C,q=-w,H=L-_,E=ce[v],Q=new Uint8Array(L),ee=[],ve=s.decoder,R=s.contextCache.getContexts("GB"),W=0,oe,re,Pe,Le=0,V,ae,B=0;B<T;B++){if(r){var xe=ve.readBit(R,E);if(W^=xe,W){ee.push(Q);continue}}for(Q=new Uint8Array(Q),ee.push(Q),oe=0;oe<L;oe++){if(p&&m[B][oe]){Q[oe]=0;continue}if(oe>=F&&oe<H&&B>=q)for(Le=Le<<1&u,d=0;d<S;d++)re=B+U[d],Pe=oe+D[d],V=ee[re][Pe],V&&(V=$[d],Le|=V);else for(Le=0,ae=a-1,d=0;d<a;d++,ae--)Pe=oe+t[d],Pe>=0&&Pe<L&&(re=B+i[d],re>=0&&(V=ee[re][Pe],V&&(Le|=V<<ae)));var fe=ve.readBit(R,Le);Q[oe]=fe}}return ee}function we(A,L,T,v,r,m,e,s,p){var n=ue[T].coding;T===0&&(n=n.concat([s[0]]));var a=n.length,t=new Int32Array(a),i=new Int32Array(a),o;for(o=0;o<a;o++)t[o]=n[o].x,i[o]=n[o].y;var u=ue[T].reference;T===0&&(u=u.concat([s[1]]));var C=u.length,_=new Int32Array(C),w=new Int32Array(C);for(o=0;o<C;o++)_[o]=u[o].x,w[o]=u[o].y;for(var b=v[0].length,d=v.length,S=Te[T],D=[],U=p.decoder,$=p.contextCache.getContexts("GR"),F=0,q=0;q<L;q++){if(e){var H=U.readBit($,S);F^=H,F&&N("JBIG2 error: prediction is not supported")}var E=new Uint8Array(A);D.push(E);for(var Q=0;Q<A;Q++){var ee,ve,R=0;for(o=0;o<a;o++)ee=q+i[o],ve=Q+t[o],ee<0||ve<0||ve>=A?R<<=1:R=R<<1|D[ee][ve];for(o=0;o<C;o++)ee=q+w[o]+m,ve=Q+_[o]+r,ee<0||ee>=d||ve<0||ve>=b?R<<=1:R=R<<1|v[ee][ve];var W=U.readBit($,R);E[Q]=W}}return D}function be(A,L,T,v,r,m,e,s,p,n,a){A&&N("JBIG2 error: huffman is not supported");for(var t=[],i=0,o=x(T.length+v),u=a.decoder,C=a.contextCache;t.length<v;){var _=ie(C,"IADH",u);i+=_;for(var w=0,b=0;;){var d=ie(C,"IADW",u);if(d===null)break;w+=d,b+=w;var S;if(L){var D=ie(C,"IAAI",u);if(D>1)S=ye(A,L,w,i,0,D,1,T.concat(t),o,0,0,1,0,m,p,n,a);else{var U=X(C,u,o),$=ie(C,"IARDX",u),F=ie(C,"IARDY",u),q=U<T.length?T[U]:t[U-T.length];S=we(w,i,p,q,$,F,!1,n,a)}}else S=Ce(!1,w,i,e,!1,null,s,a);t.push(S)}}for(var H=[],E=[],Q=!1,ee=T.length+v;E.length<ee;){for(var ve=ie(C,"IAEX",u);ve--;)E.push(Q);Q=!Q}for(var R=0,W=T.length;R<W;R++)E[R]&&H.push(T[R]);for(var oe=0;oe<v;R++,oe++)E[R]&&H.push(t[oe]);return H}function ye(A,L,T,v,r,m,e,s,p,n,a,t,i,o,u,C,_){A&&N("JBIG2 error: huffman is not supported");var w=[],b,d;for(b=0;b<v;b++){if(d=new Uint8Array(T),r)for(var S=0;S<T;S++)d[S]=r;w.push(d)}var D=_.decoder,U=_.contextCache,$=-ie(U,"IADT",D),F=0;for(b=0;b<m;){var q=ie(U,"IADT",D);$+=q;var H=ie(U,"IAFS",D);F+=H;var E=F;do{var Q=e===1?0:ie(U,"IAIT",D),ee=e*$+Q,ve=X(U,D,p),R=L&&ie(U,"IARI",D),W=s[ve],oe=W[0].length,re=W.length;if(R){var Pe=ie(U,"IARDW",D),Le=ie(U,"IARDH",D),V=ie(U,"IARDX",D),ae=ie(U,"IARDY",D);oe+=Pe,re+=Le,W=we(oe,re,u,W,(Pe>>1)+V,(Le>>1)+ae,!1,C,_)}var B=ee-(t&1?0:re),xe=E-(t&2?oe:0),fe,ne,ke;if(n){for(fe=0;fe<re;fe++)if(d=w[xe+fe],!!d){ke=W[fe];var Oe=Math.min(T-B,oe);switch(i){case 0:for(ne=0;ne<Oe;ne++)d[B+ne]|=ke[ne];break;case 2:for(ne=0;ne<Oe;ne++)d[B+ne]^=ke[ne];break;default:N("JBIG2 error: operator "+i+" is not supported")}}E+=re-1}else{for(ne=0;ne<re;ne++)if(d=w[B+ne],!!d)switch(ke=W[ne],i){case 0:for(fe=0;fe<oe;fe++)d[xe+fe]|=ke[fe];break;case 2:for(fe=0;fe<oe;fe++)d[xe+fe]^=ke[fe];break;default:N("JBIG2 error: operator "+i+" is not supported")}E+=oe-1}b++;var ze=ie(U,"IADS",D);if(ze===null)break;E+=ze+a}while(!0)}return w}function _e(A,L){var T={};T.number=g(A,L);var v=A[L+4],r=v&63;G[r]||N("JBIG2 error: invalid segment type: "+r),T.type=r,T.typeName=G[r],T.deferredNonRetain=!!(v&128);var m=!!(v&64),e=A[L+5],s=e>>5&7,p=[e&31],n=L+6;if(e===7){s=g(A,n-1)&536870911,n+=3;var a=s+7>>3;for(p[0]=A[n++];--a>0;)p.push(A[n++])}else(e===5||e===6)&&N("JBIG2 error: invalid referred-to flags");T.retainBits=p;var t=T.number<=256?1:T.number<=65536?2:4,i=[],o,u;for(o=0;o<s;o++){var C=t===1?A[n]:t===2?y(A,n):g(A,n);i.push(C),n+=t}if(T.referredTo=i,m?(T.pageAssociation=g(A,n),n+=4):T.pageAssociation=A[n++],T.length=g(A,n),n+=4,T.length===4294967295)if(r===38){var _=pe(A,n),w=A[n+M],b=!!(w&1),d=6,S=new Uint8Array(d);for(b||(S[0]=255,S[1]=172),S[2]=_.height>>>24&255,S[3]=_.height>>16&255,S[4]=_.height>>8&255,S[5]=_.height&255,o=n,u=A.length;o<u;o++){for(var D=0;D<d&&S[D]===A[o+D];)D++;if(D===d){T.length=o+d;break}}T.length===4294967295&&N("JBIG2 error: segment end was not found")}else N("JBIG2 error: invalid unknown segment length");return T.headerEnd=n,T}function Me(A,L,T,v){for(var r=[],m=T;m<v;){var e=_e(L,m);m=e.headerEnd;var s={header:e,data:L};if(A.randomAccess||(s.start=m,m+=e.length,s.end=m),r.push(s),e.type===51)break}if(A.randomAccess)for(var p=0,n=r.length;p<n;p++)r[p].start=m,m+=r[p].header.length,r[p].end=m;return r}function pe(A,L){return{width:g(A,L),height:g(A,L+4),x:g(A,L+8),y:g(A,L+12),combinationOperator:A[L+16]&7}}var M=17;function O(A,L){var T=A.header,v=A.data,r=A.start,m=A.end,e,s,p,n;switch(T.type){case 0:var a={},t=y(v,r);if(a.huffman=!!(t&1),a.refinement=!!(t&2),a.huffmanDHSelector=t>>2&3,a.huffmanDWSelector=t>>4&3,a.bitmapSizeSelector=t>>6&1,a.aggregationInstancesSelector=t>>7&1,a.bitmapCodingContextUsed=!!(t&256),a.bitmapCodingContextRetained=!!(t&512),a.template=t>>10&3,a.refinementTemplate=t>>12&1,r+=2,!a.huffman){for(n=a.template===0?4:1,s=[],p=0;p<n;p++)s.push({x:P(v,r),y:P(v,r+1)}),r+=2;a.at=s}if(a.refinement&&!a.refinementTemplate){for(s=[],p=0;p<2;p++)s.push({x:P(v,r),y:P(v,r+1)}),r+=2;a.refinementAt=s}a.numberOfExportedSymbols=g(v,r),r+=4,a.numberOfNewSymbols=g(v,r),r+=4,e=[a,T.number,T.referredTo,v,r,m];break;case 6:case 7:var i={};i.info=pe(v,r),r+=M;var o=y(v,r);if(r+=2,i.huffman=!!(o&1),i.refinement=!!(o&2),i.stripSize=1<<(o>>2&3),i.referenceCorner=o>>4&3,i.transposed=!!(o&64),i.combinationOperator=o>>7&3,i.defaultPixelValue=o>>9&1,i.dsOffset=o<<17>>27,i.refinementTemplate=o>>15&1,i.huffman){var u=y(v,r);r+=2,i.huffmanFS=u&3,i.huffmanDS=u>>2&3,i.huffmanDT=u>>4&3,i.huffmanRefinementDW=u>>6&3,i.huffmanRefinementDH=u>>8&3,i.huffmanRefinementDX=u>>10&3,i.huffmanRefinementDY=u>>12&3,i.huffmanRefinementSizeSelector=!!(u&14)}if(i.refinement&&!i.refinementTemplate){for(s=[],p=0;p<2;p++)s.push({x:P(v,r),y:P(v,r+1)}),r+=2;i.refinementAt=s}i.numberOfSymbolInstances=g(v,r),r+=4,i.huffman&&N("JBIG2 error: huffman is not supported"),e=[i,T.referredTo,v,r,m];break;case 38:case 39:var C={};C.info=pe(v,r),r+=M;var _=v[r++];if(C.mmr=!!(_&1),C.template=_>>1&3,C.prediction=!!(_&8),!C.mmr){for(n=C.template===0?4:1,s=[],p=0;p<n;p++)s.push({x:P(v,r),y:P(v,r+1)}),r+=2;C.at=s}e=[C,v,r,m];break;case 48:var w={width:g(v,r),height:g(v,r+4),resolutionX:g(v,r+8),resolutionY:g(v,r+12)};w.height===4294967295&&delete w.height;var b=v[r+16],d=y(v,r+17);w.lossless=!!(b&1),w.refinement=!!(b&2),w.defaultPixelValue=b>>2&1,w.combinationOperator=b>>3&3,w.requiresBuffer=!!(b&32),w.combinationOperatorOverride=!!(b&64),e=[w];break;case 49:break;case 50:break;case 51:break;case 62:break;default:N("JBIG2 error: segment type "+T.typeName+"("+T.type+") is not implemented")}var S="on"+T.typeName;S in L&&L[S].apply(L,e)}function Y(A,L){for(var T=0,v=A.length;T<v;T++)O(A[T],L)}function J(A,L,T){var v=L;(A[v]!==151||A[v+1]!==74||A[v+2]!==66||A[v+3]!==50||A[v+4]!==13||A[v+5]!==10||A[v+6]!==26||A[v+7]!==10)&&N("JBIG2 error: invalid header");var r={};v+=8;var m=A[v++];r.randomAccess=!(m&1),m&2||(r.numberOfPages=g(A,v),v+=4);var e=Me(r,A,v,T);N("Not implemented")}function k(A){for(var L=new se,T=0,v=A.length;T<v;T++){var r=A[T],m=Me({},r.data,r.start,r.end);Y(m,L)}return L}function se(){}se.prototype={onPageInformation:function(L){this.currentPageInfo=L;var T=L.width+7>>3,v=new Uint8Array(T*L.height);if(L.defaultPixelValue)for(var r=0,m=v.length;r<m;r++)v[r]=255;this.buffer=v},drawBitmap:function(L,T){var v=this.currentPageInfo,r=L.width,m=L.height,e=v.width+7>>3,s=v.combinationOperatorOverride?L.combinationOperator:v.combinationOperator,p=this.buffer,n=128>>(L.x&7),a=L.y*e+(L.x>>3),t,i,o,u;switch(s){case 0:for(t=0;t<m;t++){for(o=n,u=a,i=0;i<r;i++)T[t][i]&&(p[u]|=o),o>>=1,o||(o=128,u++);a+=e}break;case 2:for(t=0;t<m;t++){for(o=n,u=a,i=0;i<r;i++)T[t][i]&&(p[u]^=o),o>>=1,o||(o=128,u++);a+=e}break;default:N("JBIG2 error: operator "+s+" is not supported")}},onImmediateGenericRegion:function(L,T,v,r){var m=L.info,e=new K(T,v,r),s=Ce(L.mmr,m.width,m.height,L.template,L.prediction,null,L.at,e);this.drawBitmap(m,s)},onImmediateLosslessGenericRegion:function(){this.onImmediateGenericRegion.apply(this,arguments)},onSymbolDictionary:function(L,T,v,r,m,e){var s;L.huffman&&N("JBIG2 error: huffman is not supported");var p=this.symbols;p||(this.symbols=p={});for(var n=[],a=0,t=v.length;a<t;a++)n=n.concat(p[v[a]]);var i=new K(r,m,e);p[T]=be(L.huffman,L.refinement,n,L.numberOfNewSymbols,L.numberOfExportedSymbols,s,L.template,L.at,L.refinementTemplate,L.refinementAt,i)},onImmediateTextRegion:function(L,T,v,r,m){for(var e=L.info,s,p=this.symbols,n=[],a=0,t=T.length;a<t;a++)n=n.concat(p[T[a]]);var i=x(n.length),o=new K(v,r,m),u=ye(L.huffman,L.refinement,e.width,e.height,L.defaultPixelValue,L.numberOfSymbolInstances,L.stripSize,n,i,L.transposed,L.dsOffset,L.referenceCorner,L.combinationOperator,s,L.refinementTemplate,L.refinementAt,o);this.drawBitmap(e,u)},onImmediateLosslessTextRegion:function(){this.onImmediateTextRegion.apply(this,arguments)}};function j(){}return j.prototype={parseChunks:function(L){return k(L)}},j}();function x(de){for(var me=1,K=0;de>me;)me<<=1,K++;return K}function P(de,me){return de[me]<<24>>24}function y(de,me){return de[me]<<8|de[me+1]}function g(de,me){return(de[me]<<24|de[me+1]<<16|de[me+2]<<8|de[me+3])>>>0}function z(de,me,K){return Object.defineProperty(de,me,{value:K,enumerable:!0,configurable:!0,writable:!1}),K}var N=function(){throw console.error.apply(console,arguments),new Error("PDFJS error: "+arguments[0])},te=function(){console.warn.apply(console,arguments)},Ae=function(){console.info.apply(console,arguments)};I.prototype.parse=function(he){var K=0,ie=he.length;(he[K]!==151||he[K+1]!==74||he[K+2]!==66||he[K+3]!==50||he[K+4]!==13||he[K+5]!==10||he[K+6]!==26||he[K+7]!==10)&&N("JBIG2 error: invalid header");var X={};K+=8;var G=he[K++];X.randomAccess=!(G&1),G&2||(X.numberOfPages=g(he,K),K+=4);for(var Z=this.parseChunks([{data:he,start:K,end:ie}]),ue=Z.currentPageInfo.width,ce=Z.currentPageInfo.height,Te=Z.buffer,he=new Uint8Array(ue*ce),Ce=0,we=0,be=0;be<ce;be++)for(var ye=0,_e,Me=0;Me<ue;Me++)ye||(ye=128,_e=Te[we++]),he[Ce++]=_e&ye?0:255,ye>>=1;this.width=ue,this.height=ce,this.data=he},c.JpegImage=f,c.JpxImage=l,c.Jbig2Image=I})(Ye||(Ye={}));var Ar=Ye.JpegImage,It=Ye.JpxImage,Pt=Ye.Jbig2Image;/**
 * @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.
 */De(Ir,async(c,f,h,l,I)=>{const x=new Ar;if(x.parse(c),f!==void 0&&h!==void 0&&x.width*x.height!==f*h)throw new Error(`JPEG data does not have the expected dimensions: width=${x.width}, height=${x.height}, expected width=${f}, expected height=${h}`);if(f=x.width,h=x.height,l!==void 0&&x.numComponents!==l)throw new Error(`JPEG data does not have the expected number of components: components=${x.numComponents}, expected=${l}`);l=x.numComponents;let P;if(x.numComponents===1)P=x.getData(x.width,x.height,!1);else if(x.numComponents===3)if(P=x.getData(x.width,x.height,!1),I){const y=f*h,g=new Uint8Array(y);for(let z=0;z<y;++z)g[z]=P[z*3];P=g}else P=yr(P,x.width*x.height,3);else throw new Error(`JPEG data has an unsupported number of components: components=${x.numComponents}`);return{value:{width:f,height:h,numComponents:l,uint8Array:P},transfer:[P.buffer]}});var cr=ge(3075);/**
 * @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 Tr=Ee("decodeGzip");/**
 * @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.
 */De(Tr,async c=>{const f=cr.Ay.inflate(c);return{value:f,transfer:[f.buffer]}});/**
 * @license
 * Copyright 2022 William Silversmith
 * 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 Mr=Ee("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 hr={emscripten_notify_memory_growth:()=>{},proc_exit:c=>{throw`proc exit: ${c}`}},kr=(async()=>{const c=(await WebAssembly.instantiateStreaming(fetch(new URL(ge(3200),ge.b)),{env:hr,wasi_snapshot_preview1:hr})).instance;return c.exports._initialize(),c})();var Lr=(c=>(c[c.GRAYSCALE=0]="GRAYSCALE",c[c.RGB=2]="RGB",c[c.PALETTE=3]="PALETTE",c[c.GRAYSCALE_ALPHA=4]="GRAYSCALE_ALPHA",c[c.RGBA=6]="RGBA",c))(Lr||{});const Qe=[137,80,78,71,13,10,26,10],_r=["I","H","D","R"];function Er(c){function f(X,G){return X.every((Z,ue)=>Z===G[ue])}if(c.length<12)throw new Error("png: Invalid image size: {buffer.length}");if(!f(Qe,c))throw new Error("png: didn't match magic numbers: {buffer.slice(0,8)}");const l=new DataView(c.buffer,Qe.length),I=l.getUint32(0,!1);if(c.length<Qe.length+I+12)throw new Error("png: Invalid image size: {buffer.length}");const P=[4,5,6,7].map(X=>String.fromCharCode(l.getUint8(X)));if(!f(P,_r))throw new Error(`png: Invalid header code (should be IHDR): ${P}`);const y=l.getUint32(8,!1),g=l.getUint32(12,!1),z=l.getUint8(16),N=l.getUint8(17),te=l.getUint8(18),Ae=l.getUint8(19),de=l.getUint8(20);if(y===0||g===0)throw new Error(`png: 0 is not a valid width or height. width: ${y} height: ${g}`);if(te!==0)throw new Error(`png: Invalid compression method Only 0 is supported (DEFLATE). Got: ${te}`);if(Ae!==0)throw new Error(`png: Invalid filter method. Only 0 (adaptive filtering) is supported. Got: ${Ae}`);if(de>1)throw new Error(`png: invalid interlace method. Only 0 (no interlace) and 1 (adam7) are supported. Got: ${de}`);const me=[1,2,4,8,16];if(me.indexOf(z)===-1)throw new Error(`png: invalid bit depth. Got: ${z} Valid Depths: ${me}`);let K=z<=8?1:2,ie=1;if(N!==0)if(N===2){if(z!==8&&z!==16)throw new Error(`png: invalid bit depth for RGB colorspace. Got: ${z}`);ie=3}else if(N===3)K=1,ie=3;else if(N===6){if(z!==8&&z!==16)throw new Error(`png: invalid bit depth for RGBA colorspace. Got: ${z}`);ie=4}else if(N===4){if(z!==8&&z!==16)throw new Error(`png: invalid bit depth for grayscale + alpha channel colorspace. Got: ${z}`);ie=4}else throw new Error(`png: Invalid color space: ${N}`);return{sx:y,sy:g,dataWidth:K,numChannels:ie}}async function Sr(c,f,h,l,I,x){const P=await kr;let{sx:y,sy:g,dataWidth:z,numChannels:N}=Er(c);if(x&&(z=1,N=1),f!==void 0&&y!==f||h!==void 0&&g!==h||l!==void 0&&l!==N||I!==z)throw new Error(`png: Image decode parameters did not match expected chunk parameters.
         Expected: width: ${f} height: ${h} channels: ${l} bytes per pixel: ${I} 
         Decoded:  width: ${y} height: ${g} channels: ${N} bytes per pixel: ${z}
         Convert to Grayscale? ${x}
        `);const te=y*g*z*N;if(te<0)throw new Error(`png: Failed to decode png image size. image size: ${te}`);const Ae=P.exports.malloc(c.byteLength),de=P.exports.malloc(te);new Uint8Array(P.exports.memory.buffer).set(c,Ae);const K=P.exports.png_decompress(Ae,c.byteLength,de,te,x);try{if(K!==0)throw new Error(`png: Failed to decode png image. decoder code: ${K}`);const ie=new Uint8Array(P.exports.memory.buffer,de,te);return{width:y,height:g,numComponents:N,uint8Array:ie.slice(0)}}finally{P.exports.free(Ae),P.exports.free(de)}}/**
 * @license
 * Copyright 2022 William Silversmith
 * 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.
 */De(Mr,async(c,f,h,l,I,x)=>{const P=await Sr(c,f,h,l,I,x);return{value:P,transfer:[P.uint8Array.buffer]}});/**
 * @license
 * Copyright 2020 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 Or=Ee("decodeBlosc");/**
 * @license
 * Copyright 2020 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.
 */De(Or,async c=>{const{default:f}=await ge.e(121).then(ge.bind(ge,5121)),l=await f.fromConfig({id:"blosc"}).decode(c);return{value:l,transfer:[l.buffer]}});/**
 * @license
 * Copyright 2023 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 Ur=Ee("decodeZstd");/**
 * @license
 * Copyright 2023 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.
 */De(Ur,async c=>{const{default:f}=await ge.e(505).then(ge.bind(ge,7505)),l=await f.fromConfig({id:"blosc"}).decode(c);return{value:l,transfer:[l.buffer]}});/**
 * @license
 * Copyright 2020 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 Dr=Ee("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 Jr{constructor(f=16){this.length=0,this.data=new Float32Array(f)}resize(f){const{data:h}=this;if(f>h.length){const l=new Float32Array(Math.max(f,h.length*2));l.set(h.subarray(0,this.length)),this.data=l}this.length=f}get view(){const{data:f}=this;return new Float32Array(f.buffer,f.byteOffset,this.length)}shrinkToFit(){this.data=new Float32Array(this.view)}clear(){this.length=0}appendArray(f){const{length:h}=this;this.resize(h+f.length),this.data.set(f,h)}eraseRange(f,h){this.data.copyWithin(f,h,this.length),this.length-=h-f}}/**
 * @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.
 */function Fr(c){const f=new Uint8Array(c.buffer,c.byteOffset,c.byteLength);return f.length>2&&f[0]===31&&f[1]===139}function vr(c){let f;return c instanceof ArrayBuffer?f=new Uint8Array(c):f=new Uint8Array(c.buffer,c.byteOffset,c.byteLength),Fr(f)?cr.Ay.inflate(f):f}/**
 * @license
 * Copyright 2020 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.
 */De(Dr,async c=>{c=vr(c);let f=new TextDecoder().decode(c);f=f.replace(/#.*/g,"");const h=new Jr,l=new lr;for(const P of f.matchAll(/^v\s+([-0-9.eE]+)\s+([-0-9.eE]+)\s+([-0-9.eE]+)\s*$/gm))h.appendArray([parseFloat(P[1]),parseFloat(P[2]),parseFloat(P[3])]);for(const P of f.matchAll(/^f\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s*$/gm))l.appendArray([parseInt(P[1],10)-1,parseInt(P[2],10)-1,parseInt(P[3],10)-1]);h.shrinkToFit(),l.shrinkToFit();const I={info:{numVertices:h.length/3,numTriangles:l.length/3,vertexAttributes:[]},vertexPositions:h.view,indices:l.view,vertexAttributes:[]},x=I.vertexPositions.byteLength+I.indices.byteLength;return console.log(I),{value:{data:I,size:x},transfer:[I.indices.buffer,I.vertexPositions.buffer]}});/**
 * @license
 * Copyright 2021 William Silversmith
 * 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 zr=Ee("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 fr={emscripten_notify_memory_growth:()=>{},proc_exit:c=>{throw`proc exit: ${c}`}},Hr=(async()=>{const c=(await WebAssembly.instantiateStreaming(fetch(new URL(ge(3941),ge.b)),{env:fr,wasi_snapshot_preview1:fr})).instance;return c.exports._initialize(),c})();function Xr(c){if(!(c[0]===99&&c[1]===112&&c[2]===115&&c[3]===111))throw new Error("compresso: didn't match magic numbers");if(c[4]>1)throw new Error("compresso: didn't match format version");const l=new DataView(c.buffer,0),I=c[5],x=l.getUint16(6,!0),P=l.getUint16(8,!0),y=l.getUint16(10,!0);return{sx:x,sy:P,sz:y,dataWidth:I}}async function Gr(c){const f=await Hr,{sx:h,sy:l,sz:I,dataWidth:x}=Xr(c),P=h*l*I,y=P*x;if(y<0)throw new Error(`Failed to decode compresso image. image size: ${y}`);const g=f.exports.malloc(y),z=f.exports.malloc(c.byteLength);new Uint8Array(f.exports.memory.buffer).set(c,z);const te=f.exports.compresso_decompress(z,c.byteLength,g);try{if(te!==0)throw new Error(`Failed to decode compresso image. decoder code: ${te}`);return new Uint8Array(f.exports.memory.buffer,g,P*x).slice(0)}finally{f.exports.free(z),f.exports.free(g)}}/**
 * @license
 * Copyright 2021 William Silversmith
 * 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.
 */De(zr,async c=>{const f=await Gr(c);return{value:f,transfer:[f.buffer]}});/**
 * @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 $r=Ee("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 Yr=1e3,Vr=/^[ \t]*#[ \t]+vtk[ \t]+DataFile[ \t]+Version[ \t]+([^\s]+)[ \t]*\n(.*)\n[ \t]*(ASCII|BINARY)[ \t]*\n[ \t]*DATASET[ \t]+([^ ]+)[ \t]*\n/,Rr=/^[ \t]*POINT_DATA[ \t]+([0-9]+)[ \t]*$/,Nr=/^[ \t]*POINTS[ \t]+([0-9]+)[ \t]+([^\s]+)[ \t]*$/,Zr=/^[ \t]*SCALARS[ \t]+([^\s]+)[ \t]+([^\s]+)(?:[ \t]+([0-9]+))?[ \t]*$/,Qr=/^[ \t]*LOOKUP_TABLE[ \t]+([^\s]+)[ \t]*$/,Wr=/^[ \t]*POLYGONS[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]*$/,Kr=/^[ \t]*3[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]*$/,ur=/^[ \t]*$/;class qr{constructor(f,h,l,I,x,P){this.header=f,this.numVertices=h,this.vertexPositions=l,this.numTriangles=I,this.indices=x,this.vertexAttributes=P}}function Br(c){let f=c.vertexPositions.byteLength+c.indices.byteLength;for(const h of c.vertexAttributes)f+=h.data.byteLength;return f}function jr(c,f){const I=new TextDecoder().decode(f).split(`
`),x=I.length;let P=0,y=-1,g,z=-1,N;const te=new Array;function Ae(X,G,Z,ue){const ce=RegExp("^[ 	]*"+"([^s]+)[ 	]+".repeat(Z-1)+"([^s]+)[ 	]*$");if(x-P<G)throw new Error(`VTK data ended unexpectedly while parsing ${X}.`);const Te=new Float32Array(G*Z);let he=0;for(let Ce=0;Ce<G;++Ce){const we=I[P++],be=we.match(ce);if(be===null)throw new Error(`Failed to parse ${X} line ${Ce}: ${JSON.stringify(we)}.`);for(let ye=0;ye<Z;++ye)Te[he++]=parseFloat(be[ye+1])}return Te}function de(X,G){if(N!==void 0)throw new Error("POINTS specified more than once.");y=X,g=Ae("POINTS",X,3,G)}function me(X,G){if(N!==void 0)throw new Error("VERTICES specified more than once.");if(x-P<X)throw new Error("VTK data ended unexpectedly");if(G!==X*4)throw new Error("Only triangular faces are supported.");z=X,N=new Uint32Array(X*3);let Z=0;for(let ue=0;ue<X;++ue){const ce=I[P++].match(Kr);if(ce===null)throw new Error(`Failed to parse indices for face ${ue}`);N[Z++]=parseInt(ce[1],10),N[Z++]=parseInt(ce[2],10),N[Z++]=parseInt(ce[3],10)}}function K(X,G,Z){if(P===x)throw new Error("Expected LOOKUP_TABLE directive.");const ue=I[P++],ce=ue.match(Qr);if(ce===null)throw new Error(`Expected LOOKUP_TABLE directive in ${JSON.stringify(ue)}.`);const Te=ce[1],he=Ae(`SCALARS(${X})`,y,Z,G);te.push({name:X,data:he,numComponents:Z,dataType:G,tableName:Te})}function ie(X){if(y!==X)throw new Error(`Number of vertices specified in POINT_DATA section (${X}) must match number of points (${y}).`);for(;P<x;){const G=I[P];if(G.match(ur)){++P;continue}const Z=G.match(Zr);if(Z!==null){let ue;Z[3]===void 0?ue=1:ue=parseInt(Z[3],10),++P,K(Z[1],Z[2],ue)}}}for(;P<x;){const X=I[P];if(X.match(ur)){++P;continue}let G;if(G=X.match(Nr),G!==null){++P,de(parseInt(G[1],10),G[2]);continue}if(G=X.match(Wr),G!==null){++P,me(parseInt(G[1],10),parseInt(G[2],10));continue}if(G=X.match(Rr),G!==null){++P,ie(parseInt(G[1],10));break}throw new Error(`Failed to parse VTK line ${JSON.stringify(X)}.`)}if(g===void 0)throw new Error("Vertex positions not specified.");if(N===void 0)throw new Error("Indices not specified.");return new qr(c,y,g,z,N,te)}const et=new Map([["POLYDATA",jr]]);function rt(c){const l=new TextDecoder().decode(new Uint8Array(c.buffer,c.byteOffset,Math.min(c.byteLength,Yr))).match(Vr);if(l===null)throw new Error("Failed to parse VTK file header.");const I=l[0].length,x=l[4],P=l[3],y={version:l[1],comment:l[2],datasetType:x,dataFormat:P},g=new Uint8Array(c.buffer,c.byteOffset+I,c.byteLength-I);if(P==="ASCII"){const z=et.get(x);if(z===void 0)throw new Error(`VTK dataset type ${JSON.stringify(x)} is not supported.`);return z(y,g)}throw new Error(`VTK data format ${JSON.stringify(P)} is not supported.`)}/**
 * @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.
 */De($r,async c=>{const f=rt(vr(c));return{value:{data:f,size:Br(f)},transfer:[f.indices.buffer,f.vertexPositions.buffer,...Array.from(f.vertexAttributes.values()).map(h=>h.data.buffer)]}})}},pr={};function Ie(le){var Je=pr[le];if(Je!==void 0)return Je.exports;var ge=pr[le]={exports:{}};return mr[le](ge,ge.exports,Ie),ge.exports}Ie.m=mr,Ie.x=()=>{var le=Ie.O(void 0,[75],()=>Ie(8483));return le=Ie.O(le),le},(()=>{var le=[];Ie.O=(Je,ge,Ee,Se)=>{if(ge){Se=Se||0;for(var Ue=le.length;Ue>0&&le[Ue-1][2]>Se;Ue--)le[Ue]=le[Ue-1];le[Ue]=[ge,Ee,Se];return}for(var Fe=1/0,Ue=0;Ue<le.length;Ue++){for(var[ge,Ee,Se]=le[Ue],He=!0,De=0;De<ge.length;De++)(Se&!1||Fe>=Se)&&Object.keys(Ie.O).every(Re=>Ie.O[Re](ge[De]))?ge.splice(De--,1):(He=!1,Se<Fe&&(Fe=Se));if(He){le.splice(Ue--,1);var Ve=Ee();Ve!==void 0&&(Je=Ve)}}return Je}})(),Ie.d=(le,Je)=>{for(var ge in Je)Ie.o(Je,ge)&&!Ie.o(le,ge)&&Object.defineProperty(le,ge,{enumerable:!0,get:Je[ge]})},Ie.f={},Ie.e=le=>Promise.all(Object.keys(Ie.f).reduce((Je,ge)=>(Ie.f[ge](le,Je),Je),[])),Ie.u=le=>""+le+"."+{75:"423cd3e121d2ad42f697",121:"64b0a48251268e3fddb4",505:"2358dc95446edff9ff70"}[le]+".js",Ie.miniCssF=le=>{},Ie.o=(le,Je)=>Object.prototype.hasOwnProperty.call(le,Je),(()=>{var le;if(typeof import.meta.url=="string"&&(le=import.meta.url),!le)throw new Error("Automatic publicPath is not supported in this browser");le=le.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),Ie.p=le})(),(()=>{Ie.b=new URL("./",import.meta.url);var le={491:0},Je=ge=>{var{ids:Ee,modules:Se,runtime:Ue}=ge,Fe,He,De=0;for(Fe in Se)Ie.o(Se,Fe)&&(Ie.m[Fe]=Se[Fe]);for(Ue&&Ue(Ie);De<Ee.length;De++)He=Ee[De],Ie.o(le,He)&&le[He]&&le[He][0](),le[Ee[De]]=0;Ie.O()};Ie.f.j=(ge,Ee)=>{var Se=Ie.o(le,ge)?le[ge]:void 0;if(Se!==0)if(Se)Ee.push(Se[1]);else{var Ue=import("./"+Ie.u(ge)).then(Je,Fe=>{throw le[ge]!==0&&(le[ge]=void 0),Fe}),Ue=Promise.race([Ue,new Promise(Fe=>Se=le[ge]=[Fe])]);Ee.push(Se[1]=Ue)}},Ie.O.j=ge=>le[ge]===0})(),(()=>{var le=Ie.x;Ie.x=()=>Ie.e(75).then(le)})();var At=Ie.x();

//# sourceMappingURL=neuroglancer_async_computation.7a2236a27da923b7d515.js.map