@gisatcz/deckgl-geolib 1.9.2 → 1.9.3-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
- import{WebMercatorViewport as e,OrthographicViewport as t,project as i,_LayersPass as r,_PickLayersPass as n,log as a,LayerExtension as s,CompositeLayer as o}from"@deck.gl/core";import{TileLayer as l,TerrainLayer as h}from"@deck.gl/geo-layers";import{BitmapLayer as f}from"@deck.gl/layers";import c from"@luma.gl/constants";import u from"chroma-js";import{Framebuffer as d,Texture2D as g,isWebGL2 as p,withParameters as m,ProgramManager as w}from"@luma.gl/core";function y(e,t,i,r){return new(i||(i=Promise))((function(n,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))}function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function _(e){var t=function(e,t){if("object"!==b(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===b(t)?t:String(t)}function v(e,t,i){return(t=_(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var x,k="undefined"!=typeof Float32Array?Float32Array:Array;function T(e,t){const i=[1/0,1/0,-1/0,-1/0];for(const r of e){const e=r.getBounds();if(e){const n=r.projectPosition(e[0],{viewport:t,autoOffset:!1}),a=r.projectPosition(e[1],{viewport:t,autoOffset:!1});i[0]=Math.min(i[0],n[0]),i[1]=Math.min(i[1],n[1]),i[2]=Math.max(i[2],a[0]),i[3]=Math.max(i[3],a[1])}}return Number.isFinite(i[0])?i:null}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),x=new k(2),k!=Float32Array&&(x[0]=0,x[1]=0),function(){var e=function(){var e=new k(3);return k!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}()}(),function(){var e=function(){var e=new k(4);return k!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}()}();function S(i){const{bounds:r,viewport:n,border:a=0}=i,{isGeospatial:s}=n;if(r[2]<=r[0]||r[3]<=r[1])return null;const o=n.unprojectPosition([(r[0]+r[2])/2,(r[1]+r[3])/2,0]);let{width:l,height:h,zoom:f}=i;if(void 0===f){l-=2*a,h-=2*a;const e=Math.min(l/(r[2]-r[0]),h/(r[3]-r[1]));f=Math.min(Math.log2(e),20)}else if(!l||!h){const e=2**f;l=Math.round(Math.abs(r[2]-r[0])*e),h=Math.round(Math.abs(r[3]-r[1])*e);const t=2048-2*a;if(l>t||h>t){const e=t/Math.max(l,h);l=Math.round(l*e),h=Math.round(h*e),f+=Math.log2(e)}}return s?new e({id:n.id,x:a,y:a,width:l,height:h,longitude:o[0],latitude:o[1],zoom:f,orthographic:!0}):new t({id:n.id,x:a,y:a,width:l,height:h,target:o,zoom:f,flipY:!1})}function A(e,t,i){if(!e)return[0,0,1,1];const r=function(e,t){let i;if(t&&2===t.length){const[r,n]=t,a=e.getBounds({z:r}),s=e.getBounds({z:n});i=[Math.min(a[0],s[0]),Math.min(a[1],s[1]),Math.max(a[2],s[2]),Math.max(a[3],s[3])]}else i=e.getBounds();const r=e.projectPosition(i.slice(0,2)),n=e.projectPosition(i.slice(2,4));return[r[0],r[1],n[0],n[1]]}(t,i),n=function(e){const t=e[2]-e[0],i=e[3]-e[1],r=(e[0]+e[2])/2,n=(e[1]+e[3])/2;return[r-t,n-i,r+t,n+i]}(r);return e[2]-e[0]<=n[2]-n[0]&&e[3]-e[1]<=n[3]-n[1]?e:[Math.max(e[0],n[0]),Math.max(e[1],n[1]),Math.min(e[2],n[2]),Math.min(e[3],n[3])]}const C={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},P=Object.keys(C).map((e=>"const float TERRAIN_MODE_".concat(e," = ").concat(C[e],".0;"))).join("\n"),M={name:"terrain",dependencies:[i],inject:{"vs:#decl":"\nuniform float terrain_mode;\nuniform sampler2D terrain_map;\nuniform vec4 terrain_bounds;\nvarying vec3 commonPos;\n".concat(P,"\n "),"vs:#main-start":"\nif (terrain_mode == TERRAIN_MODE_SKIP) {\n gl_Position = vec4(0.0);\n return;\n}\n","vs:DECKGL_FILTER_GL_POSITION":"\ncommonPos = geometry.position.xyz;\nif (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {\n vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;\n position = vec4(texCoords * 2.0 - 1.0, 0.0, 1.0);\n commonPos.z += project_uCommonOrigin.z;\n}\nif (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {\n vec3 anchor = geometry.worldPosition;\n anchor.z = 0.0;\n vec3 anchorCommon = project_position(anchor);\n vec2 texCoords = (anchorCommon.xy - terrain_bounds.xy) / terrain_bounds.zw;\n if (texCoords.x >= 0.0 && texCoords.y >= 0.0 && texCoords.x <= 1.0 && texCoords.y <= 1.0) {\n float terrainZ = texture2D(terrain_map, texCoords).r;\n geometry.position.z += terrainZ;\n position = project_common_position_to_clipspace(geometry.position);\n }\n}\n ","fs:#decl":"\nuniform float terrain_mode;\nuniform sampler2D terrain_map;\nuniform vec4 terrain_bounds;\nvarying vec3 commonPos;\n".concat(P,"\n "),"fs:#main-start":"\nif (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {\n gl_FragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);\n return;\n}\n ","fs:DECKGL_FILTER_COLOR":"\nif ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY)) {\n vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;\n vec4 pixel = texture2D(terrain_map, texCoords);\n if (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY) {\n color = pixel;\n } else {\n // pixel is premultiplied\n color = pixel + color * (1.0 - pixel.a);\n }\n return;\n}\n "},getUniforms:(e={},t)=>{if("dummyHeightMap"in e){const{drawToTerrainHeightMap:i,heightMap:r,heightMapBounds:n,dummyHeightMap:a,terrainCover:s,useTerrainHeightMap:o,terrainSkipRender:l}=e,{project_uCommonOrigin:h}=t;let f=l?C.SKIP:C.NONE,c=a,u=null;if(i)f=C.WRITE_HEIGHT_MAP,u=n;else if(o&&r)f=C.USE_HEIGHT_MAP,c=r,u=n;else if(s){const t=e.pickingActive;c=t?s.getPickingFramebuffer():s.getRenderFramebuffer(),t&&(f=C.SKIP),c?(f=f===C.SKIP?C.USE_COVER_ONLY:C.USE_COVER,u=s.bounds):c=a}return{terrain_mode:f,terrain_map:c,terrain_bounds:u?[u[0]-h[0],u[1]-h[1],u[2]-u[0],u[3]-u[1]]:[0,0,0,0]}}return null}};function I(e,t){return new d(e,{id:t.id,attachments:{36064:new g(e,{...t.float&&{format:p(e)?34836:6408,type:5126},mipmaps:!1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}})}})}class E{constructor(e){v(this,"isDirty",!0),v(this,"targetLayer",void 0),v(this,"renderViewport",null),v(this,"bounds",null),v(this,"fbo",void 0),v(this,"pickingFbo",void 0),v(this,"layers",[]),v(this,"tile",void 0),v(this,"targetBounds",null),v(this,"targetBoundsCommon",null),this.targetLayer=e,this.tile=U(e)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:e,viewport:t,layers:i,layerNeedsRedraw:r}){e&&(this.targetLayer=e);const n=!!t&&this._updateViewport(t);let a=!!i&&this._updateLayers(i);if(r)for(const e of this.layers)if(r[e]){a=!0;break}return a||n}_updateLayers(e){let t=!1;if((e=this.tile?function(e,t){return t.filter((t=>{const i=U(t);return!i||function(e,t){if(e&&t)return e[0][0]<t[1][0]&&t[0][0]<e[1][0]&&e[0][1]<t[1][1]&&t[0][1]<e[1][1];return!1}(e.boundingBox,i.boundingBox)}))}(this.tile,e):e).length!==this.layers.length)t=!0;else for(let i=0;i<e.length;i++){if(e[i].id!==this.layers[i]){t=!0;break}}return t&&(this.layers=e.map((e=>e.id))),t}_updateViewport(e){const t=this.targetLayer;let i=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){i=!0,this.targetBounds=this.tile.boundingBox;const t=e.projectPosition(this.targetBounds[0]),r=e.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[t[0],t[1],r[0],r[1]]}}else this.targetBounds!==t.getBounds()&&(i=!0,this.targetBounds=t.getBounds(),this.targetBoundsCommon=T([t],e));if(!this.targetBoundsCommon)return!1;const r=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{var n;const t=null===(n=this.renderViewport)||void 0===n?void 0:n.zoom;i=i||r!==t;const a=A(this.targetBoundsCommon,e),s=this.bounds;i=i||!s||a.some(((e,t)=>e!==s[t])),this.bounds=a}return i&&(this.renderViewport=S({bounds:this.bounds,zoom:r,viewport:e})),i}getRenderFramebuffer(){return this.renderViewport&&0!==this.layers.length?(this.fbo||(this.fbo=I(this.targetLayer.context.gl,{id:this.id})),this.fbo):null}getPickingFramebuffer(){return!this.renderViewport||0===this.layers.length&&!this.targetLayer.props.pickable?null:(this.pickingFbo||(this.pickingFbo=I(this.targetLayer.context.gl,{id:"".concat(this.id,"-picking")})),this.pickingFbo)}filterLayers(e){return e.filter((({id:e})=>this.layers.includes(e)))}delete(){const{fbo:e,pickingFbo:t}=this;e&&(e.texture.delete(),e.delete()),t&&(t.texture.delete(),t.delete())}}function U(e){for(;e;){const{tile:t}=e.props;if(t)return t;e=e.parent}return null}class D extends r{getRenderableLayers(e,t){const{layers:i}=t,r=[],n=this._getDrawLayerParams(e,t,!0);for(let e=0;e<i.length;e++){const t=i[e];!t.isComposite&&n[e].shouldDrawLayer&&r.push(t)}return r}renderHeightMap(e,t){const i=e.getRenderFramebuffer(),r=e.renderViewport;i&&r&&(i.resize(r),m(this.gl,{clearColor:[0,0,0,0],blend:!0,blendFunc:[1,1],blendEquation:32776,depthTest:!1},(()=>this.render({...t,target:i,pass:"terrain-height-map",layers:t.layers,viewports:[r],effects:[]}))))}renderTerrainCover(e,t){const i=e.getRenderFramebuffer(),r=e.renderViewport;if(!i||!r)return;const n=e.filterLayers(t.layers);i.resize(r),m(this.gl,{clearColor:[0,0,0,0],depthTest:!1},(()=>this.render({...t,target:i,pass:"terrain-cover-".concat(e.id),layers:n,effects:[],viewports:[r]})))}}class O extends n{constructor(...e){super(...e),v(this,"drawParameters",{})}getRenderableLayers(e,t){const{layers:i}=t,r=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);const n=this._getDrawLayerParams(e,t);for(let e=0;e<i.length;e++){const t=i[e];!t.isComposite&&n[e].shouldDrawLayer&&(r.push(t),this.drawParameters[t.id]=n[e].layerParameters)}return r}renderTerrainCover(e,t){const i=e.getPickingFramebuffer(),r=e.renderViewport;if(!i||!r)return;const n=e.filterLayers(t.layers),a=e.targetLayer;a.props.pickable&&n.unshift(a),i.resize(r),m(this.gl,{depthTest:!1},(()=>this.render({...t,pickingFBO:i,pass:"terrain-cover-picking-".concat(e.id),layers:n,effects:[],viewports:[r],cullRect:void 0,deviceRect:r,pickZ:!1})))}getLayerParameters(e,t,i){if(this.drawParameters[e.id])return this.drawParameters[e.id];const r=super.getLayerParameters(e,t,i);return r.blend=!0,r}}class L{static isSupported(e){return d.isSupported(e,{colorBufferFloat:!0})}constructor(e){v(this,"renderViewport",null),v(this,"bounds",null),v(this,"fbo",void 0),v(this,"gl",void 0),v(this,"layers",[]),v(this,"layersBounds",[]),v(this,"layersBoundsCommon",null),v(this,"lastViewport",null),this.gl=e}getRenderFramebuffer(){return this.renderViewport?(this.fbo||(this.fbo=I(this.gl,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:e,viewport:t}){const i=e.length!==this.layers.length||e.some(((e,t)=>e!==this.layers[t]||e.props.transitions||e.getBounds()!==this.layersBounds[t]));i&&(this.layers=e,this.layersBounds=e.map((e=>e.getBounds())),this.layersBoundsCommon=T(e,t));const r=!this.lastViewport||!t.equals(this.lastViewport);if(this.layersBoundsCommon){if(i||r){const e=A(this.layersBoundsCommon,t);if(e[2]<=e[0]||e[3]<=e[1])return this.renderViewport=null,!1;this.bounds=e,this.lastViewport=t;const i=t.scale,r=(e[2]-e[0])*i,n=(e[3]-e[1])*i;return this.renderViewport=r>0||n>0?S({bounds:[t.center[0]-1,t.center[1]-1,t.center[0]+1,t.center[1]+1],zoom:t.zoom,width:Math.min(r,2048),height:Math.min(n,2048),viewport:t}):null,!0}}else this.renderViewport=null;return!1}delete(){this.fbo&&(this.fbo.color.delete(),this.fbo.delete())}}class z{constructor(){v(this,"id","terrain-effect"),v(this,"props",null),v(this,"useInPicking",!0),v(this,"isPicking",!1),v(this,"isDrapingEnabled",!1),v(this,"dummyHeightMap",void 0),v(this,"heightMap",void 0),v(this,"terrainPass",void 0),v(this,"terrainPickingPass",void 0),v(this,"terrainCovers",new Map)}initialize(e){this.dummyHeightMap=new g(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])}),this.terrainPass=new D(e,{id:"terrain"}),this.terrainPickingPass=new O(e,{id:"terrain-picking"}),L.isSupported(e)?this.heightMap=new L(e):a.warn("Terrain offset mode is not supported by this browser")(),w.getDefaultProgramManager(e).addDefaultModule(M)}preRender(e,t){if(!this.dummyHeightMap){this.initialize(e);for(const e of t.layers)e.props.operation.includes("terrain")&&e.setChangeFlags({extensionsChanged:!0})}if(t.pickZ)return void(this.isDrapingEnabled=!1);const{viewports:i}=t,r=t.pass.startsWith("picking");this.isPicking=r,this.isDrapingEnabled=!0;const n=i[0],a=(r?this.terrainPickingPass:this.terrainPass).getRenderableLayers(n,t),s=a.filter((e=>e.props.operation.includes("terrain")));if(0===s.length)return;if(!r){a.filter((e=>"offset"===e.state.terrainDrawMode)).length>0&&this._updateHeightMap(s,n,t)}const o=a.filter((e=>"drape"===e.state.terrainDrawMode));this._updateTerrainCovers(s,o,n,t)}getModuleParameters(e){var t,i;const{terrainDrawMode:r}=e.state;return{heightMap:null===(t=this.heightMap)||void 0===t?void 0:t.getRenderFramebuffer(),heightMapBounds:null===(i=this.heightMap)||void 0===i?void 0:i.bounds,dummyHeightMap:this.dummyHeightMap,terrainCover:this.isDrapingEnabled?this.terrainCovers.get(e.id):null,useTerrainHeightMap:"offset"===r,terrainSkipRender:"drape"===r||!e.props.operation.includes("draw")}}cleanup(){this.dummyHeightMap&&(this.dummyHeightMap.delete(),this.dummyHeightMap=void 0),this.heightMap&&(this.heightMap.delete(),this.heightMap=void 0);for(const e of this.terrainCovers.values())e.delete();this.terrainCovers.clear()}_updateHeightMap(e,t,i){if(!this.heightMap)return;this.heightMap.shouldUpdate({layers:e,viewport:t})&&this.terrainPass.renderHeightMap(this.heightMap,{...i,layers:e,moduleParameters:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,devicePixelRatio:1,drawToTerrainHeightMap:!0}})}_updateTerrainCovers(e,t,i,r){const n={};for(const e of t)e.state.terrainCoverNeedsRedraw&&(n[e.id]=!0,e.state.terrainCoverNeedsRedraw=!1);for(const e of this.terrainCovers.values())e.isDirty=e.isDirty||e.shouldUpdate({layerNeedsRedraw:n});for(const n of e)this._updateTerrainCover(n,t,i,r);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,i,r){const n=this.isPicking?this.terrainPickingPass:this.terrainPass;let a=this.terrainCovers.get(e.id);a||(a=new E(e),this.terrainCovers.set(e.id,a));try{const s=a.shouldUpdate({targetLayer:e,viewport:i,layers:t});(this.isPicking||a.isDirty||s)&&(n.renderTerrainCover(a,{...r,layers:t,moduleParameters:{dummyHeightMap:this.dummyHeightMap,terrainSkipRender:!1,devicePixelRatio:1}}),this.isPicking||(a.isDirty=!1))}catch(t){e.raiseError(t,"Error rendering terrain cover ".concat(a.id))}}_pruneTerrainCovers(){const e=[];for(const[t,i]of this.terrainCovers)i.isActive||e.push(t);for(const t of e)this.terrainCovers.delete(t)}}const G={terrainDrawMode:void 0};class R extends s{getShaders(){return{modules:[M]}}initializeState(){var e;null===(e=this.context.deck)||void 0===e||e._addDefaultEffect(new z)}updateState(e){const{props:t,oldProps:i}=e;if(this.state.terrainDrawMode&&t.terrainDrawMode===i.terrainDrawMode&&t.extruded===i.extruded)return;let{terrainDrawMode:r}=t;if(!r){var n;const e=this.props.extruded,t=null===(n=this.getAttributeManager())||void 0===n?void 0:n.attributes;r=e||t&&"instancePositions"in t?"offset":"drape"}this.setState({terrainDrawMode:r})}onNeedsRedraw(){const e=this.state;"drape"===e.terrainDrawMode&&(e.terrainCoverNeedsRedraw=!0)}}var B;v(R,"defaultProps",G),v(R,"extensionName","TerrainExtension"),function(e){e[e.Double=8]="Double",e[e.Float32=4]="Float32",e[e.UInt64=8]="UInt64",e[e.UInt32=4]="UInt32",e[e.UInt16=2]="UInt16",e[e.UInt8=1]="UInt8"}(B||(B={}));const F=2**32;function V(e,t,i){const r=e.getUint32(t,i),n=e.getUint32(t+4,i),a=i?r+F*n:F*r+n;if(!Number.isSafeInteger(a))throw new Error(a+" exceeds MAX_SAFE_INTEGER. Precision may is lost");return a}function N(e,t,i,r){switch(i){case B.UInt8:return e.getUint8(t);case B.UInt16:return e.getUint16(t,r);case B.UInt32:return e.getUint32(t,r);case B.UInt64:return V(e,t,r)}}var K;!function(e){e.None="application/octet-stream",e.Jpeg="image/jpeg",e.Jp2="image/jp2",e.JpegXl="image/jpegxl",e.Webp="image/webp",e.Zstd="application/zstd",e.Lzw="application/lzw",e.Deflate="application/deflate",e.Lerc="application/lerc",e.Lzma="application/x-lzma"}(K||(K={}));const j={1:K.None,5:K.Lzw,6:K.Jpeg,7:K.Jpeg,8:K.Deflate,34887:K.Lerc,34925:K.Lzma,34712:K.Jp2,5e4:K.Zstd,50001:K.Webp,50002:K.JpegXl};var H,Z,W;function Y(e,t,i){return!(t<e.sourceOffset)&&!(e.sourceOffset+e.byteLength<t+i)}function $(e){switch(e){case W.Uint8:case W.Ascii:case W.Int8:case W.Undefined:return 1;case W.Uint16:case W.Int16:return 2;case W.Uint32:case W.Int32:case W.Float32:return 4;case W.Rational:case W.SignedRational:case W.Float64:case W.Uint64:case W.Int64:case W.Ifd8:return 8;default:throw new Error(`Invalid fieldType ${e}`)}}function X(e,t,i,r){switch(e){case W.Ascii:return String.fromCharCode(t.getUint8(i));case W.Undefined:case W.Uint8:return t.getUint8(i);case W.Int8:return t.getInt8(i);case W.Uint16:return t.getUint16(i,r);case W.Int16:return t.getInt16(i,r);case W.Uint32:return t.getUint32(i,r);case W.Int32:return t.getInt32(i,r);case W.Rational:return[t.getUint32(i,r),t.getUint32(i+4,r)];case W.SignedRational:return[t.getInt32(i,r),t.getInt32(i+4,r)];case W.Float64:return t.getFloat64(i,r);case W.Float32:return t.getFloat32(i,r);case W.Uint64:return V(t,i,r);default:throw new Error(`Unknown read type "${e}" "${W[e]}"`)}}function q(e,t,i,r,n){const a=$(r),s=n*a;if(1===n)return X(r,t,i,e.isLittleEndian);if(r===W.Ascii)return String.fromCharCode.apply(null,new Uint8Array(t.buffer,i,s-1));const o=[];for(let n=0;n<s;n+=a)o.push(X(r,t,i+n,e.isLittleEndian));return o}function J(e,t,i){const r=t.getUint16(i+0,e.isLittleEndian),n=t.getUint16(i+2,e.isLittleEndian),a=N(t,i+4,e.ifdConfig.pointer,e.isLittleEndian),s=$(n)*a;if(s<=e.ifdConfig.pointer){return{type:"inline",id:r,count:a,value:q(e,t,i+4+e.ifdConfig.pointer,n,a),dataType:n,tagOffset:i}}const o=N(t,i+4+e.ifdConfig.pointer,e.ifdConfig.pointer,e.isLittleEndian);switch(r){case H.TileOffsets:case H.TileByteCounts:case H.StripByteCounts:case H.StripOffsets:const e={type:"offset",id:r,count:a,dataType:n,dataOffset:o,isLoaded:!1,value:[],tagOffset:i};return r===H.TileOffsets&&Y(t,o,s)&&function(e,t){const i=$(e.dataType),r=t.byteOffset+e.dataOffset-t.sourceOffset;e.view=new DataView(t.buffer.slice(r,r+i*e.count)),e.view.sourceOffset=e.dataOffset}(e,t),e}if(Y(t,o,s)){return{type:"inline",id:r,count:a,value:q(e,t,o-t.sourceOffset,n,a),dataType:n,tagOffset:i}}return{type:"lazy",id:r,count:a,dataOffset:o,dataType:n,tagOffset:i}}!function(e){e[e.Artist=315]="Artist",e[e.BitsPerSample=258]="BitsPerSample",e[e.CellLength=265]="CellLength",e[e.CellWidth=264]="CellWidth",e[e.ColorMap=320]="ColorMap",e[e.Compression=259]="Compression",e[e.Copyright=33432]="Copyright",e[e.DateTime=306]="DateTime",e[e.ExtraSamples=338]="ExtraSamples",e[e.FillOrder=266]="FillOrder",e[e.FreeByteCounts=289]="FreeByteCounts",e[e.FreeOffsets=288]="FreeOffsets",e[e.GrayResponseCurve=291]="GrayResponseCurve",e[e.GrayResponseUnit=290]="GrayResponseUnit",e[e.HostComputer=316]="HostComputer",e[e.ImageDescription=270]="ImageDescription",e[e.ImageHeight=257]="ImageHeight",e[e.ImageWidth=256]="ImageWidth",e[e.Make=271]="Make",e[e.MaxSampleValue=281]="MaxSampleValue",e[e.MinSampleValue=280]="MinSampleValue",e[e.Model=272]="Model",e[e.NewSubFileType=254]="NewSubFileType",e[e.Orientation=274]="Orientation",e[e.PhotometricInterpretation=262]="PhotometricInterpretation",e[e.PlanarConfiguration=284]="PlanarConfiguration",e[e.ResolutionUnit=296]="ResolutionUnit",e[e.RowsPerStrip=278]="RowsPerStrip",e[e.SamplesPerPixel=277]="SamplesPerPixel",e[e.Software=305]="Software",e[e.StripByteCounts=279]="StripByteCounts",e[e.StripOffsets=273]="StripOffsets",e[e.SubFileType=255]="SubFileType",e[e.Threshholding=263]="Threshholding",e[e.XResolution=282]="XResolution",e[e.YResolution=283]="YResolution",e[e.BadFaxLines=326]="BadFaxLines",e[e.CleanFaxData=327]="CleanFaxData",e[e.ClipPath=343]="ClipPath",e[e.ConsecutiveBadFaxLines=328]="ConsecutiveBadFaxLines",e[e.Decode=433]="Decode",e[e.DefaultImageColor=434]="DefaultImageColor",e[e.DocumentName=269]="DocumentName",e[e.DotRange=336]="DotRange",e[e.HalftoneHints=321]="HalftoneHints",e[e.Indexed=346]="Indexed",e[e.JPEGTables=347]="JPEGTables",e[e.PageName=285]="PageName",e[e.PageNumber=297]="PageNumber",e[e.Predictor=317]="Predictor",e[e.PrimaryChromaticities=319]="PrimaryChromaticities",e[e.ReferenceBlackWhite=532]="ReferenceBlackWhite",e[e.SampleFormat=339]="SampleFormat",e[e.SMinSampleValue=340]="SMinSampleValue",e[e.SMaxSampleValue=341]="SMaxSampleValue",e[e.StripRowCounts=559]="StripRowCounts",e[e.SubIFDs=330]="SubIFDs",e[e.T4Options=292]="T4Options",e[e.T6Options=293]="T6Options",e[e.TileByteCounts=325]="TileByteCounts",e[e.TileHeight=323]="TileHeight",e[e.TileOffsets=324]="TileOffsets",e[e.TileWidth=322]="TileWidth",e[e.TransferFunction=301]="TransferFunction",e[e.WhitePoint=318]="WhitePoint",e[e.XClipPathUnits=344]="XClipPathUnits",e[e.XPosition=286]="XPosition",e[e.YCbCrCoefficients=529]="YCbCrCoefficients",e[e.YCbCrPositioning=531]="YCbCrPositioning",e[e.YCbCrSubSampling=530]="YCbCrSubSampling",e[e.YClipPathUnits=345]="YClipPathUnits",e[e.YPosition=287]="YPosition",e[e.ApertureValue=37378]="ApertureValue",e[e.ColorSpace=40961]="ColorSpace",e[e.DateTimeDigitized=36868]="DateTimeDigitized",e[e.DateTimeOriginal=36867]="DateTimeOriginal",e[e.ExifIFD=34665]="ExifIFD",e[e.ExifVersion=36864]="ExifVersion",e[e.ExposureTime=33434]="ExposureTime",e[e.FileSource=41728]="FileSource",e[e.Flash=37385]="Flash",e[e.FlashpixVersion=40960]="FlashpixVersion",e[e.FNumber=33437]="FNumber",e[e.ImageUniqueID=42016]="ImageUniqueID",e[e.LightSource=37384]="LightSource",e[e.MakerNote=37500]="MakerNote",e[e.ShutterSpeedValue=37377]="ShutterSpeedValue",e[e.UserComment=37510]="UserComment",e[e.IPTC=33723]="IPTC",e[e.ICCProfile=34675]="ICCProfile",e[e.XMP=700]="XMP",e[e.GdalMetadata=42112]="GdalMetadata",e[e.GdalNoData=42113]="GdalNoData",e[e.LercParams=50674]="LercParams",e[e.Photoshop=34377]="Photoshop",e[e.ModelPixelScale=33550]="ModelPixelScale",e[e.ModelTiePoint=33922]="ModelTiePoint",e[e.ModelTransformation=34264]="ModelTransformation",e[e.GeoKeyDirectory=34735]="GeoKeyDirectory",e[e.GeoDoubleParams=34736]="GeoDoubleParams",e[e.GeoAsciiParams=34737]="GeoAsciiParams"}(H||(H={})),function(e){e[e.GTModelTypeGeoKey=1024]="GTModelTypeGeoKey",e[e.GTRasterTypeGeoKey=1025]="GTRasterTypeGeoKey",e[e.GTCitationGeoKey=1026]="GTCitationGeoKey",e[e.GeographicTypeGeoKey=2048]="GeographicTypeGeoKey",e[e.GeogCitationGeoKey=2049]="GeogCitationGeoKey",e[e.GeogGeodeticDatumGeoKey=2050]="GeogGeodeticDatumGeoKey",e[e.GeogPrimeMeridianGeoKey=2051]="GeogPrimeMeridianGeoKey",e[e.GeogLinearUnitsGeoKey=2052]="GeogLinearUnitsGeoKey",e[e.GeogLinearUnitSizeGeoKey=2053]="GeogLinearUnitSizeGeoKey",e[e.GeogAngularUnitsGeoKey=2054]="GeogAngularUnitsGeoKey",e[e.GeogAngularUnitSizeGeoKey=2055]="GeogAngularUnitSizeGeoKey",e[e.GeogEllipsoidGeoKey=2056]="GeogEllipsoidGeoKey",e[e.GeogSemiMajorAxisGeoKey=2057]="GeogSemiMajorAxisGeoKey",e[e.GeogSemiMinorAxisGeoKey=2058]="GeogSemiMinorAxisGeoKey",e[e.GeogInvFlatteningGeoKey=2059]="GeogInvFlatteningGeoKey",e[e.GeogAzimuthUnitsGeoKey=2060]="GeogAzimuthUnitsGeoKey",e[e.GeogPrimeMeridianLongGeoKey=2061]="GeogPrimeMeridianLongGeoKey",e[e.GeogTOWGS84GeoKey=2062]="GeogTOWGS84GeoKey",e[e.ProjectedCSTypeGeoKey=3072]="ProjectedCSTypeGeoKey",e[e.PCSCitationGeoKey=3073]="PCSCitationGeoKey",e[e.ProjectionGeoKey=3074]="ProjectionGeoKey",e[e.ProjCoordTransGeoKey=3075]="ProjCoordTransGeoKey",e[e.ProjLinearUnitsGeoKey=3076]="ProjLinearUnitsGeoKey",e[e.ProjLinearUnitSizeGeoKey=3077]="ProjLinearUnitSizeGeoKey",e[e.ProjStdParallel1GeoKey=3078]="ProjStdParallel1GeoKey",e[e.ProjStdParallel2GeoKey=3079]="ProjStdParallel2GeoKey",e[e.ProjNatOriginLongGeoKey=3080]="ProjNatOriginLongGeoKey",e[e.ProjNatOriginLatGeoKey=3081]="ProjNatOriginLatGeoKey",e[e.ProjFalseEastingGeoKey=3082]="ProjFalseEastingGeoKey",e[e.ProjFalseNorthingGeoKey=3083]="ProjFalseNorthingGeoKey",e[e.ProjFalseOriginLongGeoKey=3084]="ProjFalseOriginLongGeoKey",e[e.ProjFalseOriginLatGeoKey=3085]="ProjFalseOriginLatGeoKey",e[e.ProjFalseOriginEastingGeoKey=3086]="ProjFalseOriginEastingGeoKey",e[e.ProjFalseOriginNorthingGeoKey=3087]="ProjFalseOriginNorthingGeoKey",e[e.ProjCenterLongGeoKey=3088]="ProjCenterLongGeoKey",e[e.ProjCenterLatGeoKey=3089]="ProjCenterLatGeoKey",e[e.ProjCenterEastingGeoKey=3090]="ProjCenterEastingGeoKey",e[e.ProjCenterNorthingGeoKey=3091]="ProjCenterNorthingGeoKey",e[e.ProjScaleAtNatOriginGeoKey=3092]="ProjScaleAtNatOriginGeoKey",e[e.ProjScaleAtCenterGeoKey=3093]="ProjScaleAtCenterGeoKey",e[e.ProjAzimuthAngleGeoKey=3094]="ProjAzimuthAngleGeoKey",e[e.ProjStraightVertPoleLongGeoKey=3095]="ProjStraightVertPoleLongGeoKey",e[e.ProjRectifiedGridAngleGeoKey=3096]="ProjRectifiedGridAngleGeoKey",e[e.VerticalCSTypeGeoKey=4096]="VerticalCSTypeGeoKey",e[e.VerticalCitationGeoKey=4097]="VerticalCitationGeoKey",e[e.VerticalDatumGeoKey=4098]="VerticalDatumGeoKey",e[e.VerticalUnitsGeoKey=4099]="VerticalUnitsGeoKey"}(Z||(Z={})),function(e){e[e.Uint8=1]="Uint8",e[e.Ascii=2]="Ascii",e[e.Uint16=3]="Uint16",e[e.Uint32=4]="Uint32",e[e.Rational=5]="Rational",e[e.Int8=6]="Int8",e[e.Undefined=7]="Undefined",e[e.Int16=8]="Int16",e[e.Int32=9]="Int32",e[e.SignedRational=10]="SignedRational",e[e.Float32=11]="Float32",e[e.Float64=12]="Float64",e[e.Uint64=16]="Uint64",e[e.Int64=17]="Int64",e[e.Ifd8=18]="Ifd8"}(W||(W={}));new Set([H.Compression,H.ImageHeight,H.ImageWidth,H.ModelPixelScale,H.ModelTiePoint,H.ModelTransformation,H.TileHeight,H.TileWidth,H.GeoKeyDirectory,H.GeoAsciiParams,H.GeoDoubleParams,H.TileOffsets]);class Q{constructor(e,t,i){Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tiff",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isGeoTagsLoaded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"tagsGeo",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.tiff=e,this.id=t,this.tags=i}async init(e=!0){const t=[this.fetch(H.Compression),this.fetch(H.ImageHeight),this.fetch(H.ImageWidth),this.fetch(H.ModelPixelScale),this.fetch(H.ModelTiePoint),this.fetch(H.ModelTransformation),this.fetch(H.TileHeight),this.fetch(H.TileWidth)];e&&(t.push(this.fetch(H.GeoKeyDirectory)),t.push(this.fetch(H.GeoAsciiParams)),t.push(this.fetch(H.GeoDoubleParams))),await Promise.all(t),e&&await this.loadGeoTiffTags()}value(e){const t=this.tags.get(e);return null==t||"offset"===t.type&&!1===t.isLoaded?null:t.value}async loadGeoTiffTags(){if(this.isGeoTagsLoaded)return;const e=this.tags.get(H.GeoKeyDirectory);if(null==e)return void(this.isGeoTagsLoaded=!0);if("lazy"===e.type&&null==e.value&&await Promise.all([this.fetch(H.GeoKeyDirectory),this.fetch(H.GeoAsciiParams),this.fetch(H.GeoDoubleParams)]),this.isGeoTagsLoaded=!0,null==e.value)return;const t=e.value;if("number"==typeof t)throw new Error("Invalid geo tags found");for(let e=4;e<=4*t[3];e+=4){const i=t[e],r=t[e+1],n=t[e+3];if(0===r){this.tagsGeo.set(i,n);continue}const a=this.tags.get(r);if(null==a||null==a.value)continue;const s=t[e+2];if("string"!=typeof a.value)throw new Error("Failed to extract GeoTiffTags");this.tagsGeo.set(i,a.value.slice(n,n+s-1).trim())}}valueGeo(e){if(!1===this.isGeoTagsLoaded)throw new Error("loadGeoTiffTags() has not been called");return this.tagsGeo.get(e)}async fetch(e){const t=this.tags.get(e);if(null==t)return null;if("inline"===t.type)return t.value;if("lazy"===t.type)return async function(e,t){if(null!=e.value)return e.value;const i=$(e.dataType)*e.count,r=await t.source.fetch(e.dataOffset,i),n=new DataView(r);return e.value=q(t,n,0,e.dataType,e.count),e.value}(t,this.tiff);if(t.isLoaded)return t.value;if("offset"===t.type)return async function(e,t){const i=$(t.dataType);if(null==t.view){const r=await e.source.fetch(t.dataOffset,i*t.count);t.view=new DataView(r),t.view.sourceOffset=t.dataOffset}return t.value=q(e,t.view,0,t.dataType,t.count),t.isLoaded=!0,t.value}(this.tiff,t);throw new Error("Cannot fetch:"+e)}get origin(){const e=this.value(H.ModelTiePoint);if(null!=e&&6===e.length)return[e[3],e[4],e[5]];const t=this.value(H.ModelTransformation);if(null!=t)return[t[3],t[7],t[11]];if(1===this.value(H.NewSubFileType)&&0!==this.id)return this.tiff.images[0].origin;throw new Error("Image does not have a geo transformation.")}get isGeoLocated(){return!(null==this.value(H.ModelPixelScale)&&null==this.value(H.ModelTransformation))||1===this.value(H.NewSubFileType)&&0!==this.id&&this.tiff.images[0].isGeoLocated}get resolution(){const e=this.value(H.ModelPixelScale);if(null!=e)return[e[0],-e[1],e[2]];const t=this.value(H.ModelTransformation);if(null!=t)return[t[0],t[5],t[10]];if(1===this.value(H.NewSubFileType)&&0!==this.id){const e=this.tiff.images[0],[t,i,r]=e.resolution,n=e.size,a=this.size;return[t*n.width/a.width,i*n.height/a.height,r]}throw new Error("Image does not have a geo transformation.")}get bbox(){const e=this.size,t=this.origin,i=this.resolution;if(null==t||null==e||null==i)throw new Error("Unable to calculate bounding box");const r=t[0],n=t[1],a=r+i[0]*e.width,s=n+i[1]*e.height;return[Math.min(r,a),Math.min(n,s),Math.max(r,a),Math.max(n,s)]}get compression(){const e=this.value(H.Compression);return null==e||"number"!=typeof e?null:j[e]}get epsg(){const e=this.valueGeo(Z.ProjectedCSTypeGeoKey);return 32767===e?null:e}get size(){return{width:this.value(H.ImageWidth),height:this.value(H.ImageHeight)}}isTiled(){return null!==this.value(H.TileWidth)}get tileSize(){return{width:this.value(H.TileWidth),height:this.value(H.TileHeight)}}get tileCount(){const e=this.size,t=this.tileSize;return{x:Math.ceil(e.width/t.width),y:Math.ceil(e.height/t.height)}}get tileOffset(){const e=this.tags.get(H.TileOffsets);if(null==e)throw new Error("No tile offsets found");return e}get stripCount(){const e=this.tags.get(H.StripByteCounts);return null==e?0:e.count}getTileBounds(e,t){const{size:i,tileSize:r}=this,n=t*r.height,a=e*r.width;return{x:a,y:n,width:a+r.width>=i.width?i.width-a:r.width,height:n+r.height>=i.height?i.height-n:r.height}}async getStrip(e){if(this.isTiled())throw new Error("Cannot read stripes, tiff is tiled: "+e);const t=this.tags.get(H.StripByteCounts),i=this.tags.get(H.StripOffsets);if(e>=t.count)throw new Error("Cannot read strip, index out of bounds");const[r,n]=await Promise.all([ee(this.tiff,i,e),ee(this.tiff,t,e)]);return this.getBytes(r,n)}getJpegHeader(e){const t=this.value(H.JPEGTables);if(null==t)throw new Error("Unable to find Jpeg header");const i=t.slice(0,t.length-2),r=new Uint8Array(e.byteLength+i.length-2);return r.set(i,0),r.set(new Uint8Array(e).slice(2),i.length),r}async getBytes(e,t){const i=this.compression;if(null==i)throw new Error("Unsupported compression: "+this.value(H.Compression));if(0===t)return null;const r=await this.tiff.source.fetch(e,t);if(r.byteLength<t)throw new Error(`Failed to fetch bytes from offset:${e} wanted:${t} got:${r.byteLength}`);return this.compression===K.Jpeg?{mimeType:i,bytes:this.getJpegHeader(r)}:{mimeType:i,bytes:r}}async getTile(e,t){const i=this.compression,r=this.size,n=this.tileSize;if(null==n)throw new Error("Tiff is not tiled");if(null==i)throw new Error("Unsupported compression: "+this.value(H.Compression));const a=Math.ceil(r.height/n.height),s=Math.ceil(r.width/n.width);if(e>=s||t>=a)throw new Error(`Tile index is outside of range x:${e} >= ${s} or y:${t} >= ${a}`);const o=t*s+e,l=s*a;if(o>=l)throw new Error(`Tile index is outside of tile range: ${o} >= ${l}`);const{offset:h,imageSize:f}=await this.getTileSize(o);return this.getBytes(h,f)}async hasTile(e,t){const i=this.tileSize,r=this.size;if(null==i)throw new Error("Tiff is not tiled");const n=Math.ceil(r.height/i.height),a=Math.ceil(r.width/i.width);if(e>=a||t>=n)return!1;const s=t*a+e;return(await this.getTileSize(s)).offset>0}async getTileSize(e){const t=this.tiff.options?.tileLeaderByteSize;if(t){const i=await ee(this.tiff,this.tileOffset,e);if(0===i)return{offset:0,imageSize:0};const r=await this.tiff.source.fetch(i-t,t);return{offset:i,imageSize:N(new DataView(r),0,t,this.tiff.isLittleEndian)}}const i=this.tags.get(H.TileByteCounts);if(null==i)throw new Error("No tile byte counts found");const[r,n]=await Promise.all([ee(this.tiff,this.tileOffset,e),ee(this.tiff,i,e)]);return{offset:r,imageSize:n}}}function ee(e,t,i){if(i>t.count||i<0)throw new Error("TagIndex: out of bounds "+t.id+" @ "+i);return"inline"===t.type?t.count>1?t.value[i]:t.value:async function(e,t,i){if(i>t.count||i<0)throw new Error("TagOffset: out of bounds :"+i);if(null!=t.value[i])return t.value[i];const r=$(t.dataType);if(null==t.view){const n=await e.source.fetch(t.dataOffset+i*r,r),a=q(e,new DataView(n),0,t.dataType,1);return t.value[i]=a,a}const n=q(e,t.view,i*r,t.dataType,1);return t.value[i]=n,n}(e,t,i)}var te,ie,re,ne,ae;!function(e){e[e.Big=19789]="Big",e[e.Little=18761]="Little"}(te||(te={})),function(e){e[e.BigTiff=43]="BigTiff",e[e.Tiff=42]="Tiff"}(ie||(ie={})),function(e){e.GdalStructuralMetadataSize="GDAL_STRUCTURAL_METADATA_SIZE",e.Layout="LAYOUT",e.BlockOrder="BLOCK_ORDER",e.BlockLeader="BLOCK_LEADER",e.BlockTrailer="BLOCK_TRAILER",e.KnownIncompatibleEdition="KNOWN_INCOMPATIBLE_EDITION",e.MaskInterleavedWithImagery="MASK_INTERLEAVED_WITH_IMAGERY"}(re||(re={})),function(e){e.RowMajor="ROW_MAJOR"}(ne||(ne={})),function(e){e.uint32="SIZE_AS_UINT4"}(ae||(ae={}));class se{constructor(){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}get isCogOptimized(){return!this.isBroken&&"IFDS_BEFORE_DATA"===this.options.get(re.Layout)}get isBroken(){return"YES"===this.options.get(re.KnownIncompatibleEdition)}process(e,t,i){let r="",n="",a=!1;for(let s=0;s<i;s++){const i=e.getUint8(t+s);if(0===i)break;const o=String.fromCharCode(i);"\n"===o?(this.options.set(r.trim(),n.trim()),r="",n="",a=!1):"="===o?a=!0:a?n+=o:r+=o}}get tileLeaderByteSize(){return this.options.get(re.BlockLeader)===ae.uint32?B.UInt32:null}get isMaskInterleaved(){return"YES"===this.options.get(re.MaskInterleavedWithImagery)}}const oe={version:ie.Tiff,pointer:B.UInt32,offset:B.UInt16,ifd:B.UInt16+B.UInt16+2*B.UInt32},le={version:ie.BigTiff,pointer:B.UInt64,offset:B.UInt64,ifd:B.UInt16+B.UInt16+2*B.UInt64};ie.BigTiff,ie.Tiff;class he{constructor(e){Object.defineProperty(this,"defaultReadSize",{enumerable:!0,configurable:!0,writable:!0,value:16384}),Object.defineProperty(this,"source",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:ie.Tiff}),Object.defineProperty(this,"images",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ifdConfig",{enumerable:!0,configurable:!0,writable:!0,value:oe}),Object.defineProperty(this,"isLittleEndian",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isInitialized",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_initPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.source=e}static create(e){return new he(e).init()}init(){return this._initPromise||(this._initPromise=this.readHeader()),this._initPromise}getImageByResolution(e){const t=this.images[0],i=t.size,[r]=t.resolution,n=r*i.width;for(let t=this.images.length-1;t>0;t--){const i=this.images[t];if(n/i.size.width-e<=.01)return i}return t}async readHeader(){if(this.isInitialized)return this;const e=new DataView(await this.source.fetch(0,this.defaultReadSize));e.sourceOffset=0;let t=0;const i=e.getUint16(t,this.isLittleEndian);if(t+=2,this.isLittleEndian=i===te.Little,!this.isLittleEndian)throw new Error("Only little endian is supported");let r;if(this.version=e.getUint16(t,this.isLittleEndian),t+=2,this.version===ie.BigTiff){this.ifdConfig=le;const i=e.getUint16(t,this.isLittleEndian);if(t+=2,8!==i)throw new Error("Only 8byte pointers are supported");const n=e.getUint16(t,this.isLittleEndian);if(t+=2,0!==n)throw new Error("Invalid big tiff header");r=N(e,t,this.ifdConfig.pointer,this.isLittleEndian),t+=this.ifdConfig.pointer}else{if(this.version!==ie.Tiff)throw new Error(`Only tiff supported version:${this.version}`);r=N(e,t,this.ifdConfig.pointer,this.isLittleEndian),t+=this.ifdConfig.pointer}const n=r-t;for(n>0&&n<16384&&(this.options=new se,this.options.process(e,t,n));0!==r;){let t=e;if(!Y(t,r,1024)){const e=await this.source.fetch(r,fe(this.source,r,this.defaultReadSize));t=new DataView(e),t.sourceOffset=r}r=await this.readIfd(r,t)}return await Promise.all(this.images.map((e=>e.init()))),this.isInitialized=!0,this}async readIfd(e,t){const i=e-t.sourceOffset,r=N(t,i,this.ifdConfig.offset,this.isLittleEndian),n=new Map;if(!Y(t,e,r*this.ifdConfig.ifd))throw new Error("IFD out of range @ "+function(e,t=4,i=!0){const r=e.toString(16).padStart(t,"0");return i?"0x"+r:r}(e)+" IFD"+this.images.length);const a=this.ifdConfig.ifd,s=i+this.ifdConfig.offset;for(let e=0;e<r;e++){const i=J(this,t,s+e*a);n.set(i.id,i)}return this.images.push(new Q(this,this.images.length,n)),N(t,s+r*a,this.ifdConfig.pointer,this.isLittleEndian)}}function fe(e,t,i){if(null==e.metadata?.size)return i;const r=e.metadata.size;return t+i>r?r-t:i}class ce extends Error{code;url;source;constructor(e,t,i,r){super(e,{cause:r}),this.code=t,this.url=i.url,this.source=i,Object.defineProperty(this,"_sourceError",{enumerable:!1,value:"SourceError"})}static is(e){return e instanceof ce||"object"==typeof e&&(null!=e&&("_sourceError"in e&&"SourceError"===e._sourceError))}}const ue={toRange(e,t){if(null==t)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+t-1}`},parseSize(e){const[t,i]=e.split(" ");if("bytes"!==t)throw new Error("Failed to parse content-range: "+e);if(null==i)throw new Error("Failed to parse content-range: "+e);const[,r]=i.split("/"),n=Number(r);if(isNaN(n))throw new Error("Failed to parse content-range: "+e);return n}};function de(e){const t={size:-1},i=e.headers.get("content-range");return null!=i&&(t.size=ue.parseSize(i)),t.eTag=e.headers.get("etag")??void 0,t.contentType=e.headers.get("content-type")??void 0,t.contentDisposition=e.headers.get("content-disposition")??void 0,t}class ge{constructor(e){this.type="http",this.url="string"==typeof e?ge.tryUrl(e):e}static tryUrl(e){try{return new URL(e)}catch(t){return"undefined"!=typeof document?new URL(e,document.baseURI):new URL(e,import.meta.url)}}head(){return this._head||(this._head=ge.fetch(this.url,{method:"HEAD"}).then((e=>{if(!e.ok)throw delete this._head,new Error(`Failed to HEAD ${this.url}`,{cause:{statusCode:e.status,msg:e.statusText}});return this.metadata=de(e),this.metadata}))),this._head}async fetch(e,t){try{const i=ue.toRange(e,t),r={Range:i},n=await ge.fetch(this.url,{headers:r});if(!n.ok)throw new ce(`Failed to fetch ${this.url} ${i}`,n.status,this,new Error(n.statusText));const a=de(n);if(null==this.metadata)this.metadata=a;else if(this.metadata.eTag&&this.metadata.eTag!==a.eTag)throw new ce(`ETag conflict ${this.url} ${i} expected: ${this.metadata.eTag} got: ${a.eTag}`,409,this);return n.arrayBuffer()}catch(e){if(ce.is(e)&&e.source===this)throw e;throw new ce(`Failed to fetch: ${this.url}`,500,this,e)}}}ge.fetch=(e,t)=>fetch(e,t)
2
- /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */;function pe(e){let t=e.length;for(;--t>=0;)e[t]=0}const me=256,we=286,ye=30,be=15,_e=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ve=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),xe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ke=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Te=new Array(576);pe(Te);const Se=new Array(60);pe(Se);const Ae=new Array(512);pe(Ae);const Ce=new Array(256);pe(Ce);const Pe=new Array(29);pe(Pe);const Me=new Array(ye);function Ie(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}let Ee,Ue,De;function Oe(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}pe(Me);const Le=e=>e<256?Ae[e]:Ae[256+(e>>>7)],ze=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Ge=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,ze(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)},Re=(e,t,i)=>{Ge(e,i[2*t],i[2*t+1])},Be=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},Fe=(e,t,i)=>{const r=new Array(16);let n,a,s=0;for(n=1;n<=be;n++)s=s+i[n-1]<<1,r[n]=s;for(a=0;a<=t;a++){let t=e[2*a+1];0!==t&&(e[2*a]=Be(r[t]++,t))}},Ve=e=>{let t;for(t=0;t<we;t++)e.dyn_ltree[2*t]=0;for(t=0;t<ye;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Ne=e=>{e.bi_valid>8?ze(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Ke=(e,t,i,r)=>{const n=2*t,a=2*i;return e[n]<e[a]||e[n]===e[a]&&r[t]<=r[i]},je=(e,t,i)=>{const r=e.heap[i];let n=i<<1;for(;n<=e.heap_len&&(n<e.heap_len&&Ke(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!Ke(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r},He=(e,t,i)=>{let r,n,a,s,o=0;if(0!==e.sym_next)do{r=255&e.pending_buf[e.sym_buf+o++],r+=(255&e.pending_buf[e.sym_buf+o++])<<8,n=e.pending_buf[e.sym_buf+o++],0===r?Re(e,n,t):(a=Ce[n],Re(e,a+me+1,t),s=_e[a],0!==s&&(n-=Pe[a],Ge(e,n,s)),r--,a=Le(r),Re(e,a,i),s=ve[a],0!==s&&(r-=Me[a],Ge(e,r,s)))}while(o<e.sym_next);Re(e,256,t)},Ze=(e,t)=>{const i=t.dyn_tree,r=t.stat_desc.static_tree,n=t.stat_desc.has_stree,a=t.stat_desc.elems;let s,o,l,h=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<a;s++)0!==i[2*s]?(e.heap[++e.heap_len]=h=s,e.depth[s]=0):i[2*s+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=h<2?++h:0,i[2*l]=1,e.depth[l]=0,e.opt_len--,n&&(e.static_len-=r[2*l+1]);for(t.max_code=h,s=e.heap_len>>1;s>=1;s--)je(e,i,s);l=a;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],je(e,i,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,i[2*l]=i[2*s]+i[2*o],e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,i[2*s+1]=i[2*o+1]=l,e.heap[1]=l++,je(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,r=t.max_code,n=t.stat_desc.static_tree,a=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,l=t.stat_desc.max_length;let h,f,c,u,d,g,p=0;for(u=0;u<=be;u++)e.bl_count[u]=0;for(i[2*e.heap[e.heap_max]+1]=0,h=e.heap_max+1;h<573;h++)f=e.heap[h],u=i[2*i[2*f+1]+1]+1,u>l&&(u=l,p++),i[2*f+1]=u,f>r||(e.bl_count[u]++,d=0,f>=o&&(d=s[f-o]),g=i[2*f],e.opt_len+=g*(u+d),a&&(e.static_len+=g*(n[2*f+1]+d)));if(0!==p){do{for(u=l-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,p-=2}while(p>0);for(u=l;0!==u;u--)for(f=e.bl_count[u];0!==f;)c=e.heap[--h],c>r||(i[2*c+1]!==u&&(e.opt_len+=(u-i[2*c+1])*i[2*c],i[2*c+1]=u),f--)}})(e,t),Fe(i,h,e.bl_count)},We=(e,t,i)=>{let r,n,a=-1,s=t[1],o=0,l=7,h=4;for(0===s&&(l=138,h=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=s,s=t[2*(r+1)+1],++o<l&&n===s||(o<h?e.bl_tree[2*n]+=o:0!==n?(n!==a&&e.bl_tree[2*n]++,e.bl_tree[32]++):o<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=0,a=n,0===s?(l=138,h=3):n===s?(l=6,h=3):(l=7,h=4))},Ye=(e,t,i)=>{let r,n,a=-1,s=t[1],o=0,l=7,h=4;for(0===s&&(l=138,h=3),r=0;r<=i;r++)if(n=s,s=t[2*(r+1)+1],!(++o<l&&n===s)){if(o<h)do{Re(e,n,e.bl_tree)}while(0!=--o);else 0!==n?(n!==a&&(Re(e,n,e.bl_tree),o--),Re(e,16,e.bl_tree),Ge(e,o-3,2)):o<=10?(Re(e,17,e.bl_tree),Ge(e,o-3,3)):(Re(e,18,e.bl_tree),Ge(e,o-11,7));o=0,a=n,0===s?(l=138,h=3):n===s?(l=6,h=3):(l=7,h=4)}};let $e=!1;const Xe=(e,t,i,r)=>{Ge(e,0+(r?1:0),3),Ne(e),ze(e,i),ze(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};var qe=(e,t,i,r)=>{let n,a,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<me;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),Ze(e,e.l_desc),Ze(e,e.d_desc),s=(e=>{let t;for(We(e,e.dyn_ltree,e.l_desc.max_code),We(e,e.dyn_dtree,e.d_desc.max_code),Ze(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*ke[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=n&&(n=a)):n=a=i+5,i+4<=n&&-1!==t?Xe(e,t,i,r):4===e.strategy||a===n?(Ge(e,2+(r?1:0),3),He(e,Te,Se)):(Ge(e,4+(r?1:0),3),((e,t,i,r)=>{let n;for(Ge(e,t-257,5),Ge(e,i-1,5),Ge(e,r-4,4),n=0;n<r;n++)Ge(e,e.bl_tree[2*ke[n]+1],3);Ye(e,e.dyn_ltree,t-1),Ye(e,e.dyn_dtree,i-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),He(e,e.dyn_ltree,e.dyn_dtree)),Ve(e),r&&Ne(e)},Je={_tr_init:e=>{$e||((()=>{let e,t,i,r,n;const a=new Array(16);for(i=0,r=0;r<28;r++)for(Pe[r]=i,e=0;e<1<<_e[r];e++)Ce[i++]=r;for(Ce[i-1]=r,n=0,r=0;r<16;r++)for(Me[r]=n,e=0;e<1<<ve[r];e++)Ae[n++]=r;for(n>>=7;r<ye;r++)for(Me[r]=n<<7,e=0;e<1<<ve[r]-7;e++)Ae[256+n++]=r;for(t=0;t<=be;t++)a[t]=0;for(e=0;e<=143;)Te[2*e+1]=8,e++,a[8]++;for(;e<=255;)Te[2*e+1]=9,e++,a[9]++;for(;e<=279;)Te[2*e+1]=7,e++,a[7]++;for(;e<=287;)Te[2*e+1]=8,e++,a[8]++;for(Fe(Te,287,a),e=0;e<ye;e++)Se[2*e+1]=5,Se[2*e]=Be(e,5);Ee=new Ie(Te,_e,257,we,be),Ue=new Ie(Se,ve,0,ye,be),De=new Ie(new Array(0),xe,0,19,7)})(),$e=!0),e.l_desc=new Oe(e.dyn_ltree,Ee),e.d_desc=new Oe(e.dyn_dtree,Ue),e.bl_desc=new Oe(e.bl_tree,De),e.bi_buf=0,e.bi_valid=0,Ve(e)},_tr_stored_block:Xe,_tr_flush_block:qe,_tr_tally:(e,t,i)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(Ce[i]+me+1)]++,e.dyn_dtree[2*Le(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Ge(e,2,3),Re(e,256,Te),(e=>{16===e.bi_valid?(ze(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var Qe=(e,t,i,r)=>{let n=65535&e|0,a=e>>>16&65535|0,s=0;for(;0!==i;){s=i>2e3?2e3:i,i-=s;do{n=n+t[r++]|0,a=a+n|0}while(--s);n%=65521,a%=65521}return n|a<<16|0};const et=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var tt=(e,t,i,r)=>{const n=et,a=r+i;e^=-1;for(let i=r;i<a;i++)e=e>>>8^n[255&(e^t[i])];return-1^e},it={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},rt={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:nt,_tr_stored_block:at,_tr_flush_block:st,_tr_tally:ot,_tr_align:lt}=Je,{Z_NO_FLUSH:ht,Z_PARTIAL_FLUSH:ft,Z_FULL_FLUSH:ct,Z_FINISH:ut,Z_BLOCK:dt,Z_OK:gt,Z_STREAM_END:pt,Z_STREAM_ERROR:mt,Z_DATA_ERROR:wt,Z_BUF_ERROR:yt,Z_DEFAULT_COMPRESSION:bt,Z_FILTERED:_t,Z_HUFFMAN_ONLY:vt,Z_RLE:xt,Z_FIXED:kt,Z_DEFAULT_STRATEGY:Tt,Z_UNKNOWN:St,Z_DEFLATED:At}=rt,Ct=258,Pt=262,Mt=42,It=113,Et=666,Ut=(e,t)=>(e.msg=it[t],t),Dt=e=>2*e-(e>4?9:0),Ot=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Lt=e=>{let t,i,r,n=e.w_size;t=e.hash_size,r=t;do{i=e.head[--r],e.head[r]=i>=n?i-n:0}while(--t);t=n,r=t;do{i=e.prev[--r],e.prev[r]=i>=n?i-n:0}while(--t)};let zt=(e,t,i)=>(t<<e.hash_shift^i)&e.hash_mask;const Gt=e=>{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},Rt=(e,t)=>{st(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Gt(e.strm)},Bt=(e,t)=>{e.pending_buf[e.pending++]=t},Ft=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Vt=(e,t,i,r)=>{let n=e.avail_in;return n>r&&(n=r),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),i),1===e.state.wrap?e.adler=Qe(e.adler,t,n,i):2===e.state.wrap&&(e.adler=tt(e.adler,t,n,i)),e.next_in+=n,e.total_in+=n,n)},Nt=(e,t)=>{let i,r,n=e.max_chain_length,a=e.strstart,s=e.prev_length,o=e.nice_match;const l=e.strstart>e.w_size-Pt?e.strstart-(e.w_size-Pt):0,h=e.window,f=e.w_mask,c=e.prev,u=e.strstart+Ct;let d=h[a+s-1],g=h[a+s];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do{if(i=t,h[i+s]===g&&h[i+s-1]===d&&h[i]===h[a]&&h[++i]===h[a+1]){a+=2,i++;do{}while(h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&a<u);if(r=Ct-(u-a),a=u-Ct,r>s){if(e.match_start=t,s=r,r>=o)break;d=h[a+s-1],g=h[a+s]}}}while((t=c[t&f])>l&&0!=--n);return s<=e.lookahead?s:e.lookahead},Kt=e=>{const t=e.w_size;let i,r,n;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Pt)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Lt(e),r+=t),0===e.strm.avail_in)break;if(i=Vt(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=i,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=zt(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=zt(e,e.ins_h,e.window[n+3-1]),e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Pt&&0!==e.strm.avail_in)},jt=(e,t)=>{let i,r,n,a=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,s=0,o=e.strm.avail_in;do{if(i=65535,n=e.bi_valid+42>>3,e.strm.avail_out<n)break;if(n=e.strm.avail_out-n,r=e.strstart-e.block_start,i>r+e.strm.avail_in&&(i=r+e.strm.avail_in),i>n&&(i=n),i<a&&(0===i&&t!==ut||t===ht||i!==r+e.strm.avail_in))break;s=t===ut&&i===r+e.strm.avail_in?1:0,at(e,0,0,s),e.pending_buf[e.pending-4]=i,e.pending_buf[e.pending-3]=i>>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,Gt(e.strm),r&&(r>i&&(r=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,i-=r),i&&(Vt(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===s);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?4:t!==ht&&t!==ut&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(n=e.window_size-e.strstart,e.strm.avail_in>n&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(Vt(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water<e.strstart&&(e.high_water=e.strstart),n=e.bi_valid+42>>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,a=n>e.w_size?e.w_size:n,r=e.strstart-e.block_start,(r>=a||(r||t===ut)&&t!==ht&&0===e.strm.avail_in&&r<=n)&&(i=r>n?n:r,s=t===ut&&0===e.strm.avail_in&&i===r?1:0,at(e,e.block_start,i,s),e.block_start+=i,Gt(e.strm)),s?3:1)},Ht=(e,t)=>{let i,r;for(;;){if(e.lookahead<Pt){if(Kt(e),e.lookahead<Pt&&t===ht)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=zt(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-Pt&&(e.match_length=Nt(e,i)),e.match_length>=3)if(r=ot(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=zt(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=zt(e,e.ins_h,e.window[e.strstart+1]);else r=ot(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Rt(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===ut?(Rt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Rt(e,!1),0===e.strm.avail_out)?1:2},Zt=(e,t)=>{let i,r,n;for(;;){if(e.lookahead<Pt){if(Kt(e),e.lookahead<Pt&&t===ht)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=zt(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Pt&&(e.match_length=Nt(e,i),e.match_length<=5&&(e.strategy===_t||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,r=ot(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=zt(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Rt(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(r=ot(e,0,e.window[e.strstart-1]),r&&Rt(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=ot(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===ut?(Rt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Rt(e,!1),0===e.strm.avail_out)?1:2};function Wt(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}const Yt=[new Wt(0,0,0,0,jt),new Wt(4,4,8,4,Ht),new Wt(4,5,16,8,Ht),new Wt(4,6,32,32,Ht),new Wt(4,4,16,16,Zt),new Wt(8,16,32,32,Zt),new Wt(8,16,128,128,Zt),new Wt(8,32,128,256,Zt),new Wt(32,128,258,1024,Zt),new Wt(32,258,258,4096,Zt)];function $t(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=At,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Ot(this.dyn_ltree),Ot(this.dyn_dtree),Ot(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Ot(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ot(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Xt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Mt&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==It&&t.status!==Et?1:0},qt=e=>{if(Xt(e))return Ut(e,mt);e.total_in=e.total_out=0,e.data_type=St;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Mt:It,e.adler=2===t.wrap?0:1,t.last_flush=-2,nt(t),gt},Jt=e=>{const t=qt(e);var i;return t===gt&&((i=e.state).window_size=2*i.w_size,Ot(i.head),i.max_lazy_match=Yt[i.level].max_lazy,i.good_match=Yt[i.level].good_length,i.nice_match=Yt[i.level].nice_length,i.max_chain_length=Yt[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},Qt=(e,t,i,r,n,a)=>{if(!e)return mt;let s=1;if(t===bt&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>9||i!==At||r<8||r>15||t<0||t>9||a<0||a>kt||8===r&&1!==s)return Ut(e,mt);8===r&&(r=9);const o=new $t;return e.state=o,o.strm=e,o.status=Mt,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=t,o.strategy=a,o.method=i,Jt(e)};var ei={deflateInit:(e,t)=>Qt(e,t,At,15,8,Tt),deflateInit2:Qt,deflateReset:Jt,deflateResetKeep:qt,deflateSetHeader:(e,t)=>Xt(e)||2!==e.state.wrap?mt:(e.state.gzhead=t,gt),deflate:(e,t)=>{if(Xt(e)||t>dt||t<0)return e?Ut(e,mt):mt;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===Et&&t!==ut)return Ut(e,0===e.avail_out?yt:mt);const r=i.last_flush;if(i.last_flush=t,0!==i.pending){if(Gt(e),0===e.avail_out)return i.last_flush=-1,gt}else if(0===e.avail_in&&Dt(t)<=Dt(r)&&t!==ut)return Ut(e,yt);if(i.status===Et&&0!==e.avail_in)return Ut(e,yt);if(i.status===Mt&&0===i.wrap&&(i.status=It),i.status===Mt){let t=At+(i.w_bits-8<<4)<<8,r=-1;if(r=i.strategy>=vt||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=r<<6,0!==i.strstart&&(t|=32),t+=31-t%31,Ft(i,t),0!==i.strstart&&(Ft(i,e.adler>>>16),Ft(i,65535&e.adler)),e.adler=1,i.status=It,Gt(e),0!==i.pending)return i.last_flush=-1,gt}if(57===i.status)if(e.adler=0,Bt(i,31),Bt(i,139),Bt(i,8),i.gzhead)Bt(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Bt(i,255&i.gzhead.time),Bt(i,i.gzhead.time>>8&255),Bt(i,i.gzhead.time>>16&255),Bt(i,i.gzhead.time>>24&255),Bt(i,9===i.level?2:i.strategy>=vt||i.level<2?4:0),Bt(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Bt(i,255&i.gzhead.extra.length),Bt(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=tt(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Bt(i,0),Bt(i,0),Bt(i,0),Bt(i,0),Bt(i,0),Bt(i,9===i.level?2:i.strategy>=vt||i.level<2?4:0),Bt(i,3),i.status=It,Gt(e),0!==i.pending)return i.last_flush=-1,gt;if(69===i.status){if(i.gzhead.extra){let t=i.pending,r=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+r>i.pending_buf_size;){let n=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=tt(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=n,Gt(e),0!==i.pending)return i.last_flush=-1,gt;t=0,r-=n}let n=new Uint8Array(i.gzhead.extra);i.pending_buf.set(n.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending+=r,i.gzhead.hcrc&&i.pending>t&&(e.adler=tt(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(e.adler=tt(e.adler,i.pending_buf,i.pending-r,r)),Gt(e),0!==i.pending)return i.last_flush=-1,gt;r=0}t=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,Bt(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>r&&(e.adler=tt(e.adler,i.pending_buf,i.pending-r,r)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(e.adler=tt(e.adler,i.pending_buf,i.pending-r,r)),Gt(e),0!==i.pending)return i.last_flush=-1,gt;r=0}t=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,Bt(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>r&&(e.adler=tt(e.adler,i.pending_buf,i.pending-r,r))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Gt(e),0!==i.pending))return i.last_flush=-1,gt;Bt(i,255&e.adler),Bt(i,e.adler>>8&255),e.adler=0}if(i.status=It,Gt(e),0!==i.pending)return i.last_flush=-1,gt}if(0!==e.avail_in||0!==i.lookahead||t!==ht&&i.status!==Et){let r=0===i.level?jt(i,t):i.strategy===vt?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(Kt(e),0===e.lookahead)){if(t===ht)return 1;break}if(e.match_length=0,i=ot(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Rt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===ut?(Rt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Rt(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===xt?((e,t)=>{let i,r,n,a;const s=e.window;for(;;){if(e.lookahead<=Ct){if(Kt(e),e.lookahead<=Ct&&t===ht)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,r=s[n],r===s[++n]&&r===s[++n]&&r===s[++n])){a=e.strstart+Ct;do{}while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<a);e.match_length=Ct-(a-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=ot(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=ot(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Rt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===ut?(Rt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Rt(e,!1),0===e.strm.avail_out)?1:2})(i,t):Yt[i.level].func(i,t);if(3!==r&&4!==r||(i.status=Et),1===r||3===r)return 0===e.avail_out&&(i.last_flush=-1),gt;if(2===r&&(t===ft?lt(i):t!==dt&&(at(i,0,0,!1),t===ct&&(Ot(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Gt(e),0===e.avail_out))return i.last_flush=-1,gt}return t!==ut?gt:i.wrap<=0?pt:(2===i.wrap?(Bt(i,255&e.adler),Bt(i,e.adler>>8&255),Bt(i,e.adler>>16&255),Bt(i,e.adler>>24&255),Bt(i,255&e.total_in),Bt(i,e.total_in>>8&255),Bt(i,e.total_in>>16&255),Bt(i,e.total_in>>24&255)):(Ft(i,e.adler>>>16),Ft(i,65535&e.adler)),Gt(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?gt:pt)},deflateEnd:e=>{if(Xt(e))return mt;const t=e.state.status;return e.state=null,t===It?Ut(e,wt):gt},deflateSetDictionary:(e,t)=>{let i=t.length;if(Xt(e))return mt;const r=e.state,n=r.wrap;if(2===n||1===n&&r.status!==Mt||r.lookahead)return mt;if(1===n&&(e.adler=Qe(e.adler,t,i,0)),r.wrap=0,i>=r.w_size){0===n&&(Ot(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(i-r.w_size,i),0),t=e,i=r.w_size}const a=e.avail_in,s=e.next_in,o=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,Kt(r);r.lookahead>=3;){let e=r.strstart,t=r.lookahead-2;do{r.ins_h=zt(r,r.ins_h,r.window[e+3-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++}while(--t);r.strstart=e,r.lookahead=2,Kt(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=o,e.avail_in=a,r.wrap=n,gt},deflateInfo:"pako deflate (from Nodeca project)"};const ti=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var ii={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)ti(i,t)&&(e[t]=i[t])}}return e},flattenChunks:e=>{let t=0;for(let i=0,r=e.length;i<r;i++)t+=e[i].length;const i=new Uint8Array(t);for(let t=0,r=0,n=e.length;t<n;t++){let n=e[t];i.set(n,r),r+=n.length}return i}};let ri=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){ri=!1}const ni=new Uint8Array(256);for(let e=0;e<256;e++)ni[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;ni[254]=ni[254]=1;var ai={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,r,n,a,s=e.length,o=0;for(n=0;n<s;n++)i=e.charCodeAt(n),55296==(64512&i)&&n+1<s&&(r=e.charCodeAt(n+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),n++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Uint8Array(o),a=0,n=0;a<o;n++)i=e.charCodeAt(n),55296==(64512&i)&&n+1<s&&(r=e.charCodeAt(n+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),n++)),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>>6,t[a++]=128|63&i):i<65536?(t[a++]=224|i>>>12,t[a++]=128|i>>>6&63,t[a++]=128|63&i):(t[a++]=240|i>>>18,t[a++]=128|i>>>12&63,t[a++]=128|i>>>6&63,t[a++]=128|63&i);return t},buf2string:(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,n;const a=new Array(2*i);for(n=0,r=0;r<i;){let t=e[r++];if(t<128){a[n++]=t;continue}let s=ni[t];if(s>4)a[n++]=65533,r+=s-1;else{for(t&=2===s?31:3===s?15:7;s>1&&r<i;)t=t<<6|63&e[r++],s--;s>1?a[n++]=65533:t<65536?a[n++]=t:(t-=65536,a[n++]=55296|t>>10&1023,a[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&ri)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i})(a,n)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+ni[e[i]]>t?i:t}};var si=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const oi=Object.prototype.toString,{Z_NO_FLUSH:li,Z_SYNC_FLUSH:hi,Z_FULL_FLUSH:fi,Z_FINISH:ci,Z_OK:ui,Z_STREAM_END:di,Z_DEFAULT_COMPRESSION:gi,Z_DEFAULT_STRATEGY:pi,Z_DEFLATED:mi}=rt;function wi(e){this.options=ii.assign({level:gi,method:mi,chunkSize:16384,windowBits:15,memLevel:8,strategy:pi},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new si,this.strm.avail_out=0;let i=ei.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==ui)throw new Error(it[i]);if(t.header&&ei.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?ai.string2buf(t.dictionary):"[object ArrayBuffer]"===oi.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=ei.deflateSetDictionary(this.strm,e),i!==ui)throw new Error(it[i]);this._dict_set=!0}}wi.prototype.push=function(e,t){const i=this.strm,r=this.options.chunkSize;let n,a;if(this.ended)return!1;for(a=t===~~t?t:!0===t?ci:li,"string"==typeof e?i.input=ai.string2buf(e):"[object ArrayBuffer]"===oi.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),(a===hi||a===fi)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(n=ei.deflate(i,a),n===di)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),n=ei.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ui;if(0!==i.avail_out){if(a>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},wi.prototype.onData=function(e){this.chunks.push(e)},wi.prototype.onEnd=function(e){e===ui&&(this.result=ii.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const yi=16209;var bi=function(e,t){let i,r,n,a,s,o,l,h,f,c,u,d,g,p,m,w,y,b,_,v,x,k,T,S;const A=e.state;i=e.next_in,T=e.input,r=i+(e.avail_in-5),n=e.next_out,S=e.output,a=n-(t-e.avail_out),s=n+(e.avail_out-257),o=A.dmax,l=A.wsize,h=A.whave,f=A.wnext,c=A.window,u=A.hold,d=A.bits,g=A.lencode,p=A.distcode,m=(1<<A.lenbits)-1,w=(1<<A.distbits)-1;e:do{d<15&&(u+=T[i++]<<d,d+=8,u+=T[i++]<<d,d+=8),y=g[u&m];t:for(;;){if(b=y>>>24,u>>>=b,d-=b,b=y>>>16&255,0===b)S[n++]=65535&y;else{if(!(16&b)){if(0==(64&b)){y=g[(65535&y)+(u&(1<<b)-1)];continue t}if(32&b){A.mode=16191;break e}e.msg="invalid literal/length code",A.mode=yi;break e}_=65535&y,b&=15,b&&(d<b&&(u+=T[i++]<<d,d+=8),_+=u&(1<<b)-1,u>>>=b,d-=b),d<15&&(u+=T[i++]<<d,d+=8,u+=T[i++]<<d,d+=8),y=p[u&w];i:for(;;){if(b=y>>>24,u>>>=b,d-=b,b=y>>>16&255,!(16&b)){if(0==(64&b)){y=p[(65535&y)+(u&(1<<b)-1)];continue i}e.msg="invalid distance code",A.mode=yi;break e}if(v=65535&y,b&=15,d<b&&(u+=T[i++]<<d,d+=8,d<b&&(u+=T[i++]<<d,d+=8)),v+=u&(1<<b)-1,v>o){e.msg="invalid distance too far back",A.mode=yi;break e}if(u>>>=b,d-=b,b=n-a,v>b){if(b=v-b,b>h&&A.sane){e.msg="invalid distance too far back",A.mode=yi;break e}if(x=0,k=c,0===f){if(x+=l-b,b<_){_-=b;do{S[n++]=c[x++]}while(--b);x=n-v,k=S}}else if(f<b){if(x+=l+f-b,b-=f,b<_){_-=b;do{S[n++]=c[x++]}while(--b);if(x=0,f<_){b=f,_-=b;do{S[n++]=c[x++]}while(--b);x=n-v,k=S}}}else if(x+=f-b,b<_){_-=b;do{S[n++]=c[x++]}while(--b);x=n-v,k=S}for(;_>2;)S[n++]=k[x++],S[n++]=k[x++],S[n++]=k[x++],_-=3;_&&(S[n++]=k[x++],_>1&&(S[n++]=k[x++]))}else{x=n-v;do{S[n++]=S[x++],S[n++]=S[x++],S[n++]=S[x++],_-=3}while(_>2);_&&(S[n++]=S[x++],_>1&&(S[n++]=S[x++]))}break}}break}}while(i<r&&n<s);_=d>>3,i-=_,d-=_<<3,u&=(1<<d)-1,e.next_in=i,e.next_out=n,e.avail_in=i<r?r-i+5:5-(i-r),e.avail_out=n<s?s-n+257:257-(n-s),A.hold=u,A.bits=d};const _i=15,vi=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),xi=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ki=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ti=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Si=(e,t,i,r,n,a,s,o)=>{const l=o.bits;let h,f,c,u,d,g,p=0,m=0,w=0,y=0,b=0,_=0,v=0,x=0,k=0,T=0,S=null;const A=new Uint16Array(16),C=new Uint16Array(16);let P,M,I,E=null;for(p=0;p<=_i;p++)A[p]=0;for(m=0;m<r;m++)A[t[i+m]]++;for(b=l,y=_i;y>=1&&0===A[y];y--);if(b>y&&(b=y),0===y)return n[a++]=20971520,n[a++]=20971520,o.bits=1,0;for(w=1;w<y&&0===A[w];w++);for(b<w&&(b=w),x=1,p=1;p<=_i;p++)if(x<<=1,x-=A[p],x<0)return-1;if(x>0&&(0===e||1!==y))return-1;for(C[1]=0,p=1;p<_i;p++)C[p+1]=C[p]+A[p];for(m=0;m<r;m++)0!==t[i+m]&&(s[C[t[i+m]]++]=m);if(0===e?(S=E=s,g=20):1===e?(S=vi,E=xi,g=257):(S=ki,E=Ti,g=0),T=0,m=0,p=w,d=a,_=b,v=0,c=-1,k=1<<b,u=k-1,1===e&&k>852||2===e&&k>592)return 1;for(;;){P=p-v,s[m]+1<g?(M=0,I=s[m]):s[m]>=g?(M=E[s[m]-g],I=S[s[m]-g]):(M=96,I=0),h=1<<p-v,f=1<<_,w=f;do{f-=h,n[d+(T>>v)+f]=P<<24|M<<16|I|0}while(0!==f);for(h=1<<p-1;T&h;)h>>=1;if(0!==h?(T&=h-1,T+=h):T=0,m++,0==--A[p]){if(p===y)break;p=t[i+s[m]]}if(p>b&&(T&u)!==c){for(0===v&&(v=b),d+=w,_=p-v,x=1<<_;_+v<y&&(x-=A[_+v],!(x<=0));)_++,x<<=1;if(k+=1<<_,1===e&&k>852||2===e&&k>592)return 1;c=T&u,n[c]=b<<24|_<<16|d-a|0}}return 0!==T&&(n[d+T]=p-v<<24|64<<16|0),o.bits=b,0};const{Z_FINISH:Ai,Z_BLOCK:Ci,Z_TREES:Pi,Z_OK:Mi,Z_STREAM_END:Ii,Z_NEED_DICT:Ei,Z_STREAM_ERROR:Ui,Z_DATA_ERROR:Di,Z_MEM_ERROR:Oi,Z_BUF_ERROR:Li,Z_DEFLATED:zi}=rt,Gi=16180,Ri=16190,Bi=16191,Fi=16192,Vi=16194,Ni=16199,Ki=16200,ji=16206,Hi=16209,Zi=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Wi(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Yi=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Gi||t.mode>16211?1:0},$i=e=>{if(Yi(e))return Ui;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Gi,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Mi},Xi=e=>{if(Yi(e))return Ui;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,$i(e)},qi=(e,t)=>{let i;if(Yi(e))return Ui;const r=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Ui:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,Xi(e))},Ji=(e,t)=>{if(!e)return Ui;const i=new Wi;e.state=i,i.strm=e,i.window=null,i.mode=Gi;const r=qi(e,t);return r!==Mi&&(e.state=null),r};let Qi,er,tr=!0;const ir=e=>{if(tr){Qi=new Int32Array(512),er=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Si(1,e.lens,0,288,Qi,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Si(2,e.lens,0,32,er,0,e.work,{bits:5}),tr=!1}e.lencode=Qi,e.lenbits=9,e.distcode=er,e.distbits=5},rr=(e,t,i,r)=>{let n;const a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=a.wsize?(a.window.set(t.subarray(i-a.wsize,i),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>r&&(n=r),a.window.set(t.subarray(i-r,i-r+n),a.wnext),(r-=n)?(a.window.set(t.subarray(i-r,i),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0};var nr={inflateReset:Xi,inflateReset2:qi,inflateResetKeep:$i,inflateInit:e=>Ji(e,15),inflateInit2:Ji,inflate:(e,t)=>{let i,r,n,a,s,o,l,h,f,c,u,d,g,p,m,w,y,b,_,v,x,k,T=0;const S=new Uint8Array(4);let A,C;const P=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Yi(e)||!e.output||!e.input&&0!==e.avail_in)return Ui;i=e.state,i.mode===Bi&&(i.mode=Fi),s=e.next_out,n=e.output,l=e.avail_out,a=e.next_in,r=e.input,o=e.avail_in,h=i.hold,f=i.bits,c=o,u=l,k=Mi;e:for(;;)switch(i.mode){case Gi:if(0===i.wrap){i.mode=Fi;break}for(;f<16;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}if(2&i.wrap&&35615===h){0===i.wbits&&(i.wbits=15),i.check=0,S[0]=255&h,S[1]=h>>>8&255,i.check=tt(i.check,S,2,0),h=0,f=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){e.msg="incorrect header check",i.mode=Hi;break}if((15&h)!==zi){e.msg="unknown compression method",i.mode=Hi;break}if(h>>>=4,f-=4,x=8+(15&h),0===i.wbits&&(i.wbits=x),x>15||x>i.wbits){e.msg="invalid window size",i.mode=Hi;break}i.dmax=1<<i.wbits,i.flags=0,e.adler=i.check=1,i.mode=512&h?16189:Bi,h=0,f=0;break;case 16181:for(;f<16;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}if(i.flags=h,(255&i.flags)!==zi){e.msg="unknown compression method",i.mode=Hi;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=Hi;break}i.head&&(i.head.text=h>>8&1),512&i.flags&&4&i.wrap&&(S[0]=255&h,S[1]=h>>>8&255,i.check=tt(i.check,S,2,0)),h=0,f=0,i.mode=16182;case 16182:for(;f<32;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}i.head&&(i.head.time=h),512&i.flags&&4&i.wrap&&(S[0]=255&h,S[1]=h>>>8&255,S[2]=h>>>16&255,S[3]=h>>>24&255,i.check=tt(i.check,S,4,0)),h=0,f=0,i.mode=16183;case 16183:for(;f<16;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}i.head&&(i.head.xflags=255&h,i.head.os=h>>8),512&i.flags&&4&i.wrap&&(S[0]=255&h,S[1]=h>>>8&255,i.check=tt(i.check,S,2,0)),h=0,f=0,i.mode=16184;case 16184:if(1024&i.flags){for(;f<16;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}i.length=h,i.head&&(i.head.extra_len=h),512&i.flags&&4&i.wrap&&(S[0]=255&h,S[1]=h>>>8&255,i.check=tt(i.check,S,2,0)),h=0,f=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(d=i.length,d>o&&(d=o),d&&(i.head&&(x=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(r.subarray(a,a+d),x)),512&i.flags&&4&i.wrap&&(i.check=tt(i.check,r,d,a)),o-=d,a+=d,i.length-=d),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===o)break e;d=0;do{x=r[a+d++],i.head&&x&&i.length<65536&&(i.head.name+=String.fromCharCode(x))}while(x&&d<o);if(512&i.flags&&4&i.wrap&&(i.check=tt(i.check,r,d,a)),o-=d,a+=d,x)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===o)break e;d=0;do{x=r[a+d++],i.head&&x&&i.length<65536&&(i.head.comment+=String.fromCharCode(x))}while(x&&d<o);if(512&i.flags&&4&i.wrap&&(i.check=tt(i.check,r,d,a)),o-=d,a+=d,x)break e}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;f<16;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}if(4&i.wrap&&h!==(65535&i.check)){e.msg="header crc mismatch",i.mode=Hi;break}h=0,f=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Bi;break;case 16189:for(;f<32;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}e.adler=i.check=Zi(h),h=0,f=0,i.mode=Ri;case Ri:if(0===i.havedict)return e.next_out=s,e.avail_out=l,e.next_in=a,e.avail_in=o,i.hold=h,i.bits=f,Ei;e.adler=i.check=1,i.mode=Bi;case Bi:if(t===Ci||t===Pi)break e;case Fi:if(i.last){h>>>=7&f,f-=7&f,i.mode=ji;break}for(;f<3;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}switch(i.last=1&h,h>>>=1,f-=1,3&h){case 0:i.mode=16193;break;case 1:if(ir(i),i.mode=Ni,t===Pi){h>>>=2,f-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=Hi}h>>>=2,f-=2;break;case 16193:for(h>>>=7&f,f-=7&f;f<32;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}if((65535&h)!=(h>>>16^65535)){e.msg="invalid stored block lengths",i.mode=Hi;break}if(i.length=65535&h,h=0,f=0,i.mode=Vi,t===Pi)break e;case Vi:i.mode=16195;case 16195:if(d=i.length,d){if(d>o&&(d=o),d>l&&(d=l),0===d)break e;n.set(r.subarray(a,a+d),s),o-=d,a+=d,l-=d,s+=d,i.length-=d;break}i.mode=Bi;break;case 16196:for(;f<14;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}if(i.nlen=257+(31&h),h>>>=5,f-=5,i.ndist=1+(31&h),h>>>=5,f-=5,i.ncode=4+(15&h),h>>>=4,f-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=Hi;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;f<3;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}i.lens[P[i.have++]]=7&h,h>>>=3,f-=3}for(;i.have<19;)i.lens[P[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,A={bits:i.lenbits},k=Si(0,i.lens,0,19,i.lencode,0,i.work,A),i.lenbits=A.bits,k){e.msg="invalid code lengths set",i.mode=Hi;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;T=i.lencode[h&(1<<i.lenbits)-1],m=T>>>24,w=T>>>16&255,y=65535&T,!(m<=f);){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}if(y<16)h>>>=m,f-=m,i.lens[i.have++]=y;else{if(16===y){for(C=m+2;f<C;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}if(h>>>=m,f-=m,0===i.have){e.msg="invalid bit length repeat",i.mode=Hi;break}x=i.lens[i.have-1],d=3+(3&h),h>>>=2,f-=2}else if(17===y){for(C=m+3;f<C;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}h>>>=m,f-=m,x=0,d=3+(7&h),h>>>=3,f-=3}else{for(C=m+7;f<C;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}h>>>=m,f-=m,x=0,d=11+(127&h),h>>>=7,f-=7}if(i.have+d>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=Hi;break}for(;d--;)i.lens[i.have++]=x}}if(i.mode===Hi)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=Hi;break}if(i.lenbits=9,A={bits:i.lenbits},k=Si(1,i.lens,0,i.nlen,i.lencode,0,i.work,A),i.lenbits=A.bits,k){e.msg="invalid literal/lengths set",i.mode=Hi;break}if(i.distbits=6,i.distcode=i.distdyn,A={bits:i.distbits},k=Si(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,A),i.distbits=A.bits,k){e.msg="invalid distances set",i.mode=Hi;break}if(i.mode=Ni,t===Pi)break e;case Ni:i.mode=Ki;case Ki:if(o>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=a,e.avail_in=o,i.hold=h,i.bits=f,bi(e,u),s=e.next_out,n=e.output,l=e.avail_out,a=e.next_in,r=e.input,o=e.avail_in,h=i.hold,f=i.bits,i.mode===Bi&&(i.back=-1);break}for(i.back=0;T=i.lencode[h&(1<<i.lenbits)-1],m=T>>>24,w=T>>>16&255,y=65535&T,!(m<=f);){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}if(w&&0==(240&w)){for(b=m,_=w,v=y;T=i.lencode[v+((h&(1<<b+_)-1)>>b)],m=T>>>24,w=T>>>16&255,y=65535&T,!(b+m<=f);){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}h>>>=b,f-=b,i.back+=b}if(h>>>=m,f-=m,i.back+=m,i.length=y,0===w){i.mode=16205;break}if(32&w){i.back=-1,i.mode=Bi;break}if(64&w){e.msg="invalid literal/length code",i.mode=Hi;break}i.extra=15&w,i.mode=16201;case 16201:if(i.extra){for(C=i.extra;f<C;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}i.length+=h&(1<<i.extra)-1,h>>>=i.extra,f-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;T=i.distcode[h&(1<<i.distbits)-1],m=T>>>24,w=T>>>16&255,y=65535&T,!(m<=f);){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}if(0==(240&w)){for(b=m,_=w,v=y;T=i.distcode[v+((h&(1<<b+_)-1)>>b)],m=T>>>24,w=T>>>16&255,y=65535&T,!(b+m<=f);){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}h>>>=b,f-=b,i.back+=b}if(h>>>=m,f-=m,i.back+=m,64&w){e.msg="invalid distance code",i.mode=Hi;break}i.offset=y,i.extra=15&w,i.mode=16203;case 16203:if(i.extra){for(C=i.extra;f<C;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}i.offset+=h&(1<<i.extra)-1,h>>>=i.extra,f-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=Hi;break}i.mode=16204;case 16204:if(0===l)break e;if(d=u-l,i.offset>d){if(d=i.offset-d,d>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=Hi;break}d>i.wnext?(d-=i.wnext,g=i.wsize-d):g=i.wnext-d,d>i.length&&(d=i.length),p=i.window}else p=n,g=s-i.offset,d=i.length;d>l&&(d=l),l-=d,i.length-=d;do{n[s++]=p[g++]}while(--d);0===i.length&&(i.mode=Ki);break;case 16205:if(0===l)break e;n[s++]=i.length,l--,i.mode=Ki;break;case ji:if(i.wrap){for(;f<32;){if(0===o)break e;o--,h|=r[a++]<<f,f+=8}if(u-=l,e.total_out+=u,i.total+=u,4&i.wrap&&u&&(e.adler=i.check=i.flags?tt(i.check,n,u,s-u):Qe(i.check,n,u,s-u)),u=l,4&i.wrap&&(i.flags?h:Zi(h))!==i.check){e.msg="incorrect data check",i.mode=Hi;break}h=0,f=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;f<32;){if(0===o)break e;o--,h+=r[a++]<<f,f+=8}if(4&i.wrap&&h!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=Hi;break}h=0,f=0}i.mode=16208;case 16208:k=Ii;break e;case Hi:k=Di;break e;case 16210:return Oi;default:return Ui}return e.next_out=s,e.avail_out=l,e.next_in=a,e.avail_in=o,i.hold=h,i.bits=f,(i.wsize||u!==e.avail_out&&i.mode<Hi&&(i.mode<ji||t!==Ai))&&rr(e,e.output,e.next_out,u-e.avail_out),c-=e.avail_in,u-=e.avail_out,e.total_in+=c,e.total_out+=u,i.total+=u,4&i.wrap&&u&&(e.adler=i.check=i.flags?tt(i.check,n,u,e.next_out-u):Qe(i.check,n,u,e.next_out-u)),e.data_type=i.bits+(i.last?64:0)+(i.mode===Bi?128:0)+(i.mode===Ni||i.mode===Vi?256:0),(0===c&&0===u||t===Ai)&&k===Mi&&(k=Li),k},inflateEnd:e=>{if(Yi(e))return Ui;let t=e.state;return t.window&&(t.window=null),e.state=null,Mi},inflateGetHeader:(e,t)=>{if(Yi(e))return Ui;const i=e.state;return 0==(2&i.wrap)?Ui:(i.head=t,t.done=!1,Mi)},inflateSetDictionary:(e,t)=>{const i=t.length;let r,n,a;return Yi(e)?Ui:(r=e.state,0!==r.wrap&&r.mode!==Ri?Ui:r.mode===Ri&&(n=1,n=Qe(n,t,i,0),n!==r.check)?Di:(a=rr(e,t,i,i),a?(r.mode=16210,Oi):(r.havedict=1,Mi)))},inflateInfo:"pako inflate (from Nodeca project)"};var ar=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const sr=Object.prototype.toString,{Z_NO_FLUSH:or,Z_FINISH:lr,Z_OK:hr,Z_STREAM_END:fr,Z_NEED_DICT:cr,Z_STREAM_ERROR:ur,Z_DATA_ERROR:dr,Z_MEM_ERROR:gr}=rt;function pr(e){this.options=ii.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new si,this.strm.avail_out=0;let i=nr.inflateInit2(this.strm,t.windowBits);if(i!==hr)throw new Error(it[i]);if(this.header=new ar,nr.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=ai.string2buf(t.dictionary):"[object ArrayBuffer]"===sr.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=nr.inflateSetDictionary(this.strm,t.dictionary),i!==hr)))throw new Error(it[i])}function mr(e,t){const i=new pr(t);if(i.push(e),i.err)throw i.msg||it[i.err];return i.result}pr.prototype.push=function(e,t){const i=this.strm,r=this.options.chunkSize,n=this.options.dictionary;let a,s,o;if(this.ended)return!1;for(s=t===~~t?t:!0===t?lr:or,"[object ArrayBuffer]"===sr.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),a=nr.inflate(i,s),a===cr&&n&&(a=nr.inflateSetDictionary(i,n),a===hr?a=nr.inflate(i,s):a===dr&&(a=cr));i.avail_in>0&&a===fr&&i.state.wrap>0&&0!==e[i.next_in];)nr.inflateReset(i),a=nr.inflate(i,s);switch(a){case ur:case dr:case cr:case gr:return this.onEnd(a),this.ended=!0,!1}if(o=i.avail_out,i.next_out&&(0===i.avail_out||a===fr))if("string"===this.options.to){let e=ai.utf8border(i.output,i.next_out),t=i.next_out-e,n=ai.buf2string(i.output,e);i.next_out=t,i.avail_out=r-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(n)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(a!==hr||0!==o){if(a===fr)return a=nr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},pr.prototype.onData=function(e){this.chunks.push(e)},pr.prototype.onEnd=function(e){e===hr&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ii.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var wr={Inflate:pr,inflate:mr,inflateRaw:function(e,t){return(t=t||{}).raw=!0,mr(e,t)},ungzip:mr,constants:rt};const{Inflate:yr,inflate:br,inflateRaw:_r,ungzip:vr}=wr;var xr=br;function kr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tr={exports:{}};!function(e){function t(e){var t,i,r,n,a,s=Math.floor,o=new Array(64),l=new Array(64),h=new Array(64),f=new Array(64),c=new Array(65535),u=new Array(65535),d=new Array(64),g=new Array(64),p=[],m=0,w=7,y=new Array(64),b=new Array(64),_=new Array(64),v=new Array(256),x=new Array(2048),k=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],T=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],S=[0,1,2,3,4,5,6,7,8,9,10,11],A=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],C=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],P=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],M=[0,1,2,3,4,5,6,7,8,9,10,11],I=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],E=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function U(e,t){for(var i=0,r=0,n=new Array,a=1;a<=16;a++){for(var s=1;s<=e[a];s++)n[t[r]]=[],n[t[r]][0]=i,n[t[r]][1]=a,r++,i++;i*=2}return n}function D(e){for(var t=e[0],i=e[1]-1;i>=0;)t&1<<i&&(m|=1<<w),i--,--w<0&&(255==m?(O(255),O(0)):O(m),w=7,m=0)}function O(e){p.push(e)}function L(e){O(e>>8&255),O(255&e)}function z(e,t,i,r,n){for(var a,s=n[0],o=n[240],l=function(e,t){var i,r,n,a,s,o,l,h,f,c,u=0;for(f=0;f<8;++f){i=e[u],r=e[u+1],n=e[u+2],a=e[u+3],s=e[u+4],o=e[u+5],l=e[u+6];var g=i+(h=e[u+7]),p=i-h,m=r+l,w=r-l,y=n+o,b=n-o,_=a+s,v=a-s,x=g+_,k=g-_,T=m+y,S=m-y;e[u]=x+T,e[u+4]=x-T;var A=.707106781*(S+k);e[u+2]=k+A,e[u+6]=k-A;var C=.382683433*((x=v+b)-(S=w+p)),P=.5411961*x+C,M=1.306562965*S+C,I=.707106781*(T=b+w),E=p+I,U=p-I;e[u+5]=U+P,e[u+3]=U-P,e[u+1]=E+M,e[u+7]=E-M,u+=8}for(u=0,f=0;f<8;++f){i=e[u],r=e[u+8],n=e[u+16],a=e[u+24],s=e[u+32],o=e[u+40],l=e[u+48];var D=i+(h=e[u+56]),O=i-h,L=r+l,z=r-l,G=n+o,R=n-o,B=a+s,F=a-s,V=D+B,N=D-B,K=L+G,j=L-G;e[u]=V+K,e[u+32]=V-K;var H=.707106781*(j+N);e[u+16]=N+H,e[u+48]=N-H;var Z=.382683433*((V=F+R)-(j=z+O)),W=.5411961*V+Z,Y=1.306562965*j+Z,$=.707106781*(K=R+z),X=O+$,q=O-$;e[u+40]=q+W,e[u+24]=q-W,e[u+8]=X+Y,e[u+56]=X-Y,u++}for(f=0;f<64;++f)c=e[f]*t[f],d[f]=c>0?c+.5|0:c-.5|0;return d}(e,t),h=0;h<64;++h)g[k[h]]=l[h];var f=g[0]-i;i=g[0],0==f?D(r[0]):(D(r[u[a=32767+f]]),D(c[a]));for(var p=63;p>0&&0==g[p];p--);if(0==p)return D(s),i;for(var m,w=1;w<=p;){for(var y=w;0==g[w]&&w<=p;++w);var b=w-y;if(b>=16){m=b>>4;for(var _=1;_<=m;++_)D(o);b&=15}a=32767+g[w],D(n[(b<<4)+u[a]]),D(c[a]),w++}return 63!=p&&D(s),i}function G(e){if(e<=0&&(e=1),e>100&&(e=100),a!=e){(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],i=0;i<64;i++){var r=s((t[i]*e+50)/100);r<1?r=1:r>255&&(r=255),o[k[i]]=r}for(var n=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],a=0;a<64;a++){var c=s((n[a]*e+50)/100);c<1?c=1:c>255&&(c=255),l[k[a]]=c}for(var u=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],d=0,g=0;g<8;g++)for(var p=0;p<8;p++)h[d]=1/(o[k[d]]*u[g]*u[p]*8),f[d]=1/(l[k[d]]*u[g]*u[p]*8),d++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),a=e}}this.encode=function(e,a){var s;(new Date).getTime(),a&&G(a),p=new Array,m=0,w=7,L(65496),L(65504),L(16),O(74),O(70),O(73),O(70),O(0),O(1),O(1),O(0),L(1),L(1),O(0),O(0),void 0!==(s=e.comments)&&s.constructor===Array&&s.forEach((e=>{if("string"==typeof e){L(65534);var t,i=e.length;for(L(i+2),t=0;t<i;t++)O(e.charCodeAt(t))}})),function(e){if(e){L(65505),69===e[0]&&120===e[1]&&105===e[2]&&102===e[3]?L(e.length+2):(L(e.length+5+2),O(69),O(120),O(105),O(102),O(0));for(var t=0;t<e.length;t++)O(e[t])}}(e.exifBuffer),function(){L(65499),L(132),O(0);for(var e=0;e<64;e++)O(o[e]);O(1);for(var t=0;t<64;t++)O(l[t])}(),function(e,t){L(65472),L(17),O(8),L(t),L(e),O(3),O(1),O(17),O(0),O(2),O(17),O(1),O(3),O(17),O(1)}(e.width,e.height),function(){L(65476),L(418),O(0);for(var e=0;e<16;e++)O(T[e+1]);for(var t=0;t<=11;t++)O(S[t]);O(16);for(var i=0;i<16;i++)O(A[i+1]);for(var r=0;r<=161;r++)O(C[r]);O(1);for(var n=0;n<16;n++)O(P[n+1]);for(var a=0;a<=11;a++)O(M[a]);O(17);for(var s=0;s<16;s++)O(I[s+1]);for(var o=0;o<=161;o++)O(E[o])}(),L(65498),L(12),O(3),O(1),O(0),O(2),O(17),O(3),O(17),O(0),O(63),O(0);var c=0,u=0,d=0;m=0,w=7,this.encode.displayName="_encode_";for(var g,v,k,U,R,B,F,V,N,K=e.data,j=e.width,H=e.height,Z=4*j,W=0;W<H;){for(g=0;g<Z;){for(B=R=Z*W+g,F=-1,V=0,N=0;N<64;N++)B=R+(V=N>>3)*Z+(F=4*(7&N)),W+V>=H&&(B-=Z*(W+1+V-H)),g+F>=Z&&(B-=g+F-Z+4),v=K[B++],k=K[B++],U=K[B++],y[N]=(x[v]+x[k+256>>0]+x[U+512>>0]>>16)-128,b[N]=(x[v+768>>0]+x[k+1024>>0]+x[U+1280>>0]>>16)-128,_[N]=(x[v+1280>>0]+x[k+1536>>0]+x[U+1792>>0]>>16)-128;c=z(y,h,c,t,r),u=z(b,f,u,i,n),d=z(_,f,d,i,n),g+=32}W+=8}if(w>=0){var Y=[];Y[1]=w+1,Y[0]=(1<<w+1)-1,D(Y)}return L(65497),Buffer.from(p)},(new Date).getTime(),e||(e=50),function(){for(var e=String.fromCharCode,t=0;t<256;t++)v[t]=e(t)}(),t=U(T,S),i=U(P,M),r=U(A,C),n=U(I,E),function(){for(var e=1,t=2,i=1;i<=15;i++){for(var r=e;r<t;r++)u[32767+r]=i,c[32767+r]=[],c[32767+r][1]=i,c[32767+r][0]=r;for(var n=-(t-1);n<=-e;n++)u[32767+n]=i,c[32767+n]=[],c[32767+n][1]=i,c[32767+n][0]=t-1+n;e<<=1,t<<=1}}(),function(){for(var e=0;e<256;e++)x[e]=19595*e,x[e+256>>0]=38470*e,x[e+512>>0]=7471*e+32768,x[e+768>>0]=-11059*e,x[e+1024>>0]=-21709*e,x[e+1280>>0]=32768*e+8421375,x[e+1536>>0]=-27439*e,x[e+1792>>0]=-5329*e}(),G(e),(new Date).getTime()}Tr.exports=function(e,i){void 0===i&&(i=50);var r=new t(i),n=r.encode(e,i);return{data:n,width:e.width,height:e.height}}}();var Sr,Ar,Cr=Tr.exports,Pr={exports:{}};Sr=Pr,Ar=function(){var e=new Int32Array([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]),t=4017,i=799,r=3406,n=2276,a=1567,s=3784,o=5793,l=2896;function h(){}function f(e,t){for(var i,r,n=0,a=[],s=16;s>0&&!e[s-1];)s--;a.push({children:[],index:0});var o,l=a[0];for(i=0;i<s;i++){for(r=0;r<e[i];r++){for((l=a.pop()).children[l.index]=t[n];l.index>0;){if(0===a.length)throw new Error("Could not recreate Huffman Table");l=a.pop()}for(l.index++,a.push(l);a.length<=i;)a.push(o={children:[],index:0}),l.children[l.index]=o.children,l=o;n++}i+1<s&&(a.push(o={children:[],index:0}),l.children[l.index]=o.children,l=o)}return a[0].children}function c(t,i,r,n,a,s,o,l,h,f){r.precision,r.samplesPerLine,r.scanLines;var c=r.mcusPerLine,u=r.progressive;r.maxH,r.maxV;var d=i,g=0,p=0;function m(){if(p>0)return p--,g>>p&1;if(255==(g=t[i++])){var e=t[i++];if(e)throw new Error("unexpected marker: "+(g<<8|e).toString(16))}return p=7,g>>>7}function w(e){for(var t,i=e;null!==(t=m());){if("number"==typeof(i=i[t]))return i;if("object"!=typeof i)throw new Error("invalid huffman sequence")}return null}function y(e){for(var t=0;e>0;){var i=m();if(null===i)return;t=t<<1|i,e--}return t}function b(e){var t=y(e);return t>=1<<e-1?t:t+(-1<<e)+1}var _,v=0,x=0;function k(e,t,i,r,n){var a=i%c,s=(i/c|0)*e.v+r,o=a*e.h+n;void 0===e.blocks[s]&&f.tolerantDecoding||t(e,e.blocks[s][o])}function T(e,t,i){var r=i/e.blocksPerLine|0,n=i%e.blocksPerLine;void 0===e.blocks[r]&&f.tolerantDecoding||t(e,e.blocks[r][n])}var S,A,C,P,M,I,E=n.length;I=u?0===s?0===l?function(e,t){var i=w(e.huffmanTableDC),r=0===i?0:b(i)<<h;t[0]=e.pred+=r}:function(e,t){t[0]|=m()<<h}:0===l?function(t,i){if(v>0)v--;else for(var r=s,n=o;r<=n;){var a=w(t.huffmanTableAC),l=15&a,f=a>>4;if(0!==l)i[e[r+=f]]=b(l)*(1<<h),r++;else{if(f<15){v=y(f)+(1<<f)-1;break}r+=16}}}:function(t,i){for(var r=s,n=o,a=0;r<=n;){var l=e[r],f=i[l]<0?-1:1;switch(x){case 0:var c=w(t.huffmanTableAC),u=15&c;if(a=c>>4,0===u)a<15?(v=y(a)+(1<<a),x=4):(a=16,x=1);else{if(1!==u)throw new Error("invalid ACn encoding");_=b(u),x=a?2:3}continue;case 1:case 2:i[l]?i[l]+=(m()<<h)*f:0==--a&&(x=2==x?3:0);break;case 3:i[l]?i[l]+=(m()<<h)*f:(i[l]=_<<h,x=0);break;case 4:i[l]&&(i[l]+=(m()<<h)*f)}r++}4===x&&0==--v&&(x=0)}:function(t,i){var r=w(t.huffmanTableDC),n=0===r?0:b(r);i[0]=t.pred+=n;for(var a=1;a<64;){var s=w(t.huffmanTableAC),o=15&s,l=s>>4;if(0!==o)i[e[a+=l]]=b(o),a++;else{if(l<15)break;a+=16}}};var U,D,O,L,z=0;for(D=1==E?n[0].blocksPerLine*n[0].blocksPerColumn:c*r.mcusPerColumn,a||(a=D);z<D;){for(A=0;A<E;A++)n[A].pred=0;if(v=0,1==E)for(S=n[0],M=0;M<a;M++)T(S,I,z),z++;else for(M=0;M<a;M++){for(A=0;A<E;A++)for(O=(S=n[A]).h,L=S.v,C=0;C<L;C++)for(P=0;P<O;P++)k(S,I,z,C,P);if(++z===D)break}if(z===D)do{if(255===t[i]&&0!==t[i+1])break;i+=1}while(i<t.length-2);if(p=0,(U=t[i]<<8|t[i+1])<65280)throw new Error("marker was not found");if(!(U>=65488&&U<=65495))break;i+=2}return i-d}function u(e,h){var f,c,u=[],d=h.blocksPerLine,g=h.blocksPerColumn,p=d<<3,w=new Int32Array(64),y=new Uint8Array(64);function b(e,f,c){var u,d,g,p,m,w,y,b,_,v,x=h.quantizationTable,k=c;for(v=0;v<64;v++)k[v]=e[v]*x[v];for(v=0;v<8;++v){var T=8*v;0!=k[1+T]||0!=k[2+T]||0!=k[3+T]||0!=k[4+T]||0!=k[5+T]||0!=k[6+T]||0!=k[7+T]?(u=o*k[0+T]+128>>8,d=o*k[4+T]+128>>8,g=k[2+T],p=k[6+T],m=l*(k[1+T]-k[7+T])+128>>8,b=l*(k[1+T]+k[7+T])+128>>8,w=k[3+T]<<4,y=k[5+T]<<4,_=u-d+1>>1,u=u+d+1>>1,d=_,_=g*s+p*a+128>>8,g=g*a-p*s+128>>8,p=_,_=m-y+1>>1,m=m+y+1>>1,y=_,_=b+w+1>>1,w=b-w+1>>1,b=_,_=u-p+1>>1,u=u+p+1>>1,p=_,_=d-g+1>>1,d=d+g+1>>1,g=_,_=m*n+b*r+2048>>12,m=m*r-b*n+2048>>12,b=_,_=w*i+y*t+2048>>12,w=w*t-y*i+2048>>12,y=_,k[0+T]=u+b,k[7+T]=u-b,k[1+T]=d+y,k[6+T]=d-y,k[2+T]=g+w,k[5+T]=g-w,k[3+T]=p+m,k[4+T]=p-m):(_=o*k[0+T]+512>>10,k[0+T]=_,k[1+T]=_,k[2+T]=_,k[3+T]=_,k[4+T]=_,k[5+T]=_,k[6+T]=_,k[7+T]=_)}for(v=0;v<8;++v){var S=v;0!=k[8+S]||0!=k[16+S]||0!=k[24+S]||0!=k[32+S]||0!=k[40+S]||0!=k[48+S]||0!=k[56+S]?(u=o*k[0+S]+2048>>12,d=o*k[32+S]+2048>>12,g=k[16+S],p=k[48+S],m=l*(k[8+S]-k[56+S])+2048>>12,b=l*(k[8+S]+k[56+S])+2048>>12,w=k[24+S],y=k[40+S],_=u-d+1>>1,u=u+d+1>>1,d=_,_=g*s+p*a+2048>>12,g=g*a-p*s+2048>>12,p=_,_=m-y+1>>1,m=m+y+1>>1,y=_,_=b+w+1>>1,w=b-w+1>>1,b=_,_=u-p+1>>1,u=u+p+1>>1,p=_,_=d-g+1>>1,d=d+g+1>>1,g=_,_=m*n+b*r+2048>>12,m=m*r-b*n+2048>>12,b=_,_=w*i+y*t+2048>>12,w=w*t-y*i+2048>>12,y=_,k[0+S]=u+b,k[56+S]=u-b,k[8+S]=d+y,k[48+S]=d-y,k[16+S]=g+w,k[40+S]=g-w,k[24+S]=p+m,k[32+S]=p-m):(_=o*c[v+0]+8192>>14,k[0+S]=_,k[8+S]=_,k[16+S]=_,k[24+S]=_,k[32+S]=_,k[40+S]=_,k[48+S]=_,k[56+S]=_)}for(v=0;v<64;++v){var A=128+(k[v]+8>>4);f[v]=A<0?0:A>255?255:A}}m(p*g*8);for(var _=0;_<g;_++){var v=_<<3;for(f=0;f<8;f++)u.push(new Uint8Array(p));for(var x=0;x<d;x++){b(h.blocks[_][x],y,w);var k=0,T=x<<3;for(c=0;c<8;c++){var S=u[v+c];for(f=0;f<8;f++)S[T+f]=y[k++]}}}return u}function d(e){return e<0?0:e>255?255:e}h.prototype={load:function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){var e=new Uint8Array(t.response||t.mozResponseArrayBuffer);this.parse(e),this.onload&&this.onload()}.bind(this),t.send(null)},parse:function(t){var i=1e3*this.opts.maxResolutionInMP*1e3,r=0;function n(){var e=t[r]<<8|t[r+1];return r+=2,e}function a(e){var t,i,r=1,n=1;for(i in e.components)e.components.hasOwnProperty(i)&&(r<(t=e.components[i]).h&&(r=t.h),n<t.v&&(n=t.v));var a=Math.ceil(e.samplesPerLine/8/r),s=Math.ceil(e.scanLines/8/n);for(i in e.components)if(e.components.hasOwnProperty(i)){t=e.components[i];var o=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/r),l=Math.ceil(Math.ceil(e.scanLines/8)*t.v/n),h=a*t.h,f=s*t.v,c=[];m(f*h*256);for(var u=0;u<f;u++){for(var d=[],g=0;g<h;g++)d.push(new Int32Array(64));c.push(d)}t.blocksPerLine=o,t.blocksPerColumn=l,t.blocks=c}e.maxH=r,e.maxV=n,e.mcusPerLine=a,e.mcusPerColumn=s}t.length;var s,o,l,h,d=null,g=null,p=[],w=[],y=[],b=[],_=n(),v=-1;if(this.comments=[],65496!=_)throw new Error("SOI not found");for(_=n();65497!=_;){switch(_){case 65280:break;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 x=(l=void 0,h=void 0,l=n(),h=t.subarray(r,r+l-2),r+=h.length,h);if(65534===_){var k=String.fromCharCode.apply(null,x);this.comments.push(k)}65504===_&&74===x[0]&&70===x[1]&&73===x[2]&&70===x[3]&&0===x[4]&&(d={version:{major:x[5],minor:x[6]},densityUnits:x[7],xDensity:x[8]<<8|x[9],yDensity:x[10]<<8|x[11],thumbWidth:x[12],thumbHeight:x[13],thumbData:x.subarray(14,14+3*x[12]*x[13])}),65505===_&&69===x[0]&&120===x[1]&&105===x[2]&&102===x[3]&&0===x[4]&&(this.exifBuffer=x.subarray(5,x.length)),65518===_&&65===x[0]&&100===x[1]&&111===x[2]&&98===x[3]&&101===x[4]&&0===x[5]&&(g={version:x[6],flags0:x[7]<<8|x[8],flags1:x[9]<<8|x[10],transformCode:x[11]});break;case 65499:for(var T=n()+r-2;r<T;){var S=t[r++];m(256);var A=new Int32Array(64);if(S>>4==0)for(Y=0;Y<64;Y++)A[e[Y]]=t[r++];else{if(S>>4!=1)throw new Error("DQT: invalid table spec");for(Y=0;Y<64;Y++)A[e[Y]]=n()}p[15&S]=A}break;case 65472:case 65473:case 65474:n(),(s={}).extended=65473===_,s.progressive=65474===_,s.precision=t[r++],s.scanLines=n(),s.samplesPerLine=n(),s.components={},s.componentsOrder=[];var C=s.scanLines*s.samplesPerLine;if(C>i){var P=Math.ceil((C-i)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${P}MP`)}var M,I=t[r++];for(Z=0;Z<I;Z++){M=t[r];var E=t[r+1]>>4,U=15&t[r+1],D=t[r+2];if(E<=0||U<=0)throw new Error("Invalid sampling factor, expected values above 0");s.componentsOrder.push(M),s.components[M]={h:E,v:U,quantizationIdx:D},r+=3}a(s),w.push(s);break;case 65476:var O=n();for(Z=2;Z<O;){var L=t[r++],z=new Uint8Array(16),G=0;for(Y=0;Y<16;Y++,r++)G+=z[Y]=t[r];m(16+G);var R=new Uint8Array(G);for(Y=0;Y<G;Y++,r++)R[Y]=t[r];Z+=17+G,(L>>4==0?b:y)[15&L]=f(z,R)}break;case 65501:n(),o=n();break;case 65500:n(),n();break;case 65498:n();var B=t[r++],F=[];for(Z=0;Z<B;Z++){$=s.components[t[r++]];var V=t[r++];$.huffmanTableDC=b[V>>4],$.huffmanTableAC=y[15&V],F.push($)}var N=t[r++],K=t[r++],j=t[r++],H=c(t,r,s,F,o,N,K,j>>4,15&j,this.opts);r+=H;break;case 65535:255!==t[r]&&r--;break;default:if(255==t[r-3]&&t[r-2]>=192&&t[r-2]<=254){r-=3;break}if(224===_||225==_){if(-1!==v)throw new Error(`first unknown JPEG marker at offset ${v.toString(16)}, second unknown JPEG marker ${_.toString(16)} at offset ${(r-1).toString(16)}`);v=r-1;const e=n();if(255===t[r+e-2]){r+=e-2;break}}throw new Error("unknown JPEG marker "+_.toString(16))}_=n()}if(1!=w.length)throw new Error("only single frame JPEGs supported");for(var Z=0;Z<w.length;Z++){var W=w[Z].components;for(var Y in W)W[Y].quantizationTable=p[W[Y].quantizationIdx],delete W[Y].quantizationIdx}for(this.width=s.samplesPerLine,this.height=s.scanLines,this.jfif=d,this.adobe=g,this.components=[],Z=0;Z<s.componentsOrder.length;Z++){var $=s.components[s.componentsOrder[Z]];this.components.push({lines:u(0,$),scaleX:$.h/s.maxH,scaleY:$.v/s.maxV})}},getData:function(e,t){var i,r,n,a,s,o,l,h,f,c,u,g,p,w,y,b,_,v,x,k,T,S=this.width/e,A=this.height/t,C=0,P=e*t*this.components.length;m(P);var M=new Uint8Array(P);switch(this.components.length){case 1:for(i=this.components[0],c=0;c<t;c++)for(s=i.lines[0|c*i.scaleY*A],f=0;f<e;f++)u=s[0|f*i.scaleX*S],M[C++]=u;break;case 2:for(i=this.components[0],r=this.components[1],c=0;c<t;c++)for(s=i.lines[0|c*i.scaleY*A],o=r.lines[0|c*r.scaleY*A],f=0;f<e;f++)u=s[0|f*i.scaleX*S],M[C++]=u,u=o[0|f*r.scaleX*S],M[C++]=u;break;case 3:for(T=!0,this.adobe&&this.adobe.transformCode?T=!0:void 0!==this.opts.colorTransform&&(T=!!this.opts.colorTransform),i=this.components[0],r=this.components[1],n=this.components[2],c=0;c<t;c++)for(s=i.lines[0|c*i.scaleY*A],o=r.lines[0|c*r.scaleY*A],l=n.lines[0|c*n.scaleY*A],f=0;f<e;f++)T?(u=s[0|f*i.scaleX*S],g=o[0|f*r.scaleX*S],v=d(u+1.402*((p=l[0|f*n.scaleX*S])-128)),x=d(u-.3441363*(g-128)-.71413636*(p-128)),k=d(u+1.772*(g-128))):(v=s[0|f*i.scaleX*S],x=o[0|f*r.scaleX*S],k=l[0|f*n.scaleX*S]),M[C++]=v,M[C++]=x,M[C++]=k;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(T=!1,this.adobe&&this.adobe.transformCode?T=!0:void 0!==this.opts.colorTransform&&(T=!!this.opts.colorTransform),i=this.components[0],r=this.components[1],n=this.components[2],a=this.components[3],c=0;c<t;c++)for(s=i.lines[0|c*i.scaleY*A],o=r.lines[0|c*r.scaleY*A],l=n.lines[0|c*n.scaleY*A],h=a.lines[0|c*a.scaleY*A],f=0;f<e;f++)T?(u=s[0|f*i.scaleX*S],g=o[0|f*r.scaleX*S],p=l[0|f*n.scaleX*S],w=h[0|f*a.scaleX*S],y=255-d(u+1.402*(p-128)),b=255-d(u-.3441363*(g-128)-.71413636*(p-128)),_=255-d(u+1.772*(g-128))):(y=s[0|f*i.scaleX*S],b=o[0|f*r.scaleX*S],_=l[0|f*n.scaleX*S],w=h[0|f*a.scaleX*S]),M[C++]=255-y,M[C++]=255-b,M[C++]=255-_,M[C++]=255-w;break;default:throw new Error("Unsupported color mode")}return M},copyToImageData:function(e,t){var i,r,n,a,s,o,l,h,f,c=e.width,u=e.height,g=e.data,p=this.getData(c,u),m=0,w=0;switch(this.components.length){case 1:for(r=0;r<u;r++)for(i=0;i<c;i++)n=p[m++],g[w++]=n,g[w++]=n,g[w++]=n,t&&(g[w++]=255);break;case 3:for(r=0;r<u;r++)for(i=0;i<c;i++)l=p[m++],h=p[m++],f=p[m++],g[w++]=l,g[w++]=h,g[w++]=f,t&&(g[w++]=255);break;case 4:for(r=0;r<u;r++)for(i=0;i<c;i++)s=p[m++],o=p[m++],n=p[m++],l=255-d(s*(1-(a=p[m++])/255)+a),h=255-d(o*(1-a/255)+a),f=255-d(n*(1-a/255)+a),g[w++]=l,g[w++]=h,g[w++]=f,t&&(g[w++]=255);break;default:throw new Error("Unsupported color mode")}}};var g=0,p=0;function m(e=0){var t=g+e;if(t>p){var i=Math.ceil((t-p)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${i}MB`)}g=t}return h.resetMaxMemoryUsage=function(e){g=0,p=e},h.getBytesAllocated=function(){return g},h.requestMemoryAllocation=m,h}(),Sr.exports=function(e,t={}){var i={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512,...t},r=new Uint8Array(e),n=new Ar;n.opts=i,Ar.resetMaxMemoryUsage(1024*i.maxMemoryUsageInMB*1024),n.parse(r);var a=i.formatAsRGBA?4:3,s=n.width*n.height*a;try{Ar.requestMemoryAllocation(s);var o={width:n.width,height:n.height,exifBuffer:n.exifBuffer,data:i.useTArray?new Uint8Array(s):Buffer.alloc(s)};n.comments.length>0&&(o.comments=n.comments)}catch(e){if(e instanceof RangeError)throw new Error("Could not allocate enough memory for the image. Required: "+s);if(e instanceof ReferenceError&&"Buffer is not defined"===e.message)throw new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true");throw e}return n.copyToImageData(o,i.formatAsRGBA),o};var Mr=kr({encode:Cr,decode:Pr.exports});const Ir=Math.PI,Er=Ir/4,Ur=180/Ir;function Dr(e,t){let i=e.length-t,r=0;do{for(let i=t;i>0;i--)e[r+t]+=e[r],r++;i-=t}while(i>0)}function Or(e,t,i){let r=0,n=e.length;const a=n/i;for(;n>t;){for(let i=t;i>0;--i)e[r+t]+=e[r],++r;n-=t}const s=e.slice();for(let t=0;t<a;++t)for(let r=0;r<i;++r)e[i*t+r]=s[(i-r-1)*a+t]}let Lr=class{async decode(e,t){const i=await this.decodeBlock(t),r=e.Predictor||1;if(1!==r){const t=!e.StripOffsets;return function(e,t,i,r,n,a){if(!t||1===t)return e;for(let e=0;e<n.length;++e){if(n[e]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(n[e]!==n[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const s=n[0]/8,o=2===a?1:n.length;for(let a=0;a<r&&!(a*o*i*s>=e.byteLength);++a){let r;if(2===t){switch(n[0]){case 8:r=new Uint8Array(e,a*o*i*s,o*i*s);break;case 16:r=new Uint16Array(e,a*o*i*s,o*i*s/2);break;case 32:r=new Uint32Array(e,a*o*i*s,o*i*s/4);break;default:throw new Error(`Predictor 2 not allowed with ${n[0]} bits per sample.`)}Dr(r,o)}else 3===t&&(r=new Uint8Array(e,a*o*i*s,o*i*s),Or(r,o,s))}return e}(i,r,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return i}};const zr=257;function Gr(e,t){for(let i=t.length-1;i>=0;i--)e.push(t[i]);return e}function Rr(e){const t=new Uint16Array(4093),i=new Uint8Array(4093);for(let e=0;e<=257;e++)t[e]=4096,i[e]=e;let r=258,n=9,a=0;function s(){r=258,n=9}function o(e){const t=function(e,t,i){const r=t%8,n=Math.floor(t/8),a=8-r,s=t+i-8*(n+1);let o=8*(n+2)-(t+i);const l=8*(n+2)-t;if(o=Math.max(0,o),n>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),zr;let h=e[n]&2**(8-r)-1;h<<=i-a;let f=h;if(n+1<e.length){let t=e[n+1]>>>o;t<<=Math.max(0,i-l),f+=t}if(s>8&&n+2<e.length){const r=8*(n+3)-(t+i);f+=e[n+2]>>>r}return f}(e,a,n);return a+=n,t}function l(e,n){return i[r]=n,t[r]=e,r++,r-1}function h(e){const r=[];for(let n=e;4096!==n;n=t[n])r.push(i[n]);return r}const f=[];s();const c=new Uint8Array(e);let u,d=o(c);for(;d!==zr;){if(256===d){for(s(),d=o(c);256===d;)d=o(c);if(d===zr)break;if(d>256)throw new Error(`corrupted code at scanline ${d}`);Gr(f,h(d)),u=d}else if(d<r){const e=h(d);Gr(f,e),l(u,e[e.length-1]),u=d}else{const e=h(u);if(!e)throw new Error(`Bogus entry. Not in dictionary,\n ${u} / ${r},\n position: ${a}`);Gr(f,e),f.push(e[e.length-1]),l(u,e[e.length-1]),u=d}r+1>=2**n&&(12===n?u=void 0:n++),d=o(c)}return new Uint8Array(f)}let Br=class extends Lr{decodeBlock(e){return Rr(e).buffer}};function Fr(e){return(t,...i)=>Nr(e,t,i)}function Vr(e,t){return Fr(Zr(e,t).get)}const{apply:Nr,construct:Kr,defineProperty:jr,get:Hr,getOwnPropertyDescriptor:Zr,getPrototypeOf:Wr,has:Yr,ownKeys:$r,set:Xr,setPrototypeOf:qr}=Reflect,{iterator:Jr,species:Qr,toStringTag:en,for:tn}=Symbol,rn=Object,{create:nn,defineProperty:an,freeze:sn,is:on}=rn,ln=Array.prototype[Jr],hn=Fr(ln),fn=ArrayBuffer;Vr(fn.prototype,"byteLength");const cn="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null;cn&&Vr(cn.prototype,"byteLength");const un=Wr(Uint8Array);un.from;const dn=un.prototype;dn[Jr],Fr(dn.keys),Fr(dn.values),Fr(dn.entries),Fr(dn.set),Fr(dn.reverse),Fr(dn.fill),Fr(dn.copyWithin),Fr(dn.sort),Fr(dn.slice),Fr(dn.subarray),Vr(dn,"buffer"),Vr(dn,"byteOffset"),Vr(dn,"length"),Vr(dn,en);const gn=Uint32Array,pn=Float32Array,mn=Wr([][Jr]()),wn=Fr(mn.next),yn=Fr(function*(){}().next),bn=Wr(mn),_n=Fr(DataView.prototype.getUint16),vn=WeakMap,xn=vn.prototype,kn=Fr(xn.get),Tn=Fr(xn.set),Sn=new vn,An=nn(null,{next:{value:function(){const e=kn(Sn,this);return wn(e)}},[Jr]:{value:function(){return this}}});const Cn=new vn,Pn=nn(bn,{next:{value:function(){const e=kn(Cn,this);return yn(e)},writable:!0,configurable:!0}});for(const e of $r(mn))"next"!==e&&an(Pn,e,Zr(mn,e));const Mn=new fn(4),In=new pn(Mn),En=new gn(Mn),Un=new gn(512),Dn=new gn(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(Un[e]=0,Un[256|e]=32768,Dn[e]=24,Dn[256|e]=24):t<-14?(Un[e]=1024>>-t-14,Un[256|e]=1024>>-t-14|32768,Dn[e]=-t-1,Dn[256|e]=-t-1):t<=15?(Un[e]=t+15<<10,Un[256|e]=t+15<<10|32768,Dn[e]=13,Dn[256|e]=13):t<128?(Un[e]=31744,Un[256|e]=64512,Dn[e]=24,Dn[256|e]=24):(Un[e]=31744,Un[256|e]=64512,Dn[e]=13,Dn[256|e]=13)}const On=new gn(2048),Ln=new gn(64),zn=new gn(64);for(let e=1;e<1024;++e){let t=e<<13,i=0;for(;0==(8388608&t);)t<<=1,i-=8388608;t&=-8388609,i+=947912704,On[e]=t|i}for(let e=1024;e<2048;++e)On[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)Ln[e]=e<<23;Ln[31]=1199570944,Ln[32]=2147483648;for(let e=33;e<63;++e)Ln[e]=2147483648+(e-32<<23);Ln[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(zn[e]=1024);function Gn(e,t,...i){return function(e){const t=e>>10;return En[0]=On[zn[t]+(1023&e)]+Ln[t],In[0]}(_n(e,t,...function(e){if(e[Jr]===ln&&mn.next===wn)return e;const t=nn(An);return Tn(Sn,t,hn(e)),t}(i)))}var Rn={exports:{}};function Bn(e,t,i){const r=i&&i.debug||!1;r&&console.log("[xml-utils] getting "+t+" in "+e);const n="object"==typeof e?e.outer:e,a=n.slice(0,n.indexOf(">")+1),s=['"',"'"];for(let e=0;e<s.length;e++){const i=s[e],n=t+"\\="+i+"([^"+i+"]*)"+i;r&&console.log("[xml-utils] pattern:",n);const o=new RegExp(n).exec(a);if(r&&console.log("[xml-utils] match:",o),o)return o[1]}}Rn.exports=Bn,Rn.exports.default=Bn;var Fn=kr(Rn.exports),Vn={exports:{}},Nn={exports:{}},Kn={exports:{}};function jn(e,t,i){const r=new RegExp(t).exec(e.slice(i));return r?i+r.index:-1}Kn.exports=jn,Kn.exports.default=jn;var Hn=Kn.exports,Zn={exports:{}};function Wn(e,t,i){const r=new RegExp(t).exec(e.slice(i));return r?i+r.index+r[0].length-1:-1}Zn.exports=Wn,Zn.exports.default=Wn;var Yn=Zn.exports,$n={exports:{}};function Xn(e,t){const i=new RegExp(t,"g"),r=e.match(i);return r?r.length:0}$n.exports=Xn,$n.exports.default=Xn;var qn=$n.exports;const Jn=Hn,Qn=Yn,ea=qn;function ta(e,t,i){const r=i&&i.debug||!1,n=!(i&&!1===typeof i.nested),a=i&&i.startIndex||0;r&&console.log("[xml-utils] starting findTagByName with",t," and ",i);const s=Jn(e,`<${t}[ \n>/]`,a);if(r&&console.log("[xml-utils] start:",s),-1===s)return;const o=e.slice(s+t.length);let l=Qn(o,"^[^<]*[ /]>",0);const h=-1!==l&&"/"===o[l-1];if(r&&console.log("[xml-utils] selfClosing:",h),!1===h)if(n){let e=0,i=1,r=0;for(;-1!==(l=Qn(o,"[ /]"+t+">",e));){const n=o.substring(e,l+1);if(i+=ea(n,"<"+t+"[ \n\t>]"),r+=ea(n,"</"+t+">"),r>=i)break;e=l}}else l=Qn(o,"[ /]"+t+">",0);const f=s+t.length+l+1;if(r&&console.log("[xml-utils] end:",f),-1===f)return;const c=e.slice(s,f);let u;return u=h?null:c.slice(c.indexOf(">")+1,c.lastIndexOf("<")),{inner:u,outer:c,start:s,end:f}}Nn.exports=ta,Nn.exports.default=ta;const ia=Nn.exports;function ra(e,t,i){const r=[],n=i&&i.debug||!1,a=!i||"boolean"!=typeof i.nested||i.nested;let s,o=i&&i.startIndex||0;for(;s=ia(e,t,{debug:n,startIndex:o});)o=a?s.start+1+t.length:s.end,r.push(s);return n&&console.log("findTagsByName found",r.length,"tags"),r}Vn.exports=ra,Vn.exports.default=ra;var na=kr(Vn.exports);const aa={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},sa={};for(const e in aa)aa.hasOwnProperty(e)&&(sa[aa[e]]=parseInt(e,10));const oa=[sa.BitsPerSample,sa.ExtraSamples,sa.SampleFormat,sa.StripByteCounts,sa.StripOffsets,sa.StripRowCounts,sa.TileByteCounts,sa.TileOffsets,sa.SubIFDs],la={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},ha={};for(const e in la)la.hasOwnProperty(e)&&(ha[la[e]]=parseInt(e,10));const fa=0,ca=1,ua=2,da=3,ga=5,pa=6,ma=8,wa=0,ya=1,ba=0,_a=1,va={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};const xa=new Map;function ka(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>xa.set(e,t)))}function Ta(e,t,i,r=1){return new(Object.getPrototypeOf(e).constructor)(t*i*r)}function Sa(e,t,i){return(1-i)*e+i*t}function Aa(e,t,i,r,n,a="nearest"){switch(a.toLowerCase()){case"nearest":return function(e,t,i,r,n){const a=t/r,s=i/n;return e.map((e=>{const o=Ta(e,r,n);for(let l=0;l<n;++l){const n=Math.min(Math.round(s*l),i-1);for(let i=0;i<r;++i){const s=Math.min(Math.round(a*i),t-1),h=e[n*t+s];o[l*r+i]=h}}return o}))}(e,t,i,r,n);case"bilinear":case"linear":return function(e,t,i,r,n){const a=t/r,s=i/n;return e.map((e=>{const o=Ta(e,r,n);for(let l=0;l<n;++l){const n=s*l,h=Math.floor(n),f=Math.min(Math.ceil(n),i-1);for(let i=0;i<r;++i){const s=a*i,c=s%1,u=Math.floor(s),d=Math.min(Math.ceil(s),t-1),g=e[h*t+u],p=e[h*t+d],m=e[f*t+u],w=e[f*t+d],y=Sa(Sa(g,p,c),Sa(m,w,c),n%1);o[l*r+i]=y}}return o}))}(e,t,i,r,n);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function Ca(e,t,i,r,n,a,s="nearest"){switch(s.toLowerCase()){case"nearest":return function(e,t,i,r,n,a){const s=t/r,o=i/n,l=Ta(e,r,n,a);for(let h=0;h<n;++h){const n=Math.min(Math.round(o*h),i-1);for(let i=0;i<r;++i){const o=Math.min(Math.round(s*i),t-1);for(let s=0;s<a;++s){const f=e[n*t*a+o*a+s];l[h*r*a+i*a+s]=f}}}return l}(e,t,i,r,n,a);case"bilinear":case"linear":return function(e,t,i,r,n,a){const s=t/r,o=i/n,l=Ta(e,r,n,a);for(let h=0;h<n;++h){const n=o*h,f=Math.floor(n),c=Math.min(Math.ceil(n),i-1);for(let i=0;i<r;++i){const o=s*i,u=o%1,d=Math.floor(o),g=Math.min(Math.ceil(o),t-1);for(let s=0;s<a;++s){const o=e[f*t*a+d*a+s],p=e[f*t*a+g*a+s],m=e[c*t*a+d*a+s],w=e[c*t*a+g*a+s],y=Sa(Sa(o,p,u),Sa(m,w,u),n%1);l[h*r*a+i*a+s]=y}}}return l}(e,t,i,r,n,a);default:throw new Error(`Unsupported resampling method: '${s}'`)}}function Pa(e,t,i){let r=0;for(let n=t;n<i;++n)r+=e[n];return r}function Ma(e,t,i){switch(e){case 1:if(t<=8)return new Uint8Array(i);if(t<=16)return new Uint16Array(i);if(t<=32)return new Uint32Array(i);break;case 2:if(8===t)return new Int8Array(i);if(16===t)return new Int16Array(i);if(32===t)return new Int32Array(i);break;case 3:switch(t){case 16:case 32:return new Float32Array(i);case 64:return new Float64Array(i)}}throw Error("Unsupported data format/bitsPerSample")}ka([void 0,1],(()=>Promise.resolve().then((function(){return es})).then((e=>e.default)))),ka(5,(()=>Promise.resolve().then((function(){return ns})).then((e=>e.default)))),ka(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),ka(7,(()=>Promise.resolve().then((function(){return ys})).then((e=>e.default)))),ka([8,32946],(()=>Promise.resolve().then((function(){return bs})).then((e=>e.default)))),ka(32773,(()=>Promise.resolve().then((function(){return _s})).then((e=>e.default)))),ka(34887,(()=>Promise.resolve().then((function(){return ks})).then((e=>e.default)))),ka(50001,(()=>Promise.resolve().then((function(){return Ts})).then((e=>e.default))));var Ia=class{constructor(e,t,i,r,n,a){this.fileDirectory=e,this.geoKeys=t,this.dataView=i,this.littleEndian=r,this.tiles=n?{}:null,this.isTiled=!e.StripOffsets;const s=e.PlanarConfiguration;if(this.planarConfiguration=void 0===s?1:s,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=a}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return void 0!==this.fileDirectory.SamplesPerPixel?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,i=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(i<=8)return DataView.prototype.getUint8;if(i<=16)return DataView.prototype.getUint16;if(i<=32)return DataView.prototype.getUint32;break;case 2:if(i<=8)return DataView.prototype.getInt8;if(i<=16)return DataView.prototype.getInt16;if(i<=32)return DataView.prototype.getInt32;break;case 3:switch(i){case 16:return function(e,t){return Gn(this,e,t)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){return Ma(this.getSampleFormat(e),this.getBitsPerSample(e),t)}async getTileOrStrip(e,t,i,r,n){const a=Math.ceil(this.getWidth()/this.getTileWidth()),s=Math.ceil(this.getHeight()/this.getTileHeight());let o;const{tiles:l}=this;let h,f;1===this.planarConfiguration?o=t*a+e:2===this.planarConfiguration&&(o=i*a*s+t*a+e),this.isTiled?(h=this.fileDirectory.TileOffsets[o],f=this.fileDirectory.TileByteCounts[o]):(h=this.fileDirectory.StripOffsets[o],f=this.fileDirectory.StripByteCounts[o]);const c=(await this.source.fetch([{offset:h,length:f}],n))[0];let u;return null!==l&&l[o]?u=l[o]:(u=(async()=>{let e=await r.decode(this.fileDirectory,c);const i=this.getSampleFormat(),n=this.getBitsPerSample();return function(e,t){return(1!==e&&2!==e||!(t<=32)||t%8!=0)&&(3!==e||16!==t&&32!==t&&64!==t)}(i,n)&&(e=function(e,t,i,r,n,a,s){const o=new DataView(e),l=2===i?1:r,h=Ma(t,n,2===i?s*a:s*a*r),f=parseInt("1".repeat(n),2);if(1===t){let e;e=1===i?r*n:n;let t=a*e;0!=(7&t)&&(t=t+7&-8);for(let e=0;e<s;++e){const i=e*t;for(let t=0;t<a;++t){const r=i+t*l*n;for(let i=0;i<l;++i){const s=r+i*n,c=(e*a+t)*l+i,u=Math.floor(s/8),d=s%8;if(d+n<=8)h[c]=o.getUint8(u)>>8-n-d&f;else if(d+n<=16)h[c]=o.getUint16(u)>>16-n-d&f;else if(d+n<=24){const e=o.getUint16(u)<<8|o.getUint8(u+2);h[c]=e>>24-n-d&f}else h[c]=o.getUint32(u)>>32-n-d&f}}}}return h.buffer}(e,i,this.planarConfiguration,this.getSamplesPerPixel(),n,this.getTileWidth(),this.getBlockHeight(t))),e})(),null!==l&&(l[o]=u)),{x:e,y:t,sample:i,data:await u}}async _readRaster(e,t,i,r,n,a,s,o,l){const h=this.getTileWidth(),f=this.getTileHeight(),c=this.getWidth(),u=this.getHeight(),d=Math.max(Math.floor(e[0]/h),0),g=Math.min(Math.ceil(e[2]/h),Math.ceil(c/h)),p=Math.max(Math.floor(e[1]/f),0),m=Math.min(Math.ceil(e[3]/f),Math.ceil(u/f)),w=e[2]-e[0];let y=this.getBytesPerPixel();const b=[],_=[];for(let e=0;e<t.length;++e)1===this.planarConfiguration?b.push(Pa(this.fileDirectory.BitsPerSample,0,t[e])/8):b.push(0),_.push(this.getReaderForSample(t[e]));const v=[],{littleEndian:x}=this;for(let a=p;a<m;++a)for(let s=d;s<g;++s)for(let o=0;o<t.length;++o){const d=o,g=t[o];2===this.planarConfiguration&&(y=this.getSampleByteSize(o));const p=this.getTileOrStrip(s,a,g,n,l).then((n=>{const a=n.data,s=new DataView(a),o=this.getBlockHeight(n.y),l=n.y*f,g=n.x*h,p=l+o,m=(n.x+1)*h,v=_[d],k=Math.min(o,o-(p-e[3]),u-l),T=Math.min(h,h-(m-e[2]),c-g);for(let n=Math.max(0,e[1]-l);n<k;++n)for(let a=Math.max(0,e[0]-g);a<T;++a){const o=(n*h+a)*y,f=v.call(s,o+b[d],x);let c;r?(c=(n+l-e[1])*w*t.length+(a+g-e[0])*t.length+d,i[c]=f):(c=(n+l-e[1])*w+a+g-e[0],i[d][c]=f)}}));v.push(p)}if(await Promise.all(v),a&&e[2]-e[0]!==a||s&&e[3]-e[1]!==s){let n;return n=r?Ca(i,e[2]-e[0],e[3]-e[1],a,s,t.length,o):Aa(i,e[2]-e[0],e[3]-e[1],a,s,o),n.width=a,n.height=s,n}return i.width=a||e[2]-e[0],i.height=s||e[3]-e[1],i}async readRasters({window:e,samples:t=[],interleave:i,pool:r=null,width:n,height:a,resampleMethod:s,fillValue:o,signal:l}={}){const h=e||[0,0,this.getWidth(),this.getHeight()];if(h[0]>h[2]||h[1]>h[3])throw new Error("Invalid subsets");const f=(h[2]-h[0])*(h[3]-h[1]),c=this.getSamplesPerPixel();if(t&&t.length){for(let e=0;e<t.length;++e)if(t[e]>=c)return Promise.reject(new RangeError(`Invalid sample index '${t[e]}'.`))}else for(let e=0;e<c;++e)t.push(e);let u;if(i){u=Ma(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),f*t.length),o&&u.fill(o)}else{u=[];for(let e=0;e<t.length;++e){const i=this.getArrayForSample(t[e],f);Array.isArray(o)&&e<o.length?i.fill(o[e]):o&&!Array.isArray(o)&&i.fill(o),u.push(i)}}const d=r||await async function(e){const t=xa.get(e.Compression);if(!t)throw new Error(`Unknown compression method identifier: ${e.Compression}`);return new(await t())(e)}(this.fileDirectory);return await this._readRaster(h,t,u,i,d,n,a,s,l)}async readRGB({window:e,interleave:t=!0,pool:i=null,width:r,height:n,resampleMethod:a,enableAlpha:s=!1,signal:o}={}){const l=e||[0,0,this.getWidth(),this.getHeight()];if(l[0]>l[2]||l[1]>l[3])throw new Error("Invalid subsets");const h=this.fileDirectory.PhotometricInterpretation;if(h===ua){let l=[0,1,2];if(this.fileDirectory.ExtraSamples!==wa&&s){l=[];for(let e=0;e<this.fileDirectory.BitsPerSample.length;e+=1)l.push(e)}return this.readRasters({window:e,interleave:t,samples:l,pool:i,width:r,height:n,resampleMethod:a,signal:o})}let f;switch(h){case fa:case ca:case da:f=[0];break;case ga:f=[0,1,2,3];break;case pa:case ma:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const c={window:l,interleave:!0,samples:f,pool:i,width:r,height:n,resampleMethod:a,signal:o},{fileDirectory:u}=this,d=await this.readRasters(c),g=2**this.fileDirectory.BitsPerSample[0];let p;switch(h){case fa:p=function(e,t){const{width:i,height:r}=e,n=new Uint8Array(i*r*3);let a;for(let i=0,r=0;i<e.length;++i,r+=3)a=256-e[i]/t*256,n[r]=a,n[r+1]=a,n[r+2]=a;return n}(d,g);break;case ca:p=function(e,t){const{width:i,height:r}=e,n=new Uint8Array(i*r*3);let a;for(let i=0,r=0;i<e.length;++i,r+=3)a=e[i]/t*256,n[r]=a,n[r+1]=a,n[r+2]=a;return n}(d,g);break;case da:p=function(e,t){const{width:i,height:r}=e,n=new Uint8Array(i*r*3),a=t.length/3,s=t.length/3*2;for(let i=0,r=0;i<e.length;++i,r+=3){const o=e[i];n[r]=t[o]/65536*256,n[r+1]=t[o+a]/65536*256,n[r+2]=t[o+s]/65536*256}return n}(d,u.ColorMap);break;case ga:p=function(e){const{width:t,height:i}=e,r=new Uint8Array(t*i*3);for(let t=0,i=0;t<e.length;t+=4,i+=3){const n=e[t],a=e[t+1],s=e[t+2],o=e[t+3];r[i]=(255-n)/256*255*((255-o)/256),r[i+1]=(255-a)/256*255*((255-o)/256),r[i+2]=(255-s)/256*255*((255-o)/256)}return r}(d);break;case pa:p=function(e){const{width:t,height:i}=e,r=new Uint8ClampedArray(t*i*3);for(let t=0,i=0;t<e.length;t+=3,i+=3){const n=e[t],a=e[t+1],s=e[t+2];r[i]=n+1.402*(s-128),r[i+1]=n-.34414*(a-128)-.71414*(s-128),r[i+2]=n+1.772*(a-128)}return r}(d);break;case ma:p=function(e){const{width:t,height:i}=e,r=new Uint8Array(t*i*3);for(let t=0,i=0;t<e.length;t+=3,i+=3){let n,a,s,o=(e[t+0]+16)/116,l=(e[t+1]<<24>>24)/500+o,h=o-(e[t+2]<<24>>24)/200;l=.95047*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),o=1*(o*o*o>.008856?o*o*o:(o-16/116)/7.787),h=1.08883*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),n=3.2406*l+-1.5372*o+-.4986*h,a=-.9689*l+1.8758*o+.0415*h,s=.0557*l+-.204*o+1.057*h,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,r[i]=255*Math.max(0,Math.min(1,n)),r[i+1]=255*Math.max(0,Math.min(1,a)),r[i+2]=255*Math.max(0,Math.min(1,s))}return r}(d);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const e=new Uint8Array(p.length/3),t=new Uint8Array(p.length/3),i=new Uint8Array(p.length/3);for(let r=0,n=0;r<p.length;r+=3,++n)e[n]=p[r],t[n]=p[r+1],i[n]=p[r+2];p=[e,t,i]}return p.width=d.width,p.height=d.height,p}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const i=this.fileDirectory.GDAL_METADATA;let r=na(i,"Item");r=null===e?r.filter((e=>void 0===Fn(e,"sample"))):r.filter((t=>Number(Fn(t,"sample"))===e));for(let e=0;e<r.length;++e){const i=r[e];t[Fn(i,"name")]=i.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&6===e.length)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,i=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(i)return[i[0],i[5],i[10]];if(e){const[t,i,r]=e.getResolution();return[t*e.getWidth()/this.getWidth(),i*e.getHeight()/this.getHeight(),r*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(){const e=this.getOrigin(),t=this.getResolution(),i=e[0],r=e[1],n=i+t[0]*this.getWidth(),a=r+t[1]*this.getHeight();return[Math.min(i,n),Math.min(r,a),Math.max(i,n),Math.max(r,a)]}};class Ea{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const i=this.getUint32(e,t),r=this.getUint32(e+4,t);let n;if(t){if(n=i+2**32*r,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*i+r,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}getInt64(e,t){let i=0;const r=(128&this._dataView.getUint8(e+(t?7:0)))>0;let n=!0;for(let a=0;a<8;a++){let s=this._dataView.getUint8(e+(t?a:7-a));r&&(n?0!==s&&(s=255&~(s-1),n=!1):s=255&~s),i+=s*256**a}return r&&(i=-i),i}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return Gn(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class Ua{constructor(e,t,i,r){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=i,this._bigTiff=r}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),i=this.readUint32(e+4);let r;if(this._littleEndian){if(r=t+2**32*i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*t+i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}readInt64(e){let t=0;const i=(128&this._dataView.getUint8(e+(this._littleEndian?7:0)))>0;let r=!0;for(let n=0;n<8;n++){let a=this._dataView.getUint8(e+(this._littleEndian?n:7-n));i&&(r?0!==a&&(a=255&~(a-1),r=!1):a=255&~a),t+=a*256**n}return i&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class Da{async fetch(e,t=undefined){return Promise.all(e.map((e=>this.fetchSlice(e,t))))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class Oa extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,Oa),this.name="AbortError"}}class La extends Da{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,t){if(t&&t.aborted)throw new Oa("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function za(e,t){let i=e.length-t,r=0;do{for(let i=t;i>0;i--)e[r+t]+=e[r],r++;i-=t}while(i>0)}function Ga(e,t,i){let r=0,n=e.length;const a=n/i;for(;n>t;){for(let i=t;i>0;--i)e[r+t]+=e[r],++r;n-=t}const s=e.slice();for(let t=0;t<a;++t)for(let r=0;r<i;++r)e[i*t+r]=s[(i-r-1)*a+t]}class Ra{async decode(e,t){const i=await this.decodeBlock(t),r=e.Predictor||1;if(1!==r){const t=!e.StripOffsets;return function(e,t,i,r,n,a){if(!t||1===t)return e;for(let e=0;e<n.length;++e){if(n[e]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(n[e]!==n[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const s=n[0]/8,o=2===a?1:n.length;for(let a=0;a<r&&!(a*o*i*s>=e.byteLength);++a){let r;if(2===t){switch(n[0]){case 8:r=new Uint8Array(e,a*o*i*s,o*i*s);break;case 16:r=new Uint16Array(e,a*o*i*s,o*i*s/2);break;case 32:r=new Uint32Array(e,a*o*i*s,o*i*s/4);break;default:throw new Error(`Predictor 2 not allowed with ${n[0]} bits per sample.`)}za(r,o)}else 3===t&&(r=new Uint8Array(e,a*o*i*s,o*i*s),Ga(r,o,s))}return e}(i,r,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return i}}function Ba(e){switch(e){case ha.BYTE:case ha.ASCII:case ha.SBYTE:case ha.UNDEFINED:return 1;case ha.SHORT:case ha.SSHORT:return 2;case ha.LONG:case ha.SLONG:case ha.FLOAT:case ha.IFD:return 4;case ha.RATIONAL:case ha.SRATIONAL:case ha.DOUBLE:case ha.LONG8:case ha.SLONG8:case ha.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${e}`)}}function Fa(e,t,i,r){let n=null,a=null;const s=Ba(t);switch(t){case ha.BYTE:case ha.ASCII:case ha.UNDEFINED:n=new Uint8Array(i),a=e.readUint8;break;case ha.SBYTE:n=new Int8Array(i),a=e.readInt8;break;case ha.SHORT:n=new Uint16Array(i),a=e.readUint16;break;case ha.SSHORT:n=new Int16Array(i),a=e.readInt16;break;case ha.LONG:case ha.IFD:n=new Uint32Array(i),a=e.readUint32;break;case ha.SLONG:n=new Int32Array(i),a=e.readInt32;break;case ha.LONG8:case ha.IFD8:n=new Array(i),a=e.readUint64;break;case ha.SLONG8:n=new Array(i),a=e.readInt64;break;case ha.RATIONAL:n=new Uint32Array(2*i),a=e.readUint32;break;case ha.SRATIONAL:n=new Int32Array(2*i),a=e.readInt32;break;case ha.FLOAT:n=new Float32Array(i),a=e.readFloat32;break;case ha.DOUBLE:n=new Float64Array(i),a=e.readFloat64;break;default:throw new RangeError(`Invalid field type: ${t}`)}if(t!==ha.RATIONAL&&t!==ha.SRATIONAL)for(let t=0;t<i;++t)n[t]=a.call(e,r+t*s);else for(let t=0;t<i;t+=2)n[t]=a.call(e,r+t*s),n[t+1]=a.call(e,r+(t*s+4));return t===ha.ASCII?new TextDecoder("utf-8").decode(n):n}class Va{constructor(e,t,i){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=i}}class Na extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class Ka{async readRasters(e={}){const{window:t,width:i,height:r}=e;let{resX:n,resY:a,bbox:s}=e;const o=await this.getImage();let l=o;const h=await this.getImageCount(),f=o.getBoundingBox();if(t&&s)throw new Error('Both "bbox" and "window" passed.');if(i||r){if(t){const[e,i]=o.getOrigin(),[r,n]=o.getResolution();s=[e+t[0]*r,i+t[1]*n,e+t[2]*r,i+t[3]*n]}const e=s||f;if(i){if(n)throw new Error("Both width and resX passed");n=(e[2]-e[0])/i}if(r){if(a)throw new Error("Both width and resY passed");a=(e[3]-e[1])/r}}if(n||a){const e=[];for(let t=0;t<h;++t){const i=await this.getImage(t),{SubfileType:r,NewSubfileType:n}=i.fileDirectory;(0===t||2===r||1&n)&&e.push(i)}e.sort(((e,t)=>e.getWidth()-t.getWidth()));for(let t=0;t<e.length;++t){const i=e[t],r=(f[2]-f[0])/i.getWidth(),s=(f[3]-f[1])/i.getHeight();if(l=i,n&&n>r||a&&a>s)break}}let c=t;if(s){const[e,t]=o.getOrigin(),[i,r]=l.getResolution(o);c=[Math.round((s[0]-e)/i),Math.round((s[1]-t)/r),Math.round((s[2]-e)/i),Math.round((s[3]-t)/r)],c=[Math.min(c[0],c[2]),Math.min(c[1],c[3]),Math.max(c[0],c[2]),Math.max(c[1],c[3])]}return l.readRasters({...e,window:c})}}class ja extends Ka{constructor(e,t,i,r,n={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=i,this.firstIFDOffset=r,this.cache=n.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const i=this.bigTiff?4048:1024;return new Ua((await this.source.fetch([{offset:e,length:void 0!==t?t:i}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,i=this.bigTiff?8:2;let r=await this.getSlice(e);const n=this.bigTiff?r.readUint64(e):r.readUint16(e),a=n*t+(this.bigTiff?16:6);r.covers(e,a)||(r=await this.getSlice(e,a));const s={};let o=e+(this.bigTiff?8:2);for(let e=0;e<n;o+=t,++e){const e=r.readUint16(o),t=r.readUint16(o+2),i=this.bigTiff?r.readUint64(o+4):r.readUint32(o+4);let n,a;const l=Ba(t),h=o+(this.bigTiff?12:8);if(l*i<=(this.bigTiff?8:4))n=Fa(r,t,i,h);else{const e=r.readOffset(h),a=Ba(t)*i;if(r.covers(e,a))n=Fa(r,t,i,e);else{n=Fa(await this.getSlice(e,a),t,i,e)}}a=1===i&&-1===oa.indexOf(e)&&t!==ha.RATIONAL&&t!==ha.SRATIONAL?n[0]:n,s[aa[e]]=a}const l=function(e){const t=e.GeoKeyDirectory;if(!t)return null;const i={};for(let r=4;r<=4*t[3];r+=4){const n=va[t[r]],a=t[r+1]?aa[t[r+1]]:null,s=t[r+2],o=t[r+3];let l=null;if(a){if(l=e[a],null==l)throw new Error(`Could not get value of geoKey '${n}'.`);"string"==typeof l?l=l.substring(o,o+s-1):l.subarray&&(l=l.subarray(o,o+s),1===s&&(l=l[0]))}else l=o;i[n]=l}return i}(s),h=r.readOffset(e+i+t*n);return new Va(s,l,h)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(0===e)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(t){if(t instanceof Na)throw new Na(e);throw t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(0===t.nextIFDByteOffset)throw new Na(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new Ia(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,t=!0;for(;t;)try{await this.requestIFD(e),++e}catch(e){if(!(e instanceof Na))throw e;t=!1}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",i=t.length+100;let r=await this.getSlice(e,i);if(t===Fa(r,ha.ASCII,t.length,e)){const t=Fa(r,ha.ASCII,i,e).split("\n")[0],n=Number(t.split("=")[1].split(" ")[0])+t.length;n>i&&(r=await this.getSlice(e,n));const a=Fa(r,ha.ASCII,n,e);this.ghostValues={},a.split("\n").filter((e=>e.length>0)).map((e=>e.split("="))).forEach((([e,t])=>{this.ghostValues[e]=t}))}return this.ghostValues}static async fromSource(e,t,i){const r=(await e.fetch([{offset:0,length:1024}],i))[0],n=new Ea(r),a=n.getUint16(0,0);let s;if(18761===a)s=!0;else{if(19789!==a)throw new TypeError("Invalid byte order value.");s=!1}const o=n.getUint16(2,s);let l;if(42===o)l=!1;else{if(43!==o)throw new TypeError("Invalid magic number.");l=!0;if(8!==n.getUint16(4,s))throw new Error("Unsupported offset byte-size.")}const h=l?n.getUint64(8,s):n.getUint32(4,s);return new ja(e,s,l,h,t)}close(){return"function"==typeof this.source.close&&this.source.close()}}async function Ha(e,t){return ja.fromSource(function(e){return new La(e)}(e),t)}const Za={type:"image",format:"uint8",useHeatMap:!0,useColorsBasedOnValues:!1,useAutoRange:!1,useDataForOpacity:!1,useSingleColor:!1,useColorClasses:!1,blurredTexture:!0,clipLow:null,clipHigh:null,multiplier:1,color:[255,0,255,255],colorScale:u.brewer.YlOrRd,colorScaleValueRange:[0,255],colorsBasedOnValues:null,colorClasses:null,alpha:100,useChannel:null,noDataValue:void 0,numOfChannels:void 0,nullColor:[0,0,0,0],unidentifiedColor:[0,0,0,0],clippedColor:[0,0,0,0],terrainColor:[133,133,133,255],terrainSkirtHeight:100,terrainMinValue:0};class Wa{constructor(){this.scale=(e,t,i,r,n)=>(e-t)*(n-r)/(i-t)+r}setUrl(e){return y(this,void 0,void 0,(function*(){const t=yield fetch(e),i=yield t.arrayBuffer(),r=yield Ha(i),n=yield r.getImage(0);this.data=n}))}getMap(e,t){return y(this,void 0,void 0,(function*(){const i=Object.assign(Object.assign({},Za),t);switch(i.type){case"image":return this.getBitmap(e,i);case"terrain":return this.getHeightmap(e,i);default:return null}}))}getHeightmap(e,t){return y(this,void 0,void 0,(function*(){let i,r,n=[];"string"==typeof e?(yield this.setUrl(e),n=yield this.data.readRasters(),i=this.data.getWidth(),r=this.data.getHeight()):(n=e.rasters,i=e.width,r=e.height);let a=n[0];null!=t.useChannel&&n[t.useChannel]&&(a=n[t.useChannel]);const s=document.createElement("canvas");s.width=i,s.height=r;const o=s.getContext("2d"),l=o.createImageData(i,r),h=a.length/(i*r),f=i*r*4;let c=null===t.useChannel?0:t.useChannel;for(let e=0;e<f;e+=4){const i=t.noDataValue&&a[c]===t.noDataValue?t.terrainMinValue:a[c]*t.multiplier,r=Math.floor((i+1e4)/.1);l.data[e]=Math.floor(r/65536),l.data[e+1]=Math.floor(r/256%256),l.data[e+2]=r%256,l.data[e+3]=255,c+=h}o.putImageData(l,0,0);return s.toDataURL("image/png")}))}getBitmap(e,t){return y(this,void 0,void 0,(function*(){const i=Object.assign({},t);let r,n,a,s=[];"string"==typeof e?(yield this.setUrl(e),s=yield this.data.readRasters(),r=s.length,n=this.data.getWidth(),a=this.data.getHeight()):(s=e.rasters,r=s.length,n=e.width,a=e.height);const o=document.createElement("canvas");o.width=n,o.height=a;const l=o.getContext("2d"),h=l.createImageData(n,a);let f,c,u,d;const g=n*a*4;if(t.noDataValue||console.log("Missing noData value. Raster might be displayed incorrectly."),i.unidentifiedColor=this.getColorFromChromaType(i.unidentifiedColor),i.nullColor=this.getColorFromChromaType(i.nullColor),i.clippedColor=this.getColorFromChromaType(i.clippedColor),i.color=this.getColorFromChromaType(i.color),null==i.useChannel){if(1===r){if(s[0].length/(n*a)==1){const e=s[0];i.useAutoRange&&(i.colorScaleValueRange=this.getMinMax(e,i));this.getColorValue(e,i,g).forEach(((e,t)=>{h.data[t]=e}))}if(s[0].length/(n*a)==3){let e=0;for(let t=0;t<g;t+=4){const r=[s[0][e],s[0][e+1],s[0][e+2]],n=this.hasPixelsNoData(r,i.noDataValue)?i.nullColor:[...r,Math.floor(2.55*i.alpha)];[h.data[t],h.data[t+1],h.data[t+2],h.data[t+3]]=n,e+=3}}s[0].length/(n*a)==4&&s[0].forEach(((e,t)=>{h.data[t]=e}))}if(3===r){let e=0;for(let t=0;t<g;t+=4)f=s[0][e],c=s[1][e],u=s[2][e],d=Math.floor(2.55*i.alpha),h.data[t]=f,h.data[t+1]=c,h.data[t+2]=u,h.data[t+3]=d,e+=1}if(4===r){let e=0;for(let t=0;t<g;t+=4)f=s[0][e],c=s[1][e],u=s[2][e],d=Math.floor(2.55*i.alpha),h.data[t]=f,h.data[t+1]=c,h.data[t+2]=u,h.data[t+3]=d,e+=1}}else if(i.useChannel<=i.numOfChannels){let e=s[0];s[i.useChannel]&&(e=s[i.useChannel]),i.useAutoRange&&(i.colorScaleValueRange=this.getMinMax(e,i));const t=e.length/(n*a);this.getColorValue(e,i,g,t).forEach(((e,t)=>{h.data[t]=e}))}else{console.log("Defined channel does not exist, displaying only grey values");this.getDefaultColor(g,i.nullColor).forEach(((e,t)=>{h.data[t]=e}))}l.putImageData(h,0,0);return o.toDataURL("image/png")}))}getMinMax(e,t){let i=t.maxValue?t.maxValue:Number.MIN_VALUE,r=t.minValue?t.minValue:Number.MAX_VALUE;for(let n=0;n<e.length;n+=1)void 0!==t.noDataValue&&e[n]===t.noDataValue||(e[n]>i&&(i=e[n]),e[n]<r&&(r=e[n]));return[r,i]}getColorValue(e,t,i,r=1){const n=u.scale(t.colorScale).domain(t.colorScaleValueRange);let a=null===t.useChannel?0:t.useChannel;const s=new Array(i),o=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([e])=>e)):void 0,l=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([,e])=>[...u(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,h=t.useColorClasses?t.colorClasses.map((([e])=>[...u(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,f=t.useColorClasses?t.colorClasses.map((([,e])=>e)):void 0,c=t.useColorClasses?t.colorClasses.map((([,,e],i)=>void 0!==e?e:i===t.colorClasses.length-1?[!0,!0]:[!0,!1])):void 0;for(let u=0;u<i;u+=4){let i=t.nullColor;if(void 0===t.noDataValue||e[a]!==t.noDataValue)if(null!=t.clipLow&&e[a]<=t.clipLow||null!=t.clipHigh&&e[a]>=t.clipHigh)i=t.clippedColor;else{if(t.useHeatMap&&(i=[...n(e[a]).rgb(),Math.floor(2.55*t.alpha)]),t.useColorsBasedOnValues){const r=o.indexOf(e[a]);i=r>-1?l[r]:t.unidentifiedColor}if(t.useColorClasses){const r=this.findClassIndex(e[a],f,c);i=r>-1?h[r]:t.unidentifiedColor}t.useSingleColor&&(i=t.color),t.useDataForOpacity&&(i[3]=this.scale(e[a],t.colorScaleValueRange[0],t.colorScaleValueRange.slice(-1)[0],0,255))}else Number.isNaN(e[a])&&(i=[0,0,0,0]);[s[u],s[u+1],s[u+2],s[u+3]]=i,a+=r}return s}findClassIndex(e,t,i){for(let r=0;r<t.length;r+=1){const[n,a]=t[r],[s,o]=i[r];if((s?e>=n:e>n)&&(o?e<=a:e<a))return r}return-1}getDefaultColor(e,t){const i=new Array(e);for(let r=0;r<e;r+=4)[i[r],i[r+1],i[r+2],i[r+3]]=t;return i}getColorFromChromaType(e){return Array.isArray(e)&&4===e.length?e:[...u(e).rgb(),255]}hasPixelsNoData(e,t){return void 0!==t&&e.every((e=>e===t))}}const Ya=40075e3,$a=20037500;class Xa{constructor(e){this.zoomRange=[0,0],this.lowestOriginTileOffset=[0,0],this.lowestOriginTileSize=0,this.loaded=!1,this.geo=new Wa,this.lzw=new Br,this.options=e}initializeCog(e){return y(this,void 0,void 0,(function*(){ge.fetch=(e,t)=>y(this,void 0,void 0,(function*(){return yield fetch(e,t)}));const t=new ge(e);return this.cog=yield he.create(t),this.cog.images.forEach((e=>{e.loadGeoTiffTags()})),this.tileSize=this.getTileSize(this.cog),this.lowestOriginTileOffset=this.getImageTileIndex(this.cog.images[this.cog.images.length-1]),this.zoomRange=this.getZoomRange(this.cog),this.cog}))}getTileSize(e){return e.images[e.images.length-1].tileSize.width}getZoomRange(e){const t=e.images[e.images.length-1],i=this.getZoomLevelFromResolution(e.images[e.images.length-1].tileSize.width,t.resolution[0]);return[i,i+(e.images.length-1)]}getBoundsAsLatLon(e){const{bbox:t}=e.images[e.images.length-1],i=Math.min(t[0],t[2]),r=Math.max(t[0],t[2]),n=Math.min(t[1],t[3]),a=Math.max(t[1],t[3]),s=this.getLatLon([i,n]),o=this.getLatLon([r,a]);return[s[0],s[1],o[0],o[1]]}getOriginAsLatLon(e){const{origin:t}=e.images[e.images.length-1];return this.getLatLon(t)}getImageTileIndex(e){const t=$a+e.origin[0],i=-($a+(e.origin[1]-Ya)),r=e.tileSize.width*this.getResolutionFromZoomLevel(e.tileSize.width,this.getZoomLevelFromResolution(e.tileSize.width,e.resolution[0]));return[Math.round(t/r),Math.round(i/r),this.getZoomLevelFromResolution(e.tileSize.width,e.resolution[0])]}getResolutionFromZoomLevel(e,t){return Ya/e/Math.pow(2,t)}getZoomLevelFromResolution(e,t){return Math.round(Math.log2(Ya/(t*e)))}getLatLon(e){const t=function(e){const[t,i]=e,r=t/512*(2*Ir)-Ir,n=2*(Math.atan(Math.exp(i/512*(2*Ir)-Ir))-Er);return[r*Ur,n*Ur]}([12776044915782906e-21*($a+e[0]),12776044915782906e-21*-($a+(e[1]-Ya))]);return[t[0],-t[1]]}getTile(e,t,i){return y(this,void 0,void 0,(function*(){const r=this.getResolutionFromZoomLevel(this.tileSize,i),n=this.cog.getImageByResolution(r);let a=[0,0];if(i===this.zoomRange[0])a=this.lowestOriginTileOffset;else{const e=Math.pow(2,i-this.zoomRange[0]);a[0]=Math.floor(this.lowestOriginTileOffset[0]*e),a[1]=Math.floor(this.lowestOriginTileOffset[1]*e)}const s=n.tileCount.x,o=n.tileCount.y,l=a[0],h=a[1];let f,c;this.options.numOfChannels=Number(n.tags.get(277).value),this.options.noDataValue=this.getNoDataValue(n.tags),this.options.format||(this.options.format=this.getFormat(n.tags.get(339).value,n.tags.get(258).value));let u=n.tags.get(258).value;if(Array.isArray(u))if("terrain"===this.options.type){let e=0;u.forEach((t=>{e+=t})),u=e}else[u]=u;if(e-l>=0&&t-h>=0&&e-l<s&&t-h<o){const i=yield n.getTile(e-l,t-h);switch(n.compression){case"image/jpeg":c=Mr.decode(i.bytes,{useTArray:!0});break;case"application/deflate":c=yield xr(i.bytes);break;case"application/lzw":c=this.lzw.decodeBlock(i.bytes.buffer);break;default:console.warn(`Unexpected compression method: ${n.compression}`)}let r;switch(this.options.format){case"uint8":r=new Uint8Array(c.buffer);break;case"uint16":r=new Uint16Array(c.buffer);break;case"uint32":r=new Uint32Array(c.buffer);break;case"int8":r=new Int8Array(c.buffer);break;case"int16":r=new Int16Array(c.buffer);break;case"int32":r=new Int32Array(c.buffer);break;case"float32":r=new Float32Array(c.buffer);break;case"float64":r=new Float64Array(c.buffer);break;default:r=null}return f=yield this.geo.getMap({rasters:[r],width:this.tileSize,height:this.tileSize},this.options),f}return null}))}getFormat(e,t){let i,r=e,n=t;switch(Array.isArray(e)&&([r]=e),Array.isArray(t)&&([n]=t),r){case 1:switch(n){case 8:i="uint8";break;case 16:i="uint16";break;case 32:i="uint32";break;default:i=null}break;case 2:switch(n){case 8:i="int8";break;case 16:i="int16";break;case 32:i="int32";break;default:i=null}break;case 3:switch(n){case 32:i="float32";break;case 64:i="float64";break;default:i=null}break;default:throw new Error("Unknown data format.")}return i}getNoDataValue(e){if(e.has(42113)){const t=e.get(42113).value;if("string"==typeof t||t instanceof String){const e=t.replace(/[\0\s]/g,"");return Number(e)}return Number.isNaN(Number(t))?void 0:Number(t)}}testCog(){return y(this,void 0,void 0,(function*(){this.options={type:"image",multiplier:1,useChannel:1,alpha:180,clipLow:1,clipHigh:Number.MAX_VALUE};const e=yield this.initializeCog("https://gisat-gis.eu-central-1.linodeobjects.com/eman/versions/v2/Quadrants/Q3_Bolivia_ASTER_2002_RGB_COG_LZW.tif"),t=e.images[Math.floor(e.images.length/2)];console.log(t);const i=this.getImageTileIndex(t);console.log(i);const r=Math.floor(t.tileCount.x/2),n=Math.floor(t.tileCount.y/2);console.log(e.getTile(r,n,Math.floor(e.images.length/2)));const a=r+i[0],s=n+i[1],o=i[2],l=yield this.getTile(a,s,o);!1===l?console.log("couldn't retrieve tile"):console.log(l)}))}}class qa extends o{constructor(e,t,i){super({}),this.id="",this.id=e,this.cogTiles=new Xa(i),this.blurredTexture=i.blurredTexture,this.url=t}initializeState(){this.state={initialized:!1},this.init(this.url)}init(e){return y(this,void 0,void 0,(function*(){const t=yield this.cogTiles.initializeCog(e);this.setState({initialized:!0}),this.tileSize=this.cogTiles.getTileSize(t);const i=this.cogTiles.getZoomRange(t);[this.minZoom,this.maxZoom]=i}))}renderLayers(){if(this.cogTiles.cog){return new l({id:`${this.id}-${String(performance.now())}`,getTileData:e=>this.cogTiles.getTile(e.index.x,e.index.y,e.index.z),minZoom:this.minZoom,maxZoom:this.maxZoom,tileSize:this.tileSize,maxRequests:6,extent:this.cogTiles.cog?this.cogTiles.getBoundsAsLatLon(this.cogTiles.cog):null,renderSubLayers:e=>{var t,i,r,n,a,s,o;const{bbox:{west:l,south:h,east:u,north:d}}=e.tile;return new f(e,Object.assign({data:null,image:e.data,bounds:[l,h,u,d],opacity:1,textureParameters:{[c.TEXTURE_MAG_FILTER]:this.blurredTexture?c.LINEAR:c.NEAREST},extensions:(null===(i=null===(t=this.cogTiles)||void 0===t?void 0:t.options)||void 0===i?void 0:i.clampToTerrain)?[new R]:[]},(null===(a=null===(n=null===(r=this.cogTiles)||void 0===r?void 0:r.options)||void 0===n?void 0:n.clampToTerrain)||void 0===a?void 0:a.terrainDrawMode)?{terrainDrawMode:null===(o=null===(s=this.cogTiles)||void 0===s?void 0:s.options)||void 0===o?void 0:o.clampToTerrain.terrainDrawMode}:{}))}})}return null}}qa.layerName="CogBitmapLayer",qa.displayName="CogBitmapLayer";class Ja extends o{constructor(e,t,i,r,n){super({}),this.urlType="none",this.id="",this.id=e;const a=Object.assign(Object.assign({},Za),i);var s;this.terrainOpacity=a.alpha/100,this.terrainColor=u(a.terrainColor.slice(0,3)).rgb(),this.terrainSkirtHeight=a.terrainSkirtHeight,r&&((s=r)&&s.includes("{x}")&&s.includes("{y}")&&s.includes("{z}")?(this.bitmapUrl=r,this.urlType="tile",this.terrainColor=[0,0,0,0]):!function(e){return!!(e.includes(".tif")||e.includes(".tiff")||e.includes(".TIF")||e.includes(".TIFF"))}(r)?console.warn("URL needs to point to a valid cog file, or needs to be in the {x}{y}{z} format."):(this.bitmapCogTiles=new Xa(n),this.bitmapCogTiles.initializeCog(r),this.urlType="cog",this.terrainColor=[0,0,0,0])),this.terrainCogTiles=new Xa(i),this.terrainUrl=t}initializeState(){const e=Object.create(null,{initializeState:{get:()=>super.initializeState}});return y(this,void 0,void 0,(function*(){e.initializeState.call(this),this.setState({initialized:!1}),yield this.init(this.terrainUrl)}))}shouldUpdateState(){var e;return 0===(null===(e=this.internalState)||void 0===e?void 0:e.subLayers.length)}init(e){return y(this,void 0,void 0,(function*(){const t=yield this.terrainCogTiles.initializeCog(e);this.tileSize=this.terrainCogTiles.getTileSize(t);const i=this.terrainCogTiles.getZoomRange(t);[this.minZoom,this.maxZoom]=i,this.setState({initialized:!0})}))}renderLayers(){if(this.terrainCogTiles.cog){let e;this.urlType;return[new l({id:`${this.id}-${String(performance.now())}`,zoomOffset:-1,getTileData:e=>this.terrainCogTiles.getTile(e.index.x,e.index.y,e.index.z),minZoom:this.minZoom,maxZoom:this.maxZoom,tileSize:this.tileSize,maxRequests:6,refinementStrategy:"best-available",extent:this.terrainCogTiles.getBoundsAsLatLon(this.terrainCogTiles.cog),renderSubLayers:t=>{if(t.data&&void 0!==t.tile.index.x){switch(this.urlType){case"tile":i=this.bitmapUrl,r=t.tile.index.x,n=t.tile.index.y,a=t.tile.index.z,e=i.replace("{x}",String(r)).replace("{y}",String(n)).replace("{z}",String(a));break;case"cog":e=this.bitmapCogTiles.getTile(t.tile.index.x,t.tile.index.y,t.tile.index.z);break;default:e=null}return new h({id:`terrain-${t.tile.index.x}-${t.tile.index.y}-${t.tile.index.z}`,pickable:!0,elevationDecoder:{rScaler:6553.6,gScaler:25.6,bScaler:.1,offset:-1e4},elevationData:t.data,texture:e,opacity:this.terrainOpacity,bounds:[t.tile.bbox.west,t.tile.bbox.south,t.tile.bbox.east,t.tile.bbox.north],color:this.terrainColor,operation:"terrain+draw",minZoom:this.minZoom,maxZoom:this.maxZoom,loadOptions:{terrain:{skirtHeight:this.terrainSkirtHeight,tesselator:"martini"}},meshMaxError:12})}var i,r,n,a;return null}})]}return[]}}Ja.layerName="CogTerrainLayer",Ja.displayName="CogTerrainLayer";var Qa={CogBitmapLayer:qa,CogTerrainLayer:Ja,cogtiles:Xa,GeoImage:Wa};var es=Object.freeze({__proto__:null,default:class extends Ra{decodeBlock(e){return e}}});const ts=257;function is(e,t){for(let i=t.length-1;i>=0;i--)e.push(t[i]);return e}function rs(e){const t=new Uint16Array(4093),i=new Uint8Array(4093);for(let e=0;e<=257;e++)t[e]=4096,i[e]=e;let r=258,n=9,a=0;function s(){r=258,n=9}function o(e){const t=function(e,t,i){const r=t%8,n=Math.floor(t/8),a=8-r,s=t+i-8*(n+1);let o=8*(n+2)-(t+i);const l=8*(n+2)-t;if(o=Math.max(0,o),n>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),ts;let h=e[n]&2**(8-r)-1;h<<=i-a;let f=h;if(n+1<e.length){let t=e[n+1]>>>o;t<<=Math.max(0,i-l),f+=t}if(s>8&&n+2<e.length){const r=8*(n+3)-(t+i);f+=e[n+2]>>>r}return f}(e,a,n);return a+=n,t}function l(e,n){return i[r]=n,t[r]=e,r++,r-1}function h(e){const r=[];for(let n=e;4096!==n;n=t[n])r.push(i[n]);return r}const f=[];s();const c=new Uint8Array(e);let u,d=o(c);for(;d!==ts;){if(256===d){for(s(),d=o(c);256===d;)d=o(c);if(d===ts)break;if(d>256)throw new Error(`corrupted code at scanline ${d}`);is(f,h(d)),u=d}else if(d<r){const e=h(d);is(f,e),l(u,e[e.length-1]),u=d}else{const e=h(u);if(!e)throw new Error(`Bogus entry. Not in dictionary, ${u} / ${r}, position: ${a}`);is(f,e),f.push(e[e.length-1]),l(u,e[e.length-1]),u=d}r+1>=2**n&&(12===n?u=void 0:n++),d=o(c)}return new Uint8Array(f)}var ns=Object.freeze({__proto__:null,default:class extends Ra{decodeBlock(e){return rs(e).buffer}}});const as=new Int32Array([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]),ss=4017,os=799,ls=3406,hs=2276,fs=1567,cs=3784,us=5793,ds=2896;function gs(e,t){let i=0;const r=[];let n=16;for(;n>0&&!e[n-1];)--n;r.push({children:[],index:0});let a,s=r[0];for(let o=0;o<n;o++){for(let n=0;n<e[o];n++){for(s=r.pop(),s.children[s.index]=t[i];s.index>0;)s=r.pop();for(s.index++,r.push(s);r.length<=o;)r.push(a={children:[],index:0}),s.children[s.index]=a.children,s=a;i++}o+1<n&&(r.push(a={children:[],index:0}),s.children[s.index]=a.children,s=a)}return r[0].children}function ps(e,t,i,r,n,a,s,o,l){const{mcusPerLine:h,progressive:f}=i,c=t;let u=t,d=0,g=0;function p(){if(g>0)return g--,d>>g&1;if(d=e[u++],255===d){const t=e[u++];if(t)throw new Error(`unexpected marker: ${(d<<8|t).toString(16)}`)}return g=7,d>>>7}function m(e){let t,i=e;for(;null!==(t=p());){if(i=i[t],"number"==typeof i)return i;if("object"!=typeof i)throw new Error("invalid huffman sequence")}return null}function w(e){let t=e,i=0;for(;t>0;){const e=p();if(null===e)return;i=i<<1|e,--t}return i}function y(e){const t=w(e);return t>=1<<e-1?t:t+(-1<<e)+1}let b=0;let _,v=0;function x(e,t,i,r,n){const a=i%h,s=(i/h|0)*e.v+r,o=a*e.h+n;t(e,e.blocks[s][o])}function k(e,t,i){const r=i/e.blocksPerLine|0,n=i%e.blocksPerLine;t(e,e.blocks[r][n])}const T=r.length;let S,A,C,P,M,I;I=f?0===a?0===o?function(e,t){const i=m(e.huffmanTableDC),r=0===i?0:y(i)<<l;e.pred+=r,t[0]=e.pred}:function(e,t){t[0]|=p()<<l}:0===o?function(e,t){if(b>0)return void b--;let i=a;const r=s;for(;i<=r;){const r=m(e.huffmanTableAC),n=15&r,a=r>>4;if(0===n){if(a<15){b=w(a)+(1<<a)-1;break}i+=16}else i+=a,t[as[i]]=y(n)*(1<<l),i++}}:function(e,t){let i=a;const r=s;let n=0;for(;i<=r;){const r=as[i],a=t[r]<0?-1:1;switch(v){case 0:{const t=m(e.huffmanTableAC),i=15&t;if(n=t>>4,0===i)n<15?(b=w(n)+(1<<n),v=4):(n=16,v=1);else{if(1!==i)throw new Error("invalid ACn encoding");_=y(i),v=n?2:3}continue}case 1:case 2:t[r]?t[r]+=(p()<<l)*a:(n--,0===n&&(v=2===v?3:0));break;case 3:t[r]?t[r]+=(p()<<l)*a:(t[r]=_<<l,v=0);break;case 4:t[r]&&(t[r]+=(p()<<l)*a)}i++}4===v&&(b--,0===b&&(v=0))}:function(e,t){const i=m(e.huffmanTableDC),r=0===i?0:y(i);e.pred+=r,t[0]=e.pred;let n=1;for(;n<64;){const i=m(e.huffmanTableAC),r=15&i,a=i>>4;if(0===r){if(a<15)break;n+=16}else n+=a,t[as[n]]=y(r),n++}};let E,U,D=0;U=1===T?r[0].blocksPerLine*r[0].blocksPerColumn:h*i.mcusPerColumn;const O=n||U;for(;D<U;){for(A=0;A<T;A++)r[A].pred=0;if(b=0,1===T)for(S=r[0],M=0;M<O;M++)k(S,I,D),D++;else for(M=0;M<O;M++){for(A=0;A<T;A++){S=r[A];const{h:e,v:t}=S;for(C=0;C<t;C++)for(P=0;P<e;P++)x(S,I,D,C,P)}if(D++,D===U)break}if(g=0,E=e[u]<<8|e[u+1],E<65280)throw new Error("marker was not found");if(!(E>=65488&&E<=65495))break;u+=2}return u-c}function ms(e,t){const i=[],{blocksPerLine:r,blocksPerColumn:n}=t,a=r<<3,s=new Int32Array(64),o=new Uint8Array(64);function l(e,i,r){const n=t.quantizationTable;let a,s,o,l,h,f,c,u,d;const g=r;let p;for(p=0;p<64;p++)g[p]=e[p]*n[p];for(p=0;p<8;++p){const e=8*p;0!==g[1+e]||0!==g[2+e]||0!==g[3+e]||0!==g[4+e]||0!==g[5+e]||0!==g[6+e]||0!==g[7+e]?(a=us*g[0+e]+128>>8,s=us*g[4+e]+128>>8,o=g[2+e],l=g[6+e],h=ds*(g[1+e]-g[7+e])+128>>8,u=ds*(g[1+e]+g[7+e])+128>>8,f=g[3+e]<<4,c=g[5+e]<<4,d=a-s+1>>1,a=a+s+1>>1,s=d,d=o*cs+l*fs+128>>8,o=o*fs-l*cs+128>>8,l=d,d=h-c+1>>1,h=h+c+1>>1,c=d,d=u+f+1>>1,f=u-f+1>>1,u=d,d=a-l+1>>1,a=a+l+1>>1,l=d,d=s-o+1>>1,s=s+o+1>>1,o=d,d=h*hs+u*ls+2048>>12,h=h*ls-u*hs+2048>>12,u=d,d=f*os+c*ss+2048>>12,f=f*ss-c*os+2048>>12,c=d,g[0+e]=a+u,g[7+e]=a-u,g[1+e]=s+c,g[6+e]=s-c,g[2+e]=o+f,g[5+e]=o-f,g[3+e]=l+h,g[4+e]=l-h):(d=us*g[0+e]+512>>10,g[0+e]=d,g[1+e]=d,g[2+e]=d,g[3+e]=d,g[4+e]=d,g[5+e]=d,g[6+e]=d,g[7+e]=d)}for(p=0;p<8;++p){const e=p;0!==g[8+e]||0!==g[16+e]||0!==g[24+e]||0!==g[32+e]||0!==g[40+e]||0!==g[48+e]||0!==g[56+e]?(a=us*g[0+e]+2048>>12,s=us*g[32+e]+2048>>12,o=g[16+e],l=g[48+e],h=ds*(g[8+e]-g[56+e])+2048>>12,u=ds*(g[8+e]+g[56+e])+2048>>12,f=g[24+e],c=g[40+e],d=a-s+1>>1,a=a+s+1>>1,s=d,d=o*cs+l*fs+2048>>12,o=o*fs-l*cs+2048>>12,l=d,d=h-c+1>>1,h=h+c+1>>1,c=d,d=u+f+1>>1,f=u-f+1>>1,u=d,d=a-l+1>>1,a=a+l+1>>1,l=d,d=s-o+1>>1,s=s+o+1>>1,o=d,d=h*hs+u*ls+2048>>12,h=h*ls-u*hs+2048>>12,u=d,d=f*os+c*ss+2048>>12,f=f*ss-c*os+2048>>12,c=d,g[0+e]=a+u,g[56+e]=a-u,g[8+e]=s+c,g[48+e]=s-c,g[16+e]=o+f,g[40+e]=o-f,g[24+e]=l+h,g[32+e]=l-h):(d=us*r[p+0]+8192>>14,g[0+e]=d,g[8+e]=d,g[16+e]=d,g[24+e]=d,g[32+e]=d,g[40+e]=d,g[48+e]=d,g[56+e]=d)}for(p=0;p<64;++p){const e=128+(g[p]+8>>4);i[p]=e<0?0:e>255?255:e}}for(let e=0;e<n;e++){const n=e<<3;for(let e=0;e<8;e++)i.push(new Uint8Array(a));for(let a=0;a<r;a++){l(t.blocks[e][a],o,s);let r=0;const h=a<<3;for(let e=0;e<8;e++){const t=i[n+e];for(let e=0;e<8;e++)t[h+e]=o[r++]}}}return i}class ws{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(e){let t=0;function i(){const i=e[t]<<8|e[t+1];return t+=2,i}function r(){const r=i(),n=e.subarray(t,t+r-2);return t+=n.length,n}function n(e){let t,i,r=0,n=0;for(i in e.components)e.components.hasOwnProperty(i)&&(t=e.components[i],r<t.h&&(r=t.h),n<t.v&&(n=t.v));const a=Math.ceil(e.samplesPerLine/8/r),s=Math.ceil(e.scanLines/8/n);for(i in e.components)if(e.components.hasOwnProperty(i)){t=e.components[i];const o=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/r),l=Math.ceil(Math.ceil(e.scanLines/8)*t.v/n),h=a*t.h,f=s*t.v,c=[];for(let e=0;e<f;e++){const e=[];for(let t=0;t<h;t++)e.push(new Int32Array(64));c.push(e)}t.blocksPerLine=o,t.blocksPerColumn=l,t.blocks=c}e.maxH=r,e.maxV=n,e.mcusPerLine=a,e.mcusPerColumn=s}let a=i();if(65496!==a)throw new Error("SOI not found");for(a=i();65497!==a;){switch(a){case 65280:break;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:{const e=r();65504===a&&74===e[0]&&70===e[1]&&73===e[2]&&70===e[3]&&0===e[4]&&(this.jfif={version:{major:e[5],minor:e[6]},densityUnits:e[7],xDensity:e[8]<<8|e[9],yDensity:e[10]<<8|e[11],thumbWidth:e[12],thumbHeight:e[13],thumbData:e.subarray(14,14+3*e[12]*e[13])}),65518===a&&65===e[0]&&100===e[1]&&111===e[2]&&98===e[3]&&101===e[4]&&0===e[5]&&(this.adobe={version:e[6],flags0:e[7]<<8|e[8],flags1:e[9]<<8|e[10],transformCode:e[11]});break}case 65499:{const r=i()+t-2;for(;t<r;){const r=e[t++],n=new Int32Array(64);if(r>>4==0)for(let i=0;i<64;i++){n[as[i]]=e[t++]}else{if(r>>4!=1)throw new Error("DQT: invalid table spec");for(let e=0;e<64;e++){n[as[e]]=i()}}this.quantizationTables[15&r]=n}break}case 65472:case 65473:case 65474:{i();const r={extended:65473===a,progressive:65474===a,precision:e[t++],scanLines:i(),samplesPerLine:i(),components:{},componentsOrder:[]},s=e[t++];let o;for(let i=0;i<s;i++){o=e[t];const i=e[t+1]>>4,n=15&e[t+1],a=e[t+2];r.componentsOrder.push(o),r.components[o]={h:i,v:n,quantizationIdx:a},t+=3}n(r),this.frames.push(r);break}case 65476:{const r=i();for(let i=2;i<r;){const r=e[t++],n=new Uint8Array(16);let a=0;for(let i=0;i<16;i++,t++)n[i]=e[t],a+=n[i];const s=new Uint8Array(a);for(let i=0;i<a;i++,t++)s[i]=e[t];i+=17+a,r>>4==0?this.huffmanTablesDC[15&r]=gs(n,s):this.huffmanTablesAC[15&r]=gs(n,s)}break}case 65501:i(),this.resetInterval=i();break;case 65498:{i();const r=e[t++],n=[],a=this.frames[0];for(let i=0;i<r;i++){const i=a.components[e[t++]],r=e[t++];i.huffmanTableDC=this.huffmanTablesDC[r>>4],i.huffmanTableAC=this.huffmanTablesAC[15&r],n.push(i)}const s=e[t++],o=e[t++],l=e[t++],h=ps(e,t,a,n,this.resetInterval,s,o,l>>4,15&l);t+=h;break}case 65535:255!==e[t]&&t--;break;default:if(255===e[t-3]&&e[t-2]>=192&&e[t-2]<=254){t-=3;break}throw new Error(`unknown JPEG marker ${a.toString(16)}`)}a=i()}}getResult(){const{frames:e}=this;if(0===this.frames.length)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(let e=0;e<this.frames.length;e++){const t=this.frames[e].components;for(const e of Object.keys(t))t[e].quantizationTable=this.quantizationTables[t[e].quantizationIdx],delete t[e].quantizationIdx}const t=e[0],{components:i,componentsOrder:r}=t,n=[],a=t.samplesPerLine,s=t.scanLines;for(let e=0;e<r.length;e++){const a=i[r[e]];n.push({lines:ms(0,a),scaleX:a.h/t.maxH,scaleY:a.v/t.maxV})}const o=new Uint8Array(a*s*n.length);let l=0;for(let e=0;e<s;++e)for(let t=0;t<a;++t)for(let i=0;i<n.length;++i){const r=n[i];o[l]=r.lines[0|e*r.scaleY][0|t*r.scaleX],++l}return o}}var ys=Object.freeze({__proto__:null,default:class extends Ra{constructor(e){super(),this.reader=new ws,e.JPEGTables&&this.reader.parse(e.JPEGTables)}decodeBlock(e){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(e)),this.reader.getResult().buffer}}});var bs=Object.freeze({__proto__:null,default:class extends Ra{decodeBlock(e){return xr(new Uint8Array(e)).buffer}}});var _s=Object.freeze({__proto__:null,default:class extends Ra{decodeBlock(e){const t=new DataView(e),i=[];for(let r=0;r<e.byteLength;++r){let e=t.getInt8(r);if(e<0){const n=t.getUint8(r+1);e=-e;for(let t=0;t<=e;++t)i.push(n);r+=1}else{for(let n=0;n<=e;++n)i.push(t.getUint8(r+n+1));r+=e+1}}return new Uint8Array(i).buffer}}}),vs={exports:{}};!function(e){
1
+ import{WebMercatorViewport as e,OrthographicViewport as t,project as A,_LayersPass as i,_PickLayersPass as r,log as a,LayerExtension as n,CompositeLayer as s}from"@deck.gl/core";import{TileLayer as o,TerrainLayer as l}from"@deck.gl/geo-layers";import{BitmapLayer as g}from"@deck.gl/layers";import{GL as h}from"@luma.gl/constants";import c from"chroma-js";function f(e,t,A,i){return new(A||(A=Promise))((function(r,a){function n(e){try{o(i.next(e))}catch(e){a(e)}}function s(e){try{o(i.throw(e))}catch(e){a(e)}}function o(e){var t;e.done?r(e.value):(t=e.value,t instanceof A?t:new A((function(e){e(t)}))).then(n,s)}o((i=i.apply(e,t||[])).next())}))}function d(e,t){const A=[1/0,1/0,-1/0,-1/0];for(const i of e){const e=i.getBounds();if(e){const r=i.projectPosition(e[0],{viewport:t,autoOffset:!1}),a=i.projectPosition(e[1],{viewport:t,autoOffset:!1});A[0]=Math.min(A[0],r[0]),A[1]=Math.min(A[1],r[1]),A[2]=Math.max(A[2],a[0]),A[3]=Math.max(A[3],a[1])}}return Number.isFinite(A[0])?A:null}function u(A){const{bounds:i,viewport:r,border:a=0}=A,{isGeospatial:n}=r;if(i[2]<=i[0]||i[3]<=i[1])return null;const s=r.unprojectPosition([(i[0]+i[2])/2,(i[1]+i[3])/2,0]);let{width:o,height:l,zoom:g}=A;if(void 0===g){o-=2*a,l-=2*a;const e=Math.min(o/(i[2]-i[0]),l/(i[3]-i[1]));g=Math.min(Math.log2(e),20)}else if(!o||!l){const e=2**g;o=Math.round(Math.abs(i[2]-i[0])*e),l=Math.round(Math.abs(i[3]-i[1])*e);const t=2048-2*a;if(o>t||l>t){const e=t/Math.max(o,l);o=Math.round(o*e),l=Math.round(l*e),g+=Math.log2(e)}}return n?new e({id:r.id,x:a,y:a,width:o,height:l,longitude:s[0],latitude:s[1],zoom:g,orthographic:!0}):new t({id:r.id,x:a,y:a,width:o,height:l,target:s,zoom:g,flipY:!1})}function I(e,t,A){if(!e)return[0,0,1,1];const i=function(e,t){let A;if(t&&2===t.length){const[i,r]=t,a=e.getBounds({z:i}),n=e.getBounds({z:r});A=[Math.min(a[0],n[0]),Math.min(a[1],n[1]),Math.max(a[2],n[2]),Math.max(a[3],n[3])]}else A=e.getBounds();const i=e.projectPosition(A.slice(0,2)),r=e.projectPosition(A.slice(2,4));return[i[0],i[1],r[0],r[1]]}(t,A),r=function(e){const t=e[2]-e[0],A=e[3]-e[1],i=(e[0]+e[2])/2,r=(e[1]+e[3])/2;return[i-t,r-A,i+t,r+A]}(i);return e[2]-e[0]<=r[2]-r[0]&&e[3]-e[1]<=r[3]-r[1]?e:[Math.max(e[0],r[0]),Math.max(e[1],r[1]),Math.min(e[2],r[2]),Math.min(e[3],r[3])]}const B={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},C=Object.keys(B).map((e=>`const float TERRAIN_MODE_${e} = ${B[e]}.0;`)).join("\n"),E={name:"terrain",dependencies:[A],inject:{"vs:#decl":"\nuniform float terrain_mode;\nuniform sampler2D terrain_map;\nuniform vec4 terrain_bounds;\nout vec3 commonPos;\n"+C,"vs:#main-start":"\nif (terrain_mode == TERRAIN_MODE_SKIP) {\ngl_Position = vec4(0.0);\nreturn;\n}\n","vs:DECKGL_FILTER_GL_POSITION":"\ncommonPos = geometry.position.xyz;\nif (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {\nvec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;\nposition = vec4(texCoords * 2.0 - 1.0, 0.0, 1.0);\ncommonPos.z += project_uCommonOrigin.z;\n}\nif (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {\nvec3 anchor = geometry.worldPosition;\nanchor.z = 0.0;\nvec3 anchorCommon = project_position(anchor);\nvec2 texCoords = (anchorCommon.xy - terrain_bounds.xy) / terrain_bounds.zw;\nif (texCoords.x >= 0.0 && texCoords.y >= 0.0 && texCoords.x <= 1.0 && texCoords.y <= 1.0) {\nfloat terrainZ = texture(terrain_map, texCoords).r;\ngeometry.position.z += terrainZ;\nposition = project_common_position_to_clipspace(geometry.position);\n}\n}\n","fs:#decl":"\nuniform float terrain_mode;\nuniform sampler2D terrain_map;\nuniform vec4 terrain_bounds;\nin vec3 commonPos;\n"+C,"fs:#main-start":"\nif (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {\nfragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);\nreturn;\n}\n","fs:DECKGL_FILTER_COLOR":"\nif ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY)) {\nvec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;\nvec4 pixel = texture(terrain_map, texCoords);\nif (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY) {\ncolor = pixel;\n} else {\ncolor = pixel + color * (1.0 - pixel.a);\n}\nreturn;\n}\n"},getUniforms:(e={},t)=>{if("dummyHeightMap"in e){const{drawToTerrainHeightMap:A,heightMap:i,heightMapBounds:r,dummyHeightMap:a,terrainCover:n,useTerrainHeightMap:s,terrainSkipRender:o}=e,{project_uCommonOrigin:l}=t;let g=o?B.SKIP:B.NONE,h=a,c=null;if(A)g=B.WRITE_HEIGHT_MAP,c=r;else if(s&&i)g=B.USE_HEIGHT_MAP,h=i,c=r;else if(n){const t=e.picking?.isActive,A=t?n.getPickingFramebuffer():n.getRenderFramebuffer();h=A?.colorAttachments[0].texture,t&&(g=B.SKIP),h?(g=g===B.SKIP?B.USE_COVER_ONLY:B.USE_COVER,c=n.bounds):h=a}return{terrain_mode:g,terrain_map:h,terrain_bounds:c?[c[0]-l[0],c[1]-l[1],c[2]-c[0],c[3]-c[1]]:[0,0,0,0]}}return null}};function w(e,t){return e.createFramebuffer({id:t.id,colorAttachments:[e.createTexture({id:t.id,...t.float&&{format:"rgba32float",type:5126},mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}})]})}class Q{constructor(e){this.isDirty=!0,this.renderViewport=null,this.bounds=null,this.layers=[],this.targetBounds=null,this.targetBoundsCommon=null,this.targetLayer=e,this.tile=m(e)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:e,viewport:t,layers:A,layerNeedsRedraw:i}){e&&(this.targetLayer=e);const r=!!t&&this._updateViewport(t);let a=!!A&&this._updateLayers(A);if(i)for(const e of this.layers)if(i[e]){a=!0;break}return a||r}_updateLayers(e){let t=!1;if((e=this.tile?function(e,t){return t.filter((t=>{const A=m(t);return!A||function(e,t){if(e&&t)return e[0][0]<t[1][0]&&t[0][0]<e[1][0]&&e[0][1]<t[1][1]&&t[0][1]<e[1][1];return!1}(e.boundingBox,A.boundingBox)}))}(this.tile,e):e).length!==this.layers.length)t=!0;else for(let A=0;A<e.length;A++){if(e[A].id!==this.layers[A]){t=!0;break}}return t&&(this.layers=e.map((e=>e.id))),t}_updateViewport(e){const t=this.targetLayer;let A=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){A=!0,this.targetBounds=this.tile.boundingBox;const t=e.projectPosition(this.targetBounds[0]),i=e.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[t[0],t[1],i[0],i[1]]}}else this.targetBounds!==t.getBounds()&&(A=!0,this.targetBounds=t.getBounds(),this.targetBoundsCommon=d([t],e));if(!this.targetBoundsCommon)return!1;const i=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{const t=this.renderViewport?.zoom;A=A||i!==t;const r=I(this.targetBoundsCommon,e),a=this.bounds;A=A||!a||r.some(((e,t)=>e!==a[t])),this.bounds=r}return A&&(this.renderViewport=u({bounds:this.bounds,zoom:i,viewport:e})),A}getRenderFramebuffer(){return this.renderViewport&&0!==this.layers.length?(this.fbo||(this.fbo=w(this.targetLayer.context.device,{id:this.id})),this.fbo):null}getPickingFramebuffer(){return!this.renderViewport||0===this.layers.length&&!this.targetLayer.props.pickable?null:(this.pickingFbo||(this.pickingFbo=w(this.targetLayer.context.device,{id:`${this.id}-picking`})),this.pickingFbo)}filterLayers(e){return e.filter((({id:e})=>this.layers.includes(e)))}delete(){const{fbo:e,pickingFbo:t}=this;e&&(e.colorAttachments[0].destroy(),e.destroy()),t&&(t.colorAttachments[0].destroy(),t.destroy())}}function m(e){for(;e;){const{tile:t}=e.props;if(t)return t;e=e.parent}return null}const p={blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"};class y extends i{getRenderableLayers(e,t){const{layers:A}=t,i=[],r=this._getDrawLayerParams(e,t,!0);for(let e=0;e<A.length;e++){const t=A[e];!t.isComposite&&r[e].shouldDrawLayer&&i.push(t)}return i}renderHeightMap(e,t){const A=e.getRenderFramebuffer(),i=e.renderViewport;A&&i&&(A.resize(i),this.render({...t,target:A,pass:"terrain-height-map",layers:t.layers,viewports:[i],effects:[],clearColor:[0,0,0,0]}))}renderTerrainCover(e,t){const A=e.getRenderFramebuffer(),i=e.renderViewport;if(!A||!i)return;const r=e.filterLayers(t.layers);A.resize(i),this.render({...t,target:A,pass:`terrain-cover-${e.id}`,layers:r,effects:[],viewports:[i],clearColor:[0,0,0,0]})}getLayerParameters(e,t,A){return{...e.props.parameters,blend:!0,depthTest:!1,...e.props.operation.includes("terrain")&&p}}}class _ extends r{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(e,t){const{layers:A}=t,i=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);const r=this._getDrawLayerParams(e,t);for(let e=0;e<A.length;e++){const t=A[e];!t.isComposite&&r[e].shouldDrawLayer&&(i.push(t),this.drawParameters[t.id]=r[e].layerParameters)}return i}renderTerrainCover(e,t){const A=e.getPickingFramebuffer(),i=e.renderViewport;if(!A||!i)return;const r=e.filterLayers(t.layers),a=e.targetLayer;a.props.pickable&&r.unshift(a),A.resize(i),this.render({...t,pickingFBO:A,pass:`terrain-cover-picking-${e.id}`,layers:r,effects:[],viewports:[i],cullRect:void 0,deviceRect:i,pickZ:!1})}getLayerParameters(e,t,A){let i;return this.drawParameters[e.id]?i=this.drawParameters[e.id]:(i=super.getLayerParameters(e,t,A),i.blend=!0),{...i,depthTest:!1}}}class b{static isSupported(e){return e.isTextureFormatRenderable("rgba32float")}constructor(e){this.renderViewport=null,this.bounds=null,this.layers=[],this.layersBounds=[],this.layersBoundsCommon=null,this.lastViewport=null,this.device=e}getRenderFramebuffer(){return this.renderViewport?(this.fbo||(this.fbo=w(this.device,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:e,viewport:t}){const A=e.length!==this.layers.length||e.some(((e,t)=>e!==this.layers[t]||e.props.transitions||e.getBounds()!==this.layersBounds[t]));A&&(this.layers=e,this.layersBounds=e.map((e=>e.getBounds())),this.layersBoundsCommon=d(e,t));const i=!this.lastViewport||!t.equals(this.lastViewport);if(this.layersBoundsCommon){if(A||i){const e=I(this.layersBoundsCommon,t);if(e[2]<=e[0]||e[3]<=e[1])return this.renderViewport=null,!1;this.bounds=e,this.lastViewport=t;const A=t.scale,i=(e[2]-e[0])*A,r=(e[3]-e[1])*A;return this.renderViewport=i>0||r>0?u({bounds:[t.center[0]-1,t.center[1]-1,t.center[0]+1,t.center[1]+1],zoom:t.zoom,width:Math.min(i,2048),height:Math.min(r,2048),viewport:t}):null,!0}}else this.renderViewport=null;return!1}delete(){this.fbo&&(this.fbo.colorAttachments[0].delete(),this.fbo.delete())}}class D{constructor(){this.id="terrain-effect",this.props=null,this.useInPicking=!0,this.isPicking=!1,this.isDrapingEnabled=!1,this.terrainCovers=new Map}setup({device:e,deck:t}){this.dummyHeightMap=e.createTexture({width:1,height:1,data:new Uint8Array([0,0,0,0])}),this.terrainPass=new y(e,{id:"terrain"}),this.terrainPickingPass=new _(e,{id:"terrain-picking"}),b.isSupported(e)?this.heightMap=new b(e):a.warn("Terrain offset mode is not supported by this browser")(),t._addDefaultShaderModule(E)}preRender(e){if(e.pickZ)return void(this.isDrapingEnabled=!1);const{viewports:t}=e,A=e.pass.startsWith("picking");this.isPicking=A,this.isDrapingEnabled=!0;const i=t[0],r=(A?this.terrainPickingPass:this.terrainPass).getRenderableLayers(i,e),a=r.filter((e=>e.props.operation.includes("terrain")));if(0===a.length)return;if(!A){r.filter((e=>"offset"===e.state.terrainDrawMode)).length>0&&this._updateHeightMap(a,i,e)}const n=r.filter((e=>"drape"===e.state.terrainDrawMode));this._updateTerrainCovers(a,n,i,e)}getModuleParameters(e){const{terrainDrawMode:t}=e.state;return{heightMap:this.heightMap?.getRenderFramebuffer()?.colorAttachments[0].texture||null,heightMapBounds:this.heightMap?.bounds,dummyHeightMap:this.dummyHeightMap,terrainCover:this.isDrapingEnabled?this.terrainCovers.get(e.id):null,useTerrainHeightMap:"offset"===t,terrainSkipRender:"drape"===t||!e.props.operation.includes("draw")}}cleanup({deck:e}){this.dummyHeightMap&&(this.dummyHeightMap.delete(),this.dummyHeightMap=void 0),this.heightMap&&(this.heightMap.delete(),this.heightMap=void 0);for(const e of this.terrainCovers.values())e.delete();this.terrainCovers.clear(),e._removeDefaultShaderModule(E)}_updateHeightMap(e,t,A){if(!this.heightMap)return;this.heightMap.shouldUpdate({layers:e,viewport:t})&&this.terrainPass.renderHeightMap(this.heightMap,{...A,layers:e,moduleParameters:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,devicePixelRatio:1,drawToTerrainHeightMap:!0}})}_updateTerrainCovers(e,t,A,i){const r={};for(const e of t)e.state.terrainCoverNeedsRedraw&&(r[e.id]=!0,e.state.terrainCoverNeedsRedraw=!1);for(const e of this.terrainCovers.values())e.isDirty=e.isDirty||e.shouldUpdate({layerNeedsRedraw:r});for(const r of e)this._updateTerrainCover(r,t,A,i);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,A,i){const r=this.isPicking?this.terrainPickingPass:this.terrainPass;let a=this.terrainCovers.get(e.id);a||(a=new Q(e),this.terrainCovers.set(e.id,a));try{const n=a.shouldUpdate({targetLayer:e,viewport:A,layers:t});(this.isPicking||a.isDirty||n)&&(r.renderTerrainCover(a,{...i,layers:t,moduleParameters:{dummyHeightMap:this.dummyHeightMap,terrainSkipRender:!1,devicePixelRatio:1}}),this.isPicking||(a.isDirty=!1))}catch(t){e.raiseError(t,`Error rendering terrain cover ${a.id}`)}}_pruneTerrainCovers(){const e=[];for(const[t,A]of this.terrainCovers)A.isActive||e.push(t);for(const t of e)this.terrainCovers.delete(t)}}const k={terrainDrawMode:void 0};class v extends n{static{this.defaultProps=k}static{this.extensionName="TerrainExtension"}getShaders(){return{modules:[E]}}initializeState(){this.context.deck?._addDefaultEffect(new D)}updateState(e){const{props:t,oldProps:A}=e;if(this.state.terrainDrawMode&&t.terrainDrawMode===A.terrainDrawMode&&t.extruded===A.extruded)return;let{terrainDrawMode:i}=t;if(!i){const e=this.props.extruded,t=this.getAttributeManager()?.attributes;i=e||t&&"instancePositions"in t?"offset":"drape"}this.setState({terrainDrawMode:i})}onNeedsRedraw(){const e=this.state;"drape"===e.terrainDrawMode&&(e.terrainCoverNeedsRedraw=!0)}}var x,S,G,U,M,R,F,L,T,N,P,O,z,K;!function(e){e[e.Big=19789]="Big",e[e.Little=18761]="Little"}(x||(x={})),function(e){e[e.ReducedImage=1]="ReducedImage",e[e.Page=2]="Page",e[e.Mask=4]="Mask"}(S||(S={})),function(e){e[e.TopLeft=1]="TopLeft",e[e.TopRight=2]="TopRight",e[e.BottomRight=3]="BottomRight",e[e.BottomLeft=4]="BottomLeft",e[e.LeftTop=5]="LeftTop",e[e.RightTOP=6]="RightTOP",e[e.RightBottom=7]="RightBottom",e[e.LeftBottom=8]="LeftBottom"}(G||(G={})),function(e){e[e.PixelIsArea=1]="PixelIsArea",e[e.PixelIsPoint=2]="PixelIsPoint"}(U||(U={})),function(e){e[e.Unknown=0]="Unknown",e[e.Projected=1]="Projected",e[e.Geographic=2]="Geographic",e[e.Geocentric=3]="Geocentric",e[e.UserDefined=32767]="UserDefined"}(M||(M={})),function(e){e[e.Image=1]="Image",e[e.ReducedImage=2]="ReducedImage",e[e.Page=3]="Page"}(R||(R={})),function(e){e[e.None=1]="None",e[e.Lzw=5]="Lzw",e[e.Jpeg6=6]="Jpeg6",e[e.Jpeg=7]="Jpeg",e[e.DeflateOther=8]="DeflateOther",e[e.Deflate=32946]="Deflate",e[e.Jp2000=3417]="Jp2000",e[e.Lerc=34887]="Lerc",e[e.Lzma=34925]="Lzma",e[e.Zstd=5e4]="Zstd",e[e.Webp=50001]="Webp",e[e.JpegXl=50002]="JpegXl"}(F||(F={})),function(e){e[e.Contig=1]="Contig",e[e.Separate=2]="Separate"}(L||(L={})),function(e){e[e.Uint=1]="Uint",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Void=4]="Void",e[e.ComplexInt=5]="ComplexInt",e[e.ComplexFloat=6]="ComplexFloat"}(T||(T={})),function(e){e[e.MinIsWhite=0]="MinIsWhite",e[e.MinIsBlack=1]="MinIsBlack",e[e.Rgb=2]="Rgb",e[e.Palette=3]="Palette",e[e.Mask=4]="Mask",e[e.Separated=5]="Separated",e[e.Ycbcr=6]="Ycbcr",e[e.Cielab=8]="Cielab",e[e.Icclab=9]="Icclab",e[e.Itulab=10]="Itulab",e[e.Cfa=32803]="Cfa",e[e.Logl=32844]="Logl",e[e.Logluv=32845]="Logluv"}(N||(N={})),function(e){e[e.SubFileType=254]="SubFileType",e[e.OldSubFileType=255]="OldSubFileType",e[e.ImageWidth=256]="ImageWidth",e[e.ImageHeight=257]="ImageHeight",e[e.BitsPerSample=258]="BitsPerSample",e[e.SampleFormat=339]="SampleFormat",e[e.Compression=259]="Compression",e[e.Photometric=262]="Photometric",e[e.TileWidth=322]="TileWidth",e[e.TileHeight=323]="TileHeight",e[e.TileOffsets=324]="TileOffsets",e[e.TileByteCounts=325]="TileByteCounts",e[e.JpegTables=347]="JpegTables",e[e.StripOffsets=273]="StripOffsets",e[e.StripByteCounts=279]="StripByteCounts",e[e.GdalMetadata=42112]="GdalMetadata",e[e.GdalNoData=42113]="GdalNoData",e[e.ModelPixelScale=33550]="ModelPixelScale",e[e.ModelTiePoint=33922]="ModelTiePoint",e[e.ModelTransformation=34744]="ModelTransformation",e[e.GeoKeyDirectory=34735]="GeoKeyDirectory",e[e.GeoDoubleParams=34736]="GeoDoubleParams",e[e.GeoAsciiParams=34737]="GeoAsciiParams",e[e.LercParameters=50674]="LercParameters",e[e.PlanarConfiguration=284]="PlanarConfiguration",e[e.CellLength=265]="CellLength",e[e.CellWidth=264]="CellWidth",e[e.ColorMap=320]="ColorMap",e[e.Copyright=33432]="Copyright",e[e.DateTime=306]="DateTime",e[e.ExtraSamples=338]="ExtraSamples",e[e.FillOrder=266]="FillOrder",e[e.FreeByteCounts=289]="FreeByteCounts",e[e.FreeOffsets=288]="FreeOffsets",e[e.GrayResponseCurve=291]="GrayResponseCurve",e[e.GrayResponseUnit=290]="GrayResponseUnit",e[e.HostComputer=316]="HostComputer",e[e.ImageDescription=270]="ImageDescription",e[e.Make=271]="Make",e[e.MaxSampleValue=281]="MaxSampleValue",e[e.MinSampleValue=280]="MinSampleValue",e[e.Model=272]="Model",e[e.Orientation=274]="Orientation",e[e.ResolutionUnit=296]="ResolutionUnit",e[e.RowsPerStrip=278]="RowsPerStrip",e[e.SamplesPerPixel=277]="SamplesPerPixel",e[e.Software=305]="Software",e[e.Threshholding=263]="Threshholding",e[e.XResolution=282]="XResolution",e[e.YResolution=283]="YResolution",e[e.BadFaxLines=326]="BadFaxLines",e[e.CleanFaxData=327]="CleanFaxData",e[e.ClipPath=343]="ClipPath",e[e.ConsecutiveBadFaxLines=328]="ConsecutiveBadFaxLines",e[e.Decode=433]="Decode",e[e.DefaultImageColor=434]="DefaultImageColor",e[e.DocumentName=269]="DocumentName",e[e.DotRange=336]="DotRange",e[e.HalftoneHints=321]="HalftoneHints",e[e.Indexed=346]="Indexed",e[e.PageName=285]="PageName",e[e.PageNumber=297]="PageNumber",e[e.Predictor=317]="Predictor",e[e.PrimaryChromaticities=319]="PrimaryChromaticities",e[e.ReferenceBlackWhite=532]="ReferenceBlackWhite",e[e.SMinSampleValue=340]="SMinSampleValue",e[e.SMaxSampleValue=341]="SMaxSampleValue",e[e.StripRowCounts=559]="StripRowCounts",e[e.SubIFDs=330]="SubIFDs",e[e.T4Options=292]="T4Options",e[e.T6Options=293]="T6Options",e[e.TransferFunction=301]="TransferFunction",e[e.WhitePoint=318]="WhitePoint",e[e.XClipPathUnits=344]="XClipPathUnits",e[e.XPosition=286]="XPosition",e[e.YCbCrCoefficients=529]="YCbCrCoefficients",e[e.YCbCrPositioning=531]="YCbCrPositioning",e[e.YCbCrSubSampling=530]="YCbCrSubSampling",e[e.YClipPathUnits=345]="YClipPathUnits",e[e.YPosition=287]="YPosition",e[e.ApertureValue=37378]="ApertureValue",e[e.ColorSpace=40961]="ColorSpace",e[e.DateTimeDigitized=36868]="DateTimeDigitized",e[e.DateTimeOriginal=36867]="DateTimeOriginal",e[e.ExifIFD=34665]="ExifIFD",e[e.ExifVersion=36864]="ExifVersion",e[e.ExposureTime=33434]="ExposureTime",e[e.FileSource=41728]="FileSource",e[e.Flash=37385]="Flash",e[e.FlashpixVersion=40960]="FlashpixVersion",e[e.FNumber=33437]="FNumber",e[e.ImageUniqueID=42016]="ImageUniqueID",e[e.LightSource=37384]="LightSource",e[e.MakerNote=37500]="MakerNote",e[e.ShutterSpeedValue=37377]="ShutterSpeedValue",e[e.UserComment=37510]="UserComment",e[e.IPTC=33723]="IPTC",e[e.ICCProfile=34675]="ICCProfile",e[e.XMP=700]="XMP"}(P||(P={})),function(e){e[e.GTModelTypeGeoKey=1024]="GTModelTypeGeoKey",e[e.GTRasterTypeGeoKey=1025]="GTRasterTypeGeoKey",e[e.GTCitationGeoKey=1026]="GTCitationGeoKey",e[e.GeodeticCRSGeoKey=2048]="GeodeticCRSGeoKey",e[e.GeodeticCitationGeoKey=2049]="GeodeticCitationGeoKey",e[e.GeodeticDatumGeoKey=2050]="GeodeticDatumGeoKey",e[e.PrimeMeridianGeoKey=2051]="PrimeMeridianGeoKey",e[e.GeogLinearUnitsGeoKey=2052]="GeogLinearUnitsGeoKey",e[e.GeogLinearUnitSizeGeoKey=2053]="GeogLinearUnitSizeGeoKey",e[e.GeogAngularUnitsGeoKey=2054]="GeogAngularUnitsGeoKey",e[e.GeogAngularUnitSizeGeoKey=2055]="GeogAngularUnitSizeGeoKey",e[e.EllipsoidGeoKey=2056]="EllipsoidGeoKey",e[e.EllipsoidSemiMajorAxisGeoKey=2057]="EllipsoidSemiMajorAxisGeoKey",e[e.EllipsoidSemiMinorAxisGeoKey=2058]="EllipsoidSemiMinorAxisGeoKey",e[e.EllipsoidInvFlatteningGeoKey=2059]="EllipsoidInvFlatteningGeoKey",e[e.PrimeMeridianLongitudeGeoKey=2061]="PrimeMeridianLongitudeGeoKey",e[e.GeogTOWGS84GeoKey=2062]="GeogTOWGS84GeoKey",e[e.GeogAzimuthUnitsGeoKey=2060]="GeogAzimuthUnitsGeoKey",e[e.ProjectedCRSGeoKey=3072]="ProjectedCRSGeoKey",e[e.ProjectedCitationGeoKey=3073]="ProjectedCitationGeoKey",e[e.ProjectionGeoKey=3074]="ProjectionGeoKey",e[e.ProjMethodGeoKey=3075]="ProjMethodGeoKey",e[e.ProjLinearUnitsGeoKey=3076]="ProjLinearUnitsGeoKey",e[e.ProjLinearUnitSizeGeoKey=3077]="ProjLinearUnitSizeGeoKey",e[e.ProjStdParallel1GeoKey=3078]="ProjStdParallel1GeoKey",e[e.ProjStdParallel2GeoKey=3079]="ProjStdParallel2GeoKey",e[e.ProjNatOriginLongGeoKey=3080]="ProjNatOriginLongGeoKey",e[e.ProjNatOriginLatGeoKey=3081]="ProjNatOriginLatGeoKey",e[e.ProjFalseEastingGeoKey=3082]="ProjFalseEastingGeoKey",e[e.ProjFalseNorthingGeoKey=3083]="ProjFalseNorthingGeoKey",e[e.ProjFalseOriginLongGeoKey=3084]="ProjFalseOriginLongGeoKey",e[e.ProjFalseOriginLatGeoKey=3085]="ProjFalseOriginLatGeoKey",e[e.ProjFalseOriginEastingGeoKey=3086]="ProjFalseOriginEastingGeoKey",e[e.ProjFalseOriginNorthingGeoKey=3087]="ProjFalseOriginNorthingGeoKey",e[e.ProjCenterLongGeoKey=3088]="ProjCenterLongGeoKey",e[e.ProjCenterLatGeoKey=3089]="ProjCenterLatGeoKey",e[e.ProjCenterEastingGeoKey=3090]="ProjCenterEastingGeoKey",e[e.ProjCenterNorthingGeoKey=3091]="ProjCenterNorthingGeoKey",e[e.ProjScaleAtNatOriginGeoKey=3092]="ProjScaleAtNatOriginGeoKey",e[e.ProjScaleAtCenterGeoKey=3093]="ProjScaleAtCenterGeoKey",e[e.ProjAzimuthAngleGeoKey=3094]="ProjAzimuthAngleGeoKey",e[e.ProjStraightVertPoleLongGeoKey=3095]="ProjStraightVertPoleLongGeoKey",e[e.ProjRectifiedGridAngleGeoKey=3096]="ProjRectifiedGridAngleGeoKey",e[e.VerticalGeoKey=4096]="VerticalGeoKey",e[e.VerticalCitationGeoKey=4097]="VerticalCitationGeoKey",e[e.VerticalDatumGeoKey=4098]="VerticalDatumGeoKey",e[e.VerticalUnitsGeoKey=4099]="VerticalUnitsGeoKey"}(O||(O={})),function(e){e[e.Radian=9101]="Radian",e[e.Degree=9102]="Degree",e[e.ArcMinute=9103]="ArcMinute",e[e.ArcDegree=9104]="ArcDegree",e[e.Grad=9105]="Grad",e[e.Gon=9106]="Gon",e[e.Dms=9107]="Dms"}(z||(z={})),function(e){e[e.Metre=9001]="Metre",e[e.Foot=9002]="Foot",e[e.FootUsSurvey=9003]="FootUsSurvey",e[e.FootModifiedAmerican=9004]="FootModifiedAmerican",e[e.FootClarke=9005]="FootClarke",e[e.FootIndian=9006]="FootIndian",e[e.Link=9007]="Link",e[e.LinkBenoit=9008]="LinkBenoit",e[e.LinkSears=9009]="LinkSears",e[e.ChainBenoit=9010]="ChainBenoit",e[e.ChainSears=9011]="ChainSears",e[e.YardSears=9012]="YardSears",e[e.YardIndian=9013]="YardIndian",e[e.Fathom=9014]="Fathom",e[e.MileInternationalNautical=9015]="MileInternationalNautical"}(K||(K={}));const H={[P.TileByteCounts]:!0,[P.TileOffsets]:!0,[P.StripOffsets]:!0,[P.StripByteCounts]:!0,[P.BitsPerSample]:!0,[P.SampleFormat]:!0,[P.GeoKeyDirectory]:!0,[P.GeoDoubleParams]:!0};var J;!function(e){e.None="application/octet-stream",e.Jpeg="image/jpeg",e.Jp2000="image/jp2",e.JpegXl="image/jpegxl",e.Webp="image/webp",e.Zstd="application/zstd",e.Lzw="application/lzw",e.Deflate="application/deflate",e.Lerc="application/lerc",e.Lzma="application/x-lzma"}(J||(J={}));const q={[F.None]:J.None,[F.Lzw]:J.Lzw,[F.Jpeg6]:J.Jpeg,[F.Jpeg]:J.Jpeg,[F.DeflateOther]:J.Deflate,[F.Deflate]:J.Deflate,[F.Lerc]:J.Lerc,[F.Lzma]:J.Lzma,[F.Jp2000]:J.Jp2000,[F.Zstd]:J.Zstd,[F.Webp]:J.Webp,[F.JpegXl]:J.JpegXl};var Y,V,Z,j;function W(e){switch(e){case Y.Uint8:case Y.Ascii:case Y.Int8:case Y.Undefined:return 1;case Y.Uint16:case Y.Int16:return 2;case Y.Uint32:case Y.Int32:case Y.Float32:return 4;case Y.Rational:case Y.SignedRational:case Y.Float64:case Y.Uint64:case Y.Int64:case Y.Ifd8:return 8;default:throw new Error(`Invalid fieldType ${e}`)}}!function(e){e[e.Uint8=1]="Uint8",e[e.Ascii=2]="Ascii",e[e.Uint16=3]="Uint16",e[e.Uint32=4]="Uint32",e[e.Rational=5]="Rational",e[e.Int8=6]="Int8",e[e.Undefined=7]="Undefined",e[e.Int16=8]="Int16",e[e.Int32=9]="Int32",e[e.SignedRational=10]="SignedRational",e[e.Float32=11]="Float32",e[e.Float64=12]="Float64",e[e.Uint64=16]="Uint64",e[e.Int64=17]="Int64",e[e.Ifd8=18]="Ifd8"}(Y||(Y={})),function(e){e[e.BigTiff=43]="BigTiff",e[e.Tiff=42]="Tiff"}(V||(V={})),function(e){e[e.Double=8]="Double",e[e.Float32=4]="Float32"}(Z||(Z={})),function(e){e[e.UInt64=8]="UInt64",e[e.UInt32=4]="UInt32",e[e.UInt16=2]="UInt16",e[e.UInt8=1]="UInt8"}(j||(j={}));const X=2**32;function $(e,t,A){const i=e.getUint32(t,A),r=e.getUint32(t+4,A),a=A?i+X*r:X*i+r;if(!Number.isSafeInteger(a))throw new Error(a+" exceeds MAX_SAFE_INTEGER. Precision may is lost");return a}function ee(e,t,A,i){switch(A){case j.UInt8:return e.getUint8(t);case j.UInt16:return e.getUint16(t,i);case j.UInt32:return e.getUint32(t,i);case j.UInt64:return $(e,t,i)}}function te(e,t,A){return!(t<e.sourceOffset)&&!(e.sourceOffset+e.byteLength<t+A)}function Ae(e,t,A,i){switch(e){case Y.Ascii:return String.fromCharCode(t.getUint8(A));case Y.Undefined:case Y.Uint8:return t.getUint8(A);case Y.Int8:return t.getInt8(A);case Y.Uint16:return t.getUint16(A,i);case Y.Int16:return t.getInt16(A,i);case Y.Uint32:return t.getUint32(A,i);case Y.Int32:return t.getInt32(A,i);case Y.Rational:return[t.getUint32(A,i),t.getUint32(A+4,i)];case Y.SignedRational:return[t.getInt32(A,i),t.getInt32(A+4,i)];case Y.Float64:return t.getFloat64(A,i);case Y.Float32:return t.getFloat32(A,i);case Y.Uint64:return $(t,A,i);default:throw new Error(`Unknown read type "${e}" "${Y[e]}"`)}}function ie(e,t,A,i,r,a){const n=W(r),s=a*n;if(1===a){const a=Ae(r,A,i,e.isLittleEndian);return t&&H[t]?[a]:a}if(r===Y.Ascii)return String.fromCharCode.apply(null,new Uint8Array(A.buffer,i,s-1));const o=[];for(let t=0;t<s;t+=n)o.push(Ae(r,A,i+t,e.isLittleEndian));return o}function re(e,t,A){const i=t.getUint16(A+0,e.isLittleEndian),r=t.getUint16(A+2,e.isLittleEndian),a=ee(t,A+4,e.ifdConfig.pointer,e.isLittleEndian),n=W(r)*a;if(n<=e.ifdConfig.pointer){const n=ie(e,i,t,A+4+e.ifdConfig.pointer,r,a);return{type:"inline",id:i,name:P[i],count:a,value:n,dataType:r,tagOffset:A}}const s=ee(t,A+4+e.ifdConfig.pointer,e.ifdConfig.pointer,e.isLittleEndian);switch(i){case P.TileOffsets:case P.TileByteCounts:case P.StripByteCounts:case P.StripOffsets:const e={type:"offset",id:i,name:P[i],count:a,dataType:r,dataOffset:s,isLoaded:!1,value:[],tagOffset:A};return i===P.TileOffsets&&te(t,s,n)&&function(e,t){const A=W(e.dataType),i=t.byteOffset+e.dataOffset-t.sourceOffset;e.view=new DataView(t.buffer.slice(i,i+A*e.count)),e.view.sourceOffset=e.dataOffset}(e,t),e}if(te(t,s,n)){const n=ie(e,i,t,s-t.sourceOffset,r,a);return{type:"inline",id:i,name:P[i],count:a,value:n,dataType:r,tagOffset:A}}return{type:"lazy",id:i,name:P[i],count:a,dataOffset:s,dataType:r,tagOffset:A}}new Set([P.Compression,P.ImageHeight,P.ImageWidth,P.ModelPixelScale,P.ModelTiePoint,P.ModelTransformation,P.TileHeight,P.TileWidth,P.GeoKeyDirectory,P.GeoAsciiParams,P.GeoDoubleParams,P.TileOffsets]);class ae{constructor(e,t,A){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tiff",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isGeoTagsLoaded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"tagsGeo",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tiff=e,this.id=t,this.tags=A}async init(e=!0){const t=[this.fetch(P.Compression),this.fetch(P.ImageHeight),this.fetch(P.ImageWidth),this.fetch(P.ModelPixelScale),this.fetch(P.ModelTiePoint),this.fetch(P.ModelTransformation),this.fetch(P.TileHeight),this.fetch(P.TileWidth)];e&&(t.push(this.fetch(P.GeoKeyDirectory)),t.push(this.fetch(P.GeoAsciiParams)),t.push(this.fetch(P.GeoDoubleParams))),await Promise.all(t),e&&await this.loadGeoTiffTags()}value(e){const t=this.tags.get(e);return null==t||"offset"===t.type&&!1===t.isLoaded?null:t.value}has(e){return this.tags.has(e)}async fetch(e){const t=this.tags.get(e);if(null==t)return null;if("inline"===t.type)return t.value;if("lazy"===t.type)return async function(e,t){if(null!=e.value)return e.value;const A=W(e.dataType)*e.count,i=await t.source.fetch(e.dataOffset,A),r=new DataView(i);return e.value=ie(t,e.id,r,0,e.dataType,e.count),e.value}(t,this.tiff);if(t.isLoaded)return t.value;if("offset"===t.type)return async function(e,t){const A=W(t.dataType);if(null==t.view){const i=await e.source.fetch(t.dataOffset,A*t.count);t.view=new DataView(i),t.view.sourceOffset=t.dataOffset}return t.value=ie(e,t.id,t.view,0,t.dataType,t.count),t.isLoaded=!0,t.value}(this.tiff,t);throw new Error("Cannot fetch:"+e)}valueGeo(e){if(!1===this.isGeoTagsLoaded)throw new Error("loadGeoTiffTags() has not been called");return this.tagsGeo.get(e)}get noData(){const e=this.tags.get(P.GdalNoData);if(null==e)return null;if(e.value)return Number(e.value);throw new Error("GdalNoData tag is not loaded")}async loadGeoTiffTags(){if(this.isGeoTagsLoaded)return;const e=this.tags.get(P.GeoKeyDirectory);if(null==e)return void(this.isGeoTagsLoaded=!0);if("lazy"===e.type&&null==e.value&&await Promise.all([this.fetch(P.GeoKeyDirectory),this.fetch(P.GeoAsciiParams),this.fetch(P.GeoDoubleParams)]),this.isGeoTagsLoaded=!0,null==e.value)return;const t=e.value;if("number"==typeof t)throw new Error("Invalid geo tags found");for(let e=4;e<=4*t[3];e+=4){const A=t[e],i=t[e+1],r=t[e+3];if(0===i){this.tagsGeo.set(A,r);continue}const a=this.tags.get(i);if(null==a||null==a.value)continue;const n=t[e+2];if("string"==typeof a.value)this.tagsGeo.set(A,a.value.slice(r,r+n-1).trim());else{if(!Array.isArray(a.value))throw new Error("Failed to extract GeoTiffTags");1===n?this.tagsGeo.set(A,a.value[r]):this.tagsGeo.set(A,a.value.slice(r,r+n))}}}get origin(){const e=this.value(P.ModelTiePoint);if(null!=e&&6===e.length)return[e[3],e[4],e[5]];const t=this.value(P.ModelTransformation);if(null!=t)return[t[3],t[7],t[11]];if(this.value(P.SubFileType)===S.ReducedImage&&0!==this.id)return this.tiff.images[0].origin;throw new Error("Image does not have a geo transformation.")}get isGeoLocated(){return!(null==this.value(P.ModelPixelScale)&&null==this.value(P.ModelTransformation))||!(!this.isSubImage||0===this.id)&&this.tiff.images[0].isGeoLocated}get resolution(){const e=this.value(P.ModelPixelScale);if(null!=e)return[e[0],-e[1],e[2]];const t=this.value(P.ModelTransformation);if(null!=t)return[t[0],t[5],t[10]];if(this.isSubImage&&0!==this.id){const e=this.tiff.images[0],[t,A,i]=e.resolution,r=e.size,a=this.size;return[t*r.width/a.width,A*r.height/a.height,i]}throw new Error("Image does not have a geo transformation.")}get isSubImage(){return this.value(P.SubFileType)===S.ReducedImage}get bbox(){const e=this.size,t=this.origin,A=this.resolution;if(null==t||null==e||null==A)throw new Error("Unable to calculate bounding box");const i=t[0],r=t[1],a=i+A[0]*e.width,n=r+A[1]*e.height;return[Math.min(i,a),Math.min(r,n),Math.max(i,a),Math.max(r,n)]}get compression(){const e=this.value(P.Compression);return null==e?null:q[e]}get epsg(){const e=this.valueGeo(O.ProjectionGeoKey);if(null!=e&&32767!==e)return e;let t=null;switch(this.valueGeo(O.GTModelTypeGeoKey)){case M.Unknown:return null;case M.Projected:t=this.valueGeo(O.ProjectedCRSGeoKey);break;case M.Geographic:case M.Geocentric:t=this.valueGeo(O.GeodeticCRSGeoKey);break;case M.UserDefined:return null}return 32767===t?null:t}get size(){const e=this.value(P.ImageWidth),t=this.value(P.ImageHeight);if(null==e||null==t)throw new Error("Tiff has no height or width");return{width:e,height:t}}isTiled(){return null!==this.value(P.TileWidth)}get tileSize(){const e=this.value(P.TileWidth),t=this.value(P.TileHeight);if(null==e||null==t)throw new Error("Tiff is not tiled");return{width:e,height:t}}get tileCount(){const e=this.size,t=this.tileSize;return{x:Math.ceil(e.width/t.width),y:Math.ceil(e.height/t.height)}}get tileOffset(){const e=this.tags.get(P.TileOffsets);if(null==e)throw new Error("No tile offsets found");return e}get stripCount(){return this.tags.get(P.StripByteCounts)?.count??0}getTileBounds(e,t){const{size:A,tileSize:i}=this,r=t*i.height,a=e*i.width;return{x:a,y:r,width:a+i.width>=A.width?A.width-a:i.width,height:r+i.height>=A.height?A.height-r:i.height}}async getStrip(e){if(this.isTiled())throw new Error("Cannot read stripes, tiff is tiled: "+e);const t=this.tags.get(P.StripByteCounts),A=this.tags.get(P.StripOffsets);if(e>=t.count)throw new Error("Cannot read strip, index out of bounds");const[i,r]=await Promise.all([ne(this.tiff,A,e),ne(this.tiff,t,e)]);return this.getBytes(i,r)}getJpegHeader(e){const t=this.value(P.JpegTables);if(null==t)throw new Error("Unable to find Jpeg header");const A=t.slice(0,t.length-2),i=new Uint8Array(e.byteLength+A.length-2);return i.set(A,0),i.set(new Uint8Array(e).slice(2),A.length),i}async getBytes(e,t){if(0===t)return null;const A=await this.tiff.source.fetch(e,t);if(A.byteLength<t)throw new Error(`Failed to fetch bytes from offset:${e} wanted:${t} got:${A.byteLength}`);let i=this.value(P.Compression);null==i&&(i=F.None);const r=(null==(a=i)?null:q[a])??J.None;var a;return i===F.Jpeg?{mimeType:r,bytes:this.getJpegHeader(A),compression:i}:{mimeType:r,bytes:A,compression:i}}async getTile(e,t){const A=this.size,i=this.tileSize;if(null==i)throw new Error("Tiff is not tiled");const r=Math.ceil(A.height/i.height),a=Math.ceil(A.width/i.width);if(e>=a||t>=r)throw new Error(`Tile index is outside of range x:${e} >= ${a} or y:${t} >= ${r}`);const n=t*a+e,s=a*r;if(n>=s)throw new Error(`Tile index is outside of tile range: ${n} >= ${s}`);const{offset:o,imageSize:l}=await this.getTileSize(n);return this.getBytes(o,l)}async hasTile(e,t){const A=this.tileSize,i=this.size;if(null==A)throw new Error("Tiff is not tiled");const r=Math.ceil(i.height/A.height),a=Math.ceil(i.width/A.width);if(e>=a||t>=r)return!1;const n=t*a+e;return(await this.getTileSize(n)).offset>0}async getTileSize(e){const t=this.tiff.options?.tileLeaderByteSize;if(t){const A=await ne(this.tiff,this.tileOffset,e);if(0===A)return{offset:0,imageSize:0};const i=await this.tiff.source.fetch(A-t,t);return{offset:A,imageSize:ee(new DataView(i),0,t,this.tiff.isLittleEndian)}}const A=this.tags.get(P.TileByteCounts);if(null==A)throw new Error("No tile byte counts found");const[i,r]=await Promise.all([ne(this.tiff,this.tileOffset,e),ne(this.tiff,A,e)]);return{offset:i,imageSize:r}}}function ne(e,t,A){if(A<0)throw new Error(`Tiff: ${e.source.url.href} out of bounds ${P[t.id]} index:${A} total:${t.count}`);return A>=t.count?0:"inline"===t.type?t.value[A]:async function(e,t,A){if(A>t.count||A<0)throw new Error("TagOffset: out of bounds :"+A);if(null!=t.value[A])return t.value[A];const i=W(t.dataType);if(null==t.view){const r=await e.source.fetch(t.dataOffset+A*i,i),a=ie(e,void 0,new DataView(r),0,t.dataType,1);return t.value[A]=a,a}const r=ie(e,void 0,t.view,A*i,t.dataType,1);return t.value[A]=r,r}(e,t,A)}var se,oe,le;!function(e){e.GdalStructuralMetadataSize="GDAL_STRUCTURAL_METADATA_SIZE",e.Layout="LAYOUT",e.BlockOrder="BLOCK_ORDER",e.BlockLeader="BLOCK_LEADER",e.BlockTrailer="BLOCK_TRAILER",e.KnownIncompatibleEdition="KNOWN_INCOMPATIBLE_EDITION",e.MaskInterleavedWithImagery="MASK_INTERLEAVED_WITH_IMAGERY"}(se||(se={})),function(e){e.RowMajor="ROW_MAJOR"}(oe||(oe={})),function(e){e.uint32="SIZE_AS_UINT4"}(le||(le={}));class ge{constructor(){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}get isCogOptimized(){return!this.isBroken&&"IFDS_BEFORE_DATA"===this.options.get(se.Layout)}get isBroken(){return"YES"===this.options.get(se.KnownIncompatibleEdition)}process(e,t,A){let i="",r="",a=!1;for(let n=0;n<A;n++){const A=e.getUint8(t+n);if(0===A)break;const s=String.fromCharCode(A);"\n"===s?(this.options.set(i.trim(),r.trim()),i="",r="",a=!1):"="===s?a=!0:a?r+=s:i+=s}}get tileLeaderByteSize(){return this.options.get(se.BlockLeader)===le.uint32?j.UInt32:null}get isMaskInterleaved(){return"YES"===this.options.get(se.MaskInterleavedWithImagery)}}const he={version:V.Tiff,pointer:j.UInt32,offset:j.UInt16,ifd:j.UInt16+j.UInt16+2*j.UInt32},ce={version:V.BigTiff,pointer:j.UInt64,offset:j.UInt64,ifd:j.UInt16+j.UInt16+2*j.UInt64};V.BigTiff,V.Tiff;class fe{constructor(e){Object.defineProperty(this,"defaultReadSize",{enumerable:!0,configurable:!0,writable:!0,value:fe.DefaultReadSize}),Object.defineProperty(this,"source",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:V.Tiff}),Object.defineProperty(this,"images",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ifdConfig",{enumerable:!0,configurable:!0,writable:!0,value:he}),Object.defineProperty(this,"isLittleEndian",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isInitialized",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_initPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.source=e}static create(e){return new fe(e).init()}init(){return this._initPromise||(this._initPromise=this.readHeader()),this._initPromise}getImageByResolution(e){const t=this.images[0],A=t.size,[i]=t.resolution,r=i*A.width;for(let t=this.images.length-1;t>0;t--){const A=this.images[t];if(r/A.size.width-e<=.01)return A}return t}async readHeader(){if(this.isInitialized)return this;const e=new DataView(await this.source.fetch(0,de(this.source,0,this.defaultReadSize)));e.sourceOffset=0;let t=0;const A=e.getUint16(t,this.isLittleEndian);if(t+=2,this.isLittleEndian=A===x.Little,!this.isLittleEndian)throw new Error("Only little endian is supported");let i;if(this.version=e.getUint16(t,this.isLittleEndian),t+=2,this.version===V.BigTiff){this.ifdConfig=ce;const A=e.getUint16(t,this.isLittleEndian);if(t+=2,8!==A)throw new Error("Only 8byte pointers are supported");const r=e.getUint16(t,this.isLittleEndian);if(t+=2,0!==r)throw new Error("Invalid big tiff header");i=ee(e,t,this.ifdConfig.pointer,this.isLittleEndian),t+=this.ifdConfig.pointer}else{if(this.version!==V.Tiff)throw new Error(`Only tiff supported version:${this.version}`);i=ee(e,t,this.ifdConfig.pointer,this.isLittleEndian),t+=this.ifdConfig.pointer}const r=i-t;for(r>0&&r<16384&&(this.options=new ge,this.options.process(e,t,r));0!==i;){let t=e;if(!te(t,i,1024)){const e=await this.source.fetch(i,de(this.source,i,this.defaultReadSize));t=new DataView(e),t.sourceOffset=i}i=await this.readIfd(i,t)}return await Promise.all(this.images.map((e=>e.init()))),this.isInitialized=!0,this}async readIfd(e,t){const A=e-t.sourceOffset,i=ee(t,A,this.ifdConfig.offset,this.isLittleEndian),r=new Map;if(!te(t,e,i*this.ifdConfig.ifd))throw new Error("IFD out of range @ "+function(e,t=4,A=!0){const i=e.toString(16).padStart(t,"0");return A?"0x"+i:i}(e)+" IFD"+this.images.length);const a=this.ifdConfig.ifd,n=A+this.ifdConfig.offset;for(let e=0;e<i;e++){const A=re(this,t,n+e*a);r.set(A.id,A)}return this.images.push(new ae(this,this.images.length,r)),ee(t,n+i*a,this.ifdConfig.pointer,this.isLittleEndian)}}function de(e,t,A){if(null==e.metadata?.size)return A;const i=e.metadata.size;return t+A>i?i-t:A}Object.defineProperty(fe,"DefaultReadSize",{enumerable:!0,configurable:!0,writable:!0,value:16384});class ue extends Error{code;url;source;constructor(e,t,A,i){super(e,{cause:i}),this.code=t,this.url=A.url,this.source=A,Object.defineProperty(this,"_sourceError",{enumerable:!1,value:"SourceError"})}static is(e){return e instanceof ue||"object"==typeof e&&(null!=e&&("_sourceError"in e&&"SourceError"===e._sourceError))}}const Ie={toRange(e,t){if(null==t)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+t-1}`},parseSize(e){const[t,A]=e.split(" ");if("bytes"!==t)throw new Error("Failed to parse content-range: "+e);if(null==A)throw new Error("Failed to parse content-range: "+e);const[,i]=A.split("/"),r=Number(i);if(isNaN(r))throw new Error("Failed to parse content-range: "+e);return r}};function Be(e){const t={size:-1},A=e.headers.get("content-range");return null!=A&&(t.size=Ie.parseSize(A)),t.eTag=e.headers.get("etag")??void 0,t.contentType=e.headers.get("content-type")??void 0,t.contentDisposition=e.headers.get("content-disposition")??void 0,t}class Ce{constructor(e,t){this.type="http",this.url="string"==typeof e?Ce.tryUrl(e):e,this.headers=t}static tryUrl(e){try{return new URL(e)}catch(t){return"undefined"!=typeof document?new URL(e,document.baseURI):new URL(e,import.meta.url)}}head(){return this._head||(this._head=Ce.fetch(this.url,{method:"HEAD",headers:this.headers}).then((e=>{if(!e.ok)throw delete this._head,new Error(`Failed to HEAD ${this.url}`,{cause:{statusCode:e.status,msg:e.statusText}});return this.metadata=Be(e),this.metadata}))),this._head}async fetch(e,t){try{const A={range:Ie.toRange(e,t),...this.headers},i=await Ce.fetch(this.url,{headers:A});if(!i.ok)throw new ue(`Failed to fetch ${this.url} ${A.range}`,i.status,this,new Error(i.statusText));const r=Be(i);if(null==this.metadata)this.metadata=r;else if(this.metadata.eTag&&this.metadata.eTag!==r.eTag)throw new ue(`ETag conflict ${this.url} ${A.range} expected: ${this.metadata.eTag} got: ${r.eTag}`,409,this);return i.arrayBuffer()}catch(e){if(ue.is(e)&&e.source===this)throw e;throw new ue(`Failed to fetch: ${this.url}`,500,this,e)}}}Ce.fetch=(e,t)=>fetch(e,t)
2
+ /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */;function Ee(e){let t=e.length;for(;--t>=0;)e[t]=0}const we=256,Qe=286,me=30,pe=15,ye=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),_e=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),be=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),De=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ke=new Array(576);Ee(ke);const ve=new Array(60);Ee(ve);const xe=new Array(512);Ee(xe);const Se=new Array(256);Ee(Se);const Ge=new Array(29);Ee(Ge);const Ue=new Array(me);function Me(e,t,A,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=A,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}let Re,Fe,Le;function Te(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}Ee(Ue);const Ne=e=>e<256?xe[e]:xe[256+(e>>>7)],Pe=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Oe=(e,t,A)=>{e.bi_valid>16-A?(e.bi_buf|=t<<e.bi_valid&65535,Pe(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=A-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=A)},ze=(e,t,A)=>{Oe(e,A[2*t],A[2*t+1])},Ke=(e,t)=>{let A=0;do{A|=1&e,e>>>=1,A<<=1}while(--t>0);return A>>>1},He=(e,t,A)=>{const i=new Array(16);let r,a,n=0;for(r=1;r<=pe;r++)n=n+A[r-1]<<1,i[r]=n;for(a=0;a<=t;a++){let t=e[2*a+1];0!==t&&(e[2*a]=Ke(i[t]++,t))}},Je=e=>{let t;for(t=0;t<Qe;t++)e.dyn_ltree[2*t]=0;for(t=0;t<me;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},qe=e=>{e.bi_valid>8?Pe(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Ye=(e,t,A,i)=>{const r=2*t,a=2*A;return e[r]<e[a]||e[r]===e[a]&&i[t]<=i[A]},Ve=(e,t,A)=>{const i=e.heap[A];let r=A<<1;for(;r<=e.heap_len&&(r<e.heap_len&&Ye(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Ye(t,i,e.heap[r],e.depth));)e.heap[A]=e.heap[r],A=r,r<<=1;e.heap[A]=i},Ze=(e,t,A)=>{let i,r,a,n,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,r=e.pending_buf[e.sym_buf+s++],0===i?ze(e,r,t):(a=Se[r],ze(e,a+we+1,t),n=ye[a],0!==n&&(r-=Ge[a],Oe(e,r,n)),i--,a=Ne(i),ze(e,a,A),n=_e[a],0!==n&&(i-=Ue[a],Oe(e,i,n)))}while(s<e.sym_next);ze(e,256,t)},je=(e,t)=>{const A=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.elems;let n,s,o,l=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<a;n++)0!==A[2*n]?(e.heap[++e.heap_len]=l=n,e.depth[n]=0):A[2*n+1]=0;for(;e.heap_len<2;)o=e.heap[++e.heap_len]=l<2?++l:0,A[2*o]=1,e.depth[o]=0,e.opt_len--,r&&(e.static_len-=i[2*o+1]);for(t.max_code=l,n=e.heap_len>>1;n>=1;n--)Ve(e,A,n);o=a;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ve(e,A,1),s=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=s,A[2*o]=A[2*n]+A[2*s],e.depth[o]=(e.depth[n]>=e.depth[s]?e.depth[n]:e.depth[s])+1,A[2*n+1]=A[2*s+1]=o,e.heap[1]=o++,Ve(e,A,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const A=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,a=t.stat_desc.has_stree,n=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,o=t.stat_desc.max_length;let l,g,h,c,f,d,u=0;for(c=0;c<=pe;c++)e.bl_count[c]=0;for(A[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)g=e.heap[l],c=A[2*A[2*g+1]+1]+1,c>o&&(c=o,u++),A[2*g+1]=c,g>i||(e.bl_count[c]++,f=0,g>=s&&(f=n[g-s]),d=A[2*g],e.opt_len+=d*(c+f),a&&(e.static_len+=d*(r[2*g+1]+f)));if(0!==u){do{for(c=o-1;0===e.bl_count[c];)c--;e.bl_count[c]--,e.bl_count[c+1]+=2,e.bl_count[o]--,u-=2}while(u>0);for(c=o;0!==c;c--)for(g=e.bl_count[c];0!==g;)h=e.heap[--l],h>i||(A[2*h+1]!==c&&(e.opt_len+=(c-A[2*h+1])*A[2*h],A[2*h+1]=c),g--)}})(e,t),He(A,l,e.bl_count)},We=(e,t,A)=>{let i,r,a=-1,n=t[1],s=0,o=7,l=4;for(0===n&&(o=138,l=3),t[2*(A+1)+1]=65535,i=0;i<=A;i++)r=n,n=t[2*(i+1)+1],++s<o&&r===n||(s<l?e.bl_tree[2*r]+=s:0!==r?(r!==a&&e.bl_tree[2*r]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,a=r,0===n?(o=138,l=3):r===n?(o=6,l=3):(o=7,l=4))},Xe=(e,t,A)=>{let i,r,a=-1,n=t[1],s=0,o=7,l=4;for(0===n&&(o=138,l=3),i=0;i<=A;i++)if(r=n,n=t[2*(i+1)+1],!(++s<o&&r===n)){if(s<l)do{ze(e,r,e.bl_tree)}while(0!=--s);else 0!==r?(r!==a&&(ze(e,r,e.bl_tree),s--),ze(e,16,e.bl_tree),Oe(e,s-3,2)):s<=10?(ze(e,17,e.bl_tree),Oe(e,s-3,3)):(ze(e,18,e.bl_tree),Oe(e,s-11,7));s=0,a=r,0===n?(o=138,l=3):r===n?(o=6,l=3):(o=7,l=4)}};let $e=!1;const et=(e,t,A,i)=>{Oe(e,0+(i?1:0),3),qe(e),Pe(e,A),Pe(e,~A),A&&e.pending_buf.set(e.window.subarray(t,t+A),e.pending),e.pending+=A};var tt=(e,t,A,i)=>{let r,a,n=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,A=4093624447;for(t=0;t<=31;t++,A>>>=1)if(1&A&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<we;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),je(e,e.l_desc),je(e,e.d_desc),n=(e=>{let t;for(We(e,e.dyn_ltree,e.l_desc.max_code),We(e,e.dyn_dtree,e.d_desc.max_code),je(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*De[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=A+5,A+4<=r&&-1!==t?et(e,t,A,i):4===e.strategy||a===r?(Oe(e,2+(i?1:0),3),Ze(e,ke,ve)):(Oe(e,4+(i?1:0),3),((e,t,A,i)=>{let r;for(Oe(e,t-257,5),Oe(e,A-1,5),Oe(e,i-4,4),r=0;r<i;r++)Oe(e,e.bl_tree[2*De[r]+1],3);Xe(e,e.dyn_ltree,t-1),Xe(e,e.dyn_dtree,A-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,n+1),Ze(e,e.dyn_ltree,e.dyn_dtree)),Je(e),i&&qe(e)},At={_tr_init:e=>{$e||((()=>{let e,t,A,i,r;const a=new Array(16);for(A=0,i=0;i<28;i++)for(Ge[i]=A,e=0;e<1<<ye[i];e++)Se[A++]=i;for(Se[A-1]=i,r=0,i=0;i<16;i++)for(Ue[i]=r,e=0;e<1<<_e[i];e++)xe[r++]=i;for(r>>=7;i<me;i++)for(Ue[i]=r<<7,e=0;e<1<<_e[i]-7;e++)xe[256+r++]=i;for(t=0;t<=pe;t++)a[t]=0;for(e=0;e<=143;)ke[2*e+1]=8,e++,a[8]++;for(;e<=255;)ke[2*e+1]=9,e++,a[9]++;for(;e<=279;)ke[2*e+1]=7,e++,a[7]++;for(;e<=287;)ke[2*e+1]=8,e++,a[8]++;for(He(ke,287,a),e=0;e<me;e++)ve[2*e+1]=5,ve[2*e]=Ke(e,5);Re=new Me(ke,ye,257,Qe,pe),Fe=new Me(ve,_e,0,me,pe),Le=new Me(new Array(0),be,0,19,7)})(),$e=!0),e.l_desc=new Te(e.dyn_ltree,Re),e.d_desc=new Te(e.dyn_dtree,Fe),e.bl_desc=new Te(e.bl_tree,Le),e.bi_buf=0,e.bi_valid=0,Je(e)},_tr_stored_block:et,_tr_flush_block:tt,_tr_tally:(e,t,A)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=A,0===t?e.dyn_ltree[2*A]++:(e.matches++,t--,e.dyn_ltree[2*(Se[A]+we+1)]++,e.dyn_dtree[2*Ne(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Oe(e,2,3),ze(e,256,ke),(e=>{16===e.bi_valid?(Pe(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var it=(e,t,A,i)=>{let r=65535&e|0,a=e>>>16&65535|0,n=0;for(;0!==A;){n=A>2e3?2e3:A,A-=n;do{r=r+t[i++]|0,a=a+r|0}while(--n);r%=65521,a%=65521}return r|a<<16|0};const rt=new Uint32Array((()=>{let e,t=[];for(var A=0;A<256;A++){e=A;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[A]=e}return t})());var at=(e,t,A,i)=>{const r=rt,a=i+A;e^=-1;for(let A=i;A<a;A++)e=e>>>8^r[255&(e^t[A])];return-1^e},nt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},st={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:ot,_tr_stored_block:lt,_tr_flush_block:gt,_tr_tally:ht,_tr_align:ct}=At,{Z_NO_FLUSH:ft,Z_PARTIAL_FLUSH:dt,Z_FULL_FLUSH:ut,Z_FINISH:It,Z_BLOCK:Bt,Z_OK:Ct,Z_STREAM_END:Et,Z_STREAM_ERROR:wt,Z_DATA_ERROR:Qt,Z_BUF_ERROR:mt,Z_DEFAULT_COMPRESSION:pt,Z_FILTERED:yt,Z_HUFFMAN_ONLY:_t,Z_RLE:bt,Z_FIXED:Dt,Z_DEFAULT_STRATEGY:kt,Z_UNKNOWN:vt,Z_DEFLATED:xt}=st,St=258,Gt=262,Ut=42,Mt=113,Rt=666,Ft=(e,t)=>(e.msg=nt[t],t),Lt=e=>2*e-(e>4?9:0),Tt=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Nt=e=>{let t,A,i,r=e.w_size;t=e.hash_size,i=t;do{A=e.head[--i],e.head[i]=A>=r?A-r:0}while(--t);t=r,i=t;do{A=e.prev[--i],e.prev[i]=A>=r?A-r:0}while(--t)};let Pt=(e,t,A)=>(t<<e.hash_shift^A)&e.hash_mask;const Ot=e=>{const t=e.state;let A=t.pending;A>e.avail_out&&(A=e.avail_out),0!==A&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+A),e.next_out),e.next_out+=A,t.pending_out+=A,e.total_out+=A,e.avail_out-=A,t.pending-=A,0===t.pending&&(t.pending_out=0))},zt=(e,t)=>{gt(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Ot(e.strm)},Kt=(e,t)=>{e.pending_buf[e.pending++]=t},Ht=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Jt=(e,t,A,i)=>{let r=e.avail_in;return r>i&&(r=i),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),A),1===e.state.wrap?e.adler=it(e.adler,t,r,A):2===e.state.wrap&&(e.adler=at(e.adler,t,r,A)),e.next_in+=r,e.total_in+=r,r)},qt=(e,t)=>{let A,i,r=e.max_chain_length,a=e.strstart,n=e.prev_length,s=e.nice_match;const o=e.strstart>e.w_size-Gt?e.strstart-(e.w_size-Gt):0,l=e.window,g=e.w_mask,h=e.prev,c=e.strstart+St;let f=l[a+n-1],d=l[a+n];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do{if(A=t,l[A+n]===d&&l[A+n-1]===f&&l[A]===l[a]&&l[++A]===l[a+1]){a+=2,A++;do{}while(l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&a<c);if(i=St-(c-a),a=c-St,i>n){if(e.match_start=t,n=i,i>=s)break;f=l[a+n-1],d=l[a+n]}}}while((t=h[t&g])>o&&0!=--r);return n<=e.lookahead?n:e.lookahead},Yt=e=>{const t=e.w_size;let A,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Gt)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Nt(e),i+=t),0===e.strm.avail_in)break;if(A=Jt(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=A,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=Pt(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=Pt(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Gt&&0!==e.strm.avail_in)},Vt=(e,t)=>{let A,i,r,a=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n=0,s=e.strm.avail_in;do{if(A=65535,r=e.bi_valid+42>>3,e.strm.avail_out<r)break;if(r=e.strm.avail_out-r,i=e.strstart-e.block_start,A>i+e.strm.avail_in&&(A=i+e.strm.avail_in),A>r&&(A=r),A<a&&(0===A&&t!==It||t===ft||A!==i+e.strm.avail_in))break;n=t===It&&A===i+e.strm.avail_in?1:0,lt(e,0,0,n),e.pending_buf[e.pending-4]=A,e.pending_buf[e.pending-3]=A>>8,e.pending_buf[e.pending-2]=~A,e.pending_buf[e.pending-1]=~A>>8,Ot(e.strm),i&&(i>A&&(i=A),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,A-=i),A&&(Jt(e.strm,e.strm.output,e.strm.next_out,A),e.strm.next_out+=A,e.strm.avail_out-=A,e.strm.total_out+=A)}while(0===n);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),n?4:t!==ft&&t!==It&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(r=e.window_size-e.strstart,e.strm.avail_in>r&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(Jt(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water<e.strstart&&(e.high_water=e.strstart),r=e.bi_valid+42>>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,a=r>e.w_size?e.w_size:r,i=e.strstart-e.block_start,(i>=a||(i||t===It)&&t!==ft&&0===e.strm.avail_in&&i<=r)&&(A=i>r?r:i,n=t===It&&0===e.strm.avail_in&&A===i?1:0,lt(e,e.block_start,A,n),e.block_start+=A,Ot(e.strm)),n?3:1)},Zt=(e,t)=>{let A,i;for(;;){if(e.lookahead<Gt){if(Yt(e),e.lookahead<Gt&&t===ft)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Pt(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==A&&e.strstart-A<=e.w_size-Gt&&(e.match_length=qt(e,A)),e.match_length>=3)if(i=ht(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Pt(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Pt(e,e.ins_h,e.window[e.strstart+1]);else i=ht(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(zt(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===It?(zt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(zt(e,!1),0===e.strm.avail_out)?1:2},jt=(e,t)=>{let A,i,r;for(;;){if(e.lookahead<Gt){if(Yt(e),e.lookahead<Gt&&t===ft)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Pt(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==A&&e.prev_length<e.max_lazy_match&&e.strstart-A<=e.w_size-Gt&&(e.match_length=qt(e,A),e.match_length<=5&&(e.strategy===yt||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,i=ht(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=Pt(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(zt(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=ht(e,0,e.window[e.strstart-1]),i&&zt(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=ht(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===It?(zt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(zt(e,!1),0===e.strm.avail_out)?1:2};function Wt(e,t,A,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=A,this.max_chain=i,this.func=r}const Xt=[new Wt(0,0,0,0,Vt),new Wt(4,4,8,4,Zt),new Wt(4,5,16,8,Zt),new Wt(4,6,32,32,Zt),new Wt(4,4,16,16,jt),new Wt(8,16,32,32,jt),new Wt(8,16,128,128,jt),new Wt(8,32,128,256,jt),new Wt(32,128,258,1024,jt),new Wt(32,258,258,4096,jt)];function $t(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=xt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Tt(this.dyn_ltree),Tt(this.dyn_dtree),Tt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Tt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Tt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const eA=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Ut&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Mt&&t.status!==Rt?1:0},tA=e=>{if(eA(e))return Ft(e,wt);e.total_in=e.total_out=0,e.data_type=vt;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Ut:Mt,e.adler=2===t.wrap?0:1,t.last_flush=-2,ot(t),Ct},AA=e=>{const t=tA(e);var A;return t===Ct&&((A=e.state).window_size=2*A.w_size,Tt(A.head),A.max_lazy_match=Xt[A.level].max_lazy,A.good_match=Xt[A.level].good_length,A.nice_match=Xt[A.level].nice_length,A.max_chain_length=Xt[A.level].max_chain,A.strstart=0,A.block_start=0,A.lookahead=0,A.insert=0,A.match_length=A.prev_length=2,A.match_available=0,A.ins_h=0),t},iA=(e,t,A,i,r,a)=>{if(!e)return wt;let n=1;if(t===pt&&(t=6),i<0?(n=0,i=-i):i>15&&(n=2,i-=16),r<1||r>9||A!==xt||i<8||i>15||t<0||t>9||a<0||a>Dt||8===i&&1!==n)return Ft(e,wt);8===i&&(i=9);const s=new $t;return e.state=s,s.strm=e,s.status=Ut,s.wrap=n,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=r+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<r+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=a,s.method=A,AA(e)};var rA={deflateInit:(e,t)=>iA(e,t,xt,15,8,kt),deflateInit2:iA,deflateReset:AA,deflateResetKeep:tA,deflateSetHeader:(e,t)=>eA(e)||2!==e.state.wrap?wt:(e.state.gzhead=t,Ct),deflate:(e,t)=>{if(eA(e)||t>Bt||t<0)return e?Ft(e,wt):wt;const A=e.state;if(!e.output||0!==e.avail_in&&!e.input||A.status===Rt&&t!==It)return Ft(e,0===e.avail_out?mt:wt);const i=A.last_flush;if(A.last_flush=t,0!==A.pending){if(Ot(e),0===e.avail_out)return A.last_flush=-1,Ct}else if(0===e.avail_in&&Lt(t)<=Lt(i)&&t!==It)return Ft(e,mt);if(A.status===Rt&&0!==e.avail_in)return Ft(e,mt);if(A.status===Ut&&0===A.wrap&&(A.status=Mt),A.status===Ut){let t=xt+(A.w_bits-8<<4)<<8,i=-1;if(i=A.strategy>=_t||A.level<2?0:A.level<6?1:6===A.level?2:3,t|=i<<6,0!==A.strstart&&(t|=32),t+=31-t%31,Ht(A,t),0!==A.strstart&&(Ht(A,e.adler>>>16),Ht(A,65535&e.adler)),e.adler=1,A.status=Mt,Ot(e),0!==A.pending)return A.last_flush=-1,Ct}if(57===A.status)if(e.adler=0,Kt(A,31),Kt(A,139),Kt(A,8),A.gzhead)Kt(A,(A.gzhead.text?1:0)+(A.gzhead.hcrc?2:0)+(A.gzhead.extra?4:0)+(A.gzhead.name?8:0)+(A.gzhead.comment?16:0)),Kt(A,255&A.gzhead.time),Kt(A,A.gzhead.time>>8&255),Kt(A,A.gzhead.time>>16&255),Kt(A,A.gzhead.time>>24&255),Kt(A,9===A.level?2:A.strategy>=_t||A.level<2?4:0),Kt(A,255&A.gzhead.os),A.gzhead.extra&&A.gzhead.extra.length&&(Kt(A,255&A.gzhead.extra.length),Kt(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(e.adler=at(e.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=69;else if(Kt(A,0),Kt(A,0),Kt(A,0),Kt(A,0),Kt(A,0),Kt(A,9===A.level?2:A.strategy>=_t||A.level<2?4:0),Kt(A,3),A.status=Mt,Ot(e),0!==A.pending)return A.last_flush=-1,Ct;if(69===A.status){if(A.gzhead.extra){let t=A.pending,i=(65535&A.gzhead.extra.length)-A.gzindex;for(;A.pending+i>A.pending_buf_size;){let r=A.pending_buf_size-A.pending;if(A.pending_buf.set(A.gzhead.extra.subarray(A.gzindex,A.gzindex+r),A.pending),A.pending=A.pending_buf_size,A.gzhead.hcrc&&A.pending>t&&(e.adler=at(e.adler,A.pending_buf,A.pending-t,t)),A.gzindex+=r,Ot(e),0!==A.pending)return A.last_flush=-1,Ct;t=0,i-=r}let r=new Uint8Array(A.gzhead.extra);A.pending_buf.set(r.subarray(A.gzindex,A.gzindex+i),A.pending),A.pending+=i,A.gzhead.hcrc&&A.pending>t&&(e.adler=at(e.adler,A.pending_buf,A.pending-t,t)),A.gzindex=0}A.status=73}if(73===A.status){if(A.gzhead.name){let t,i=A.pending;do{if(A.pending===A.pending_buf_size){if(A.gzhead.hcrc&&A.pending>i&&(e.adler=at(e.adler,A.pending_buf,A.pending-i,i)),Ot(e),0!==A.pending)return A.last_flush=-1,Ct;i=0}t=A.gzindex<A.gzhead.name.length?255&A.gzhead.name.charCodeAt(A.gzindex++):0,Kt(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=at(e.adler,A.pending_buf,A.pending-i,i)),A.gzindex=0}A.status=91}if(91===A.status){if(A.gzhead.comment){let t,i=A.pending;do{if(A.pending===A.pending_buf_size){if(A.gzhead.hcrc&&A.pending>i&&(e.adler=at(e.adler,A.pending_buf,A.pending-i,i)),Ot(e),0!==A.pending)return A.last_flush=-1,Ct;i=0}t=A.gzindex<A.gzhead.comment.length?255&A.gzhead.comment.charCodeAt(A.gzindex++):0,Kt(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=at(e.adler,A.pending_buf,A.pending-i,i))}A.status=103}if(103===A.status){if(A.gzhead.hcrc){if(A.pending+2>A.pending_buf_size&&(Ot(e),0!==A.pending))return A.last_flush=-1,Ct;Kt(A,255&e.adler),Kt(A,e.adler>>8&255),e.adler=0}if(A.status=Mt,Ot(e),0!==A.pending)return A.last_flush=-1,Ct}if(0!==e.avail_in||0!==A.lookahead||t!==ft&&A.status!==Rt){let i=0===A.level?Vt(A,t):A.strategy===_t?((e,t)=>{let A;for(;;){if(0===e.lookahead&&(Yt(e),0===e.lookahead)){if(t===ft)return 1;break}if(e.match_length=0,A=ht(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,A&&(zt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===It?(zt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(zt(e,!1),0===e.strm.avail_out)?1:2})(A,t):A.strategy===bt?((e,t)=>{let A,i,r,a;const n=e.window;for(;;){if(e.lookahead<=St){if(Yt(e),e.lookahead<=St&&t===ft)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,i=n[r],i===n[++r]&&i===n[++r]&&i===n[++r])){a=e.strstart+St;do{}while(i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&r<a);e.match_length=St-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(A=ht(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(A=ht(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),A&&(zt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===It?(zt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(zt(e,!1),0===e.strm.avail_out)?1:2})(A,t):Xt[A.level].func(A,t);if(3!==i&&4!==i||(A.status=Rt),1===i||3===i)return 0===e.avail_out&&(A.last_flush=-1),Ct;if(2===i&&(t===dt?ct(A):t!==Bt&&(lt(A,0,0,!1),t===ut&&(Tt(A.head),0===A.lookahead&&(A.strstart=0,A.block_start=0,A.insert=0))),Ot(e),0===e.avail_out))return A.last_flush=-1,Ct}return t!==It?Ct:A.wrap<=0?Et:(2===A.wrap?(Kt(A,255&e.adler),Kt(A,e.adler>>8&255),Kt(A,e.adler>>16&255),Kt(A,e.adler>>24&255),Kt(A,255&e.total_in),Kt(A,e.total_in>>8&255),Kt(A,e.total_in>>16&255),Kt(A,e.total_in>>24&255)):(Ht(A,e.adler>>>16),Ht(A,65535&e.adler)),Ot(e),A.wrap>0&&(A.wrap=-A.wrap),0!==A.pending?Ct:Et)},deflateEnd:e=>{if(eA(e))return wt;const t=e.state.status;return e.state=null,t===Mt?Ft(e,Qt):Ct},deflateSetDictionary:(e,t)=>{let A=t.length;if(eA(e))return wt;const i=e.state,r=i.wrap;if(2===r||1===r&&i.status!==Ut||i.lookahead)return wt;if(1===r&&(e.adler=it(e.adler,t,A,0)),i.wrap=0,A>=i.w_size){0===r&&(Tt(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(A-i.w_size,A),0),t=e,A=i.w_size}const a=e.avail_in,n=e.next_in,s=e.input;for(e.avail_in=A,e.next_in=0,e.input=t,Yt(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=Pt(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,Yt(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=n,e.input=s,e.avail_in=a,i.wrap=r,Ct},deflateInfo:"pako deflate (from Nodeca project)"};const aA=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var nA={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const A=t.shift();if(A){if("object"!=typeof A)throw new TypeError(A+"must be non-object");for(const t in A)aA(A,t)&&(e[t]=A[t])}}return e},flattenChunks:e=>{let t=0;for(let A=0,i=e.length;A<i;A++)t+=e[A].length;const A=new Uint8Array(t);for(let t=0,i=0,r=e.length;t<r;t++){let r=e[t];A.set(r,i),i+=r.length}return A}};let sA=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){sA=!1}const oA=new Uint8Array(256);for(let e=0;e<256;e++)oA[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;oA[254]=oA[254]=1;var lA={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,A,i,r,a,n=e.length,s=0;for(r=0;r<n;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<n&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(A=65536+(A-55296<<10)+(i-56320),r++)),s+=A<128?1:A<2048?2:A<65536?3:4;for(t=new Uint8Array(s),a=0,r=0;a<s;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<n&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(A=65536+(A-55296<<10)+(i-56320),r++)),A<128?t[a++]=A:A<2048?(t[a++]=192|A>>>6,t[a++]=128|63&A):A<65536?(t[a++]=224|A>>>12,t[a++]=128|A>>>6&63,t[a++]=128|63&A):(t[a++]=240|A>>>18,t[a++]=128|A>>>12&63,t[a++]=128|A>>>6&63,t[a++]=128|63&A);return t},buf2string:(e,t)=>{const A=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,r;const a=new Array(2*A);for(r=0,i=0;i<A;){let t=e[i++];if(t<128){a[r++]=t;continue}let n=oA[t];if(n>4)a[r++]=65533,i+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&i<A;)t=t<<6|63&e[i++],n--;n>1?a[r++]=65533:t<65536?a[r++]=t:(t-=65536,a[r++]=55296|t>>10&1023,a[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&sA)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let A="";for(let i=0;i<t;i++)A+=String.fromCharCode(e[i]);return A})(a,r)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let A=t-1;for(;A>=0&&128==(192&e[A]);)A--;return A<0||0===A?t:A+oA[e[A]]>t?A:t}};var gA=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const hA=Object.prototype.toString,{Z_NO_FLUSH:cA,Z_SYNC_FLUSH:fA,Z_FULL_FLUSH:dA,Z_FINISH:uA,Z_OK:IA,Z_STREAM_END:BA,Z_DEFAULT_COMPRESSION:CA,Z_DEFAULT_STRATEGY:EA,Z_DEFLATED:wA}=st;function QA(e){this.options=nA.assign({level:CA,method:wA,chunkSize:16384,windowBits:15,memLevel:8,strategy:EA},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gA,this.strm.avail_out=0;let A=rA.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(A!==IA)throw new Error(nt[A]);if(t.header&&rA.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?lA.string2buf(t.dictionary):"[object ArrayBuffer]"===hA.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,A=rA.deflateSetDictionary(this.strm,e),A!==IA)throw new Error(nt[A]);this._dict_set=!0}}QA.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize;let r,a;if(this.ended)return!1;for(a=t===~~t?t:!0===t?uA:cA,"string"==typeof e?A.input=lA.string2buf(e):"[object ArrayBuffer]"===hA.call(e)?A.input=new Uint8Array(e):A.input=e,A.next_in=0,A.avail_in=A.input.length;;)if(0===A.avail_out&&(A.output=new Uint8Array(i),A.next_out=0,A.avail_out=i),(a===fA||a===dA)&&A.avail_out<=6)this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;else{if(r=rA.deflate(A,a),r===BA)return A.next_out>0&&this.onData(A.output.subarray(0,A.next_out)),r=rA.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===IA;if(0!==A.avail_out){if(a>0&&A.next_out>0)this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;else if(0===A.avail_in)break}else this.onData(A.output)}return!0},QA.prototype.onData=function(e){this.chunks.push(e)},QA.prototype.onEnd=function(e){e===IA&&(this.result=nA.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const mA=16209;var pA=function(e,t){let A,i,r,a,n,s,o,l,g,h,c,f,d,u,I,B,C,E,w,Q,m,p,y,_;const b=e.state;A=e.next_in,y=e.input,i=A+(e.avail_in-5),r=e.next_out,_=e.output,a=r-(t-e.avail_out),n=r+(e.avail_out-257),s=b.dmax,o=b.wsize,l=b.whave,g=b.wnext,h=b.window,c=b.hold,f=b.bits,d=b.lencode,u=b.distcode,I=(1<<b.lenbits)-1,B=(1<<b.distbits)-1;e:do{f<15&&(c+=y[A++]<<f,f+=8,c+=y[A++]<<f,f+=8),C=d[c&I];t:for(;;){if(E=C>>>24,c>>>=E,f-=E,E=C>>>16&255,0===E)_[r++]=65535&C;else{if(!(16&E)){if(0==(64&E)){C=d[(65535&C)+(c&(1<<E)-1)];continue t}if(32&E){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=mA;break e}w=65535&C,E&=15,E&&(f<E&&(c+=y[A++]<<f,f+=8),w+=c&(1<<E)-1,c>>>=E,f-=E),f<15&&(c+=y[A++]<<f,f+=8,c+=y[A++]<<f,f+=8),C=u[c&B];A:for(;;){if(E=C>>>24,c>>>=E,f-=E,E=C>>>16&255,!(16&E)){if(0==(64&E)){C=u[(65535&C)+(c&(1<<E)-1)];continue A}e.msg="invalid distance code",b.mode=mA;break e}if(Q=65535&C,E&=15,f<E&&(c+=y[A++]<<f,f+=8,f<E&&(c+=y[A++]<<f,f+=8)),Q+=c&(1<<E)-1,Q>s){e.msg="invalid distance too far back",b.mode=mA;break e}if(c>>>=E,f-=E,E=r-a,Q>E){if(E=Q-E,E>l&&b.sane){e.msg="invalid distance too far back",b.mode=mA;break e}if(m=0,p=h,0===g){if(m+=o-E,E<w){w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}}else if(g<E){if(m+=o+g-E,E-=g,E<w){w-=E;do{_[r++]=h[m++]}while(--E);if(m=0,g<w){E=g,w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}}}else if(m+=g-E,E<w){w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}for(;w>2;)_[r++]=p[m++],_[r++]=p[m++],_[r++]=p[m++],w-=3;w&&(_[r++]=p[m++],w>1&&(_[r++]=p[m++]))}else{m=r-Q;do{_[r++]=_[m++],_[r++]=_[m++],_[r++]=_[m++],w-=3}while(w>2);w&&(_[r++]=_[m++],w>1&&(_[r++]=_[m++]))}break}}break}}while(A<i&&r<n);w=f>>3,A-=w,f-=w<<3,c&=(1<<f)-1,e.next_in=A,e.next_out=r,e.avail_in=A<i?i-A+5:5-(A-i),e.avail_out=r<n?n-r+257:257-(r-n),b.hold=c,b.bits=f};const yA=15,_A=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),bA=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),DA=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),kA=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var vA=(e,t,A,i,r,a,n,s)=>{const o=s.bits;let l,g,h,c,f,d,u=0,I=0,B=0,C=0,E=0,w=0,Q=0,m=0,p=0,y=0,_=null;const b=new Uint16Array(16),D=new Uint16Array(16);let k,v,x,S=null;for(u=0;u<=yA;u++)b[u]=0;for(I=0;I<i;I++)b[t[A+I]]++;for(E=o,C=yA;C>=1&&0===b[C];C--);if(E>C&&(E=C),0===C)return r[a++]=20971520,r[a++]=20971520,s.bits=1,0;for(B=1;B<C&&0===b[B];B++);for(E<B&&(E=B),m=1,u=1;u<=yA;u++)if(m<<=1,m-=b[u],m<0)return-1;if(m>0&&(0===e||1!==C))return-1;for(D[1]=0,u=1;u<yA;u++)D[u+1]=D[u]+b[u];for(I=0;I<i;I++)0!==t[A+I]&&(n[D[t[A+I]]++]=I);if(0===e?(_=S=n,d=20):1===e?(_=_A,S=bA,d=257):(_=DA,S=kA,d=0),y=0,I=0,u=B,f=a,w=E,Q=0,h=-1,p=1<<E,c=p-1,1===e&&p>852||2===e&&p>592)return 1;for(;;){k=u-Q,n[I]+1<d?(v=0,x=n[I]):n[I]>=d?(v=S[n[I]-d],x=_[n[I]-d]):(v=96,x=0),l=1<<u-Q,g=1<<w,B=g;do{g-=l,r[f+(y>>Q)+g]=k<<24|v<<16|x|0}while(0!==g);for(l=1<<u-1;y&l;)l>>=1;if(0!==l?(y&=l-1,y+=l):y=0,I++,0==--b[u]){if(u===C)break;u=t[A+n[I]]}if(u>E&&(y&c)!==h){for(0===Q&&(Q=E),f+=B,w=u-Q,m=1<<w;w+Q<C&&(m-=b[w+Q],!(m<=0));)w++,m<<=1;if(p+=1<<w,1===e&&p>852||2===e&&p>592)return 1;h=y&c,r[h]=E<<24|w<<16|f-a|0}}return 0!==y&&(r[f+y]=u-Q<<24|64<<16|0),s.bits=E,0};const{Z_FINISH:xA,Z_BLOCK:SA,Z_TREES:GA,Z_OK:UA,Z_STREAM_END:MA,Z_NEED_DICT:RA,Z_STREAM_ERROR:FA,Z_DATA_ERROR:LA,Z_MEM_ERROR:TA,Z_BUF_ERROR:NA,Z_DEFLATED:PA}=st,OA=16180,zA=16190,KA=16191,HA=16192,JA=16194,qA=16199,YA=16200,VA=16206,ZA=16209,jA=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function WA(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const XA=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<OA||t.mode>16211?1:0},$A=e=>{if(XA(e))return FA;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=OA,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,UA},ei=e=>{if(XA(e))return FA;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,$A(e)},ti=(e,t)=>{let A;if(XA(e))return FA;const i=e.state;return t<0?(A=0,t=-t):(A=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?FA:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=A,i.wbits=t,ei(e))},Ai=(e,t)=>{if(!e)return FA;const A=new WA;e.state=A,A.strm=e,A.window=null,A.mode=OA;const i=ti(e,t);return i!==UA&&(e.state=null),i};let ii,ri,ai=!0;const ni=e=>{if(ai){ii=new Int32Array(512),ri=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(vA(1,e.lens,0,288,ii,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;vA(2,e.lens,0,32,ri,0,e.work,{bits:5}),ai=!1}e.lencode=ii,e.lenbits=9,e.distcode=ri,e.distbits=5},si=(e,t,A,i)=>{let r;const a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(t.subarray(A-a.wsize,A),0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>i&&(r=i),a.window.set(t.subarray(A-i,A-i+r),a.wnext),(i-=r)?(a.window.set(t.subarray(A-i,A),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0};var oi={inflateReset:ei,inflateReset2:ti,inflateResetKeep:$A,inflateInit:e=>Ai(e,15),inflateInit2:Ai,inflate:(e,t)=>{let A,i,r,a,n,s,o,l,g,h,c,f,d,u,I,B,C,E,w,Q,m,p,y=0;const _=new Uint8Array(4);let b,D;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(XA(e)||!e.output||!e.input&&0!==e.avail_in)return FA;A=e.state,A.mode===KA&&(A.mode=HA),n=e.next_out,r=e.output,o=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,h=s,c=o,p=UA;e:for(;;)switch(A.mode){case OA:if(0===A.wrap){A.mode=HA;break}for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(2&A.wrap&&35615===l){0===A.wbits&&(A.wbits=15),A.check=0,_[0]=255&l,_[1]=l>>>8&255,A.check=at(A.check,_,2,0),l=0,g=0,A.mode=16181;break}if(A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",A.mode=ZA;break}if((15&l)!==PA){e.msg="unknown compression method",A.mode=ZA;break}if(l>>>=4,g-=4,m=8+(15&l),0===A.wbits&&(A.wbits=m),m>15||m>A.wbits){e.msg="invalid window size",A.mode=ZA;break}A.dmax=1<<A.wbits,A.flags=0,e.adler=A.check=1,A.mode=512&l?16189:KA,l=0,g=0;break;case 16181:for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(A.flags=l,(255&A.flags)!==PA){e.msg="unknown compression method",A.mode=ZA;break}if(57344&A.flags){e.msg="unknown header flags set",A.mode=ZA;break}A.head&&(A.head.text=l>>8&1),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=at(A.check,_,2,0)),l=0,g=0,A.mode=16182;case 16182:for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.head&&(A.head.time=l),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,_[2]=l>>>16&255,_[3]=l>>>24&255,A.check=at(A.check,_,4,0)),l=0,g=0,A.mode=16183;case 16183:for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.head&&(A.head.xflags=255&l,A.head.os=l>>8),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=at(A.check,_,2,0)),l=0,g=0,A.mode=16184;case 16184:if(1024&A.flags){for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.length=l,A.head&&(A.head.extra_len=l),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=at(A.check,_,2,0)),l=0,g=0}else A.head&&(A.head.extra=null);A.mode=16185;case 16185:if(1024&A.flags&&(f=A.length,f>s&&(f=s),f&&(A.head&&(m=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Uint8Array(A.head.extra_len)),A.head.extra.set(i.subarray(a,a+f),m)),512&A.flags&&4&A.wrap&&(A.check=at(A.check,i,f,a)),s-=f,a+=f,A.length-=f),A.length))break e;A.length=0,A.mode=16186;case 16186:if(2048&A.flags){if(0===s)break e;f=0;do{m=i[a+f++],A.head&&m&&A.length<65536&&(A.head.name+=String.fromCharCode(m))}while(m&&f<s);if(512&A.flags&&4&A.wrap&&(A.check=at(A.check,i,f,a)),s-=f,a+=f,m)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=16187;case 16187:if(4096&A.flags){if(0===s)break e;f=0;do{m=i[a+f++],A.head&&m&&A.length<65536&&(A.head.comment+=String.fromCharCode(m))}while(m&&f<s);if(512&A.flags&&4&A.wrap&&(A.check=at(A.check,i,f,a)),s-=f,a+=f,m)break e}else A.head&&(A.head.comment=null);A.mode=16188;case 16188:if(512&A.flags){for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(4&A.wrap&&l!==(65535&A.check)){e.msg="header crc mismatch",A.mode=ZA;break}l=0,g=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),e.adler=A.check=0,A.mode=KA;break;case 16189:for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}e.adler=A.check=jA(l),l=0,g=0,A.mode=zA;case zA:if(0===A.havedict)return e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,RA;e.adler=A.check=1,A.mode=KA;case KA:if(t===SA||t===GA)break e;case HA:if(A.last){l>>>=7&g,g-=7&g,A.mode=VA;break}for(;g<3;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}switch(A.last=1&l,l>>>=1,g-=1,3&l){case 0:A.mode=16193;break;case 1:if(ni(A),A.mode=qA,t===GA){l>>>=2,g-=2;break e}break;case 2:A.mode=16196;break;case 3:e.msg="invalid block type",A.mode=ZA}l>>>=2,g-=2;break;case 16193:for(l>>>=7&g,g-=7&g;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",A.mode=ZA;break}if(A.length=65535&l,l=0,g=0,A.mode=JA,t===GA)break e;case JA:A.mode=16195;case 16195:if(f=A.length,f){if(f>s&&(f=s),f>o&&(f=o),0===f)break e;r.set(i.subarray(a,a+f),n),s-=f,a+=f,o-=f,n+=f,A.length-=f;break}A.mode=KA;break;case 16196:for(;g<14;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(A.nlen=257+(31&l),l>>>=5,g-=5,A.ndist=1+(31&l),l>>>=5,g-=5,A.ncode=4+(15&l),l>>>=4,g-=4,A.nlen>286||A.ndist>30){e.msg="too many length or distance symbols",A.mode=ZA;break}A.have=0,A.mode=16197;case 16197:for(;A.have<A.ncode;){for(;g<3;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.lens[k[A.have++]]=7&l,l>>>=3,g-=3}for(;A.have<19;)A.lens[k[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,b={bits:A.lenbits},p=vA(0,A.lens,0,19,A.lencode,0,A.work,b),A.lenbits=b.bits,p){e.msg="invalid code lengths set",A.mode=ZA;break}A.have=0,A.mode=16198;case 16198:for(;A.have<A.nlen+A.ndist;){for(;y=A.lencode[l&(1<<A.lenbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(C<16)l>>>=I,g-=I,A.lens[A.have++]=C;else{if(16===C){for(D=I+2;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(l>>>=I,g-=I,0===A.have){e.msg="invalid bit length repeat",A.mode=ZA;break}m=A.lens[A.have-1],f=3+(3&l),l>>>=2,g-=2}else if(17===C){for(D=I+3;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=I,g-=I,m=0,f=3+(7&l),l>>>=3,g-=3}else{for(D=I+7;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=I,g-=I,m=0,f=11+(127&l),l>>>=7,g-=7}if(A.have+f>A.nlen+A.ndist){e.msg="invalid bit length repeat",A.mode=ZA;break}for(;f--;)A.lens[A.have++]=m}}if(A.mode===ZA)break;if(0===A.lens[256]){e.msg="invalid code -- missing end-of-block",A.mode=ZA;break}if(A.lenbits=9,b={bits:A.lenbits},p=vA(1,A.lens,0,A.nlen,A.lencode,0,A.work,b),A.lenbits=b.bits,p){e.msg="invalid literal/lengths set",A.mode=ZA;break}if(A.distbits=6,A.distcode=A.distdyn,b={bits:A.distbits},p=vA(2,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,b),A.distbits=b.bits,p){e.msg="invalid distances set",A.mode=ZA;break}if(A.mode=qA,t===GA)break e;case qA:A.mode=YA;case YA:if(s>=6&&o>=258){e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,pA(e,c),n=e.next_out,r=e.output,o=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,A.mode===KA&&(A.back=-1);break}for(A.back=0;y=A.lencode[l&(1<<A.lenbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(B&&0==(240&B)){for(E=I,w=B,Q=C;y=A.lencode[Q+((l&(1<<E+w)-1)>>E)],I=y>>>24,B=y>>>16&255,C=65535&y,!(E+I<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=I,g-=I,A.back+=I,A.length=C,0===B){A.mode=16205;break}if(32&B){A.back=-1,A.mode=KA;break}if(64&B){e.msg="invalid literal/length code",A.mode=ZA;break}A.extra=15&B,A.mode=16201;case 16201:if(A.extra){for(D=A.extra;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.length+=l&(1<<A.extra)-1,l>>>=A.extra,g-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=16202;case 16202:for(;y=A.distcode[l&(1<<A.distbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(0==(240&B)){for(E=I,w=B,Q=C;y=A.distcode[Q+((l&(1<<E+w)-1)>>E)],I=y>>>24,B=y>>>16&255,C=65535&y,!(E+I<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=I,g-=I,A.back+=I,64&B){e.msg="invalid distance code",A.mode=ZA;break}A.offset=C,A.extra=15&B,A.mode=16203;case 16203:if(A.extra){for(D=A.extra;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.offset+=l&(1<<A.extra)-1,l>>>=A.extra,g-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){e.msg="invalid distance too far back",A.mode=ZA;break}A.mode=16204;case 16204:if(0===o)break e;if(f=c-o,A.offset>f){if(f=A.offset-f,f>A.whave&&A.sane){e.msg="invalid distance too far back",A.mode=ZA;break}f>A.wnext?(f-=A.wnext,d=A.wsize-f):d=A.wnext-f,f>A.length&&(f=A.length),u=A.window}else u=r,d=n-A.offset,f=A.length;f>o&&(f=o),o-=f,A.length-=f;do{r[n++]=u[d++]}while(--f);0===A.length&&(A.mode=YA);break;case 16205:if(0===o)break e;r[n++]=A.length,o--,A.mode=YA;break;case VA:if(A.wrap){for(;g<32;){if(0===s)break e;s--,l|=i[a++]<<g,g+=8}if(c-=o,e.total_out+=c,A.total+=c,4&A.wrap&&c&&(e.adler=A.check=A.flags?at(A.check,r,c,n-c):it(A.check,r,c,n-c)),c=o,4&A.wrap&&(A.flags?l:jA(l))!==A.check){e.msg="incorrect data check",A.mode=ZA;break}l=0,g=0}A.mode=16207;case 16207:if(A.wrap&&A.flags){for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(4&A.wrap&&l!==(4294967295&A.total)){e.msg="incorrect length check",A.mode=ZA;break}l=0,g=0}A.mode=16208;case 16208:p=MA;break e;case ZA:p=LA;break e;case 16210:return TA;default:return FA}return e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,(A.wsize||c!==e.avail_out&&A.mode<ZA&&(A.mode<VA||t!==xA))&&si(e,e.output,e.next_out,c-e.avail_out),h-=e.avail_in,c-=e.avail_out,e.total_in+=h,e.total_out+=c,A.total+=c,4&A.wrap&&c&&(e.adler=A.check=A.flags?at(A.check,r,c,e.next_out-c):it(A.check,r,c,e.next_out-c)),e.data_type=A.bits+(A.last?64:0)+(A.mode===KA?128:0)+(A.mode===qA||A.mode===JA?256:0),(0===h&&0===c||t===xA)&&p===UA&&(p=NA),p},inflateEnd:e=>{if(XA(e))return FA;let t=e.state;return t.window&&(t.window=null),e.state=null,UA},inflateGetHeader:(e,t)=>{if(XA(e))return FA;const A=e.state;return 0==(2&A.wrap)?FA:(A.head=t,t.done=!1,UA)},inflateSetDictionary:(e,t)=>{const A=t.length;let i,r,a;return XA(e)?FA:(i=e.state,0!==i.wrap&&i.mode!==zA?FA:i.mode===zA&&(r=1,r=it(r,t,A,0),r!==i.check)?LA:(a=si(e,t,A,A),a?(i.mode=16210,TA):(i.havedict=1,UA)))},inflateInfo:"pako inflate (from Nodeca project)"};var li=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const gi=Object.prototype.toString,{Z_NO_FLUSH:hi,Z_FINISH:ci,Z_OK:fi,Z_STREAM_END:di,Z_NEED_DICT:ui,Z_STREAM_ERROR:Ii,Z_DATA_ERROR:Bi,Z_MEM_ERROR:Ci}=st;function Ei(e){this.options=nA.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gA,this.strm.avail_out=0;let A=oi.inflateInit2(this.strm,t.windowBits);if(A!==fi)throw new Error(nt[A]);if(this.header=new li,oi.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=lA.string2buf(t.dictionary):"[object ArrayBuffer]"===gi.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(A=oi.inflateSetDictionary(this.strm,t.dictionary),A!==fi)))throw new Error(nt[A])}function wi(e,t){const A=new Ei(t);if(A.push(e),A.err)throw A.msg||nt[A.err];return A.result}Ei.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let a,n,s;if(this.ended)return!1;for(n=t===~~t?t:!0===t?ci:hi,"[object ArrayBuffer]"===gi.call(e)?A.input=new Uint8Array(e):A.input=e,A.next_in=0,A.avail_in=A.input.length;;){for(0===A.avail_out&&(A.output=new Uint8Array(i),A.next_out=0,A.avail_out=i),a=oi.inflate(A,n),a===ui&&r&&(a=oi.inflateSetDictionary(A,r),a===fi?a=oi.inflate(A,n):a===Bi&&(a=ui));A.avail_in>0&&a===di&&A.state.wrap>0&&0!==e[A.next_in];)oi.inflateReset(A),a=oi.inflate(A,n);switch(a){case Ii:case Bi:case ui:case Ci:return this.onEnd(a),this.ended=!0,!1}if(s=A.avail_out,A.next_out&&(0===A.avail_out||a===di))if("string"===this.options.to){let e=lA.utf8border(A.output,A.next_out),t=A.next_out-e,r=lA.buf2string(A.output,e);A.next_out=t,A.avail_out=i-t,t&&A.output.set(A.output.subarray(e,e+t),0),this.onData(r)}else this.onData(A.output.length===A.next_out?A.output:A.output.subarray(0,A.next_out));if(a!==fi||0!==s){if(a===di)return a=oi.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===A.avail_in)break}}return!0},Ei.prototype.onData=function(e){this.chunks.push(e)},Ei.prototype.onEnd=function(e){e===fi&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=nA.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Qi={Inflate:Ei,inflate:wi,inflateRaw:function(e,t){return(t=t||{}).raw=!0,wi(e,t)},ungzip:wi,constants:st};const{Inflate:mi,inflate:pi,inflateRaw:yi,ungzip:_i}=Qi;var bi=pi;function Di(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ki={exports:{}};!function(e){function t(e){var t,A,i,r,a,n=Math.floor,s=new Array(64),o=new Array(64),l=new Array(64),g=new Array(64),h=new Array(65535),c=new Array(65535),f=new Array(64),d=new Array(64),u=[],I=0,B=7,C=new Array(64),E=new Array(64),w=new Array(64),Q=new Array(256),m=new Array(2048),p=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],y=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],_=[0,1,2,3,4,5,6,7,8,9,10,11],b=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],D=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],k=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],v=[0,1,2,3,4,5,6,7,8,9,10,11],x=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],S=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function G(e,t){for(var A=0,i=0,r=new Array,a=1;a<=16;a++){for(var n=1;n<=e[a];n++)r[t[i]]=[],r[t[i]][0]=A,r[t[i]][1]=a,i++,A++;A*=2}return r}function U(e){for(var t=e[0],A=e[1]-1;A>=0;)t&1<<A&&(I|=1<<B),A--,--B<0&&(255==I?(M(255),M(0)):M(I),B=7,I=0)}function M(e){u.push(e)}function R(e){M(e>>8&255),M(255&e)}function F(e,t,A,i,r){for(var a,n=r[0],s=r[240],o=function(e,t){var A,i,r,a,n,s,o,l,g,h,c=0;for(g=0;g<8;++g){A=e[c],i=e[c+1],r=e[c+2],a=e[c+3],n=e[c+4],s=e[c+5],o=e[c+6];var d=A+(l=e[c+7]),u=A-l,I=i+o,B=i-o,C=r+s,E=r-s,w=a+n,Q=a-n,m=d+w,p=d-w,y=I+C,_=I-C;e[c]=m+y,e[c+4]=m-y;var b=.707106781*(_+p);e[c+2]=p+b,e[c+6]=p-b;var D=.382683433*((m=Q+E)-(_=B+u)),k=.5411961*m+D,v=1.306562965*_+D,x=.707106781*(y=E+B),S=u+x,G=u-x;e[c+5]=G+k,e[c+3]=G-k,e[c+1]=S+v,e[c+7]=S-v,c+=8}for(c=0,g=0;g<8;++g){A=e[c],i=e[c+8],r=e[c+16],a=e[c+24],n=e[c+32],s=e[c+40],o=e[c+48];var U=A+(l=e[c+56]),M=A-l,R=i+o,F=i-o,L=r+s,T=r-s,N=a+n,P=a-n,O=U+N,z=U-N,K=R+L,H=R-L;e[c]=O+K,e[c+32]=O-K;var J=.707106781*(H+z);e[c+16]=z+J,e[c+48]=z-J;var q=.382683433*((O=P+T)-(H=F+M)),Y=.5411961*O+q,V=1.306562965*H+q,Z=.707106781*(K=T+F),j=M+Z,W=M-Z;e[c+40]=W+Y,e[c+24]=W-Y,e[c+8]=j+V,e[c+56]=j-V,c++}for(g=0;g<64;++g)h=e[g]*t[g],f[g]=h>0?h+.5|0:h-.5|0;return f}(e,t),l=0;l<64;++l)d[p[l]]=o[l];var g=d[0]-A;A=d[0],0==g?U(i[0]):(U(i[c[a=32767+g]]),U(h[a]));for(var u=63;u>0&&0==d[u];u--);if(0==u)return U(n),A;for(var I,B=1;B<=u;){for(var C=B;0==d[B]&&B<=u;++B);var E=B-C;if(E>=16){I=E>>4;for(var w=1;w<=I;++w)U(s);E&=15}a=32767+d[B],U(r[(E<<4)+c[a]]),U(h[a]),B++}return 63!=u&&U(n),A}function L(e){if(e<=0&&(e=1),e>100&&(e=100),a!=e){(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],A=0;A<64;A++){var i=n((t[A]*e+50)/100);i<1?i=1:i>255&&(i=255),s[p[A]]=i}for(var r=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],a=0;a<64;a++){var h=n((r[a]*e+50)/100);h<1?h=1:h>255&&(h=255),o[p[a]]=h}for(var c=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],f=0,d=0;d<8;d++)for(var u=0;u<8;u++)l[f]=1/(s[p[f]]*c[d]*c[u]*8),g[f]=1/(o[p[f]]*c[d]*c[u]*8),f++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),a=e}}this.encode=function(e,a){var n;(new Date).getTime(),a&&L(a),u=new Array,I=0,B=7,R(65496),R(65504),R(16),M(74),M(70),M(73),M(70),M(0),M(1),M(1),M(0),R(1),R(1),M(0),M(0),void 0!==(n=e.comments)&&n.constructor===Array&&n.forEach((e=>{if("string"==typeof e){R(65534);var t,A=e.length;for(R(A+2),t=0;t<A;t++)M(e.charCodeAt(t))}})),function(e){if(e){R(65505),69===e[0]&&120===e[1]&&105===e[2]&&102===e[3]?R(e.length+2):(R(e.length+5+2),M(69),M(120),M(105),M(102),M(0));for(var t=0;t<e.length;t++)M(e[t])}}(e.exifBuffer),function(){R(65499),R(132),M(0);for(var e=0;e<64;e++)M(s[e]);M(1);for(var t=0;t<64;t++)M(o[t])}(),function(e,t){R(65472),R(17),M(8),R(t),R(e),M(3),M(1),M(17),M(0),M(2),M(17),M(1),M(3),M(17),M(1)}(e.width,e.height),function(){R(65476),R(418),M(0);for(var e=0;e<16;e++)M(y[e+1]);for(var t=0;t<=11;t++)M(_[t]);M(16);for(var A=0;A<16;A++)M(b[A+1]);for(var i=0;i<=161;i++)M(D[i]);M(1);for(var r=0;r<16;r++)M(k[r+1]);for(var a=0;a<=11;a++)M(v[a]);M(17);for(var n=0;n<16;n++)M(x[n+1]);for(var s=0;s<=161;s++)M(S[s])}(),R(65498),R(12),M(3),M(1),M(0),M(2),M(17),M(3),M(17),M(0),M(63),M(0);var h=0,c=0,f=0;I=0,B=7,this.encode.displayName="_encode_";for(var d,Q,p,G,T,N,P,O,z,K=e.data,H=e.width,J=e.height,q=4*H,Y=0;Y<J;){for(d=0;d<q;){for(N=T=q*Y+d,P=-1,O=0,z=0;z<64;z++)N=T+(O=z>>3)*q+(P=4*(7&z)),Y+O>=J&&(N-=q*(Y+1+O-J)),d+P>=q&&(N-=d+P-q+4),Q=K[N++],p=K[N++],G=K[N++],C[z]=(m[Q]+m[p+256>>0]+m[G+512>>0]>>16)-128,E[z]=(m[Q+768>>0]+m[p+1024>>0]+m[G+1280>>0]>>16)-128,w[z]=(m[Q+1280>>0]+m[p+1536>>0]+m[G+1792>>0]>>16)-128;h=F(C,l,h,t,i),c=F(E,g,c,A,r),f=F(w,g,f,A,r),d+=32}Y+=8}if(B>=0){var V=[];V[1]=B+1,V[0]=(1<<B+1)-1,U(V)}return R(65497),Buffer.from(u)},(new Date).getTime(),e||(e=50),function(){for(var e=String.fromCharCode,t=0;t<256;t++)Q[t]=e(t)}(),t=G(y,_),A=G(k,v),i=G(b,D),r=G(x,S),function(){for(var e=1,t=2,A=1;A<=15;A++){for(var i=e;i<t;i++)c[32767+i]=A,h[32767+i]=[],h[32767+i][1]=A,h[32767+i][0]=i;for(var r=-(t-1);r<=-e;r++)c[32767+r]=A,h[32767+r]=[],h[32767+r][1]=A,h[32767+r][0]=t-1+r;e<<=1,t<<=1}}(),function(){for(var e=0;e<256;e++)m[e]=19595*e,m[e+256>>0]=38470*e,m[e+512>>0]=7471*e+32768,m[e+768>>0]=-11059*e,m[e+1024>>0]=-21709*e,m[e+1280>>0]=32768*e+8421375,m[e+1536>>0]=-27439*e,m[e+1792>>0]=-5329*e}(),L(e),(new Date).getTime()}ki.exports=function(e,A){void 0===A&&(A=50);var i=new t(A),r=i.encode(e,A);return{data:r,width:e.width,height:e.height}}}();var vi,xi,Si=ki.exports,Gi={exports:{}};vi=Gi,xi=function(){var e=new Int32Array([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]),t=4017,A=799,i=3406,r=2276,a=1567,n=3784,s=5793,o=2896;function l(){}function g(e,t){for(var A,i,r=0,a=[],n=16;n>0&&!e[n-1];)n--;a.push({children:[],index:0});var s,o=a[0];for(A=0;A<n;A++){for(i=0;i<e[A];i++){for((o=a.pop()).children[o.index]=t[r];o.index>0;){if(0===a.length)throw new Error("Could not recreate Huffman Table");o=a.pop()}for(o.index++,a.push(o);a.length<=A;)a.push(s={children:[],index:0}),o.children[o.index]=s.children,o=s;r++}A+1<n&&(a.push(s={children:[],index:0}),o.children[o.index]=s.children,o=s)}return a[0].children}function h(t,A,i,r,a,n,s,o,l,g){i.precision,i.samplesPerLine,i.scanLines;var h=i.mcusPerLine,c=i.progressive;i.maxH,i.maxV;var f=A,d=0,u=0;function I(){if(u>0)return u--,d>>u&1;if(255==(d=t[A++])){var e=t[A++];if(e)throw new Error("unexpected marker: "+(d<<8|e).toString(16))}return u=7,d>>>7}function B(e){for(var t,A=e;null!==(t=I());){if("number"==typeof(A=A[t]))return A;if("object"!=typeof A)throw new Error("invalid huffman sequence")}return null}function C(e){for(var t=0;e>0;){var A=I();if(null===A)return;t=t<<1|A,e--}return t}function E(e){var t=C(e);return t>=1<<e-1?t:t+(-1<<e)+1}var w,Q=0,m=0;function p(e,t,A,i,r){var a=A%h,n=(A/h|0)*e.v+i,s=a*e.h+r;void 0===e.blocks[n]&&g.tolerantDecoding||t(e,e.blocks[n][s])}function y(e,t,A){var i=A/e.blocksPerLine|0,r=A%e.blocksPerLine;void 0===e.blocks[i]&&g.tolerantDecoding||t(e,e.blocks[i][r])}var _,b,D,k,v,x,S=r.length;x=c?0===n?0===o?function(e,t){var A=B(e.huffmanTableDC),i=0===A?0:E(A)<<l;t[0]=e.pred+=i}:function(e,t){t[0]|=I()<<l}:0===o?function(t,A){if(Q>0)Q--;else for(var i=n,r=s;i<=r;){var a=B(t.huffmanTableAC),o=15&a,g=a>>4;if(0!==o)A[e[i+=g]]=E(o)*(1<<l),i++;else{if(g<15){Q=C(g)+(1<<g)-1;break}i+=16}}}:function(t,A){for(var i=n,r=s,a=0;i<=r;){var o=e[i],g=A[o]<0?-1:1;switch(m){case 0:var h=B(t.huffmanTableAC),c=15&h;if(a=h>>4,0===c)a<15?(Q=C(a)+(1<<a),m=4):(a=16,m=1);else{if(1!==c)throw new Error("invalid ACn encoding");w=E(c),m=a?2:3}continue;case 1:case 2:A[o]?A[o]+=(I()<<l)*g:0==--a&&(m=2==m?3:0);break;case 3:A[o]?A[o]+=(I()<<l)*g:(A[o]=w<<l,m=0);break;case 4:A[o]&&(A[o]+=(I()<<l)*g)}i++}4===m&&0==--Q&&(m=0)}:function(t,A){var i=B(t.huffmanTableDC),r=0===i?0:E(i);A[0]=t.pred+=r;for(var a=1;a<64;){var n=B(t.huffmanTableAC),s=15&n,o=n>>4;if(0!==s)A[e[a+=o]]=E(s),a++;else{if(o<15)break;a+=16}}};var G,U,M,R,F=0;for(U=1==S?r[0].blocksPerLine*r[0].blocksPerColumn:h*i.mcusPerColumn,a||(a=U);F<U;){for(b=0;b<S;b++)r[b].pred=0;if(Q=0,1==S)for(_=r[0],v=0;v<a;v++)y(_,x,F),F++;else for(v=0;v<a;v++){for(b=0;b<S;b++)for(M=(_=r[b]).h,R=_.v,D=0;D<R;D++)for(k=0;k<M;k++)p(_,x,F,D,k);if(++F===U)break}if(F===U)do{if(255===t[A]&&0!==t[A+1])break;A+=1}while(A<t.length-2);if(u=0,(G=t[A]<<8|t[A+1])<65280)throw new Error("marker was not found");if(!(G>=65488&&G<=65495))break;A+=2}return A-f}function c(e,l){var g,h,c=[],f=l.blocksPerLine,d=l.blocksPerColumn,u=f<<3,B=new Int32Array(64),C=new Uint8Array(64);function E(e,g,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w=c-u+1>>1,c=c+u+1>>1,u=w,w=f-d+1>>1,f=f+d+1>>1,d=w,w=I*r+E*i+2048>>12,I=I*i-E*r+2048>>12,E=w,w=B*A+C*t+2048>>12,B=B*t-C*A+2048>>12,C=w,p[0+_]=c+E,p[56+_]=c-E,p[8+_]=f+C,p[48+_]=f-C,p[16+_]=d+B,p[40+_]=d-B,p[24+_]=u+I,p[32+_]=u-I):(w=s*h[Q+0]+8192>>14,p[0+_]=w,p[8+_]=w,p[16+_]=w,p[24+_]=w,p[32+_]=w,p[40+_]=w,p[48+_]=w,p[56+_]=w)}for(Q=0;Q<64;++Q){var b=128+(p[Q]+8>>4);g[Q]=b<0?0:b>255?255:b}}I(u*d*8);for(var w=0;w<d;w++){var Q=w<<3;for(g=0;g<8;g++)c.push(new Uint8Array(u));for(var m=0;m<f;m++){E(l.blocks[w][m],C,B);var p=0,y=m<<3;for(h=0;h<8;h++){var _=c[Q+h];for(g=0;g<8;g++)_[y+g]=C[p++]}}}return c}function f(e){return e<0?0:e>255?255:e}l.prototype={load:function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){var e=new Uint8Array(t.response||t.mozResponseArrayBuffer);this.parse(e),this.onload&&this.onload()}.bind(this),t.send(null)},parse:function(t){var A=1e3*this.opts.maxResolutionInMP*1e3,i=0;function r(){var e=t[i]<<8|t[i+1];return i+=2,e}function a(e){var t,A,i=1,r=1;for(A in e.components)e.components.hasOwnProperty(A)&&(i<(t=e.components[A]).h&&(i=t.h),r<t.v&&(r=t.v));var a=Math.ceil(e.samplesPerLine/8/i),n=Math.ceil(e.scanLines/8/r);for(A in e.components)if(e.components.hasOwnProperty(A)){t=e.components[A];var s=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/i),o=Math.ceil(Math.ceil(e.scanLines/8)*t.v/r),l=a*t.h,g=n*t.v,h=[];I(g*l*256);for(var c=0;c<g;c++){for(var f=[],d=0;d<l;d++)f.push(new Int32Array(64));h.push(f)}t.blocksPerLine=s,t.blocksPerColumn=o,t.blocks=h}e.maxH=i,e.maxV=r,e.mcusPerLine=a,e.mcusPerColumn=n}t.length;var n,s,o,l,f=null,d=null,u=[],B=[],C=[],E=[],w=r(),Q=-1;if(this.comments=[],65496!=w)throw new Error("SOI not found");for(w=r();65497!=w;){switch(w){case 65280:break;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 m=(o=void 0,l=void 0,o=r(),l=t.subarray(i,i+o-2),i+=l.length,l);if(65534===w){var p=String.fromCharCode.apply(null,m);this.comments.push(p)}65504===w&&74===m[0]&&70===m[1]&&73===m[2]&&70===m[3]&&0===m[4]&&(f={version:{major:m[5],minor:m[6]},densityUnits:m[7],xDensity:m[8]<<8|m[9],yDensity:m[10]<<8|m[11],thumbWidth:m[12],thumbHeight:m[13],thumbData:m.subarray(14,14+3*m[12]*m[13])}),65505===w&&69===m[0]&&120===m[1]&&105===m[2]&&102===m[3]&&0===m[4]&&(this.exifBuffer=m.subarray(5,m.length)),65518===w&&65===m[0]&&100===m[1]&&111===m[2]&&98===m[3]&&101===m[4]&&0===m[5]&&(d={version:m[6],flags0:m[7]<<8|m[8],flags1:m[9]<<8|m[10],transformCode:m[11]});break;case 65499:for(var y=r()+i-2;i<y;){var _=t[i++];I(256);var b=new Int32Array(64);if(_>>4==0)for(V=0;V<64;V++)b[e[V]]=t[i++];else{if(_>>4!=1)throw new Error("DQT: invalid table spec");for(V=0;V<64;V++)b[e[V]]=r()}u[15&_]=b}break;case 65472:case 65473:case 65474:r(),(n={}).extended=65473===w,n.progressive=65474===w,n.precision=t[i++],n.scanLines=r(),n.samplesPerLine=r(),n.components={},n.componentsOrder=[];var D=n.scanLines*n.samplesPerLine;if(D>A){var k=Math.ceil((D-A)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${k}MP`)}var v,x=t[i++];for(q=0;q<x;q++){v=t[i];var S=t[i+1]>>4,G=15&t[i+1],U=t[i+2];if(S<=0||G<=0)throw new Error("Invalid sampling factor, expected values above 0");n.componentsOrder.push(v),n.components[v]={h:S,v:G,quantizationIdx:U},i+=3}a(n),B.push(n);break;case 65476:var M=r();for(q=2;q<M;){var R=t[i++],F=new Uint8Array(16),L=0;for(V=0;V<16;V++,i++)L+=F[V]=t[i];I(16+L);var T=new Uint8Array(L);for(V=0;V<L;V++,i++)T[V]=t[i];q+=17+L,(R>>4==0?E:C)[15&R]=g(F,T)}break;case 65501:r(),s=r();break;case 65500:r(),r();break;case 65498:r();var N=t[i++],P=[];for(q=0;q<N;q++){Z=n.components[t[i++]];var O=t[i++];Z.huffmanTableDC=E[O>>4],Z.huffmanTableAC=C[15&O],P.push(Z)}var z=t[i++],K=t[i++],H=t[i++],J=h(t,i,n,P,s,z,K,H>>4,15&H,this.opts);i+=J;break;case 65535:255!==t[i]&&i--;break;default:if(255==t[i-3]&&t[i-2]>=192&&t[i-2]<=254){i-=3;break}if(224===w||225==w){if(-1!==Q)throw new Error(`first unknown JPEG marker at offset ${Q.toString(16)}, second unknown JPEG marker ${w.toString(16)} at offset ${(i-1).toString(16)}`);Q=i-1;const e=r();if(255===t[i+e-2]){i+=e-2;break}}throw new Error("unknown JPEG marker "+w.toString(16))}w=r()}if(1!=B.length)throw new Error("only single frame JPEGs supported");for(var q=0;q<B.length;q++){var Y=B[q].components;for(var V in Y)Y[V].quantizationTable=u[Y[V].quantizationIdx],delete Y[V].quantizationIdx}for(this.width=n.samplesPerLine,this.height=n.scanLines,this.jfif=f,this.adobe=d,this.components=[],q=0;q<n.componentsOrder.length;q++){var Z=n.components[n.componentsOrder[q]];this.components.push({lines:c(0,Z),scaleX:Z.h/n.maxH,scaleY:Z.v/n.maxV})}},getData:function(e,t){var A,i,r,a,n,s,o,l,g,h,c,d,u,B,C,E,w,Q,m,p,y,_=this.width/e,b=this.height/t,D=0,k=e*t*this.components.length;I(k);var v=new Uint8Array(k);switch(this.components.length){case 1:for(A=this.components[0],h=0;h<t;h++)for(n=A.lines[0|h*A.scaleY*b],g=0;g<e;g++)c=n[0|g*A.scaleX*_],v[D++]=c;break;case 2:for(A=this.components[0],i=this.components[1],h=0;h<t;h++)for(n=A.lines[0|h*A.scaleY*b],s=i.lines[0|h*i.scaleY*b],g=0;g<e;g++)c=n[0|g*A.scaleX*_],v[D++]=c,c=s[0|g*i.scaleX*_],v[D++]=c;break;case 3:for(y=!0,this.adobe&&this.adobe.transformCode?y=!0:void 0!==this.opts.colorTransform&&(y=!!this.opts.colorTransform),A=this.components[0],i=this.components[1],r=this.components[2],h=0;h<t;h++)for(n=A.lines[0|h*A.scaleY*b],s=i.lines[0|h*i.scaleY*b],o=r.lines[0|h*r.scaleY*b],g=0;g<e;g++)y?(c=n[0|g*A.scaleX*_],d=s[0|g*i.scaleX*_],Q=f(c+1.402*((u=o[0|g*r.scaleX*_])-128)),m=f(c-.3441363*(d-128)-.71413636*(u-128)),p=f(c+1.772*(d-128))):(Q=n[0|g*A.scaleX*_],m=s[0|g*i.scaleX*_],p=o[0|g*r.scaleX*_]),v[D++]=Q,v[D++]=m,v[D++]=p;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(y=!1,this.adobe&&this.adobe.transformCode?y=!0:void 0!==this.opts.colorTransform&&(y=!!this.opts.colorTransform),A=this.components[0],i=this.components[1],r=this.components[2],a=this.components[3],h=0;h<t;h++)for(n=A.lines[0|h*A.scaleY*b],s=i.lines[0|h*i.scaleY*b],o=r.lines[0|h*r.scaleY*b],l=a.lines[0|h*a.scaleY*b],g=0;g<e;g++)y?(c=n[0|g*A.scaleX*_],d=s[0|g*i.scaleX*_],u=o[0|g*r.scaleX*_],B=l[0|g*a.scaleX*_],C=255-f(c+1.402*(u-128)),E=255-f(c-.3441363*(d-128)-.71413636*(u-128)),w=255-f(c+1.772*(d-128))):(C=n[0|g*A.scaleX*_],E=s[0|g*i.scaleX*_],w=o[0|g*r.scaleX*_],B=l[0|g*a.scaleX*_]),v[D++]=255-C,v[D++]=255-E,v[D++]=255-w,v[D++]=255-B;break;default:throw new Error("Unsupported color mode")}return v},copyToImageData:function(e,t){var A,i,r,a,n,s,o,l,g,h=e.width,c=e.height,d=e.data,u=this.getData(h,c),I=0,B=0;switch(this.components.length){case 1:for(i=0;i<c;i++)for(A=0;A<h;A++)r=u[I++],d[B++]=r,d[B++]=r,d[B++]=r,t&&(d[B++]=255);break;case 3:for(i=0;i<c;i++)for(A=0;A<h;A++)o=u[I++],l=u[I++],g=u[I++],d[B++]=o,d[B++]=l,d[B++]=g,t&&(d[B++]=255);break;case 4:for(i=0;i<c;i++)for(A=0;A<h;A++)n=u[I++],s=u[I++],r=u[I++],o=255-f(n*(1-(a=u[I++])/255)+a),l=255-f(s*(1-a/255)+a),g=255-f(r*(1-a/255)+a),d[B++]=o,d[B++]=l,d[B++]=g,t&&(d[B++]=255);break;default:throw new Error("Unsupported color mode")}}};var d=0,u=0;function I(e=0){var t=d+e;if(t>u){var A=Math.ceil((t-u)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${A}MB`)}d=t}return l.resetMaxMemoryUsage=function(e){d=0,u=e},l.getBytesAllocated=function(){return d},l.requestMemoryAllocation=I,l}(),vi.exports=function(e,t={}){var A={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512,...t},i=new Uint8Array(e),r=new xi;r.opts=A,xi.resetMaxMemoryUsage(1024*A.maxMemoryUsageInMB*1024),r.parse(i);var a=A.formatAsRGBA?4:3,n=r.width*r.height*a;try{xi.requestMemoryAllocation(n);var s={width:r.width,height:r.height,exifBuffer:r.exifBuffer,data:A.useTArray?new Uint8Array(n):Buffer.alloc(n)};r.comments.length>0&&(s.comments=r.comments)}catch(e){if(e instanceof RangeError)throw new Error("Could not allocate enough memory for the image. Required: "+n);if(e instanceof ReferenceError&&"Buffer is not defined"===e.message)throw new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true");throw e}return r.copyToImageData(s,A.formatAsRGBA),s};var Ui=Di({encode:Si,decode:Gi.exports});const Mi=Math.PI,Ri=Mi/4,Fi=180/Mi;function Li(e,t){let A=e.length-t,i=0;do{for(let A=t;A>0;A--)e[i+t]+=e[i],i++;A-=t}while(A>0)}function Ti(e,t,A){let i=0,r=e.length;const a=r/A;for(;r>t;){for(let A=t;A>0;--A)e[i+t]+=e[i],++i;r-=t}const n=e.slice();for(let t=0;t<a;++t)for(let i=0;i<A;++i)e[A*t+i]=n[(A-i-1)*a+t]}let Ni=class{async decode(e,t){const A=await this.decodeBlock(t),i=e.Predictor||1;if(1!==i){const t=!e.StripOffsets;return function(e,t,A,i,r,a){if(!t||1===t)return e;for(let e=0;e<r.length;++e){if(r[e]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(r[e]!==r[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const n=r[0]/8,s=2===a?1:r.length;for(let a=0;a<i&&!(a*s*A*n>=e.byteLength);++a){let i;if(2===t){switch(r[0]){case 8:i=new Uint8Array(e,a*s*A*n,s*A*n);break;case 16:i=new Uint16Array(e,a*s*A*n,s*A*n/2);break;case 32:i=new Uint32Array(e,a*s*A*n,s*A*n/4);break;default:throw new Error(`Predictor 2 not allowed with ${r[0]} bits per sample.`)}Li(i,s)}else 3===t&&(i=new Uint8Array(e,a*s*A*n,s*A*n),Ti(i,s,n))}return e}(A,i,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return A}};const Pi=257;function Oi(e,t){for(let A=t.length-1;A>=0;A--)e.push(t[A]);return e}function zi(e){const t=new Uint16Array(4093),A=new Uint8Array(4093);for(let e=0;e<=257;e++)t[e]=4096,A[e]=e;let i=258,r=9,a=0;function n(){i=258,r=9}function s(e){const t=function(e,t,A){const i=t%8,r=Math.floor(t/8),a=8-i,n=t+A-8*(r+1);let s=8*(r+2)-(t+A);const o=8*(r+2)-t;if(s=Math.max(0,s),r>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),Pi;let l=e[r]&2**(8-i)-1;l<<=A-a;let g=l;if(r+1<e.length){let t=e[r+1]>>>s;t<<=Math.max(0,A-o),g+=t}if(n>8&&r+2<e.length){const i=8*(r+3)-(t+A);g+=e[r+2]>>>i}return g}(e,a,r);return a+=r,t}function o(e,r){return A[i]=r,t[i]=e,i++,i-1}function l(e){const i=[];for(let r=e;4096!==r;r=t[r])i.push(A[r]);return i}const g=[];n();const h=new Uint8Array(e);let c,f=s(h);for(;f!==Pi;){if(256===f){for(n(),f=s(h);256===f;)f=s(h);if(f===Pi)break;if(f>256)throw new Error(`corrupted code at scanline ${f}`);Oi(g,l(f)),c=f}else if(f<i){const e=l(f);Oi(g,e),o(c,e[e.length-1]),c=f}else{const e=l(c);if(!e)throw new Error(`Bogus entry. Not in dictionary,\n ${c} / ${i},\n position: ${a}`);Oi(g,e),g.push(e[e.length-1]),o(c,e[e.length-1]),c=f}i+1>=2**r&&(12===r?c=void 0:r++),f=s(h)}return new Uint8Array(g)}let Ki=class extends Ni{decodeBlock(e){return zi(e).buffer}};function Hi(e){return(t,...A)=>qi(e,t,A)}function Ji(e,t){return Hi(ji(e,t).get)}const{apply:qi,construct:Yi,defineProperty:Vi,get:Zi,getOwnPropertyDescriptor:ji,getPrototypeOf:Wi,has:Xi,ownKeys:$i,set:er,setPrototypeOf:tr}=Reflect,{iterator:Ar,species:ir,toStringTag:rr,for:ar}=Symbol,nr=Object,{create:sr,defineProperty:or,freeze:lr,is:gr}=nr,hr=Array.prototype[Ar],cr=Hi(hr),fr=ArrayBuffer;Ji(fr.prototype,"byteLength");const dr="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null;dr&&Ji(dr.prototype,"byteLength");const ur=Wi(Uint8Array);ur.from;const Ir=ur.prototype;Ir[Ar],Hi(Ir.keys),Hi(Ir.values),Hi(Ir.entries),Hi(Ir.set),Hi(Ir.reverse),Hi(Ir.fill),Hi(Ir.copyWithin),Hi(Ir.sort),Hi(Ir.slice),Hi(Ir.subarray),Ji(Ir,"buffer"),Ji(Ir,"byteOffset"),Ji(Ir,"length"),Ji(Ir,rr);const Br=Uint32Array,Cr=Float32Array,Er=Wi([][Ar]()),wr=Hi(Er.next),Qr=Hi(function*(){}().next),mr=Wi(Er),pr=Hi(DataView.prototype.getUint16),yr=WeakMap,_r=yr.prototype,br=Hi(_r.get),Dr=Hi(_r.set),kr=new yr,vr=sr(null,{next:{value:function(){const e=br(kr,this);return wr(e)}},[Ar]:{value:function(){return this}}});const xr=new yr,Sr=sr(mr,{next:{value:function(){const e=br(xr,this);return Qr(e)},writable:!0,configurable:!0}});for(const e of $i(Er))"next"!==e&&or(Sr,e,ji(Er,e));const Gr=new fr(4),Ur=new Cr(Gr),Mr=new Br(Gr),Rr=new Br(512),Fr=new Br(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(Rr[e]=0,Rr[256|e]=32768,Fr[e]=24,Fr[256|e]=24):t<-14?(Rr[e]=1024>>-t-14,Rr[256|e]=1024>>-t-14|32768,Fr[e]=-t-1,Fr[256|e]=-t-1):t<=15?(Rr[e]=t+15<<10,Rr[256|e]=t+15<<10|32768,Fr[e]=13,Fr[256|e]=13):t<128?(Rr[e]=31744,Rr[256|e]=64512,Fr[e]=24,Fr[256|e]=24):(Rr[e]=31744,Rr[256|e]=64512,Fr[e]=13,Fr[256|e]=13)}const Lr=new Br(2048),Tr=new Br(64),Nr=new Br(64);for(let e=1;e<1024;++e){let t=e<<13,A=0;for(;0==(8388608&t);)t<<=1,A-=8388608;t&=-8388609,A+=947912704,Lr[e]=t|A}for(let e=1024;e<2048;++e)Lr[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)Tr[e]=e<<23;Tr[31]=1199570944,Tr[32]=2147483648;for(let e=33;e<63;++e)Tr[e]=2147483648+(e-32<<23);Tr[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(Nr[e]=1024);function Pr(e,t,...A){return function(e){const t=e>>10;return Mr[0]=Lr[Nr[t]+(1023&e)]+Tr[t],Ur[0]}(pr(e,t,...function(e){if(e[Ar]===hr&&Er.next===wr)return e;const t=sr(vr);return Dr(kr,t,cr(e)),t}(A)))}var Or={exports:{}};function zr(e,t,A){const i=A&&A.debug||!1;i&&console.log("[xml-utils] getting "+t+" in "+e);const r="object"==typeof e?e.outer:e,a=r.slice(0,r.indexOf(">")+1),n=['"',"'"];for(let e=0;e<n.length;e++){const A=n[e],r=t+"\\="+A+"([^"+A+"]*)"+A;i&&console.log("[xml-utils] pattern:",r);const s=new RegExp(r).exec(a);if(i&&console.log("[xml-utils] match:",s),s)return s[1]}}Or.exports=zr,Or.exports.default=zr;var Kr=Di(Or.exports),Hr={exports:{}},Jr={exports:{}},qr={exports:{}};function Yr(e,t,A){const i=new RegExp(t).exec(e.slice(A));return i?A+i.index:-1}qr.exports=Yr,qr.exports.default=Yr;var Vr=qr.exports,Zr={exports:{}};function jr(e,t,A){const i=new RegExp(t).exec(e.slice(A));return i?A+i.index+i[0].length-1:-1}Zr.exports=jr,Zr.exports.default=jr;var Wr=Zr.exports,Xr={exports:{}};function $r(e,t){const A=new RegExp(t,"g"),i=e.match(A);return i?i.length:0}Xr.exports=$r,Xr.exports.default=$r;var ea=Xr.exports;const ta=Vr,Aa=Wr,ia=ea;function ra(e,t,A){const i=A&&A.debug||!1,r=!(A&&!1===typeof A.nested),a=A&&A.startIndex||0;i&&console.log("[xml-utils] starting findTagByName with",t," and ",A);const n=ta(e,`<${t}[ \n>/]`,a);if(i&&console.log("[xml-utils] start:",n),-1===n)return;const s=e.slice(n+t.length);let o=Aa(s,"^[^<]*[ /]>",0);const l=-1!==o&&"/"===s[o-1];if(i&&console.log("[xml-utils] selfClosing:",l),!1===l)if(r){let e=0,A=1,i=0;for(;-1!==(o=Aa(s,"[ /]"+t+">",e));){const r=s.substring(e,o+1);if(A+=ia(r,"<"+t+"[ \n\t>]"),i+=ia(r,"</"+t+">"),i>=A)break;e=o}}else o=Aa(s,"[ /]"+t+">",0);const g=n+t.length+o+1;if(i&&console.log("[xml-utils] end:",g),-1===g)return;const h=e.slice(n,g);let c;return c=l?null:h.slice(h.indexOf(">")+1,h.lastIndexOf("<")),{inner:c,outer:h,start:n,end:g}}Jr.exports=ra,Jr.exports.default=ra;const aa=Jr.exports;function na(e,t,A){const i=[],r=A&&A.debug||!1,a=!A||"boolean"!=typeof A.nested||A.nested;let n,s=A&&A.startIndex||0;for(;n=aa(e,t,{debug:r,startIndex:s});)s=a?n.start+1+t.length:n.end,i.push(n);return r&&console.log("findTagsByName found",i.length,"tags"),i}Hr.exports=na,Hr.exports.default=na;var sa=Di(Hr.exports);const oa={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},la={};for(const e in oa)oa.hasOwnProperty(e)&&(la[oa[e]]=parseInt(e,10));const ga=[la.BitsPerSample,la.ExtraSamples,la.SampleFormat,la.StripByteCounts,la.StripOffsets,la.StripRowCounts,la.TileByteCounts,la.TileOffsets,la.SubIFDs],ha={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},ca={};for(const e in ha)ha.hasOwnProperty(e)&&(ca[ha[e]]=parseInt(e,10));const fa=0,da=1,ua=2,Ia=3,Ba=5,Ca=6,Ea=8,wa=0,Qa=1,ma=0,pa=1,ya=2,_a={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};const ba=new Map;function Da(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>ba.set(e,t)))}function ka(e,t,A,i=1){return new(Object.getPrototypeOf(e).constructor)(t*A*i)}function va(e,t,A){return(1-A)*e+A*t}function xa(e,t,A,i,r,a="nearest"){switch(a.toLowerCase()){case"nearest":return function(e,t,A,i,r){const a=t/i,n=A/r;return e.map((e=>{const s=ka(e,i,r);for(let o=0;o<r;++o){const r=Math.min(Math.round(n*o),A-1);for(let A=0;A<i;++A){const n=Math.min(Math.round(a*A),t-1),l=e[r*t+n];s[o*i+A]=l}}return s}))}(e,t,A,i,r);case"bilinear":case"linear":return function(e,t,A,i,r){const a=t/i,n=A/r;return e.map((e=>{const s=ka(e,i,r);for(let o=0;o<r;++o){const r=n*o,l=Math.floor(r),g=Math.min(Math.ceil(r),A-1);for(let A=0;A<i;++A){const n=a*A,h=n%1,c=Math.floor(n),f=Math.min(Math.ceil(n),t-1),d=e[l*t+c],u=e[l*t+f],I=e[g*t+c],B=e[g*t+f],C=va(va(d,u,h),va(I,B,h),r%1);s[o*i+A]=C}}return s}))}(e,t,A,i,r);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function Sa(e,t,A,i,r,a,n="nearest"){switch(n.toLowerCase()){case"nearest":return function(e,t,A,i,r,a){const n=t/i,s=A/r,o=ka(e,i,r,a);for(let l=0;l<r;++l){const r=Math.min(Math.round(s*l),A-1);for(let A=0;A<i;++A){const s=Math.min(Math.round(n*A),t-1);for(let n=0;n<a;++n){const g=e[r*t*a+s*a+n];o[l*i*a+A*a+n]=g}}}return o}(e,t,A,i,r,a);case"bilinear":case"linear":return function(e,t,A,i,r,a){const n=t/i,s=A/r,o=ka(e,i,r,a);for(let l=0;l<r;++l){const r=s*l,g=Math.floor(r),h=Math.min(Math.ceil(r),A-1);for(let A=0;A<i;++A){const s=n*A,c=s%1,f=Math.floor(s),d=Math.min(Math.ceil(s),t-1);for(let n=0;n<a;++n){const s=e[g*t*a+f*a+n],u=e[g*t*a+d*a+n],I=e[h*t*a+f*a+n],B=e[h*t*a+d*a+n],C=va(va(s,u,c),va(I,B,c),r%1);o[l*i*a+A*a+n]=C}}}return o}(e,t,A,i,r,a);default:throw new Error(`Unsupported resampling method: '${n}'`)}}function Ga(e,t,A){let i=0;for(let r=t;r<A;++r)i+=e[r];return i}function Ua(e,t,A){switch(e){case 1:if(t<=8)return new Uint8Array(A);if(t<=16)return new Uint16Array(A);if(t<=32)return new Uint32Array(A);break;case 2:if(8===t)return new Int8Array(A);if(16===t)return new Int16Array(A);if(32===t)return new Int32Array(A);break;case 3:switch(t){case 16:case 32:return new Float32Array(A);case 64:return new Float64Array(A)}}throw Error("Unsupported data format/bitsPerSample")}Da([void 0,1],(()=>Promise.resolve().then((function(){return an})).then((e=>e.default)))),Da(5,(()=>Promise.resolve().then((function(){return ln})).then((e=>e.default)))),Da(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),Da(7,(()=>Promise.resolve().then((function(){return pn})).then((e=>e.default)))),Da([8,32946],(()=>Promise.resolve().then((function(){return Ul})).then((e=>e.default)))),Da(32773,(()=>Promise.resolve().then((function(){return Ml})).then((e=>e.default)))),Da(34887,(()=>Promise.resolve().then((function(){return Kl})).then((async e=>(await e.zstd.init(),e))).then((e=>e.default)))),Da(50001,(()=>Promise.resolve().then((function(){return Hl})).then((e=>e.default))));var Ma=class{constructor(e,t,A,i,r,a){this.fileDirectory=e,this.geoKeys=t,this.dataView=A,this.littleEndian=i,this.tiles=r?{}:null,this.isTiled=!e.StripOffsets;const n=e.PlanarConfiguration;if(this.planarConfiguration=void 0===n?1:n,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=a}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return void 0!==this.fileDirectory.SamplesPerPixel?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,A=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(A<=8)return DataView.prototype.getUint8;if(A<=16)return DataView.prototype.getUint16;if(A<=32)return DataView.prototype.getUint32;break;case 2:if(A<=8)return DataView.prototype.getInt8;if(A<=16)return DataView.prototype.getInt16;if(A<=32)return DataView.prototype.getInt32;break;case 3:switch(A){case 16:return function(e,t){return Pr(this,e,t)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){return Ua(this.getSampleFormat(e),this.getBitsPerSample(e),t)}async getTileOrStrip(e,t,A,i,r){const a=Math.ceil(this.getWidth()/this.getTileWidth()),n=Math.ceil(this.getHeight()/this.getTileHeight());let s;const{tiles:o}=this;let l,g;1===this.planarConfiguration?s=t*a+e:2===this.planarConfiguration&&(s=A*a*n+t*a+e),this.isTiled?(l=this.fileDirectory.TileOffsets[s],g=this.fileDirectory.TileByteCounts[s]):(l=this.fileDirectory.StripOffsets[s],g=this.fileDirectory.StripByteCounts[s]);const h=(await this.source.fetch([{offset:l,length:g}],r))[0];let c;return null!==o&&o[s]?c=o[s]:(c=(async()=>{let e=await i.decode(this.fileDirectory,h);const A=this.getSampleFormat(),r=this.getBitsPerSample();return function(e,t){return(1!==e&&2!==e||!(t<=32)||t%8!=0)&&(3!==e||16!==t&&32!==t&&64!==t)}(A,r)&&(e=function(e,t,A,i,r,a,n){const s=new DataView(e),o=2===A?1:i,l=Ua(t,r,2===A?n*a:n*a*i),g=parseInt("1".repeat(r),2);if(1===t){let e;e=1===A?i*r:r;let t=a*e;0!=(7&t)&&(t=t+7&-8);for(let e=0;e<n;++e){const A=e*t;for(let t=0;t<a;++t){const i=A+t*o*r;for(let A=0;A<o;++A){const n=i+A*r,h=(e*a+t)*o+A,c=Math.floor(n/8),f=n%8;if(f+r<=8)l[h]=s.getUint8(c)>>8-r-f&g;else if(f+r<=16)l[h]=s.getUint16(c)>>16-r-f&g;else if(f+r<=24){const e=s.getUint16(c)<<8|s.getUint8(c+2);l[h]=e>>24-r-f&g}else l[h]=s.getUint32(c)>>32-r-f&g}}}}return l.buffer}(e,A,this.planarConfiguration,this.getSamplesPerPixel(),r,this.getTileWidth(),this.getBlockHeight(t))),e})(),null!==o&&(o[s]=c)),{x:e,y:t,sample:A,data:await c}}async _readRaster(e,t,A,i,r,a,n,s,o){const l=this.getTileWidth(),g=this.getTileHeight(),h=this.getWidth(),c=this.getHeight(),f=Math.max(Math.floor(e[0]/l),0),d=Math.min(Math.ceil(e[2]/l),Math.ceil(h/l)),u=Math.max(Math.floor(e[1]/g),0),I=Math.min(Math.ceil(e[3]/g),Math.ceil(c/g)),B=e[2]-e[0];let C=this.getBytesPerPixel();const E=[],w=[];for(let e=0;e<t.length;++e)1===this.planarConfiguration?E.push(Ga(this.fileDirectory.BitsPerSample,0,t[e])/8):E.push(0),w.push(this.getReaderForSample(t[e]));const Q=[],{littleEndian:m}=this;for(let a=u;a<I;++a)for(let n=f;n<d;++n){let s;1===this.planarConfiguration&&(s=this.getTileOrStrip(n,a,0,r,o));for(let f=0;f<t.length;++f){const d=f,u=t[f];2===this.planarConfiguration&&(C=this.getSampleByteSize(u),s=this.getTileOrStrip(n,a,u,r,o));const I=s.then((r=>{const a=r.data,n=new DataView(a),s=this.getBlockHeight(r.y),o=r.y*g,f=r.x*l,u=o+s,I=(r.x+1)*l,Q=w[d],p=Math.min(s,s-(u-e[3]),c-o),y=Math.min(l,l-(I-e[2]),h-f);for(let r=Math.max(0,e[1]-o);r<p;++r)for(let a=Math.max(0,e[0]-f);a<y;++a){const s=(r*l+a)*C,g=Q.call(n,s+E[d],m);let h;i?(h=(r+o-e[1])*B*t.length+(a+f-e[0])*t.length+d,A[h]=g):(h=(r+o-e[1])*B+a+f-e[0],A[d][h]=g)}}));Q.push(I)}}if(await Promise.all(Q),a&&e[2]-e[0]!==a||n&&e[3]-e[1]!==n){let r;return r=i?Sa(A,e[2]-e[0],e[3]-e[1],a,n,t.length,s):xa(A,e[2]-e[0],e[3]-e[1],a,n,s),r.width=a,r.height=n,r}return A.width=a||e[2]-e[0],A.height=n||e[3]-e[1],A}async readRasters({window:e,samples:t=[],interleave:A,pool:i=null,width:r,height:a,resampleMethod:n,fillValue:s,signal:o}={}){const l=e||[0,0,this.getWidth(),this.getHeight()];if(l[0]>l[2]||l[1]>l[3])throw new Error("Invalid subsets");const g=(l[2]-l[0])*(l[3]-l[1]),h=this.getSamplesPerPixel();if(t&&t.length){for(let e=0;e<t.length;++e)if(t[e]>=h)return Promise.reject(new RangeError(`Invalid sample index '${t[e]}'.`))}else for(let e=0;e<h;++e)t.push(e);let c;if(A){c=Ua(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),g*t.length),s&&c.fill(s)}else{c=[];for(let e=0;e<t.length;++e){const A=this.getArrayForSample(t[e],g);Array.isArray(s)&&e<s.length?A.fill(s[e]):s&&!Array.isArray(s)&&A.fill(s),c.push(A)}}const f=i||await async function(e){const t=ba.get(e.Compression);if(!t)throw new Error(`Unknown compression method identifier: ${e.Compression}`);return new(await t())(e)}(this.fileDirectory);return await this._readRaster(l,t,c,A,f,r,a,n,o)}async readRGB({window:e,interleave:t=!0,pool:A=null,width:i,height:r,resampleMethod:a,enableAlpha:n=!1,signal:s}={}){const o=e||[0,0,this.getWidth(),this.getHeight()];if(o[0]>o[2]||o[1]>o[3])throw new Error("Invalid subsets");const l=this.fileDirectory.PhotometricInterpretation;if(l===ua){let o=[0,1,2];if(this.fileDirectory.ExtraSamples!==wa&&n){o=[];for(let e=0;e<this.fileDirectory.BitsPerSample.length;e+=1)o.push(e)}return this.readRasters({window:e,interleave:t,samples:o,pool:A,width:i,height:r,resampleMethod:a,signal:s})}let g;switch(l){case fa:case da:case Ia:g=[0];break;case Ba:g=[0,1,2,3];break;case Ca:case Ea:g=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const h={window:o,interleave:!0,samples:g,pool:A,width:i,height:r,resampleMethod:a,signal:s},{fileDirectory:c}=this,f=await this.readRasters(h),d=2**this.fileDirectory.BitsPerSample[0];let u;switch(l){case fa:u=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3);let a;for(let A=0,i=0;A<e.length;++A,i+=3)a=256-e[A]/t*256,r[i]=a,r[i+1]=a,r[i+2]=a;return r}(f,d);break;case da:u=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3);let a;for(let A=0,i=0;A<e.length;++A,i+=3)a=e[A]/t*256,r[i]=a,r[i+1]=a,r[i+2]=a;return r}(f,d);break;case Ia:u=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3),a=t.length/3,n=t.length/3*2;for(let A=0,i=0;A<e.length;++A,i+=3){const s=e[A];r[i]=t[s]/65536*256,r[i+1]=t[s+a]/65536*256,r[i+2]=t[s+n]/65536*256}return r}(f,c.ColorMap);break;case Ba:u=function(e){const{width:t,height:A}=e,i=new Uint8Array(t*A*3);for(let t=0,A=0;t<e.length;t+=4,A+=3){const r=e[t],a=e[t+1],n=e[t+2],s=e[t+3];i[A]=(255-r)/256*255*((255-s)/256),i[A+1]=(255-a)/256*255*((255-s)/256),i[A+2]=(255-n)/256*255*((255-s)/256)}return i}(f);break;case Ca:u=function(e){const{width:t,height:A}=e,i=new Uint8ClampedArray(t*A*3);for(let t=0,A=0;t<e.length;t+=3,A+=3){const r=e[t],a=e[t+1],n=e[t+2];i[A]=r+1.402*(n-128),i[A+1]=r-.34414*(a-128)-.71414*(n-128),i[A+2]=r+1.772*(a-128)}return i}(f);break;case Ea:u=function(e){const{width:t,height:A}=e,i=new Uint8Array(t*A*3);for(let t=0,A=0;t<e.length;t+=3,A+=3){let r,a,n,s=(e[t+0]+16)/116,o=(e[t+1]<<24>>24)/500+s,l=s-(e[t+2]<<24>>24)/200;o=.95047*(o*o*o>.008856?o*o*o:(o-16/116)/7.787),s=1*(s*s*s>.008856?s*s*s:(s-16/116)/7.787),l=1.08883*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),r=3.2406*o+-1.5372*s+-.4986*l,a=-.9689*o+1.8758*s+.0415*l,n=.0557*o+-.204*s+1.057*l,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,i[A]=255*Math.max(0,Math.min(1,r)),i[A+1]=255*Math.max(0,Math.min(1,a)),i[A+2]=255*Math.max(0,Math.min(1,n))}return i}(f);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const e=new Uint8Array(u.length/3),t=new Uint8Array(u.length/3),A=new Uint8Array(u.length/3);for(let i=0,r=0;i<u.length;i+=3,++r)e[r]=u[i],t[r]=u[i+1],A[r]=u[i+2];u=[e,t,A]}return u.width=f.width,u.height=f.height,u}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const A=this.fileDirectory.GDAL_METADATA;let i=sa(A,"Item");i=null===e?i.filter((e=>void 0===Kr(e,"sample"))):i.filter((t=>Number(Kr(t,"sample"))===e));for(let e=0;e<i.length;++e){const A=i[e];t[Kr(A,"name")]=A.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&6===e.length)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,A=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(A)return 0===A[1]&&0===A[4]?[A[0],-A[5],A[10]]:[Math.sqrt(A[0]*A[0]+A[4]*A[4]),-Math.sqrt(A[1]*A[1]+A[5]*A[5]),A[10]];if(e){const[t,A,i]=e.getResolution();return[t*e.getWidth()/this.getWidth(),A*e.getHeight()/this.getHeight(),i*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(e=!1){const t=this.getHeight(),A=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[e,i,r,a,n,s,o,l]=this.fileDirectory.ModelTransformation,g=[[0,0],[0,t],[A,0],[A,t]].map((([t,A])=>[a+e*t+i*A,l+n*t+s*A])),h=g.map((e=>e[0])),c=g.map((e=>e[1]));return[Math.min(...h),Math.min(...c),Math.max(...h),Math.max(...c)]}{const e=this.getOrigin(),i=this.getResolution(),r=e[0],a=e[1],n=r+i[0]*A,s=a+i[1]*t;return[Math.min(r,n),Math.min(a,s),Math.max(r,n),Math.max(a,s)]}}};class Ra{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const A=this.getUint32(e,t),i=this.getUint32(e+4,t);let r;if(t){if(r=A+2**32*i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*A+i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}getInt64(e,t){let A=0;const i=(128&this._dataView.getUint8(e+(t?7:0)))>0;let r=!0;for(let a=0;a<8;a++){let n=this._dataView.getUint8(e+(t?a:7-a));i&&(r?0!==n&&(n=255&~(n-1),r=!1):n=255&~n),A+=n*256**a}return i&&(A=-A),A}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return Pr(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class Fa{constructor(e,t,A,i){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=A,this._bigTiff=i}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),A=this.readUint32(e+4);let i;if(this._littleEndian){if(i=t+2**32*A,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*t+A,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}readInt64(e){let t=0;const A=(128&this._dataView.getUint8(e+(this._littleEndian?7:0)))>0;let i=!0;for(let r=0;r<8;r++){let a=this._dataView.getUint8(e+(this._littleEndian?r:7-r));A&&(i?0!==a&&(a=255&~(a-1),i=!1):a=255&~a),t+=a*256**r}return A&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class La{async fetch(e,t=undefined){return Promise.all(e.map((e=>this.fetchSlice(e,t))))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class Ta extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,Ta),this.name="AbortError"}}class Na extends La{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,t){if(t&&t.aborted)throw new Ta("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function Pa(e,t){let A=e.length-t,i=0;do{for(let A=t;A>0;A--)e[i+t]+=e[i],i++;A-=t}while(A>0)}function Oa(e,t,A){let i=0,r=e.length;const a=r/A;for(;r>t;){for(let A=t;A>0;--A)e[i+t]+=e[i],++i;r-=t}const n=e.slice();for(let t=0;t<a;++t)for(let i=0;i<A;++i)e[A*t+i]=n[(A-i-1)*a+t]}class za{async decode(e,t){const A=await this.decodeBlock(t),i=e.Predictor||1;if(1!==i){const t=!e.StripOffsets;return function(e,t,A,i,r,a){if(!t||1===t)return e;for(let e=0;e<r.length;++e){if(r[e]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(r[e]!==r[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const n=r[0]/8,s=2===a?1:r.length;for(let a=0;a<i&&!(a*s*A*n>=e.byteLength);++a){let i;if(2===t){switch(r[0]){case 8:i=new Uint8Array(e,a*s*A*n,s*A*n);break;case 16:i=new Uint16Array(e,a*s*A*n,s*A*n/2);break;case 32:i=new Uint32Array(e,a*s*A*n,s*A*n/4);break;default:throw new Error(`Predictor 2 not allowed with ${r[0]} bits per sample.`)}Pa(i,s)}else 3===t&&(i=new Uint8Array(e,a*s*A*n,s*A*n),Oa(i,s,n))}return e}(A,i,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return A}}function Ka(e){switch(e){case ca.BYTE:case ca.ASCII:case ca.SBYTE:case ca.UNDEFINED:return 1;case ca.SHORT:case ca.SSHORT:return 2;case ca.LONG:case ca.SLONG:case ca.FLOAT:case ca.IFD:return 4;case ca.RATIONAL:case ca.SRATIONAL:case ca.DOUBLE:case ca.LONG8:case ca.SLONG8:case ca.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${e}`)}}function Ha(e,t,A,i){let r=null,a=null;const n=Ka(t);switch(t){case ca.BYTE:case ca.ASCII:case ca.UNDEFINED:r=new Uint8Array(A),a=e.readUint8;break;case ca.SBYTE:r=new Int8Array(A),a=e.readInt8;break;case ca.SHORT:r=new Uint16Array(A),a=e.readUint16;break;case ca.SSHORT:r=new Int16Array(A),a=e.readInt16;break;case ca.LONG:case ca.IFD:r=new Uint32Array(A),a=e.readUint32;break;case ca.SLONG:r=new Int32Array(A),a=e.readInt32;break;case ca.LONG8:case ca.IFD8:r=new Array(A),a=e.readUint64;break;case ca.SLONG8:r=new Array(A),a=e.readInt64;break;case ca.RATIONAL:r=new Uint32Array(2*A),a=e.readUint32;break;case ca.SRATIONAL:r=new Int32Array(2*A),a=e.readInt32;break;case ca.FLOAT:r=new Float32Array(A),a=e.readFloat32;break;case ca.DOUBLE:r=new Float64Array(A),a=e.readFloat64;break;default:throw new RangeError(`Invalid field type: ${t}`)}if(t!==ca.RATIONAL&&t!==ca.SRATIONAL)for(let t=0;t<A;++t)r[t]=a.call(e,i+t*n);else for(let t=0;t<A;t+=2)r[t]=a.call(e,i+t*n),r[t+1]=a.call(e,i+(t*n+4));return t===ca.ASCII?new TextDecoder("utf-8").decode(r):r}class Ja{constructor(e,t,A){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=A}}class qa extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class Ya{async readRasters(e={}){const{window:t,width:A,height:i}=e;let{resX:r,resY:a,bbox:n}=e;const s=await this.getImage();let o=s;const l=await this.getImageCount(),g=s.getBoundingBox();if(t&&n)throw new Error('Both "bbox" and "window" passed.');if(A||i){if(t){const[e,A]=s.getOrigin(),[i,r]=s.getResolution();n=[e+t[0]*i,A+t[1]*r,e+t[2]*i,A+t[3]*r]}const e=n||g;if(A){if(r)throw new Error("Both width and resX passed");r=(e[2]-e[0])/A}if(i){if(a)throw new Error("Both width and resY passed");a=(e[3]-e[1])/i}}if(r||a){const e=[];for(let t=0;t<l;++t){const A=await this.getImage(t),{SubfileType:i,NewSubfileType:r}=A.fileDirectory;(0===t||2===i||1&r)&&e.push(A)}e.sort(((e,t)=>e.getWidth()-t.getWidth()));for(let t=0;t<e.length;++t){const A=e[t],i=(g[2]-g[0])/A.getWidth(),n=(g[3]-g[1])/A.getHeight();if(o=A,r&&r>i||a&&a>n)break}}let h=t;if(n){const[e,t]=s.getOrigin(),[A,i]=o.getResolution(s);h=[Math.round((n[0]-e)/A),Math.round((n[1]-t)/i),Math.round((n[2]-e)/A),Math.round((n[3]-t)/i)],h=[Math.min(h[0],h[2]),Math.min(h[1],h[3]),Math.max(h[0],h[2]),Math.max(h[1],h[3])]}return o.readRasters({...e,window:h})}}class Va extends Ya{constructor(e,t,A,i,r={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=A,this.firstIFDOffset=i,this.cache=r.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const A=this.bigTiff?4048:1024;return new Fa((await this.source.fetch([{offset:e,length:void 0!==t?t:A}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,A=this.bigTiff?8:2;let i=await this.getSlice(e);const r=this.bigTiff?i.readUint64(e):i.readUint16(e),a=r*t+(this.bigTiff?16:6);i.covers(e,a)||(i=await this.getSlice(e,a));const n={};let s=e+(this.bigTiff?8:2);for(let e=0;e<r;s+=t,++e){const e=i.readUint16(s),t=i.readUint16(s+2),A=this.bigTiff?i.readUint64(s+4):i.readUint32(s+4);let r,a;const o=Ka(t),l=s+(this.bigTiff?12:8);if(o*A<=(this.bigTiff?8:4))r=Ha(i,t,A,l);else{const e=i.readOffset(l),a=Ka(t)*A;if(i.covers(e,a))r=Ha(i,t,A,e);else{r=Ha(await this.getSlice(e,a),t,A,e)}}a=1===A&&-1===ga.indexOf(e)&&t!==ca.RATIONAL&&t!==ca.SRATIONAL?r[0]:r,n[oa[e]]=a}const o=function(e){const t=e.GeoKeyDirectory;if(!t)return null;const A={};for(let i=4;i<=4*t[3];i+=4){const r=_a[t[i]],a=t[i+1]?oa[t[i+1]]:null,n=t[i+2],s=t[i+3];let o=null;if(a){if(o=e[a],null==o)throw new Error(`Could not get value of geoKey '${r}'.`);"string"==typeof o?o=o.substring(s,s+n-1):o.subarray&&(o=o.subarray(s,s+n),1===n&&(o=o[0]))}else o=s;A[r]=o}return A}(n),l=i.readOffset(e+A+t*r);return new Ja(n,o,l)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(0===e)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(t){if(t instanceof qa)throw new qa(e);throw t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(0===t.nextIFDByteOffset)throw new qa(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new Ma(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,t=!0;for(;t;)try{await this.requestIFD(e),++e}catch(e){if(!(e instanceof qa))throw e;t=!1}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",A=t.length+100;let i=await this.getSlice(e,A);if(t===Ha(i,ca.ASCII,t.length,e)){const t=Ha(i,ca.ASCII,A,e).split("\n")[0],r=Number(t.split("=")[1].split(" ")[0])+t.length;r>A&&(i=await this.getSlice(e,r));const a=Ha(i,ca.ASCII,r,e);this.ghostValues={},a.split("\n").filter((e=>e.length>0)).map((e=>e.split("="))).forEach((([e,t])=>{this.ghostValues[e]=t}))}return this.ghostValues}static async fromSource(e,t,A){const i=(await e.fetch([{offset:0,length:1024}],A))[0],r=new Ra(i),a=r.getUint16(0,0);let n;if(18761===a)n=!0;else{if(19789!==a)throw new TypeError("Invalid byte order value.");n=!1}const s=r.getUint16(2,n);let o;if(42===s)o=!1;else{if(43!==s)throw new TypeError("Invalid magic number.");o=!0;if(8!==r.getUint16(4,n))throw new Error("Unsupported offset byte-size.")}const l=o?r.getUint64(8,n):r.getUint32(4,n);return new Va(e,n,o,l,t)}close(){return"function"==typeof this.source.close&&this.source.close()}}async function Za(e,t){return Va.fromSource(function(e){return new Na(e)}(e),t)}const ja={type:"image",format:"uint8",useHeatMap:!0,useColorsBasedOnValues:!1,useAutoRange:!1,useDataForOpacity:!1,useSingleColor:!1,useColorClasses:!1,blurredTexture:!0,clipLow:null,clipHigh:null,multiplier:1,color:[255,0,255,255],colorScale:c.brewer.YlOrRd,colorScaleValueRange:[0,255],colorsBasedOnValues:null,colorClasses:null,alpha:100,useChannel:null,noDataValue:void 0,numOfChannels:void 0,nullColor:[0,0,0,0],unidentifiedColor:[0,0,0,0],clippedColor:[0,0,0,0],terrainColor:[133,133,133,255],terrainSkirtHeight:100,terrainMinValue:0};class Wa{constructor(){this.scale=(e,t,A,i,r)=>(e-t)*(r-i)/(A-t)+i}setUrl(e){return f(this,void 0,void 0,(function*(){const t=yield fetch(e),A=yield t.arrayBuffer(),i=yield Za(A),r=yield i.getImage(0);this.data=r}))}getMap(e,t){return f(this,void 0,void 0,(function*(){const A=Object.assign(Object.assign({},ja),t);switch(A.type){case"image":return this.getBitmap(e,A);case"terrain":return this.getHeightmap(e,A);default:return null}}))}getHeightmap(e,t){return f(this,void 0,void 0,(function*(){let A,i,r=[];"string"==typeof e?(yield this.setUrl(e),r=yield this.data.readRasters(),A=this.data.getWidth(),i=this.data.getHeight()):(r=e.rasters,A=e.width,i=e.height);let a=r[0];null!=t.useChannel&&r[t.useChannel]&&(a=r[t.useChannel]);const n=document.createElement("canvas");n.width=A,n.height=i;const s=n.getContext("2d"),o=s.createImageData(A,i),l=a.length/(A*i),g=A*i*4;let h=null===t.useChannel?0:t.useChannel;for(let e=0;e<g;e+=4){const A=t.noDataValue&&a[h]===t.noDataValue?t.terrainMinValue:a[h]*t.multiplier,i=Math.floor((A+1e4)/.1);o.data[e]=Math.floor(i/65536),o.data[e+1]=Math.floor(i/256%256),o.data[e+2]=i%256,o.data[e+3]=255,h+=l}s.putImageData(o,0,0);return n.toDataURL("image/png")}))}getBitmap(e,t){return f(this,void 0,void 0,(function*(){const A=Object.assign({},t);let i,r,a,n=[];"string"==typeof e?(yield this.setUrl(e),n=yield this.data.readRasters(),i=n.length,r=this.data.getWidth(),a=this.data.getHeight()):(n=e.rasters,i=n.length,r=e.width,a=e.height);const s=document.createElement("canvas");s.width=r,s.height=a;const o=s.getContext("2d"),l=o.createImageData(r,a);let g,h,c,f;const d=r*a*4;if(t.noDataValue||console.log("Missing noData value. Raster might be displayed incorrectly."),A.unidentifiedColor=this.getColorFromChromaType(A.unidentifiedColor),A.nullColor=this.getColorFromChromaType(A.nullColor),A.clippedColor=this.getColorFromChromaType(A.clippedColor),A.color=this.getColorFromChromaType(A.color),null==A.useChannel){if(1===i){if(n[0].length/(r*a)==1){const e=n[0];A.useAutoRange&&(A.colorScaleValueRange=this.getMinMax(e,A));this.getColorValue(e,A,d).forEach(((e,t)=>{l.data[t]=e}))}if(n[0].length/(r*a)==3){let e=0;for(let t=0;t<d;t+=4){const i=[n[0][e],n[0][e+1],n[0][e+2]],r=this.hasPixelsNoData(i,A.noDataValue)?A.nullColor:[...i,Math.floor(2.55*A.alpha)];[l.data[t],l.data[t+1],l.data[t+2],l.data[t+3]]=r,e+=3}}n[0].length/(r*a)==4&&n[0].forEach(((e,t)=>{l.data[t]=e}))}if(3===i){let e=0;for(let t=0;t<d;t+=4)g=n[0][e],h=n[1][e],c=n[2][e],f=Math.floor(2.55*A.alpha),l.data[t]=g,l.data[t+1]=h,l.data[t+2]=c,l.data[t+3]=f,e+=1}if(4===i){let e=0;for(let t=0;t<d;t+=4)g=n[0][e],h=n[1][e],c=n[2][e],f=Math.floor(2.55*A.alpha),l.data[t]=g,l.data[t+1]=h,l.data[t+2]=c,l.data[t+3]=f,e+=1}}else if(A.useChannel<=A.numOfChannels){let e=n[0];n[A.useChannel]&&(e=n[A.useChannel]),A.useAutoRange&&(A.colorScaleValueRange=this.getMinMax(e,A));const t=e.length/(r*a);this.getColorValue(e,A,d,t).forEach(((e,t)=>{l.data[t]=e}))}else{console.log("Defined channel does not exist, displaying only grey values");this.getDefaultColor(d,A.nullColor).forEach(((e,t)=>{l.data[t]=e}))}o.putImageData(l,0,0);return s.toDataURL("image/png")}))}getMinMax(e,t){let A=t.maxValue?t.maxValue:Number.MIN_VALUE,i=t.minValue?t.minValue:Number.MAX_VALUE;for(let r=0;r<e.length;r+=1)void 0!==t.noDataValue&&e[r]===t.noDataValue||(e[r]>A&&(A=e[r]),e[r]<i&&(i=e[r]));return[i,A]}getColorValue(e,t,A,i=1){const r=c.scale(t.colorScale).domain(t.colorScaleValueRange);let a=null===t.useChannel?0:t.useChannel;const n=new Array(A),s=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([e])=>e)):void 0,o=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([,e])=>[...c(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,l=t.useColorClasses?t.colorClasses.map((([e])=>[...c(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,g=t.useColorClasses?t.colorClasses.map((([,e])=>e)):void 0,h=t.useColorClasses?t.colorClasses.map((([,,e],A)=>void 0!==e?e:A===t.colorClasses.length-1?[!0,!0]:[!0,!1])):void 0;for(let c=0;c<A;c+=4){let A=t.nullColor;if(void 0===t.noDataValue||e[a]!==t.noDataValue)if(null!=t.clipLow&&e[a]<=t.clipLow||null!=t.clipHigh&&e[a]>=t.clipHigh)A=t.clippedColor;else{if(t.useHeatMap&&(A=[...r(e[a]).rgb(),Math.floor(2.55*t.alpha)]),t.useColorsBasedOnValues){const i=s.indexOf(e[a]);A=i>-1?o[i]:t.unidentifiedColor}if(t.useColorClasses){const i=this.findClassIndex(e[a],g,h);A=i>-1?l[i]:t.unidentifiedColor}t.useSingleColor&&(A=t.color),t.useDataForOpacity&&(A[3]=this.scale(e[a],t.colorScaleValueRange[0],t.colorScaleValueRange.slice(-1)[0],0,255))}else Number.isNaN(e[a])&&(A=[0,0,0,0]);[n[c],n[c+1],n[c+2],n[c+3]]=A,a+=i}return n}findClassIndex(e,t,A){for(let i=0;i<t.length;i+=1){const[r,a]=t[i],[n,s]=A[i];if((n?e>=r:e>r)&&(s?e<=a:e<a))return i}return-1}getDefaultColor(e,t){const A=new Array(e);for(let i=0;i<e;i+=4)[A[i],A[i+1],A[i+2],A[i+3]]=t;return A}getColorFromChromaType(e){return Array.isArray(e)&&4===e.length?e:[...c(e).rgb(),255]}hasPixelsNoData(e,t){return void 0!==t&&e.every((e=>e===t))}}const Xa=40075e3,$a=20037500;class en{constructor(e){this.zoomRange=[0,0],this.lowestOriginTileOffset=[0,0],this.lowestOriginTileSize=0,this.loaded=!1,this.geo=new Wa,this.lzw=new Ki,this.options=e}initializeCog(e){return f(this,void 0,void 0,(function*(){Ce.fetch=(e,t)=>f(this,void 0,void 0,(function*(){return yield fetch(e,t)}));const t=new Ce(e);return this.cog=yield fe.create(t),this.cog.images.forEach((e=>{e.loadGeoTiffTags()})),this.tileSize=this.getTileSize(this.cog),this.lowestOriginTileOffset=this.getImageTileIndex(this.cog.images[this.cog.images.length-1]),this.zoomRange=this.getZoomRange(this.cog),this.cog}))}getTileSize(e){return e.images[e.images.length-1].tileSize.width}getZoomRange(e){const t=e.images[e.images.length-1],A=this.getZoomLevelFromResolution(e.images[e.images.length-1].tileSize.width,t.resolution[0]);return[A,A+(e.images.length-1)]}getBoundsAsLatLon(e){const{bbox:t}=e.images[e.images.length-1],A=Math.min(t[0],t[2]),i=Math.max(t[0],t[2]),r=Math.min(t[1],t[3]),a=Math.max(t[1],t[3]),n=this.getLatLon([A,r]),s=this.getLatLon([i,a]);return[n[0],n[1],s[0],s[1]]}getOriginAsLatLon(e){const{origin:t}=e.images[e.images.length-1];return this.getLatLon(t)}getImageTileIndex(e){const t=$a+e.origin[0],A=-($a+(e.origin[1]-Xa)),i=e.tileSize.width*this.getResolutionFromZoomLevel(e.tileSize.width,this.getZoomLevelFromResolution(e.tileSize.width,e.resolution[0]));return[Math.round(t/i),Math.round(A/i),this.getZoomLevelFromResolution(e.tileSize.width,e.resolution[0])]}getResolutionFromZoomLevel(e,t){return Xa/e/Math.pow(2,t)}getZoomLevelFromResolution(e,t){return Math.round(Math.log2(Xa/(t*e)))}getLatLon(e){const t=function(e){const[t,A]=e,i=t/512*(2*Mi)-Mi,r=2*(Math.atan(Math.exp(A/512*(2*Mi)-Mi))-Ri);return[i*Fi,r*Fi]}([12776044915782906e-21*($a+e[0]),12776044915782906e-21*-($a+(e[1]-Xa))]);return[t[0],-t[1]]}getTile(e,t,A){return f(this,void 0,void 0,(function*(){const i=this.getResolutionFromZoomLevel(this.tileSize,A),r=this.cog.getImageByResolution(i);let a=[0,0];if(A===this.zoomRange[0])a=this.lowestOriginTileOffset;else{const e=Math.pow(2,A-this.zoomRange[0]);a[0]=Math.floor(this.lowestOriginTileOffset[0]*e),a[1]=Math.floor(this.lowestOriginTileOffset[1]*e)}const n=r.tileCount.x,s=r.tileCount.y,o=a[0],l=a[1];let g,h;this.options.numOfChannels=Number(r.tags.get(277).value),this.options.noDataValue=this.getNoDataValue(r.tags),this.options.format||(this.options.format=this.getFormat(r.tags.get(339).value,r.tags.get(258).value));let c=r.tags.get(258).value;if(Array.isArray(c))if("terrain"===this.options.type){let e=0;c.forEach((t=>{e+=t})),c=e}else[c]=c;if(e-o>=0&&t-l>=0&&e-o<n&&t-l<s){const A=yield r.getTile(e-o,t-l);switch(r.compression){case"image/jpeg":h=Ui.decode(A.bytes,{useTArray:!0});break;case"application/deflate":h=yield bi(A.bytes);break;case"application/lzw":h=this.lzw.decodeBlock(A.bytes.buffer);break;default:console.warn(`Unexpected compression method: ${r.compression}`)}let i;switch(this.options.format){case"uint8":i=new Uint8Array(h.buffer);break;case"uint16":i=new Uint16Array(h.buffer);break;case"uint32":i=new Uint32Array(h.buffer);break;case"int8":i=new Int8Array(h.buffer);break;case"int16":i=new Int16Array(h.buffer);break;case"int32":i=new Int32Array(h.buffer);break;case"float32":i=new Float32Array(h.buffer);break;case"float64":i=new Float64Array(h.buffer);break;default:i=null}return g=yield this.geo.getMap({rasters:[i],width:this.tileSize,height:this.tileSize},this.options),g}return null}))}getFormat(e,t){let A,i=e,r=t;switch(Array.isArray(e)&&([i]=e),Array.isArray(t)&&([r]=t),i){case 1:switch(r){case 8:A="uint8";break;case 16:A="uint16";break;case 32:A="uint32";break;default:A=null}break;case 2:switch(r){case 8:A="int8";break;case 16:A="int16";break;case 32:A="int32";break;default:A=null}break;case 3:switch(r){case 32:A="float32";break;case 64:A="float64";break;default:A=null}break;default:throw new Error("Unknown data format.")}return A}getNoDataValue(e){if(e.has(42113)){const t=e.get(42113).value;if("string"==typeof t||t instanceof String){const e=t.replace(/[\0\s]/g,"");return Number(e)}return Number.isNaN(Number(t))?void 0:Number(t)}}testCog(){return f(this,void 0,void 0,(function*(){this.options={type:"image",multiplier:1,useChannel:1,alpha:180,clipLow:1,clipHigh:Number.MAX_VALUE};const e=yield this.initializeCog("https://gisat-gis.eu-central-1.linodeobjects.com/eman/versions/v2/Quadrants/Q3_Bolivia_ASTER_2002_RGB_COG_LZW.tif"),t=e.images[Math.floor(e.images.length/2)];console.log(t);const A=this.getImageTileIndex(t);console.log(A);const i=Math.floor(t.tileCount.x/2),r=Math.floor(t.tileCount.y/2);console.log(e.getTile(i,r,Math.floor(e.images.length/2)));const a=i+A[0],n=r+A[1],s=A[2],o=yield this.getTile(a,n,s);!1===o?console.log("couldn't retrieve tile"):console.log(o)}))}}class tn extends s{constructor(e,t,A){super({}),this.id="",this.id=e,this.cogTiles=new en(A),this.blurredTexture=A.blurredTexture,this.url=t}initializeState(){this.state={initialized:!1},this.init(this.url)}init(e){return f(this,void 0,void 0,(function*(){const t=yield this.cogTiles.initializeCog(e);this.setState({initialized:!0}),this.tileSize=this.cogTiles.getTileSize(t);const A=this.cogTiles.getZoomRange(t);[this.minZoom,this.maxZoom]=A}))}renderLayers(){if(this.cogTiles.cog){return new o({id:`${this.id}-${String(performance.now())}`,getTileData:e=>this.cogTiles.getTile(e.index.x,e.index.y,e.index.z),minZoom:this.minZoom,maxZoom:this.maxZoom,tileSize:this.tileSize,maxRequests:6,extent:this.cogTiles.cog?this.cogTiles.getBoundsAsLatLon(this.cogTiles.cog):null,renderSubLayers:e=>{var t,A,i,r,a,n,s;const{bbox:{west:o,south:l,east:c,north:f}}=e.tile;return new g(e,Object.assign({data:null,image:e.data,bounds:[o,l,c,f],opacity:1,textureParameters:{[h.TEXTURE_MIN_FILTER]:this.blurredTexture?h.LINEAR:h.NEAREST},extensions:(null===(A=null===(t=this.cogTiles)||void 0===t?void 0:t.options)||void 0===A?void 0:A.clampToTerrain)?[new v]:[]},(null===(a=null===(r=null===(i=this.cogTiles)||void 0===i?void 0:i.options)||void 0===r?void 0:r.clampToTerrain)||void 0===a?void 0:a.terrainDrawMode)?{terrainDrawMode:null===(s=null===(n=this.cogTiles)||void 0===n?void 0:n.options)||void 0===s?void 0:s.clampToTerrain.terrainDrawMode}:{}))}})}return null}}tn.layerName="CogBitmapLayer",tn.displayName="CogBitmapLayer";class An extends s{constructor(e,t,A,i,r){super({}),this.urlType="none",this.id="",this.id=e;const a=Object.assign(Object.assign({},ja),A);var n;this.terrainOpacity=a.alpha/100,this.terrainColor=c(a.terrainColor.slice(0,3)).rgb(),this.terrainSkirtHeight=a.terrainSkirtHeight,i&&((n=i)&&n.includes("{x}")&&n.includes("{y}")&&n.includes("{z}")?(this.bitmapUrl=i,this.urlType="tile",this.terrainColor=[0,0,0,0]):!function(e){return!!(e.includes(".tif")||e.includes(".tiff")||e.includes(".TIF")||e.includes(".TIFF"))}(i)?console.warn("URL needs to point to a valid cog file, or needs to be in the {x}{y}{z} format."):(this.bitmapCogTiles=new en(r),this.bitmapCogTiles.initializeCog(i),this.urlType="cog",this.terrainColor=[0,0,0,0])),this.terrainCogTiles=new en(A),this.terrainUrl=t}initializeState(){const e=Object.create(null,{initializeState:{get:()=>super.initializeState}});return f(this,void 0,void 0,(function*(){e.initializeState.call(this),this.setState({initialized:!1}),yield this.init(this.terrainUrl)}))}shouldUpdateState(){var e;return 0===(null===(e=this.internalState)||void 0===e?void 0:e.subLayers.length)}init(e){return f(this,void 0,void 0,(function*(){const t=yield this.terrainCogTiles.initializeCog(e);this.tileSize=this.terrainCogTiles.getTileSize(t);const A=this.terrainCogTiles.getZoomRange(t);[this.minZoom,this.maxZoom]=A,this.setState({initialized:!0})}))}renderLayers(){if(this.terrainCogTiles.cog){let e;this.urlType;return[new o({id:`${this.id}-${String(performance.now())}`,zoomOffset:-1,getTileData:e=>this.terrainCogTiles.getTile(e.index.x,e.index.y,e.index.z),minZoom:this.minZoom,maxZoom:this.maxZoom,tileSize:this.tileSize,maxRequests:6,refinementStrategy:"best-available",extent:this.terrainCogTiles.getBoundsAsLatLon(this.terrainCogTiles.cog),renderSubLayers:t=>{if(t.data&&void 0!==t.tile.index.x){switch(this.urlType){case"tile":A=this.bitmapUrl,i=t.tile.index.x,r=t.tile.index.y,a=t.tile.index.z,e=A.replace("{x}",String(i)).replace("{y}",String(r)).replace("{z}",String(a));break;case"cog":e=this.bitmapCogTiles.getTile(t.tile.index.x,t.tile.index.y,t.tile.index.z);break;default:e=null}return new l({id:`terrain-${t.tile.index.x}-${t.tile.index.y}-${t.tile.index.z}`,pickable:!0,elevationDecoder:{rScaler:6553.6,gScaler:25.6,bScaler:.1,offset:-1e4},elevationData:t.data,texture:e,opacity:this.terrainOpacity,bounds:[t.tile.bbox.west,t.tile.bbox.south,t.tile.bbox.east,t.tile.bbox.north],color:this.terrainColor,operation:"terrain+draw",minZoom:this.minZoom,maxZoom:this.maxZoom,loadOptions:{terrain:{skirtHeight:this.terrainSkirtHeight,tesselator:"martini"}},meshMaxError:12})}var A,i,r,a;return null}})]}return[]}}An.layerName="CogTerrainLayer",An.displayName="CogTerrainLayer";var rn={CogBitmapLayer:tn,CogTerrainLayer:An,cogtiles:en,GeoImage:Wa};var an=Object.freeze({__proto__:null,default:class extends za{decodeBlock(e){return e}}});const nn=257;function sn(e,t){for(let A=t.length-1;A>=0;A--)e.push(t[A]);return e}function on(e){const t=new Uint16Array(4093),A=new Uint8Array(4093);for(let e=0;e<=257;e++)t[e]=4096,A[e]=e;let i=258,r=9,a=0;function n(){i=258,r=9}function s(e){const t=function(e,t,A){const i=t%8,r=Math.floor(t/8),a=8-i,n=t+A-8*(r+1);let s=8*(r+2)-(t+A);const o=8*(r+2)-t;if(s=Math.max(0,s),r>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),nn;let l=e[r]&2**(8-i)-1;l<<=A-a;let g=l;if(r+1<e.length){let t=e[r+1]>>>s;t<<=Math.max(0,A-o),g+=t}if(n>8&&r+2<e.length){const i=8*(r+3)-(t+A);g+=e[r+2]>>>i}return g}(e,a,r);return a+=r,t}function o(e,r){return A[i]=r,t[i]=e,i++,i-1}function l(e){const i=[];for(let r=e;4096!==r;r=t[r])i.push(A[r]);return i}const g=[];n();const h=new Uint8Array(e);let c,f=s(h);for(;f!==nn;){if(256===f){for(n(),f=s(h);256===f;)f=s(h);if(f===nn)break;if(f>256)throw new Error(`corrupted code at scanline ${f}`);sn(g,l(f)),c=f}else if(f<i){const e=l(f);sn(g,e),o(c,e[e.length-1]),c=f}else{const e=l(c);if(!e)throw new Error(`Bogus entry. Not in dictionary, ${c} / ${i}, position: ${a}`);sn(g,e),g.push(e[e.length-1]),o(c,e[e.length-1]),c=f}i+1>=2**r&&(12===r?c=void 0:r++),f=s(h)}return new Uint8Array(g)}var ln=Object.freeze({__proto__:null,default:class extends za{decodeBlock(e){return on(e).buffer}}});const gn=new Int32Array([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]),hn=4017,cn=799,fn=3406,dn=2276,un=1567,In=3784,Bn=5793,Cn=2896;function En(e,t){let A=0;const i=[];let r=16;for(;r>0&&!e[r-1];)--r;i.push({children:[],index:0});let a,n=i[0];for(let s=0;s<r;s++){for(let r=0;r<e[s];r++){for(n=i.pop(),n.children[n.index]=t[A];n.index>0;)n=i.pop();for(n.index++,i.push(n);i.length<=s;)i.push(a={children:[],index:0}),n.children[n.index]=a.children,n=a;A++}s+1<r&&(i.push(a={children:[],index:0}),n.children[n.index]=a.children,n=a)}return i[0].children}function wn(e,t,A,i,r,a,n,s,o){const{mcusPerLine:l,progressive:g}=A,h=t;let c=t,f=0,d=0;function u(){if(d>0)return d--,f>>d&1;if(f=e[c++],255===f){const t=e[c++];if(t)throw new Error(`unexpected marker: ${(f<<8|t).toString(16)}`)}return d=7,f>>>7}function I(e){let t,A=e;for(;null!==(t=u());){if(A=A[t],"number"==typeof A)return A;if("object"!=typeof A)throw new Error("invalid huffman sequence")}return null}function B(e){let t=e,A=0;for(;t>0;){const e=u();if(null===e)return;A=A<<1|e,--t}return A}function C(e){const t=B(e);return t>=1<<e-1?t:t+(-1<<e)+1}let E=0;let w,Q=0;function m(e,t,A,i,r){const a=A%l,n=(A/l|0)*e.v+i,s=a*e.h+r;t(e,e.blocks[n][s])}function p(e,t,A){const i=A/e.blocksPerLine|0,r=A%e.blocksPerLine;t(e,e.blocks[i][r])}const y=i.length;let _,b,D,k,v,x;x=g?0===a?0===s?function(e,t){const A=I(e.huffmanTableDC),i=0===A?0:C(A)<<o;e.pred+=i,t[0]=e.pred}:function(e,t){t[0]|=u()<<o}:0===s?function(e,t){if(E>0)return void E--;let A=a;const i=n;for(;A<=i;){const i=I(e.huffmanTableAC),r=15&i,a=i>>4;if(0===r){if(a<15){E=B(a)+(1<<a)-1;break}A+=16}else A+=a,t[gn[A]]=C(r)*(1<<o),A++}}:function(e,t){let A=a;const i=n;let r=0;for(;A<=i;){const i=gn[A],a=t[i]<0?-1:1;switch(Q){case 0:{const t=I(e.huffmanTableAC),A=15&t;if(r=t>>4,0===A)r<15?(E=B(r)+(1<<r),Q=4):(r=16,Q=1);else{if(1!==A)throw new Error("invalid ACn encoding");w=C(A),Q=r?2:3}continue}case 1:case 2:t[i]?t[i]+=(u()<<o)*a:(r--,0===r&&(Q=2===Q?3:0));break;case 3:t[i]?t[i]+=(u()<<o)*a:(t[i]=w<<o,Q=0);break;case 4:t[i]&&(t[i]+=(u()<<o)*a)}A++}4===Q&&(E--,0===E&&(Q=0))}:function(e,t){const A=I(e.huffmanTableDC),i=0===A?0:C(A);e.pred+=i,t[0]=e.pred;let r=1;for(;r<64;){const A=I(e.huffmanTableAC),i=15&A,a=A>>4;if(0===i){if(a<15)break;r+=16}else r+=a,t[gn[r]]=C(i),r++}};let S,G,U=0;G=1===y?i[0].blocksPerLine*i[0].blocksPerColumn:l*A.mcusPerColumn;const M=r||G;for(;U<G;){for(b=0;b<y;b++)i[b].pred=0;if(E=0,1===y)for(_=i[0],v=0;v<M;v++)p(_,x,U),U++;else for(v=0;v<M;v++){for(b=0;b<y;b++){_=i[b];const{h:e,v:t}=_;for(D=0;D<t;D++)for(k=0;k<e;k++)m(_,x,U,D,k)}if(U++,U===G)break}if(d=0,S=e[c]<<8|e[c+1],S<65280)throw new Error("marker was not found");if(!(S>=65488&&S<=65495))break;c+=2}return c-h}function Qn(e,t){const A=[],{blocksPerLine:i,blocksPerColumn:r}=t,a=i<<3,n=new Int32Array(64),s=new Uint8Array(64);function o(e,A,i){const r=t.quantizationTable;let a,n,s,o,l,g,h,c,f;const d=i;let u;for(u=0;u<64;u++)d[u]=e[u]*r[u];for(u=0;u<8;++u){const e=8*u;0!==d[1+e]||0!==d[2+e]||0!==d[3+e]||0!==d[4+e]||0!==d[5+e]||0!==d[6+e]||0!==d[7+e]?(a=Bn*d[0+e]+128>>8,n=Bn*d[4+e]+128>>8,s=d[2+e],o=d[6+e],l=Cn*(d[1+e]-d[7+e])+128>>8,c=Cn*(d[1+e]+d[7+e])+128>>8,g=d[3+e]<<4,h=d[5+e]<<4,f=a-n+1>>1,a=a+n+1>>1,n=f,f=s*In+o*un+128>>8,s=s*un-o*In+128>>8,o=f,f=l-h+1>>1,l=l+h+1>>1,h=f,f=c+g+1>>1,g=c-g+1>>1,c=f,f=a-o+1>>1,a=a+o+1>>1,o=f,f=n-s+1>>1,n=n+s+1>>1,s=f,f=l*dn+c*fn+2048>>12,l=l*fn-c*dn+2048>>12,c=f,f=g*cn+h*hn+2048>>12,g=g*hn-h*cn+2048>>12,h=f,d[0+e]=a+c,d[7+e]=a-c,d[1+e]=n+h,d[6+e]=n-h,d[2+e]=s+g,d[5+e]=s-g,d[3+e]=o+l,d[4+e]=o-l):(f=Bn*d[0+e]+512>>10,d[0+e]=f,d[1+e]=f,d[2+e]=f,d[3+e]=f,d[4+e]=f,d[5+e]=f,d[6+e]=f,d[7+e]=f)}for(u=0;u<8;++u){const e=u;0!==d[8+e]||0!==d[16+e]||0!==d[24+e]||0!==d[32+e]||0!==d[40+e]||0!==d[48+e]||0!==d[56+e]?(a=Bn*d[0+e]+2048>>12,n=Bn*d[32+e]+2048>>12,s=d[16+e],o=d[48+e],l=Cn*(d[8+e]-d[56+e])+2048>>12,c=Cn*(d[8+e]+d[56+e])+2048>>12,g=d[24+e],h=d[40+e],f=a-n+1>>1,a=a+n+1>>1,n=f,f=s*In+o*un+2048>>12,s=s*un-o*In+2048>>12,o=f,f=l-h+1>>1,l=l+h+1>>1,h=f,f=c+g+1>>1,g=c-g+1>>1,c=f,f=a-o+1>>1,a=a+o+1>>1,o=f,f=n-s+1>>1,n=n+s+1>>1,s=f,f=l*dn+c*fn+2048>>12,l=l*fn-c*dn+2048>>12,c=f,f=g*cn+h*hn+2048>>12,g=g*hn-h*cn+2048>>12,h=f,d[0+e]=a+c,d[56+e]=a-c,d[8+e]=n+h,d[48+e]=n-h,d[16+e]=s+g,d[40+e]=s-g,d[24+e]=o+l,d[32+e]=o-l):(f=Bn*i[u+0]+8192>>14,d[0+e]=f,d[8+e]=f,d[16+e]=f,d[24+e]=f,d[32+e]=f,d[40+e]=f,d[48+e]=f,d[56+e]=f)}for(u=0;u<64;++u){const e=128+(d[u]+8>>4);A[u]=e<0?0:e>255?255:e}}for(let e=0;e<r;e++){const r=e<<3;for(let e=0;e<8;e++)A.push(new Uint8Array(a));for(let a=0;a<i;a++){o(t.blocks[e][a],s,n);let i=0;const l=a<<3;for(let e=0;e<8;e++){const t=A[r+e];for(let e=0;e<8;e++)t[l+e]=s[i++]}}}return A}class mn{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(e){let t=0;function A(){const A=e[t]<<8|e[t+1];return t+=2,A}function i(){const i=A(),r=e.subarray(t,t+i-2);return t+=r.length,r}function r(e){let t,A,i=0,r=0;for(A in e.components)e.components.hasOwnProperty(A)&&(t=e.components[A],i<t.h&&(i=t.h),r<t.v&&(r=t.v));const a=Math.ceil(e.samplesPerLine/8/i),n=Math.ceil(e.scanLines/8/r);for(A in e.components)if(e.components.hasOwnProperty(A)){t=e.components[A];const s=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/i),o=Math.ceil(Math.ceil(e.scanLines/8)*t.v/r),l=a*t.h,g=n*t.v,h=[];for(let e=0;e<g;e++){const e=[];for(let t=0;t<l;t++)e.push(new Int32Array(64));h.push(e)}t.blocksPerLine=s,t.blocksPerColumn=o,t.blocks=h}e.maxH=i,e.maxV=r,e.mcusPerLine=a,e.mcusPerColumn=n}let a=A();if(65496!==a)throw new Error("SOI not found");for(a=A();65497!==a;){switch(a){case 65280:break;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:{const e=i();65504===a&&74===e[0]&&70===e[1]&&73===e[2]&&70===e[3]&&0===e[4]&&(this.jfif={version:{major:e[5],minor:e[6]},densityUnits:e[7],xDensity:e[8]<<8|e[9],yDensity:e[10]<<8|e[11],thumbWidth:e[12],thumbHeight:e[13],thumbData:e.subarray(14,14+3*e[12]*e[13])}),65518===a&&65===e[0]&&100===e[1]&&111===e[2]&&98===e[3]&&101===e[4]&&0===e[5]&&(this.adobe={version:e[6],flags0:e[7]<<8|e[8],flags1:e[9]<<8|e[10],transformCode:e[11]});break}case 65499:{const i=A()+t-2;for(;t<i;){const i=e[t++],r=new Int32Array(64);if(i>>4==0)for(let A=0;A<64;A++){r[gn[A]]=e[t++]}else{if(i>>4!=1)throw new Error("DQT: invalid table spec");for(let e=0;e<64;e++){r[gn[e]]=A()}}this.quantizationTables[15&i]=r}break}case 65472:case 65473:case 65474:{A();const i={extended:65473===a,progressive:65474===a,precision:e[t++],scanLines:A(),samplesPerLine:A(),components:{},componentsOrder:[]},n=e[t++];let s;for(let A=0;A<n;A++){s=e[t];const A=e[t+1]>>4,r=15&e[t+1],a=e[t+2];i.componentsOrder.push(s),i.components[s]={h:A,v:r,quantizationIdx:a},t+=3}r(i),this.frames.push(i);break}case 65476:{const i=A();for(let A=2;A<i;){const i=e[t++],r=new Uint8Array(16);let a=0;for(let A=0;A<16;A++,t++)r[A]=e[t],a+=r[A];const n=new Uint8Array(a);for(let A=0;A<a;A++,t++)n[A]=e[t];A+=17+a,i>>4==0?this.huffmanTablesDC[15&i]=En(r,n):this.huffmanTablesAC[15&i]=En(r,n)}break}case 65501:A(),this.resetInterval=A();break;case 65498:{A();const i=e[t++],r=[],a=this.frames[0];for(let A=0;A<i;A++){const A=a.components[e[t++]],i=e[t++];A.huffmanTableDC=this.huffmanTablesDC[i>>4],A.huffmanTableAC=this.huffmanTablesAC[15&i],r.push(A)}const n=e[t++],s=e[t++],o=e[t++],l=wn(e,t,a,r,this.resetInterval,n,s,o>>4,15&o);t+=l;break}case 65535:255!==e[t]&&t--;break;default:if(255===e[t-3]&&e[t-2]>=192&&e[t-2]<=254){t-=3;break}throw new Error(`unknown JPEG marker ${a.toString(16)}`)}a=A()}}getResult(){const{frames:e}=this;if(0===this.frames.length)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(let e=0;e<this.frames.length;e++){const t=this.frames[e].components;for(const e of Object.keys(t))t[e].quantizationTable=this.quantizationTables[t[e].quantizationIdx],delete t[e].quantizationIdx}const t=e[0],{components:A,componentsOrder:i}=t,r=[],a=t.samplesPerLine,n=t.scanLines;for(let e=0;e<i.length;e++){const a=A[i[e]];r.push({lines:Qn(0,a),scaleX:a.h/t.maxH,scaleY:a.v/t.maxV})}const s=new Uint8Array(a*n*r.length);let o=0;for(let e=0;e<n;++e)for(let t=0;t<a;++t)for(let A=0;A<r.length;++A){const i=r[A];s[o]=i.lines[0|e*i.scaleY][0|t*i.scaleX],++o}return s}}var pn=Object.freeze({__proto__:null,default:class extends za{constructor(e){super(),this.reader=new mn,e.JPEGTables&&this.reader.parse(e.JPEGTables)}decodeBlock(e){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(e)),this.reader.getResult().buffer}}});
3
+ /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function yn(e){let t=e.length;for(;--t>=0;)e[t]=0}const _n=256,bn=286,Dn=30,kn=15,vn=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),xn=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Sn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Gn=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Un=new Array(576);yn(Un);const Mn=new Array(60);yn(Mn);const Rn=new Array(512);yn(Rn);const Fn=new Array(256);yn(Fn);const Ln=new Array(29);yn(Ln);const Tn=new Array(Dn);function Nn(e,t,A,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=A,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}let Pn,On,zn;function Kn(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}yn(Tn);const Hn=e=>e<256?Rn[e]:Rn[256+(e>>>7)],Jn=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},qn=(e,t,A)=>{e.bi_valid>16-A?(e.bi_buf|=t<<e.bi_valid&65535,Jn(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=A-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=A)},Yn=(e,t,A)=>{qn(e,A[2*t],A[2*t+1])},Vn=(e,t)=>{let A=0;do{A|=1&e,e>>>=1,A<<=1}while(--t>0);return A>>>1},Zn=(e,t,A)=>{const i=new Array(16);let r,a,n=0;for(r=1;r<=kn;r++)n=n+A[r-1]<<1,i[r]=n;for(a=0;a<=t;a++){let t=e[2*a+1];0!==t&&(e[2*a]=Vn(i[t]++,t))}},jn=e=>{let t;for(t=0;t<bn;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Dn;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Wn=e=>{e.bi_valid>8?Jn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Xn=(e,t,A,i)=>{const r=2*t,a=2*A;return e[r]<e[a]||e[r]===e[a]&&i[t]<=i[A]},$n=(e,t,A)=>{const i=e.heap[A];let r=A<<1;for(;r<=e.heap_len&&(r<e.heap_len&&Xn(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Xn(t,i,e.heap[r],e.depth));)e.heap[A]=e.heap[r],A=r,r<<=1;e.heap[A]=i},es=(e,t,A)=>{let i,r,a,n,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,r=e.pending_buf[e.sym_buf+s++],0===i?Yn(e,r,t):(a=Fn[r],Yn(e,a+_n+1,t),n=vn[a],0!==n&&(r-=Ln[a],qn(e,r,n)),i--,a=Hn(i),Yn(e,a,A),n=xn[a],0!==n&&(i-=Tn[a],qn(e,i,n)))}while(s<e.sym_next);Yn(e,256,t)},ts=(e,t)=>{const A=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.elems;let n,s,o,l=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<a;n++)0!==A[2*n]?(e.heap[++e.heap_len]=l=n,e.depth[n]=0):A[2*n+1]=0;for(;e.heap_len<2;)o=e.heap[++e.heap_len]=l<2?++l:0,A[2*o]=1,e.depth[o]=0,e.opt_len--,r&&(e.static_len-=i[2*o+1]);for(t.max_code=l,n=e.heap_len>>1;n>=1;n--)$n(e,A,n);o=a;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],$n(e,A,1),s=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=s,A[2*o]=A[2*n]+A[2*s],e.depth[o]=(e.depth[n]>=e.depth[s]?e.depth[n]:e.depth[s])+1,A[2*n+1]=A[2*s+1]=o,e.heap[1]=o++,$n(e,A,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const A=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,a=t.stat_desc.has_stree,n=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,o=t.stat_desc.max_length;let l,g,h,c,f,d,u=0;for(c=0;c<=kn;c++)e.bl_count[c]=0;for(A[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)g=e.heap[l],c=A[2*A[2*g+1]+1]+1,c>o&&(c=o,u++),A[2*g+1]=c,g>i||(e.bl_count[c]++,f=0,g>=s&&(f=n[g-s]),d=A[2*g],e.opt_len+=d*(c+f),a&&(e.static_len+=d*(r[2*g+1]+f)));if(0!==u){do{for(c=o-1;0===e.bl_count[c];)c--;e.bl_count[c]--,e.bl_count[c+1]+=2,e.bl_count[o]--,u-=2}while(u>0);for(c=o;0!==c;c--)for(g=e.bl_count[c];0!==g;)h=e.heap[--l],h>i||(A[2*h+1]!==c&&(e.opt_len+=(c-A[2*h+1])*A[2*h],A[2*h+1]=c),g--)}})(e,t),Zn(A,l,e.bl_count)},As=(e,t,A)=>{let i,r,a=-1,n=t[1],s=0,o=7,l=4;for(0===n&&(o=138,l=3),t[2*(A+1)+1]=65535,i=0;i<=A;i++)r=n,n=t[2*(i+1)+1],++s<o&&r===n||(s<l?e.bl_tree[2*r]+=s:0!==r?(r!==a&&e.bl_tree[2*r]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,a=r,0===n?(o=138,l=3):r===n?(o=6,l=3):(o=7,l=4))},is=(e,t,A)=>{let i,r,a=-1,n=t[1],s=0,o=7,l=4;for(0===n&&(o=138,l=3),i=0;i<=A;i++)if(r=n,n=t[2*(i+1)+1],!(++s<o&&r===n)){if(s<l)do{Yn(e,r,e.bl_tree)}while(0!=--s);else 0!==r?(r!==a&&(Yn(e,r,e.bl_tree),s--),Yn(e,16,e.bl_tree),qn(e,s-3,2)):s<=10?(Yn(e,17,e.bl_tree),qn(e,s-3,3)):(Yn(e,18,e.bl_tree),qn(e,s-11,7));s=0,a=r,0===n?(o=138,l=3):r===n?(o=6,l=3):(o=7,l=4)}};let rs=!1;const as=(e,t,A,i)=>{qn(e,0+(i?1:0),3),Wn(e),Jn(e,A),Jn(e,~A),A&&e.pending_buf.set(e.window.subarray(t,t+A),e.pending),e.pending+=A};var ns=(e,t,A,i)=>{let r,a,n=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,A=4093624447;for(t=0;t<=31;t++,A>>>=1)if(1&A&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<_n;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),ts(e,e.l_desc),ts(e,e.d_desc),n=(e=>{let t;for(As(e,e.dyn_ltree,e.l_desc.max_code),As(e,e.dyn_dtree,e.d_desc.max_code),ts(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Gn[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=A+5,A+4<=r&&-1!==t?as(e,t,A,i):4===e.strategy||a===r?(qn(e,2+(i?1:0),3),es(e,Un,Mn)):(qn(e,4+(i?1:0),3),((e,t,A,i)=>{let r;for(qn(e,t-257,5),qn(e,A-1,5),qn(e,i-4,4),r=0;r<i;r++)qn(e,e.bl_tree[2*Gn[r]+1],3);is(e,e.dyn_ltree,t-1),is(e,e.dyn_dtree,A-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,n+1),es(e,e.dyn_ltree,e.dyn_dtree)),jn(e),i&&Wn(e)},ss={_tr_init:e=>{rs||((()=>{let e,t,A,i,r;const a=new Array(16);for(A=0,i=0;i<28;i++)for(Ln[i]=A,e=0;e<1<<vn[i];e++)Fn[A++]=i;for(Fn[A-1]=i,r=0,i=0;i<16;i++)for(Tn[i]=r,e=0;e<1<<xn[i];e++)Rn[r++]=i;for(r>>=7;i<Dn;i++)for(Tn[i]=r<<7,e=0;e<1<<xn[i]-7;e++)Rn[256+r++]=i;for(t=0;t<=kn;t++)a[t]=0;for(e=0;e<=143;)Un[2*e+1]=8,e++,a[8]++;for(;e<=255;)Un[2*e+1]=9,e++,a[9]++;for(;e<=279;)Un[2*e+1]=7,e++,a[7]++;for(;e<=287;)Un[2*e+1]=8,e++,a[8]++;for(Zn(Un,287,a),e=0;e<Dn;e++)Mn[2*e+1]=5,Mn[2*e]=Vn(e,5);Pn=new Nn(Un,vn,257,bn,kn),On=new Nn(Mn,xn,0,Dn,kn),zn=new Nn(new Array(0),Sn,0,19,7)})(),rs=!0),e.l_desc=new Kn(e.dyn_ltree,Pn),e.d_desc=new Kn(e.dyn_dtree,On),e.bl_desc=new Kn(e.bl_tree,zn),e.bi_buf=0,e.bi_valid=0,jn(e)},_tr_stored_block:as,_tr_flush_block:ns,_tr_tally:(e,t,A)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=A,0===t?e.dyn_ltree[2*A]++:(e.matches++,t--,e.dyn_ltree[2*(Fn[A]+_n+1)]++,e.dyn_dtree[2*Hn(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{qn(e,2,3),Yn(e,256,Un),(e=>{16===e.bi_valid?(Jn(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var os=(e,t,A,i)=>{let r=65535&e|0,a=e>>>16&65535|0,n=0;for(;0!==A;){n=A>2e3?2e3:A,A-=n;do{r=r+t[i++]|0,a=a+r|0}while(--n);r%=65521,a%=65521}return r|a<<16|0};const ls=new Uint32Array((()=>{let e,t=[];for(var A=0;A<256;A++){e=A;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[A]=e}return t})());var gs=(e,t,A,i)=>{const r=ls,a=i+A;e^=-1;for(let A=i;A<a;A++)e=e>>>8^r[255&(e^t[A])];return-1^e},hs={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},cs={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:fs,_tr_stored_block:ds,_tr_flush_block:us,_tr_tally:Is,_tr_align:Bs}=ss,{Z_NO_FLUSH:Cs,Z_PARTIAL_FLUSH:Es,Z_FULL_FLUSH:ws,Z_FINISH:Qs,Z_BLOCK:ms,Z_OK:ps,Z_STREAM_END:ys,Z_STREAM_ERROR:_s,Z_DATA_ERROR:bs,Z_BUF_ERROR:Ds,Z_DEFAULT_COMPRESSION:ks,Z_FILTERED:vs,Z_HUFFMAN_ONLY:xs,Z_RLE:Ss,Z_FIXED:Gs,Z_DEFAULT_STRATEGY:Us,Z_UNKNOWN:Ms,Z_DEFLATED:Rs}=cs,Fs=258,Ls=262,Ts=42,Ns=113,Ps=666,Os=(e,t)=>(e.msg=hs[t],t),zs=e=>2*e-(e>4?9:0),Ks=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Hs=e=>{let t,A,i,r=e.w_size;t=e.hash_size,i=t;do{A=e.head[--i],e.head[i]=A>=r?A-r:0}while(--t);t=r,i=t;do{A=e.prev[--i],e.prev[i]=A>=r?A-r:0}while(--t)};let Js=(e,t,A)=>(t<<e.hash_shift^A)&e.hash_mask;const qs=e=>{const t=e.state;let A=t.pending;A>e.avail_out&&(A=e.avail_out),0!==A&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+A),e.next_out),e.next_out+=A,t.pending_out+=A,e.total_out+=A,e.avail_out-=A,t.pending-=A,0===t.pending&&(t.pending_out=0))},Ys=(e,t)=>{us(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,qs(e.strm)},Vs=(e,t)=>{e.pending_buf[e.pending++]=t},Zs=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},js=(e,t,A,i)=>{let r=e.avail_in;return r>i&&(r=i),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),A),1===e.state.wrap?e.adler=os(e.adler,t,r,A):2===e.state.wrap&&(e.adler=gs(e.adler,t,r,A)),e.next_in+=r,e.total_in+=r,r)},Ws=(e,t)=>{let A,i,r=e.max_chain_length,a=e.strstart,n=e.prev_length,s=e.nice_match;const o=e.strstart>e.w_size-Ls?e.strstart-(e.w_size-Ls):0,l=e.window,g=e.w_mask,h=e.prev,c=e.strstart+Fs;let f=l[a+n-1],d=l[a+n];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do{if(A=t,l[A+n]===d&&l[A+n-1]===f&&l[A]===l[a]&&l[++A]===l[a+1]){a+=2,A++;do{}while(l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&a<c);if(i=Fs-(c-a),a=c-Fs,i>n){if(e.match_start=t,n=i,i>=s)break;f=l[a+n-1],d=l[a+n]}}}while((t=h[t&g])>o&&0!=--r);return n<=e.lookahead?n:e.lookahead},Xs=e=>{const t=e.w_size;let A,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ls)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Hs(e),i+=t),0===e.strm.avail_in)break;if(A=js(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=A,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=Js(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=Js(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Ls&&0!==e.strm.avail_in)},$s=(e,t)=>{let A,i,r,a=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n=0,s=e.strm.avail_in;do{if(A=65535,r=e.bi_valid+42>>3,e.strm.avail_out<r)break;if(r=e.strm.avail_out-r,i=e.strstart-e.block_start,A>i+e.strm.avail_in&&(A=i+e.strm.avail_in),A>r&&(A=r),A<a&&(0===A&&t!==Qs||t===Cs||A!==i+e.strm.avail_in))break;n=t===Qs&&A===i+e.strm.avail_in?1:0,ds(e,0,0,n),e.pending_buf[e.pending-4]=A,e.pending_buf[e.pending-3]=A>>8,e.pending_buf[e.pending-2]=~A,e.pending_buf[e.pending-1]=~A>>8,qs(e.strm),i&&(i>A&&(i=A),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,A-=i),A&&(js(e.strm,e.strm.output,e.strm.next_out,A),e.strm.next_out+=A,e.strm.avail_out-=A,e.strm.total_out+=A)}while(0===n);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),n?4:t!==Cs&&t!==Qs&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(r=e.window_size-e.strstart,e.strm.avail_in>r&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(js(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water<e.strstart&&(e.high_water=e.strstart),r=e.bi_valid+42>>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,a=r>e.w_size?e.w_size:r,i=e.strstart-e.block_start,(i>=a||(i||t===Qs)&&t!==Cs&&0===e.strm.avail_in&&i<=r)&&(A=i>r?r:i,n=t===Qs&&0===e.strm.avail_in&&A===i?1:0,ds(e,e.block_start,A,n),e.block_start+=A,qs(e.strm)),n?3:1)},eo=(e,t)=>{let A,i;for(;;){if(e.lookahead<Ls){if(Xs(e),e.lookahead<Ls&&t===Cs)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Js(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==A&&e.strstart-A<=e.w_size-Ls&&(e.match_length=Ws(e,A)),e.match_length>=3)if(i=Is(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Js(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Js(e,e.ins_h,e.window[e.strstart+1]);else i=Is(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Ys(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Qs?(Ys(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ys(e,!1),0===e.strm.avail_out)?1:2},to=(e,t)=>{let A,i,r;for(;;){if(e.lookahead<Ls){if(Xs(e),e.lookahead<Ls&&t===Cs)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Js(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==A&&e.prev_length<e.max_lazy_match&&e.strstart-A<=e.w_size-Ls&&(e.match_length=Ws(e,A),e.match_length<=5&&(e.strategy===vs||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,i=Is(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=Js(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(Ys(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=Is(e,0,e.window[e.strstart-1]),i&&Ys(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=Is(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Qs?(Ys(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ys(e,!1),0===e.strm.avail_out)?1:2};function Ao(e,t,A,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=A,this.max_chain=i,this.func=r}const io=[new Ao(0,0,0,0,$s),new Ao(4,4,8,4,eo),new Ao(4,5,16,8,eo),new Ao(4,6,32,32,eo),new Ao(4,4,16,16,to),new Ao(8,16,32,32,to),new Ao(8,16,128,128,to),new Ao(8,32,128,256,to),new Ao(32,128,258,1024,to),new Ao(32,258,258,4096,to)];function ro(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Rs,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Ks(this.dyn_ltree),Ks(this.dyn_dtree),Ks(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Ks(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ks(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const ao=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Ts&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Ns&&t.status!==Ps?1:0},no=e=>{if(ao(e))return Os(e,_s);e.total_in=e.total_out=0,e.data_type=Ms;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Ts:Ns,e.adler=2===t.wrap?0:1,t.last_flush=-2,fs(t),ps},so=e=>{const t=no(e);var A;return t===ps&&((A=e.state).window_size=2*A.w_size,Ks(A.head),A.max_lazy_match=io[A.level].max_lazy,A.good_match=io[A.level].good_length,A.nice_match=io[A.level].nice_length,A.max_chain_length=io[A.level].max_chain,A.strstart=0,A.block_start=0,A.lookahead=0,A.insert=0,A.match_length=A.prev_length=2,A.match_available=0,A.ins_h=0),t},oo=(e,t,A,i,r,a)=>{if(!e)return _s;let n=1;if(t===ks&&(t=6),i<0?(n=0,i=-i):i>15&&(n=2,i-=16),r<1||r>9||A!==Rs||i<8||i>15||t<0||t>9||a<0||a>Gs||8===i&&1!==n)return Os(e,_s);8===i&&(i=9);const s=new ro;return e.state=s,s.strm=e,s.status=Ts,s.wrap=n,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=r+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<r+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=a,s.method=A,so(e)};var lo={deflateInit:(e,t)=>oo(e,t,Rs,15,8,Us),deflateInit2:oo,deflateReset:so,deflateResetKeep:no,deflateSetHeader:(e,t)=>ao(e)||2!==e.state.wrap?_s:(e.state.gzhead=t,ps),deflate:(e,t)=>{if(ao(e)||t>ms||t<0)return e?Os(e,_s):_s;const A=e.state;if(!e.output||0!==e.avail_in&&!e.input||A.status===Ps&&t!==Qs)return Os(e,0===e.avail_out?Ds:_s);const i=A.last_flush;if(A.last_flush=t,0!==A.pending){if(qs(e),0===e.avail_out)return A.last_flush=-1,ps}else if(0===e.avail_in&&zs(t)<=zs(i)&&t!==Qs)return Os(e,Ds);if(A.status===Ps&&0!==e.avail_in)return Os(e,Ds);if(A.status===Ts&&0===A.wrap&&(A.status=Ns),A.status===Ts){let t=Rs+(A.w_bits-8<<4)<<8,i=-1;if(i=A.strategy>=xs||A.level<2?0:A.level<6?1:6===A.level?2:3,t|=i<<6,0!==A.strstart&&(t|=32),t+=31-t%31,Zs(A,t),0!==A.strstart&&(Zs(A,e.adler>>>16),Zs(A,65535&e.adler)),e.adler=1,A.status=Ns,qs(e),0!==A.pending)return A.last_flush=-1,ps}if(57===A.status)if(e.adler=0,Vs(A,31),Vs(A,139),Vs(A,8),A.gzhead)Vs(A,(A.gzhead.text?1:0)+(A.gzhead.hcrc?2:0)+(A.gzhead.extra?4:0)+(A.gzhead.name?8:0)+(A.gzhead.comment?16:0)),Vs(A,255&A.gzhead.time),Vs(A,A.gzhead.time>>8&255),Vs(A,A.gzhead.time>>16&255),Vs(A,A.gzhead.time>>24&255),Vs(A,9===A.level?2:A.strategy>=xs||A.level<2?4:0),Vs(A,255&A.gzhead.os),A.gzhead.extra&&A.gzhead.extra.length&&(Vs(A,255&A.gzhead.extra.length),Vs(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(e.adler=gs(e.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=69;else if(Vs(A,0),Vs(A,0),Vs(A,0),Vs(A,0),Vs(A,0),Vs(A,9===A.level?2:A.strategy>=xs||A.level<2?4:0),Vs(A,3),A.status=Ns,qs(e),0!==A.pending)return A.last_flush=-1,ps;if(69===A.status){if(A.gzhead.extra){let t=A.pending,i=(65535&A.gzhead.extra.length)-A.gzindex;for(;A.pending+i>A.pending_buf_size;){let r=A.pending_buf_size-A.pending;if(A.pending_buf.set(A.gzhead.extra.subarray(A.gzindex,A.gzindex+r),A.pending),A.pending=A.pending_buf_size,A.gzhead.hcrc&&A.pending>t&&(e.adler=gs(e.adler,A.pending_buf,A.pending-t,t)),A.gzindex+=r,qs(e),0!==A.pending)return A.last_flush=-1,ps;t=0,i-=r}let r=new Uint8Array(A.gzhead.extra);A.pending_buf.set(r.subarray(A.gzindex,A.gzindex+i),A.pending),A.pending+=i,A.gzhead.hcrc&&A.pending>t&&(e.adler=gs(e.adler,A.pending_buf,A.pending-t,t)),A.gzindex=0}A.status=73}if(73===A.status){if(A.gzhead.name){let t,i=A.pending;do{if(A.pending===A.pending_buf_size){if(A.gzhead.hcrc&&A.pending>i&&(e.adler=gs(e.adler,A.pending_buf,A.pending-i,i)),qs(e),0!==A.pending)return A.last_flush=-1,ps;i=0}t=A.gzindex<A.gzhead.name.length?255&A.gzhead.name.charCodeAt(A.gzindex++):0,Vs(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=gs(e.adler,A.pending_buf,A.pending-i,i)),A.gzindex=0}A.status=91}if(91===A.status){if(A.gzhead.comment){let t,i=A.pending;do{if(A.pending===A.pending_buf_size){if(A.gzhead.hcrc&&A.pending>i&&(e.adler=gs(e.adler,A.pending_buf,A.pending-i,i)),qs(e),0!==A.pending)return A.last_flush=-1,ps;i=0}t=A.gzindex<A.gzhead.comment.length?255&A.gzhead.comment.charCodeAt(A.gzindex++):0,Vs(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=gs(e.adler,A.pending_buf,A.pending-i,i))}A.status=103}if(103===A.status){if(A.gzhead.hcrc){if(A.pending+2>A.pending_buf_size&&(qs(e),0!==A.pending))return A.last_flush=-1,ps;Vs(A,255&e.adler),Vs(A,e.adler>>8&255),e.adler=0}if(A.status=Ns,qs(e),0!==A.pending)return A.last_flush=-1,ps}if(0!==e.avail_in||0!==A.lookahead||t!==Cs&&A.status!==Ps){let i=0===A.level?$s(A,t):A.strategy===xs?((e,t)=>{let A;for(;;){if(0===e.lookahead&&(Xs(e),0===e.lookahead)){if(t===Cs)return 1;break}if(e.match_length=0,A=Is(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,A&&(Ys(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Qs?(Ys(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ys(e,!1),0===e.strm.avail_out)?1:2})(A,t):A.strategy===Ss?((e,t)=>{let A,i,r,a;const n=e.window;for(;;){if(e.lookahead<=Fs){if(Xs(e),e.lookahead<=Fs&&t===Cs)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,i=n[r],i===n[++r]&&i===n[++r]&&i===n[++r])){a=e.strstart+Fs;do{}while(i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&r<a);e.match_length=Fs-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(A=Is(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(A=Is(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),A&&(Ys(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Qs?(Ys(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ys(e,!1),0===e.strm.avail_out)?1:2})(A,t):io[A.level].func(A,t);if(3!==i&&4!==i||(A.status=Ps),1===i||3===i)return 0===e.avail_out&&(A.last_flush=-1),ps;if(2===i&&(t===Es?Bs(A):t!==ms&&(ds(A,0,0,!1),t===ws&&(Ks(A.head),0===A.lookahead&&(A.strstart=0,A.block_start=0,A.insert=0))),qs(e),0===e.avail_out))return A.last_flush=-1,ps}return t!==Qs?ps:A.wrap<=0?ys:(2===A.wrap?(Vs(A,255&e.adler),Vs(A,e.adler>>8&255),Vs(A,e.adler>>16&255),Vs(A,e.adler>>24&255),Vs(A,255&e.total_in),Vs(A,e.total_in>>8&255),Vs(A,e.total_in>>16&255),Vs(A,e.total_in>>24&255)):(Zs(A,e.adler>>>16),Zs(A,65535&e.adler)),qs(e),A.wrap>0&&(A.wrap=-A.wrap),0!==A.pending?ps:ys)},deflateEnd:e=>{if(ao(e))return _s;const t=e.state.status;return e.state=null,t===Ns?Os(e,bs):ps},deflateSetDictionary:(e,t)=>{let A=t.length;if(ao(e))return _s;const i=e.state,r=i.wrap;if(2===r||1===r&&i.status!==Ts||i.lookahead)return _s;if(1===r&&(e.adler=os(e.adler,t,A,0)),i.wrap=0,A>=i.w_size){0===r&&(Ks(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(A-i.w_size,A),0),t=e,A=i.w_size}const a=e.avail_in,n=e.next_in,s=e.input;for(e.avail_in=A,e.next_in=0,e.input=t,Xs(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=Js(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,Xs(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=n,e.input=s,e.avail_in=a,i.wrap=r,ps},deflateInfo:"pako deflate (from Nodeca project)"};const go=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var ho={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const A=t.shift();if(A){if("object"!=typeof A)throw new TypeError(A+"must be non-object");for(const t in A)go(A,t)&&(e[t]=A[t])}}return e},flattenChunks:e=>{let t=0;for(let A=0,i=e.length;A<i;A++)t+=e[A].length;const A=new Uint8Array(t);for(let t=0,i=0,r=e.length;t<r;t++){let r=e[t];A.set(r,i),i+=r.length}return A}};let co=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){co=!1}const fo=new Uint8Array(256);for(let e=0;e<256;e++)fo[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;fo[254]=fo[254]=1;var uo={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,A,i,r,a,n=e.length,s=0;for(r=0;r<n;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<n&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(A=65536+(A-55296<<10)+(i-56320),r++)),s+=A<128?1:A<2048?2:A<65536?3:4;for(t=new Uint8Array(s),a=0,r=0;a<s;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<n&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(A=65536+(A-55296<<10)+(i-56320),r++)),A<128?t[a++]=A:A<2048?(t[a++]=192|A>>>6,t[a++]=128|63&A):A<65536?(t[a++]=224|A>>>12,t[a++]=128|A>>>6&63,t[a++]=128|63&A):(t[a++]=240|A>>>18,t[a++]=128|A>>>12&63,t[a++]=128|A>>>6&63,t[a++]=128|63&A);return t},buf2string:(e,t)=>{const A=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,r;const a=new Array(2*A);for(r=0,i=0;i<A;){let t=e[i++];if(t<128){a[r++]=t;continue}let n=fo[t];if(n>4)a[r++]=65533,i+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&i<A;)t=t<<6|63&e[i++],n--;n>1?a[r++]=65533:t<65536?a[r++]=t:(t-=65536,a[r++]=55296|t>>10&1023,a[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&co)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let A="";for(let i=0;i<t;i++)A+=String.fromCharCode(e[i]);return A})(a,r)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let A=t-1;for(;A>=0&&128==(192&e[A]);)A--;return A<0||0===A?t:A+fo[e[A]]>t?A:t}};var Io=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Bo=Object.prototype.toString,{Z_NO_FLUSH:Co,Z_SYNC_FLUSH:Eo,Z_FULL_FLUSH:wo,Z_FINISH:Qo,Z_OK:mo,Z_STREAM_END:po,Z_DEFAULT_COMPRESSION:yo,Z_DEFAULT_STRATEGY:_o,Z_DEFLATED:bo}=cs;function Do(e){this.options=ho.assign({level:yo,method:bo,chunkSize:16384,windowBits:15,memLevel:8,strategy:_o},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Io,this.strm.avail_out=0;let A=lo.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(A!==mo)throw new Error(hs[A]);if(t.header&&lo.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?uo.string2buf(t.dictionary):"[object ArrayBuffer]"===Bo.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,A=lo.deflateSetDictionary(this.strm,e),A!==mo)throw new Error(hs[A]);this._dict_set=!0}}Do.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize;let r,a;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Qo:Co,"string"==typeof e?A.input=uo.string2buf(e):"[object ArrayBuffer]"===Bo.call(e)?A.input=new Uint8Array(e):A.input=e,A.next_in=0,A.avail_in=A.input.length;;)if(0===A.avail_out&&(A.output=new Uint8Array(i),A.next_out=0,A.avail_out=i),(a===Eo||a===wo)&&A.avail_out<=6)this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;else{if(r=lo.deflate(A,a),r===po)return A.next_out>0&&this.onData(A.output.subarray(0,A.next_out)),r=lo.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===mo;if(0!==A.avail_out){if(a>0&&A.next_out>0)this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;else if(0===A.avail_in)break}else this.onData(A.output)}return!0},Do.prototype.onData=function(e){this.chunks.push(e)},Do.prototype.onEnd=function(e){e===mo&&(this.result=ho.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const ko=16209;var vo=function(e,t){let A,i,r,a,n,s,o,l,g,h,c,f,d,u,I,B,C,E,w,Q,m,p,y,_;const b=e.state;A=e.next_in,y=e.input,i=A+(e.avail_in-5),r=e.next_out,_=e.output,a=r-(t-e.avail_out),n=r+(e.avail_out-257),s=b.dmax,o=b.wsize,l=b.whave,g=b.wnext,h=b.window,c=b.hold,f=b.bits,d=b.lencode,u=b.distcode,I=(1<<b.lenbits)-1,B=(1<<b.distbits)-1;e:do{f<15&&(c+=y[A++]<<f,f+=8,c+=y[A++]<<f,f+=8),C=d[c&I];t:for(;;){if(E=C>>>24,c>>>=E,f-=E,E=C>>>16&255,0===E)_[r++]=65535&C;else{if(!(16&E)){if(0==(64&E)){C=d[(65535&C)+(c&(1<<E)-1)];continue t}if(32&E){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=ko;break e}w=65535&C,E&=15,E&&(f<E&&(c+=y[A++]<<f,f+=8),w+=c&(1<<E)-1,c>>>=E,f-=E),f<15&&(c+=y[A++]<<f,f+=8,c+=y[A++]<<f,f+=8),C=u[c&B];A:for(;;){if(E=C>>>24,c>>>=E,f-=E,E=C>>>16&255,!(16&E)){if(0==(64&E)){C=u[(65535&C)+(c&(1<<E)-1)];continue A}e.msg="invalid distance code",b.mode=ko;break e}if(Q=65535&C,E&=15,f<E&&(c+=y[A++]<<f,f+=8,f<E&&(c+=y[A++]<<f,f+=8)),Q+=c&(1<<E)-1,Q>s){e.msg="invalid distance too far back",b.mode=ko;break e}if(c>>>=E,f-=E,E=r-a,Q>E){if(E=Q-E,E>l&&b.sane){e.msg="invalid distance too far back",b.mode=ko;break e}if(m=0,p=h,0===g){if(m+=o-E,E<w){w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}}else if(g<E){if(m+=o+g-E,E-=g,E<w){w-=E;do{_[r++]=h[m++]}while(--E);if(m=0,g<w){E=g,w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}}}else if(m+=g-E,E<w){w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}for(;w>2;)_[r++]=p[m++],_[r++]=p[m++],_[r++]=p[m++],w-=3;w&&(_[r++]=p[m++],w>1&&(_[r++]=p[m++]))}else{m=r-Q;do{_[r++]=_[m++],_[r++]=_[m++],_[r++]=_[m++],w-=3}while(w>2);w&&(_[r++]=_[m++],w>1&&(_[r++]=_[m++]))}break}}break}}while(A<i&&r<n);w=f>>3,A-=w,f-=w<<3,c&=(1<<f)-1,e.next_in=A,e.next_out=r,e.avail_in=A<i?i-A+5:5-(A-i),e.avail_out=r<n?n-r+257:257-(r-n),b.hold=c,b.bits=f};const xo=15,So=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Go=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Uo=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Mo=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Ro=(e,t,A,i,r,a,n,s)=>{const o=s.bits;let l,g,h,c,f,d,u=0,I=0,B=0,C=0,E=0,w=0,Q=0,m=0,p=0,y=0,_=null;const b=new Uint16Array(16),D=new Uint16Array(16);let k,v,x,S=null;for(u=0;u<=xo;u++)b[u]=0;for(I=0;I<i;I++)b[t[A+I]]++;for(E=o,C=xo;C>=1&&0===b[C];C--);if(E>C&&(E=C),0===C)return r[a++]=20971520,r[a++]=20971520,s.bits=1,0;for(B=1;B<C&&0===b[B];B++);for(E<B&&(E=B),m=1,u=1;u<=xo;u++)if(m<<=1,m-=b[u],m<0)return-1;if(m>0&&(0===e||1!==C))return-1;for(D[1]=0,u=1;u<xo;u++)D[u+1]=D[u]+b[u];for(I=0;I<i;I++)0!==t[A+I]&&(n[D[t[A+I]]++]=I);if(0===e?(_=S=n,d=20):1===e?(_=So,S=Go,d=257):(_=Uo,S=Mo,d=0),y=0,I=0,u=B,f=a,w=E,Q=0,h=-1,p=1<<E,c=p-1,1===e&&p>852||2===e&&p>592)return 1;for(;;){k=u-Q,n[I]+1<d?(v=0,x=n[I]):n[I]>=d?(v=S[n[I]-d],x=_[n[I]-d]):(v=96,x=0),l=1<<u-Q,g=1<<w,B=g;do{g-=l,r[f+(y>>Q)+g]=k<<24|v<<16|x|0}while(0!==g);for(l=1<<u-1;y&l;)l>>=1;if(0!==l?(y&=l-1,y+=l):y=0,I++,0==--b[u]){if(u===C)break;u=t[A+n[I]]}if(u>E&&(y&c)!==h){for(0===Q&&(Q=E),f+=B,w=u-Q,m=1<<w;w+Q<C&&(m-=b[w+Q],!(m<=0));)w++,m<<=1;if(p+=1<<w,1===e&&p>852||2===e&&p>592)return 1;h=y&c,r[h]=E<<24|w<<16|f-a|0}}return 0!==y&&(r[f+y]=u-Q<<24|64<<16|0),s.bits=E,0};const{Z_FINISH:Fo,Z_BLOCK:Lo,Z_TREES:To,Z_OK:No,Z_STREAM_END:Po,Z_NEED_DICT:Oo,Z_STREAM_ERROR:zo,Z_DATA_ERROR:Ko,Z_MEM_ERROR:Ho,Z_BUF_ERROR:Jo,Z_DEFLATED:qo}=cs,Yo=16180,Vo=16190,Zo=16191,jo=16192,Wo=16194,Xo=16199,$o=16200,el=16206,tl=16209,Al=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function il(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const rl=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Yo||t.mode>16211?1:0},al=e=>{if(rl(e))return zo;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Yo,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,No},nl=e=>{if(rl(e))return zo;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,al(e)},sl=(e,t)=>{let A;if(rl(e))return zo;const i=e.state;return t<0?(A=0,t=-t):(A=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?zo:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=A,i.wbits=t,nl(e))},ol=(e,t)=>{if(!e)return zo;const A=new il;e.state=A,A.strm=e,A.window=null,A.mode=Yo;const i=sl(e,t);return i!==No&&(e.state=null),i};let ll,gl,hl=!0;const cl=e=>{if(hl){ll=new Int32Array(512),gl=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Ro(1,e.lens,0,288,ll,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Ro(2,e.lens,0,32,gl,0,e.work,{bits:5}),hl=!1}e.lencode=ll,e.lenbits=9,e.distcode=gl,e.distbits=5},fl=(e,t,A,i)=>{let r;const a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(t.subarray(A-a.wsize,A),0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>i&&(r=i),a.window.set(t.subarray(A-i,A-i+r),a.wnext),(i-=r)?(a.window.set(t.subarray(A-i,A),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0};var dl={inflateReset:nl,inflateReset2:sl,inflateResetKeep:al,inflateInit:e=>ol(e,15),inflateInit2:ol,inflate:(e,t)=>{let A,i,r,a,n,s,o,l,g,h,c,f,d,u,I,B,C,E,w,Q,m,p,y=0;const _=new Uint8Array(4);let b,D;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(rl(e)||!e.output||!e.input&&0!==e.avail_in)return zo;A=e.state,A.mode===Zo&&(A.mode=jo),n=e.next_out,r=e.output,o=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,h=s,c=o,p=No;e:for(;;)switch(A.mode){case Yo:if(0===A.wrap){A.mode=jo;break}for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(2&A.wrap&&35615===l){0===A.wbits&&(A.wbits=15),A.check=0,_[0]=255&l,_[1]=l>>>8&255,A.check=gs(A.check,_,2,0),l=0,g=0,A.mode=16181;break}if(A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",A.mode=tl;break}if((15&l)!==qo){e.msg="unknown compression method",A.mode=tl;break}if(l>>>=4,g-=4,m=8+(15&l),0===A.wbits&&(A.wbits=m),m>15||m>A.wbits){e.msg="invalid window size",A.mode=tl;break}A.dmax=1<<A.wbits,A.flags=0,e.adler=A.check=1,A.mode=512&l?16189:Zo,l=0,g=0;break;case 16181:for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(A.flags=l,(255&A.flags)!==qo){e.msg="unknown compression method",A.mode=tl;break}if(57344&A.flags){e.msg="unknown header flags set",A.mode=tl;break}A.head&&(A.head.text=l>>8&1),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=gs(A.check,_,2,0)),l=0,g=0,A.mode=16182;case 16182:for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.head&&(A.head.time=l),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,_[2]=l>>>16&255,_[3]=l>>>24&255,A.check=gs(A.check,_,4,0)),l=0,g=0,A.mode=16183;case 16183:for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.head&&(A.head.xflags=255&l,A.head.os=l>>8),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=gs(A.check,_,2,0)),l=0,g=0,A.mode=16184;case 16184:if(1024&A.flags){for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.length=l,A.head&&(A.head.extra_len=l),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=gs(A.check,_,2,0)),l=0,g=0}else A.head&&(A.head.extra=null);A.mode=16185;case 16185:if(1024&A.flags&&(f=A.length,f>s&&(f=s),f&&(A.head&&(m=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Uint8Array(A.head.extra_len)),A.head.extra.set(i.subarray(a,a+f),m)),512&A.flags&&4&A.wrap&&(A.check=gs(A.check,i,f,a)),s-=f,a+=f,A.length-=f),A.length))break e;A.length=0,A.mode=16186;case 16186:if(2048&A.flags){if(0===s)break e;f=0;do{m=i[a+f++],A.head&&m&&A.length<65536&&(A.head.name+=String.fromCharCode(m))}while(m&&f<s);if(512&A.flags&&4&A.wrap&&(A.check=gs(A.check,i,f,a)),s-=f,a+=f,m)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=16187;case 16187:if(4096&A.flags){if(0===s)break e;f=0;do{m=i[a+f++],A.head&&m&&A.length<65536&&(A.head.comment+=String.fromCharCode(m))}while(m&&f<s);if(512&A.flags&&4&A.wrap&&(A.check=gs(A.check,i,f,a)),s-=f,a+=f,m)break e}else A.head&&(A.head.comment=null);A.mode=16188;case 16188:if(512&A.flags){for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(4&A.wrap&&l!==(65535&A.check)){e.msg="header crc mismatch",A.mode=tl;break}l=0,g=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),e.adler=A.check=0,A.mode=Zo;break;case 16189:for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}e.adler=A.check=Al(l),l=0,g=0,A.mode=Vo;case Vo:if(0===A.havedict)return e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,Oo;e.adler=A.check=1,A.mode=Zo;case Zo:if(t===Lo||t===To)break e;case jo:if(A.last){l>>>=7&g,g-=7&g,A.mode=el;break}for(;g<3;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}switch(A.last=1&l,l>>>=1,g-=1,3&l){case 0:A.mode=16193;break;case 1:if(cl(A),A.mode=Xo,t===To){l>>>=2,g-=2;break e}break;case 2:A.mode=16196;break;case 3:e.msg="invalid block type",A.mode=tl}l>>>=2,g-=2;break;case 16193:for(l>>>=7&g,g-=7&g;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",A.mode=tl;break}if(A.length=65535&l,l=0,g=0,A.mode=Wo,t===To)break e;case Wo:A.mode=16195;case 16195:if(f=A.length,f){if(f>s&&(f=s),f>o&&(f=o),0===f)break e;r.set(i.subarray(a,a+f),n),s-=f,a+=f,o-=f,n+=f,A.length-=f;break}A.mode=Zo;break;case 16196:for(;g<14;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(A.nlen=257+(31&l),l>>>=5,g-=5,A.ndist=1+(31&l),l>>>=5,g-=5,A.ncode=4+(15&l),l>>>=4,g-=4,A.nlen>286||A.ndist>30){e.msg="too many length or distance symbols",A.mode=tl;break}A.have=0,A.mode=16197;case 16197:for(;A.have<A.ncode;){for(;g<3;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.lens[k[A.have++]]=7&l,l>>>=3,g-=3}for(;A.have<19;)A.lens[k[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,b={bits:A.lenbits},p=Ro(0,A.lens,0,19,A.lencode,0,A.work,b),A.lenbits=b.bits,p){e.msg="invalid code lengths set",A.mode=tl;break}A.have=0,A.mode=16198;case 16198:for(;A.have<A.nlen+A.ndist;){for(;y=A.lencode[l&(1<<A.lenbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(C<16)l>>>=I,g-=I,A.lens[A.have++]=C;else{if(16===C){for(D=I+2;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(l>>>=I,g-=I,0===A.have){e.msg="invalid bit length repeat",A.mode=tl;break}m=A.lens[A.have-1],f=3+(3&l),l>>>=2,g-=2}else if(17===C){for(D=I+3;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=I,g-=I,m=0,f=3+(7&l),l>>>=3,g-=3}else{for(D=I+7;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=I,g-=I,m=0,f=11+(127&l),l>>>=7,g-=7}if(A.have+f>A.nlen+A.ndist){e.msg="invalid bit length repeat",A.mode=tl;break}for(;f--;)A.lens[A.have++]=m}}if(A.mode===tl)break;if(0===A.lens[256]){e.msg="invalid code -- missing end-of-block",A.mode=tl;break}if(A.lenbits=9,b={bits:A.lenbits},p=Ro(1,A.lens,0,A.nlen,A.lencode,0,A.work,b),A.lenbits=b.bits,p){e.msg="invalid literal/lengths set",A.mode=tl;break}if(A.distbits=6,A.distcode=A.distdyn,b={bits:A.distbits},p=Ro(2,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,b),A.distbits=b.bits,p){e.msg="invalid distances set",A.mode=tl;break}if(A.mode=Xo,t===To)break e;case Xo:A.mode=$o;case $o:if(s>=6&&o>=258){e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,vo(e,c),n=e.next_out,r=e.output,o=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,A.mode===Zo&&(A.back=-1);break}for(A.back=0;y=A.lencode[l&(1<<A.lenbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(B&&0==(240&B)){for(E=I,w=B,Q=C;y=A.lencode[Q+((l&(1<<E+w)-1)>>E)],I=y>>>24,B=y>>>16&255,C=65535&y,!(E+I<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=I,g-=I,A.back+=I,A.length=C,0===B){A.mode=16205;break}if(32&B){A.back=-1,A.mode=Zo;break}if(64&B){e.msg="invalid literal/length code",A.mode=tl;break}A.extra=15&B,A.mode=16201;case 16201:if(A.extra){for(D=A.extra;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.length+=l&(1<<A.extra)-1,l>>>=A.extra,g-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=16202;case 16202:for(;y=A.distcode[l&(1<<A.distbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(0==(240&B)){for(E=I,w=B,Q=C;y=A.distcode[Q+((l&(1<<E+w)-1)>>E)],I=y>>>24,B=y>>>16&255,C=65535&y,!(E+I<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=I,g-=I,A.back+=I,64&B){e.msg="invalid distance code",A.mode=tl;break}A.offset=C,A.extra=15&B,A.mode=16203;case 16203:if(A.extra){for(D=A.extra;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}A.offset+=l&(1<<A.extra)-1,l>>>=A.extra,g-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){e.msg="invalid distance too far back",A.mode=tl;break}A.mode=16204;case 16204:if(0===o)break e;if(f=c-o,A.offset>f){if(f=A.offset-f,f>A.whave&&A.sane){e.msg="invalid distance too far back",A.mode=tl;break}f>A.wnext?(f-=A.wnext,d=A.wsize-f):d=A.wnext-f,f>A.length&&(f=A.length),u=A.window}else u=r,d=n-A.offset,f=A.length;f>o&&(f=o),o-=f,A.length-=f;do{r[n++]=u[d++]}while(--f);0===A.length&&(A.mode=$o);break;case 16205:if(0===o)break e;r[n++]=A.length,o--,A.mode=$o;break;case el:if(A.wrap){for(;g<32;){if(0===s)break e;s--,l|=i[a++]<<g,g+=8}if(c-=o,e.total_out+=c,A.total+=c,4&A.wrap&&c&&(e.adler=A.check=A.flags?gs(A.check,r,c,n-c):os(A.check,r,c,n-c)),c=o,4&A.wrap&&(A.flags?l:Al(l))!==A.check){e.msg="incorrect data check",A.mode=tl;break}l=0,g=0}A.mode=16207;case 16207:if(A.wrap&&A.flags){for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(4&A.wrap&&l!==(4294967295&A.total)){e.msg="incorrect length check",A.mode=tl;break}l=0,g=0}A.mode=16208;case 16208:p=Po;break e;case tl:p=Ko;break e;case 16210:return Ho;default:return zo}return e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,(A.wsize||c!==e.avail_out&&A.mode<tl&&(A.mode<el||t!==Fo))&&fl(e,e.output,e.next_out,c-e.avail_out),h-=e.avail_in,c-=e.avail_out,e.total_in+=h,e.total_out+=c,A.total+=c,4&A.wrap&&c&&(e.adler=A.check=A.flags?gs(A.check,r,c,e.next_out-c):os(A.check,r,c,e.next_out-c)),e.data_type=A.bits+(A.last?64:0)+(A.mode===Zo?128:0)+(A.mode===Xo||A.mode===Wo?256:0),(0===h&&0===c||t===Fo)&&p===No&&(p=Jo),p},inflateEnd:e=>{if(rl(e))return zo;let t=e.state;return t.window&&(t.window=null),e.state=null,No},inflateGetHeader:(e,t)=>{if(rl(e))return zo;const A=e.state;return 0==(2&A.wrap)?zo:(A.head=t,t.done=!1,No)},inflateSetDictionary:(e,t)=>{const A=t.length;let i,r,a;return rl(e)?zo:(i=e.state,0!==i.wrap&&i.mode!==Vo?zo:i.mode===Vo&&(r=1,r=os(r,t,A,0),r!==i.check)?Ko:(a=fl(e,t,A,A),a?(i.mode=16210,Ho):(i.havedict=1,No)))},inflateInfo:"pako inflate (from Nodeca project)"};var ul=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Il=Object.prototype.toString,{Z_NO_FLUSH:Bl,Z_FINISH:Cl,Z_OK:El,Z_STREAM_END:wl,Z_NEED_DICT:Ql,Z_STREAM_ERROR:ml,Z_DATA_ERROR:pl,Z_MEM_ERROR:yl}=cs;function _l(e){this.options=ho.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Io,this.strm.avail_out=0;let A=dl.inflateInit2(this.strm,t.windowBits);if(A!==El)throw new Error(hs[A]);if(this.header=new ul,dl.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=uo.string2buf(t.dictionary):"[object ArrayBuffer]"===Il.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(A=dl.inflateSetDictionary(this.strm,t.dictionary),A!==El)))throw new Error(hs[A])}function bl(e,t){const A=new _l(t);if(A.push(e),A.err)throw A.msg||hs[A.err];return A.result}_l.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let a,n,s;if(this.ended)return!1;for(n=t===~~t?t:!0===t?Cl:Bl,"[object ArrayBuffer]"===Il.call(e)?A.input=new Uint8Array(e):A.input=e,A.next_in=0,A.avail_in=A.input.length;;){for(0===A.avail_out&&(A.output=new Uint8Array(i),A.next_out=0,A.avail_out=i),a=dl.inflate(A,n),a===Ql&&r&&(a=dl.inflateSetDictionary(A,r),a===El?a=dl.inflate(A,n):a===pl&&(a=Ql));A.avail_in>0&&a===wl&&A.state.wrap>0&&0!==e[A.next_in];)dl.inflateReset(A),a=dl.inflate(A,n);switch(a){case ml:case pl:case Ql:case yl:return this.onEnd(a),this.ended=!0,!1}if(s=A.avail_out,A.next_out&&(0===A.avail_out||a===wl))if("string"===this.options.to){let e=uo.utf8border(A.output,A.next_out),t=A.next_out-e,r=uo.buf2string(A.output,e);A.next_out=t,A.avail_out=i-t,t&&A.output.set(A.output.subarray(e,e+t),0),this.onData(r)}else this.onData(A.output.length===A.next_out?A.output:A.output.subarray(0,A.next_out));if(a!==El||0!==s){if(a===wl)return a=dl.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===A.avail_in)break}}return!0},_l.prototype.onData=function(e){this.chunks.push(e)},_l.prototype.onEnd=function(e){e===El&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ho.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Dl={Inflate:_l,inflate:bl,inflateRaw:function(e,t){return(t=t||{}).raw=!0,bl(e,t)},ungzip:bl,constants:cs};const{Inflate:kl,inflate:vl,inflateRaw:xl,ungzip:Sl}=Dl;var Gl=vl;var Ul=Object.freeze({__proto__:null,default:class extends za{decodeBlock(e){return Gl(new Uint8Array(e)).buffer}}});var Ml=Object.freeze({__proto__:null,default:class extends za{decodeBlock(e){const t=new DataView(e),A=[];for(let i=0;i<e.byteLength;++i){let e=t.getInt8(i);if(e<0){const r=t.getUint8(i+1);e=-e;for(let t=0;t<=e;++t)A.push(r);i+=1}else{for(let r=0;r<=e;++r)A.push(t.getUint8(i+r+1));i+=e+1}}return new Uint8Array(A).buffer}}}),Rl={exports:{}};!function(e){
3
4
  /* Copyright 2015-2021 Esri. 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 @preserve */
4
- !function(){var t,i,r,n,a,s,o,l,h,f,c,u,d,g,p,m,w=(t={defaultNoDataValue:-34027999387901484e22,decode:function(e,s){var o=(s=s||{}).encodedMaskData||null===s.encodedMaskData,l=a(e,s.inputOffset||0,o),h=null!==s.noDataValue?s.noDataValue:t.defaultNoDataValue,f=i(l,s.pixelType||Float32Array,s.encodedMaskData,h,s.returnMask),c={width:l.width,height:l.height,pixelData:f.resultPixels,minValue:f.minValue,maxValue:l.pixels.maxValue,noDataValue:h};return f.resultMask&&(c.maskData=f.resultMask),s.returnEncodedMask&&l.mask&&(c.encodedMaskData=l.mask.bitset?l.mask.bitset:null),s.returnFileInfo&&(c.fileInfo=r(l),s.computeUsedBitDepths&&(c.fileInfo.bitDepths=n(l))),c}},i=function(e,t,i,r,n){var a,o,l,h=0,f=e.pixels.numBlocksX,c=e.pixels.numBlocksY,u=Math.floor(e.width/f),d=Math.floor(e.height/c),g=2*e.maxZError,p=Number.MAX_VALUE;i=i||(e.mask?e.mask.bitset:null),o=new t(e.width*e.height),n&&i&&(l=new Uint8Array(e.width*e.height));for(var m,w,y=new Float32Array(u*d),b=0;b<=c;b++){var _=b!==c?d:e.height%c;if(0!==_)for(var v=0;v<=f;v++){var x=v!==f?u:e.width%f;if(0!==x){var k,T,S,A,C=b*e.width*d+v*u,P=e.width-x,M=e.pixels.blocks[h];if(M.encoding<2?(0===M.encoding?k=M.rawData:(s(M.stuffedData,M.bitsPerPixel,M.numValidPixels,M.offset,g,y,e.pixels.maxValue),k=y),T=0):S=2===M.encoding?0:M.offset,i)for(w=0;w<_;w++){for(7&C&&(A=i[C>>3],A<<=7&C),m=0;m<x;m++)7&C||(A=i[C>>3]),128&A?(l&&(l[C]=1),p=p>(a=M.encoding<2?k[T++]:S)?a:p,o[C++]=a):(l&&(l[C]=0),o[C++]=r),A<<=1;C+=P}else if(M.encoding<2)for(w=0;w<_;w++){for(m=0;m<x;m++)p=p>(a=k[T++])?a:p,o[C++]=a;C+=P}else for(p=p>S?S:p,w=0;w<_;w++){for(m=0;m<x;m++)o[C++]=S;C+=P}if(1===M.encoding&&T!==M.numValidPixels)throw"Block and Mask do not match";h++}}}return{resultPixels:o,resultMask:l,minValue:p}},r=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},n=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,i={},r=0;r<t;r++){var n=e.pixels.blocks[r];0===n.encoding?i.float32=!0:1===n.encoding?i[n.bitsPerPixel]=!0:i[0]=!0}return Object.keys(i)},a=function(e,t,i){var r={},n=new Uint8Array(e,t,10);if(r.fileIdentifierString=String.fromCharCode.apply(null,n),"CntZImage"!==r.fileIdentifierString.trim())throw"Unexpected file identifier string: "+r.fileIdentifierString;t+=10;var a=new DataView(e,t,24);if(r.fileVersion=a.getInt32(0,!0),r.imageType=a.getInt32(4,!0),r.height=a.getUint32(8,!0),r.width=a.getUint32(12,!0),r.maxZError=a.getFloat64(16,!0),t+=24,!i)if(a=new DataView(e,t,16),r.mask={},r.mask.numBlocksY=a.getUint32(0,!0),r.mask.numBlocksX=a.getUint32(4,!0),r.mask.numBytes=a.getUint32(8,!0),r.mask.maxValue=a.getFloat32(12,!0),t+=16,r.mask.numBytes>0){var s=new Uint8Array(Math.ceil(r.width*r.height/8)),o=(a=new DataView(e,t,r.mask.numBytes)).getInt16(0,!0),l=2,h=0;do{if(o>0)for(;o--;)s[h++]=a.getUint8(l++);else{var f=a.getUint8(l++);for(o=-o;o--;)s[h++]=f}o=a.getInt16(l,!0),l+=2}while(l<r.mask.numBytes);if(-32768!==o||h<s.length)throw"Unexpected end of mask RLE encoding";r.mask.bitset=s,t+=r.mask.numBytes}else 0==(r.mask.numBytes|r.mask.numBlocksY|r.mask.maxValue)&&(r.mask.bitset=new Uint8Array(Math.ceil(r.width*r.height/8)));a=new DataView(e,t,16),r.pixels={},r.pixels.numBlocksY=a.getUint32(0,!0),r.pixels.numBlocksX=a.getUint32(4,!0),r.pixels.numBytes=a.getUint32(8,!0),r.pixels.maxValue=a.getFloat32(12,!0),t+=16;var c=r.pixels.numBlocksX,u=r.pixels.numBlocksY,d=c+(r.width%c>0?1:0),g=u+(r.height%u>0?1:0);r.pixels.blocks=new Array(d*g);for(var p=0,m=0;m<g;m++)for(var w=0;w<d;w++){var y=0,b=e.byteLength-t;a=new DataView(e,t,Math.min(10,b));var _={};r.pixels.blocks[p++]=_;var v=a.getUint8(0);if(y++,_.encoding=63&v,_.encoding>3)throw"Invalid block encoding ("+_.encoding+")";if(2!==_.encoding){if(0!==v&&2!==v){if(v>>=6,_.offsetType=v,2===v)_.offset=a.getInt8(1),y++;else if(1===v)_.offset=a.getInt16(1,!0),y+=2;else{if(0!==v)throw"Invalid block offset type";_.offset=a.getFloat32(1,!0),y+=4}if(1===_.encoding)if(v=a.getUint8(y),y++,_.bitsPerPixel=63&v,v>>=6,_.numValidPixelsType=v,2===v)_.numValidPixels=a.getUint8(y),y++;else if(1===v)_.numValidPixels=a.getUint16(y,!0),y+=2;else{if(0!==v)throw"Invalid valid pixel count type";_.numValidPixels=a.getUint32(y,!0),y+=4}}var x;if(t+=y,3!==_.encoding)if(0===_.encoding){var k=(r.pixels.numBytes-1)/4;if(k!==Math.floor(k))throw"uncompressed block has invalid length";x=new ArrayBuffer(4*k),new Uint8Array(x).set(new Uint8Array(e,t,4*k));var T=new Float32Array(x);_.rawData=T,t+=4*k}else if(1===_.encoding){var S=Math.ceil(_.numValidPixels*_.bitsPerPixel/8),A=Math.ceil(S/4);x=new ArrayBuffer(4*A),new Uint8Array(x).set(new Uint8Array(e,t,S)),_.stuffedData=new Uint32Array(x),t+=S}}else t++}return r.eofOffset=t,r},s=function(e,t,i,r,n,a,s){var o,l,h,f=(1<<t)-1,c=0,u=0,d=Math.ceil((s-r)/n),g=4*e.length-Math.ceil(t*i/8);for(e[e.length-1]<<=8*g,o=0;o<i;o++){if(0===u&&(h=e[c++],u=32),u>=t)l=h>>>u-t&f,u-=t;else{var p=t-u;l=(h&f)<<p&f,l+=(h=e[c++])>>>(u=32-p)}a[o]=l<d?r+l*n:s}return a},t),y=(o=function(e,t,i,r,n,a,s,o){var l,h,f,c,u,d=(1<<i)-1,g=0,p=0,m=4*e.length-Math.ceil(i*r/8);if(e[e.length-1]<<=8*m,n)for(l=0;l<r;l++)0===p&&(f=e[g++],p=32),p>=i?(h=f>>>p-i&d,p-=i):(h=(f&d)<<(c=i-p)&d,h+=(f=e[g++])>>>(p=32-c)),t[l]=n[h];else for(u=Math.ceil((o-a)/s),l=0;l<r;l++)0===p&&(f=e[g++],p=32),p>=i?(h=f>>>p-i&d,p-=i):(h=(f&d)<<(c=i-p)&d,h+=(f=e[g++])>>>(p=32-c)),t[l]=h<u?a+h*s:o},l=function(e,t,i,r,n,a){var s,o=(1<<t)-1,l=0,h=0,f=0,c=0,u=0,d=[],g=4*e.length-Math.ceil(t*i/8);e[e.length-1]<<=8*g;var p=Math.ceil((a-r)/n);for(h=0;h<i;h++)0===c&&(s=e[l++],c=32),c>=t?(u=s>>>c-t&o,c-=t):(u=(s&o)<<(f=t-c)&o,u+=(s=e[l++])>>>(c=32-f)),d[h]=u<p?r+u*n:a;return d.unshift(r),d},h=function(e,t,i,r,n,a,s,o){var l,h,f,c,u=(1<<i)-1,d=0,g=0,p=0;if(n)for(l=0;l<r;l++)0===g&&(f=e[d++],g=32,p=0),g>=i?(h=f>>>p&u,g-=i,p+=i):(h=f>>>p&u,g=32-(c=i-g),h|=((f=e[d++])&(1<<c)-1)<<i-c,p=c),t[l]=n[h];else{var m=Math.ceil((o-a)/s);for(l=0;l<r;l++)0===g&&(f=e[d++],g=32,p=0),g>=i?(h=f>>>p&u,g-=i,p+=i):(h=f>>>p&u,g=32-(c=i-g),h|=((f=e[d++])&(1<<c)-1)<<i-c,p=c),t[l]=h<m?a+h*s:o}return t},f=function(e,t,i,r,n,a){var s,o=(1<<t)-1,l=0,h=0,f=0,c=0,u=0,d=0,g=[],p=Math.ceil((a-r)/n);for(h=0;h<i;h++)0===c&&(s=e[l++],c=32,d=0),c>=t?(u=s>>>d&o,c-=t,d+=t):(u=s>>>d&o,c=32-(f=t-c),u|=((s=e[l++])&(1<<f)-1)<<t-f,d=f),g[h]=u<p?r+u*n:a;return g.unshift(r),g},c=function(e,t,i,r){var n,a,s,o,l=(1<<i)-1,h=0,f=0,c=4*e.length-Math.ceil(i*r/8);for(e[e.length-1]<<=8*c,n=0;n<r;n++)0===f&&(s=e[h++],f=32),f>=i?(a=s>>>f-i&l,f-=i):(a=(s&l)<<(o=i-f)&l,a+=(s=e[h++])>>>(f=32-o)),t[n]=a;return t},u=function(e,t,i,r){var n,a,s,o,l=(1<<i)-1,h=0,f=0,c=0;for(n=0;n<r;n++)0===f&&(s=e[h++],f=32,c=0),f>=i?(a=s>>>c&l,f-=i,c+=i):(a=s>>>c&l,f=32-(o=i-f),a|=((s=e[h++])&(1<<o)-1)<<i-o,c=o),t[n]=a;return t},d={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,i=65535,r=e.length,n=Math.floor(r/2),a=0;n;){var s=n>=359?359:n;n-=s;do{t+=e[a++]<<8,i+=t+=e[a++]}while(--s);t=(65535&t)+(t>>>16),i=(65535&i)+(i>>>16)}return 1&r&&(i+=t+=e[a]<<8),((i=(65535&i)+(i>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var i=t.ptr,r=new Uint8Array(e,i,6),n={};if(n.fileIdentifierString=String.fromCharCode.apply(null,r),0!==n.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+n.fileIdentifierString;i+=6;var a,s=new DataView(e,i,8),o=s.getInt32(0,!0);if(n.fileVersion=o,i+=4,o>=3&&(n.checksum=s.getUint32(4,!0),i+=4),s=new DataView(e,i,12),n.height=s.getUint32(0,!0),n.width=s.getUint32(4,!0),i+=8,o>=4?(n.numDims=s.getUint32(8,!0),i+=4):n.numDims=1,s=new DataView(e,i,40),n.numValidPixel=s.getUint32(0,!0),n.microBlockSize=s.getInt32(4,!0),n.blobSize=s.getInt32(8,!0),n.imageType=s.getInt32(12,!0),n.maxZError=s.getFloat64(16,!0),n.zMin=s.getFloat64(24,!0),n.zMax=s.getFloat64(32,!0),i+=40,t.headerInfo=n,t.ptr=i,o>=3&&(a=o>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,i-a,n.blobSize-14))!==n.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var i=t.headerInfo,r=this.getDataTypeArray(i.imageType),n=i.numDims*this.getDataTypeSize(i.imageType),a=this.readSubArray(e,t.ptr,r,n),s=this.readSubArray(e,t.ptr+n,r,n);t.ptr+=2*n;var o,l=!0;for(o=0;o<i.numDims;o++)if(a[o]!==s[o]){l=!1;break}return i.minValues=a,i.maxValues=s,l},readSubArray:function(e,t,i,r){var n;if(i===Uint8Array)n=new Uint8Array(e,t,r);else{var a=new ArrayBuffer(r);new Uint8Array(a).set(new Uint8Array(e,t,r)),n=new i(a)}return n},readMask:function(e,t){var i,r,n=t.ptr,a=t.headerInfo,s=a.width*a.height,o=a.numValidPixel,l=new DataView(e,n,4),h={};if(h.numBytes=l.getUint32(0,!0),n+=4,(0===o||s===o)&&0!==h.numBytes)throw"invalid mask";if(0===o)i=new Uint8Array(Math.ceil(s/8)),h.bitset=i,r=new Uint8Array(s),t.pixels.resultMask=r,n+=h.numBytes;else if(h.numBytes>0){i=new Uint8Array(Math.ceil(s/8));var f=(l=new DataView(e,n,h.numBytes)).getInt16(0,!0),c=2,u=0,d=0;do{if(f>0)for(;f--;)i[u++]=l.getUint8(c++);else for(d=l.getUint8(c++),f=-f;f--;)i[u++]=d;f=l.getInt16(c,!0),c+=2}while(c<h.numBytes);if(-32768!==f||u<i.length)throw"Unexpected end of mask RLE encoding";r=new Uint8Array(s);var g=0,p=0;for(p=0;p<s;p++)7&p?(g=i[p>>3],g<<=7&p):g=i[p>>3],128&g&&(r[p]=1);t.pixels.resultMask=r,h.bitset=i,n+=h.numBytes}return t.ptr=n,t.mask=h,!0},readDataOneSweep:function(e,t,i,r){var n,a=t.ptr,s=t.headerInfo,o=s.numDims,l=s.width*s.height,h=s.imageType,f=s.numValidPixel*d.getDataTypeSize(h)*o,c=t.pixels.resultMask;if(i===Uint8Array)n=new Uint8Array(e,a,f);else{var u=new ArrayBuffer(f);new Uint8Array(u).set(new Uint8Array(e,a,f)),n=new i(u)}if(n.length===l*o)t.pixels.resultPixels=r?d.swapDimensionOrder(n,l,o,i,!0):n;else{t.pixels.resultPixels=new i(l*o);var g=0,p=0,m=0,w=0;if(o>1){if(r){for(p=0;p<l;p++)if(c[p])for(w=p,m=0;m<o;m++,w+=l)t.pixels.resultPixels[w]=n[g++]}else for(p=0;p<l;p++)if(c[p])for(w=p*o,m=0;m<o;m++)t.pixels.resultPixels[w+m]=n[g++]}else for(p=0;p<l;p++)c[p]&&(t.pixels.resultPixels[p]=n[g++])}return a+=f,t.ptr=a,!0},readHuffmanTree:function(e,t){var i=this.HUFFMAN_LUT_BITS_MAX,r=new DataView(e,t.ptr,16);if(t.ptr+=16,r.getInt32(0,!0)<2)throw"unsupported Huffman version";var n=r.getInt32(4,!0),a=r.getInt32(8,!0),s=r.getInt32(12,!0);if(a>=s)return!1;var o=new Uint32Array(s-a);d.decodeBits(e,t,o);var l,h,f,c,u=[];for(l=a;l<s;l++)u[h=l-(l<n?0:n)]={first:o[l-a],second:null};var p=e.byteLength-t.ptr,m=Math.ceil(p/4),w=new ArrayBuffer(4*m);new Uint8Array(w).set(new Uint8Array(e,t.ptr,p));var y,b=new Uint32Array(w),_=0,v=0;for(y=b[0],l=a;l<s;l++)(c=u[h=l-(l<n?0:n)].first)>0&&(u[h].second=y<<_>>>32-c,32-_>=c?32===(_+=c)&&(_=0,y=b[++v]):(_+=c-32,y=b[++v],u[h].second|=y>>>32-_));var x=0,k=0,T=new g;for(l=0;l<u.length;l++)void 0!==u[l]&&(x=Math.max(x,u[l].first));k=x>=i?i:x;var S,A,C,P,M,I=[];for(l=a;l<s;l++)if((c=u[h=l-(l<n?0:n)].first)>0)if(S=[c,h],c<=k)for(A=u[h].second<<k-c,C=1<<k-c,f=0;f<C;f++)I[A|f]=S;else for(A=u[h].second,M=T,P=c-1;P>=0;P--)A>>>P&1?(M.right||(M.right=new g),M=M.right):(M.left||(M.left=new g),M=M.left),0!==P||M.val||(M.val=S[1]);return{decodeLut:I,numBitsLUTQick:k,numBitsLUT:x,tree:T,stuffedData:b,srcPtr:v,bitPos:_}},readHuffman:function(e,t,i,r){var n,a,s,o,l,h,f,c,u,g=t.headerInfo.numDims,p=t.headerInfo.height,m=t.headerInfo.width,w=m*p,y=this.readHuffmanTree(e,t),b=y.decodeLut,_=y.tree,v=y.stuffedData,x=y.srcPtr,k=y.bitPos,T=y.numBitsLUTQick,S=y.numBitsLUT,A=0===t.headerInfo.imageType?128:0,C=t.pixels.resultMask,P=0;k>0&&(x++,k=0);var M,I=v[x],E=1===t.encodeMode,U=new i(w*g),D=U;if(g<2||E){for(M=0;M<g;M++)if(g>1&&(D=new i(U.buffer,w*M,w),P=0),t.headerInfo.numValidPixel===m*p)for(c=0,h=0;h<p;h++)for(f=0;f<m;f++,c++){if(a=0,l=o=I<<k>>>32-T,32-k<T&&(l=o|=v[x+1]>>>64-k-T),b[l])a=b[l][1],k+=b[l][0];else for(l=o=I<<k>>>32-S,32-k<S&&(l=o|=v[x+1]>>>64-k-S),n=_,u=0;u<S;u++)if(!(n=o>>>S-u-1&1?n.right:n.left).left&&!n.right){a=n.val,k=k+u+1;break}k>=32&&(k-=32,I=v[++x]),s=a-A,E?(s+=f>0?P:h>0?D[c-m]:P,s&=255,D[c]=s,P=s):D[c]=s}else for(c=0,h=0;h<p;h++)for(f=0;f<m;f++,c++)if(C[c]){if(a=0,l=o=I<<k>>>32-T,32-k<T&&(l=o|=v[x+1]>>>64-k-T),b[l])a=b[l][1],k+=b[l][0];else for(l=o=I<<k>>>32-S,32-k<S&&(l=o|=v[x+1]>>>64-k-S),n=_,u=0;u<S;u++)if(!(n=o>>>S-u-1&1?n.right:n.left).left&&!n.right){a=n.val,k=k+u+1;break}k>=32&&(k-=32,I=v[++x]),s=a-A,E?(f>0&&C[c-1]?s+=P:h>0&&C[c-m]?s+=D[c-m]:s+=P,s&=255,D[c]=s,P=s):D[c]=s}}else for(c=0,h=0;h<p;h++)for(f=0;f<m;f++)if(c=h*m+f,!C||C[c])for(M=0;M<g;M++,c+=w){if(a=0,l=o=I<<k>>>32-T,32-k<T&&(l=o|=v[x+1]>>>64-k-T),b[l])a=b[l][1],k+=b[l][0];else for(l=o=I<<k>>>32-S,32-k<S&&(l=o|=v[x+1]>>>64-k-S),n=_,u=0;u<S;u++)if(!(n=o>>>S-u-1&1?n.right:n.left).left&&!n.right){a=n.val,k=k+u+1;break}k>=32&&(k-=32,I=v[++x]),s=a-A,D[c]=s}t.ptr=t.ptr+4*(x+1)+(k>0?4:0),t.pixels.resultPixels=U,g>1&&!r&&(t.pixels.resultPixels=d.swapDimensionOrder(U,w,g,i))},decodeBits:function(e,t,i,r,n){var a=t.headerInfo,s=a.fileVersion,d=0,g=e.byteLength-t.ptr>=5?5:e.byteLength-t.ptr,p=new DataView(e,t.ptr,g),m=p.getUint8(0);d++;var w=m>>6,y=0===w?4:3-w,b=(32&m)>0,_=31&m,v=0;if(1===y)v=p.getUint8(d),d++;else if(2===y)v=p.getUint16(d,!0),d+=2;else{if(4!==y)throw"Invalid valid pixel count type";v=p.getUint32(d,!0),d+=4}var x,k,T,S,A,C,P,M,I,E=2*a.maxZError,U=a.numDims>1?a.maxValues[n]:a.zMax;if(b){for(t.counter.lut++,M=p.getUint8(d),d++,S=Math.ceil((M-1)*_/8),A=Math.ceil(S/4),k=new ArrayBuffer(4*A),T=new Uint8Array(k),t.ptr+=d,T.set(new Uint8Array(e,t.ptr,S)),P=new Uint32Array(k),t.ptr+=S,I=0;M-1>>>I;)I++;S=Math.ceil(v*I/8),A=Math.ceil(S/4),k=new ArrayBuffer(4*A),(T=new Uint8Array(k)).set(new Uint8Array(e,t.ptr,S)),x=new Uint32Array(k),t.ptr+=S,C=s>=3?f(P,_,M-1,r,E,U):l(P,_,M-1,r,E,U),s>=3?h(x,i,I,v,C):o(x,i,I,v,C)}else t.counter.bitstuffer++,I=_,t.ptr+=d,I>0&&(S=Math.ceil(v*I/8),A=Math.ceil(S/4),k=new ArrayBuffer(4*A),(T=new Uint8Array(k)).set(new Uint8Array(e,t.ptr,S)),x=new Uint32Array(k),t.ptr+=S,s>=3?null==r?u(x,i,I,v):h(x,i,I,v,!1,r,E,U):null==r?c(x,i,I,v):o(x,i,I,v,!1,r,E,U))},readTiles:function(e,t,i,r){var n=t.headerInfo,a=n.width,s=n.height,o=a*s,l=n.microBlockSize,h=n.imageType,f=d.getDataTypeSize(h),c=Math.ceil(a/l),u=Math.ceil(s/l);t.pixels.numBlocksY=u,t.pixels.numBlocksX=c,t.pixels.ptr=0;var g,p,m,w,y,b,_,v,x,k,T=0,S=0,A=0,C=0,P=0,M=0,I=0,E=0,U=0,D=0,O=0,L=0,z=0,G=0,R=0,B=new i(l*l),F=s%l||l,V=a%l||l,N=n.numDims,K=t.pixels.resultMask,j=t.pixels.resultPixels,H=n.fileVersion>=5?14:15,Z=n.zMax;for(A=0;A<u;A++)for(P=A!==u-1?l:F,C=0;C<c;C++)for(D=A*a*l+C*l,O=a-(M=C!==c-1?l:V),v=0;v<N;v++){if(N>1?(k=j,D=A*a*l+C*l,j=new i(t.pixels.resultPixels.buffer,o*v*f,o),Z=n.maxValues[v]):k=null,I=e.byteLength-t.ptr,p={},R=0,E=(g=new DataView(e,t.ptr,Math.min(10,I))).getUint8(0),R++,x=n.fileVersion>=5?4&E:0,U=E>>6&255,(E>>2&H)!=(C*l>>3&H))throw"integrity issue";if(x&&0===v)throw"integrity issue";if((y=3&E)>3)throw t.ptr+=R,"Invalid block encoding ("+y+")";if(2!==y)if(0===y){if(x)throw"integrity issue";if(t.counter.uncompressed++,t.ptr+=R,L=(L=P*M*f)<(z=e.byteLength-t.ptr)?L:z,m=new ArrayBuffer(L%f==0?L:L+f-L%f),new Uint8Array(m).set(new Uint8Array(e,t.ptr,L)),w=new i(m),G=0,K)for(T=0;T<P;T++){for(S=0;S<M;S++)K[D]&&(j[D]=w[G++]),D++;D+=O}else for(T=0;T<P;T++){for(S=0;S<M;S++)j[D++]=w[G++];D+=O}t.ptr+=G*f}else if(b=d.getDataTypeUsed(x&&h<6?4:h,U),_=d.getOnePixel(p,R,b,g),R+=d.getDataTypeSize(b),3===y)if(t.ptr+=R,t.counter.constantoffset++,K)for(T=0;T<P;T++){for(S=0;S<M;S++)K[D]&&(j[D]=x?Math.min(Z,k[D]+_):_),D++;D+=O}else for(T=0;T<P;T++){for(S=0;S<M;S++)j[D]=x?Math.min(Z,k[D]+_):_,D++;D+=O}else if(t.ptr+=R,d.decodeBits(e,t,B,_,v),R=0,x)if(K)for(T=0;T<P;T++){for(S=0;S<M;S++)K[D]&&(j[D]=B[R++]+k[D]),D++;D+=O}else for(T=0;T<P;T++){for(S=0;S<M;S++)j[D]=B[R++]+k[D],D++;D+=O}else if(K)for(T=0;T<P;T++){for(S=0;S<M;S++)K[D]&&(j[D]=B[R++]),D++;D+=O}else for(T=0;T<P;T++){for(S=0;S<M;S++)j[D++]=B[R++];D+=O}else{if(x)if(K)for(T=0;T<P;T++)for(S=0;S<M;S++)K[D]&&(j[D]=k[D]),D++;else for(T=0;T<P;T++)for(S=0;S<M;S++)j[D]=k[D],D++;t.counter.constant++,t.ptr+=R}}N>1&&!r&&(t.pixels.resultPixels=d.swapDimensionOrder(t.pixels.resultPixels,o,N,i))},formatFileInfo:function(e){return{fileIdentifierString:e.headerInfo.fileIdentifierString,fileVersion:e.headerInfo.fileVersion,imageType:e.headerInfo.imageType,height:e.headerInfo.height,width:e.headerInfo.width,numValidPixel:e.headerInfo.numValidPixel,microBlockSize:e.headerInfo.microBlockSize,blobSize:e.headerInfo.blobSize,maxZError:e.headerInfo.maxZError,pixelType:d.getPixelType(e.headerInfo.imageType),eofOffset:e.eofOffset,mask:e.mask?{numBytes:e.mask.numBytes}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,maxValue:e.headerInfo.zMax,minValue:e.headerInfo.zMin,noDataValue:e.noDataValue}}},constructConstantSurface:function(e,t){var i=e.headerInfo.zMax,r=e.headerInfo.zMin,n=e.headerInfo.maxValues,a=e.headerInfo.numDims,s=e.headerInfo.height*e.headerInfo.width,o=0,l=0,h=0,f=e.pixels.resultMask,c=e.pixels.resultPixels;if(f)if(a>1){if(t)for(o=0;o<a;o++)for(h=o*s,i=n[o],l=0;l<s;l++)f[l]&&(c[h+l]=i);else for(l=0;l<s;l++)if(f[l])for(h=l*a,o=0;o<a;o++)c[h+a]=n[o]}else for(l=0;l<s;l++)f[l]&&(c[l]=i);else if(a>1&&r!==i)if(t)for(o=0;o<a;o++)for(h=o*s,i=n[o],l=0;l<s;l++)c[h+l]=i;else for(l=0;l<s;l++)for(h=l*a,o=0;o<a;o++)c[h+o]=n[o];else for(l=0;l<s*a;l++)c[l]=i},getDataTypeArray:function(e){var t;switch(e){case 0:t=Int8Array;break;case 1:t=Uint8Array;break;case 2:t=Int16Array;break;case 3:t=Uint16Array;break;case 4:t=Int32Array;break;case 5:t=Uint32Array;break;case 6:default:t=Float32Array;break;case 7:t=Float64Array}return t},getPixelType:function(e){var t;switch(e){case 0:t="S8";break;case 1:t="U8";break;case 2:t="S16";break;case 3:t="U16";break;case 4:t="S32";break;case 5:t="U32";break;case 6:default:t="F32";break;case 7:t="F64"}return t},isValidPixelValue:function(e,t){if(null==t)return!1;var i;switch(e){case 0:i=t>=-128&&t<=127;break;case 1:i=t>=0&&t<=255;break;case 2:i=t>=-32768&&t<=32767;break;case 3:i=t>=0&&t<=65536;break;case 4:i=t>=-2147483648&&t<=2147483647;break;case 5:i=t>=0&&t<=4294967296;break;case 6:i=t>=-34027999387901484e22&&t<=34027999387901484e22;break;case 7:i=t>=-17976931348623157e292&&t<=17976931348623157e292;break;default:i=!1}return i},getDataTypeSize:function(e){var t=0;switch(e){case 0:case 1:t=1;break;case 2:case 3:t=2;break;case 4:case 5:case 6:t=4;break;case 7:t=8;break;default:t=e}return t},getDataTypeUsed:function(e,t){var i=e;switch(e){case 2:case 4:i=e-t;break;case 3:case 5:i=e-2*t;break;case 6:i=0===t?e:1===t?2:1;break;case 7:i=0===t?e:e-2*t+1;break;default:i=e}return i},getOnePixel:function(e,t,i,r){var n=0;switch(i){case 0:n=r.getInt8(t);break;case 1:n=r.getUint8(t);break;case 2:n=r.getInt16(t,!0);break;case 3:n=r.getUint16(t,!0);break;case 4:n=r.getInt32(t,!0);break;case 5:n=r.getUInt32(t,!0);break;case 6:n=r.getFloat32(t,!0);break;case 7:n=r.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}return n},swapDimensionOrder:function(e,t,i,r,n){var a=0,s=0,o=0,l=0,h=e;if(i>1)if(h=new r(t*i),n)for(a=0;a<t;a++)for(l=a,o=0;o<i;o++,l+=t)h[l]=e[s++];else for(a=0;a<t;a++)for(l=a,o=0;o<i;o++,l+=t)h[s++]=e[l];return h}},g=function(e,t,i){this.val=e,this.left=t,this.right=i},{decode:function(e,t){var i=(t=t||{}).noDataValue,r=0,n={};if(n.ptr=t.inputOffset||0,n.pixels={},d.readHeaderInfo(e,n)){var a=n.headerInfo,s=a.fileVersion,o=d.getDataTypeArray(a.imageType);if(s>5)throw"unsupported lerc version 2."+s;d.readMask(e,n),a.numValidPixel===a.width*a.height||n.pixels.resultMask||(n.pixels.resultMask=t.maskData);var l=a.width*a.height;n.pixels.resultPixels=new o(l*a.numDims),n.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var h,f=!t.returnPixelInterleavedDims;if(0!==a.numValidPixel)if(a.zMax===a.zMin)d.constructConstantSurface(n,f);else if(s>=4&&d.checkMinMaxRanges(e,n))d.constructConstantSurface(n,f);else{var c=new DataView(e,n.ptr,2),u=c.getUint8(0);if(n.ptr++,u)d.readDataOneSweep(e,n,o,f);else if(s>1&&a.imageType<=1&&Math.abs(a.maxZError-.5)<1e-5){var g=c.getUint8(1);if(n.ptr++,n.encodeMode=g,g>2||s<4&&g>1)throw"Invalid Huffman flag "+g;g?d.readHuffman(e,n,o,f):d.readTiles(e,n,o,f)}else d.readTiles(e,n,o,f)}n.eofOffset=n.ptr,t.inputOffset?(h=n.headerInfo.blobSize+t.inputOffset-n.ptr,Math.abs(h)>=1&&(n.eofOffset=t.inputOffset+n.headerInfo.blobSize)):(h=n.headerInfo.blobSize-n.ptr,Math.abs(h)>=1&&(n.eofOffset=n.headerInfo.blobSize));var p={width:a.width,height:a.height,pixelData:n.pixels.resultPixels,minValue:a.zMin,maxValue:a.zMax,validPixelCount:a.numValidPixel,dimCount:a.numDims,dimStats:{minValues:a.minValues,maxValues:a.maxValues},maskData:n.pixels.resultMask};if(n.pixels.resultMask&&d.isValidPixelValue(a.imageType,i)){var m=n.pixels.resultMask;for(r=0;r<l;r++)m[r]||(p.pixelData[r]=i);p.noDataValue=i}return n.noDataValue=i,t.returnFileInfo&&(p.fileInfo=d.formatFileInfo(n)),p}},getBandCount:function(e){for(var t=0,i=0,r={ptr:0,pixels:{}};i<e.byteLength-58;)d.readHeaderInfo(e,r),i+=r.headerInfo.blobSize,t++,r.ptr=i;return t}}),b=(p=new ArrayBuffer(4),m=new Uint8Array(p),new Uint32Array(p)[0]=1,1===m[0]),_={decode:function(e,t){if(!b)throw"Big endian system is not supported.";var i,r,n=(t=t||{}).inputOffset||0,a=new Uint8Array(e,n,10),s=String.fromCharCode.apply(null,a);if("CntZImage"===s.trim())i=w,r=1;else{if("Lerc2"!==s.substring(0,5))throw"Unexpected file identifier string: "+s;i=y,r=2}for(var o,l,h,f,c,u,d=0,g=e.byteLength-10,p=[],m={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]},_=0;n<g;){var v=i.decode(e,{inputOffset:n,encodedMaskData:o,maskData:h,returnMask:0===d,returnEncodedMask:0===d,returnFileInfo:!0,returnPixelInterleavedDims:t.returnPixelInterleavedDims,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});n=v.fileInfo.eofOffset,h=v.maskData,0===d&&(o=v.encodedMaskData,m.width=v.width,m.height=v.height,m.dimCount=v.dimCount||1,m.pixelType=v.pixelType||v.fileInfo.pixelType,m.mask=h),r>1&&(h&&p.push(h),v.fileInfo.mask&&v.fileInfo.mask.numBytes>0&&_++),d++,m.pixels.push(v.pixelData),m.statistics.push({minValue:v.minValue,maxValue:v.maxValue,noDataValue:v.noDataValue,dimStats:v.dimStats})}if(r>1&&_>1){for(u=m.width*m.height,m.bandMasks=p,(h=new Uint8Array(u)).set(p[0]),f=1;f<p.length;f++)for(l=p[f],c=0;c<u;c++)h[c]=h[c]&l[c];m.maskData=h}return m}};e.exports?e.exports=_:this.Lerc=_}()}(vs);var xs=kr(vs.exports);var ks=Object.freeze({__proto__:null,default:class extends Ra{constructor(e){super(),this.planarConfiguration=void 0!==e.PlanarConfiguration?e.PlanarConfiguration:1,this.samplesPerPixel=void 0!==e.SamplesPerPixel?e.SamplesPerPixel:1,this.addCompression=e.LercParameters[ya]}decodeBlock(e){switch(this.addCompression){case ba:break;case _a:e=xr(new Uint8Array(e)).buffer;break;default:throw new Error(`Unsupported LERC additional compression method identifier: ${this.addCompression}`)}return xs.decode(e,{returnPixelInterleavedDims:1===this.planarConfiguration}).pixels[0].buffer}}});var Ts=Object.freeze({__proto__:null,default:class extends Ra{constructor(){if(super(),"undefined"==typeof createImageBitmap)throw new Error("Cannot decode WebImage as `createImageBitmap` is not available");if("undefined"==typeof document&&"undefined"==typeof OffscreenCanvas)throw new Error("Cannot decode WebImage as neither `document` nor `OffscreenCanvas` is not available")}async decode(e,t){const i=new Blob([t]),r=await createImageBitmap(i);let n;"undefined"!=typeof document?(n=document.createElement("canvas"),n.width=r.width,n.height=r.height):n=new OffscreenCanvas(r.width,r.height);const a=n.getContext("2d");return a.drawImage(r,0,0),a.getImageData(0,0,r.width,r.height).data.buffer}}});export{Qa as default};
5
+ !function(){var t,A,i,r,a,n,s,o,l,g,h,c,f,d,u,I,B=(t={defaultNoDataValue:-34027999387901484e22,decode:function(e,n){var s=(n=n||{}).encodedMaskData||null===n.encodedMaskData,o=a(e,n.inputOffset||0,s),l=null!==n.noDataValue?n.noDataValue:t.defaultNoDataValue,g=A(o,n.pixelType||Float32Array,n.encodedMaskData,l,n.returnMask),h={width:o.width,height:o.height,pixelData:g.resultPixels,minValue:g.minValue,maxValue:o.pixels.maxValue,noDataValue:l};return g.resultMask&&(h.maskData=g.resultMask),n.returnEncodedMask&&o.mask&&(h.encodedMaskData=o.mask.bitset?o.mask.bitset:null),n.returnFileInfo&&(h.fileInfo=i(o),n.computeUsedBitDepths&&(h.fileInfo.bitDepths=r(o))),h}},A=function(e,t,A,i,r){var a,s,o,l=0,g=e.pixels.numBlocksX,h=e.pixels.numBlocksY,c=Math.floor(e.width/g),f=Math.floor(e.height/h),d=2*e.maxZError,u=Number.MAX_VALUE;A=A||(e.mask?e.mask.bitset:null),s=new t(e.width*e.height),r&&A&&(o=new Uint8Array(e.width*e.height));for(var I,B,C=new Float32Array(c*f),E=0;E<=h;E++){var w=E!==h?f:e.height%h;if(0!==w)for(var Q=0;Q<=g;Q++){var m=Q!==g?c:e.width%g;if(0!==m){var p,y,_,b,D=E*e.width*f+Q*c,k=e.width-m,v=e.pixels.blocks[l];if(v.encoding<2?(0===v.encoding?p=v.rawData:(n(v.stuffedData,v.bitsPerPixel,v.numValidPixels,v.offset,d,C,e.pixels.maxValue),p=C),y=0):_=2===v.encoding?0:v.offset,A)for(B=0;B<w;B++){for(7&D&&(b=A[D>>3],b<<=7&D),I=0;I<m;I++)7&D||(b=A[D>>3]),128&b?(o&&(o[D]=1),u=u>(a=v.encoding<2?p[y++]:_)?a:u,s[D++]=a):(o&&(o[D]=0),s[D++]=i),b<<=1;D+=k}else if(v.encoding<2)for(B=0;B<w;B++){for(I=0;I<m;I++)u=u>(a=p[y++])?a:u,s[D++]=a;D+=k}else for(u=u>_?_:u,B=0;B<w;B++){for(I=0;I<m;I++)s[D++]=_;D+=k}if(1===v.encoding&&y!==v.numValidPixels)throw"Block and Mask do not match";l++}}}return{resultPixels:s,resultMask:o,minValue:u}},i=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},r=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,A={},i=0;i<t;i++){var r=e.pixels.blocks[i];0===r.encoding?A.float32=!0:1===r.encoding?A[r.bitsPerPixel]=!0:A[0]=!0}return Object.keys(A)},a=function(e,t,A){var i={},r=new Uint8Array(e,t,10);if(i.fileIdentifierString=String.fromCharCode.apply(null,r),"CntZImage"!==i.fileIdentifierString.trim())throw"Unexpected file identifier string: "+i.fileIdentifierString;t+=10;var a=new DataView(e,t,24);if(i.fileVersion=a.getInt32(0,!0),i.imageType=a.getInt32(4,!0),i.height=a.getUint32(8,!0),i.width=a.getUint32(12,!0),i.maxZError=a.getFloat64(16,!0),t+=24,!A)if(a=new DataView(e,t,16),i.mask={},i.mask.numBlocksY=a.getUint32(0,!0),i.mask.numBlocksX=a.getUint32(4,!0),i.mask.numBytes=a.getUint32(8,!0),i.mask.maxValue=a.getFloat32(12,!0),t+=16,i.mask.numBytes>0){var n=new Uint8Array(Math.ceil(i.width*i.height/8)),s=(a=new DataView(e,t,i.mask.numBytes)).getInt16(0,!0),o=2,l=0;do{if(s>0)for(;s--;)n[l++]=a.getUint8(o++);else{var g=a.getUint8(o++);for(s=-s;s--;)n[l++]=g}s=a.getInt16(o,!0),o+=2}while(o<i.mask.numBytes);if(-32768!==s||l<n.length)throw"Unexpected end of mask RLE encoding";i.mask.bitset=n,t+=i.mask.numBytes}else 0==(i.mask.numBytes|i.mask.numBlocksY|i.mask.maxValue)&&(i.mask.bitset=new Uint8Array(Math.ceil(i.width*i.height/8)));a=new DataView(e,t,16),i.pixels={},i.pixels.numBlocksY=a.getUint32(0,!0),i.pixels.numBlocksX=a.getUint32(4,!0),i.pixels.numBytes=a.getUint32(8,!0),i.pixels.maxValue=a.getFloat32(12,!0),t+=16;var h=i.pixels.numBlocksX,c=i.pixels.numBlocksY,f=h+(i.width%h>0?1:0),d=c+(i.height%c>0?1:0);i.pixels.blocks=new Array(f*d);for(var u=0,I=0;I<d;I++)for(var B=0;B<f;B++){var C=0,E=e.byteLength-t;a=new DataView(e,t,Math.min(10,E));var w={};i.pixels.blocks[u++]=w;var Q=a.getUint8(0);if(C++,w.encoding=63&Q,w.encoding>3)throw"Invalid block encoding ("+w.encoding+")";if(2!==w.encoding){if(0!==Q&&2!==Q){if(Q>>=6,w.offsetType=Q,2===Q)w.offset=a.getInt8(1),C++;else if(1===Q)w.offset=a.getInt16(1,!0),C+=2;else{if(0!==Q)throw"Invalid block offset type";w.offset=a.getFloat32(1,!0),C+=4}if(1===w.encoding)if(Q=a.getUint8(C),C++,w.bitsPerPixel=63&Q,Q>>=6,w.numValidPixelsType=Q,2===Q)w.numValidPixels=a.getUint8(C),C++;else if(1===Q)w.numValidPixels=a.getUint16(C,!0),C+=2;else{if(0!==Q)throw"Invalid valid pixel count type";w.numValidPixels=a.getUint32(C,!0),C+=4}}var m;if(t+=C,3!==w.encoding)if(0===w.encoding){var p=(i.pixels.numBytes-1)/4;if(p!==Math.floor(p))throw"uncompressed block has invalid length";m=new ArrayBuffer(4*p),new Uint8Array(m).set(new Uint8Array(e,t,4*p));var y=new Float32Array(m);w.rawData=y,t+=4*p}else if(1===w.encoding){var _=Math.ceil(w.numValidPixels*w.bitsPerPixel/8),b=Math.ceil(_/4);m=new ArrayBuffer(4*b),new Uint8Array(m).set(new Uint8Array(e,t,_)),w.stuffedData=new Uint32Array(m),t+=_}}else t++}return i.eofOffset=t,i},n=function(e,t,A,i,r,a,n){var s,o,l,g=(1<<t)-1,h=0,c=0,f=Math.ceil((n-i)/r),d=4*e.length-Math.ceil(t*A/8);for(e[e.length-1]<<=8*d,s=0;s<A;s++){if(0===c&&(l=e[h++],c=32),c>=t)o=l>>>c-t&g,c-=t;else{var u=t-c;o=(l&g)<<u&g,o+=(l=e[h++])>>>(c=32-u)}a[s]=o<f?i+o*r:n}return a},t),C=(s=function(e,t,A,i,r,a,n,s){var o,l,g,h,c,f=(1<<A)-1,d=0,u=0,I=4*e.length-Math.ceil(A*i/8);if(e[e.length-1]<<=8*I,r)for(o=0;o<i;o++)0===u&&(g=e[d++],u=32),u>=A?(l=g>>>u-A&f,u-=A):(l=(g&f)<<(h=A-u)&f,l+=(g=e[d++])>>>(u=32-h)),t[o]=r[l];else for(c=Math.ceil((s-a)/n),o=0;o<i;o++)0===u&&(g=e[d++],u=32),u>=A?(l=g>>>u-A&f,u-=A):(l=(g&f)<<(h=A-u)&f,l+=(g=e[d++])>>>(u=32-h)),t[o]=l<c?a+l*n:s},o=function(e,t,A,i,r,a){var n,s=(1<<t)-1,o=0,l=0,g=0,h=0,c=0,f=[],d=4*e.length-Math.ceil(t*A/8);e[e.length-1]<<=8*d;var u=Math.ceil((a-i)/r);for(l=0;l<A;l++)0===h&&(n=e[o++],h=32),h>=t?(c=n>>>h-t&s,h-=t):(c=(n&s)<<(g=t-h)&s,c+=(n=e[o++])>>>(h=32-g)),f[l]=c<u?i+c*r:a;return f.unshift(i),f},l=function(e,t,A,i,r,a,n,s){var o,l,g,h,c=(1<<A)-1,f=0,d=0,u=0;if(r)for(o=0;o<i;o++)0===d&&(g=e[f++],d=32,u=0),d>=A?(l=g>>>u&c,d-=A,u+=A):(l=g>>>u&c,d=32-(h=A-d),l|=((g=e[f++])&(1<<h)-1)<<A-h,u=h),t[o]=r[l];else{var I=Math.ceil((s-a)/n);for(o=0;o<i;o++)0===d&&(g=e[f++],d=32,u=0),d>=A?(l=g>>>u&c,d-=A,u+=A):(l=g>>>u&c,d=32-(h=A-d),l|=((g=e[f++])&(1<<h)-1)<<A-h,u=h),t[o]=l<I?a+l*n:s}return t},g=function(e,t,A,i,r,a){var n,s=(1<<t)-1,o=0,l=0,g=0,h=0,c=0,f=0,d=[],u=Math.ceil((a-i)/r);for(l=0;l<A;l++)0===h&&(n=e[o++],h=32,f=0),h>=t?(c=n>>>f&s,h-=t,f+=t):(c=n>>>f&s,h=32-(g=t-h),c|=((n=e[o++])&(1<<g)-1)<<t-g,f=g),d[l]=c<u?i+c*r:a;return d.unshift(i),d},h=function(e,t,A,i){var r,a,n,s,o=(1<<A)-1,l=0,g=0,h=4*e.length-Math.ceil(A*i/8);for(e[e.length-1]<<=8*h,r=0;r<i;r++)0===g&&(n=e[l++],g=32),g>=A?(a=n>>>g-A&o,g-=A):(a=(n&o)<<(s=A-g)&o,a+=(n=e[l++])>>>(g=32-s)),t[r]=a;return t},c=function(e,t,A,i){var r,a,n,s,o=(1<<A)-1,l=0,g=0,h=0;for(r=0;r<i;r++)0===g&&(n=e[l++],g=32,h=0),g>=A?(a=n>>>h&o,g-=A,h+=A):(a=n>>>h&o,g=32-(s=A-g),a|=((n=e[l++])&(1<<s)-1)<<A-s,h=s),t[r]=a;return t},f={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,A=65535,i=e.length,r=Math.floor(i/2),a=0;r;){var n=r>=359?359:r;r-=n;do{t+=e[a++]<<8,A+=t+=e[a++]}while(--n);t=(65535&t)+(t>>>16),A=(65535&A)+(A>>>16)}return 1&i&&(A+=t+=e[a]<<8),((A=(65535&A)+(A>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var A=t.ptr,i=new Uint8Array(e,A,6),r={};if(r.fileIdentifierString=String.fromCharCode.apply(null,i),0!==r.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+r.fileIdentifierString;A+=6;var a,n=new DataView(e,A,8),s=n.getInt32(0,!0);if(r.fileVersion=s,A+=4,s>=3&&(r.checksum=n.getUint32(4,!0),A+=4),n=new DataView(e,A,12),r.height=n.getUint32(0,!0),r.width=n.getUint32(4,!0),A+=8,s>=4?(r.numDims=n.getUint32(8,!0),A+=4):r.numDims=1,n=new DataView(e,A,40),r.numValidPixel=n.getUint32(0,!0),r.microBlockSize=n.getInt32(4,!0),r.blobSize=n.getInt32(8,!0),r.imageType=n.getInt32(12,!0),r.maxZError=n.getFloat64(16,!0),r.zMin=n.getFloat64(24,!0),r.zMax=n.getFloat64(32,!0),A+=40,t.headerInfo=r,t.ptr=A,s>=3&&(a=s>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,A-a,r.blobSize-14))!==r.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var A=t.headerInfo,i=this.getDataTypeArray(A.imageType),r=A.numDims*this.getDataTypeSize(A.imageType),a=this.readSubArray(e,t.ptr,i,r),n=this.readSubArray(e,t.ptr+r,i,r);t.ptr+=2*r;var s,o=!0;for(s=0;s<A.numDims;s++)if(a[s]!==n[s]){o=!1;break}return A.minValues=a,A.maxValues=n,o},readSubArray:function(e,t,A,i){var r;if(A===Uint8Array)r=new Uint8Array(e,t,i);else{var a=new ArrayBuffer(i);new Uint8Array(a).set(new Uint8Array(e,t,i)),r=new A(a)}return r},readMask:function(e,t){var A,i,r=t.ptr,a=t.headerInfo,n=a.width*a.height,s=a.numValidPixel,o=new DataView(e,r,4),l={};if(l.numBytes=o.getUint32(0,!0),r+=4,(0===s||n===s)&&0!==l.numBytes)throw"invalid mask";if(0===s)A=new Uint8Array(Math.ceil(n/8)),l.bitset=A,i=new Uint8Array(n),t.pixels.resultMask=i,r+=l.numBytes;else if(l.numBytes>0){A=new Uint8Array(Math.ceil(n/8));var g=(o=new DataView(e,r,l.numBytes)).getInt16(0,!0),h=2,c=0,f=0;do{if(g>0)for(;g--;)A[c++]=o.getUint8(h++);else for(f=o.getUint8(h++),g=-g;g--;)A[c++]=f;g=o.getInt16(h,!0),h+=2}while(h<l.numBytes);if(-32768!==g||c<A.length)throw"Unexpected end of mask RLE encoding";i=new Uint8Array(n);var d=0,u=0;for(u=0;u<n;u++)7&u?(d=A[u>>3],d<<=7&u):d=A[u>>3],128&d&&(i[u]=1);t.pixels.resultMask=i,l.bitset=A,r+=l.numBytes}return t.ptr=r,t.mask=l,!0},readDataOneSweep:function(e,t,A,i){var r,a=t.ptr,n=t.headerInfo,s=n.numDims,o=n.width*n.height,l=n.imageType,g=n.numValidPixel*f.getDataTypeSize(l)*s,h=t.pixels.resultMask;if(A===Uint8Array)r=new Uint8Array(e,a,g);else{var c=new ArrayBuffer(g);new Uint8Array(c).set(new Uint8Array(e,a,g)),r=new A(c)}if(r.length===o*s)t.pixels.resultPixels=i?f.swapDimensionOrder(r,o,s,A,!0):r;else{t.pixels.resultPixels=new A(o*s);var d=0,u=0,I=0,B=0;if(s>1){if(i){for(u=0;u<o;u++)if(h[u])for(B=u,I=0;I<s;I++,B+=o)t.pixels.resultPixels[B]=r[d++]}else for(u=0;u<o;u++)if(h[u])for(B=u*s,I=0;I<s;I++)t.pixels.resultPixels[B+I]=r[d++]}else for(u=0;u<o;u++)h[u]&&(t.pixels.resultPixels[u]=r[d++])}return a+=g,t.ptr=a,!0},readHuffmanTree:function(e,t){var A=this.HUFFMAN_LUT_BITS_MAX,i=new DataView(e,t.ptr,16);if(t.ptr+=16,i.getInt32(0,!0)<2)throw"unsupported Huffman version";var r=i.getInt32(4,!0),a=i.getInt32(8,!0),n=i.getInt32(12,!0);if(a>=n)return!1;var s=new Uint32Array(n-a);f.decodeBits(e,t,s);var o,l,g,h,c=[];for(o=a;o<n;o++)c[l=o-(o<r?0:r)]={first:s[o-a],second:null};var u=e.byteLength-t.ptr,I=Math.ceil(u/4),B=new ArrayBuffer(4*I);new Uint8Array(B).set(new Uint8Array(e,t.ptr,u));var C,E=new Uint32Array(B),w=0,Q=0;for(C=E[0],o=a;o<n;o++)(h=c[l=o-(o<r?0:r)].first)>0&&(c[l].second=C<<w>>>32-h,32-w>=h?32===(w+=h)&&(w=0,C=E[++Q]):(w+=h-32,C=E[++Q],c[l].second|=C>>>32-w));var m=0,p=0,y=new d;for(o=0;o<c.length;o++)void 0!==c[o]&&(m=Math.max(m,c[o].first));p=m>=A?A:m;var _,b,D,k,v,x=[];for(o=a;o<n;o++)if((h=c[l=o-(o<r?0:r)].first)>0)if(_=[h,l],h<=p)for(b=c[l].second<<p-h,D=1<<p-h,g=0;g<D;g++)x[b|g]=_;else for(b=c[l].second,v=y,k=h-1;k>=0;k--)b>>>k&1?(v.right||(v.right=new d),v=v.right):(v.left||(v.left=new d),v=v.left),0!==k||v.val||(v.val=_[1]);return{decodeLut:x,numBitsLUTQick:p,numBitsLUT:m,tree:y,stuffedData:E,srcPtr:Q,bitPos:w}},readHuffman:function(e,t,A,i){var r,a,n,s,o,l,g,h,c,d=t.headerInfo.numDims,u=t.headerInfo.height,I=t.headerInfo.width,B=I*u,C=this.readHuffmanTree(e,t),E=C.decodeLut,w=C.tree,Q=C.stuffedData,m=C.srcPtr,p=C.bitPos,y=C.numBitsLUTQick,_=C.numBitsLUT,b=0===t.headerInfo.imageType?128:0,D=t.pixels.resultMask,k=0;p>0&&(m++,p=0);var v,x=Q[m],S=1===t.encodeMode,G=new A(B*d),U=G;if(d<2||S){for(v=0;v<d;v++)if(d>1&&(U=new A(G.buffer,B*v,B),k=0),t.headerInfo.numValidPixel===I*u)for(h=0,l=0;l<u;l++)for(g=0;g<I;g++,h++){if(a=0,o=s=x<<p>>>32-y,32-p<y&&(o=s|=Q[m+1]>>>64-p-y),E[o])a=E[o][1],p+=E[o][0];else for(o=s=x<<p>>>32-_,32-p<_&&(o=s|=Q[m+1]>>>64-p-_),r=w,c=0;c<_;c++)if(!(r=s>>>_-c-1&1?r.right:r.left).left&&!r.right){a=r.val,p=p+c+1;break}p>=32&&(p-=32,x=Q[++m]),n=a-b,S?(n+=g>0?k:l>0?U[h-I]:k,n&=255,U[h]=n,k=n):U[h]=n}else for(h=0,l=0;l<u;l++)for(g=0;g<I;g++,h++)if(D[h]){if(a=0,o=s=x<<p>>>32-y,32-p<y&&(o=s|=Q[m+1]>>>64-p-y),E[o])a=E[o][1],p+=E[o][0];else for(o=s=x<<p>>>32-_,32-p<_&&(o=s|=Q[m+1]>>>64-p-_),r=w,c=0;c<_;c++)if(!(r=s>>>_-c-1&1?r.right:r.left).left&&!r.right){a=r.val,p=p+c+1;break}p>=32&&(p-=32,x=Q[++m]),n=a-b,S?(g>0&&D[h-1]?n+=k:l>0&&D[h-I]?n+=U[h-I]:n+=k,n&=255,U[h]=n,k=n):U[h]=n}}else for(h=0,l=0;l<u;l++)for(g=0;g<I;g++)if(h=l*I+g,!D||D[h])for(v=0;v<d;v++,h+=B){if(a=0,o=s=x<<p>>>32-y,32-p<y&&(o=s|=Q[m+1]>>>64-p-y),E[o])a=E[o][1],p+=E[o][0];else for(o=s=x<<p>>>32-_,32-p<_&&(o=s|=Q[m+1]>>>64-p-_),r=w,c=0;c<_;c++)if(!(r=s>>>_-c-1&1?r.right:r.left).left&&!r.right){a=r.val,p=p+c+1;break}p>=32&&(p-=32,x=Q[++m]),n=a-b,U[h]=n}t.ptr=t.ptr+4*(m+1)+(p>0?4:0),t.pixels.resultPixels=G,d>1&&!i&&(t.pixels.resultPixels=f.swapDimensionOrder(G,B,d,A))},decodeBits:function(e,t,A,i,r){var a=t.headerInfo,n=a.fileVersion,f=0,d=e.byteLength-t.ptr>=5?5:e.byteLength-t.ptr,u=new DataView(e,t.ptr,d),I=u.getUint8(0);f++;var B=I>>6,C=0===B?4:3-B,E=(32&I)>0,w=31&I,Q=0;if(1===C)Q=u.getUint8(f),f++;else if(2===C)Q=u.getUint16(f,!0),f+=2;else{if(4!==C)throw"Invalid valid pixel count type";Q=u.getUint32(f,!0),f+=4}var m,p,y,_,b,D,k,v,x,S=2*a.maxZError,G=a.numDims>1?a.maxValues[r]:a.zMax;if(E){for(t.counter.lut++,v=u.getUint8(f),f++,_=Math.ceil((v-1)*w/8),b=Math.ceil(_/4),p=new ArrayBuffer(4*b),y=new Uint8Array(p),t.ptr+=f,y.set(new Uint8Array(e,t.ptr,_)),k=new Uint32Array(p),t.ptr+=_,x=0;v-1>>>x;)x++;_=Math.ceil(Q*x/8),b=Math.ceil(_/4),p=new ArrayBuffer(4*b),(y=new Uint8Array(p)).set(new Uint8Array(e,t.ptr,_)),m=new Uint32Array(p),t.ptr+=_,D=n>=3?g(k,w,v-1,i,S,G):o(k,w,v-1,i,S,G),n>=3?l(m,A,x,Q,D):s(m,A,x,Q,D)}else t.counter.bitstuffer++,x=w,t.ptr+=f,x>0&&(_=Math.ceil(Q*x/8),b=Math.ceil(_/4),p=new ArrayBuffer(4*b),(y=new Uint8Array(p)).set(new Uint8Array(e,t.ptr,_)),m=new Uint32Array(p),t.ptr+=_,n>=3?null==i?c(m,A,x,Q):l(m,A,x,Q,!1,i,S,G):null==i?h(m,A,x,Q):s(m,A,x,Q,!1,i,S,G))},readTiles:function(e,t,A,i){var r=t.headerInfo,a=r.width,n=r.height,s=a*n,o=r.microBlockSize,l=r.imageType,g=f.getDataTypeSize(l),h=Math.ceil(a/o),c=Math.ceil(n/o);t.pixels.numBlocksY=c,t.pixels.numBlocksX=h,t.pixels.ptr=0;var d,u,I,B,C,E,w,Q,m,p,y=0,_=0,b=0,D=0,k=0,v=0,x=0,S=0,G=0,U=0,M=0,R=0,F=0,L=0,T=0,N=new A(o*o),P=n%o||o,O=a%o||o,z=r.numDims,K=t.pixels.resultMask,H=t.pixels.resultPixels,J=r.fileVersion>=5?14:15,q=r.zMax;for(b=0;b<c;b++)for(k=b!==c-1?o:P,D=0;D<h;D++)for(U=b*a*o+D*o,M=a-(v=D!==h-1?o:O),Q=0;Q<z;Q++){if(z>1?(p=H,U=b*a*o+D*o,H=new A(t.pixels.resultPixels.buffer,s*Q*g,s),q=r.maxValues[Q]):p=null,x=e.byteLength-t.ptr,u={},T=0,S=(d=new DataView(e,t.ptr,Math.min(10,x))).getUint8(0),T++,m=r.fileVersion>=5?4&S:0,G=S>>6&255,(S>>2&J)!=(D*o>>3&J))throw"integrity issue";if(m&&0===Q)throw"integrity issue";if((C=3&S)>3)throw t.ptr+=T,"Invalid block encoding ("+C+")";if(2!==C)if(0===C){if(m)throw"integrity issue";if(t.counter.uncompressed++,t.ptr+=T,R=(R=k*v*g)<(F=e.byteLength-t.ptr)?R:F,I=new ArrayBuffer(R%g==0?R:R+g-R%g),new Uint8Array(I).set(new Uint8Array(e,t.ptr,R)),B=new A(I),L=0,K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(H[U]=B[L++]),U++;U+=M}else for(y=0;y<k;y++){for(_=0;_<v;_++)H[U++]=B[L++];U+=M}t.ptr+=L*g}else if(E=f.getDataTypeUsed(m&&l<6?4:l,G),w=f.getOnePixel(u,T,E,d),T+=f.getDataTypeSize(E),3===C)if(t.ptr+=T,t.counter.constantoffset++,K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(H[U]=m?Math.min(q,p[U]+w):w),U++;U+=M}else for(y=0;y<k;y++){for(_=0;_<v;_++)H[U]=m?Math.min(q,p[U]+w):w,U++;U+=M}else if(t.ptr+=T,f.decodeBits(e,t,N,w,Q),T=0,m)if(K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(H[U]=N[T++]+p[U]),U++;U+=M}else for(y=0;y<k;y++){for(_=0;_<v;_++)H[U]=N[T++]+p[U],U++;U+=M}else if(K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(H[U]=N[T++]),U++;U+=M}else for(y=0;y<k;y++){for(_=0;_<v;_++)H[U++]=N[T++];U+=M}else{if(m)if(K)for(y=0;y<k;y++)for(_=0;_<v;_++)K[U]&&(H[U]=p[U]),U++;else for(y=0;y<k;y++)for(_=0;_<v;_++)H[U]=p[U],U++;t.counter.constant++,t.ptr+=T}}z>1&&!i&&(t.pixels.resultPixels=f.swapDimensionOrder(t.pixels.resultPixels,s,z,A))},formatFileInfo:function(e){return{fileIdentifierString:e.headerInfo.fileIdentifierString,fileVersion:e.headerInfo.fileVersion,imageType:e.headerInfo.imageType,height:e.headerInfo.height,width:e.headerInfo.width,numValidPixel:e.headerInfo.numValidPixel,microBlockSize:e.headerInfo.microBlockSize,blobSize:e.headerInfo.blobSize,maxZError:e.headerInfo.maxZError,pixelType:f.getPixelType(e.headerInfo.imageType),eofOffset:e.eofOffset,mask:e.mask?{numBytes:e.mask.numBytes}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,maxValue:e.headerInfo.zMax,minValue:e.headerInfo.zMin,noDataValue:e.noDataValue}}},constructConstantSurface:function(e,t){var A=e.headerInfo.zMax,i=e.headerInfo.zMin,r=e.headerInfo.maxValues,a=e.headerInfo.numDims,n=e.headerInfo.height*e.headerInfo.width,s=0,o=0,l=0,g=e.pixels.resultMask,h=e.pixels.resultPixels;if(g)if(a>1){if(t)for(s=0;s<a;s++)for(l=s*n,A=r[s],o=0;o<n;o++)g[o]&&(h[l+o]=A);else for(o=0;o<n;o++)if(g[o])for(l=o*a,s=0;s<a;s++)h[l+a]=r[s]}else for(o=0;o<n;o++)g[o]&&(h[o]=A);else if(a>1&&i!==A)if(t)for(s=0;s<a;s++)for(l=s*n,A=r[s],o=0;o<n;o++)h[l+o]=A;else for(o=0;o<n;o++)for(l=o*a,s=0;s<a;s++)h[l+s]=r[s];else for(o=0;o<n*a;o++)h[o]=A},getDataTypeArray:function(e){var t;switch(e){case 0:t=Int8Array;break;case 1:t=Uint8Array;break;case 2:t=Int16Array;break;case 3:t=Uint16Array;break;case 4:t=Int32Array;break;case 5:t=Uint32Array;break;case 6:default:t=Float32Array;break;case 7:t=Float64Array}return t},getPixelType:function(e){var t;switch(e){case 0:t="S8";break;case 1:t="U8";break;case 2:t="S16";break;case 3:t="U16";break;case 4:t="S32";break;case 5:t="U32";break;case 6:default:t="F32";break;case 7:t="F64"}return t},isValidPixelValue:function(e,t){if(null==t)return!1;var A;switch(e){case 0:A=t>=-128&&t<=127;break;case 1:A=t>=0&&t<=255;break;case 2:A=t>=-32768&&t<=32767;break;case 3:A=t>=0&&t<=65536;break;case 4:A=t>=-2147483648&&t<=2147483647;break;case 5:A=t>=0&&t<=4294967296;break;case 6:A=t>=-34027999387901484e22&&t<=34027999387901484e22;break;case 7:A=t>=-17976931348623157e292&&t<=17976931348623157e292;break;default:A=!1}return A},getDataTypeSize:function(e){var t=0;switch(e){case 0:case 1:t=1;break;case 2:case 3:t=2;break;case 4:case 5:case 6:t=4;break;case 7:t=8;break;default:t=e}return t},getDataTypeUsed:function(e,t){var A=e;switch(e){case 2:case 4:A=e-t;break;case 3:case 5:A=e-2*t;break;case 6:A=0===t?e:1===t?2:1;break;case 7:A=0===t?e:e-2*t+1;break;default:A=e}return A},getOnePixel:function(e,t,A,i){var r=0;switch(A){case 0:r=i.getInt8(t);break;case 1:r=i.getUint8(t);break;case 2:r=i.getInt16(t,!0);break;case 3:r=i.getUint16(t,!0);break;case 4:r=i.getInt32(t,!0);break;case 5:r=i.getUInt32(t,!0);break;case 6:r=i.getFloat32(t,!0);break;case 7:r=i.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}return r},swapDimensionOrder:function(e,t,A,i,r){var a=0,n=0,s=0,o=0,l=e;if(A>1)if(l=new i(t*A),r)for(a=0;a<t;a++)for(o=a,s=0;s<A;s++,o+=t)l[o]=e[n++];else for(a=0;a<t;a++)for(o=a,s=0;s<A;s++,o+=t)l[n++]=e[o];return l}},d=function(e,t,A){this.val=e,this.left=t,this.right=A},{decode:function(e,t){var A=(t=t||{}).noDataValue,i=0,r={};if(r.ptr=t.inputOffset||0,r.pixels={},f.readHeaderInfo(e,r)){var a=r.headerInfo,n=a.fileVersion,s=f.getDataTypeArray(a.imageType);if(n>5)throw"unsupported lerc version 2."+n;f.readMask(e,r),a.numValidPixel===a.width*a.height||r.pixels.resultMask||(r.pixels.resultMask=t.maskData);var o=a.width*a.height;r.pixels.resultPixels=new s(o*a.numDims),r.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var l,g=!t.returnPixelInterleavedDims;if(0!==a.numValidPixel)if(a.zMax===a.zMin)f.constructConstantSurface(r,g);else if(n>=4&&f.checkMinMaxRanges(e,r))f.constructConstantSurface(r,g);else{var h=new DataView(e,r.ptr,2),c=h.getUint8(0);if(r.ptr++,c)f.readDataOneSweep(e,r,s,g);else if(n>1&&a.imageType<=1&&Math.abs(a.maxZError-.5)<1e-5){var d=h.getUint8(1);if(r.ptr++,r.encodeMode=d,d>2||n<4&&d>1)throw"Invalid Huffman flag "+d;d?f.readHuffman(e,r,s,g):f.readTiles(e,r,s,g)}else f.readTiles(e,r,s,g)}r.eofOffset=r.ptr,t.inputOffset?(l=r.headerInfo.blobSize+t.inputOffset-r.ptr,Math.abs(l)>=1&&(r.eofOffset=t.inputOffset+r.headerInfo.blobSize)):(l=r.headerInfo.blobSize-r.ptr,Math.abs(l)>=1&&(r.eofOffset=r.headerInfo.blobSize));var u={width:a.width,height:a.height,pixelData:r.pixels.resultPixels,minValue:a.zMin,maxValue:a.zMax,validPixelCount:a.numValidPixel,dimCount:a.numDims,dimStats:{minValues:a.minValues,maxValues:a.maxValues},maskData:r.pixels.resultMask};if(r.pixels.resultMask&&f.isValidPixelValue(a.imageType,A)){var I=r.pixels.resultMask;for(i=0;i<o;i++)I[i]||(u.pixelData[i]=A);u.noDataValue=A}return r.noDataValue=A,t.returnFileInfo&&(u.fileInfo=f.formatFileInfo(r)),u}},getBandCount:function(e){for(var t=0,A=0,i={ptr:0,pixels:{}};A<e.byteLength-58;)f.readHeaderInfo(e,i),A+=i.headerInfo.blobSize,t++,i.ptr=A;return t}}),E=(u=new ArrayBuffer(4),I=new Uint8Array(u),new Uint32Array(u)[0]=1,1===I[0]),w={decode:function(e,t){if(!E)throw"Big endian system is not supported.";var A,i,r=(t=t||{}).inputOffset||0,a=new Uint8Array(e,r,10),n=String.fromCharCode.apply(null,a);if("CntZImage"===n.trim())A=B,i=1;else{if("Lerc2"!==n.substring(0,5))throw"Unexpected file identifier string: "+n;A=C,i=2}for(var s,o,l,g,h,c,f=0,d=e.byteLength-10,u=[],I={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]},w=0;r<d;){var Q=A.decode(e,{inputOffset:r,encodedMaskData:s,maskData:l,returnMask:0===f,returnEncodedMask:0===f,returnFileInfo:!0,returnPixelInterleavedDims:t.returnPixelInterleavedDims,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});r=Q.fileInfo.eofOffset,l=Q.maskData,0===f&&(s=Q.encodedMaskData,I.width=Q.width,I.height=Q.height,I.dimCount=Q.dimCount||1,I.pixelType=Q.pixelType||Q.fileInfo.pixelType,I.mask=l),i>1&&(l&&u.push(l),Q.fileInfo.mask&&Q.fileInfo.mask.numBytes>0&&w++),f++,I.pixels.push(Q.pixelData),I.statistics.push({minValue:Q.minValue,maxValue:Q.maxValue,noDataValue:Q.noDataValue,dimStats:Q.dimStats})}if(i>1&&w>1){for(c=I.width*I.height,I.bandMasks=u,(l=new Uint8Array(c)).set(u[0]),g=1;g<u.length;g++)for(o=u[g],h=0;h<c;h++)l[h]=l[h]&o[h];I.maskData=l}return I}};e.exports?e.exports=w:this.Lerc=w}()}(Rl);var Fl=Di(Rl.exports);let Ll,Tl,Nl;const Pl={env:{emscripten_notify_memory_growth:function(e){Nl=new Uint8Array(Tl.exports.memory.buffer)}}};const Ol="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8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AAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUEC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ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0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QaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFB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AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDED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EBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",zl=new class{init(){return Ll||(Ll="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Ol).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,Pl))).then(this._init):WebAssembly.instantiate(Buffer.from(Ol,"base64"),Pl).then(this._init),Ll)}_init(e){Tl=e.instance,Pl.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Tl)throw new Error("ZSTDDecoder: Await .init() before decoding.");const A=e.byteLength,i=Tl.exports.malloc(A);Nl.set(e,i),t=t||Number(Tl.exports.ZSTD_findDecompressedSize(i,A));const r=Tl.exports.malloc(t),a=Tl.exports.ZSTD_decompress(r,t,i,A),n=Nl.slice(r,r+a);return Tl.exports.free(i),Tl.exports.free(r),n}};var Kl=Object.freeze({__proto__:null,default:class extends za{constructor(e){super(),this.planarConfiguration=void 0!==e.PlanarConfiguration?e.PlanarConfiguration:1,this.samplesPerPixel=void 0!==e.SamplesPerPixel?e.SamplesPerPixel:1,this.addCompression=e.LercParameters[Qa]}decodeBlock(e){switch(this.addCompression){case ma:break;case pa:e=Gl(new Uint8Array(e)).buffer;break;case ya:e=zl.decode(new Uint8Array(e)).buffer;break;default:throw new Error(`Unsupported LERC additional compression method identifier: ${this.addCompression}`)}return Fl.decode(e,{returnPixelInterleavedDims:1===this.planarConfiguration}).pixels[0].buffer}},zstd:zl});var Hl=Object.freeze({__proto__:null,default:class extends za{constructor(){if(super(),"undefined"==typeof createImageBitmap)throw new Error("Cannot decode WebImage as `createImageBitmap` is not available");if("undefined"==typeof document&&"undefined"==typeof OffscreenCanvas)throw new Error("Cannot decode WebImage as neither `document` nor `OffscreenCanvas` is not available")}async decode(e,t){const A=new Blob([t]),i=await createImageBitmap(A);let r;"undefined"!=typeof document?(r=document.createElement("canvas"),r.width=i.width,r.height=i.height):r=new OffscreenCanvas(i.width,i.height);const a=r.getContext("2d");return a.drawImage(i,0,0),a.getImageData(0,0,i.width,i.height).data.buffer}}});export{rn as default};
5
6
  //# sourceMappingURL=index.min.js.map