@maptalks/3dtiles 0.23.1 → 0.83.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,22 +1,23 @@
1
1
  /*!
2
- * @maptalks/3dtiles v0.23.1
2
+ * @maptalks/3dtiles v0.83.0
3
3
  * LICENSE : UNLICENSED
4
4
  * (c) 2016-2023 maptalks.org
5
5
  */
6
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("maptalks"),require("@maptalks/gl")):"function"==typeof define&&define.amd?define(["exports","maptalks","@maptalks/gl"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).maptalks=t.maptalks||{},t.maptalks,t.maptalksgl)}(this,(function(t,e,r){"use strict";function n(t){if(t&&t.t)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var i=n(e),s=n(r);const o="${",a=`function(t){var e=1e-6,r="undefined"!=typeof Float32Array?Float32Array:Array;function n(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function A(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function i(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function o(t,e,r){var n=e[0],A=e[1],i=e[2],o=e[3],s=e[4],a=e[5],B=e[6],E=e[7],c=e[8],C=e[9],f=e[10],l=e[11],u=e[12],_=e[13],D=e[14],R=e[15],I=r[0],T=r[1],h=r[2],F=r[3];return t[0]=I*n+T*s+h*c+F*u,t[1]=I*A+T*a+h*C+F*_,t[2]=I*i+T*B+h*f+F*D,t[3]=I*o+T*E+h*l+F*R,I=r[4],T=r[5],h=r[6],F=r[7],t[4]=I*n+T*s+h*c+F*u,t[5]=I*A+T*a+h*C+F*_,t[6]=I*i+T*B+h*f+F*D,t[7]=I*o+T*E+h*l+F*R,I=r[8],T=r[9],h=r[10],F=r[11],t[8]=I*n+T*s+h*c+F*u,t[9]=I*A+T*a+h*C+F*_,t[10]=I*i+T*B+h*f+F*D,t[11]=I*o+T*E+h*l+F*R,I=r[12],T=r[13],h=r[14],F=r[15],t[12]=I*n+T*s+h*c+F*u,t[13]=I*A+T*a+h*C+F*_,t[14]=I*i+T*B+h*f+F*D,t[15]=I*o+T*E+h*l+F*R,t}function s(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function a(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function B(t,e){var r=e[0],n=e[1],A=e[2],i=e[3],o=r+r,s=n+n,a=A+A,B=r*o,E=n*o,c=n*s,C=A*o,f=A*s,l=A*a,u=i*o,_=i*s,D=i*a;return t[0]=1-c-l,t[1]=E+D,t[2]=C-_,t[3]=0,t[4]=E-D,t[5]=1-B-l,t[6]=f+u,t[7]=0,t[8]=C+_,t[9]=f-u,t[10]=1-B-c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function E(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function c(){var t=new r(3);return r!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function C(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function f(t,e,n){var A=new r(3);return A[0]=t,A[1]=e,A[2]=n,A}function l(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function u(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function _(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function D(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function R(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function I(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function T(t,e){var r=e[0]-t[0],n=e[1]-t[1],A=e[2]-t[2];return Math.sqrt(r*r+n*n+A*A)}function h(t,e){var r=e[0],n=e[1],A=e[2],i=r*r+n*n+A*A;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i),t}function F(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function P(t,e,r){var n=e[0],A=e[1],i=e[2],o=r[0],s=r[1],a=r[2];return t[0]=A*a-i*s,t[1]=i*o-n*a,t[2]=n*s-A*o,t}function L(t,e,r){var n=e[0],A=e[1],i=e[2],o=r[3]*n+r[7]*A+r[11]*i+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*A+r[8]*i+r[12])/o,t[1]=(r[1]*n+r[5]*A+r[9]*i+r[13])/o,t[2]=(r[2]*n+r[6]*A+r[10]*i+r[14])/o,t}var O=D,y=R,M=C;function N(t,e,r,n,A){return t[0]=e,t[1]=r,t[2]=n,t[3]=A,t}function S(){var t=new r(4);return r!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function d(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function U(t,r,n,A){var i=r[0],o=r[1],s=r[2],a=r[3],B=n[0],E=n[1],c=n[2],C=n[3],f=void 0,l=void 0,u=void 0,_=void 0,D=void 0;return(l=i*B+o*E+s*c+a*C)<0&&(l=-l,B=-B,E=-E,c=-c,C=-C),1-l>e?(f=Math.acos(l),u=Math.sin(f),_=Math.sin((1-A)*f)/u,D=Math.sin(A*f)/u):(_=1-A,D=A),t[0]=_*i+D*B,t[1]=_*o+D*E,t[2]=_*s+D*c,t[3]=_*a+D*C,t}c(),function(){var t,e=(t=new r(4),r!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var G,m=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t};c(),f(1,0,0),f(0,1,0),S(),S(),G=new r(9),r!=Float32Array&&(G[1]=0,G[2]=0,G[3]=0,G[5]=0,G[6]=0,G[7]=0),G[0]=1,G[4]=1,G[8]=1;\n/*!\n * @maptalks/gltf-loader v0.27.2\n * LICENSE : UNLICENSED\n * (c) 2016-2022 maptalks.org\n */\nlet b=0;function p(t){return null==t}function w(t){return!p(t)}function H(t){for(let e=1;e<arguments.length;e++){const r=arguments[e];for(const e in r)t[e]=r[e]}return t}function K(t){switch(t){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:return Uint16Array;case 5124:return Int32Array;case 5125:return Uint32Array;case 5126:return Float32Array}throw new Error("unsupported bufferView's component type: "+t)}function g(t){return 0===t.indexOf("data:")&&t.indexOf("base64,")>0}function V(t){const e=function(t){return"undefined"!=typeof self?self.atob(t):window.atob(t)}(t.substring(t.indexOf(",")+1)),r=e.length,n=new Uint8Array(r);for(let t=0;t<r;t++)n[t]=e.charCodeAt(t);return n.buffer}const X=[],J=[],v=[],Z=[0,0,0],x=d([]),k=[1,1,1];function W(t,e,r,n,A,i,o){const s=K(o);if((0===A||A===n*s.BYTES_PER_ELEMENT)&&i%s.BYTES_PER_ELEMENT==0){const A=new s(e,i,r*n);return t.set(A),t}0===A&&(A=n*s.BYTES_PER_ELEMENT);const a=new Uint8Array(n*s.BYTES_PER_ELEMENT);for(let o=0;o<r;o++){let r=null;const B=new Uint8Array(e,A*o+i,n*s.BYTES_PER_ELEMENT);a.set(B),r=new s(a.buffer,0,n);for(let e=0;e<n;e++)t[o*n+e]=r[e]}return t}const Q="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;function j(t,e,r){const n=new Uint8Array(t,e,r);return Q.decode(n)}const Y={get:function(t,e={}){e||(e={});const r=new AbortController,n=r.signal,A=H({},e);A.signal=n,A.method||(A.method="GET");const i=fetch(t,A).then((t=>{const r=this.t(t,e.responseType);return r.message?r:r.then((r=>"arraybuffer"===e.responseType?{data:r,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),contentType:t.headers.get("Content-Type")}:r)).catch((t=>{if(!t.code||t.code!==DOMException.ABORT_ERR)throw t}))})).catch((t=>{if(!t.code||t.code!==DOMException.ABORT_ERR)throw t}));return i.xhr=r,i},t:(t,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${o}t.status}): ${o}t.statusText}\`}:"arraybuffer"===e?t.arrayBuffer():"json"===e?t.json():t.text(),getArrayBuffer:(t,e={})=>(e||(e={}),e.responseType="arraybuffer",Y.get(t,e)),getJSON:function(t,e={}){return e&&e.jsonp?Y.jsonp(t):((e=e||{}).responseType="json",Y.get(t,e))},jsonp:function(t){const e="_maptalks_jsonp_"+b++;t.match(/\\?/)?t+="&callback="+e:t+="?callback="+e;let r=document.createElement("script");return r.type="text/javascript",r.src=t,new Promise((t=>{window[e]=function(n){document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[e],t(n)},document.getElementsByTagName("head")[0].appendChild(r)}))}};class z{constructor(t,e,r){this.A=t,this.decoders=e,this.i=r,this.images={},this.o={}}requestImageFromBufferURI(t,e,r){if(this.buffers[t.id]){const n=this.buffers[t.id],A=this.B(e,n);return this.getImageByBuffer(A,r)}if(this.o[t.id])return this.o[t.id].then((()=>{const n=this.buffers[t.id],A=this.B(e,n);return this.getImageByBuffer(A,r)}));if(g(t.uri)){const n=this.buffers[t.id]=V(t.uri),A=this.B(e,n);return this.getImageByBuffer(A,r)}return this.o[t.id]=Y.getArrayBuffer(t.uri,null).then((n=>{const A=this.buffers[t.id]=n.data,i=this.B(e,A);return this.getImageByBuffer(i,r)}))}getImageByBuffer(t,e){if(this.images[e.id])return Promise.resolve(this.images[e.id]);const r=this.decoders;if(r[e.mimeType])return r[e.mimeType](t,{supportedFormats:this.i});if("image/crn"===e.mimeType||"image/ktx2"===e.mimeType||"image/cttf"===e.mimeType)return console.warn("missing transcoder for "+e.mimeType,", visit https://maptalks.com/docs/transcoders for details"),Promise.resolve(null);{const r=new Blob([t],{type:e.mimeType}),n=URL.createObjectURL(r);return this.C(e.id,n)}}requestExternalImage(t){if(this.images[t.id])return Promise.resolve(this.images[t.id]);const e=0===t.uri.indexOf("data:image/")?t.uri:this.rootPath+"/"+t.uri;return this.o[t.id]?this.o[t.id].then((()=>this.images[t.id])):this.o[t.id]=this.C(t.id,e)}C(t,e){return new Promise(((r,n)=>{this.A(e,((A,i)=>{A?n(A):(URL.revokeObjectURL(e),this.images[t]=i,r(this.images[t]))}))}))}}const q=["SCALAR",1,"VEC2",2,"VEC3",3,"VEC4",4,"MAT2",4,"MAT3",9,"MAT4",16];class ${o}constructor(t,e,r){this.rootPath=t,this.gltf=e,this.l=!1,this.glbBuffer=r,this.buffers={},this.requests={},this.accessors={},this.u()}_(t,e){const r=this.gltf,n=r.accessors[e];if(void 0===n.bufferView)return this.accessors[n.id]=this.D(t,e,null,0),Promise.resolve(this.accessors[n.id]);if(n&&this.accessors[n.id])return Promise.resolve(this.accessors[n.id]);const A=r.bufferViews[n.bufferView];return this.I(A).then((r=>{const{buffer:A,byteOffset:i}=r;return this.accessors[n.id]=this.D(t,e,A,i)}))}I(t){const e=this.gltf.buffers[t.buffer];if(this.buffers[e.id]){const t=this.buffers[e.id];return Promise.resolve({buffer:t,byteOffset:0})}if(this.requests[e.id])return this.requests[e.id].then((()=>{const t=this.buffers[e.id];return Promise.resolve({buffer:t,byteOffset:0})}));if("binary_glTF"!==t.buffer&&"KHR_binary_glTF"!==t.buffer&&e.uri){if(g(e.uri)){const t=this.buffers[e.id]=V(e.uri);return Promise.resolve({buffer:t,byteOffset:0})}let t;const r=e.uri.indexOf("blob:")>=0;return t=e.uri.indexOf("://")>0||r?e.uri:this.rootPath+"/"+e.uri,this.requests[e.id]=Y.getArrayBuffer(t,null).then((n=>(r&&URL.revokeObjectURL(t),{buffer:this.buffers[e.id]=n.data,byteOffset:0})))}return Promise.resolve({buffer:this.glbBuffer.buffer,byteOffset:this.glbBuffer.byteOffset})}D(t,e,r,n=0){const A=this.gltf,i=A.accessors[e],o=void 0!==i.bufferView?A.bufferViews[i.bufferView]:{},s=(o.byteOffset||0)+n,a=this.T(i.type),B=K(i.componentType),E=o.byteStride||0,c={array:void 0,name:t,accessorName:e,byteLength:i.count*a*B.BYTES_PER_ELEMENT,componentType:i.componentType,count:i.count,type:i.type,itemSize:a};if(i.min&&(c.min=i.min),i.max&&(c.max=i.max),r)if(this.l)c.byteStride=E,c.byteOffset=s+(i.byteOffset||0),!E||E===a*B.BYTES_PER_ELEMENT||"indices"===t||"input"===t||"output"===t||t.indexOf("morph")>=0?(c.array=this.h(r,i.count,a,s+(i.byteOffset||0),B),c.array.buffer.byteLength===c.byteLength&&(c.byteOffset=0)):c.array=new Uint8Array(r,s,o.byteLength);else if(i.interleaved){c.byteStride=0,c.byteOffset=0;const t=new B(i.count*a);c.array=W(t,r,i.count,a,E,s+(i.byteOffset||0),i.componentType)}else c.byteStride=0,c.array=this.h(r,i.count,a,s+(i.byteOffset||0),B),c.byteOffset=c.array.byteOffset;else{c.array=new B(i.count);const t=c.min||c.max;t&&(c.array[0]=t[0],c.array[1]=t[1],c.array[2]=t[2])}return c}u(){const t=this.gltf.accessors;if(Array.isArray(t))for(let e=0;e<t.length;e++)for(let r=0;r<t.length;r++)e!==r&&t[e].bufferView===t[r].bufferView&&(t[e].interleaved=t[r].interleaved=!0);else for(const e in t)for(const r in t)e!==r&&t[e].bufferView===t[r].bufferView&&(t[e].interleaved=t[r].interleaved=!0)}h(t,e,r,n,A){return n%A.BYTES_PER_ELEMENT!=0&&(t=t.slice(n,n+e*r*A.BYTES_PER_ELEMENT),n=0),new A(t,n,r*e)}T(t){const e=q.indexOf(t);return q[e+1]}requestKHRTechniquesWebgl(t){const{shaders:e}=t,r=e.map((t=>{if(void 0!==t.bufferView){const e=this.gltf.bufferViews[t.bufferView],{byteLength:r}=e;return this.I(e).then((n=>{const{buffer:A,byteOffset:i}=n,o=j(A,i+(e.byteOffset||0),r);return t.content=o,t}))}if(t.uri){if(g(t.uri)){const e=V(t.uri),r=j(e,0,e.byteLength);return t.content=r,Promise.resolve(t)}{const e=this.rootPath+"/"+t.uri;return Y.get(e).then((e=>(t.content=e,t)))}}return Promise.resolve(t)}));return Promise.all(r).then((()=>t))}}class tt extends z{constructor(t,e,r,n,A,i){super(n,A,i),this.rootPath=t,this.gltf=e,this.requests={},this.buffers={},this.glbBuffer=r,this.accessor=new $(t,e,r)}iterate(t,e){const r=this.gltf[e];if(!r)return;let n=0;for(const e in r)t(e,r[e],n++)}createNode(t){const e={};if(w(t.name)&&(e.name=t.name),w(t.children)&&(e.children=t.children),w(t.jointName)&&(e.jointName=t.jointName),w(t.matrix)&&(e.matrix=t.matrix),w(t.rotation)&&(e.rotation=t.rotation),w(t.scale)&&(e.scale=t.scale),w(t.translation)&&(e.translation=t.translation),w(t.extras)&&(e.extras=t.extras),w(t.meshes)&&(e.mesh=t.meshes[0]),e.translation||e.rotation||e.scale){const t=function(t,e){if(e.matrix)return e.matrix;if(e.translation||e.scale||e.rotation){const r=s(X,e.translation||Z),n=B(J,e.rotation||x),A=a(v,e.scale||k);return o(A,n,A),o(t,r,A)}return i(t)}([],e);delete e.translation,delete e.rotation,delete e.scale,e.matrix=t}return e}F(t){const e={};for(const r in t){const n=t[r];let A,i;n.instanceTechnique&&n.instanceTechnique.values?(A=n.instanceTechnique,i=A.values.diffuse):(A=n,i=A.values.tex||A.values.diffuseTex||A.values.diffuse);const o={baseColorTexture:{index:i}};n.name&&(o.name=n.name),n.extensions&&(o.extensions=n.extensions),n.extras&&(o.extras=n.extras),e[r]=o}return e}P(t){if(t.bufferView||t.extensions&&(t.extensions.KHR_binary_glTF||t.extensions.binary_glTF)){const e=t.bufferView?t:t.extensions.KHR_binary_glTF||t.extensions.binary_glTF;t.extensions&&(t.mimeType=e.mimeType,t.width=e.width,t.height=e.height);const r=this.gltf.bufferViews[e.bufferView],n=(r.byteOffset||0)+this.glbBuffer.byteOffset,A=r.byteLength,i=this.buffers[e.bufferView]=new Uint8Array(this.glbBuffer.buffer,n,A);return this.getImageByBuffer(i,t)}return this.requestExternalImage(t)}L(t){const e=this.gltf.textures[t];if(!e)return null;const r=this.gltf.images[e.source];return this.P(r).then((t=>{const n=this.gltf.samplers[e.sampler];return{image:{array:t.data,width:t.width,height:t.height,index:e.source,mimeType:r.mimeType,name:r.name,extras:r.extras},sampler:n}}))}getBaseColorTexture(t){const e=this.gltf.materials[t];let r,n;if(e.instanceTechnique&&e.instanceTechnique.values?(r=e.instanceTechnique,n=r.values.diffuse):(r=e,n=r.values.tex||r.values.diffuseTex||r.values.diffuse),void 0===n||void 0===this.gltf.textures)return null;const A=this.gltf.textures[n];if(!A)return null;const i=this.gltf.samplers[A.sampler];return{format:A.format||6408,internalFormat:A.internalFormat||6408,type:A.type||5121,sampler:i,source:this.gltf.images[A.source]}}getMaterial(){return null}getAnimations(){return null}}class et extends z{constructor(t,e,r,n,A,i){super(n,A,i),this.rootPath=t,this.gltf=e,this.glbBuffer=r,this.buffers={},this.requests={},this.accessor=new $(t,e,r)}iterate(t,e){const r=this.gltf[e];if(r)for(let e=0;e<r.length;e++)t(e,r[e],e)}createNode(t){const e={};return H(e,t),!w(t.weights)&&this.gltf.meshes&&w(e.mesh)?e.weights=this.gltf.meshes[e.mesh].weights:t.weights&&(e.weights=t.weights),e}L(t){const e=this.gltf.textures[t];if(!e)return null;const r=this.gltf.images[e.source];return this.P(r).then((t=>{if(!t)return null;const n={image:{array:t.data,mipmap:t.mipmap,width:t.width,height:t.height,index:e.source,mimeType:r.mimeType,name:r.name,extensions:r.extensions,extras:r.extras}};H(n,e);const A=w(e.sampler)?this.gltf.samplers[e.sampler]:void 0;return A&&(n.sampler=A),t.format&&(n.format=t.format),n}))}P(t){if(!w(t.bufferView))return this.requestExternalImage(t);{const e=this.gltf.bufferViews[t.bufferView],r=this.gltf.buffers[e.buffer];if(r.uri)return this.requestImageFromBufferURI(r,e,t);if(this.glbBuffer)return this.O(e,t)}return null}O(t,e){const r=this.B(t,this.glbBuffer.buffer,this.glbBuffer.byteOffset);return this.getImageByBuffer(r,e)}B(t,e,r){r=r||0;const n=t.byteOffset+r,A=t.byteLength;return new Uint8Array(e,n,A)}M(t,e){const r=new Array(t.byteLength);for(let e=0;e<t.byteLength;e++)r[e]=String.fromCharCode(t[e]);return r.join(""),"data:"+(e=e||"image/png")+";base64,"+function(t){return"undefined"!=typeof self?self.btoa(t):window.btoa(t)}(unescape(encodeURIComponent(r)))}getAnimations(t){const e=[];return t.forEach((t=>{e.push(this.getSamplers(t.samplers))})),Promise.all(e).then((e=>{for(let r=0;r<e.length;r++)t[r].samplers=e[r];return t}))}getSamplers(t){const e=[];for(let r=0;r<t.length;r++)(w(t[r].input)||w(t[r].output))&&(e.push(this.accessor._("input",t[r].input)),e.push(this.accessor._("output",t[r].output)));return Promise.all(e).then((e=>{for(let r=0;r<e.length/2;r++)t[r].input=e[2*r],t[r].output=e[2*r+1],t[r].interpolation||(t[r].interpolation="LINEAR");return t}))}}const rt="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;class nt{static read(t,e=0,r=0){r||(r=t.byteLength);const n=new DataView(t,e,r),A=n.getUint32(4,!0);if(1===A)return nt.readV1(n,e);if(2===A)return nt.readV2(t,e);throw new Error("Unsupported glb version : "+A)}static readV1(t,e){const r=t.getUint32(8,!0),n=t.getUint32(12,!0);if(r!==t.byteLength)throw new Error("Length in GLB header is inconsistent with glb's byte length.");const A=At(t.buffer,20+e,n);return{json:JSON.parse(A),glbBuffer:{byteOffset:20+e+n,buffer:t.buffer,byteLength:r}}}static readV2(t,e){let r,n,A;const i=new DataView(t,e+12);let o=0;for(;o<i.byteLength;){const s=i.getUint32(o,!0);o+=4;const a=i.getUint32(o,!0);if(o+=4,1313821514===a)r=At(t,e+12+o,s);else if(5130562===a){A=e+12+o,n=s;break}o+=s}return{json:JSON.parse(r),glbBuffer:{byteOffset:A,buffer:t,byteLength:n}}}}function At(t,e,r){if(rt){const n=new Uint8Array(t,e,r);return rt.decode(n)}return function(t){const e=t.length;let r="";for(let n=0;n<e;){let A=t[n++];if(128&A){let r=it[A>>3&7];if(!(64&A)||!r||n+r>e)return null;for(A&=63>>r;r>0;r-=1){const e=t[n++];if(128!=(192&e))return null;A=A<<6|63&e}}r+=String.fromCharCode(A)}return r}(new Uint8Array(t,e,r))}const it=[1,1,1,1,2,2,3,0],ot=[0,0,0],st=[0,0,0,1],at=[1,1,1],Bt={TRANSLATION:[0,0,0],ROTATION:[0,0,0,1],SCALE:[1,1,1]},Et={PREVIOUS:null,NEXT:null,PREINDEX:null,NEXTINDEX:null,INTERPOLATION:null},ct={N(t,e,r,n,A,i,o,s){const a=w(t)?e.animations:[e.animations[0]],B={};for(let e=0;e<a.length;e++){const E=a[e],c=E.name||e;if(w(t)&&c!==t)continue;const C=E.channelsMap[r];if(C)for(let t=0;t<C.length;t++){const e=C[t];"translation"===e.target.path?(this.S(A,E.samplers[e.sampler],n,1),B.translation=l(ot,A)):"rotation"===e.target.path?(this.U(i,E.samplers[e.sampler],n,1),B.rotation=m(st,i)):"scale"===e.target.path?(this.S(o,E.samplers[e.sampler],n,1),B.scale=l(at,o)):"weights"===e.target.path&&s&&(this.S(s,E.samplers[e.sampler],n,s.length),B.weights=s)}}return B},S(t,e,r,n){switch(e.interpolation){case"LINEAR":{const A=this.G(Et,e,r,1*n);A&&(t=function(t,e,r,n){for(let A=0;A<t.length;A++)t[A]=e[A]+n*(r[A]-e[A]);return t}(t,A.PREVIOUS,A.NEXT,A.INTERPOLATION));break}case"STEP":{const A=this.G(Et,e,r,1*n);A&&(t=function(t,e){for(let r=0;r<t.length;r++)t[r]=e[r];return t}(t,...A.PREVIOUS));break}case"CUBICSPLINE":{const A=this.G(Et,e,r,3*n);A&&(t=this.m(t,A,e.input.array,3*n));break}}return t},U(t,e,r){switch(e.interpolation){case"LINEAR":{const n=this.G(Et,e,r,1);n&&U(t,n.PREVIOUS,n.NEXT,n.INTERPOLATION);break}case"STEP":{const n=this.G(Et,e,r,1);n&&(t=N(t,...n.PREVIOUS));break}case"CUBICSPLINE":{const n=this.G(Et,e,r,3);if(n){for(let t=0;t<n.PREVIOUS.length;t++)n.PREVIOUS[t]=Math.acos(n.PREVIOUS[t]),n.NEXT[t]=Math.acos(n.NEXT[t]);t=this.m(t,n,e.input.array,3);for(let e=0;e<t.length;e++)t[e]=Math.cos(t[e])}break}}return t},p(t,e){const r=t.length;let n,A,i,o=0,s=r-1,a=Math.floor((o+s)/2);for(;o<=r-1&&s>=0;){if(o===s)return null;if(t[a]<=e&&e<=t[a+1]){const r=t[a];return n=a,A=a+1,i=(e-r)/(t[a+1]-r),{preIndx:n,nextIndex:A,interpolation:i}}e<t[a]?(s=a,a=Math.floor((o+s)/2)):t[a+1]<e&&(o=a,a=Math.floor((o+s)/2))}return null},G(t,e,r,n){const A=e.input.array,i=e.output.array,o=e.output.itemSize;(r<A[0]||r>A[A.length-1])&&(r=Math.max(A[0],Math.min(A[A.length-1],r))),r===A[A.length-1]&&(r=A[0]);const s=this.p(A,r);if(!s||!s.nextIndex)return null;const{preIndx:a,nextIndex:B,interpolation:E}=s;t.PREINDEX=a,t.NEXTINDEX=B,t.INTERPOLATION=E;const c=o*n;return t.PREVIOUS=i.subarray(t.PREINDEX*c,(t.PREINDEX+1)*c),t.NEXT=i.subarray(t.NEXTINDEX*c,(t.NEXTINDEX+1)*c),t},m(t,e,r,n){const A=e.INTERPOLATION,i=r[e.PREINDEX],o=r[e.NEXTINDEX];for(let r=0;r<3;r++){const s=e.PREVIOUS[n+r],a=(o-i)*e.PREVIOUS[2*n+r],B=e.NEXT[3+r],E=(o-i)*e.NEXT[r],c=(2*Math.pow(A,3)-3*Math.pow(A,2)+1)*s+(Math.pow(A,3)-2*Math.pow(A,2)+A)*a+(2*-Math.pow(A,3)+3*Math.pow(A,2))*B+(Math.pow(A,3)-Math.pow(A,2))*E;t[r]=c}return t},getAnimationClip(t,e,r,n){const A=t.nodes[e]&&t.nodes[e].weights;return u(ot,...Bt.TRANSLATION),N(st,...Bt.ROTATION),u(at,...Bt.SCALE),this.N(n,t,e,r,ot,st,at,A)},getTimeSpan(t){if(!t.animations)return null;if(t.timeSpan)return t.timeSpan;const e=t.animations;return t.timeSpan={},e.forEach(((e,r)=>{let n=-1/0,A=1/0;const i=e.channels;for(let t=0;t<i.length;t++){const r=i[t],o=e.samplers[r.sampler].input.array;o[o.length-1]>n&&(n=o[o.length-1]),o[0]<A&&(A=o[0])}const o=e.name||r;t.timeSpan[o]={max:n,min:A}})),t.timeSpan},getTimeSpanByName(t,e){const r=this.getTimeSpan(t);return r?w(e)?r[e]:r[Object.keys(r)[0]]:null}};let Ct=!1;if("undefined"!=typeof OffscreenCanvas){let t;try{t=new OffscreenCanvas(2,2).getContext("2d")}catch(Te){}t&&"undefined"!=typeof createImageBitmap&&(Ct=!0)}const ft="undefined"==typeof document?null:document.createElement("canvas");class lt{constructor(t,e,r){if(this.options=r||{},this.options.decoders||(this.options.decoders={}),e.buffer instanceof ArrayBuffer){const{json:r,glbBuffer:n}=nt.read(e.buffer,e.byteOffset,e.byteLength);this.H(t,r,n)}else this.H(t,e);this.K=new $(this.rootPath,this.gltf,this.glbBuffer),this.V()}V(){const t=this.gltf.extensionsRequired;if(t){if(t.indexOf("KHR_draco_mesh_compression")>=0&&!this.options.decoders.draco)throw new Error("KHR_draco_mesh_compression is required but @maptalks/transcoders.draco is not loaded");if(t.indexOf("KHR_texture_basisu")>=0&&!this.options.decoders.ktx2)throw new Error("KHR_texture_basisu is required but @maptalks/transcoders.ktx2 is not loaded")}}X(){const t=this.gltf.extensions;return t&&t.KHR_techniques_webgl?this.K.requestKHRTechniquesWebgl(t.KHR_techniques_webgl).then((e=>(t.KHR_techniques_webgl=e,t))):Promise.resolve(t)}load(t){t=t||{};const e=this.J(t),r=this.v(),n=this.Z(),A=this.X();return Promise.all([e,r,n,A]).then((t=>(t[0].animations=t[1],t[0].textures=t[2],t[0].extensions=t[3],t[0].transferables=this.transferables||[],this.createChannelsMap(t[0]),t[0])))}createChannelsMap(t){const e=t.animations;if(e)for(let t=0;t<e.length;t++){const r=e[t];r.channelsMap={};for(let t=0;t<r.channels.length;t++){const e=r.channels[t];r.channelsMap[e.target.node]||(r.channelsMap[e.target.node]=[]),r.channelsMap[e.target.node].push(e)}}}getExternalResources(){const t=[];if(this.gltf){const{buffers:e,images:r}=this.gltf;for(let r=0;r<e.length;r++)e[r].uri&&e[r].uri.indexOf("data:application/octet-stream;base64")<0&&t.push({type:"buffer",uri:e[r].uri});for(let e=0;e<r.length;e++)r[e].uri&&r[e].uri.indexOf("data:image/")<0&&t.push({type:"image",uri:r[e].uri})}return t}static getAnimationClip(t,e,r,n){return ct.getAnimationClip(t,e,r,n)}static getAnimationTimeSpan(t,e){return ct.getTimeSpanByName(t,e)}static getTypedArrayCtor(t){return K(t)}static readInterleavedArray(t,e,r,n,A,i,o){return W(t,e,r,n,A,i,o)}H(t,e,r){this.gltf=e,this.glbBuffer=r,this.version=e.asset?+e.asset.version:1,this.rootPath=t,this.buffers={},this.requests={},this.options.requestImage=Ct?Rt.bind(this):this.options.requestImage||ut,this.options.transferable&&(this.transferables=[]),2===this.version?(this.adapter=new et(t,e,r,this.options.requestImage,this.options.decoders||{},this.options.supportedFormats||{}),this.adapter.iterate(((t,e,r)=>{e.id="buffer_"+r}),"buffers"),this.adapter.iterate(((t,e,r)=>{e.id="image_"+r}),"images"),this.adapter.iterate(((t,e,r)=>{e.id="accessor_"+r}),"accessors")):(this.adapter=new tt(t,e,r,this.options.requestImage,this.options.decoders||{},this.options.supportedFormats||{}),this.adapter.iterate(((t,e,r)=>{e.id="accessor_"+r}),"accessors"),this.adapter.iterate(((t,e,r)=>{e.id="image_"+r}),"images"))}k(t,e){if(t.children&&t.children.length>0){if(!("number"==typeof(r=t.children[0])&&isFinite(r)||function(t){return!p(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}(t.children[0])))return t;const n=t.children.map((t=>{const r=e[t];return r.nodeIndex=t,this.k(r,e)}));t.children=n}var r;return t}J(t){return this.W(t).then((t=>{const e=this.scenes=[];let r;for(const e in t)t[e]=this.k(t[e],t),t[e].nodeIndex=Number(e)?Number(e):e;this.adapter.iterate(((n,A,i)=>{const o={};A.name&&(o.name=A.name),A.nodes&&(o.nodes=A.nodes.map((e=>t[e]))),this.gltf.scene===n&&(r=i),e.push(o)}),"scenes");const n={asset:this.gltf.asset,scene:r,scenes:e,nodes:t,meshes:this.meshes,materials:this.gltf.materials,skins:this.skins};if(this.gltf.extensions&&(n.extensions=this.gltf.extensions),1===this.version){const t=this.adapter.F(this.gltf.materials);n.materials=t}return n}))}W(t){return this.j(t).then((()=>{const t=this.nodes={};return this.adapter.iterate(((e,r)=>{const n=this.adapter.createNode(r,this.meshes,this.skins);t[e]=n}),"nodes"),t}))}Y(){this.skins=[];const t=[];return this.adapter.iterate(((e,r,n)=>{t.push(this.q(r).then((t=>{t.index=n,this.skins.push(t)})))}),"skins"),t}q(t){const e=t.inverseBindMatrices;return this.adapter.accessor._("inverseBindMatrices",e).then((e=>(t.inverseBindMatrices=e,e&&e.buffer&&this.transferables&&this.transferables.indexOf(e.buffer)<0&&this.transferables.push(e.buffer),t)))}v(){const t=this.gltf.animations;return w(t)?this.adapter.getAnimations(t):null}j(t){this.meshes={};let e=[];return this.adapter.iterate(((r,n,A)=>{e.push(this.$(n,t).then((t=>{t.index=A,this.meshes[r]=t})))}),"meshes"),e=e.concat(this.Y()),Promise.all(e)}$(t,e){const r=t.primitives.map((t=>this.tt(t,e))).filter((t=>!!t));return Promise.all(r).then((e=>{const r={};return H(r,t),r.primitives=e,r}))}Z(){const t=this.gltf.textures;if(!t)return null;const e=[];for(const r in t)e.push(this.adapter.L(r));return Promise.all(e).then((e=>{if(this.transferables)for(let t=0;t<e.length;t++){const r=e[t].image.array;if(e[t]&&r){let t;t=r instanceof ImageBitmap?r:r.buffer,t&&this.transferables.indexOf(t)<0&&this.transferables.push(t)}}if(!Array.isArray(t)){const r={},n=Object.keys(t);for(let t=0;t<e.length;t++)e[t]&&(r[n[t]]=e[t]);return r}return e}))}tt(t,e){let r;const n=[],A=t.extensions;if(w(t.targets))for(let e=0;e<t.targets.length;e++){const r=t.targets[e];for(const t in r){const A=this.adapter.accessor._(\`morphTargets_${o}t}_${o}e}\`,r[t]);A&&n.push(A)}}if(A&&A.KHR_draco_mesh_compression){if(!this.options.decoders.draco&&(!this.gltf.extensionsRequired||!this.gltf.extensionsRequired.indexOf("KHR_draco_mesh_compression")<0))return null;const t=this.options.decoders.draco,{bufferView:i,attributes:o}=A.KHR_draco_mesh_compression,s=this.gltf.bufferViews[i],a=this.K.I(s).then((r=>{const{buffer:n,byteOffset:A}=r;let{byteOffset:i,byteLength:a}=s;i||(i=0);const B=new DataView(n,A+i,a),E={attributes:o,useUniqueIDs:!1,skipAttributeTransform:e.skipAttributeTransform};return t(B,E).then((t=>{const e=Object.values(t.attributes);return t.indices&&e.push(t.indices),e}))}));n.push(a),r=Promise.all(n)}else{const e=t.attributes;for(const t in e){const r=this.adapter.accessor._(t,e[t]);r&&n.push(r)}if(w(t.indices)){const e=this.adapter.accessor._("indices",t.indices);e&&n.push(e)}r=Promise.all(n)}return r.then((e=>{if(A&&A.KHR_draco_mesh_compression){const r=t.targets?t.targets.length:0;e[r]=e[r].concat(e.slice(0,r)),e=e[r]}let r,n;const i={attributes:e.reduce(((t,e)=>{if("indices"===e.name)r=e;else if(e.name.indexOf("morphTargets_")>-1)n=n||{},n[e.name.slice(13)]=e;else{if(!("POSITION"!==e.name||e.min&&e.max)){const t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0],{itemSize:n,array:A}=e,i=A.length/n;for(let e=0;e<i;e++)for(let i=0;i<n;i++){const o=e*n+i;A[o]<t[i]&&(t[i]=A[o]),A[o]>r[i]&&(r[i]=A[o])}if(e.quantization){const n=e.quantization,A=n.range/(1<<n.quantizationBits),i=n.minValues;I(t,t,A),_(t,t,i),I(r,r,A),_(r,r,i)}e.min=t,e.max=r}t[e.name]=e}return this.transferables&&e.array.buffer&&this.transferables.indexOf(e.array.buffer)<0&&this.transferables.push(e.array.buffer),t}),{}),material:t.material};return r&&(i.indices=r),n&&(i.morphTargets=n),i.mode=w(t.mode)?t.mode:4,w(t.extras)&&(i.extras=t.extras),i}))}}function ut(t,e){const r=new Image;r.crossOrigin="",r.onload=()=>{if(!ft)return void e(new Error("There is no canvas to draw image!"));ft.width=r.width,ft.height=r.height;const t=ft.getContext("2d",{willReadFrequently:!0});t.drawImage(r,0,0,r.width,r.height);const n=t.getImageData(0,0,r.width,r.height),A={width:r.width,height:r.height,data:new Uint8Array(n.data)};e(null,A)},r.onerror=function(t){e(t)},r.src=t}let _t,Dt;function Rt(t,e){_t||(_t=new OffscreenCanvas(2,2),Dt=_t.getContext("2d",{willReadFrequently:!0})),fetch(t).then((t=>t.arrayBuffer())).then((t=>{const e=new Blob([new Uint8Array(t)]);return createImageBitmap(e)})).then((t=>{let{width:r,height:n}=t;It(r)||(r=Tt(r)),It(n)||(n=Tt(n));const A=this.options.maxTextureSize;A&&(r=Math.min(A,r),n=Math.min(A,n)),_t.width=r,_t.height=n,Dt.drawImage(t,0,0,r,n),t.close();const i=Dt.getImageData(0,0,r,n);e(null,{width:r,height:n,data:new Uint8Array(i.data)})})).catch((t=>{console.warn(t),e(t)}))}function It(t){return 0==(t&t-1)&&0!==t}function Tt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function ht(t){return"object"==typeof t&&!!t}function Ft(t){return t*Math.PI/180}function Pt(t){return t/Math.PI*180}function Lt(t){return Math.sign?Math.sign(t):0===(t=+t)||isNaN(t)?Number(t):t>0?1:-1}const Ot=[1,1,1,1,2,2,3,0];function yt(t){const e=t.length;let r="";for(let n=0;n<e;){let A=t[n++];if(128&A){let r=Ot[A>>3&7];if(!(64&A)||!r||n+r>e)return null;for(A&=63>>r;r>0;r-=1){const e=t[n++];if(128!=(192&e))return null;A=A<<6|63&e}}r+=String.fromCharCode(A)}return r}const Mt=new Array(3),Nt=new Array(3),St=[40680631590769,40680631590769,40408299984661.445];const dt=[1/6378137,1/6378137,1/6356752.314245179],Ut=[1/40680631590769,1/40680631590769,1/40408299984661.445],Gt=new Array(3),mt=new Array(3),bt=new Array(3);function pt(t,e){const r=Ut,n=function(t,e,r,n,A){const i=e[0],o=e[1],s=e[2],a=r[0],B=r[1],E=r[2],c=i*i*a*a,C=o*o*B*B,f=s*s*E*E,l=c+C+f,u=Math.sqrt(1/l),_=I(wt,e,u);if(l<A)return isFinite(u)?_:void 0;const D=n[0],R=n[1],T=n[2],h=Ht;h[0]=_[0]*D*2,h[1]=_[1]*R*2,h[2]=_[2]*T*2;let F,P,L,O,y,M,N,S,d,U,G,m=(1-u)*gt(e)/(.5*gt(h)),b=0;do{m-=b,L=1/(1+m*D),O=1/(1+m*R),y=1/(1+m*T),M=L*L,N=O*O,S=y*y,d=M*L,U=N*O,G=S*y,F=c*M+C*N+f*S-1,P=c*d*D+C*U*R+f*G*T;b=F/(-2*P)}while(Math.abs(F)>Kt);return t[0]=i*L,t[1]=o*O,t[2]=s*y,t}(Gt,e,dt,r,.1);let A=y(mt,n,r);A=Vt(A,A);const i=O(bt,e,n),o=Math.atan2(A[1],A[0]),s=Math.asin(A[2]),a=Lt(F(i,e))*gt(i);return t[0]=Pt(o),t[1]=Pt(s),t[2]=a,t}const wt=new Array(3),Ht=new Array(3),Kt=1e-12;function gt(t){return C(t)}function Vt(t,e){const r=e[0],n=e[1],A=e[2];let i=r*r+n*n+A*A;return i>0&&(i=Math.sqrt(i),t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i),t}const Xt=1e-14;function Jt(t,e,r,n){r=r||0,n=n||r;var A=Math.abs(t-e);return A<=n||A<=r*Math.max(Math.abs(t),Math.abs(e))}function vt(t,e){let r="";for(let n=0;n<4;n++){const A=t.getUint8(e+n);r+=String.fromCharCode(A)}return r}const Zt="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;function xt(t,e,r){const n=new Uint8Array(t,e,r);return Zt?JSON.parse(Zt.decode(n)):JSON.parse(yt(n))}function kt(t,e,r){const n=new Uint8Array(t,e,r);return Zt?JSON.parse(Zt.decode(n)):JSON.parse(yt(n))}function Wt(t,e,r){return{offset:e,byteLength:r}}function Qt(t,e,r,n){const{byteOffset:A,componentType:i,type:o}=t,{ctor:s,type:a}=function(t){return zt[t]}(i||"UNSIGNED_SHORT"),B=function(t){if(!t)return 1;return Yt[t]}(o);return{byteStride:0,byteOffset:A+r,itemSize:B,count:n*B,componentType:a,array:new s(e,r+A,n*B)}}function jt(t,e,r,n){const A=Qt(t,e,r,n);return A.array.buffer.byteLength!==e.byteLength&&(A.array=A.array.slice()),A}const Yt={"SCALAR":1,"VEC2":2,"VEC3":3,"VEC4":4};const zt={"BYTE":{ctor:Int8Array,type:5120,name:"Int8Array"},"UNSIGNED_BYTE":{ctor:Uint8Array,type:5121,name:"Uint8Array"},"SHORT":{ctor:Int16Array,type:5122,name:"Int16Array"},"UNSIGNED_SHORT":{ctor:Uint16Array,type:5123,name:"Uint16Array"},"INT":{ctor:Int32Array,type:5124,name:"Int32Array"},"UNSIGNED_INT":{ctor:Uint32Array,type:5125,name:"Uint32Array"},"FLOAT":{ctor:Float32Array,type:5126,name:"Float32Array"},"DOUBLE":{ctor:Float64Array,type:5126,name:"Float64Array"}};function qt(t){for(let e in zt)if(t===zt[e].ctor)return zt[e].type;throw new Error("unrecognized ctor:"+t)}function $t(t,e,r,n){const A=t,i=e.length/3;for(let t=0;t<i;t++)A[3*t]=e[3*t]/65535*n[0]+r[0],A[3*t+1]=e[3*t+1]/65535*n[1]+r[1],A[3*t+2]=e[3*t+2]/65535*n[2]+r[2];return A}function te(t,e,r){let n=t.getUint32(12,!0),A=t.getUint32(16,!0),i=t.getUint32(20,!0),o=t.getUint32(24,!0);const s=t.buffer;let a,B,E={},c={};n>0&&(E=xt(s,e,n),e+=n),A>0&&(a=function(t,e,r){return{offset:e,byteLength:r}}(0,e,A),e+=A),i>0&&(c=kt(s,e,i),e+=i);const C=Wt(0,e,o);return B=s.slice(C.offset,C.offset+C.byteLength),r.push(B),{featureTable:E,featureTableBin:a,batchTable:c,batchTableBin:B}}var ee={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},re={},ne={east:[],north:[],up:[],west:[],south:[],down:[]},Ae=[],ie=[],oe=[];const se=[0,0,0];const ae=(Ce={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}}[Be="east"][Ee="north"],re[fe=Be+Ee]?ce=re[fe]:(ce=function(t,r,n){if(function(t,r){var n=t[0],A=t[1],i=t[2],o=r[0],s=r[1],a=r[2];return Math.abs(n-o)<=e*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(A-s)<=e*Math.max(1,Math.abs(A),Math.abs(s))&&Math.abs(i-a)<=e*Math.max(1,Math.abs(i),Math.abs(a))}(t,se))l(Ae,ee[Be]),l(ie,ee[Ee]),l(oe,ee[Ce]);else if(Jt(t[0],0,Xt)&&Jt(t[1],0,Xt)){var A=Lt(t[2]);l(Ae,ee[Be]),"east"!==Be&&"west"!==Be&&I(Ae,Ae,A),l(ie,ee[Ee]),"east"!==Ee&&"west"!==Ee&&I(ie,ie,A),l(oe,ee[Ce]),"east"!==Ce&&"west"!==Ce&&I(oe,oe,A)}else{!function(t,e){R(e,t,Ut),h(e,e)}(t,ne.up);var i=ne.up,o=ne.east;o[0]=-t[1],o[1]=t[0],o[2]=0,h(ne.east,o),P(ne.north,i,o),I(ne.down,ne.up,-1),I(ne.west,ne.east,-1),I(ne.south,ne.north,-1),Ae=ne[Be],ie=ne[Ee],oe=ne[Ce]}return n[0]=Ae[0],n[1]=Ae[1],n[2]=Ae[2],n[3]=0,n[4]=ie[0],n[5]=ie[1],n[6]=ie[2],n[7]=0,n[8]=oe[0],n[9]=oe[1],n[10]=oe[2],n[11]=0,n[12]=t[0],n[13]=t[1],n[14]=t[2],n[15]=1,n},re[fe]=ce),ce);var Be,Ee,ce,Ce,fe;const le={5120:Int8Array,5122:Int16Array,5124:Int32Array,5121:Uint8Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function ue(t){return le[t]}function _e(t){for(let e in le)if(t===le[e])return+e;throw new Error("unrecognized ctor:"+t)}function De(t){return 1===t?"FLOAT":"VEC"+t}\n/*!\n * @maptalks/gl v0.81.2\n * LICENSE : UNLICENSED\n * (c) 2016-2023 maptalks.com\n */const Re=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof undefined)return global;throw new Error("unable to locate global object")},Ie=Re(),Te=Ie.gl_trans__coders=Ie.gl_trans__coders||{};Te.inject=function(t){const e=t.toString(),r=e.indexOf("{")+1,n=e.substring(0,r),A=Ie.gl_trans__coders=Ie.gl_trans__coders||{};let i=\`${o}n}\\n const _____getGlobal = ${o}Re.toString()};\\n const g___lobals = _____getGlobal()\\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};\`;for(const t in A)"inject"!==t&&"getTranscoder"!==t&&"registerTranscoder"!==t&&(i+='tran_____scoders["'+t+'"] ='+A[t].toString()+"\\n;");return i+="\\n"+e.substring(n.length),i},Te.registerTranscoder=function(t,e){Te[t]=e},Te.getTranscoder=function(t){return Te[t]};let he=null;function Fe(){return he||(he={"image/crn":Te.crn&&Te.crn(),"image/ktx2":Te.ktx2&&Te.ktx2(),"image/cttf":Te.ktx2&&Te.ktx2(),"draco":Te.draco&&Te.draco()}),he}class Pe{constructor(t,e,r){this.A=t,this.et=e||lt,this.i=r,this.rt=Fe()}static createEmptyB3DM(){return{featureTable:null,batchTable:null,gltf:{}}}load(t,e,r=0,n=0,A){return e?(n||(n=e.byteLength),this.nt(t,e,r,n,A)):Y.getArrayBuffer(t,{}).then((e=>{const A=e.data;return n||(n=A.byteLength),this.nt(t,A,r,n)}))}nt(t,e,r,n,A){const i=A&&A.maxTextureSize,o=this.At(e,r,n,t);if(o.error)return Promise.resolve(o);const s=t.substring(0,t.lastIndexOf("/")),a=new this.et(s,o.glb,{transferable:!0,requestImage:this.A,decoders:this.rt,supportedFormats:this.i,maxTextureSize:i});return a.load({skipAttributeTransform:!1}).then((e=>{e.url=\`${o}t}-${o}r}-${o}n}\`;const A=a.transferables;for(let t=0;t<o.transferables.length;t++)A.indexOf(o.transferables[t])<0&&A.push(o.transferables[t]);return{magic:"b3dm",count:o.count,transferables:A,featureTable:o.featureTable,batchTable:o.batchTable,batchTableBin:o.batchTableBin,gltf:e}}))}At(t,e,r,n){const A=new DataView(t,e,r),i=A.getUint32(4,!0);if(1!==i){const t="Unsupported b3dm version: "+i+", url:"+n;return console.warn(t),{error:t}}if(A.getUint32(8,!0)!==A.byteLength){const t="Length in b3dm header is inconsistent with b3dm's byte length, url: "+n;return console.warn(t),{error:t}}let o,s=A.getUint32(12,!0),a=A.getUint32(16,!0),B=A.getUint32(20,!0),E=A.getUint32(24,!0),c=28+e;B>=570425344?(c-=8,o=s,B=a,E=0,s=0,a=0):E>=570425344&&(c-=4,o=B,B=s,E=a,s=0,a=0);const C=[t];let f,l,u;if(s>0?(f=xt(t,c,s),c+=s,o=f.BATCH_LENGTH):f={"BATCH_LENGTH":o},a>0&&(c+=a),B>0&&(l=kt(t,c,B),c+=B,E>0)){const e=Wt(0,c,E);u=t.slice(e.offset,e.offset+e.byteLength),c+=E,C.push(u)}const _=f.BATCH_LENGTH,D={};if(f&&f.BATCH_ID){D.BATCH_ID=jt(f.BATCH_ID,t,undefined.offset,_);const e=D.BATCH_ID.array&&D.BATCH_ID.array.buffer;e&&C.indexOf(e)<0&&C.push(e)}return{count:o,transferables:C,featureTable:f,batchTable:l,batchTableBin:u,b3dm:D,glb:{buffer:t,byteOffset:c,byteLength:A.byteLength+A.byteOffset-c}}}it(){return null}}class Le{constructor(t,e,r,n){this.A=t,this.et=e||lt,this.i=r,this.rt=Fe(),this.ot=n}load(t,e,r=0,n=0,A){return e?(n||(n=e.byteLength),this.nt(t,e,r,n,A)):Y.getArrayBuffer(t,{}).then((e=>{const A=e.data;return n||(n=A.byteLength),this.nt(t,A,r,n)}))}nt(t,e,r,n,A){return this.st(t,e,r,n,A).then((({gltf:A,transferables:i})=>{const o=this.Bt(e,r,n,t);if(o.error)return Promise.resolve(o);for(let t=0;t<i.length;t++)-1===o.transferables.indexOf(i[t])&&o.transferables.push(i[t]);return delete A.transferables,Promise.resolve({magic:"i3dm",count:o.count,transferables:o.transferables,featureTable:o.featureTable,batchTable:o.batchTable,batchTableBin:o.batchTableBin,i3dm:o.i3dm,gltf:A})}))}st(t,e,r,n,A){const i=A&&A.maxTextureSize,o={transferable:!0,requestImage:this.A,decoders:this.rt,supportedFormats:this.i,maxTextureSize:i},s=new DataView(e,r,n),a=32+s.getUint32(12,!0)+s.getUint32(16,!0)+s.getUint32(20,!0)+s.getUint32(24,!0);if(0===s.getUint32(28,!0)){let n=yt(new Uint8Array(e,a+r,s.byteLength-a));-1==n.indexOf("://")&&(n=t.substring(0,t.lastIndexOf("/"))+"/"+n);return n.indexOf(".glb")>0?Y.getArrayBuffer(n,{}).then((t=>this.Et(n,{buffer:t.data,byteOffset:0},o))):Y.getJSON(n,{}).then((t=>this.Et(n,t,o)))}{const n={buffer:e,byteOffset:a+r,byteLength:s.byteLength-a};return this.Et(t,n,o)}}Et(t,e,r){const n=t.substring(0,t.lastIndexOf("/")),A=new this.et(n,e,r);return A.load({skipAttributeTransform:!0}).then((r=>{let n=0,i=0;return e.buffer&&(n=e.byteOffset||0,i=e.byteLength||0),r.url=\`${o}t}-${o}n}-${o}i}\`,{transferables:A.transferables,gltf:r}}))}Bt(t,e,r,n){const A=new DataView(t,e,r),i=A.getUint32(4,!0);if(1!==i){const t="Unsupported pnts version: "+i+", url:"+n;return console.warn(t),{error:t}}if(A.getUint32(8,!0)!==A.byteLength){const t="Length in pnts header is inconsistent with pnts's byte length, url: "+n;return console.warn(t),{error:t}}const o=[t],{featureTable:s,featureTableBin:a,batchTable:B,batchTableBin:E}=te(A,32+e,o),c={},C=s.INSTANCES_LENGTH;if(s.POSITION){const{byteOffset:e}=s.POSITION;c.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:new Float32Array(t,e+a.offset,3*C).slice()},o.push(c.POSITION.array.buffer)}else if(s.POSITION_QUANTIZED){const e=s.QUANTIZED_VOLUME_OFFSET,r=s.QUANTIZED_VOLUME_SCALE,{byteOffset:n}=s.POSITION_QUANTIZED;c.POSITION={byteStride:12,byteOffset:0,itemSize:3,count:C,componentType:5126,array:this.ct(new Uint16Array(t,n+a.offset,3*C),e,r)},o.push(c.POSITION.array.buffer)}if(s.BATCH_ID){c.BATCH_ID=jt(s.BATCH_ID,t,a.offset,C);const e=c.BATCH_ID.array&&c.BATCH_ID.array.buffer;e&&o.indexOf(e)<0&&o.push(e)}if(s.NORMAL_UP){let{byteOffset:e}=s.NORMAL_UP;c.NORMAL_UP={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:new Float32Array(t,e+a.offset,3*C).slice()},o.push(c.NORMAL_UP.array.buffer),e=s.NORMAL_RIGHT.byteOffset,c.NORMAL_RIGHT={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:new Float32Array(t,e+a.offset,3*C).slice()},o.push(c.NORMAL_RIGHT.array.buffer)}else if(s.NORMAL_UP_OCT32P){let{byteOffset:e}=s.NORMAL_UP_OCT32P;c.NORMAL_UP={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:this.Ct(new Uint16Array(t,e+a.offset,2*C))},o.push(c.NORMAL_UP.array.buffer),e=s.NORMAL_RIGHT_OCT32P.byteOffset,c.NORMAL_RIGHT={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:this.Ct(new Uint16Array(t,e+a.offset,2*C))},o.push(c.NORMAL_RIGHT.array.buffer)}if(s.SCALE){const{byteOffset:e}=s.SCALE;c.SCALE={byteStride:0,byteOffset:0,itemSize:1,count:C,componentType:5126,array:new Float32Array(t,e+a.offset,C).slice()},o.push(c.SCALE.array.buffer)}else if(s.SCALE_NON_UNIFORM){const{byteOffset:e}=s.SCALE_NON_UNIFORM;c.SCALE_NON_UNIFORM={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:new Float32Array(t,e+a.offset,3*C).slice()},o.push(c.SCALE_NON_UNIFORM.array.buffer)}return{count:C,batchTable:B,batchTableBin:E,featureTable:s,i3dm:c,transferables:o}}Ct(t){const e=t.length/2,r=new Float32Array(3*e),n=[];for(let A=0;A<e;A++)Oe(n,t[2*A],t[2*A+1],65535),r[3*A]=n[0],r[3*A+1]=n[1],r[3*A+2]=n[2];return r}ct(t,e,r){return $t(new Float32Array(t.length),t,e,r)}it(){return null}}function Oe(t,e,r,n){if(t[0]=ye(e,n),t[1]=ye(r,n),t[2]=1-(Math.abs(t[0])+Math.abs(t[1])),t[2]<0){const e=t[0];t[0]=(1-Math.abs(t[1]))*Me(e),t[1]=(1-Math.abs(e))*Me(t[1])}return h(t,t)}function ye(t,e){return e=function(t,e){if(null!=t)return t;return e}(e,255),function(t,e,r){return t<e?e:t>r?r:t}(t,0,e)/e*2-1}function Me(t){return t<0?-1:1}class Ne{constructor(){}load(t,e,r=0,n=0){return e?(n||(n=e.byteLength),this.nt(t,e,r,n)):Y.getArrayBuffer(t,{}).then((e=>{const A=e.data;return n||(n=A.byteLength),this.nt(t,A,r,n)}))}nt(t,e,r,n){return this.ft(e,r,n,t).then((t=>t.error?t:{magic:"pnts",count:t.count,transferables:t.transferables,featureTable:t.featureTable,batchTable:t.batchTable,batchTableBin:t.batchTableBin,pnts:t.pnts}))}ft(t,e,r,n){const A=new DataView(t,e,r),i=A.getUint32(4,!0);if(1!==i){const t="Unsupported pnts version: "+i+", url:"+n;return console.warn(t),{error:t}}if(A.getUint32(8,!0)!==A.byteLength){const t="Length in pnts header is inconsistent with pnts's byte length, url: "+n;return console.warn(t),{error:t}}const o=[t],{featureTable:s,featureTableBin:a,batchTable:B,batchTableBin:E}=te(A,e+28,o),c=s.QUANTIZED_VOLUME_OFFSET,C=s.QUANTIZED_VOLUME_SCALE,f=s.POINTS_LENGTH;let l,u={};if(s.extensions&&s.extensions["3DTILES_draco_point_compression"]){u=s.extensions["3DTILES_draco_point_compression"],l=new DataView(t,u.byteOffset+a.offset,u.byteLength);const e={attributes:u.properties,useUniqueIDs:!1};return this.lt||(this.lt=Fe().draco),this.lt(l,e).then((e=>{const r=e.attributes;!s.POSITION&&!s.POSITION_QUANTIZED||r.POSITION||r.POSITION_QUANTIZED||(r.POSITION=s.POSITION,r.POSITION_QUANTIZED=s.POSITION_QUANTIZED),!(s.RGB||s.RGBA||s.RGB565)||r.RGB||r.RGBA||r.RGB565||(r.RGB=s.RGB,r.RGBA=s.RGBA,r.RGB565=s.RGB565),!s.NORMAL&&!s.NORMAL_OCT16P||r.NORMAL||r.NORMAL_OCT16P||(r.NORMAL=s.NORMAL,r.NORMAL_OCT16P=s.NORMAL_OCT16P);const n=this.ut(t,e.attributes,a.offset,f,o,c,C);if(e.attributes.BATCH_ID){const t=e.attributes.BATCH_ID.array;n.BATCH_ID={byteStride:0,byteOffset:0,itemSize:1,count:t.length,componentType:qt(t.constructor),array:t},o.push(t.buffer)}else if(s.BATCH_ID||Object.keys(B).length){s.BATCH_ID?n.BATCH_ID=jt(s.BATCH_ID,t,a.offset,f):n.BATCH_ID=Se(f);const e=n.BATCH_ID.array&&n.BATCH_ID.array.buffer;e&&o.indexOf(e)<0&&o.push(e)}return{count:f,batchTable:B,batchTableBin:E,featureTable:s,pnts:n,transferables:o}}))}const _=this.ut(t,s,a.offset,f,o,c,C);if(s.BATCH_ID||Object.keys(B).length){s.BATCH_ID?_.BATCH_ID=jt(s.BATCH_ID,t,a.offset,f):_.BATCH_ID=Se(f);const e=_.BATCH_ID.array&&_.BATCH_ID.array.buffer;e&&o.indexOf(e)<0&&o.push(e)}return Promise.resolve({count:f,batchTable:B,batchTableBin:E,featureTable:s,pnts:_,transferables:o})}ut(t,e,r,n,A,i,o){const s={};if(e.POSITION){let{byteOffset:i,array:o}=e.POSITION;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+3*n*4);o=new Float32Array(e)}s.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5126,array:o},A.push(o.buffer)}else if(e.POSITION_QUANTIZED){let{byteOffset:a,array:B}=e.POSITION_QUANTIZED;a=a||0;const E=B?0:r;s.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5126,array:this.ct(B||new Uint16Array(t,a+E,3*n),i,o)},A.push(s.POSITION.array.buffer)}if(e.RGBA){let{byteOffset:i,array:o}=e.RGBA;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+4*n);o=new Uint8Array(e)}s.RGBA={byteStride:0,byteOffset:0,itemSize:4,count:n,componentType:5121,array:o},A.push(o.buffer)}else if(e.RGB){let{byteOffset:i,array:o}=e.RGB;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+3*n);o=new Uint8Array(e)}s.RGB={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5121,array:o},A.push(o.buffer)}else if(e.RGB565){let{byteOffset:i,array:o}=e.RGB565;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+2*n);o=new Uint16Array(e)}s.RGB565={byteStride:0,byteOffset:0,itemSize:1,count:n,componentType:5123,array:o},A.push(o.buffer)}if(e.NORMAL){let{byteOffset:i,array:o}=e.NORMAL;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+3*n*4);o=new Float32Array(e)}s.NORMAL={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5126,array:o},A.push(o.buffer)}else if(e.NORMAL_OCT16P){let{byteOffset:i,array:o}=e.NORMAL_OCT16P;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+2*n);o=new Uint8Array(e)}s.NORMAL_OCT16P={byteStride:0,byteOffset:0,itemSize:2,count:n,componentType:5121,array:o},A.push(o.buffer)}return s}ct(t,e,r){return $t(new Float32Array(t.length),t,e,r)}it(){return null}}function Se(t){const e=(r=t)<256?Uint8Array:r<65536?Uint16Array:Uint32Array;var r;const n=new e(t);for(let e=0;e<t;e++)n[e]=e;return{byteStride:0,byteOffset:0,itemSize:1,count:t,componentType:qt(e),array:n}}class de{constructor(t,e,r,n){this.i=r,this.A=t,this.et=e||lt,this.ot=n}load(t,e,r=0,n=0,A){return e?this.nt(t,e,r,n,A):Y.getArrayBuffer(t,{}).then((e=>{const A=e.data;return this.nt(t,A,r,n)}))}nt(t,e,r,n,A){n||(n=e.byteLength);const i=this._t(e,t,r,n),o=[];for(let r=0;r<i.length;r++){let n;if("b3dm"===i[r].magic)n=new Pe(this.A,this.et,this.i);else if("i3dm"===i[r].magic)n=new Le(this.A,this.et,this.i,this.ot);else if("pnts"===i[r].magic)n=new Ne;else{if("cmpt"!==i[r].magic){console.warn("Unsupported magic in CMPT tile:",i[r].magic);continue}n=new de(this.A,this.et,this.i,this.ot)}o.push(n.load(t,e,i[r].offset,i[r].byteLength,A).then((t=>t)))}return Promise.all(o).then((t=>({magic:"cmpt",tiles:t})))}_t(t,e,r,n){const A=new DataView(t,r,n),i=A.getUint32(4,!0);if(1!==i){const t="Unsupported cmpt version: "+i+", url:"+e;return console.warn(t),{error:t}}if(16===A.byteLength)return[];const o=[],s=A.getUint32(12,!0);let a=16;for(let e=0;e<s;e++){const e=vt(A,a),n=A.getUint32(a+8,!0);o.push({magic:e,buffer:t,offset:a+r,byteLength:n}),a+=n}return o}}function Ue(t,e){if(t.scenes&&t.scenes.length)for(let r=0,n=t.scenes.length;r<n;r++){const n=t.scenes[r].nodes;for(let r=0,A=n.length;r<A;r++){const A=[];Ke(n[r],A,t,e)}}}const Ge=[],me=[],be=[],pe=[0,0,0],we=d([]),He=[1,1,1];function Ke(t,e,r,n){const A=e.slice(0);if(t.matrix)A.push(t.matrix);else if(t.rotation||t.translation||t.scale){const e=s(Ge,t.translation||pe),r=B(me,t.rotation||we),n=a(be,t.scale||He);o(n,r,n);const i=o([],e,n);A.push(i)}if(t.children&&t.children.length)for(let e=0,i=t.children.length;e<i;e++)Ke(t.children[e],A,r,n);if(void 0!==t.mesh){const e=t.mesh,i=r.meshes[e];if(i){const t=A.slice(0),o=i.primitives;for(let A=0,i=o.length;A<i;A++){const i=o[A];i&&(i.matrices=t,n(i,e,A,r))}}}}function ge(t,e){let{componentType:r,byteOffset:n,byteStride:A,count:i,itemSize:o}=t;const s=t.array.buffer,a=r?lt.getTypedArrayCtor(r):t.array.constructor;if(n=void 0===n?t.array.byteOffset:n,A=A||0,i=i||t.array.length/o,(!A||A===o*a.BYTES_PER_ELEMENT)&&n%a.BYTES_PER_ELEMENT==0){const t=new a(s,n,i*o);for(let r=0;r<i*o;r+=o){e(new a(t.buffer,n+r*a.BYTES_PER_ELEMENT,o),r/o)}return}const B=new Uint8Array(o*a.BYTES_PER_ELEMENT);A||(A=o*a.BYTES_PER_ELEMENT);for(let t=0;t<i;t++){const r=new Uint8Array(s,A*t+n,o*a.BYTES_PER_ELEMENT);B.set(r);e(new a(B.buffer),t),r.set(B)}}const Ve=[],Xe=[];function Je(t){"3.0"===t.version&&(t=function(t){const e=JSON.parse(JSON.stringify(t)),r=e.rootTiles;for(let t=0;t<r.length;t++){const{boundingbox:e}=r[t],{center:n,xExtent:A,yExtent:i,zExtent:o}=e,s={x:2*n.x-A.x,y:2*n.y-i.y,z:2*n.z-o.z},a={x:A.x,y:i.y,z:o.z};e.min=s,e.max=a}return e.tiles=r,e}(t));const e={asset:{version:"1.0",gltfUpAxis:"Z",s3mType:t.dataType},extensions:t.extensions,geometricError:0,root:{boundingVolume:{},content:{uri:""},transform:[],geometricError:0,refine:"REPLACE",children:[]}},r=t.position.x,n=t.position.y,i=t.position.z,o=function(t,e,r,n){const A=St,i=Math.cos(r);Mt[0]=i*Math.cos(e),Mt[1]=i*Math.sin(e),Mt[2]=Math.sin(r),Vt(Mt,Mt),R(Nt,A,Mt);const o=Math.sqrt(F(Mt,Nt));var s,a,B;return a=Nt,B=o,(s=Nt)[0]=a[0]/B,s[1]=a[1]/B,s[2]=a[2]/B,I(Mt,Mt,n),_(t,Nt,Mt)}([],Ft(r),Ft(n),i),s=ae(o,null,[]);e.root.transform=A([],s);const a=[];for(let r=0,n=t.tiles.length;r<n;r++)if(t.tiles[r].boundingbox){const n=t.tiles[r].boundingbox;u(Ve,n.min.x,n.min.y,n.min.z),u(Xe,n.max.x,n.max.y,n.max.z);const A={center:[0,0,0],radius:0};ve(Ve,Xe,A),e.root.children.push({boundingVolume:{sphere:[...A.center,A.radius]},content:{uri:t.tiles[r].url},geometricError:70,refine:"REPLACE"}),a.push(A)}else if(t.tiles[r].boundingsphere){const{boundingsphere:n}=t.tiles[r],A={center:[n.center.x,n.center.y,n.center.z],radius:n.radius};e.root.children.push({boundingVolume:{sphere:[...A.center,A.radius]},content:{uri:t.tiles[r].url},geometricError:70,refine:"REPLACE"}),a.push(A)}const B=function(t,e){if(0===t.length)return e;const r=t.length;if(1===r)return function(t,e){return l(e.center,t.center),e.radius=t.radius,e}(t[0],e);if(2===r)return function(t,e,r){const n=t.center,A=t.radius,i=e.center,o=e.radius,s=D(xe,i,n),a=or(s);if(A>=a+o)return t.clone(r),r;if(o>=a+A)return e.clone(r),r;const B=.5*(A+a+o),E=I(ke,s,(-A+B)/a);return _(E,E,n),l(r.center,E),r.radius=B,r}(t[0],t[1],e);const n=[];for(let e=0;e<r;e++)n.push(t[e].center);const A=(e=function(t,e){if(0===t.length)return e.center=u(e.center,0,0,0),e.radius=0,e;const r=l($e,t[0]),n=l(We,r),A=l(Qe,r),i=l(je,r),o=l(Ye,r),s=l(ze,r),a=l(qe,r),B=t.length;for(let e=1;e<B;e++){l(r,t[e]);const B=r[0],E=r[1],c=r[2];B<n[0]&&l(n,r),B>o[0]&&l(o,r),E<A[1]&&l(A,r),E>s[1]&&l(s,r),c<i[2]&&l(i,r),c>a[2]&&l(a,r)}const E=ir(D(tr,o,n)),c=ir(D(tr,s,A)),C=ir(D(tr,a,i));let f=n,_=o,R=E;c>R&&(R=c,f=A,_=s);C>R&&(R=C,f=i,_=a);const I=er;I[0]=.5*(f[0]+_[0]),I[1]=.5*(f[1]+_[1]),I[2]=.5*(f[2]+_[2]);let T=ir(D(tr,_,I)),h=Math.sqrt(T);const F=rr;F[0]=n[0],F[1]=A[1],F[2]=i[2];const P=nr;P[0]=o[0],P[1]=s[1],P[2]=a[2];const L=Ze(F,P,Ar);let O=0;for(let e=0;e<B;e++){l(r,t[e]);const n=or(D(tr,r,L));n>O&&(O=n);const A=ir(D(tr,r,I));if(A>T){const t=Math.sqrt(A);h=.5*(h+t),T=h*h;const e=t-h;I[0]=(h*I[0]+e*r[0])/t,I[1]=(h*I[1]+e*r[1])/t,I[2]=(h*I[2]+e*r[2])/t}}h<O?(l(e.center,I),e.radius=h):(l(e.center,L),e.radius=O);return e}(n,e)).center;let i=e.radius;for(let e=0;e<r;e++){const r=t[e];i=Math.max(i,T(A,r.center)+r.radius)}return e.radius=i,e}(a,{center:[0,0,0],radius:0});return e.root.boundingVolume.sphere=[...B.center,B.radius],e}function ve(t,e,r){var n=Ze(t,e,r.center);return r.radius=T(n,e),r}function Ze(t,e,r){return r[0]=.5*(t[0]+e[0]),r[1]=.5*(t[1]+e[1]),r[2]=.5*(t[2]+e[2]),r}const xe=[],ke=[];const We=[],Qe=[],je=[],Ye=[],ze=[],qe=[],$e=[],tr=[],er=[],rr=[],nr=[],Ar=[];function ir(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function or(t){return Math.hypot(t[0],t[1],t[2])}\n/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function sr(t){let e=t.length;for(;--e>=0;)t[e]=0}const ar=256,Br=286,Er=30,cr=15,Cr=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]),fr=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]),lr=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ur=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_r=new Array(576);sr(_r);const Dr=new Array(60);sr(Dr);const Rr=new Array(512);sr(Rr);const Ir=new Array(256);sr(Ir);const Tr=new Array(29);sr(Tr);const hr=new Array(Er);function Fr(t,e,r,n,A){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=A,this.has_stree=t&&t.length}let Pr,Lr,Or;function yr(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}sr(hr);const Mr=t=>t<256?Rr[t]:Rr[256+(t>>>7)],Nr=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Sr=(t,e,r)=>{t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,Nr(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},dr=(t,e,r)=>{Sr(t,r[2*e],r[2*e+1])},Ur=(t,e)=>{let r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1},Gr=(t,e,r)=>{const n=new Array(16);let A,i,o=0;for(A=1;A<=cr;A++)o=o+r[A-1]<<1,n[A]=o;for(i=0;i<=e;i++){let e=t[2*i+1];0!==e&&(t[2*i]=Ur(n[e]++,e))}},mr=t=>{let e;for(e=0;e<Br;e++)t.dyn_ltree[2*e]=0;for(e=0;e<Er;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},br=t=>{t.bi_valid>8?Nr(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},pr=(t,e,r,n)=>{const A=2*e,i=2*r;return t[A]<t[i]||t[A]===t[i]&&n[e]<=n[r]},wr=(t,e,r)=>{const n=t.heap[r];let A=r<<1;for(;A<=t.heap_len&&(A<t.heap_len&&pr(e,t.heap[A+1],t.heap[A],t.depth)&&A++,!pr(e,n,t.heap[A],t.depth));)t.heap[r]=t.heap[A],r=A,A<<=1;t.heap[r]=n},Hr=(t,e,r)=>{let n,A,i,o,s=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+s++],n+=(255&t.pending_buf[t.sym_buf+s++])<<8,A=t.pending_buf[t.sym_buf+s++],0===n?dr(t,A,e):(i=Ir[A],dr(t,i+ar+1,e),o=Cr[i],0!==o&&(A-=Tr[i],Sr(t,A,o)),n--,i=Mr(n),dr(t,i,r),o=fr[i],0!==o&&(n-=hr[i],Sr(t,n,o)))}while(s<t.sym_next);dr(t,256,e)},Kr=(t,e)=>{const r=e.dyn_tree,n=e.stat_desc.static_tree,A=e.stat_desc.has_stree,i=e.stat_desc.elems;let o,s,a,B=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<i;o++)0!==r[2*o]?(t.heap[++t.heap_len]=B=o,t.depth[o]=0):r[2*o+1]=0;for(;t.heap_len<2;)a=t.heap[++t.heap_len]=B<2?++B:0,r[2*a]=1,t.depth[a]=0,t.opt_len--,A&&(t.static_len-=n[2*a+1]);for(e.max_code=B,o=t.heap_len>>1;o>=1;o--)wr(t,r,o);a=i;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],wr(t,r,1),s=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=s,r[2*a]=r[2*o]+r[2*s],t.depth[a]=(t.depth[o]>=t.depth[s]?t.depth[o]:t.depth[s])+1,r[2*o+1]=r[2*s+1]=a,t.heap[1]=a++,wr(t,r,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const r=e.dyn_tree,n=e.max_code,A=e.stat_desc.static_tree,i=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,a=e.stat_desc.max_length;let B,E,c,C,f,l,u=0;for(C=0;C<=cr;C++)t.bl_count[C]=0;for(r[2*t.heap[t.heap_max]+1]=0,B=t.heap_max+1;B<573;B++)E=t.heap[B],C=r[2*r[2*E+1]+1]+1,C>a&&(C=a,u++),r[2*E+1]=C,E>n||(t.bl_count[C]++,f=0,E>=s&&(f=o[E-s]),l=r[2*E],t.opt_len+=l*(C+f),i&&(t.static_len+=l*(A[2*E+1]+f)));if(0!==u){do{for(C=a-1;0===t.bl_count[C];)C--;t.bl_count[C]--,t.bl_count[C+1]+=2,t.bl_count[a]--,u-=2}while(u>0);for(C=a;0!==C;C--)for(E=t.bl_count[C];0!==E;)c=t.heap[--B],c>n||(r[2*c+1]!==C&&(t.opt_len+=(C-r[2*c+1])*r[2*c],r[2*c+1]=C),E--)}})(t,e),Gr(r,B,t.bl_count)},gr=(t,e,r)=>{let n,A,i=-1,o=e[1],s=0,a=7,B=4;for(0===o&&(a=138,B=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)A=o,o=e[2*(n+1)+1],++s<a&&A===o||(s<B?t.bl_tree[2*A]+=s:0!==A?(A!==i&&t.bl_tree[2*A]++,t.bl_tree[32]++):s<=10?t.bl_tree[34]++:t.bl_tree[36]++,s=0,i=A,0===o?(a=138,B=3):A===o?(a=6,B=3):(a=7,B=4))},Vr=(t,e,r)=>{let n,A,i=-1,o=e[1],s=0,a=7,B=4;for(0===o&&(a=138,B=3),n=0;n<=r;n++)if(A=o,o=e[2*(n+1)+1],!(++s<a&&A===o)){if(s<B)do{dr(t,A,t.bl_tree)}while(0!=--s);else 0!==A?(A!==i&&(dr(t,A,t.bl_tree),s--),dr(t,16,t.bl_tree),Sr(t,s-3,2)):s<=10?(dr(t,17,t.bl_tree),Sr(t,s-3,3)):(dr(t,18,t.bl_tree),Sr(t,s-11,7));s=0,i=A,0===o?(a=138,B=3):A===o?(a=6,B=3):(a=7,B=4)}};let Xr=!1;const Jr=(t,e,r,n)=>{Sr(t,0+(n?1:0),3),br(t),Nr(t,r),Nr(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r};var vr=t=>{Xr||((()=>{let t,e,r,n,A;const i=new Array(16);for(r=0,n=0;n<28;n++)for(Tr[n]=r,t=0;t<1<<Cr[n];t++)Ir[r++]=n;for(Ir[r-1]=n,A=0,n=0;n<16;n++)for(hr[n]=A,t=0;t<1<<fr[n];t++)Rr[A++]=n;for(A>>=7;n<Er;n++)for(hr[n]=A<<7,t=0;t<1<<fr[n]-7;t++)Rr[256+A++]=n;for(e=0;e<=cr;e++)i[e]=0;for(t=0;t<=143;)_r[2*t+1]=8,t++,i[8]++;for(;t<=255;)_r[2*t+1]=9,t++,i[9]++;for(;t<=279;)_r[2*t+1]=7,t++,i[7]++;for(;t<=287;)_r[2*t+1]=8,t++,i[8]++;for(Gr(_r,287,i),t=0;t<Er;t++)Dr[2*t+1]=5,Dr[2*t]=Ur(t,5);Pr=new Fr(_r,Cr,257,Br,cr),Lr=new Fr(Dr,fr,0,Er,cr),Or=new Fr(new Array(0),lr,0,19,7)})(),Xr=!0),t.l_desc=new yr(t.dyn_ltree,Pr),t.d_desc=new yr(t.dyn_dtree,Lr),t.bl_desc=new yr(t.bl_tree,Or),t.bi_buf=0,t.bi_valid=0,mr(t)},Zr=(t,e,r,n)=>{let A,i,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<ar;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),Kr(t,t.l_desc),Kr(t,t.d_desc),o=(t=>{let e;for(gr(t,t.dyn_ltree,t.l_desc.max_code),gr(t,t.dyn_dtree,t.d_desc.max_code),Kr(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*ur[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),A=t.opt_len+3+7>>>3,i=t.static_len+3+7>>>3,i<=A&&(A=i)):A=i=r+5,r+4<=A&&-1!==e?Jr(t,e,r,n):4===t.strategy||i===A?(Sr(t,2+(n?1:0),3),Hr(t,_r,Dr)):(Sr(t,4+(n?1:0),3),((t,e,r,n)=>{let A;for(Sr(t,e-257,5),Sr(t,r-1,5),Sr(t,n-4,4),A=0;A<n;A++)Sr(t,t.bl_tree[2*ur[A]+1],3);Vr(t,t.dyn_ltree,e-1),Vr(t,t.dyn_dtree,r-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),Hr(t,t.dyn_ltree,t.dyn_dtree)),mr(t),n&&br(t)},xr={Dt:vr,Rt:Jr,It:Zr,Tt:(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(Ir[r]+ar+1)]++,t.dyn_dtree[2*Mr(e)]++),t.sym_next===t.sym_end),ht:t=>{Sr(t,2,3),dr(t,256,_r),(t=>{16===t.bi_valid?(Nr(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}};var kr=(t,e,r,n)=>{let A=65535&t|0,i=t>>>16&65535|0,o=0;for(;0!==r;){o=r>2e3?2e3:r,r-=o;do{A=A+e[n++]|0,i=i+A|0}while(--o);A%=65521,i%=65521}return A|i<<16|0};const Wr=new Uint32Array((()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e})());var Qr=(t,e,r,n)=>{const A=Wr,i=n+r;t^=-1;for(let r=n;r<i;r++)t=t>>>8^A[255&(t^e[r])];return-1^t},jr={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"},Yr={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{Dt:zr,Rt:qr,It:$r,Tt:tn,ht:en}=xr,{Z_NO_FLUSH:rn,Z_PARTIAL_FLUSH:nn,Z_FULL_FLUSH:An,Z_FINISH:on,Z_BLOCK:sn,Z_OK:an,Z_STREAM_END:Bn,Z_STREAM_ERROR:En,Z_DATA_ERROR:cn,Z_BUF_ERROR:Cn,Z_DEFAULT_COMPRESSION:fn,Z_FILTERED:ln,Z_HUFFMAN_ONLY:un,Z_RLE:_n,Z_FIXED:Dn,Z_DEFAULT_STRATEGY:Rn,Z_UNKNOWN:In,Z_DEFLATED:Tn}=Yr,hn=286,Fn=30,Pn=19,Ln=2*hn+1,On=15,yn=258,Mn=262,Nn=42,Sn=113,dn=666,Un=(t,e)=>(t.msg=jr[e],e),Gn=t=>2*t-(t>4?9:0),mn=t=>{let e=t.length;for(;--e>=0;)t[e]=0},bn=t=>{let e,r,n,A=t.w_size;e=t.hash_size,n=e;do{r=t.head[--n],t.head[n]=r>=A?r-A:0}while(--e);e=A,n=e;do{r=t.prev[--n],t.prev[n]=r>=A?r-A:0}while(--e)};let pn=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask;const wn=t=>{const e=t.state;let r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))},Hn=(t,e)=>{$r(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,wn(t.strm)},Kn=(t,e)=>{t.pending_buf[t.pending++]=e},gn=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Vn=(t,e,r,n)=>{let A=t.avail_in;return A>n&&(A=n),0===A?0:(t.avail_in-=A,e.set(t.input.subarray(t.next_in,t.next_in+A),r),1===t.state.wrap?t.adler=kr(t.adler,e,A,r):2===t.state.wrap&&(t.adler=Qr(t.adler,e,A,r)),t.next_in+=A,t.total_in+=A,A)},Xn=(t,e)=>{let r,n,A=t.max_chain_length,i=t.strstart,o=t.prev_length,s=t.nice_match;const a=t.strstart>t.w_size-Mn?t.strstart-(t.w_size-Mn):0,B=t.window,E=t.w_mask,c=t.prev,C=t.strstart+yn;let f=B[i+o-1],l=B[i+o];t.prev_length>=t.good_match&&(A>>=2),s>t.lookahead&&(s=t.lookahead);do{if(r=e,B[r+o]===l&&B[r+o-1]===f&&B[r]===B[i]&&B[++r]===B[i+1]){i+=2,r++;do{}while(B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&i<C);if(n=yn-(C-i),i=C-yn,n>o){if(t.match_start=e,o=n,n>=s)break;f=B[i+o-1],l=B[i+o]}}}while((e=c[e&E])>a&&0!=--A);return o<=t.lookahead?o:t.lookahead},Jn=t=>{const e=t.w_size;let r,n,A;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Mn)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),bn(t),n+=e),0===t.strm.avail_in)break;if(r=Vn(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=3)for(A=t.strstart-t.insert,t.ins_h=t.window[A],t.ins_h=pn(t,t.ins_h,t.window[A+1]);t.insert&&(t.ins_h=pn(t,t.ins_h,t.window[A+3-1]),t.prev[A&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=A,A++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<Mn&&0!==t.strm.avail_in)},vn=(t,e)=>{let r,n,A,i=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,s=t.strm.avail_in;do{if(r=65535,A=t.bi_valid+42>>3,t.strm.avail_out<A)break;if(A=t.strm.avail_out-A,n=t.strstart-t.block_start,r>n+t.strm.avail_in&&(r=n+t.strm.avail_in),r>A&&(r=A),r<i&&(0===r&&e!==on||e===rn||r!==n+t.strm.avail_in))break;o=e===on&&r===n+t.strm.avail_in?1:0,qr(t,0,0,o),t.pending_buf[t.pending-4]=r,t.pending_buf[t.pending-3]=r>>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,wn(t.strm),n&&(n>r&&(n=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,r-=n),r&&(Vn(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(0===o);return s-=t.strm.avail_in,s&&(s>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=s&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-s,t.strm.next_in),t.strstart),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?4:e!==rn&&e!==on&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(A=t.window_size-t.strstart,t.strm.avail_in>A&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,A+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),A>t.strm.avail_in&&(A=t.strm.avail_in),A&&(Vn(t.strm,t.window,t.strstart,A),t.strstart+=A,t.insert+=A>t.w_size-t.insert?t.w_size-t.insert:A),t.high_water<t.strstart&&(t.high_water=t.strstart),A=t.bi_valid+42>>3,A=t.pending_buf_size-A>65535?65535:t.pending_buf_size-A,i=A>t.w_size?t.w_size:A,n=t.strstart-t.block_start,(n>=i||(n||e===on)&&e!==rn&&0===t.strm.avail_in&&n<=A)&&(r=n>A?A:n,o=e===on&&0===t.strm.avail_in&&r===n?1:0,qr(t,t.block_start,r,o),t.block_start+=r,wn(t.strm)),o?3:1)},Zn=(t,e)=>{let r,n;for(;;){if(t.lookahead<Mn){if(Jn(t),t.lookahead<Mn&&e===rn)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=pn(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-Mn&&(t.match_length=Xn(t,r)),t.match_length>=3)if(n=tn(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=pn(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=pn(t,t.ins_h,t.window[t.strstart+1]);else n=tn(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(Hn(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===on?(Hn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Hn(t,!1),0===t.strm.avail_out)?1:2},xn=(t,e)=>{let r,n,A;for(;;){if(t.lookahead<Mn){if(Jn(t),t.lookahead<Mn&&e===rn)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=pn(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Mn&&(t.match_length=Xn(t,r),t.match_length<=5&&(t.strategy===ln||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){A=t.strstart+t.lookahead-3,n=tn(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=A&&(t.ins_h=pn(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(Hn(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=tn(t,0,t.window[t.strstart-1]),n&&Hn(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=tn(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===on?(Hn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Hn(t,!1),0===t.strm.avail_out)?1:2};function kn(t,e,r,n,A){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=A}const Wn=[new kn(0,0,0,0,vn),new kn(4,4,8,4,Zn),new kn(4,5,16,8,Zn),new kn(4,6,32,32,Zn),new kn(4,4,16,16,xn),new kn(8,16,32,32,xn),new kn(8,16,128,128,xn),new kn(8,32,128,256,xn),new kn(32,128,258,1024,xn),new kn(32,258,258,4096,xn)];function Qn(){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=Tn,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(2*Ln),this.dyn_dtree=new Uint16Array(2*(2*Fn+1)),this.bl_tree=new Uint16Array(2*(2*Pn+1)),mn(this.dyn_ltree),mn(this.dyn_dtree),mn(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(On+1),this.heap=new Uint16Array(2*hn+1),mn(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*hn+1),mn(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 jn=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Nn&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Sn&&e.status!==dn?1:0},Yn=t=>{if(jn(t))return Un(t,En);t.total_in=t.total_out=0,t.data_type=In;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Nn:Sn,t.adler=2===e.wrap?0:1,e.last_flush=-2,zr(e),an},zn=t=>{const e=Yn(t);var r;return e===an&&((r=t.state).window_size=2*r.w_size,mn(r.head),r.max_lazy_match=Wn[r.level].max_lazy,r.good_match=Wn[r.level].good_length,r.nice_match=Wn[r.level].nice_length,r.max_chain_length=Wn[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),e},qn=(t,e,r,n,A,i)=>{if(!t)return En;let o=1;if(e===fn&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),A<1||A>9||r!==Tn||n<8||n>15||e<0||e>9||i<0||i>Dn||8===n&&1!==o)return Un(t,En);8===n&&(n=9);const s=new Qn;return t.state=s,s.strm=t,s.status=Nn,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=A+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<<A+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=e,s.strategy=i,s.method=r,zn(t)};var $n=(t,e)=>{if(jn(t)||e>sn||e<0)return t?Un(t,En):En;const r=t.state;if(!t.output||0!==t.avail_in&&!t.input||r.status===dn&&e!==on)return Un(t,0===t.avail_out?Cn:En);const n=r.last_flush;if(r.last_flush=e,0!==r.pending){if(wn(t),0===t.avail_out)return r.last_flush=-1,an}else if(0===t.avail_in&&Gn(e)<=Gn(n)&&e!==on)return Un(t,Cn);if(r.status===dn&&0!==t.avail_in)return Un(t,Cn);if(r.status===Nn&&0===r.wrap&&(r.status=Sn),r.status===Nn){let e=Tn+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=un||r.level<2?0:r.level<6?1:6===r.level?2:3,e|=n<<6,0!==r.strstart&&(e|=32),e+=31-e%31,gn(r,e),0!==r.strstart&&(gn(r,t.adler>>>16),gn(r,65535&t.adler)),t.adler=1,r.status=Sn,wn(t),0!==r.pending)return r.last_flush=-1,an}if(57===r.status)if(t.adler=0,Kn(r,31),Kn(r,139),Kn(r,8),r.gzhead)Kn(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Kn(r,255&r.gzhead.time),Kn(r,r.gzhead.time>>8&255),Kn(r,r.gzhead.time>>16&255),Kn(r,r.gzhead.time>>24&255),Kn(r,9===r.level?2:r.strategy>=un||r.level<2?4:0),Kn(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Kn(r,255&r.gzhead.extra.length),Kn(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Qr(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(Kn(r,0),Kn(r,0),Kn(r,0),Kn(r,0),Kn(r,0),Kn(r,9===r.level?2:r.strategy>=un||r.level<2?4:0),Kn(r,3),r.status=Sn,wn(t),0!==r.pending)return r.last_flush=-1,an;if(69===r.status){if(r.gzhead.extra){let e=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let A=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+A),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>e&&(t.adler=Qr(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex+=A,wn(t),0!==r.pending)return r.last_flush=-1,an;e=0,n-=A}let A=new Uint8Array(r.gzhead.extra);r.pending_buf.set(A.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>e&&(t.adler=Qr(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let e,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Qr(t.adler,r.pending_buf,r.pending-n,n)),wn(t),0!==r.pending)return r.last_flush=-1,an;n=0}e=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Kn(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>n&&(t.adler=Qr(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let e,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Qr(t.adler,r.pending_buf,r.pending-n,n)),wn(t),0!==r.pending)return r.last_flush=-1,an;n=0}e=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Kn(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>n&&(t.adler=Qr(t.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(wn(t),0!==r.pending))return r.last_flush=-1,an;Kn(r,255&t.adler),Kn(r,t.adler>>8&255),t.adler=0}if(r.status=Sn,wn(t),0!==r.pending)return r.last_flush=-1,an}if(0!==t.avail_in||0!==r.lookahead||e!==rn&&r.status!==dn){let n=0===r.level?vn(r,e):r.strategy===un?((t,e)=>{let r;for(;;){if(0===t.lookahead&&(Jn(t),0===t.lookahead)){if(e===rn)return 1;break}if(t.match_length=0,r=tn(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Hn(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===on?(Hn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Hn(t,!1),0===t.strm.avail_out)?1:2})(r,e):r.strategy===_n?((t,e)=>{let r,n,A,i;const o=t.window;for(;;){if(t.lookahead<=yn){if(Jn(t),t.lookahead<=yn&&e===rn)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(A=t.strstart-1,n=o[A],n===o[++A]&&n===o[++A]&&n===o[++A])){i=t.strstart+yn;do{}while(n===o[++A]&&n===o[++A]&&n===o[++A]&&n===o[++A]&&n===o[++A]&&n===o[++A]&&n===o[++A]&&n===o[++A]&&A<i);t.match_length=yn-(i-A),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=tn(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=tn(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Hn(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===on?(Hn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Hn(t,!1),0===t.strm.avail_out)?1:2})(r,e):Wn[r.level].func(r,e);if(3!==n&&4!==n||(r.status=dn),1===n||3===n)return 0===t.avail_out&&(r.last_flush=-1),an;if(2===n&&(e===nn?en(r):e!==sn&&(qr(r,0,0,!1),e===An&&(mn(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),wn(t),0===t.avail_out))return r.last_flush=-1,an}return e!==on?an:r.wrap<=0?Bn:(2===r.wrap?(Kn(r,255&t.adler),Kn(r,t.adler>>8&255),Kn(r,t.adler>>16&255),Kn(r,t.adler>>24&255),Kn(r,255&t.total_in),Kn(r,t.total_in>>8&255),Kn(r,t.total_in>>16&255),Kn(r,t.total_in>>24&255)):(gn(r,t.adler>>>16),gn(r,65535&t.adler)),wn(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?an:Bn)},tA=(t,e)=>{let r=e.length;if(jn(t))return En;const n=t.state,A=n.wrap;if(2===A||1===A&&n.status!==Nn||n.lookahead)return En;if(1===A&&(t.adler=kr(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){0===A&&(mn(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(r-n.w_size,r),0),e=t,r=n.w_size}const i=t.avail_in,o=t.next_in,s=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,Jn(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=pn(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Jn(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=s,t.avail_in=i,n.wrap=A,an},eA={deflateInit:(t,e)=>qn(t,e,Tn,15,8,Rn),deflateInit2:qn,deflateReset:zn,deflateResetKeep:Yn,deflateSetHeader:(t,e)=>jn(t)||2!==t.state.wrap?En:(t.state.gzhead=e,an),deflate:$n,deflateEnd:t=>{if(jn(t))return En;const e=t.state.status;return t.state=null,e===Sn?Un(t,cn):an},deflateSetDictionary:tA,deflateInfo:"pako deflate (from Nodeca project)"};const rA=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var nA={assign:function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const e in r)rA(r,e)&&(t[e]=r[e])}}return t},flattenChunks:t=>{let e=0;for(let r=0,n=t.length;r<n;r++)e+=t[r].length;const r=new Uint8Array(e);for(let e=0,n=0,A=t.length;e<A;e++){let A=t[e];r.set(A,n),n+=A.length}return r}};let AA=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){AA=!1}const iA=new Uint8Array(256);for(let t=0;t<256;t++)iA[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;iA[254]=iA[254]=1;var oA={string2buf:t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,r,n,A,i,o=t.length,s=0;for(A=0;A<o;A++)r=t.charCodeAt(A),55296==(64512&r)&&A+1<o&&(n=t.charCodeAt(A+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),A++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),i=0,A=0;i<s;A++)r=t.charCodeAt(A),55296==(64512&r)&&A+1<o&&(n=t.charCodeAt(A+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),A++)),r<128?e[i++]=r:r<2048?(e[i++]=192|r>>>6,e[i++]=128|63&r):r<65536?(e[i++]=224|r>>>12,e[i++]=128|r>>>6&63,e[i++]=128|63&r):(e[i++]=240|r>>>18,e[i++]=128|r>>>12&63,e[i++]=128|r>>>6&63,e[i++]=128|63&r);return e},buf2string:(t,e)=>{const r=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,A;const i=new Array(2*r);for(A=0,n=0;n<r;){let e=t[n++];if(e<128){i[A++]=e;continue}let o=iA[e];if(o>4)i[A++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n<r;)e=e<<6|63&t[n++],o--;o>1?i[A++]=65533:e<65536?i[A++]=e:(e-=65536,i[A++]=55296|e>>10&1023,i[A++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&AA)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r})(i,A)},utf8border:(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let r=e-1;for(;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+iA[t[r]]>e?r:e}};var sA=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 aA=Object.prototype.toString,{Z_NO_FLUSH:BA,Z_SYNC_FLUSH:EA,Z_FULL_FLUSH:cA,Z_FINISH:CA,Z_OK:fA,Z_STREAM_END:lA,Z_DEFAULT_COMPRESSION:uA,Z_DEFAULT_STRATEGY:_A,Z_DEFLATED:DA}=Yr;function RA(t){this.options=nA.assign({level:uA,method:DA,chunkSize:16384,windowBits:15,memLevel:8,strategy:_A},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new sA,this.strm.avail_out=0;let r=eA.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==fA)throw new Error(jr[r]);if(e.header&&eA.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?oA.string2buf(e.dictionary):"[object ArrayBuffer]"===aA.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,r=eA.deflateSetDictionary(this.strm,t),r!==fA)throw new Error(jr[r]);this.Ft=!0}}function IA(t,e){const r=new RA(e);if(r.push(t,!0),r.err)throw r.msg||jr[r.err];return r.result}RA.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize;let A,i;if(this.ended)return!1;for(i=e===~~e?e:!0===e?CA:BA,"string"==typeof t?r.input=oA.string2buf(t):"[object ArrayBuffer]"===aA.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(i===EA||i===cA)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(A=eA.deflate(r,i),A===lA)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),A=eA.deflateEnd(this.strm),this.onEnd(A),this.ended=!0,A===fA;if(0!==r.avail_out){if(i>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},RA.prototype.onData=function(t){this.chunks.push(t)},RA.prototype.onEnd=function(t){t===fA&&(this.result=nA.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var TA={Deflate:RA,deflate:IA,deflateRaw:function(t,e){return(e=e||{}).raw=!0,IA(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,IA(t,e)},constants:Yr};const hA=16209;var FA=function(t,e){let r,n,A,i,o,s,a,B,E,c,C,f,l,u,_,D,R,I,T,h,F,P,L,O;const y=t.state;r=t.next_in,L=t.input,n=r+(t.avail_in-5),A=t.next_out,O=t.output,i=A-(e-t.avail_out),o=A+(t.avail_out-257),s=y.dmax,a=y.wsize,B=y.whave,E=y.wnext,c=y.window,C=y.hold,f=y.bits,l=y.lencode,u=y.distcode,_=(1<<y.lenbits)-1,D=(1<<y.distbits)-1;t:do{f<15&&(C+=L[r++]<<f,f+=8,C+=L[r++]<<f,f+=8),R=l[C&_];e:for(;;){if(I=R>>>24,C>>>=I,f-=I,I=R>>>16&255,0===I)O[A++]=65535&R;else{if(!(16&I)){if(0==(64&I)){R=l[(65535&R)+(C&(1<<I)-1)];continue e}if(32&I){y.mode=16191;break t}t.msg="invalid literal/length code",y.mode=hA;break t}T=65535&R,I&=15,I&&(f<I&&(C+=L[r++]<<f,f+=8),T+=C&(1<<I)-1,C>>>=I,f-=I),f<15&&(C+=L[r++]<<f,f+=8,C+=L[r++]<<f,f+=8),R=u[C&D];r:for(;;){if(I=R>>>24,C>>>=I,f-=I,I=R>>>16&255,!(16&I)){if(0==(64&I)){R=u[(65535&R)+(C&(1<<I)-1)];continue r}t.msg="invalid distance code",y.mode=hA;break t}if(h=65535&R,I&=15,f<I&&(C+=L[r++]<<f,f+=8,f<I&&(C+=L[r++]<<f,f+=8)),h+=C&(1<<I)-1,h>s){t.msg="invalid distance too far back",y.mode=hA;break t}if(C>>>=I,f-=I,I=A-i,h>I){if(I=h-I,I>B&&y.sane){t.msg="invalid distance too far back",y.mode=hA;break t}if(F=0,P=c,0===E){if(F+=a-I,I<T){T-=I;do{O[A++]=c[F++]}while(--I);F=A-h,P=O}}else if(E<I){if(F+=a+E-I,I-=E,I<T){T-=I;do{O[A++]=c[F++]}while(--I);if(F=0,E<T){I=E,T-=I;do{O[A++]=c[F++]}while(--I);F=A-h,P=O}}}else if(F+=E-I,I<T){T-=I;do{O[A++]=c[F++]}while(--I);F=A-h,P=O}for(;T>2;)O[A++]=P[F++],O[A++]=P[F++],O[A++]=P[F++],T-=3;T&&(O[A++]=P[F++],T>1&&(O[A++]=P[F++]))}else{F=A-h;do{O[A++]=O[F++],O[A++]=O[F++],O[A++]=O[F++],T-=3}while(T>2);T&&(O[A++]=O[F++],T>1&&(O[A++]=O[F++]))}break}}break}}while(r<n&&A<o);T=f>>3,r-=T,f-=T<<3,C&=(1<<f)-1,t.next_in=r,t.next_out=A,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=A<o?o-A+257:257-(A-o),y.hold=C,y.bits=f};const PA=15,LA=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]),OA=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]),yA=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]),MA=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 NA=(t,e,r,n,A,i,o,s)=>{const a=s.bits;let B,E,c,C,f,l,u=0,_=0,D=0,R=0,I=0,T=0,h=0,F=0,P=0,L=0,O=null;const y=new Uint16Array(16),M=new Uint16Array(16);let N,S,d,U=null;for(u=0;u<=PA;u++)y[u]=0;for(_=0;_<n;_++)y[e[r+_]]++;for(I=a,R=PA;R>=1&&0===y[R];R--);if(I>R&&(I=R),0===R)return A[i++]=20971520,A[i++]=20971520,s.bits=1,0;for(D=1;D<R&&0===y[D];D++);for(I<D&&(I=D),F=1,u=1;u<=PA;u++)if(F<<=1,F-=y[u],F<0)return-1;if(F>0&&(0===t||1!==R))return-1;for(M[1]=0,u=1;u<PA;u++)M[u+1]=M[u]+y[u];for(_=0;_<n;_++)0!==e[r+_]&&(o[M[e[r+_]]++]=_);if(0===t?(O=U=o,l=20):1===t?(O=LA,U=OA,l=257):(O=yA,U=MA,l=0),L=0,_=0,u=D,f=i,T=I,h=0,c=-1,P=1<<I,C=P-1,1===t&&P>852||2===t&&P>592)return 1;for(;;){N=u-h,o[_]+1<l?(S=0,d=o[_]):o[_]>=l?(S=U[o[_]-l],d=O[o[_]-l]):(S=96,d=0),B=1<<u-h,E=1<<T,D=E;do{E-=B,A[f+(L>>h)+E]=N<<24|S<<16|d|0}while(0!==E);for(B=1<<u-1;L&B;)B>>=1;if(0!==B?(L&=B-1,L+=B):L=0,_++,0==--y[u]){if(u===R)break;u=e[r+o[_]]}if(u>I&&(L&C)!==c){for(0===h&&(h=I),f+=D,T=u-h,F=1<<T;T+h<R&&(F-=y[T+h],!(F<=0));)T++,F<<=1;if(P+=1<<T,1===t&&P>852||2===t&&P>592)return 1;c=L&C,A[c]=I<<24|T<<16|f-i|0}}return 0!==L&&(A[f+L]=u-h<<24|64<<16|0),s.bits=I,0};const{Z_FINISH:SA,Z_BLOCK:dA,Z_TREES:UA,Z_OK:GA,Z_STREAM_END:mA,Z_NEED_DICT:bA,Z_STREAM_ERROR:pA,Z_DATA_ERROR:wA,Z_MEM_ERROR:HA,Z_BUF_ERROR:KA,Z_DEFLATED:gA}=Yr,VA=16180,XA=16190,JA=16191,vA=16192,ZA=16194,xA=16199,kA=16200,WA=16206,QA=16209,jA=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function YA(){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 zA=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<VA||e.mode>16211?1:0},qA=t=>{if(zA(t))return pA;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=VA,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,GA},$A=t=>{if(zA(t))return pA;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,qA(t)},ti=(t,e)=>{let r;if(zA(t))return pA;const n=t.state;return e<0?(r=0,e=-e):(r=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?pA:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,$A(t))},ei=(t,e)=>{if(!t)return pA;const r=new YA;t.state=r,r.strm=t,r.window=null,r.mode=VA;const n=ti(t,e);return n!==GA&&(t.state=null),n};let ri,ni,Ai=!0;const ii=t=>{if(Ai){ri=new Int32Array(512),ni=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(NA(1,t.lens,0,288,ri,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;NA(2,t.lens,0,32,ni,0,t.work,{bits:5}),Ai=!1}t.lencode=ri,t.lenbits=9,t.distcode=ni,t.distbits=5},oi=(t,e,r,n)=>{let A;const i=t.state;return null===i.window&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new Uint8Array(i.wsize)),n>=i.wsize?(i.window.set(e.subarray(r-i.wsize,r),0),i.wnext=0,i.whave=i.wsize):(A=i.wsize-i.wnext,A>n&&(A=n),i.window.set(e.subarray(r-n,r-n+A),i.wnext),(n-=A)?(i.window.set(e.subarray(r-n,r),0),i.wnext=n,i.whave=i.wsize):(i.wnext+=A,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=A))),0};var si=(t,e)=>{let r,n,A,i,o,s,a,B,E,c,C,f,l,u,_,D,R,I,T,h,F,P,L=0;const O=new Uint8Array(4);let y,M;const N=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(zA(t)||!t.output||!t.input&&0!==t.avail_in)return pA;r=t.state,r.mode===JA&&(r.mode=vA),o=t.next_out,A=t.output,a=t.avail_out,i=t.next_in,n=t.input,s=t.avail_in,B=r.hold,E=r.bits,c=s,C=a,P=GA;t:for(;;)switch(r.mode){case VA:if(0===r.wrap){r.mode=vA;break}for(;E<16;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(2&r.wrap&&35615===B){0===r.wbits&&(r.wbits=15),r.check=0,O[0]=255&B,O[1]=B>>>8&255,r.check=Qr(r.check,O,2,0),B=0,E=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&B)<<8)+(B>>8))%31){t.msg="incorrect header check",r.mode=QA;break}if((15&B)!==gA){t.msg="unknown compression method",r.mode=QA;break}if(B>>>=4,E-=4,F=8+(15&B),0===r.wbits&&(r.wbits=F),F>15||F>r.wbits){t.msg="invalid window size",r.mode=QA;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=512&B?16189:JA,B=0,E=0;break;case 16181:for(;E<16;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(r.flags=B,(255&r.flags)!==gA){t.msg="unknown compression method",r.mode=QA;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=QA;break}r.head&&(r.head.text=B>>8&1),512&r.flags&&4&r.wrap&&(O[0]=255&B,O[1]=B>>>8&255,r.check=Qr(r.check,O,2,0)),B=0,E=0,r.mode=16182;case 16182:for(;E<32;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.head&&(r.head.time=B),512&r.flags&&4&r.wrap&&(O[0]=255&B,O[1]=B>>>8&255,O[2]=B>>>16&255,O[3]=B>>>24&255,r.check=Qr(r.check,O,4,0)),B=0,E=0,r.mode=16183;case 16183:for(;E<16;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.head&&(r.head.xflags=255&B,r.head.os=B>>8),512&r.flags&&4&r.wrap&&(O[0]=255&B,O[1]=B>>>8&255,r.check=Qr(r.check,O,2,0)),B=0,E=0,r.mode=16184;case 16184:if(1024&r.flags){for(;E<16;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.length=B,r.head&&(r.head.extra_len=B),512&r.flags&&4&r.wrap&&(O[0]=255&B,O[1]=B>>>8&255,r.check=Qr(r.check,O,2,0)),B=0,E=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(f=r.length,f>s&&(f=s),f&&(r.head&&(F=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(i,i+f),F)),512&r.flags&&4&r.wrap&&(r.check=Qr(r.check,n,f,i)),s-=f,i+=f,r.length-=f),r.length))break t;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===s)break t;f=0;do{F=n[i+f++],r.head&&F&&r.length<65536&&(r.head.name+=String.fromCharCode(F))}while(F&&f<s);if(512&r.flags&&4&r.wrap&&(r.check=Qr(r.check,n,f,i)),s-=f,i+=f,F)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===s)break t;f=0;do{F=n[i+f++],r.head&&F&&r.length<65536&&(r.head.comment+=String.fromCharCode(F))}while(F&&f<s);if(512&r.flags&&4&r.wrap&&(r.check=Qr(r.check,n,f,i)),s-=f,i+=f,F)break t}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;E<16;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(4&r.wrap&&B!==(65535&r.check)){t.msg="header crc mismatch",r.mode=QA;break}B=0,E=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=JA;break;case 16189:for(;E<32;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}t.adler=r.check=jA(B),B=0,E=0,r.mode=XA;case XA:if(0===r.havedict)return t.next_out=o,t.avail_out=a,t.next_in=i,t.avail_in=s,r.hold=B,r.bits=E,bA;t.adler=r.check=1,r.mode=JA;case JA:if(e===dA||e===UA)break t;case vA:if(r.last){B>>>=7&E,E-=7&E,r.mode=WA;break}for(;E<3;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}switch(r.last=1&B,B>>>=1,E-=1,3&B){case 0:r.mode=16193;break;case 1:if(ii(r),r.mode=xA,e===UA){B>>>=2,E-=2;break t}break;case 2:r.mode=16196;break;case 3:t.msg="invalid block type",r.mode=QA}B>>>=2,E-=2;break;case 16193:for(B>>>=7&E,E-=7&E;E<32;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if((65535&B)!=(B>>>16^65535)){t.msg="invalid stored block lengths",r.mode=QA;break}if(r.length=65535&B,B=0,E=0,r.mode=ZA,e===UA)break t;case ZA:r.mode=16195;case 16195:if(f=r.length,f){if(f>s&&(f=s),f>a&&(f=a),0===f)break t;A.set(n.subarray(i,i+f),o),s-=f,i+=f,a-=f,o+=f,r.length-=f;break}r.mode=JA;break;case 16196:for(;E<14;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(r.nlen=257+(31&B),B>>>=5,E-=5,r.ndist=1+(31&B),B>>>=5,E-=5,r.ncode=4+(15&B),B>>>=4,E-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=QA;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;E<3;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.lens[N[r.have++]]=7&B,B>>>=3,E-=3}for(;r.have<19;)r.lens[N[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,y={bits:r.lenbits},P=NA(0,r.lens,0,19,r.lencode,0,r.work,y),r.lenbits=y.bits,P){t.msg="invalid code lengths set",r.mode=QA;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;L=r.lencode[B&(1<<r.lenbits)-1],_=L>>>24,D=L>>>16&255,R=65535&L,!(_<=E);){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(R<16)B>>>=_,E-=_,r.lens[r.have++]=R;else{if(16===R){for(M=_+2;E<M;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(B>>>=_,E-=_,0===r.have){t.msg="invalid bit length repeat",r.mode=QA;break}F=r.lens[r.have-1],f=3+(3&B),B>>>=2,E-=2}else if(17===R){for(M=_+3;E<M;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}B>>>=_,E-=_,F=0,f=3+(7&B),B>>>=3,E-=3}else{for(M=_+7;E<M;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}B>>>=_,E-=_,F=0,f=11+(127&B),B>>>=7,E-=7}if(r.have+f>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=QA;break}for(;f--;)r.lens[r.have++]=F}}if(r.mode===QA)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=QA;break}if(r.lenbits=9,y={bits:r.lenbits},P=NA(1,r.lens,0,r.nlen,r.lencode,0,r.work,y),r.lenbits=y.bits,P){t.msg="invalid literal/lengths set",r.mode=QA;break}if(r.distbits=6,r.distcode=r.distdyn,y={bits:r.distbits},P=NA(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,y),r.distbits=y.bits,P){t.msg="invalid distances set",r.mode=QA;break}if(r.mode=xA,e===UA)break t;case xA:r.mode=kA;case kA:if(s>=6&&a>=258){t.next_out=o,t.avail_out=a,t.next_in=i,t.avail_in=s,r.hold=B,r.bits=E,FA(t,C),o=t.next_out,A=t.output,a=t.avail_out,i=t.next_in,n=t.input,s=t.avail_in,B=r.hold,E=r.bits,r.mode===JA&&(r.back=-1);break}for(r.back=0;L=r.lencode[B&(1<<r.lenbits)-1],_=L>>>24,D=L>>>16&255,R=65535&L,!(_<=E);){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(D&&0==(240&D)){for(I=_,T=D,h=R;L=r.lencode[h+((B&(1<<I+T)-1)>>I)],_=L>>>24,D=L>>>16&255,R=65535&L,!(I+_<=E);){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}B>>>=I,E-=I,r.back+=I}if(B>>>=_,E-=_,r.back+=_,r.length=R,0===D){r.mode=16205;break}if(32&D){r.back=-1,r.mode=JA;break}if(64&D){t.msg="invalid literal/length code",r.mode=QA;break}r.extra=15&D,r.mode=16201;case 16201:if(r.extra){for(M=r.extra;E<M;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.length+=B&(1<<r.extra)-1,B>>>=r.extra,E-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;L=r.distcode[B&(1<<r.distbits)-1],_=L>>>24,D=L>>>16&255,R=65535&L,!(_<=E);){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(0==(240&D)){for(I=_,T=D,h=R;L=r.distcode[h+((B&(1<<I+T)-1)>>I)],_=L>>>24,D=L>>>16&255,R=65535&L,!(I+_<=E);){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}B>>>=I,E-=I,r.back+=I}if(B>>>=_,E-=_,r.back+=_,64&D){t.msg="invalid distance code",r.mode=QA;break}r.offset=R,r.extra=15&D,r.mode=16203;case 16203:if(r.extra){for(M=r.extra;E<M;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.offset+=B&(1<<r.extra)-1,B>>>=r.extra,E-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=QA;break}r.mode=16204;case 16204:if(0===a)break t;if(f=C-a,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=QA;break}f>r.wnext?(f-=r.wnext,l=r.wsize-f):l=r.wnext-f,f>r.length&&(f=r.length),u=r.window}else u=A,l=o-r.offset,f=r.length;f>a&&(f=a),a-=f,r.length-=f;do{A[o++]=u[l++]}while(--f);0===r.length&&(r.mode=kA);break;case 16205:if(0===a)break t;A[o++]=r.length,a--,r.mode=kA;break;case WA:if(r.wrap){for(;E<32;){if(0===s)break t;s--,B|=n[i++]<<E,E+=8}if(C-=a,t.total_out+=C,r.total+=C,4&r.wrap&&C&&(t.adler=r.check=r.flags?Qr(r.check,A,C,o-C):kr(r.check,A,C,o-C)),C=a,4&r.wrap&&(r.flags?B:jA(B))!==r.check){t.msg="incorrect data check",r.mode=QA;break}B=0,E=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;E<32;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(4&r.wrap&&B!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=QA;break}B=0,E=0}r.mode=16208;case 16208:P=mA;break t;case QA:P=wA;break t;case 16210:return HA;default:return pA}return t.next_out=o,t.avail_out=a,t.next_in=i,t.avail_in=s,r.hold=B,r.bits=E,(r.wsize||C!==t.avail_out&&r.mode<QA&&(r.mode<WA||e!==SA))&&oi(t,t.output,t.next_out,C-t.avail_out),c-=t.avail_in,C-=t.avail_out,t.total_in+=c,t.total_out+=C,r.total+=C,4&r.wrap&&C&&(t.adler=r.check=r.flags?Qr(r.check,A,C,t.next_out-C):kr(r.check,A,C,t.next_out-C)),t.data_type=r.bits+(r.last?64:0)+(r.mode===JA?128:0)+(r.mode===xA||r.mode===ZA?256:0),(0===c&&0===C||e===SA)&&P===GA&&(P=KA),P},ai={inflateReset:$A,inflateReset2:ti,inflateResetKeep:qA,inflateInit:t=>ei(t,15),inflateInit2:ei,inflate:si,inflateEnd:t=>{if(zA(t))return pA;let e=t.state;return e.window&&(e.window=null),t.state=null,GA},inflateGetHeader:(t,e)=>{if(zA(t))return pA;const r=t.state;return 0==(2&r.wrap)?pA:(r.head=e,e.done=!1,GA)},inflateSetDictionary:(t,e)=>{const r=e.length;let n,A,i;return zA(t)?pA:(n=t.state,0!==n.wrap&&n.mode!==XA?pA:n.mode===XA&&(A=1,A=kr(A,e,r,0),A!==n.check)?wA:(i=oi(t,e,r,r),i?(n.mode=16210,HA):(n.havedict=1,GA)))},inflateInfo:"pako inflate (from Nodeca project)"};var Bi=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 Ei=Object.prototype.toString,{Z_NO_FLUSH:ci,Z_FINISH:Ci,Z_OK:fi,Z_STREAM_END:li,Z_NEED_DICT:ui,Z_STREAM_ERROR:_i,Z_DATA_ERROR:Di,Z_MEM_ERROR:Ri}=Yr;function Ii(t){this.options=nA.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new sA,this.strm.avail_out=0;let r=ai.inflateInit2(this.strm,e.windowBits);if(r!==fi)throw new Error(jr[r]);if(this.header=new Bi,ai.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=oA.string2buf(e.dictionary):"[object ArrayBuffer]"===Ei.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=ai.inflateSetDictionary(this.strm,e.dictionary),r!==fi)))throw new Error(jr[r])}function Ti(t,e){const r=new Ii(e);if(r.push(t),r.err)throw r.msg||jr[r.err];return r.result}Ii.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize,A=this.options.dictionary;let i,o,s;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Ci:ci,"[object ArrayBuffer]"===Ei.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),i=ai.inflate(r,o),i===ui&&A&&(i=ai.inflateSetDictionary(r,A),i===fi?i=ai.inflate(r,o):i===Di&&(i=ui));r.avail_in>0&&i===li&&r.state.wrap>0&&0!==t[r.next_in];)ai.inflateReset(r),i=ai.inflate(r,o);switch(i){case _i:case Di:case ui:case Ri:return this.onEnd(i),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||i===li))if("string"===this.options.to){let t=oA.utf8border(r.output,r.next_out),e=r.next_out-t,A=oA.buf2string(r.output,t);r.next_out=e,r.avail_out=n-e,e&&r.output.set(r.output.subarray(t,t+e),0),this.onData(A)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(i!==fi||0!==s){if(i===li)return i=ai.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},Ii.prototype.onData=function(t){this.chunks.push(t)},Ii.prototype.onEnd=function(t){t===fi&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=nA.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var hi={Inflate:Ii,inflate:Ti,inflateRaw:function(t,e){return(e=e||{}).raw=!0,Ti(t,e)},ungzip:Ti,constants:Yr};const{Deflate:Fi,deflate:Pi,deflateRaw:Li,gzip:Oi}=TA,{Inflate:yi,inflate:Mi,inflateRaw:Ni,ungzip:Si}=hi;var di={Deflate:Fi,deflate:Pi,deflateRaw:Li,gzip:Oi,Inflate:yi,inflate:Mi,inflateRaw:Ni,ungzip:Si,constants:Yr},Ui={LUMINANCE_8:1,LUMINANCE_16:2,ALPHA:3,ALPHA_4_LUMINANCE_4:4,LUMINANCE_ALPHA:5,RGB_565:6,BGR565:7,RGB:10,BGR:11,ARGB:12,ABGR:13,BGRA:14,WEBP:25,RGBA:28,DXT1:17,DXT2:18,DXT3:19,DXT4:20,DXT5:21,CRN_DXT5:26},Gi=1,mi=2,bi=4;function pi(t,e,r,n){var A=t|e<<8,i=A>>11&31,o=A>>5&63,s=31&A;return r[n+0]=i<<3|i>>2,r[n+1]=o<<2|o>>4,r[n+2]=s<<3|s>>2,r[n+3]=255,A}var wi=new Uint8Array(16),Hi=new Uint8Array(16);function Ki(t,e,r,n){var A=0;0!=(n&(mi|bi))&&(A=8),function(t,e,r,n){for(var A=pi(e[r+0],e[r+1],wi,0),i=pi(e[r+2],e[r+3],wi,4),o=0;o<3;o++){var s=wi[o],a=wi[4+o];n&&A<=i?(wi[8+o]=(s+a)/2,wi[12+o]=0):(wi[8+o]=(2*s+a)/3,wi[12+o]=(s+2*a)/3)}for(wi[11]=255,wi[15]=n&&A<=i?0:255,o=0;o<4;++o){var B=e[r+4+o];Hi[4*o+0]=3&B,Hi[4*o+1]=B>>2&3,Hi[4*o+2]=B>>4&3,Hi[4*o+3]=B>>6&3}for(o=0;o<16;++o)for(var E=4*Hi[o],c=0;c<4;++c)t[4*o+c]=wi[E+c]}(t,e,r+A,0!=(n&Gi)),0!=(n&mi)?function(t,e,r){for(var n=0;n<8;++n){var A=bytes[r+n],i=15&A,o=240&A;t[8*n+3]=i|i<<4,t[8*n+7]=o|o>>4}}(t,0,r):0!=(n&bi)&&function(t,e,r){var n=e[r+0],A=e[r+1];if(wi[0]=n,wi[1]=A,n<=A){for(var i=1;i<5;++i)wi[1+i]=((5-i)*n+i*A)/5;wi[6]=0,wi[7]=255}else for(i=1;i<7;++i)wi[1+i]=((7-i)*n+i*A)/7;r+=2;var o=0;for(i=0;i<2;++i){for(var s=0,a=0;a<3;++a)s|=e[r++]<<8*a;for(a=0;a<8;++a){var B=s>>3*a&7;Hi[o++]=B}}for(i=0;i<16;++i)t[4*i+3]=wi[Hi[i]]}(t,e,r)}var gi=new Uint16Array(4);\n/*! @brief Decompresses an image in memory.\n\n @param rgba\t\tStorage for the decompressed pixels.\n @param width\tThe width of the source image.\n @param height\tThe height of the source image.\n @param blocks\tThe compressed DXT blocks.\n @param flags\tCompression flags.\n\n The decompressed pixels will be written as a contiguous array of width*height\n 16 rgba values, with each component as 1 byte each. In memory this is:\n\n { r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height\n\n The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,\n however, DXT1 will be used by default if none is specified. All other flags\n are ignored.\n\n Internally this function calls squish::Decompress for each block.\n */\nvar Vi=new Uint8Array(64);function Xi(t){}Xi.decode=function(t,e,r,n,A){if(null!=t&&null!=n&&0!=r&&0!=e){var i=0;(i=A>11||5===A?bi:32|Gi)&Gi&&32&i?function(t,e,r,n){for(var A=t,i=0,o=0,s=0,a=0,B=0,E=0,c=0,C=0,f=0,l=e/4,u=r/4,_=0;_<u;_++)for(var D=0;D<l;D++)s=4*((u-_)*l+D),gi[0]=n[s],gi[1]=n[s+1],a=31&gi[0],B=2016&gi[0],E=63488&gi[0],c=31&gi[1],C=2016&gi[1],f=63488&gi[1],gi[2]=5*a+3*c>>3|5*B+3*C>>3&2016|5*E+3*f>>3&63488,gi[3]=5*c+3*a>>3|5*C+3*B>>3&2016|5*f+3*E>>3&63488,i=n[s+2],A[o=4*_*e+4*D]=gi[3&i],A[o+1]=gi[i>>2&3],A[o+2]=gi[i>>4&3],A[o+3]=gi[i>>6&3],A[o+=e]=gi[i>>8&3],A[o+1]=gi[i>>10&3],A[o+2]=gi[i>>12&3],A[o+3]=gi[i>>14],i=n[s+3],A[o+=e]=gi[3&i],A[o+1]=gi[i>>2&3],A[o+2]=gi[i>>4&3],A[o+3]=gi[i>>6&3],A[o+=e]=gi[i>>8&3],A[o+1]=gi[i>>10&3],A[o+2]=gi[i>>12&3],A[o+3]=gi[i>>14]}(t,e,r,n):function(t,e,r,n,A,i){for(var o=0!=(A&Gi)?8:16,s=0,a=0;a<r;a+=4)for(var B=0;B<e;B+=4){Ki(Vi,n,s,A);for(var E=0,c=0;c<4;++c)for(var C=0;C<4;++C){var f=B+C,l=a+c;if(f<e&&l<r){var u=4*(e*(r-l)+f);if(i===Ui.ABGR||i===Ui.BGRA)t[u+2]=Vi[E++],t[u+1]=Vi[E++],t[u+0]=Vi[E++],t[u+3]=Vi[E++];else for(var _=0;_<4;++_)t[u++]=Vi[E++]}else E+=4}s+=o}}(t,e,r,n,i,A)}};var Ji=function(){var t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),e=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var r,n="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";WebAssembly.validate(t)&&(n="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");var A=WebAssembly.instantiate(function(t){for(var r=new Uint8Array(t.length),n=0;n<t.length;++n){var A=t.charCodeAt(n);r[n]=A>96?A-71:A>64?A-65:A>47?A+4:A>46?63:62}var i=0;for(n=0;n<t.length;++n)r[i++]=r[n]<60?e[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,i)}(n),{}).then((function(t){(r=t.instance).exports.__wasm_call_ctors()}));function i(t,e,n,A,i,o){var s=r.exports.sbrk,a=n+3&-4,B=s(a*A),E=s(i.length),c=new Uint8Array(r.exports.memory.buffer);c.set(i,E);var C=t(B,n,A,E,i.length);if(0==C&&o&&o(B,a,A),e.set(c.subarray(B,B+n*A)),s(B-s(0)),0!=C)throw new Error("Malformed buffer data: "+C)}var o={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},s={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:A,supported:!0,decodeVertexBuffer:function(t,e,n,A,s){i(r.exports.meshopt_decodeVertexBuffer,t,e,n,A,r.exports[o[s]])},decodeIndexBuffer:function(t,e,n,A){i(r.exports.meshopt_decodeIndexBuffer,t,e,n,A)},decodeIndexSequence:function(t,e,n,A){i(r.exports.meshopt_decodeIndexSequence,t,e,n,A)},decodeGltfBuffer:function(t,e,n,A,a,B){i(r.exports[s[a]],t,e,n,A,r.exports[o[B]])}}}();function vi(){}vi.s3tc=!0,vi.pvrtc=!1,vi.etc1=!1;const Zi={SV_Unkown:0,SV_Standard:1,SV_Compressed:2,SV_DracoCompressed:3},xi={Standard:0,Draco:1,MeshOpt:2},ki={0:Uint32Array.BYTES_PER_ELEMENT,1:Float32Array.BYTES_PER_ELEMENT,2:Float64Array.BYTES_PER_ELEMENT},Wi={LUMINANCE_8:1,LUMINANCE_16:2,ALPHA:3,ALPHA_4_LUMINANCE_4:4,LUMINANCE_ALPHA:5,RGB_565:6,BGR565:7,RGB:10,BGR:11,ARGB:12,ABGR:13,BGRA:14,WEBP:25,RGBA:28,DXT1:17,DXT2:18,DXT3:19,DXT4:20,DXT5:21,CRN_DXT5:26,STANDARD_CRN:27},Qi={SVC_Vertex:1,SVC_Normal:2,SVC_VertexColor:4,SVC_SecondColor:8,SVC_TexutreCoord:16,SVC_TexutreCoordIsW:32},ji={Invalid:0,Position:1,PositionW:2,Normal:4,Tangent:8,FirstTexcoord:16,SecondTexcoord:32,Color:64,SecondColor:128,Custom0:512,Custom1:1024};function Yi(t,e,r){r=t.byteLength;return t=t.subarray(0,0+r),new TextDecoder("utf-8").decode(t)}function zi(t,e,r){let n=e.getUint32(r,!0);return r+=Uint32Array.BYTES_PER_ELEMENT,{string:Yi(new Uint8Array(t,r,n)),bytesOffset:r+=n,length:n}}function qi(t,e,r,n){let A={},i=[],o=new Array(16);for(let t=0;t<16;t++)o[t]=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;A.matrix=o,A.skeletonNames=i;let s=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let n=0;n<s;n++){let n=zi(t,e,r);i.push(n.string),r=n.bytesOffset}return n.push(A),r}function $i(t,e,r,n,A){let i={};i.rangeList=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,i.rangeMode=e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT;let o={};o.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,o.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,o.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;let s=e.getFloat64(r,!0);if(r+=Float64Array.BYTES_PER_ELEMENT,i.boundingSphere={center:o,radius:s},3===A){const t={};t.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,t.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,t.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;const n={};n.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,n.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,n.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;const A={};A.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,A.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,A.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;const o={};o.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,o.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,o.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,i.obb={xExtent:n,yExtent:A,zExtent:o,obbCenter:t}}let a=zi(t,e,r),B=a.string;r=a.bytesOffset;let E=B.indexOf("Geometry");if(-1!==E){let t=B.substring(E);B=B.replace(t,"")}i.childTile=B,i.geodes=[];let c=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let n=0;n<c;n++)r=qi(t,e,r,i.geodes);if(n.push(i),3===A){r=zi(t,e,r).bytesOffset}return r}function to(t,e,r,n){let A=e.getUint32(r,!0);if(n.verticesCount=A,(r+=Uint32Array.BYTES_PER_ELEMENT)<=0)return r;let i=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;let o=e.getUint16(r,!0);o=i*Float32Array.BYTES_PER_ELEMENT,r+=Uint16Array.BYTES_PER_ELEMENT;let s=A*i*Float32Array.BYTES_PER_ELEMENT,a=new Uint8Array(t,r,s);r+=s;let B=n.vertexAttributes,E=n.attrLocation;return E.aPosition=B.length,B.push({index:E.aPosition,typedArray:a,componentsPerAttribute:i,componentDatatype:5126,offsetInBytes:0,strideInBytes:o,normalize:!1}),r}function eo(t,e,r,n){let A=e.getUint32(r,!0);if(r+=Uint32Array.BYTES_PER_ELEMENT,A<=0)return r;let i=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;let o=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;let s=A*i*Float32Array.BYTES_PER_ELEMENT,a=new Uint8Array(t,r,s);r+=s;let B=n.vertexAttributes,E=n.attrLocation;return E.aNormal=B.length,B.push({index:E.aNormal,typedArray:a,componentsPerAttribute:i,componentDatatype:5126,offsetInBytes:0,strideInBytes:o,normalize:!1}),r}function ro(t,e,r,n){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let i,o=n.verticesCount;if(A>0){e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT,r+=2*Uint8Array.BYTES_PER_ELEMENT;let n=A*Uint8Array.BYTES_PER_ELEMENT*4;i=new Uint8Array(t,r,n).slice(0,n),r+=n}else{i=new Uint8Array(4*o);for(let t=0;t<o;t++)i[4*t]=255,i[4*t+1]=255,i[4*t+2]=255,i[4*t+3]=255}let s=n.vertexAttributes,a=n.attrLocation;return a.aColor=s.length,s.push({index:a.aColor,typedArray:i,componentsPerAttribute:4,componentDatatype:5121,offsetInBytes:0,strideInBytes:4,normalize:!0}),n.vertexColor=i,r}function no(t,e,r,n){let A=e.getUint32(r,!0);if(r+=Uint32Array.BYTES_PER_ELEMENT,A<=0)return r;e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT,r+=2*Uint8Array.BYTES_PER_ELEMENT;let i=A*Uint8Array.BYTES_PER_ELEMENT*4,o=new Uint8Array(t,r,i);r+=i;let s=n.vertexAttributes,a=n.attrLocation;return a.aSecondColor=s.length,s.push({index:a.aSecondColor,typedArray:o,componentsPerAttribute:4,componentDatatype:5121,offsetInBytes:0,strideInBytes:4,normalize:!0}),r}function Ao(t,e,r,n){let A=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,r+=Uint16Array.BYTES_PER_ELEMENT;for(let i=0;i<A;i++){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let o=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT;let s=A*o*Float32Array.BYTES_PER_ELEMENT,a=new Uint8Array(t,r,s);r+=s;let B="aTexCoord"+i,E=n.vertexAttributes,c=n.attrLocation;c[B]=E.length,E.push({index:c[B],typedArray:a,componentsPerAttribute:o,componentDatatype:5126,offsetInBytes:0,strideInBytes:o*Float32Array.BYTES_PER_ELEMENT,normalize:!1})}return r}function io(t,e,r,n){let A=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,r+=Uint16Array.BYTES_PER_ELEMENT;let i=n.vertexAttributes,o=n.attrLocation;for(let s=0;s<A;s++){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let s=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT;let a=A*s*Float32Array.BYTES_PER_ELEMENT;if(17===s||29===s){let e=new Uint8Array(t,r,a);n.instanceCount=A,n.instanceMode=s,n.instanceBuffer=e,n.instanceIndex=1;let B,E=s*A*4,c=e.slice(0,E);n.vertexColorInstance=c,17===s?(B=17*Float32Array.BYTES_PER_ELEMENT,o.uv2=i.length,i.push({index:o.uv2,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:0,strideInBytes:B,instanceDivisor:1}),o.uv3=i.length,i.push({index:o.uv3,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:4*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv4=i.length,i.push({index:o.uv4,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:8*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.secondary_colour=i.length,i.push({index:o.secondary_colour,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:12*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv6=i.length,i.push({index:o.uv6,componentsPerAttribute:4,componentDatatype:5121,normalize:!0,offsetInBytes:16*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1})):29===s&&(B=29*Float32Array.BYTES_PER_ELEMENT,o.uv1=i.length,i.push({index:o.uv1,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:0,strideInBytes:B,instanceDivisor:1,byteLength:a}),o.uv2=i.length,i.push({index:o.uv2,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:4*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv3=i.length,i.push({index:o.uv3,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:8*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv4=i.length,i.push({index:o.uv4,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:12*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv5=i.length,i.push({index:o.uv5,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:16*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv6=i.length,i.push({index:o.uv6,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:20*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv7=i.length,i.push({index:o.uv7,componentsPerAttribute:3,componentDatatype:5126,normalize:!1,offsetInBytes:24*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.secondary_colour=i.length,i.push({index:o.secondary_colour,componentsPerAttribute:4,componentDatatype:5121,normalize:!0,offsetInBytes:27*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv9=i.length,i.push({index:o.uv9,componentsPerAttribute:4,componentDatatype:5121,normalize:!0,offsetInBytes:28*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}))}else{let t=A*s;n.instanceBounds=new Float32Array(t);for(let A=0;A<t;A++)n.instanceBounds[A]=e.getFloat32(r+A*Float32Array.BYTES_PER_ELEMENT,!0)}r+=a}return r}function oo(t,e,r,n,A){if(3===A&&(e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT),r=ro(t,e,r=eo(t,e,r=to(t,e,r,n),n),n),3!==A&&(r=no(t,e,r,n)),r=io(t,e,r=Ao(t,e,r,n),n),3===A){r=function(t,e,r,n){const A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let i=0;i<A;i++){const A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const o=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;const s=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;const a=A*o*ki[s],B=new Uint8Array(t,r,a);r+=a;const E=n.vertexAttributes,c=n.attrLocation,C="aCustom"+i;c[C]=E.length,E.push({index:c[C],typedArray:B,componentsPerAttribute:o,componentDatatype:5126,offsetInBytes:0,strideInBytes:0,normalize:!1})}return r}(t,e,r,n);const A=zi(t,e,r);r=A.bytesOffset,n.customVertexAttribute=JSON.parse(A.string);const i="aCustom"+n.customVertexAttribute.TextureCoordMatrix,o="aCustom"+n.customVertexAttribute.VertexWeight;void 0!==n.attrLocation[i]&&(n.attrLocation.aTextureCoordMatrix=n.attrLocation[i],delete n.attrLocation[i]),void 0!==n.attrLocation[o]&&(n.attrLocation.aVertexWeight=n.attrLocation[o],delete n.attrLocation[o]);let s=r%4;s&&(s=4-s),r=function(t,e,r,n){const A=e.getUint32(r,!0);if(r+=Uint32Array.BYTES_PER_ELEMENT,A<=0)return r;const i=e.getUint16(r,!0);return r+=Uint16Array.BYTES_PER_ELEMENT,e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT,r+=A*i*Float32Array.BYTES_PER_ELEMENT}(0,e,r+=s)}return r}function so(t,e,r,n,A,i){let o,s=0;const a=A.vertexAttributes,B=A.attrLocation;switch(e){case ji.Normal:case ji.FirstTexcoord:case ji.SecondTexcoord:s=2*Uint16Array.BYTES_PER_ELEMENT,0!=(16&i)||e!==ji.FirstTexcoord&&e!==ji.SecondTexcoord||(s=2*Float32Array.BYTES_PER_ELEMENT),o=new Uint8Array(t*s);break;case ji.Color:case ji.SecondColor:s=4*Uint8Array.BYTES_PER_ELEMENT,o=new Uint8Array(4*t);break;case ji.Custom0:case ji.Custom1:s=Float32Array.BYTES_PER_ELEMENT*r,o=new Uint8Array(t*r*4);break;default:s=4*Uint16Array.BYTES_PER_ELEMENT,o=new Uint8Array(t*s)}let E,c;switch(Ji.decodeVertexBuffer(o,t,s,n,n.length),e){case ji.Position:B.aPosition=a.length,a.push({index:B.aPosition,typedArray:new Uint16Array(o.buffer,0,o.length/2),componentsPerAttribute:4,componentDatatype:5122,offsetInBytes:0,strideInBytes:0,normalize:!1}),A.verticesCount=t;break;case ji.Normal:B.aNormal=a.length,a.push({index:B.aNormal,typedArray:new Int16Array(o.buffer,0,o.length/2),componentsPerAttribute:2,componentDatatype:5122,offsetInBytes:0,strideInBytes:0,normalize:!1});break;case ji.FirstTexcoord:0==(16&i)?(c=5126,E=new Float32Array(o.buffer,0,o.length/4)):(c=5122,E=new Uint16Array(o.buffer,0,o.length/2)),B.aTexCoord0=a.length,a.push({index:B.aTexCoord0,typedArray:E,componentsPerAttribute:2,componentDatatype:c,offsetInBytes:0,strideInBytes:0,normalize:!1});break;case ji.SecondTexcoord:0==(16&i)?(c=5126,E=new Float32Array(o.buffer,0,o.length/4)):(c=5122,E=new Uint16Array(o.buffer,0,o.length/2)),B.aTexCoord1=a.length,a.push({index:B.aTexCoord1,typedArray:E,componentsPerAttribute:2,componentDatatype:c,offsetInBytes:0,strideInBytes:0,normalize:!1});break;case ji.Color:B.aColor=a.length,a.push({index:B.aColor,typedArray:o,componentsPerAttribute:4,componentDatatype:5121,offsetInBytes:0,strideInBytes:0,normalize:!0});break;case ji.SecondColor:B.aSecondColor=a.length,a.push({index:B.aSecondColor,typedArray:o,componentsPerAttribute:4,componentDatatype:5120,offsetInBytes:0,strideInBytes:0,normalize:!1});break;case ji.Custom0:B.aCustom0=a.length,a.push({index:B.aCustom0,typedArray:new Float32Array(o.buffer,0,o.length/4),componentsPerAttribute:r,componentDatatype:5126,offsetInBytes:0,strideInBytes:0,normalize:!1});break;case ji.Custom1:B.aCustom1=a.length,a.push({index:B.aCustom1,typedArray:new Float32Array(o.buffer,0,o.length/4),componentsPerAttribute:r,componentDatatype:5126,offsetInBytes:0,strideInBytes:0,normalize:!1})}}function ao(t,e,r,n,A){const i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT,n.compressOptions=i;const o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT,n.minVerticesValue={x:0,y:0,z:0,w:0},n.minTexCoordValue=[{x:0,y:0},{x:0,y:0}],n.texCoordCompressConstant=[{x:0,y:0,z:0},{x:0,y:0,z:0}];for(let A=0;A<o;A++){const s=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT,n.vertCompressConstant=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,n.minVerticesValue.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,n.minVerticesValue.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,n.minVerticesValue.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;const a=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const B=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const E=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const c=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const C=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const f=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const l=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const u=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT,n.minTexCoordValue[0].x=E,n.minTexCoordValue[0].y=c,n.minTexCoordValue[1].x=l,n.minTexCoordValue[1].y=u,n.texCoordCompressConstant[0].x=a,n.texCoordCompressConstant[0].y=B,n.texCoordCompressConstant[1].x=C,n.texCoordCompressConstant[1].y=f;const _=e.getInt32(r,!0);r+=Int32Array.BYTES_PER_ELEMENT;for(let A=0;A<_;A++){const A=e.getInt32(r,!0);r+=Int32Array.BYTES_PER_ELEMENT;let o=0;A!==ji.Custom0&&A!==ji.Custom1||(o=e.getInt32(r,!0),r+=Int32Array.BYTES_PER_ELEMENT);const a=e.getInt32(r,!0);r+=Int32Array.BYTES_PER_ELEMENT;const B=new Uint8Array(t,r,a);let E=(r+=Uint8Array.BYTES_PER_ELEMENT*a)%4;E&&(E=4-E),r+=E,so(s,A,o,B,n,i)}let D=zi(t,e,r);r=D.bytesOffset,n.customVertexAttribute=JSON.parse(D.string);let R="aCustom"+n.customVertexAttribute.TextureCoordMatrix,I="aCustom"+n.customVertexAttribute.VertexWeight;void 0!==n.attrLocation[R]&&(n.attrLocation.aTextureCoordMatrix=n.attrLocation[R],A===o-1&&delete n.attrLocation[R]),void 0!==n.attrLocation[I]&&(n.attrLocation.aVertexWeight=n.attrLocation[I],A===o-1&&delete n.attrLocation[I]);let T=r%4;T&&(T=4-T),r+=T}return r}function Bo(t,e,r,n,A){const i=e.getInt32(r,!0);r+=Int32Array.BYTES_PER_ELEMENT;for(let A=0;A<i;A++){const A={},i=e.getInt32(r,!0);if(r+=Int32Array.BYTES_PER_ELEMENT,i<1)continue;const o=e.getInt8(r,!0);r+=Int8Array.BYTES_PER_ELEMENT,e.getInt8(r,!0),r+=Int8Array.BYTES_PER_ELEMENT;const s=e.getInt8(r,!0);r+=Int8Array.BYTES_PER_ELEMENT,e.getInt8(r,!0),r+=Int8Array.BYTES_PER_ELEMENT;const a=e.getInt32(r,!0);let B;r+=Int32Array.BYTES_PER_ELEMENT,13!==s?(B=new Uint8Array(t,r,a),r+=Uint8Array.BYTES_PER_ELEMENT*a):(B=new Uint32Array(t,r,a),r+=Uint32Array.BYTES_PER_ELEMENT*a);let E,c=r%4;c&&(c=4-c),r+=c,13!==s?(E=new Uint8Array(i*Uint32Array.BYTES_PER_ELEMENT),Ji.decodeIndexBuffer(E,i,Uint32Array.BYTES_PER_ELEMENT,B)):E=B;const C=e.getInt32(r,!0);r+=Int32Array.BYTES_PER_ELEMENT,A.indexType=o;const f=0===o?new Uint16Array(i):new Uint32Array(i);A.indicesCount=i;const l=new Uint32Array(E.buffer,E.byteOffset,E.byteLength/4);f.set(l,0),A.indicesTypedArray=f,A.primitiveType=s;for(let n=0;n<C;n++){const n=zi(t,e,r);r=n.bytesOffset,A.materialCode=n.string}n.push(A),c=r%4,c&&(c=4-c),r+=c}return r}function Eo(t,e,r,n){let A=e.getUint32(r,!0);return n.compressOptions=A,r+=Uint32Array.BYTES_PER_ELEMENT,r=(A&Qi.SVC_Vertex)===Qi.SVC_Vertex?function(t,e,r,n){let A=e.getUint32(r,!0);if(n.verticesCount=A,(r+=Uint32Array.BYTES_PER_ELEMENT)<=0)return r;let i=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;let o=e.getUint16(r,!0);o=i*Int16Array.BYTES_PER_ELEMENT,r+=Uint16Array.BYTES_PER_ELEMENT;let s=e.getFloat32(r,!0);r+=Float32Array.BYTES_PER_ELEMENT;let a={};a.x=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,a.y=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,a.z=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,a.w=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,n.vertCompressConstant=s,n.minVerticesValue=a;let B=A*i*Int16Array.BYTES_PER_ELEMENT,E=new Uint8Array(t,r,B);r+=B;let c=n.vertexAttributes,C=n.attrLocation;return C.aPosition=c.length,c.push({index:C.aPosition,typedArray:E,componentsPerAttribute:i,componentDatatype:5122,offsetInBytes:0,strideInBytes:o,normalize:!1}),r}(t,e,r,n):to(t,e,r,n),r=(A&Qi.SVC_Normal)===Qi.SVC_Normal?function(t,e,r,n){let A=e.getUint32(r,!0);if(r+=Uint32Array.BYTES_PER_ELEMENT,A<=0)return r;e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT;let i=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;let o=2*A*Int16Array.BYTES_PER_ELEMENT,s=new Uint8Array(t,r,o);r+=o;let a=n.vertexAttributes,B=n.attrLocation;return B.aNormal=a.length,a.push({index:B.aNormal,typedArray:s,componentsPerAttribute:2,componentDatatype:5122,offsetInBytes:0,strideInBytes:i,normalize:!1}),r}(t,e,r,n):eo(t,e,r,n),r=no(t,e,r=ro(t,e,r,n),n),r=(A&Qi.SVC_TexutreCoord)===Qi.SVC_TexutreCoord?function(t,e,r,n){n.texCoordCompressConstant=[],n.minTexCoordValue=[];let A=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,r+=Uint16Array.BYTES_PER_ELEMENT;for(let i=0;i<A;i++){let A=e.getUint8(r,!0);r+=Uint8Array.BYTES_PER_ELEMENT,r+=3*Uint8Array.BYTES_PER_ELEMENT;let o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let s=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT;let a=e.getFloat32(r,!0);r+=Float32Array.BYTES_PER_ELEMENT,n.texCoordCompressConstant.push(a);let B={};B.x=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,B.y=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,B.z=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,B.w=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,n.minTexCoordValue.push(B);let E=o*s*Int16Array.BYTES_PER_ELEMENT,c=new Uint8Array(t,r,E),C=(r+=E)%4;0!==C&&(r+=4-C);let f="aTexCoord"+i,l=n.vertexAttributes,u=n.attrLocation;if(u[f]=l.length,l.push({index:u[f],typedArray:c,componentsPerAttribute:s,componentDatatype:5122,offsetInBytes:0,strideInBytes:s*Int16Array.BYTES_PER_ELEMENT,normalize:!1}),A){E=o*Float32Array.BYTES_PER_ELEMENT;let e=new Uint8Array(t,r,E);r+=E,n.texCoordZMatrix=!0,f="aTexCoordZ"+i,u[f]=l.length,l.push({index:u[f],typedArray:e,componentsPerAttribute:1,componentDatatype:5126,offsetInBytes:0,strideInBytes:Float32Array.BYTES_PER_ELEMENT,normalize:!1})}}return r}(t,e,r,n):Ao(t,e,r,n),(A&Qi.SVC_TexutreCoordIsW)===Qi.SVC_TexutreCoordIsW&&(n.textureCoordIsW=!0),r=io(t,e,r,n)}function co(t,e,r,n,A){let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let o=0;o<i;o++){let i={};3===A&&(e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT);let o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let s=e.getUint8(r,!0);r+=Uint8Array.BYTES_PER_ELEMENT,e.getUint8(r,!0),r+=Uint8Array.BYTES_PER_ELEMENT;let a=e.getUint8(r,!0);if(r+=Uint8Array.BYTES_PER_ELEMENT,r+=Uint8Array.BYTES_PER_ELEMENT,o>0){let e,n=null;1===s||3===s?(e=o*Uint32Array.BYTES_PER_ELEMENT,n=new Uint8Array(t,r,e)):(e=o*Uint16Array.BYTES_PER_ELEMENT,n=new Uint8Array(t,r,e),o%2!=0&&(e+=2)),i.indicesTypedArray=n,r+=e}i.indicesCount=o,i.indexType=s,i.primitiveType=a;let B=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let n=0;n<B;n++){let n=zi(t,e,r),A=n.string;r=n.bytesOffset,i.materialCode=A}if(0!==r%4){r+=4-r%4}n.push(i)}return r}let Co={red:0,green:0,blue:0,alpha:0},fo=65536;function lo(t,e,r){let n=t.vertexAttributes,A=t.attrLocation,i=n.length;A[1===r?"instanceId":"batchId"]=i,n.push({index:i,typedArray:e,componentsPerAttribute:1,componentDatatype:5126,offsetInBytes:0,strideInBytes:0,instanceDivisor:r})}vi.parseBuffer=function(t){let e=0,r={version:void 0,groupNode:void 0,geoPackage:{},matrials:void 0,texturePackage:{}},n=new DataView(t);r.version=n.getFloat32(e,!0),e+=Float32Array.BYTES_PER_ELEMENT,r.version>=2&&(n.getUint32(e,!0),e+=Uint32Array.BYTES_PER_ELEMENT),r.version>=3&&(n.getUint32(e,!0),e+=Uint32Array.BYTES_PER_ELEMENT),n.getUint32(e,!0),e+=Uint32Array.BYTES_PER_ELEMENT;let A=function(t,e){let r=new Uint8Array(t,e);return di.inflate(r).buffer}(t,e);n=new DataView(A),e=0;let i=n.getUint32(e,!0);return e+=Uint32Array.BYTES_PER_ELEMENT,e=function(t,e,r,n){let A={},i=[];e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;let o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let A=0;A<o;A++)r=$i(t,e,r,i,n.version);A.pageLods=i;let s=r%4;return 0!==s&&(r+=4-s),n.groupNode=A,r}(A,n,e,r),e=function(t,e,r,n,A){e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let o=0;o<i;o++){3===A&&(e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT);let i=zi(t,e,r),o=i.string;r=i.bytesOffset;let s=i.length%4;0!==s&&(r+=4-s);let a=e.getUint32(r,!0);if(r+=Int32Array.BYTES_PER_ELEMENT,3===A)switch(a){case xi.Standard:a=Zi.SV_Standard;break;case xi.Draco:a=Zi.SV_DracoCompressed;break;case xi.MeshOpt:a=Zi.SV_Compressed}let B={vertexAttributes:[],attrLocation:{},instanceCount:0,instanceMode:0,instanceIndex:-1};a===Zi.SV_Standard?r=oo(t,e,r,B,A):a===Zi.SV_Compressed&&3===A?r=ao(t,e,r,B):a===Zi.SV_Compressed&&(r=Eo(t,e,r,B));let E,c=[];r=a===Zi.SV_Compressed&&3===A?Bo(t,e,r,c):co(t,e,r,c,A),2===c.length&&13===c[1].primitiveType&&c[1].indicesCount>=3&&(E=S3MEdgeProcessor.createEdgeDataByIndices(B,c[1])),n[o]={vertexPackage:B,arrIndexPackage:c,edgeGeometry:E},3===A&&(e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT)}3!==A&&(r+=e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT);return r}(A,n,e,r.geoPackage,r.version),e=function(t,e,r,n){e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let i=0;i<A;i++){let A=zi(t,e,r),i=A.string;r=A.bytesOffset;let o=A.length%4;0!==o&&(r+=4-o),e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;let s=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let a=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let B=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let E=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let c=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let C=new Uint8Array(t,r,E);r+=E;let f=c===Wi.RGB||c===Wi.BGR?33776:33779;if(22===B&&(f=36196),!vi.s3tc&&(33776===f||33779===f)){let t=new Uint8Array(s*a*4);Xi.decode(t,s,a,C,c),C=t,B=0,f=c===Wi.RGB||c===Wi.RGB?273:4369}n[i]={id:i,width:s,height:a,compressType:B,nFormat:c,internalFormat:f,arrayBufferView:C}}return r}(A,n,e,r.texturePackage),e=function(t,e,r,n){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let i=Yi(new Uint8Array(t,r,A));return r+=A,n.materials=JSON.parse(i),r}(A,n,e,r),function(t,e,r,n,A,i){if(3===i&&(n=e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT),1==(1&n)){e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;let n=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let o=0;o<n;o++){let n=zi(t,e,r),o=n.string;r=n.bytesOffset;let s=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let a={};if(A[o].pickInfo=a,-1==A[o].vertexPackage.instanceIndex){let t=new Float32Array(A[o].vertexPackage.verticesCount);for(let n=0;n<s;n++){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let o=[];for(let A=0;A<i;A++){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT,t.fill(n,A,A+i),o.push({vertexColorOffset:A,vertexColorCount:i,batchId:n})}a[A]=o}lo(A[o].vertexPackage,t,void 0)}else{let t=A[o].vertexPackage.instanceCount,n=A[o].vertexPackage.instanceBuffer,B=A[o].vertexPackage.instanceMode,E=new Float32Array(t),c=[];for(let t=0;t<s;t++){let t=e.getUint32(r,!0);c.push(t),r+=Uint32Array.BYTES_PER_ELEMENT;let n=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let t=0;t<n;t++)e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT,3===i&&(e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT)}let C=17===B?16:28;C*=Float32Array.BYTES_PER_ELEMENT;for(let e=0;e<t;e++){E[e]=e;let t=e*B*Float32Array.BYTES_PER_ELEMENT+C;Cesium.Color.unpack(n,t,Co);let r=2===i?c[e]:Co.red+256*Co.green+Co.blue*fo;void 0===a[r]&&(a[r]={vertexColorCount:1,instanceIds:[],vertexColorOffset:e}),a[r].instanceIds.push(e)}lo(A[o].vertexPackage,E,1)}}}}(A,n,e,i,r.geoPackage,r.version),r};class uo{constructor(t,e,{width:r,height:n,colorDepth:A,format:i}){if(this.format=i,this.offset=e,this.depth=A,this.stride=\n/*!\n * decode-bmp\n * https://github.com/LinusU/decode-bmp\n * MIT License\n */\nfunction(t){const e=t%4;return e?t+4-e:t}(r*this.depth/8),this.size=this.stride*n,this.data=t.subarray(this.offset,this.offset+this.size),this.size!==this.data.byteLength)throw new Error("Truncated bitmap data")}get(t,e,r){const n=this.format.indexOf(r);if(1===this.depth){return(this.data[e*this.stride+(t/8|0)]&1<<7-t%8*1)>>7-t%8*1}if(2===this.depth){return(this.data[e*this.stride+(t/4|0)]&3<<6-t%4*2)>>>6-t%4*2}if(4===this.depth){return(this.data[e*this.stride+(t/2|0)]&15<<4-t%2*4)>>>4-t%2*4}return this.data[e*this.stride+t*(this.depth/8)+n]}}function _o(t,e,r,n,{width:A=0,height:i=0,icon:o=!1}={}){const s=new DataView(e,r,n);let a,B,E,c,C;o?(a=s.getUint32(0,!0),B=s.getUint32(4,!0)/1|0,E=s.getUint32(8,!0)/2|0,c=s.getUint16(14,!0),C=s.getUint32(32,!0)):(!function(t){if(19778!==t)throw new Error(\`Invalid magic byte 0x${o}t.toString(16)}\`)}(s.getUint16(0,!0)),a=14+s.getUint32(14,!0),B=s.getUint32(18,!0),E=s.getUint32(22,!0),c=s.getUint16(28,!0),C=s.getUint32(46,!0)),0===C&&c<=8&&(C=1<<c);const f=0===B?A:B,l=0===E?i:E,u=new Uint8Array(s.buffer,s.byteOffset+a,s.byteLength-a),_=t.byteLength===f*l*4,D=C?function(t,e,r,{width:n,height:A,colorDepth:i,colorCount:o,icon:s}){if(8!==i&&4!==i&&2!==i&&1!==i)throw new Error(\`A color depth of ${o}i} is not supported\`);const a=new uo(r,0,{width:o,height:1,colorDepth:32,format:"BGRA"}),B=new uo(r,a.offset+a.size,{width:n,height:A,colorDepth:i,format:"C"}),E=s?new uo(r,B.offset+B.size,{width:n,height:A,colorDepth:1,format:"A"}):null,c=t;let C=0;for(let t=0;t<A;t++)for(let r=0;r<n;r++){const n=B.get(r,A-t-1,"C");c[C++]=a.get(n,0,"R"),c[C++]=a.get(n,0,"G"),c[C++]=a.get(n,0,"B"),e&&(c[C++]=E&&E.get(r,A-t-1,"A")?0:255)}return c}(t,_,u,{width:f,height:l,colorDepth:c,colorCount:C,icon:o}):function(t,e,r,{width:n,height:A,colorDepth:i,icon:o}){if(32!==i&&24!==i)throw new Error(\`A color depth of ${o}i} is not supported\`);const s=new uo(r,0,{width:n,height:A,colorDepth:i,format:"BGRA"}),a=24===i&&o?new uo(r,s.offset+s.size,{width:n,height:A,colorDepth:1,format:"A"}):null,B=t;let E=0;for(let t=0;t<A;t++)for(let r=0;r<n;r++)B[E++]=s.get(r,A-t-1,"R"),B[E++]=s.get(r,A-t-1,"G"),B[E++]=s.get(r,A-t-1,"B"),e&&(B[E++]=32===i?s.get(r,A-t-1,"A"):a&&a.get(r,A-t-1,"A")?0:255);return B}(t,_,u,{width:f,height:l,colorDepth:c,icon:o});return D}var Do=Object.freeze({DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGBA_ASTC_4x4_WEBGL:37808,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGBA_BPTC_UNORM:36492,HALF_FLOAT_OES:36193,DOUBLE:5130,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,COLOR:6144,DEPTH:6145,STENCIL:6146,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,MAX_3D_TEXTURE_SIZE:32883,UNSIGNED_INT_2_10_10_10_REV:33640,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,MAX_TEXTURE_LOD_BIAS:34045,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,VERTEX_ATTRIB_ARRAY_INTEGER:35069,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,UNSIGNED_INT_10F_11F_11F_REV:35899,RGB9_E5:35901,UNSIGNED_INT_5_9_9_9_REV:35902,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,RASTERIZER_DISCARD:35977,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,UNSIGNED_INT_24_8:34042,DEPTH24_STENCIL8:35056,UNSIGNED_NORMALIZED:35863,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,MAX_SAMPLES:36183,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,VERTEX_ARRAY_BINDING:34229,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,SIGNED_NORMALIZED:36764,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,INVALID_INDEX:4294967295,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,SAMPLER_BINDING:35097,RGB10_A2UI:36975,INT_2_10_10_10_REV:36255,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497,TEXTURE_IMMUTABLE_FORMAT:37167,MAX_ELEMENT_INDEX:36203,TEXTURE_IMMUTABLE_LEVELS:33503,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047}),Ro={UNSIGNED_BYTE:Do.UNSIGNED_BYTE,UNSIGNED_SHORT:Do.UNSIGNED_SHORT,UNSIGNED_INT:Do.UNSIGNED_INT,FLOAT:Do.FLOAT,HALF_FLOAT:Do.HALF_FLOAT_OES,UNSIGNED_INT_24_8:Do.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:Do.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:Do.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:Do.UNSIGNED_SHORT_5_6_5,toWebGLConstant:function(t,e){switch(t){case Ro.UNSIGNED_BYTE:return Do.UNSIGNED_BYTE;case Ro.UNSIGNED_SHORT:return Do.UNSIGNED_SHORT;case Ro.UNSIGNED_INT:return Do.UNSIGNED_INT;case Ro.FLOAT:return Do.FLOAT;case Ro.HALF_FLOAT:return e.webgl2?Do.HALF_FLOAT:Do.HALF_FLOAT_OES;case Ro.UNSIGNED_INT_24_8:return Do.UNSIGNED_INT_24_8;case Ro.UNSIGNED_SHORT_4_4_4_4:return Do.UNSIGNED_SHORT_4_4_4_4;case Ro.UNSIGNED_SHORT_5_5_5_1:return Do.UNSIGNED_SHORT_5_5_5_1;case Ro.UNSIGNED_SHORT_5_6_5:return Ro.UNSIGNED_SHORT_5_6_5}},isPacked:function(t){return t===Ro.UNSIGNED_INT_24_8||t===Ro.UNSIGNED_SHORT_4_4_4_4||t===Ro.UNSIGNED_SHORT_5_5_5_1||t===Ro.UNSIGNED_SHORT_5_6_5},sizeInBytes:function(t){switch(t){case Ro.UNSIGNED_BYTE:return 1;case Ro.UNSIGNED_SHORT:case Ro.UNSIGNED_SHORT_4_4_4_4:case Ro.UNSIGNED_SHORT_5_5_5_1:case Ro.UNSIGNED_SHORT_5_6_5:case Ro.HALF_FLOAT:return 2;case Ro.UNSIGNED_INT:case Ro.FLOAT:case Ro.UNSIGNED_INT_24_8:return 4}},validate:function(t){return t===Ro.UNSIGNED_BYTE||t===Ro.UNSIGNED_SHORT||t===Ro.UNSIGNED_INT||t===Ro.FLOAT||t===Ro.HALF_FLOAT||t===Ro.UNSIGNED_INT_24_8||t===Ro.UNSIGNED_SHORT_4_4_4_4||t===Ro.UNSIGNED_SHORT_5_5_5_1||t===Ro.UNSIGNED_SHORT_5_6_5}},Io=Object.freeze(Ro),To={DEPTH_COMPONENT:Do.DEPTH_COMPONENT,DEPTH_STENCIL:Do.DEPTH_STENCIL,ALPHA:Do.ALPHA,RGB:Do.RGB,RGBA:Do.RGBA,LUMINANCE:Do.LUMINANCE,LUMINANCE_ALPHA:Do.LUMINANCE_ALPHA,RGB_DXT1:Do.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:Do.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:Do.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:Do.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:Do.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:Do.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:Do.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:Do.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:Do.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:Do.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:Do.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:Do.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:Do.COMPRESSED_RGBA_BPTC_UNORM,componentsLength:function(t){switch(t){case To.RGB:return 3;case To.RGBA:return 4;case To.LUMINANCE_ALPHA:return 2;case To.ALPHA:case To.LUMINANCE:default:return 1}},validate:function(t){return t===To.DEPTH_COMPONENT||t===To.DEPTH_STENCIL||t===To.ALPHA||t===To.RGB||t===To.RGBA||t===To.LUMINANCE||t===To.LUMINANCE_ALPHA||t===To.RGB_DXT1||t===To.RGBA_DXT1||t===To.RGBA_DXT3||t===To.RGBA_DXT5||t===To.RGB_PVRTC_4BPPV1||t===To.RGB_PVRTC_2BPPV1||t===To.RGBA_PVRTC_4BPPV1||t===To.RGBA_PVRTC_2BPPV1||t===To.RGBA_ASTC||t===To.RGB_ETC1||t===To.RGB8_ETC2||t===To.RGBA8_ETC2_EAC||t===To.RGBA_BC7},isColorFormat:function(t){return t===To.ALPHA||t===To.RGB||t===To.RGBA||t===To.LUMINANCE||t===To.LUMINANCE_ALPHA},isDepthFormat:function(t){return t===To.DEPTH_COMPONENT||t===To.DEPTH_STENCIL},isCompressedFormat:function(t){return t===To.RGB_DXT1||t===To.RGBA_DXT1||t===To.RGBA_DXT3||t===To.RGBA_DXT5||t===To.RGB_PVRTC_4BPPV1||t===To.RGB_PVRTC_2BPPV1||t===To.RGBA_PVRTC_4BPPV1||t===To.RGBA_PVRTC_2BPPV1||t===To.RGBA_ASTC||t===To.RGB_ETC1||t===To.RGB8_ETC2||t===To.RGBA8_ETC2_EAC||t===To.RGBA_BC7},isDXTFormat:function(t){return t===To.RGB_DXT1||t===To.RGBA_DXT1||t===To.RGBA_DXT3||t===To.RGBA_DXT5},isPVRTCFormat:function(t){return t===To.RGB_PVRTC_4BPPV1||t===To.RGB_PVRTC_2BPPV1||t===To.RGBA_PVRTC_4BPPV1||t===To.RGBA_PVRTC_2BPPV1},isASTCFormat:function(t){return t===To.RGBA_ASTC},isETC1Format:function(t){return t===To.RGB_ETC1},isETC2Format:function(t){return t===To.RGB8_ETC2||t===To.RGBA8_ETC2_EAC},isBC7Format:function(t){return t===To.RGBA_BC7},compressedTextureSizeInBytes:function(t,e,r){switch(t){case To.RGB_DXT1:case To.RGBA_DXT1:case To.RGB_ETC1:case To.RGB8_ETC2:return Math.floor((e+3)/4)*Math.floor((r+3)/4)*8;case To.RGBA_DXT3:case To.RGBA_DXT5:case To.RGBA_ASTC:case To.RGBA8_ETC2_EAC:return Math.floor((e+3)/4)*Math.floor((r+3)/4)*16;case To.RGB_PVRTC_4BPPV1:case To.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(e,8)*Math.max(r,8)*4+7)/8);case To.RGB_PVRTC_2BPPV1:case To.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(e,16)*Math.max(r,8)*2+7)/8);case To.RGBA_BC7:return Math.ceil(e/4)*Math.ceil(r/4)*16;default:return 0}},textureSizeInBytes:function(t,e,r,n){var A=To.componentsLength(t);return Io.isPacked(e)&&(A=1),A*Io.sizeInBytes(e)*r*n},alignmentInBytes:function(t,e,r){var n=To.textureSizeInBytes(t,e,r,1)%4;return 0===n?4:2===n?2:1},createTypedArray:function(t,e,r,n){var A=Io.sizeInBytes(e);return new(A===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:A===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:A===Float32Array.BYTES_PER_ELEMENT&&e===Io.FLOAT?Float32Array:Uint32Array)(To.componentsLength(t)*r*n)},flipY:function(t,e,r,n,A){if(1===A)return t;for(var i=To.createTypedArray(e,r,n,A),o=To.componentsLength(e),s=n*o,a=0;a<A;++a)for(var B=a*n*o,E=(A-a-1)*n*o,c=0;c<s;++c)i[E+c]=t[B+c];return i},toInternalFormat:function(t,e,r){if(!r.webgl2)return t;if(t===To.DEPTH_STENCIL)return Do.DEPTH24_STENCIL8;if(t===To.DEPTH_COMPONENT){if(e===Io.UNSIGNED_SHORT)return Do.DEPTH_COMPONENT16;if(e===Io.UNSIGNED_INT)return Do.DEPTH_COMPONENT24}if(e===Io.FLOAT)switch(t){case To.RGBA:return Do.RGBA32F;case To.RGB:return Do.RGB32F;case To.RG:return Do.RG32F;case To.R:return Do.R32F}if(e===Io.HALF_FLOAT)switch(t){case To.RGBA:return Do.RGBA16F;case To.RGB:return Do.RGB16F;case To.RG:return Do.RG16F;case To.R:return Do.R16F}return t}},ho=Object.freeze(To);const Fo=4369,Po=6410;function Lo(t,e,r,n,A,i){const o=function(t,e,r,n){let A=t.length,i=r,o=n,s=0;for(;i>0&&o>0;){if(s+=ho.compressedTextureSizeInBytes(e,i,o),i>>=1,o>>=1,0===i&&0===o)break;i=Math.max(i,1),o=Math.max(o,1)}return s===A}(t,r,A,i);if(!o)return null;const s=r===Po||r===Fo;let a=0,B=A,E=i;const c=[];do{let n=ho.compressedTextureSizeInBytes(r,B,E),A=new Uint8Array(t.buffer,e+a,n);c.push(A),B=Math.max(B>>1,1),E=Math.max(E>>1,1),a+=n}while(a<t.byteLength&&o);return{flipY:s,mipmap:c}}const Oo={SVC_Vertex:1,SVC_Normal:2,SVC_VertexColor:4,SVC_SecondColor:8,SVC_TexutreCoord:16,SVC_TexutreCoordIsW:32};function yo(t,e){const r={};if(t.compressOptions){let e=t.compressOptions;(e&Oo.SVC_Vertex)===Oo.SVC_Vertex&&(r.COMPRESS_VERTEX=1),(e&Oo.SVC_Normal)===Oo.SVC_Normal&&(r.COMPRESS_NORMAL=1),(e&Oo.SVC_VertexColor)===Oo.SVC_VertexColor&&(r.COMPRESS_COLOR=1),(e&Oo.SVC_TexutreCoord)===Oo.SVC_TexutreCoord&&(r.COMPRESS_TEXCOORD=1)}e.push(r)}function Mo(t){if(t&&ht(t)){const e=[];for(const r in t)e.push(t[r]);return e}return t}function No(t,e){const r={},n=t.compressOptions;(n&Oo.SVC_Vertex)===Oo.SVC_Vertex&&(r.decode_position_min=Mo(t.minVerticesValue),r.decode_position_normConstant=Mo(t.vertCompressConstant)),(n&Oo.SVC_Normal)===Oo.SVC_Normal&&(r.normal_rangeConstant=Mo(t.normalRangeConstant)),(n&Oo.SVC_TexutreCoord)===Oo.SVC_TexutreCoord&&(t.texCoordCompressConstant.length>0&&(r.decode_texCoord0_min=Mo(t.minTexCoordValue[0]),r.decode_texCoord0_normConstant=Mo(t.texCoordCompressConstant[0]),r.decode_texCoord0_vNormConstant=Mo(t.texCoordCompressConstant[0])),t.texCoordCompressConstant.length>1&&(r.decode_texCoord1_min=Mo(t.minTexCoordValue[1]),r.decode_texCoord1_normConstant=Mo(t.texCoordCompressConstant[1]),r.decode_texCoord1_vNormConstant=Mo(t.texCoordCompressConstant[1])),t.texCoordCompressConstant.length>2&&(r.decode_texCoord2_min=Mo(t.minTexCoordValue[2]),r.decode_texCoord2_normConstant=Mo(t.texCoordCompressConstant[2])),t.texCoordCompressConstant.length>3&&(r.decode_texCoord3_min=Mo(t.minTexCoordValue[3]),r.decode_texCoord3_normConstant=Mo(t.texCoordCompressConstant[3])),t.texCoordCompressConstant.length>4&&(r.decode_texCoord4_min=Mo(t.minTexCoordValue[4]),r.decode_texCoord4_normConstant=Mo(t.texCoordCompressConstant[4])),t.texCoordCompressConstant.length>5&&(r.decode_texCoord5_min=Mo(t.minTexCoordValue[5]),r.decode_texCoord5_normConstant=Mo(t.texCoordCompressConstant[5])),t.texCoordCompressConstant.length>6&&(r.decode_texCoord6_min=Mo(t.minTexCoordValue[6]),r.decode_texCoord6_normConstant=Mo(t.texCoordCompressConstant[6])),t.texCoordCompressConstant.length>7&&(r.decode_texCoord7_min=Mo(t.minTexCoordValue[7]),r.decode_texCoord7_normConstant=Mo(t.texCoordCompressConstant[7]))),e.push(r)}function So(t,e){var r,n,A,i=t.bytesOffset,o=vi.parseBuffer(t.buffer,i),s=o.geoPackage,a=o.groupNode.pageLods,B=[],E=[],c=[],C=[],f=[],l=[],u=[],_=[],D=[];if(!a[0].geodes[0])return null;var R=a[0].geodes[0].matrix;const I=[];for(var T={},h=0;h<o.materials.material.length;h++)T[o.materials.material[h].material.id]=o.materials.material[h].material;var F=Number.MAX_VALUE,P=Number.MAX_VALUE,L=Number.MAX_VALUE,O=Number.MIN_VALUE,y=Number.MIN_VALUE,M=Number.MIN_VALUE;for(var N in s){var S=s[N].vertexPackage;r=S.verticesCount;var d=S.vertexAttributes[0].typedArray.buffer,U=S.vertexAttributes[0].typedArray.byteOffset,G=S.vertexAttributes[0].componentsPerAttribute;A=new(ue(S.vertexAttributes[0].componentDatatype))(d,S.vertexAttributes[0].offsetInBytes+U,r*G);const t=Mo(S.minVerticesValue)||[0,0,0],e=Mo(S.vertCompressConstant)||0;for(let n=0;n<r;n++){var m=A[n*G]*e+t[0],b=A[n*G+1]*e+t[1],p=A[n*G+2]*e+t[2];F=Math.min(F,m),P=Math.min(P,b),L=Math.min(L,p),O=Math.max(O,m),y=Math.max(y,b),M=Math.max(M,p)}B.push(A),Zo("aColor",S,d,r,C),Zo("aTexCoord0",S,d,r,c),Zo("aTextureCoordMatrix",S,d,r,I),Zo("batchId",S,d,r,f),yo(S,u),No(S,_);var w=s[N].arrIndexPackage[0].indicesTypedArray,H=w.byteLength/s[N].arrIndexPackage[0].indicesCount;n=new(4===H?Uint32Array:2===H?Uint16Array:Uint8Array)(w.buffer,(s[N].arrIndexPackage[0].bytesOffset||0)+w.byteOffset,s[N].arrIndexPackage[0].indicesCount),E.push(n),n.length,D.push(r);var K=s[N].arrIndexPackage[0].materialCode;l.push(T[K])}var g=[F,P,L],V=[O,y,M];const X=function(t,e,r,n,A,i,o,s,a,B,E,c,C,f,l,u,_,D){let R=0;for(const t in a)a[t].width*a[t].height*4>R&&(R=a[t].width*a[t].height*4);(!mo||R>mo)&&(Go=new Uint8ClampedArray(R+Uo),mo=R);const I=[],T={magFilter:9729,minFilter:9729,wrapS:10497,wrapT:10497},h={},F={},P=[],L=[],O=[];for(let B=0;B<r.length;B++){const R=e[B],y=t[B],M=r[B],N=A&&A[B]&&A[B],S=i&&i[B],d=n&&n[B]&&n[B],U=o&&o[B]&&o[B],G=s&&s[B]&&s[B],m={POSITION:{array:M,componentType:_e(M.constructor),count:y,byteOffset:M.byteOffset,byteStride:0,byteLength:M.byteLength,type:De(M.length/y),itemSize:M.length/y,name:"POSITION",min:E,max:c}};P.indexOf(M.buffer)<0&&P.push(M.buffer),N&&xo(m,"TEXCOORD_0",N,y,P),S&&xo(m,"TextureCoordMatrix",S,y,P),d&&xo(m,"NORMAL",d,y,P),U&&xo(m,"COLOR_0",U,y,P),G&&xo(m,"_BATCHID",G,y,P);const b={attributes:m,material:B,compressDefines:l[B],compressUniforms:u[B],indices:{array:R.slice(),itemSize:1,byteLength:R.byteLength,byteOffset:0,byteStride:0,name:R,count:R.length,componentType:5123},mode:4};P.push(b.indices.array.buffer);const p={primitives:[b],index:B};F[B]=p;const w={mesh:B,nodeIndex:B,matrix:D};h[B]=w,L.push({nodes:[w]});const H=f[B],K={uFillForeColor:[1,1,1,1]};let g=H.ambient;K.ambientColor=[g.r,g.g,g.b,g.a];let V=H.diffuse;K.uDiffuseColor=[V.r,V.g,V.b,V.a];let X=H.specular;K.specularColor=[X.r,X.g,X.b,X.a],K.shininess=H.shininess,K.bTransparentSorting=H.transparentsorting;let J=H.textureunitstates;if(J.length){K.uTexMatrix=J[0].textureunitstate.texmodmatrix;const t=a[J[0].textureunitstate.id];if(K.uTexture0Width=t.width,J[1]){const t=a[J[1].textureunitstate.id];K.uTexture1Width=t.width}}O.push({pbrMetallicRoughness:{baseColorFactor:[.8,.8,.8,1],metallicFactor:0,roughnessFactor:.5},extensions:{KHR_techniques_webgl:{technique:0,values:K}}}),I.push(wo(B,f,C,a,_).then((t=>{if(!t)return null;const{array:e,mipmap:r,width:n,height:A,format:i,flipY:o}=t;if(e&&P.indexOf(e.buffer)<0&&P.push(e.buffer),r)for(let t=0;t<r.length;t++)e&&P.indexOf(r[t].buffer)<0&&P.push(r[t].buffer);let s=T;return r&&(s={magFilter:T.magFilter,minFilter:9987,wrapS:T.wrapS,wrapT:T.wrapT}),{materialIndex:B,image:{mipmap:r,array:e,flipY:!!o,width:n,height:A,mimeType:"image/bmp"},sampler:s,format:i,source:B}})))}return Promise.all(I).then((t=>{t=t.filter((t=>!!t));for(let e=0;e<t.length;e++){const{materialIndex:r}=t[e];let n="uTexture";O[r].extensions.KHR_techniques_webgl.values.uTexture&&(n="uTexture2"),O[r].extensions.KHR_techniques_webgl.values[n]={"index":e,"texCoord":r},delete t[e].materialIndex}return{transferables:P,gltf:{"asset":{"generator":"S3M","version":"2.0"},"scene":0,"scenes":L,"nodes":h,"meshes":F,"materials":O,"skins":[],"animations":null,"textures":t,"transferables":[{},{},{},{},{}]}}}))}(D,E,B,null,c,I,C,f,o.texturePackage,0,g,V,[],l,u,_,e,R);return X.then((({gltf:t,transferables:e})=>({gltf:t,featureTable:{"BATCH_LENGTH":0},transferables:e,pageLods:a})))}vi.multiplyByPoint=function(t,e,r){var n=e.x,A=e.y,i=e.z,o=t[0]*n+t[4]*A+t[8]*i+t[12],s=t[1]*n+t[5]*A+t[9]*i+t[13],a=t[2]*n+t[6]*A+t[10]*i+t[14];return r.x=o,r.y=s,r.z=a,r};const Uo=122;let Go,mo=0;let bo=!1;if("undefined"!=typeof OffscreenCanvas){let t;try{t=new OffscreenCanvas(2,2).getContext("2d",{willReadFrequently:!0})}catch(Un){}t&&"undefined"!=typeof createImageBitmap&&(bo=!0)}const po={};function wo(t,e,r,n,A){const i=Go,o=Uo;return new Promise((function(r){!function(t){if(e[t].textureunitstates[0]){var s=e[t].textureunitstates[0].textureunitstate.id,a=n[s],B=a.arrayBufferView,E=a.nFormat,c=a.internalFormat;if(function(t){return t===vo.RGB_DXT1||t===vo.RGBA_DXT1||t===vo.RGBA_DXT3||t===vo.RGBA_DXT5||t===vo.RGB_PVRTC_4BPPV1||t===vo.RGB_PVRTC_2BPPV1||t===vo.RGBA_PVRTC_4BPPV1||t===vo.RGBA_PVRTC_2BPPV1||t===vo.RGBA_ASTC||t===vo.RGB_ETC1||t===vo.RGB8_ETC2||t===vo.RGBA8_ETC2_EAC||t===vo.RGBA_BC7}(c)&&a.width===a.height){const t=Lo(B,B.byteOffset,c,0,a.width,a.height);if(t){const{mipmap:e,flipY:n}=t;return void r({format:c,mipmap:e,flipY:n,width:a.width,height:a.height})}}let C;C=E>Ui.BGR||E===Ui.LUMINANCE_ALPHA?o+a.width*a.height*4:o/2+a.width*a.height,Xi.decode(i.subarray(o),a.width,a.height,B,E),function(t,e,r){var n=r*(4*e+e%4),A=n+o,i=new DataView(t),o=0;i.setUint16(o,19778,!0),o+=2,i.setUint32(o,A,!0),o+=4,i.setUint32(o,0,!0),o+=4,i.setUint32(o,122,!0),o+=4,i.setUint32(o,108,!0),o+=4,i.setUint32(o,e,!0),o+=4,i.setUint32(o,r,!0),o+=4,i.setUint16(o,1,!0),o+=2,i.setUint16(o,32,!0),o+=2,i.setUint32(o,this.compress,!0),o+=4,i.setUint32(o,n,!0),o+=4,i.setUint32(o,2835,!0),o+=4,i.setUint32(o,2835,!0),o+=4,i.setUint8(o,0,!0),o+=4,i.setUint32(o,0,!0),o+=4,i.setUint32(o,16711680,!0),o+=4,i.setUint32(o,65280,!0),o+=4,i.setUint32(o,255,!0),o+=4,i.setUint32(o,4278190080,!0),o+=4,i.setUint32(o,1466527264,!0),o+=4}(i.buffer,a.width,a.height);let{width:f,height:l}=a;Ho(f)||(f=Ko(f)),Ho(l)||(l=Ko(l));const u=A;let _;u&&(f=Math.min(u,f),l=Math.min(u,l));let D=6408;const R=a.width*a.height*4;!bo||f===a.width&&l===a.height?(_=new Uint8Array(3*R/4),D=6407):(po[R]||(po[R]=new Uint8Array(R)),_=po[R]),_=_o(_,i.buffer,0,C),!bo||f===a.width&&l===a.height||(_=function(t,e,r,n,A){go||(go=new OffscreenCanvas(2,2),Vo=go.getContext("2d"),Xo=new OffscreenCanvas(2,2),Jo=Xo.getContext("2d",{willReadFrequently:!0}));const i=new ImageData(new Uint8ClampedArray(t.buffer),e,r);return go.width=e,go.height=r,Vo.putImageData(i,0,0),Xo.width=n,Xo.height=A,Jo.drawImage(go,0,0,n,A),Jo.getImageData(0,0,n,A).data}(_,a.width,a.height,f,l)),_.buffer===(po[R]&&po[R].buffer)&&(_=new Uint8Array(_)),r({array:_,width:f,height:l,format:D})}else r(null)}(t)}))}function Ho(t){return 0==(t&t-1)&&0!==t}function Ko(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}let go,Vo,Xo,Jo;const vo={RGB_DXT1:33776,RGBA_DXT1:33777,RGBA_DXT3:33778,RGBA_DXT5:33779,RGB_PVRTC_4BPPV1:35840,RGB_PVRTC_2BPPV1:35841,RGBA_PVRTC_4BPPV1:35842,RGBA_PVRTC_2BPPV1:35843,RGBA_ASTC:37808,RGB_ETC1:36196,RGB8_ETC2:37492,RGBA8_ETC2_EAC:37496,RGBA_BC7:36492};function Zo(t,e,r,n,A){var i=e.attrLocation[t];if(i){const t=e.vertexAttributes[i];if(t.typedArray.buffer!==r)A.push(t.typedArray);else{var o=t.componentsPerAttribute;var s=new(ue(t.componentDatatype))(r,t.offsetInBytes+t.typedArray.byteOffset,n*o);A.push(s)}}else A.push(void 0)}function xo(t,e,r,n,A){t[e]={array:r,componentType:_e(r.constructor),count:n,byteOffset:r.byteOffset,byteStride:0,byteLength:r.byteLength,type:De(r.length/n),itemSize:r.length/n,name:e},A.indexOf(r.buffer)<0&&A.push(r.buffer)}var ko=542327876,Wo=131072,Qo=4,jo=ls("DXT1"),Yo=ls("DXT3"),zo=ls("DXT5"),qo=ls("DX10"),$o=116,ts=512,es=3,rs=2,ns=31,As=0,is=1,os=2,ss=3,as=4,Bs=7,Es=20,cs=21,Cs=28,fs=function(t){var e,r,n=new Int32Array(t,0,ns);if(n[As]!==ko)throw new Error("Invalid magic number in DDS header");if(!n[Es]&Qo)throw new Error("Unsupported format, must contain a FourCC code");var A=n[cs];switch(A){case jo:e=8,r="dxt1";break;case Yo:e=16,r="dxt3";break;case zo:e=16,r="dxt5";break;case $o:r="rgba32f";break;case qo:var i=new Uint32Array(t.slice(128,148));r=i[0];var o=i[1];if(i[2],i[3],i[4],o!==es||r!==rs)throw new Error("Unsupported DX10 texture format "+r);r="rgba32f";break;default:throw new Error("Unsupported FourCC code: "+(s=A,String.fromCharCode(255&s,s>>8&255,s>>16&255,s>>24&255)))}var s;var a=n[os],B=1;a&Wo&&(B=Math.max(1,n[Bs]));var E=!1;n[Cs]&ts&&(E=!0);var c,C=n[as],f=n[ss],l=n[is]+4,u=C,_=f,D=[];A===qo&&(l+=20);if(E)for(var R=0;R<6;R++){if("rgba32f"!==r)throw new Error("Only RGBA32f cubemaps are supported");C=u,f=_;for(var I=Math.log(C)/Math.log(2)+1,T=0;T<I;T++)c=C*f*16,D.push({offset:l,length:c,shape:[C,f]}),T<B&&(l+=c),C=Math.floor(C/2),f=Math.floor(f/2)}else for(T=0;T<B;T++)c=Math.max(4,C)/4*Math.max(4,f)/4*e,D.push({offset:l,length:c,shape:[C,f]}),l+=c,C=Math.floor(C/2),f=Math.floor(f/2);return{shape:[u,_],images:D,format:r,flags:a,cubemap:E}};function ls(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}const us=Math.PI/180,_s=6378137*Math.PI/180,Ds=85.0511287798;function Rs(t,e,r){if("EPSG:3857"===r)return function(t,e){const r=Ds,n=e[0],A=Math.max(Math.min(r,e[1]),-r);let i;i=0===A?0:Math.log(Math.tan((90+A)*us/2))/us;return t[0]=n*_s,t[1]=i*_s,t}(t,e);if("EPSG:4326"===r||"EPSG:4490"===r||"identity"===r)return Is(t,e);if("baidu"===r)return Is(t,e);throw new Error("unsupported projection:"+r)}function Is(t,e){return t[0]=e[0],t[1]=e[1],t}const Ts=i([]),hs=Fe().draco,Fs=Fe().ktx2,Ps={"pbrMetallicRoughness":{"baseColorFactor":[.5,.5,.5,1],"metallicFactor":0,"roughnessFactor":.5}},Ls={"position":{name:"POSITION",accessor:{"componentType":5126,"type":"VEC3"}},"normal":{name:"NORMAL",accessor:{"componentType":5126,"type":"VEC3"}},"uv0":{name:"TEXCOORD_0",accessor:{"componentType":5126,"type":"VEC2"}},"color":{name:"COLOR_0",accessor:{"componentType":5121,"type":"VEC4"}},"uv-region":{name:"uvRegion",accessor:{"componentType":5123,"type":"VEC4"}},"feature-index":{name:"_BATCHID",accessor:{"componentType":5125,"type":"SCALAR"}},"faceRange":{name:"faceRange",accessor:{"componentType":5125,"type":"VEC2"}}};function Os(t,e,r,n){const A=[],o=[],s=[];for(let e=0;e<t.meshes.length;e++){const{geometry:r,material:n}=t.meshes[e];let i=Y.getArrayBuffer(r.url);i.xhr.url=r.url,s.push(i.xhr);const a=i.then((t=>({buffer:t})));A.push(a);const B=[];if(ms(n,B),B.length){const t=B.map((t=>{const e=Y.getArrayBuffer(t.url);return e.xhr.url=t.url,s.push(e.xhr),e.then((e=>e&&e.status?null:{buffer:e,mimeType:t.mimeType,format:t.format}))}));A.push(...t)}o[e]=B.length}const a=Promise.all(A).then((A=>{for(let t=0;t<A.length;t++)if(!A[t]||!A[t].buffer)return Promise.resolve(null);const s=[];let a=0;for(let t=0;t<o.length;t++){const e=o[t];s.push({geoBuffer:{data:A[a].buffer.data},textureBuffers:A.slice(a+1,e+a+1).map((t=>({data:t.buffer.data,mimeType:t.mimeType,format:t.format})))}),a+=1+e}const B=function(t,e,r,n,A){const o={asset:{generator:"i3s",version:"2.0"},extensions:{},scene:0,scenes:[{nodes:[]}],nodes:{},meshes:{},materials:[],skins:[],animations:null,textures:[],transferables:[]},s=[];for(let a=0;a<t.meshes.length;a++){let B,{geometry:E,material:c}=t.meshes[a];const C=e[a].geoBuffer.data;if(!C)continue;B=gs(C)?Ms(o,a,E,C,t.transform,t.center,A):Ss(o,a,E,C,t.transform,t.center,A),s.push(B),o.nodes[a]={mesh:a,nodeIndex:a,matrix:i([])},o.scenes[0].nodes[a]=o.nodes[a],c||(c=Ps);const f=Us(a,o,c,e[a].textureBuffers,r,n);s.push(f)}return Promise.all(s).then((()=>({gltf:o,featureTable:{BATCH_LENGTH:0},transferables:o.transferables})))}(t,s,e,n,r);return B}));return a.xhr=s,a}const ys={"magFilter":9728,"minFilter":9728,"wrapR":33071,"wrapS":33071,"wrapT":33071};function Ms(t,e,r,n,A,i,o){const s=r.info.compressedAttributes.attributes.reduce(((t,e,r)=>{const n=Ls[e];if(!n)return t;return t[n.name||e]=r,t}),{});return hs(n,{attributes:s,metadatas:{"POSITION":[{name:"i3s-scale_x",type:"double"},{name:"i3s-scale_y",type:"double"}]},useUniqueIDs:!1,skipAttributeTransform:!1}).then((r=>ds(r,t,e,A,i,o)))}var Ns={position:function(t,e,r){const n=3*t.vertexCount,A=new Float32Array(e,r,n);return t.position={array:A,componentType:5126,itemSize:3,count:n/3,meta:{"i3s-scale_x":1,"i3s-scale_y":1},type:"VEC3"},r+=4*n},normal:function(t,e,r){var n=3*t.vertexCount;const A=new Float32Array(e,r,n);return t.normal={array:A,componentType:5126,itemSize:3,count:n/3,type:"VEC3"},r+=4*n},uv0:function(t,e,r){var n=2*t.vertexCount;const A=new Float32Array(e,r,n);return t.uv0={array:A,componentType:5126,itemSize:2,count:n/2,type:"VEC2"},r+=4*n},color:function(t,e,r){var n=4*t.vertexCount;const A=new Uint8Array(e,r,n);return t.color={array:A,componentType:5121,itemSize:4,count:n/4,type:"VEC4"},r+=n},featureId:function(t,e,r){return r+=8*t.featureCount},id:function(t,e,r){return r+=8*t.featureCount},faceRange:function(t,e,r){var n=2*t.featureCount;const A=new Uint32Array(e,r,n);return t.faceRange={array:A,componentType:5125,itemSize:2,count:n/2,type:"VEC2"},r+=4*n},uvRegion:function(t,e,r){var n=4*t.vertexCount;const A=new Uint16Array(e,r,n);return t["uv-region"]={array:A,componentType:5123,itemSize:4,count:n/4,type:"VEC4"},r+=2*n},region:function(t,e,r){var n=4*t.vertexCount;const A=new Uint16Array(e,r,n);return t["uv-region"]={array:A,componentType:5123,itemSize:4,count:n/4,type:"VEC4"},r+=2*n}};function Ss(t,e,r,n,A,i,o){const s={vertexCount:0},a=new DataView(n);try{var B=0;s.vertexCount=a.getUint32(B,1),B+=4,s.featureCount=a.getUint32(B,1),B+=4;const t=r.info.ordering?null:r.info;if(t){const e=[];for(const r in t)"offset"!==r&&""!==r&&e.push(r);for(var E=0;E<e.length;E++)Ns[e[E]]?B=Ns[e[E]](s,n,B):console.error("Unknown decoder for",e[E])}else{const t=r.info;let e=t.ordering,A=t.featureAttributeOrder;const i=null;i&&i.geometryData&&i.geometryData[0]&&i.geometryData[0].params;for(var c=0;c<e.length;c++){var C=Ns[e[c]];C||console.log(e[c]),B=C(s,n,B)}for(var f=0;f<A.length;f++){var l=Ns[A[f]];l||console.log(A[f]),B=l(s,n,B)}}}catch(t){}s.scale_x=1,s.scale_y=1;const u={};for(const t in s){const e=Ls[t]&&Ls[t].name;e&&(u[e]=s[t])}if(s.faceRange){const t=s.faceRange.array,e=t.length/2,r=(_=e)<=255?Uint8Array:_<=65535?Uint16Array:Uint32Array,n=new r(u.POSITION.array.length/3);for(let e=0;e<t.length-1;e+=2){const r=e/2,A=t[e],i=t[e+1];for(let t=A;t<=i;t++)n[3*t]=r,n[3*t+1]=r,n[3*t+2]=r}u._BATCHID={componentType:_e(r),array:n,itemSize:1,count:n.length,type:"SCALAR"}}var _;return ds({attributes:u},t,e,A,i,o)}function ds(t,e,r,n,A,i){const o={attributes:t.attributes,material:r,indices:t.indices,mode:4};!function(t){const e=t.array,r=t.meta&&t.meta["i3s-scale_x"],n=t.meta&&t.meta["i3s-scale_y"];if(r&&n&&(1!==r||1!==n))for(let t=0;t<e.length;t+=3)e[t]*=r.value,e[t+1]*=n.value}(t.attributes.POSITION);const s=function(t,e,r,n){const A=r;let i,o=[0,0,0,1],s=[0,0];const a=Rs([],r,n);a[2]=r[2];const B=e&&E(Ts,e);return ge(t,(t=>(o[0]=t[0],o[1]=t[1],o[2]=t[2],B||(o=L(o,o,e)),A&&_(o,o,A),Rs(s,o,n),i=o[2],t[0]=s[0]-a[0],t[1]=s[1]-a[1],t[2]=i-a[2],t))),a}(t.attributes.POSITION,n,A,i);e.meshes[r]={primitives:[o],index:r},e.extensions.MAPTALKS_RTC={projCenter:s},e.extensions.CESIUM_RTC={rtcCoord:A};for(const r in t.attributes)Ks(e.transferables,t.attributes[r].array.buffer);return t.indices&&Ks(e.transferables,t.indices.array.buffer),o}function Us(t,e,r,n,A,i){const o=n.map((t=>function(t,e,r,n,A){if("dds"===e){const e=fs(t),n=e.images.map((e=>new Uint8Array(t,e.offset,e.length))),A="dxt1"===e.format?33777:33779;return Promise.resolve({image:{mipmap:n,width:e.shape[0],height:e.shape[1],mimeType:r},sampler:ys,format:A})}if("png"===e||"jpg"===e)return function(t,e){bs||(bs=new OffscreenCanvas(2,2),ps=bs.getContext("2d",{willReadFrequently:!0}));const r=new Blob([new Uint8Array(t)]);return createImageBitmap(r).then((t=>{let{width:r,height:n}=t;ws(r)||(r=Hs(r)),ws(n)||(n=Hs(n));const A=e;A&&(r=Math.min(A,r),n=Math.min(A,n)),bs.width=r,bs.height=n,ps.drawImage(t,0,0,r,n),t.close();const i=ps.getImageData(0,0,r,n);return{width:r,height:n,array:new Uint8Array(i.data)}})).catch((()=>({width:2,height:2,array:new Uint8Array(4)})))}(t,A).then((t=>{t.mimeType=r;return{image:t,sampler:ys,format:6408}}));if("ktx2"===e)return Fs(t,n).then((t=>(t.mimeType=r,{image:t,sampler:ys,format:t.format})))}(t.data,t.format,t.mimeType,A,i).then((t=>{if(t.image)if(t.image.array)Ks(e.transferables,t.image.array.buffer);else if(t.image.mipmap)for(let r=0;r<t.image.mipmap.length;r++)Ks(e.transferables,t.image.mipmap[r].buffer);return t}))));return Promise.all(o).then((n=>{Gs(t,e,r,n)}))}function Gs(t,e,r,n){const A=JSON.parse(JSON.stringify(r)),i=e.textures;n.ptr||(n.ptr=0);for(const t in r)r[t]&&r[t].url?(i.push(n[n.ptr++]),A[t]={index:i.length-1},void 0!==r[t].factor&&(A[t].scale=r[t].factor)):ht(r[t])&&(A[t]=Gs(-1,e,r[t],n));return t>=0&&(e.materials[t]=A),A}function ms(t,e){for(const r in t)t[r]&&t[r].url?e.push({url:t[r].url,mimeType:t[r].mimeType,format:t[r].format}):ht(t[r])&&ms(t[r],e)}let bs,ps;function ws(t){return 0==(t&t-1)&&0!==t}function Hs(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Ks(t,e){e&&(t.indexOf(e)>=0||t.push(e))}function gs(t){const e=new Uint8Array(t,0,5);return e[0]==="D".charCodeAt()&&e[1]==="R".charCodeAt()&&e[2]==="A".charCodeAt()&&e[3]==="C".charCodeAt()&&e[4]==="O".charCodeAt()}const Vs=[1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1],Xs=[0,0,1,0,0,1,0,0,-1,0,0,0,0,0,0,1],Js="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;let vs,Zs,xs=!1;if("undefined"!=typeof OffscreenCanvas){try{Zs=new OffscreenCanvas(2,2).getContext("2d",{willReadFrequently:!0})}catch(Un){}Zs&&"undefined"!=typeof createImageBitmap&&(xs=!0)}const ks=i([]),Ws=[0,0,0],Qs=[],js=[],Ys=[],zs=[];class qs{constructor(t,e,r,n){this.id=t,this.options=e,this.Pt=this.requestImage.bind(this),this.Lt=r,this.Ot={},n(null,{},[])}yt(t){this.Mt||(this.i=t,this.Nt=new Ne,this.Mt=new Pe(this.Pt,lt,t),this.St=new Le(this.Pt,lt,t))}requestImage(t,e){xs?fetch(t).then((t=>t.blob())).then((t=>createImageBitmap(t))).then((t=>{vs.width=t.width,vs.height=t.height,Zs.drawImage(t,0,0);const r=Zs.getImageData(0,0,vs.width,vs.height);e(null,{width:t.width,height:t.height,data:new Uint8Array(r.data)})})):this.Lt("requestImage",{url:t},null,e)}loadTile(t,e){this.yt(t.supportedFormats);const r=t.url,n=t.arraybuffer;if(function(t){return t.indexOf("i3s:")>=0}(r)){const n=t.i3sInfo,A=this.options.services[t.rootIdx].maxTextureSize||1024,i=Os(n,t.supportedFormats,this.options.projection,A);return i.then((t=>{if(delete this.Ot[r],!t)return void e({status:404,url:r,i3sInfo:n});if(!Object.keys(t.gltf.meshes).length)return void e({status:404,url:r,i3sInfo:n});t.gltf.url=r;const{transferables:A}=t;t.magic="b3dm",e(null,t,A)})),void(this.Ot[r]=i.xhr)}if(n){delete this.Ot[r];const A=new DataView(n),i=vt(A,0);if("{"===i[0]||" "===i[0]||"<"===i[0]){const A=function(t,e,r){if(Js){const n=new Uint8Array(t,e,r);return Js.decode(n)}return yt(new Uint8Array(t,e,r))}(n,0,n.byteLength),i=JSON.parse(A);this.dt(t.rootIdx,i,n,r,e)}else{const o=A.getFloat32(0,!0);1===o||2===o||3===o?this.Ut(n,r,t,e):this.Gt(n,r,t,i,e)}}else{const n=this.options.services[t.rootIdx];let A=n.urlParams;A&&(A=(r.indexOf("?")>0?"&":"?")+A);const i=r.replace(/\\+/g,"%2B");let o=Y.getArrayBuffer(i+(A||""),n.fetchOptions);const s=o.xhr;o=o.then((n=>{delete this.Ot[r],n&&n.status?e(n):(t.arraybuffer=n&&n.data,this.loadTile(t,e))})).catch((t=>{delete this.Ot[r],e(t)})),this.Ot[r]=s}}Gt(t,e,r,n,A){const i=this.options.services[r.rootIdx];if("b3dm"===n){this.Mt.load(e,t,0,0,{maxTextureSize:i.maxTextureSize||1024}).then((t=>{if(t.error)return void A(t);const{content:e,transferables:n}=this.bt(t,r);A(null,e,n)})).catch((t=>{A(t)}))}else if("pnts"===n){const n=r.transform;this.Nt.load(e,t).then((t=>{const{content:e,transferables:i}=this.wt(t,n,r.rootIdx);A(null,e,i)}))}else if("i3dm"===n){const n=r.transform;this.St.load(e,t,0,0,{maxTextureSize:i.maxTextureSize||1024}).then((t=>{const{content:e,transferables:i}=this.wt(t,n,r.rootIdx);A(null,e,i)}))}else if("cmpt"===n){new de(this.Pt,lt,this.i,i.maxTextureSize||1024).load(e,t,0,0,{maxTextureSize:i.maxTextureSize||1024}).then((t=>{const{content:e,transferables:n}=this.Ht(t,r);A(null,e,n)})).catch((t=>{A(t)}))}}Ut(t,e,r,n){So({buffer:t,bytesOffset:0},this.options.services[r.rootIdx].maxTextureSize||1024).then((t=>{t.gltf.url=e;const{content:A,transferables:i}=this.bt(t,r);if(A.magic="b3dm",t.pageLods){const e=this.Kt(t.pageLods);e.length&&(A.children=e)}n(null,A,i)}))}Kt(t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];if(!n.childTile)continue;const A={boundingVolume:{sphere:[n.boundingSphere.center.x,n.boundingSphere.center.y,n.boundingSphere.center.z,n.boundingSphere.radius]},content:{uri:n.childTile},geometricError:n.boundingSphere.radius/n.rangeList*16,refine:"REPLACE"};e.push(A)}return e}dt(t,e,r,n,A){return e.dataType&&e.position?void A(null,Je(e)):(e.capabilities,void A(null,e))}Ht(t,e){const{tiles:r}=t,n={magic:"cmpt",content:[]},A=[];for(let t=0;t<r.length;t++){const{magic:i}=r[t];if("b3dm"===i){const{content:i,transferables:o}=this.bt(r[t],e);ra(A,o),n.content.push(i)}else if("i3dm"===i||"pnts"===i){const{transform:i,rootIdx:o}=e,{content:s,transferables:a}=this.wt(r[t],i,o);ra(A,a),n.content.push(s)}else if("cmpt"===i){const{content:i,transferables:o}=this.Ht(r[t],e);ra(A,o),n.content.push(i)}}return{content:n,transferables:A}}bt(t,e){const{gltf:r,transferables:n,featureTable:A}=t,i=function(t){if(!t||!t.meshes)return!1;const e="visited";let r=1;const n=[];for(const A in t.meshes){const i=t.meshes[A],{primitives:o}=i;if(o)for(let t=0;t<o.length;t++){const A=o[t].attributes&&o[t].attributes.POSITION;if(!A||!A.array)continue;A.array.buffer[e]||(A.array.buffer[e]=r++);const i=r-1+"-"+(A.byteOffset||0);if(n.indexOf(i)>=0)return!0;n.push(i)}}return!1}(r);return this.gt(t.gltf),t.gltf.asset||(t.gltf.asset={}),i?(t.gltf.asset.sharePosition=!0,this.Vt(r,A,e.upAxis,e.transform)):this.Xt(r,A,e.upAxis,e.transform),delete t.transferables,{content:t,transferables:n}}wt(t,e,r){const{featureTable:A}=t,i=t.pnts||t.i3dm;let o=A&&A.RTC_CENTER||[0,0,0];if(A.EAST_NORTH_UP&&!i.NORMAL_UP&&!i.NORMAL_UP_OCT32P){const e=new Float32Array(3*i.POSITION.array.length),r=[],A=[],s=[];ge(i.POSITION,((t,i)=>{_(s,t,o),ae(s,null,r),n(A,r);!function(t,e){t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8]}(e.subarray(9*i,9*(i+1)),A)})),i.INSTANCE_ROTATION={byteStride:0,byteOffset:0,itemSize:9,componentType:5126,array:e},t.transferables.push(e.buffer)}const s={xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0,hmin:1/0,hmax:-1/0};ta(i.POSITION.array,3,o,ks,s);const a=ea(s),B=l([],a),E=[1/0,1/0,1/0],c=[-1/0,-1/0,-1/0];ge(i.POSITION,(t=>{t[0]=t[0]+o[0]-B[0],t[1]=t[1]+o[1]-B[1],t[2]=t[2]+o[2]-B[2],t[0]<E[0]&&(E[0]=t[0]),t[1]<E[1]&&(E[1]=t[1]),t[2]<E[2]&&(E[2]=t[2]),t[0]>c[0]&&(c[0]=t[0]),t[1]>c[1]&&(c[1]=t[1]),t[2]>c[2]&&(c[2]=t[2])})),i.POSITION.min=E,i.POSITION.max=c,e&&L(a,a,e);const C=this.Jt(a);t.rtcCenter=B,t.rtcCoord=C,t.rootIdx=r;const f=t.transferables;return delete t.transferables,{content:t,transferables:f}}gt(t){if(!Array.isArray(t.textures))return;const e=t.textures;for(let t=0;t<e.length;t++){const r=e[t].image&&e[t].image.array;if(r&&r.length){const n=r[0],A=r[1],i=r[2],o=r[3];let s=!0;for(let t=4;t<r.length;t+=4)if(r[t]!==n||r[t+1]!==A||r[t+2]!==i||r[t+3]!==o){s=!1;break}s&&(e[t].image.color=[n/255,A/255,i/255,o/255],delete e[t].image.array)}}}abortTileLoading(t,e){const r=this.Ot[t.url];if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t].abort();else r&&r.abort&&r.abort();delete this.Ot[t.url],e(null)}vt(t,e,r,n){let A=e&&e.RTC_CENTER||t.extensions&&t.extensions.CESIUM_RTC&&t.extensions.CESIUM_RTC.center,s=Vs;"X"===(r=r&&r.toUpperCase())?s=Xs:"Z"===r&&(s=ks),t.extensions=t.extensions||{},t.extensions.CESIUM_RTC||(t.extensions.CESIUM_RTC={}),A&&(t.extensions.CESIUM_RTC.center=A),t.extensions.MAPTALKS_RTC={};const a={xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0,hmin:1/0,hmax:-1/0};Ue(t,(t=>{if(!(t.attributes&&t.attributes.POSITION))return;const e=i(Qs);t.matrices&&na(e,t.matrices);const r=t.attributes.POSITION.array,B=t.attributes.POSITION.itemSize;o(e,s,e),n&&o(e,n,e),ta(r,B,A||Ws,e,a,t.compressUniforms)}));const B=ea(a);return{rtcCenter:A,modelCenter:B,upAxisTransform:s}}Vt(t,e,r,n){const{modelCenter:A,upAxisTransform:s,rtcCenter:a}=this.vt(t,e,r),B=l([],A);n&&L(A,A,n),t.extensions.CESIUM_RTC.rtcCoord=this.Jt(A),a||(Ue(t,(t=>{if(t.attributes&&t.attributes.POSITION){const e=t.attributes.POSITION;if(e.array.buffer.projected&&e.array.buffer.projected[e.byteOffset])return;const r=i(Qs);t.matrices&&na(r,t.matrices),o(r,s,r);const n=function(t,e){var r=e[0],n=e[1],A=e[2],i=e[3],o=e[4],s=e[5],a=e[6],B=e[7],E=e[8],c=e[9],C=e[10],f=e[11],l=e[12],u=e[13],_=e[14],D=e[15],R=r*s-n*o,I=r*a-A*o,T=r*B-i*o,h=n*a-A*s,F=n*B-i*s,P=A*B-i*a,L=E*u-c*l,O=E*_-C*l,y=E*D-f*l,M=c*_-C*u,N=c*D-f*u,S=C*D-f*_,d=R*S-I*N+T*M+h*y-F*O+P*L;return d?(d=1/d,t[0]=(s*S-a*N+B*M)*d,t[1]=(A*N-n*S-i*M)*d,t[2]=(u*P-_*F+D*h)*d,t[3]=(C*F-c*P-f*h)*d,t[4]=(a*y-o*S-B*O)*d,t[5]=(r*S-A*y+i*O)*d,t[6]=(_*T-l*P-D*I)*d,t[7]=(E*P-C*T+f*I)*d,t[8]=(o*N-s*y+B*L)*d,t[9]=(n*y-r*N-i*L)*d,t[10]=(l*F-u*T+D*R)*d,t[11]=(c*T-E*F-f*R)*d,t[12]=(s*O-o*M-a*L)*d,t[13]=(r*M-n*O+A*L)*d,t[14]=(u*I-l*h-_*R)*d,t[15]=(E*h-c*I+C*R)*d,t):null}(js,r),A=[1/0,1/0,1/0],a=[-1/0,-1/0,-1/0];ge(e,(t=>{L(t,t,r),t[0]=t[0]-B[0],t[1]=t[1]-B[1],t[2]=t[2]-B[2],L(t,t,n),t[0]<A[0]&&(A[0]=t[0]),t[1]<A[1]&&(A[1]=t[1]),t[2]<A[2]&&(A[2]=t[2]),t[0]>a[0]&&(a[0]=t[0]),t[1]>a[1]&&(a[1]=t[1]),t[2]>a[2]&&(a[2]=t[2])})),e.min=A,e.max=a,e.array.buffer.projected||(e.array.buffer.projected={}),e.array.buffer.projected[e.byteOffset]=1}})),t.extensions.CESIUM_RTC.center=B)}Xt(t,e,r,n){const{modelCenter:A,rtcCenter:i}=this.vt(t,e,r,n),o=this.Zt(A);t.extensions.MAPTALKS_RTC.projCenter=o,t.extensions.CESIUM_RTC.rtcCoord=this.Jt(A),Ue(t,(e=>{if(e.attributes&&e.attributes.POSITION){e.attributes.NORMAL&&this.xt(e.attributes.NORMAL,e.matrices,r),e.attributes.TANGENT&&this.xt(e.attributes.TANGENT,e.matrices,r);const{newPositions:A}=this.kt(e.attributes.POSITION,e.matrices,i,t.extensions.MAPTALKS_RTC,r,n,e.compressUniforms);let{componentType:o}=e.attributes.POSITION;5126!==o&&(e.attributes.POSITION.array=new Float32Array(A))}}));for(const e in t.nodes){t.nodes[e].matrix=ks}}Zt(t){0===M(t)?u(Ys,0,0,-6378137):pt(Ys,t);const e=this.options.projection;Rs(zs,Ys,e);const r=Ys[2],n=[];return n[0]=zs[0],n[1]=zs[1],n[2]=r,n}xt(t,e,r){let i;i="Y"===r?Vs:"X"===r?Xs:ks;const o=A([],i);if(na(o,e),E(o,ks))return;const s=n([],o),a=[];ge(t,(t=>(function(t,e,r){var n=e[0],A=e[1],i=e[2];t[0]=n*r[0]+A*r[3]+i*r[6],t[1]=n*r[1]+A*r[4]+i*r[7],t[2]=n*r[2]+A*r[5]+i*r[8]}(a,t,s),h(a,a),l(t,a),a)))}kt(t,e,r,n,A,o,s){if(t.array.buffer.projected&&t.array.buffer.projected[t.byteOffset])return;const a=i([]);na(a,e);const B=this.options.projection;A=A&&A.toUpperCase();const c=r;let C=null;"Y"===A?C=Vs:"X"===A&&(C=Xs);let f=[0,0,0,1],l=[0,0,0],D=[0,0];const R=n.projCenter,I=o&&E(ks,o),T=t.min=t.min||[],h=t.max=t.max||[];u(T,1/0,1/0,1/0),u(h,-1/0,-1/0,-1/0);const F=s||{},{decode_position_min:P,decode_position_normConstant:O}=F;let y=[0,0,0,0],N=1;P&&(y=P),O&&(N=O);const S=[];return ge(t,(t=>{if(f[0]=t[0]*N+y[0],f[1]=t[1]*N+y[1],f[2]=t[2]*N+y[2],f=L(f,f,a),C&&(f=L(f,f,C)),c&&_(f,f,c),o&&!I&&(f=L(f,f,o)),0===M(f)?u(l,0,0,-6378137):pt(l,f),Rs(D,l,B),t instanceof Float32Array)t[0]=D[0]-R[0],t[1]=D[1]-R[1],t[2]=l[2]-R[2];else{const e=D[0]-R[0],r=D[1]-R[1],n=l[2]-R[2];S.push(e),S.push(r),S.push(n),S.push(t[3])}return t[0]<T[0]&&(T[0]=t[0]),t[1]<T[1]&&(T[1]=t[1]),t[2]<T[2]&&(T[2]=t[2]),t[0]>h[0]&&(h[0]=t[0]),t[1]>h[1]&&(h[1]=t[1]),t[2]>h[2]&&(h[2]=t[2]),t})),t.array.buffer.projected||(t.array.buffer.projected={}),t.array.buffer.projected[t.byteOffset]=1,{projCenter:R,newPositions:S}}Jt(t){return 0===M(t)?u([],0,0,-6378137):pt([],t)}onRemove(){}}const $s=[];function ta(t,e,r,n,A,i){const o=i||{},{decode_position_min:s,decode_position_normConstant:a}=o;let B=[0,0,0,0],E=1;s&&(B=s),a&&(E=a);for(let i=0,o=t.length;i<o;i+=e){const{xmin:o,ymin:s,xmax:a,ymax:c,hmin:C,hmax:f}=A;u($s,t[i]*E+B[0],t[i+1]*E+B[1],t[i+2]*E+B[2]),L($s,$s,n);const l=_($s,r,$s);l[0]<o&&(A.xmin=l[0]),l[0]>a&&(A.xmax=l[0]),l[1]<s&&(A.ymin=l[1]),l[1]>c&&(A.ymax=l[1]),e>2&&(l[2]<C&&(A.hmin=l[2]),l[2]>f&&(A.hmax=l[2]))}}function ea(t){const{xmax:e,ymax:r,xmin:n,ymin:A,hmin:i,hmax:o}=t,s=[(n+e)/2,(A+r)/2,(i+o)/2];return e===-1/0&&(s[0]=0),r===-1/0&&(s[1]=0),o===-1/0&&(s[2]=0),isNaN(s[2])&&(s[2]=0),s}function ra(t,e){for(let r=0;r<e.length;r++)t.indexOf(e[r])<0&&t.push(e[r])}function na(t,e){const r=t;for(let t=e.length-1;t>=0;t--)o(r,e[t],r);return r}let Aa=0;class ia{constructor(t){this.workerId=t,this.workers={},this.Wt={}}addLayer({actorId:t,mapId:e,layerId:r,params:n},A){if(this.Qt(e,r))return;const i=this.jt(e,r),o=n.options,s=this.send.bind(this,t);this.workers[i]=new qs(r,o,s,A)}removeLayer({mapId:t,layerId:e},r){const n=this.Qt(t,e),A=this.jt(t,e);delete this.workers[A],n&&n.onRemove(r)}loadTile({mapId:t,layerId:e,params:r},n){const A=this.Qt(t,e);A&&A.loadTile(r,n)}abortTileLoading({mapId:t,layerId:e,params:r},n){const A=this.Qt(t,e);A&&A.abortTileLoading(r,n)}receive(t){const e=t.callback,r=this.Wt[e];delete this.Wt[e],r&&t.error?r(new Error(t.error)):r&&r(null,t.data)}send(t,e,r,n,A){const i=A?\`${o}t}-${o}Aa++}\`:null;A&&(this.Wt[i]=A),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:e,params:r,callback:String(i)},n||[])}jt(t,e){return\`${o}t}-${o}e}\`}Qt(t,e){const r=this.jt(t,e);return this.workers[r]}}t.initialize=function(){},t.onmessage=function(t,e){const r=t.data;this.dispatcher||(this.dispatcher=new ia(t.workerId)),"<response>"===t.type?this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t):this.dispatcher[r.command]({actorId:r.actorId,mapId:r.mapId,layerId:r.layerId,params:r.params},((t,r,n)=>{t instanceof Error&&(t={message:t.message}),e(t,r,n)}))},Object.defineProperty(t,"Yt",{value:!0})}`
6
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("maptalks"),require("@maptalks/gl")):"function"==typeof define&&define.amd?define(["exports","maptalks","@maptalks/gl"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).maptalks=t.maptalks||{},t.maptalks,t.maptalksgl)}(this,(function(t,e,n){"use strict";function r(t){if(t&&t.t)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var i=r(e),o=r(n);const s='function(t){var e="undefined"!=typeof Float32Array?Float32Array:Array;function r(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function n(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function A(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function i(t,e,r){var n=e[0],A=e[1],i=e[2],o=e[3],s=e[4],a=e[5],B=e[6],E=e[7],c=e[8],C=e[9],f=e[10],l=e[11],u=e[12],_=e[13],I=e[14],D=e[15],h=r[0],R=r[1],T=r[2],F=r[3];return t[0]=h*n+R*s+T*c+F*u,t[1]=h*A+R*a+T*C+F*_,t[2]=h*i+R*B+T*f+F*I,t[3]=h*o+R*E+T*l+F*D,h=r[4],R=r[5],T=r[6],F=r[7],t[4]=h*n+R*s+T*c+F*u,t[5]=h*A+R*a+T*C+F*_,t[6]=h*i+R*B+T*f+F*I,t[7]=h*o+R*E+T*l+F*D,h=r[8],R=r[9],T=r[10],F=r[11],t[8]=h*n+R*s+T*c+F*u,t[9]=h*A+R*a+T*C+F*_,t[10]=h*i+R*B+T*f+F*I,t[11]=h*o+R*E+T*l+F*D,h=r[12],R=r[13],T=r[14],F=r[15],t[12]=h*n+R*s+T*c+F*u,t[13]=h*A+R*a+T*C+F*_,t[14]=h*i+R*B+T*f+F*I,t[15]=h*o+R*E+T*l+F*D,t}function o(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function s(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function a(t,e){var r=e[0],n=e[1],A=e[2],i=e[3],o=r+r,s=n+n,a=A+A,B=r*o,E=n*o,c=n*s,C=A*o,f=A*s,l=A*a,u=i*o,_=i*s,I=i*a;return t[0]=1-c-l,t[1]=E+I,t[2]=C-_,t[3]=0,t[4]=E-I,t[5]=1-B-l,t[6]=f+u,t[7]=0,t[8]=C+_,t[9]=f-u,t[10]=1-B-c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function B(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function E(){var t=new e(3);return e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function c(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function C(t,r,n){var A=new e(3);return A[0]=t,A[1]=r,A[2]=n,A}function f(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function l(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function u(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function _(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function I(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function D(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function h(t,e){var r=e[0]-t[0],n=e[1]-t[1],A=e[2]-t[2];return Math.sqrt(r*r+n*n+A*A)}function R(t,e){var r=e[0],n=e[1],A=e[2],i=r*r+n*n+A*A;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i),t}function T(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function F(t,e,r){var n=e[0],A=e[1],i=e[2],o=r[0],s=r[1],a=r[2];return t[0]=A*a-i*s,t[1]=i*o-n*a,t[2]=n*s-A*o,t}function P(t,e,r){var n=e[0],A=e[1],i=e[2],o=r[3]*n+r[7]*A+r[11]*i+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*A+r[8]*i+r[12])/o,t[1]=(r[1]*n+r[5]*A+r[9]*i+r[13])/o,t[2]=(r[2]*n+r[6]*A+r[10]*i+r[14])/o,t}var O=_,L=I,y=c;function M(t,e,r,n,A){return t[0]=e,t[1]=r,t[2]=n,t[3]=A,t}function N(t,e,r){var n=e[0],A=e[1],i=e[2],o=e[3];return t[0]=r[0]*n+r[4]*A+r[8]*i+r[12]*o,t[1]=r[1]*n+r[5]*A+r[9]*i+r[13]*o,t[2]=r[2]*n+r[6]*A+r[10]*i+r[14]*o,t[3]=r[3]*n+r[7]*A+r[11]*i+r[15]*o,t}function S(){var t=new e(4);return e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function d(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function U(t,e,r,n){var A=e[0],i=e[1],o=e[2],s=e[3],a=r[0],B=r[1],E=r[2],c=r[3],C=void 0,f=void 0,l=void 0,u=void 0,_=void 0;return(f=A*a+i*B+o*E+s*c)<0&&(f=-f,a=-a,B=-B,E=-E,c=-c),1-f>1e-6?(C=Math.acos(f),l=Math.sin(C),u=Math.sin((1-n)*C)/l,_=Math.sin(n*C)/l):(u=1-n,_=n),t[0]=u*A+_*a,t[1]=u*i+_*B,t[2]=u*o+_*E,t[3]=u*s+_*c,t}E(),function(){var t,r=(t=new e(4),e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var G,m=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t};E(),C(1,0,0),C(0,1,0),S(),S(),G=new e(9),e!=Float32Array&&(G[1]=0,G[2]=0,G[3]=0,G[5]=0,G[6]=0,G[7]=0),G[0]=1,G[4]=1,G[8]=1;\n/*!\n * @maptalks/gltf-loader v0.83.0\n * LICENSE : UNLICENSED\n * (c) 2016-2023 maptalks.org\n */\nlet b=0;function p(t){return null==t}function w(t){return!p(t)}function H(t){for(let e=1;e<arguments.length;e++){const r=arguments[e];for(const e in r)t[e]=r[e]}return t}function K(t){switch(t){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:return Uint16Array;case 5124:return Int32Array;case 5125:return Uint32Array;case 5126:return Float32Array}throw new Error("unsupported bufferView\'s component type: "+t)}function g(t){return 0===t.indexOf("data:")&&t.indexOf("base64,")>0}function V(t){const e=function(t){return"undefined"!=typeof self?self.atob(t):window.atob(t)}(t.substring(t.indexOf(",")+1)),r=e.length,n=new Uint8Array(r);for(let t=0;t<r;t++)n[t]=e.charCodeAt(t);return n.buffer}const J=[],X=[],v=[],Z=[0,0,0],x=d([]),k=[1,1,1];function W(t,e,r,n,A,i,o){const s=K(o);if((0===A||A===n*s.BYTES_PER_ELEMENT)&&i%s.BYTES_PER_ELEMENT==0){const A=new s(e,i,r*n);return t.set(A),t}0===A&&(A=n*s.BYTES_PER_ELEMENT);const a=new Uint8Array(n*s.BYTES_PER_ELEMENT);for(let o=0;o<r;o++){let r=null;const B=new Uint8Array(e,A*o+i,n*s.BYTES_PER_ELEMENT);a.set(B),r=new s(a.buffer,0,n);for(let e=0;e<n;e++)t[o*n+e]=r[e]}return t}const Q="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;function j(t,e,r){const n=new Uint8Array(t,e,r);return Q.decode(n)}const Y={get:function(t,e={}){e||(e={});const r=new AbortController,n=r.signal,A=H({},e);A.signal=n,A.method||(A.method="GET");const i=fetch(t,A).then(t=>{const r=this.t(t,e.responseType);return r.message?r:r.then(r=>"arraybuffer"===e.responseType?{data:r,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),contentType:t.headers.get("Content-Type")}:r).catch(t=>{if(!t.code||t.code!==DOMException.ABORT_ERR)throw t})}).catch(t=>{if(!t.code||t.code!==DOMException.ABORT_ERR)throw t});return i.xhr=r,i},t:(t,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`}:"arraybuffer"===e?t.arrayBuffer():"json"===e?t.json():t.text(),getArrayBuffer:(t,e={})=>(e||(e={}),e.responseType="arraybuffer",Y.get(t,e)),getJSON:function(t,e={}){return e&&e.jsonp?Y.jsonp(t):((e=e||{}).responseType="json",Y.get(t,e))},jsonp:function(t){const e="_maptalks_jsonp_"+b++;t.match(/\\?/)?t+="&callback="+e:t+="?callback="+e;let r=document.createElement("script");return r.type="text/javascript",r.src=t,new Promise(t=>{window[e]=function(n){document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[e],t(n)},document.getElementsByTagName("head")[0].appendChild(r)})}};class z{constructor(t,e,r){this.A=t,this.decoders=e,this.i=r,this.images={},this.o={}}requestImageFromBufferURI(t,e,r){if(this.buffers[t.id]){const n=this.buffers[t.id],A=this.s(e,n);return this.getImageByBuffer(A,r)}if(this.o[t.id])return this.o[t.id].then(()=>{const n=this.buffers[t.id],A=this.s(e,n);return this.getImageByBuffer(A,r)});if(g(t.uri)){const n=this.buffers[t.id]=V(t.uri),A=this.s(e,n);return this.getImageByBuffer(A,r)}return this.o[t.id]=Y.getArrayBuffer(t.uri,null).then(n=>{const A=this.buffers[t.id]=n.data,i=this.s(e,A);return this.getImageByBuffer(i,r)})}getImageByBuffer(t,e){if(this.images[e.id])return Promise.resolve(this.images[e.id]);const r=this.decoders;if(r[e.mimeType])return r[e.mimeType](t,{supportedFormats:this.i});if("image/crn"===e.mimeType||"image/ktx2"===e.mimeType||"image/cttf"===e.mimeType)return console.warn("missing transcoder for "+e.mimeType,", visit https://maptalks.com/docs/transcoders for details"),Promise.resolve(null);{const r=new Blob([t],{type:e.mimeType}),n=URL.createObjectURL(r);return this.B(e.id,n)}}requestExternalImage(t){if(this.images[t.id])return Promise.resolve(this.images[t.id]);const e=0===t.uri.indexOf("data:image/")?t.uri:this.rootPath+"/"+t.uri;return this.o[t.id]?this.o[t.id].then(()=>this.images[t.id]):this.o[t.id]=this.B(t.id,e)}B(t,e){return new Promise((r,n)=>{this.A(e,(A,i)=>{A?n(A):(URL.revokeObjectURL(e),this.images[t]=i,r(this.images[t]))})})}}const q=["SCALAR",1,"VEC2",2,"VEC3",3,"VEC4",4,"MAT2",4,"MAT3",9,"MAT4",16],$=[];class tt{constructor(t,e,r){this.rootPath=t,this.gltf=e,this.C=!1,this.glbBuffer=r,this.buffers={},this.requests={},this.accessors={},this.l()}u(t,e){const r=this.gltf,n=r.accessors[e];if(void 0===n.bufferView)return this.accessors[n.id]=this._(t,e,null,0),Promise.resolve(this.accessors[n.id]);if(n&&this.accessors[n.id])return Promise.resolve(this.accessors[n.id]);const A=r.bufferViews[n.bufferView];return this.I(A).then(r=>{const{buffer:A,byteOffset:i}=r;return this.accessors[n.id]=this._(t,e,A,i)})}I(t){const e=this.gltf.buffers[t.buffer];if(this.buffers[e.id]){const t=this.buffers[e.id];return Promise.resolve({buffer:t,byteOffset:0})}if(this.requests[e.id])return this.requests[e.id].then(()=>{const t=this.buffers[e.id];return Promise.resolve({buffer:t,byteOffset:0})});if("binary_glTF"!==t.buffer&&"KHR_binary_glTF"!==t.buffer&&e.uri){if(g(e.uri)){const t=this.buffers[e.id]=V(e.uri);return Promise.resolve({buffer:t,byteOffset:0})}let t;const r=e.uri.indexOf("blob:")>=0;return t=e.uri.indexOf("://")>0||r?e.uri:this.rootPath+"/"+e.uri,this.requests[e.id]=Y.getArrayBuffer(t,null).then(n=>(r&&URL.revokeObjectURL(t),{buffer:this.buffers[e.id]=n.data,byteOffset:0}))}return Promise.resolve({buffer:this.glbBuffer.buffer,byteOffset:this.glbBuffer.byteOffset})}_(t,e,r,n=0){const A=this.gltf,i=A.accessors[e],o=void 0!==i.bufferView?A.bufferViews[i.bufferView]:{},s=(o.byteOffset||0)+n,a=this.D(i.type),B=K(i.componentType),E=o.byteStride||0,c={array:void 0,name:t,accessorName:e,byteLength:i.count*a*B.BYTES_PER_ELEMENT,componentType:i.componentType,count:i.count,type:i.type,itemSize:a,max:i.max,min:i.min,extensions:i.extensions};if(i.min&&(c.min=i.min),i.max&&(c.max=i.max),r)if(this.C)c.byteStride=E,c.byteOffset=s+(i.byteOffset||0),!E||E===a*B.BYTES_PER_ELEMENT||"indices"===t||"input"===t||"output"===t||t.indexOf("morph")>=0?(c.array=this.h(r,i.count,a,s+(i.byteOffset||0),B),c.array.buffer.byteLength===c.byteLength&&(c.byteOffset=0)):c.array=new Uint8Array(r,s,o.byteLength);else if(i.interleaved){c.byteStride=0,c.byteOffset=0;const t=new B(i.count*a);if(c.array=W(t,r,i.count,a,E,s+(i.byteOffset||0),i.componentType),c.extensions&&c.extensions.WEB3D_quantized_attributes&&a>2){const t=new Float32Array(c.array.length),{decodeMatrix:e}=c.extensions.WEB3D_quantized_attributes;for(let r=0;r<c.array.length;r+=a){$[0]=c.array[r],$[1]=c.array[r+1],$[2]=c.array[r+2],$[3]=1;const n=N($,$,e);t[r]=n[0],t[r+1]=n[1],t[r+2]=n[2]}c.componentType=5126,c.array=t}}else c.byteStride=0,c.array=this.h(r,i.count,a,s+(i.byteOffset||0),B),c.byteOffset=c.array.byteOffset;else{c.array=new B(i.count);const t=c.min||c.max;t&&(c.array[0]=t[0],c.array[1]=t[1],c.array[2]=t[2])}return c}l(){const t=this.gltf.accessors;if(Array.isArray(t))for(let e=0;e<t.length;e++)for(let r=0;r<t.length;r++)e!==r&&t[e].bufferView===t[r].bufferView&&(t[e].interleaved=t[r].interleaved=!0);else for(const e in t)for(const r in t)e!==r&&t[e].bufferView===t[r].bufferView&&(t[e].interleaved=t[r].interleaved=!0)}h(t,e,r,n,A){return n%A.BYTES_PER_ELEMENT!=0&&(t=t.slice(n,n+e*r*A.BYTES_PER_ELEMENT),n=0),new A(t,n,r*e)}D(t){const e=q.indexOf(t);return q[e+1]}requestKHRTechniquesWebgl(t){const{shaders:e}=t,r=e.map(t=>{if(void 0!==t.bufferView){const e=this.gltf.bufferViews[t.bufferView],{byteLength:r}=e;return this.I(e).then(n=>{const{buffer:A,byteOffset:i}=n,o=j(A,i+(e.byteOffset||0),r);return t.content=o,t})}if(t.uri){if(g(t.uri)){const e=V(t.uri),r=j(e,0,e.byteLength);return t.content=r,Promise.resolve(t)}{const e=this.rootPath+"/"+t.uri;return Y.get(e).then(e=>(t.content=e,t))}}return Promise.resolve(t)});return Promise.all(r).then(()=>t)}}class et extends z{constructor(t,e,r,n,A,i){super(n,A,i),this.rootPath=t,this.gltf=e,this.requests={},this.buffers={},this.glbBuffer=r,this.accessor=new tt(t,e,r)}iterate(t,e){const r=this.gltf[e];if(!r)return;let n=0;for(const e in r)t(e,r[e],n++)}createNode(t){const e={};if(w(t.name)&&(e.name=t.name),w(t.children)&&(e.children=t.children),w(t.jointName)&&(e.jointName=t.jointName),w(t.matrix)&&(e.matrix=t.matrix),w(t.rotation)&&(e.rotation=t.rotation),w(t.scale)&&(e.scale=t.scale),w(t.translation)&&(e.translation=t.translation),w(t.extras)&&(e.extras=t.extras),w(t.meshes)&&(e.mesh=t.meshes[0]),e.translation||e.rotation||e.scale){const t=function(t,e){if(e.matrix)return e.matrix;if(e.translation||e.scale||e.rotation){const r=o(J,e.translation||Z),n=a(X,e.rotation||x),A=s(v,e.scale||k);return i(A,n,A),i(t,r,A)}return A(t)}([],e);delete e.translation,delete e.rotation,delete e.scale,e.matrix=t}return e}T(t){const e={};for(const r in t){const n=t[r];let A,i;n.instanceTechnique&&n.instanceTechnique.values?(A=n.instanceTechnique,i=A.values.diffuse):(A=n,i=A.values.tex||A.values.diffuseTex||A.values.diffuse);const o={baseColorTexture:{index:i}};n.name&&(o.name=n.name),n.extensions&&(o.extensions=n.extensions),n.extras&&(o.extras=n.extras),e[r]=o}return e}F(t){if(t.bufferView||t.extensions&&(t.extensions.KHR_binary_glTF||t.extensions.binary_glTF)){const e=t.bufferView?t:t.extensions.KHR_binary_glTF||t.extensions.binary_glTF;t.extensions&&(t.mimeType=e.mimeType,t.width=e.width,t.height=e.height);const r=this.gltf.bufferViews[e.bufferView],n=(r.byteOffset||0)+this.glbBuffer.byteOffset,A=r.byteLength,i=this.buffers[e.bufferView]=new Uint8Array(this.glbBuffer.buffer,n,A);return this.getImageByBuffer(i,t)}return this.requestExternalImage(t)}P(t){const e=this.gltf.textures[t];if(!e)return null;const r=this.gltf.images[e.source];return this.F(r).then(t=>{const n=this.gltf.samplers[e.sampler];return{image:{array:t.data,width:t.width,height:t.height,index:e.source,mimeType:r.mimeType,name:r.name,extras:r.extras},sampler:n}})}getBaseColorTexture(t){const e=this.gltf.materials[t];let r,n;if(e.instanceTechnique&&e.instanceTechnique.values?(r=e.instanceTechnique,n=r.values.diffuse):(r=e,n=r.values.tex||r.values.diffuseTex||r.values.diffuse),void 0===n||void 0===this.gltf.textures)return null;const A=this.gltf.textures[n];if(!A)return null;const i=this.gltf.samplers[A.sampler];return{format:A.format||6408,internalFormat:A.internalFormat||6408,type:A.type||5121,sampler:i,source:this.gltf.images[A.source]}}getMaterial(){return null}getAnimations(){return null}}class rt extends z{constructor(t,e,r,n,A,i){super(n,A,i),this.rootPath=t,this.gltf=e,this.glbBuffer=r,this.buffers={},this.requests={},this.accessor=new tt(t,e,r)}iterate(t,e){const r=this.gltf[e];if(r)for(let e=0;e<r.length;e++)t(e,r[e],e)}createNode(t){const e={};return H(e,t),!w(t.weights)&&this.gltf.meshes&&w(e.mesh)?e.weights=this.gltf.meshes[e.mesh].weights:t.weights&&(e.weights=t.weights),e}P(t){const e=this.gltf.textures[t];if(!e)return null;let r=e.source;if(e.extensions&&e.extensions.EXT_texture_webp&&(r=e.extensions.EXT_texture_webp.source),!w(r))return null;const n=this.gltf.images[r];return this.F(n).then(t=>{if(!t)return null;const r={image:{array:t.data,mipmap:t.mipmap,width:t.width,height:t.height,index:e.source,mimeType:n.mimeType,name:n.name,extensions:n.extensions,extras:n.extras}};H(r,e);const A=w(e.sampler)?this.gltf.samplers[e.sampler]:void 0;return A&&(r.sampler=A,r.sampler.magFilter=A.magFilter||9729,r.sampler.minFilter=A.minFilter||9729,r.sampler.wrapS=A.wrapS||10497,r.sampler.wrapT=A.wrapT||10497),t.format&&(r.format=t.format),r})}F(t){if(!w(t.bufferView))return this.requestExternalImage(t);{const e=this.gltf.bufferViews[t.bufferView],r=this.gltf.buffers[e.buffer];if(r.uri)return this.requestImageFromBufferURI(r,e,t);if(this.glbBuffer)return this.O(e,t)}return null}O(t,e){const r=this.s(t,this.glbBuffer.buffer,this.glbBuffer.byteOffset);return this.getImageByBuffer(r,e)}s(t,e,r){r=r||0;const n=t.byteOffset+r,A=t.byteLength;return new Uint8Array(e,n,A)}L(t,e){const r=new Array(t.byteLength);for(let e=0;e<t.byteLength;e++)r[e]=String.fromCharCode(t[e]);return r.join(""),"data:"+(e=e||"image/png")+";base64,"+function(t){return"undefined"!=typeof self?self.btoa(t):window.btoa(t)}(unescape(encodeURIComponent(r)))}getAnimations(t){const e=[];return t.forEach(t=>{e.push(this.getSamplers(t.samplers))}),Promise.all(e).then(e=>{for(let r=0;r<e.length;r++)t[r].samplers=e[r];return t})}getSamplers(t){const e=[];for(let r=0;r<t.length;r++)(w(t[r].input)||w(t[r].output))&&(e.push(this.accessor.u("input",t[r].input)),e.push(this.accessor.u("output",t[r].output)));return Promise.all(e).then(e=>{for(let r=0;r<e.length/2;r++)t[r].input=e[2*r],t[r].output=e[2*r+1],t[r].interpolation||(t[r].interpolation="LINEAR");return t})}}const nt="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;class At{static read(t,e=0,r=0){r||(r=t.byteLength);const n=new DataView(t,e,r),A=n.getUint32(4,!0);if(1===A)return At.readV1(n,e);if(2===A)return At.readV2(t,e);throw new Error("Unsupported glb version : "+A)}static readV1(t,e){const r=t.getUint32(8,!0),n=t.getUint32(12,!0);if(r!==t.byteLength)throw new Error("Length in GLB header is inconsistent with glb\'s byte length.");const A=it(t.buffer,20+e,n);return{json:JSON.parse(A),glbBuffer:{byteOffset:20+e+n,buffer:t.buffer,byteLength:r}}}static readV2(t,e){let r,n,A;const i=new DataView(t,e+12);let o=0;for(;o<i.byteLength;){const s=i.getUint32(o,!0);o+=4;const a=i.getUint32(o,!0);if(o+=4,1313821514===a)r=it(t,e+12+o,s);else if(5130562===a){A=e+12+o,n=s;break}o+=s}return{json:JSON.parse(r),glbBuffer:{byteOffset:A,buffer:t,byteLength:n}}}}function it(t,e,r){if(nt){const n=new Uint8Array(t,e,r);return nt.decode(n)}return function(t){const e=t.length;let r="";for(let n=0;n<e;){let A=t[n++];if(128&A){let r=ot[A>>3&7];if(!(64&A)||!r||n+r>e)return null;for(A&=63>>r;r>0;r-=1){const e=t[n++];if(128!=(192&e))return null;A=A<<6|63&e}}r+=String.fromCharCode(A)}return r}(new Uint8Array(t,e,r))}const ot=[1,1,1,1,2,2,3,0],st=[0,0,0],at=[0,0,0,1],Bt=[1,1,1],Et={TRANSLATION:[0,0,0],ROTATION:[0,0,0,1],SCALE:[1,1,1]},ct={PREVIOUS:null,NEXT:null,PREINDEX:null,NEXTINDEX:null,INTERPOLATION:null},Ct={M(t,e,r,n,A,i,o,s){const a=w(t)?e.animations:[e.animations[0]],B={};for(let e=0;e<a.length;e++){const E=a[e],c=E.name||e;if(w(t)&&c!==t)continue;const C=E.channelsMap[r];if(C)for(let t=0;t<C.length;t++){const e=C[t];"translation"===e.target.path?(this.N(A,E.samplers[e.sampler],n,1),B.translation=f(st,A)):"rotation"===e.target.path?(this.S(i,E.samplers[e.sampler],n,1),B.rotation=m(at,i)):"scale"===e.target.path?(this.N(o,E.samplers[e.sampler],n,1),B.scale=f(Bt,o)):"weights"===e.target.path&&s&&(this.N(s,E.samplers[e.sampler],n,s.length),B.weights=s)}}return B},N(t,e,r,n){switch(e.interpolation){case"LINEAR":{const A=this.U(ct,e,r,1*n);A&&(t=function(t,e,r,n){for(let A=0;A<t.length;A++)t[A]=e[A]+n*(r[A]-e[A]);return t}(t,A.PREVIOUS,A.NEXT,A.INTERPOLATION));break}case"STEP":{const A=this.U(ct,e,r,1*n);A&&(t=function(t,e){for(let r=0;r<t.length;r++)t[r]=e[r];return t}(t,...A.PREVIOUS));break}case"CUBICSPLINE":{const A=this.U(ct,e,r,3*n);A&&(t=this.G(t,A,e.input.array,3*n));break}}return t},S(t,e,r){switch(e.interpolation){case"LINEAR":{const n=this.U(ct,e,r,1);n&&U(t,n.PREVIOUS,n.NEXT,n.INTERPOLATION);break}case"STEP":{const n=this.U(ct,e,r,1);n&&(t=M(t,...n.PREVIOUS));break}case"CUBICSPLINE":{const n=this.U(ct,e,r,3);if(n){for(let t=0;t<n.PREVIOUS.length;t++)n.PREVIOUS[t]=Math.acos(n.PREVIOUS[t]),n.NEXT[t]=Math.acos(n.NEXT[t]);t=this.G(t,n,e.input.array,3);for(let e=0;e<t.length;e++)t[e]=Math.cos(t[e])}break}}return t},m(t,e){const r=t.length;let n,A,i,o=0,s=r-1,a=Math.floor((o+s)/2);for(;o<=r-1&&s>=0;){if(o===s)return null;if(t[a]<=e&&e<=t[a+1]){const r=t[a];return n=a,A=a+1,i=(e-r)/(t[a+1]-r),{preIndx:n,nextIndex:A,interpolation:i}}e<t[a]?(s=a,a=Math.floor((o+s)/2)):t[a+1]<e&&(o=a,a=Math.floor((o+s)/2))}return null},U(t,e,r,n){const A=e.input.array,i=e.output.array,o=e.output.itemSize;(r<A[0]||r>A[A.length-1])&&(r=Math.max(A[0],Math.min(A[A.length-1],r))),r===A[A.length-1]&&(r=A[0]);const s=this.m(A,r);if(!s||!s.nextIndex)return null;const{preIndx:a,nextIndex:B,interpolation:E}=s;t.PREINDEX=a,t.NEXTINDEX=B,t.INTERPOLATION=E;const c=o*n;return t.PREVIOUS=i.subarray(t.PREINDEX*c,(t.PREINDEX+1)*c),t.NEXT=i.subarray(t.NEXTINDEX*c,(t.NEXTINDEX+1)*c),t},G(t,e,r,n){const A=e.INTERPOLATION,i=r[e.PREINDEX],o=r[e.NEXTINDEX];for(let r=0;r<3;r++){const s=e.PREVIOUS[n+r],a=(o-i)*e.PREVIOUS[2*n+r],B=e.NEXT[3+r],E=(o-i)*e.NEXT[r],c=(2*Math.pow(A,3)-3*Math.pow(A,2)+1)*s+(Math.pow(A,3)-2*Math.pow(A,2)+A)*a+(2*-Math.pow(A,3)+3*Math.pow(A,2))*B+(Math.pow(A,3)-Math.pow(A,2))*E;t[r]=c}return t},getAnimationClip(t,e,r,n){const A=t.nodes[e]&&t.nodes[e].weights;return l(st,...Et.TRANSLATION),M(at,...Et.ROTATION),l(Bt,...Et.SCALE),this.M(n,t,e,r,st,at,Bt,A)},getTimeSpan(t){if(!t.animations)return null;if(t.timeSpan)return t.timeSpan;const e=t.animations;return t.timeSpan={},e.forEach((e,r)=>{let n=-1/0,A=1/0;const i=e.channels;for(let t=0;t<i.length;t++){const r=i[t],o=e.samplers[r.sampler].input.array;o[o.length-1]>n&&(n=o[o.length-1]),o[0]<A&&(A=o[0])}const o=e.name||r;t.timeSpan[o]={max:n,min:A}}),t.timeSpan},getTimeSpanByName(t,e){const r=this.getTimeSpan(t);return r?w(e)?r[e]:r[Object.keys(r)[0]]:null}};let ft=!1;if("undefined"!=typeof OffscreenCanvas){let t;try{t=new OffscreenCanvas(2,2).getContext("2d")}catch(ue){}t&&"undefined"!=typeof createImageBitmap&&(ft=!0)}const lt="undefined"==typeof document?null:document.createElement("canvas");class ut{constructor(t,e,r){if(this.options=r||{},this.options.decoders||(this.options.decoders={}),e.buffer instanceof ArrayBuffer){const{json:r,glbBuffer:n}=At.read(e.buffer,e.byteOffset,e.byteLength);this.p(t,r,n)}else this.p(t,e);this.H=new tt(this.rootPath,this.gltf,this.glbBuffer),this.K()}K(){const t=this.gltf.extensionsRequired;if(t){if(t.indexOf("KHR_draco_mesh_compression")>=0&&!this.options.decoders.draco)throw new Error("KHR_draco_mesh_compression is required but @maptalks/transcoders.draco is not loaded");if(t.indexOf("KHR_texture_basisu")>=0&&!this.options.decoders.ktx2)throw new Error("KHR_texture_basisu is required but @maptalks/transcoders.ktx2 is not loaded")}}V(){const t=this.gltf.extensions;return t&&t.KHR_techniques_webgl?this.H.requestKHRTechniquesWebgl(t.KHR_techniques_webgl).then(e=>(t.KHR_techniques_webgl=e,t)):Promise.resolve(t)}load(t){t=t||{};const e=this.J(t),r=this.X(),n=this.v(),A=this.V();return Promise.all([e,r,n,A]).then(t=>(t[0].animations=t[1],t[0].textures=t[2],t[0].extensions=t[3],t[0].transferables=this.transferables||[],this.createChannelsMap(t[0]),t[0]))}createChannelsMap(t){const e=t.animations;if(e)for(let t=0;t<e.length;t++){const r=e[t];r.channelsMap={};for(let t=0;t<r.channels.length;t++){const e=r.channels[t];r.channelsMap[e.target.node]||(r.channelsMap[e.target.node]=[]),r.channelsMap[e.target.node].push(e)}}}getExternalResources(){const t=[];if(this.gltf){const{buffers:e,images:r}=this.gltf;for(let r=0;r<e.length;r++)e[r].uri&&e[r].uri.indexOf("data:application/octet-stream;base64")<0&&t.push({type:"buffer",uri:e[r].uri});for(let e=0;e<r.length;e++)r[e].uri&&r[e].uri.indexOf("data:image/")<0&&t.push({type:"image",uri:r[e].uri})}return t}static getAnimationClip(t,e,r,n){return Ct.getAnimationClip(t,e,r,n)}static getAnimationTimeSpan(t,e){return Ct.getTimeSpanByName(t,e)}static getTypedArrayCtor(t){return K(t)}static readInterleavedArray(t,e,r,n,A,i,o){return W(t,e,r,n,A,i,o)}p(t,e,r){this.gltf=e,this.glbBuffer=r,this.version=e.asset?+e.asset.version:1,this.rootPath=t,this.buffers={},this.requests={},this.options.requestImage=ft?ht.bind(this):this.options.requestImage||_t,this.options.transferable&&(this.transferables=[]),2===this.version?(this.adapter=new rt(t,e,r,this.options.requestImage,this.options.decoders||{},this.options.supportedFormats||{}),this.adapter.iterate((t,e,r)=>{e.id="buffer_"+r},"buffers"),this.adapter.iterate((t,e,r)=>{e.id="image_"+r},"images"),this.adapter.iterate((t,e,r)=>{e.id="accessor_"+r},"accessors")):(this.adapter=new et(t,e,r,this.options.requestImage,this.options.decoders||{},this.options.supportedFormats||{}),this.adapter.iterate((t,e,r)=>{e.id="accessor_"+r},"accessors"),this.adapter.iterate((t,e,r)=>{e.id="image_"+r},"images"))}Z(t,e){if(t.children&&t.children.length>0){if(!("number"==typeof(r=t.children[0])&&isFinite(r)||function(t){return!p(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}(t.children[0])))return t;const n=t.children.map(t=>{const r=e[t];return r.nodeIndex=t,this.Z(r,e)});t.children=n}var r;return t}J(t){return this.k(t).then(t=>{const e=this.scenes=[];let r;for(const e in t)t[e]=this.Z(t[e],t),t[e].nodeIndex=Number(e)?Number(e):e;this.adapter.iterate((n,A,i)=>{const o={};A.name&&(o.name=A.name),A.nodes&&(o.nodes=A.nodes.map(e=>t[e])),this.gltf.scene===n&&(r=i),e.push(o)},"scenes");const n={textures:this.gltf.textures,asset:this.gltf.asset,scene:r,scenes:e,nodes:t,meshes:this.meshes,materials:this.gltf.materials,skins:this.skins,extensionsRequired:this.gltf.extensionsRequired,extensionsUsed:this.gltf.extensionsUsed};if(this.gltf.extensions&&(n.extensions=this.gltf.extensions),1===this.version){const t=this.adapter.T(this.gltf.materials);n.materials=t}return n})}k(t){return this.W(t).then(()=>{const t=this.nodes={};return this.adapter.iterate((e,r)=>{const n=this.adapter.createNode(r,this.meshes,this.skins);t[e]=n},"nodes"),t})}j(){this.skins=[];const t=[];return this.adapter.iterate((e,r,n)=>{t.push(this.Y(r).then(t=>{t.index=n,this.skins.push(t)}))},"skins"),t}Y(t){const e=t.inverseBindMatrices;return this.adapter.accessor.u("inverseBindMatrices",e).then(e=>(t.inverseBindMatrices=e,e&&e.buffer&&this.transferables&&this.transferables.indexOf(e.buffer)<0&&this.transferables.push(e.buffer),t))}X(){const t=this.gltf.animations;return w(t)?this.adapter.getAnimations(t):null}W(t){this.meshes={};let e=[];return this.adapter.iterate((r,n,A)=>{e.push(this.q(n,t).then(t=>{t.index=A,this.meshes[r]=t}))},"meshes"),e=e.concat(this.j()),Promise.all(e)}q(t,e){const r=t.primitives.map(t=>this.$(t,e)).filter(t=>!!t);return Promise.all(r).then(e=>{const r={};return H(r,t),r.primitives=e,r})}v(){const t=this.gltf.textures;if(!t)return null;const e=[];for(const r in t)e.push(this.adapter.P(r));return Promise.all(e).then(e=>{if(this.transferables)for(let t=0;t<e.length;t++){const r=e[t].image.array;if(e[t]&&r){let t;t=r instanceof ImageBitmap?r:r.buffer,t&&this.transferables.indexOf(t)<0&&this.transferables.push(t)}}if(!Array.isArray(t)){const r={},n=Object.keys(t);for(let t=0;t<e.length;t++)e[t]&&(r[n[t]]=e[t]);return r}return e})}$(t,e){let r;const n=[],A=t.extensions;if(w(t.targets))for(let e=0;e<t.targets.length;e++){const r=t.targets[e];for(const t in r){const A=this.adapter.accessor.u(`morphTargets_${t}_${e}`,r[t]);A&&n.push(A)}}if(A&&A.KHR_draco_mesh_compression){if(!this.options.decoders.draco&&(!this.gltf.extensionsRequired||!this.gltf.extensionsRequired.indexOf("KHR_draco_mesh_compression")<0))return null;const t=this.options.decoders.draco,{bufferView:i,attributes:o}=A.KHR_draco_mesh_compression,s=this.gltf.bufferViews[i],a=this.H.I(s).then(r=>{const{buffer:n,byteOffset:A}=r;let{byteOffset:i}=s;const a=s.byteLength;i||(i=0);const B=new DataView(n,A+i,a),E={attributes:o,useUniqueIDs:!1,skipAttributeTransform:e.skipAttributeTransform};return t(B,E).then(t=>{const e=Object.values(t.attributes);return t.indices&&e.push(t.indices),e})});n.push(a),r=Promise.all(n)}else{const e=t.attributes;for(const t in e){const r=this.adapter.accessor.u(t,e[t]);r&&n.push(r)}if(w(t.indices)){const e=this.adapter.accessor.u("indices",t.indices);e&&n.push(e)}r=Promise.all(n)}return r.then(e=>{if(A&&A.KHR_draco_mesh_compression){const r=t.targets?t.targets.length:0;e[r]=e[r].concat(e.slice(0,r)),e=e[r]}let r,n;const i={attributes:e.reduce((t,e)=>{if("indices"===e.name)r=e;else if(e.name.indexOf("morphTargets_")>-1)n=n||{},n[e.name.slice(13)]=e;else{if(!("POSITION"!==e.name||e.min&&e.max)){const t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0],{itemSize:n,array:A}=e,i=A.length/n;for(let e=0;e<i;e++)for(let i=0;i<n;i++){const o=e*n+i;A[o]<t[i]&&(t[i]=A[o]),A[o]>r[i]&&(r[i]=A[o])}if(e.quantization){const n=e.quantization,A=n.range/(1<<n.quantizationBits),i=n.minValues;D(t,t,A),u(t,t,i),D(r,r,A),u(r,r,i)}e.min=t,e.max=r}t[e.name]=e}return this.transferables&&e.array.buffer&&this.transferables.indexOf(e.array.buffer)<0&&this.transferables.push(e.array.buffer),t},{}),material:t.material};return r&&(i.indices=r),n&&(i.morphTargets=n),i.mode=w(t.mode)?t.mode:4,w(t.extras)&&(i.extras=t.extras),i})}}function _t(t,e){const r=new Image;r.crossOrigin="",r.onload=()=>{if(!lt)return void e(new Error("There is no canvas to draw image!"));lt.width=r.width,lt.height=r.height;const t=lt.getContext("2d",{willReadFrequently:!0});t.drawImage(r,0,0,r.width,r.height);const n=t.getImageData(0,0,r.width,r.height),A={width:r.width,height:r.height,data:new Uint8Array(n.data)};e(null,A)},r.onerror=function(t){e(t)},r.src=t}let It,Dt;function ht(t,e){It||(It=new OffscreenCanvas(2,2),Dt=It.getContext("2d",{willReadFrequently:!0})),fetch(t).then(t=>t.arrayBuffer()).then(t=>{const e=new Blob([new Uint8Array(t)]);return createImageBitmap(e)}).then(t=>{let{width:r,height:n}=t;Rt(r)||(r=Tt(r)),Rt(n)||(n=Tt(n));const A=this.options.maxTextureSize;A&&(r=Math.min(A,r),n=Math.min(A,n)),It.width=r,It.height=n,Dt.drawImage(t,0,0,r,n),t.close();const i=Dt.getImageData(0,0,r,n);e(null,{width:r,height:n,data:new Uint8Array(i.data)})}).catch(t=>{console.warn(t),e(t)})}function Rt(t){return 0==(t&t-1)&&0!==t}function Tt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Ft(t){return"object"==typeof t&&!!t}function Pt(t){return t*Math.PI/180}function Ot(t){return t/Math.PI*180}function Lt(t){return Math.sign?Math.sign(t):0===(t=+t)||isNaN(t)?Number(t):t>0?1:-1}const yt=[1,1,1,1,2,2,3,0];function Mt(t){const e=t.length;let r="";for(let n=0;n<e;){let A=t[n++];if(128&A){let r=yt[A>>3&7];if(!(64&A)||!r||n+r>e)return null;for(A&=63>>r;r>0;r-=1){const e=t[n++];if(128!=(192&e))return null;A=A<<6|63&e}}r+=String.fromCharCode(A)}return r}const Nt=new Array(3),St=new Array(3),dt=[40680631590769,40680631590769,40408299984661.445];const Ut=[1/6378137,1/6378137,1/6356752.314245179],Gt=[1/40680631590769,1/40680631590769,1/40408299984661.445],mt=new Array(3),bt=new Array(3),pt=new Array(3);function wt(t,e){const r=Gt,n=function(t,e,r,n,A){const i=e[0],o=e[1],s=e[2],a=r[0],B=r[1],E=r[2],c=i*i*a*a,C=o*o*B*B,f=s*s*E*E,l=c+C+f,u=Math.sqrt(1/l),_=D(Ht,e,u);if(l<A)return isFinite(u)?_:void 0;const I=n[0],h=n[1],R=n[2],T=Kt;T[0]=_[0]*I*2,T[1]=_[1]*h*2,T[2]=_[2]*R*2;let F,P,O,L,y,M,N,S,d,U,G,m=(1-u)*gt(e)/(.5*gt(T)),b=0;do{m-=b,O=1/(1+m*I),L=1/(1+m*h),y=1/(1+m*R),M=O*O,N=L*L,S=y*y,d=M*O,U=N*L,G=S*y,F=c*M+C*N+f*S-1,P=c*d*I+C*U*h+f*G*R;b=F/(-2*P)}while(Math.abs(F)>1e-12);return t[0]=i*O,t[1]=o*L,t[2]=s*y,t}(mt,e,Ut,r,.1);let A=L(bt,n,r);A=Vt(A,A);const i=O(pt,e,n),o=Math.atan2(A[1],A[0]),s=Math.asin(A[2]),a=Lt(T(i,e))*gt(i);return t[0]=Ot(o),t[1]=Ot(s),t[2]=a,t}const Ht=new Array(3),Kt=new Array(3);function gt(t){return c(t)}function Vt(t,e){const r=e[0],n=e[1],A=e[2];let i=r*r+n*n+A*A;return i>0&&(i=Math.sqrt(i),t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i),t}function Jt(t,e,r,n){r=r||0,n=n||r;const A=Math.abs(t-e);return A<=n||A<=r*Math.max(Math.abs(t),Math.abs(e))}function Xt(t,e){let r="";for(let n=0;n<4;n++){const A=t.getUint8(e+n);r+=String.fromCharCode(A)}return r}const vt="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;function Zt(t,e,r){const n=new Uint8Array(t,e,r);return vt?JSON.parse(vt.decode(n)):JSON.parse(Mt(n))}function xt(t,e,r){const n=new Uint8Array(t,e,r);return vt?JSON.parse(vt.decode(n)):JSON.parse(Mt(n))}function kt(t,e,r){return{offset:e,byteLength:r}}function Wt(t,e,r,n){const{byteOffset:A,componentType:i,type:o}=t,{ctor:s,type:a}=function(t){return Yt[t]}(i||"UNSIGNED_SHORT"),B=function(t){if(!t)return 1;return jt[t]}(o);return{byteStride:0,byteOffset:A+r,itemSize:B,count:n*B,componentType:a,array:new s(e,r+A,n*B)}}function Qt(t,e,r,n){const A=Wt(t,e,r,n);return A.array.buffer.byteLength!==e.byteLength&&(A.array=A.array.slice()),A}const jt={"SCALAR":1,"VEC2":2,"VEC3":3,"VEC4":4};const Yt={"BYTE":{ctor:Int8Array,type:5120,name:"Int8Array"},"UNSIGNED_BYTE":{ctor:Uint8Array,type:5121,name:"Uint8Array"},"SHORT":{ctor:Int16Array,type:5122,name:"Int16Array"},"UNSIGNED_SHORT":{ctor:Uint16Array,type:5123,name:"Uint16Array"},"INT":{ctor:Int32Array,type:5124,name:"Int32Array"},"UNSIGNED_INT":{ctor:Uint32Array,type:5125,name:"Uint32Array"},"FLOAT":{ctor:Float32Array,type:5126,name:"Float32Array"},"DOUBLE":{ctor:Float64Array,type:5126,name:"Float64Array"}};function zt(t){for(const e in Yt)if(t===Yt[e].ctor)return Yt[e].type;throw new Error("unrecognized ctor:"+t)}function qt(t,e,r,n){const A=t,i=e.length/3;for(let t=0;t<i;t++)A[3*t]=e[3*t]/65535*n[0]+r[0],A[3*t+1]=e[3*t+1]/65535*n[1]+r[1],A[3*t+2]=e[3*t+2]/65535*n[2]+r[2];return A}function $t(t,e,r){const n=t.getUint32(12,!0),A=t.getUint32(16,!0),i=t.getUint32(20,!0),o=t.getUint32(24,!0),s=t.buffer;let a,B={},E={},c=null;n>0&&(B=Zt(s,e,n),e+=n),A>0&&(a=function(t,e,r){return{offset:e,byteLength:r}}(0,e,A),e+=A),i>0&&(E=xt(s,e,i),e+=i);const C=kt(0,e,o);return c=s.slice(C.offset,C.offset+C.byteLength),r.push(c),{featureTable:B,featureTableBin:a,batchTable:E,batchTableBin:c}}const te={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},ee={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},re={},ne={east:[],north:[],up:[],west:[],south:[],down:[]};let Ae=[],ie=[],oe=[];const se=[0,0,0];const ae=function(t,e){const r=te[t][e];let n;const A=t+e;return re[A]?n=re[A]:(n=function(n,A,i){if(function(t,e){var r=t[0],n=t[1],A=t[2],i=e[0],o=e[1],s=e[2];return Math.abs(r-i)<=1e-6*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(A-s)<=1e-6*Math.max(1,Math.abs(A),Math.abs(s))}(n,se))f(Ae,ee[t]),f(ie,ee[e]),f(oe,ee[r]);else if(Jt(n[0],0,1e-14)&&Jt(n[1],0,1e-14)){const A=Lt(n[2]);f(Ae,ee[t]),"east"!==t&&"west"!==t&&D(Ae,Ae,A),f(ie,ee[e]),"east"!==e&&"west"!==e&&D(ie,ie,A),f(oe,ee[r]),"east"!==r&&"west"!==r&&D(oe,oe,A)}else{!function(t,e){I(e,t,Gt),R(e,e)}(n,ne.up);const A=ne.up,i=ne.east;i[0]=-n[1],i[1]=n[0],i[2]=0,R(ne.east,i),F(ne.north,A,i),D(ne.down,ne.up,-1),D(ne.west,ne.east,-1),D(ne.south,ne.north,-1),Ae=ne[t],ie=ne[e],oe=ne[r]}return i[0]=Ae[0],i[1]=Ae[1],i[2]=Ae[2],i[3]=0,i[4]=ie[0],i[5]=ie[1],i[6]=ie[2],i[7]=0,i[8]=oe[0],i[9]=oe[1],i[10]=oe[2],i[11]=0,i[12]=n[0],i[13]=n[1],i[14]=n[2],i[15]=1,i},re[A]=n),n}("east","north"),Be={5120:Int8Array,5122:Int16Array,5124:Int32Array,5121:Uint8Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Ee(t){return Be[t]}function ce(t){for(const e in Be)if(t===Be[e])return+e;throw new Error("unrecognized ctor:"+t)}function Ce(t){return 1===t?"FLOAT":"VEC"+t}\n/*!\n * @maptalks/gl v0.83.0\n * LICENSE : UNLICENSED\n * (c) 2016-2023 maptalks.com\n */const fe=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof undefined)return global;throw new Error("unable to locate global object")},le=fe(),ue=le.gl_trans__coders=le.gl_trans__coders||{};ue.inject=function(t){const e=t.toString(),r=e.indexOf("{")+1,n=e.substring(0,r),A=le.gl_trans__coders=le.gl_trans__coders||{};let i=`${n}\\n const _____getGlobal = ${fe.toString()};\\n const g___lobals = _____getGlobal()\\n const tran_____scoders = g___lobals[\'gl_trans__coders\'] = g___lobals[\'gl_trans__coders\'] || {};`;for(const t in A)"inject"!==t&&"getTranscoder"!==t&&"registerTranscoder"!==t&&(i+=\'tran_____scoders["\'+t+\'"] =\'+A[t].toString()+"\\n;");return i+="\\n"+e.substring(n.length),i},ue.registerTranscoder=function(t,e){ue[t]=e},ue.getTranscoder=function(t){return ue[t]};let _e=null;function Ie(){return _e||(_e={"image/crn":ue.crn&&ue.crn(),"image/ktx2":ue.ktx2&&ue.ktx2(),"image/cttf":ue.ktx2&&ue.ktx2(),"draco":ue.draco&&ue.draco()}),_e}class De{constructor(t,e,r){this.A=t,this.tt=e||ut,this.i=r,this.et=Ie()}static createEmptyB3DM(){return{featureTable:null,batchTable:null,gltf:{}}}load(t,e,r=0,n=0,A){return e?(n||(n=e.byteLength),this.rt(t,e,r,n,A)):Y.getArrayBuffer(t,{}).then(e=>{const A=e.data;return n||(n=A.byteLength),this.rt(t,A,r,n)})}rt(t,e,r,n,A){const i=A&&A.maxTextureSize,o=this.nt(e,r,n,t);if(o.error)return Promise.resolve(o);const s=t.substring(0,t.lastIndexOf("/")),a=new this.tt(s,o.glb,{transferable:!0,requestImage:this.A,decoders:this.et,supportedFormats:this.i,maxTextureSize:i});return a.load({skipAttributeTransform:!1}).then(e=>{e.url=`${t}-${r}-${n}`;const A=a.transferables;for(let t=0;t<o.transferables.length;t++)A.indexOf(o.transferables[t])<0&&A.push(o.transferables[t]);return{magic:"b3dm",count:o.count,transferables:A,featureTable:o.featureTable,batchTable:o.batchTable,batchTableBin:o.batchTableBin,gltf:e}})}nt(t,e,r,n){const A=new DataView(t,e,r),i=A.getUint32(4,!0);if(1!==i){const t="Unsupported b3dm version: "+i+", url:"+n;return console.warn(t),{error:t}}if(A.getUint32(8,!0)!==A.byteLength){const t="Length in b3dm header is inconsistent with b3dm\'s byte length, url: "+n;return console.warn(t),{error:t}}let o,s=A.getUint32(12,!0),a=A.getUint32(16,!0),B=A.getUint32(20,!0),E=A.getUint32(24,!0),c=28+e;B>=570425344?(c-=8,o=s,B=a,E=0,s=0,a=0):E>=570425344&&(c-=4,o=B,B=s,E=a,s=0,a=0);const C=[t];let f,l,u;if(s>0?(f=Zt(t,c,s),c+=s,o=f.BATCH_LENGTH):f={"BATCH_LENGTH":o},a>0&&(c+=a),B>0&&(l=xt(t,c,B),c+=B,E>0)){const e=kt(0,c,E);u=t.slice(e.offset,e.offset+e.byteLength),c+=E,C.push(u)}const _=f.BATCH_LENGTH,I={};if(f&&f.BATCH_ID){I.BATCH_ID=Qt(f.BATCH_ID,t,(void 0).offset,_);const e=I.BATCH_ID.array&&I.BATCH_ID.array.buffer;e&&C.indexOf(e)<0&&C.push(e)}return{count:o,transferables:C,featureTable:f,batchTable:l,batchTableBin:u,b3dm:I,glb:{buffer:t,byteOffset:c,byteLength:A.byteLength+A.byteOffset-c}}}At(){return null}}class he{constructor(t,e,r,n){this.A=t,this.tt=e||ut,this.i=r,this.et=Ie(),this.it=n}load(t,e,r=0,n=0,A){return e?(n||(n=e.byteLength),this.rt(t,e,r,n,A)):Y.getArrayBuffer(t,{}).then(e=>{const A=e.data;return n||(n=A.byteLength),this.rt(t,A,r,n)})}rt(t,e,r,n,A){return this.ot(t,e,r,n,A).then(({gltf:A,transferables:i})=>{const o=this.st(e,r,n,t);if(o.error)return Promise.resolve(o);for(let t=0;t<i.length;t++)-1===o.transferables.indexOf(i[t])&&o.transferables.push(i[t]);return delete A.transferables,Promise.resolve({magic:"i3dm",count:o.count,transferables:o.transferables,featureTable:o.featureTable,batchTable:o.batchTable,batchTableBin:o.batchTableBin,i3dm:o.i3dm,gltf:A})})}ot(t,e,r,n,A){const i=A&&A.maxTextureSize,o={transferable:!0,requestImage:this.A,decoders:this.et,supportedFormats:this.i,maxTextureSize:i},s=new DataView(e,r,n),a=32+s.getUint32(12,!0)+s.getUint32(16,!0)+s.getUint32(20,!0)+s.getUint32(24,!0);if(0===s.getUint32(28,!0)){let n=Mt(new Uint8Array(e,a+r,s.byteLength-a));-1==n.indexOf("://")&&(n=t.substring(0,t.lastIndexOf("/"))+"/"+n);return n.indexOf(".glb")>0?Y.getArrayBuffer(n,{}).then(t=>this.Bt(n,{buffer:t.data,byteOffset:0},o)):Y.getJSON(n,{}).then(t=>this.Bt(n,t,o))}{const n={buffer:e,byteOffset:a+r,byteLength:s.byteLength-a};return this.Bt(t,n,o)}}Bt(t,e,r){const n=t.substring(0,t.lastIndexOf("/")),A=new this.tt(n,e,r);return A.load({skipAttributeTransform:!0}).then(r=>{let n=0,i=0;return e.buffer&&(n=e.byteOffset||0,i=e.byteLength||0),r.url=`${t}-${n}-${i}`,{transferables:A.transferables,gltf:r}})}st(t,e,r,n){const A=new DataView(t,e,r),i=A.getUint32(4,!0);if(1!==i){const t="Unsupported pnts version: "+i+", url:"+n;return console.warn(t),{error:t}}if(A.getUint32(8,!0)!==A.byteLength){const t="Length in pnts header is inconsistent with pnts\'s byte length, url: "+n;return console.warn(t),{error:t}}const o=[t],{featureTable:s,featureTableBin:a,batchTable:B,batchTableBin:E}=$t(A,32+e,o),c={},C=s.INSTANCES_LENGTH;if(s.POSITION){const{byteOffset:e}=s.POSITION;c.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:new Float32Array(t,e+a.offset,3*C).slice()},o.push(c.POSITION.array.buffer)}else if(s.POSITION_QUANTIZED){const e=s.QUANTIZED_VOLUME_OFFSET,r=s.QUANTIZED_VOLUME_SCALE,{byteOffset:n}=s.POSITION_QUANTIZED;c.POSITION={byteStride:12,byteOffset:0,itemSize:3,count:C,componentType:5126,array:this.Et(new Uint16Array(t,n+a.offset,3*C),e,r)},o.push(c.POSITION.array.buffer)}if(s.BATCH_ID){c.BATCH_ID=Qt(s.BATCH_ID,t,a.offset,C);const e=c.BATCH_ID.array&&c.BATCH_ID.array.buffer;e&&o.indexOf(e)<0&&o.push(e)}if(s.NORMAL_UP){let{byteOffset:e}=s.NORMAL_UP;c.NORMAL_UP={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:new Float32Array(t,e+a.offset,3*C).slice()},o.push(c.NORMAL_UP.array.buffer),e=s.NORMAL_RIGHT.byteOffset,c.NORMAL_RIGHT={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:new Float32Array(t,e+a.offset,3*C).slice()},o.push(c.NORMAL_RIGHT.array.buffer)}else if(s.NORMAL_UP_OCT32P){let{byteOffset:e}=s.NORMAL_UP_OCT32P;c.NORMAL_UP={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:this.ct(new Uint16Array(t,e+a.offset,2*C))},o.push(c.NORMAL_UP.array.buffer),e=s.NORMAL_RIGHT_OCT32P.byteOffset,c.NORMAL_RIGHT={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:this.ct(new Uint16Array(t,e+a.offset,2*C))},o.push(c.NORMAL_RIGHT.array.buffer)}if(s.SCALE){const{byteOffset:e}=s.SCALE;c.SCALE={byteStride:0,byteOffset:0,itemSize:1,count:C,componentType:5126,array:new Float32Array(t,e+a.offset,C).slice()},o.push(c.SCALE.array.buffer)}else if(s.SCALE_NON_UNIFORM){const{byteOffset:e}=s.SCALE_NON_UNIFORM;c.SCALE_NON_UNIFORM={byteStride:0,byteOffset:0,itemSize:3,count:C,componentType:5126,array:new Float32Array(t,e+a.offset,3*C).slice()},o.push(c.SCALE_NON_UNIFORM.array.buffer)}return{count:C,batchTable:B,batchTableBin:E,featureTable:s,i3dm:c,transferables:o}}ct(t){const e=t.length/2,r=new Float32Array(3*e),n=[];for(let A=0;A<e;A++)Re(n,t[2*A],t[2*A+1],65535),r[3*A]=n[0],r[3*A+1]=n[1],r[3*A+2]=n[2];return r}Et(t,e,r){return qt(new Float32Array(t.length),t,e,r)}At(){return null}}function Re(t,e,r,n){if(t[0]=Te(e,n),t[1]=Te(r,n),t[2]=1-(Math.abs(t[0])+Math.abs(t[1])),t[2]<0){const e=t[0];t[0]=(1-Math.abs(t[1]))*Fe(e),t[1]=(1-Math.abs(e))*Fe(t[1])}return R(t,t)}function Te(t,e){return function(t,e,r){return t<e?e:t>r?r:t}(t,0,e=function(t,e){if(null!=t)return t;return e}(e,255))/e*2-1}function Fe(t){return t<0?-1:1}class Pe{constructor(){}load(t,e,r=0,n=0){return e?(n||(n=e.byteLength),this.rt(t,e,r,n)):Y.getArrayBuffer(t,{}).then(e=>{const A=e.data;return n||(n=A.byteLength),this.rt(t,A,r,n)})}rt(t,e,r,n){return this.Ct(e,r,n,t).then(t=>t.error?t:{magic:"pnts",count:t.count,transferables:t.transferables,featureTable:t.featureTable,batchTable:t.batchTable,batchTableBin:t.batchTableBin,pnts:t.pnts})}Ct(t,e,r,n){const A=new DataView(t,e,r),i=A.getUint32(4,!0);if(1!==i){const t="Unsupported pnts version: "+i+", url:"+n;return console.warn(t),{error:t}}if(A.getUint32(8,!0)!==A.byteLength){const t="Length in pnts header is inconsistent with pnts\'s byte length, url: "+n;return console.warn(t),{error:t}}const o=[t],{featureTable:s,featureTableBin:a,batchTable:B,batchTableBin:E}=$t(A,e+28,o),c=s.QUANTIZED_VOLUME_OFFSET,C=s.QUANTIZED_VOLUME_SCALE,f=s.POINTS_LENGTH;let l,u={};if(s.extensions&&s.extensions["3DTILES_draco_point_compression"]){u=s.extensions["3DTILES_draco_point_compression"],l=new DataView(t,u.byteOffset+a.offset,u.byteLength);const e={attributes:u.properties,useUniqueIDs:!1};return this.ft||(this.ft=Ie().draco),this.ft(l,e).then(e=>{const r=e.attributes;!s.POSITION&&!s.POSITION_QUANTIZED||r.POSITION||r.POSITION_QUANTIZED||(r.POSITION=s.POSITION,r.POSITION_QUANTIZED=s.POSITION_QUANTIZED),!(s.RGB||s.RGBA||s.RGB565)||r.RGB||r.RGBA||r.RGB565||(r.RGB=s.RGB,r.RGBA=s.RGBA,r.RGB565=s.RGB565),!s.NORMAL&&!s.NORMAL_OCT16P||r.NORMAL||r.NORMAL_OCT16P||(r.NORMAL=s.NORMAL,r.NORMAL_OCT16P=s.NORMAL_OCT16P);const n=this.lt(t,e.attributes,a.offset,f,o,c,C);if(e.attributes.BATCH_ID){const t=e.attributes.BATCH_ID.array;n.BATCH_ID={byteStride:0,byteOffset:0,itemSize:1,count:t.length,componentType:zt(t.constructor),array:t},o.push(t.buffer)}else if(s.BATCH_ID||Object.keys(B).length){s.BATCH_ID?n.BATCH_ID=Qt(s.BATCH_ID,t,a.offset,f):n.BATCH_ID=Oe(f);const e=n.BATCH_ID.array&&n.BATCH_ID.array.buffer;e&&o.indexOf(e)<0&&o.push(e)}return{count:f,batchTable:B,batchTableBin:E,featureTable:s,pnts:n,transferables:o}})}const _=this.lt(t,s,a.offset,f,o,c,C);if(s.BATCH_ID||Object.keys(B).length){s.BATCH_ID?_.BATCH_ID=Qt(s.BATCH_ID,t,a.offset,f):_.BATCH_ID=Oe(f);const e=_.BATCH_ID.array&&_.BATCH_ID.array.buffer;e&&o.indexOf(e)<0&&o.push(e)}return Promise.resolve({count:f,batchTable:B,batchTableBin:E,featureTable:s,pnts:_,transferables:o})}lt(t,e,r,n,A,i,o){const s={};if(e.POSITION){let{byteOffset:i,array:o}=e.POSITION;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+3*n*4);o=new Float32Array(e)}s.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5126,array:o},A.push(o.buffer)}else if(e.POSITION_QUANTIZED){let{byteOffset:a}=e.POSITION_QUANTIZED;const{array:B}=e.POSITION_QUANTIZED;a=a||0;const E=B?0:r;s.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5126,array:this.Et(B||new Uint16Array(t,a+E,3*n),i,o)},A.push(s.POSITION.array.buffer)}if(e.RGBA){let{byteOffset:i,array:o}=e.RGBA;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+4*n);o=new Uint8Array(e)}s.RGBA={byteStride:0,byteOffset:0,itemSize:4,count:n,componentType:5121,array:o},A.push(o.buffer)}else if(e.RGB){let{byteOffset:i,array:o}=e.RGB;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+3*n);o=new Uint8Array(e)}s.RGB={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5121,array:o},A.push(o.buffer)}else if(e.RGB565){let{byteOffset:i,array:o}=e.RGB565;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+2*n);o=new Uint16Array(e)}s.RGB565={byteStride:0,byteOffset:0,itemSize:1,count:n,componentType:5123,array:o},A.push(o.buffer)}if(e.NORMAL){let{byteOffset:i,array:o}=e.NORMAL;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+3*n*4);o=new Float32Array(e)}s.NORMAL={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5126,array:o},A.push(o.buffer)}else if(e.NORMAL_OCT16P){let{byteOffset:i,array:o}=e.NORMAL_OCT16P;i=i||0;const a=o?0:r;if(!o){const e=t.slice(i+a,i+a+2*n);o=new Uint8Array(e)}s.NORMAL_OCT16P={byteStride:0,byteOffset:0,itemSize:2,count:n,componentType:5121,array:o},A.push(o.buffer)}return s}Et(t,e,r){return qt(new Float32Array(t.length),t,e,r)}At(){return null}}function Oe(t){const e=(r=t)<256?Uint8Array:r<65536?Uint16Array:Uint32Array;var r;const n=new e(t);for(let e=0;e<t;e++)n[e]=e;return{byteStride:0,byteOffset:0,itemSize:1,count:t,componentType:zt(e),array:n}}class Le{constructor(t,e,r,n){this.i=r,this.A=t,this.tt=e||ut,this.it=n}load(t,e,r=0,n=0,A){return e?this.rt(t,e,r,n,A):Y.getArrayBuffer(t,{}).then(e=>{const A=e.data;return this.rt(t,A,r,n)})}rt(t,e,r,n,A){n||(n=e.byteLength);const i=this.ut(e,t,r,n),o=[];for(let r=0;r<i.length;r++){let n;if("b3dm"===i[r].magic)n=new De(this.A,this.tt,this.i);else if("i3dm"===i[r].magic)n=new he(this.A,this.tt,this.i,this.it);else if("pnts"===i[r].magic)n=new Pe;else{if("cmpt"!==i[r].magic){console.warn("Unsupported magic in CMPT tile:",i[r].magic);continue}n=new Le(this.A,this.tt,this.i,this.it)}o.push(n.load(t,e,i[r].offset,i[r].byteLength,A).then(t=>t))}return Promise.all(o).then(t=>({magic:"cmpt",tiles:t}))}ut(t,e,r,n){const A=new DataView(t,r,n),i=A.getUint32(4,!0);if(1!==i){const t="Unsupported cmpt version: "+i+", url:"+e;return console.warn(t),{error:t}}if(16===A.byteLength)return[];const o=[],s=A.getUint32(12,!0);let a=16;for(let e=0;e<s;e++){const e=Xt(A,a),n=A.getUint32(a+8,!0);o.push({magic:e,buffer:t,offset:a+r,byteLength:n}),a+=n}return o}}function ye(t,e){if(t.scenes&&t.scenes.length)for(let r=0,n=t.scenes.length;r<n;r++){const n=t.scenes[r].nodes;for(let r=0,A=n.length;r<A;r++){const A=[];me(n[r],A,t,e)}}}const Me=[],Ne=[],Se=[],de=[0,0,0],Ue=d([]),Ge=[1,1,1];function me(t,e,r,n){const A=e.slice(0);if(t.matrix)A.push(t.matrix);else if(t.rotation||t.translation||t.scale){const e=o(Me,t.translation||de),r=a(Ne,t.rotation||Ue),n=s(Se,t.scale||Ge);i(n,r,n);const B=i([],e,n);A.push(B)}if(t.children&&t.children.length)for(let e=0,i=t.children.length;e<i;e++)me(t.children[e],A,r,n);if(void 0!==t.mesh){const e=t.mesh,i=r.meshes[e];if(i){const t=A.slice(0),o=i.primitives;for(let A=0,i=o.length;A<i;A++){const i=o[A];i&&(i.matrices=t,n(i,e,A,r))}}}}function be(t,e){let{byteOffset:r,byteStride:n,count:A}=t;const{componentType:i,itemSize:o}=t,s=t.array.buffer,a=i?ut.getTypedArrayCtor(i):t.array.constructor;if(r=void 0===r?t.array.byteOffset:r,n=n||0,A=A||t.array.length/o,(!n||n===o*a.BYTES_PER_ELEMENT)&&r%a.BYTES_PER_ELEMENT==0){const t=new a(s,r,A*o);for(let n=0;n<A*o;n+=o){e(new a(t.buffer,r+n*a.BYTES_PER_ELEMENT,o),n/o)}return}const B=new Uint8Array(o*a.BYTES_PER_ELEMENT);n||(n=o*a.BYTES_PER_ELEMENT);for(let t=0;t<A;t++){const A=new Uint8Array(s,n*t+r,o*a.BYTES_PER_ELEMENT);B.set(A);e(new a(B.buffer),t),A.set(B)}}const pe=[],we=[];function He(t){"3.0"===t.version&&(t=function(t){const e=JSON.parse(JSON.stringify(t)),r=e.rootTiles;for(let t=0;t<r.length;t++){const{boundingbox:e}=r[t],{center:n,xExtent:A,yExtent:i,zExtent:o}=e,s={x:2*n.x-A.x,y:2*n.y-i.y,z:2*n.z-o.z},a={x:A.x,y:i.y,z:o.z};e.min=s,e.max=a}return e.tiles=r,e}(t));const e={asset:{version:"1.0",gltfUpAxis:"Z",s3mType:t.dataType},extensions:t.extensions,geometricError:0,root:{boundingVolume:{},content:{uri:""},transform:[],geometricError:0,refine:"REPLACE",children:[]}},r=t.position.x,A=t.position.y,i=t.position.z,o=function(t,e,r,n){const A=dt,i=Math.cos(r);Nt[0]=i*Math.cos(e),Nt[1]=i*Math.sin(e),Nt[2]=Math.sin(r),Vt(Nt,Nt),I(St,A,Nt);const o=Math.sqrt(T(Nt,St));var s,a,B;return a=St,B=o,(s=St)[0]=a[0]/B,s[1]=a[1]/B,s[2]=a[2]/B,D(Nt,Nt,n),u(t,St,Nt)}([],Pt(r),Pt(A),i),s=ae(o,null,[]);e.root.transform=n([],s);const a=[];for(let r=0,n=t.tiles.length;r<n;r++)if(t.tiles[r].boundingbox){const n=t.tiles[r].boundingbox;l(pe,n.min.x,n.min.y,n.min.z),l(we,n.max.x,n.max.y,n.max.z);const A={center:[0,0,0],radius:0};Ke(pe,we,A),e.root.children.push({boundingVolume:{sphere:[...A.center,A.radius]},content:{uri:t.tiles[r].url},geometricError:70,refine:"REPLACE"}),a.push(A)}else if(t.tiles[r].boundingsphere){const{boundingsphere:n}=t.tiles[r],A={center:[n.center.x,n.center.y,n.center.z],radius:n.radius};e.root.children.push({boundingVolume:{sphere:[...A.center,A.radius]},content:{uri:t.tiles[r].url},geometricError:70,refine:"REPLACE"}),a.push(A)}const B=function(t,e){if(0===t.length)return e;const r=t.length;if(1===r)return function(t,e){return f(e.center,t.center),e.radius=t.radius,e}(t[0],e);if(2===r)return function(t,e,r){const n=t.center,A=t.radius,i=e.center,o=e.radius,s=_(Ve,i,n),a=er(s);if(A>=a+o)return t.clone(r),r;if(o>=a+A)return e.clone(r),r;const B=.5*(A+a+o),E=D(Je,s,(-A+B)/a);return u(E,E,n),f(r.center,E),r.radius=B,r}(t[0],t[1],e);const n=[];for(let e=0;e<r;e++)n.push(t[e].center);const A=(e=function(t,e){if(0===t.length)return e.center=l(e.center,0,0,0),e.radius=0,e;const r=f(Qe,t[0]),n=f(Xe,r),A=f(ve,r),i=f(Ze,r),o=f(xe,r),s=f(ke,r),a=f(We,r),B=t.length;for(let e=1;e<B;e++){f(r,t[e]);const B=r[0],E=r[1],c=r[2];B<n[0]&&f(n,r),B>o[0]&&f(o,r),E<A[1]&&f(A,r),E>s[1]&&f(s,r),c<i[2]&&f(i,r),c>a[2]&&f(a,r)}const E=tr(_(je,o,n)),c=tr(_(je,s,A)),C=tr(_(je,a,i));let u=n,I=o,D=E;c>D&&(D=c,u=A,I=s);C>D&&(D=C,u=i,I=a);const h=Ye;h[0]=.5*(u[0]+I[0]),h[1]=.5*(u[1]+I[1]),h[2]=.5*(u[2]+I[2]);let R=tr(_(je,I,h)),T=Math.sqrt(R);const F=ze;F[0]=n[0],F[1]=A[1],F[2]=i[2];const P=qe;P[0]=o[0],P[1]=s[1],P[2]=a[2];const O=ge(F,P,$e);let L=0;for(let e=0;e<B;e++){f(r,t[e]);const n=er(_(je,r,O));n>L&&(L=n);const A=tr(_(je,r,h));if(A>R){const t=Math.sqrt(A);T=.5*(T+t),R=T*T;const e=t-T;h[0]=(T*h[0]+e*r[0])/t,h[1]=(T*h[1]+e*r[1])/t,h[2]=(T*h[2]+e*r[2])/t}}T<L?(f(e.center,h),e.radius=T):(f(e.center,O),e.radius=L);return e}(n,e)).center;let i=e.radius;for(let e=0;e<r;e++){const r=t[e];i=Math.max(i,h(A,r.center)+r.radius)}return e.radius=i,e}(a,{center:[0,0,0],radius:0});return e.root.boundingVolume.sphere=[...B.center,B.radius],e}function Ke(t,e,r){let n=ge(t,e,r.center);return r.radius=h(n,e),r}function ge(t,e,r){return r[0]=.5*(t[0]+e[0]),r[1]=.5*(t[1]+e[1]),r[2]=.5*(t[2]+e[2]),r}const Ve=[],Je=[];const Xe=[],ve=[],Ze=[],xe=[],ke=[],We=[],Qe=[],je=[],Ye=[],ze=[],qe=[],$e=[];function tr(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function er(t){return Math.hypot(t[0],t[1],t[2])}\n/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function rr(t){let e=t.length;for(;--e>=0;)t[e]=0}const nr=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]),Ar=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]),ir=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),or=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sr=new Array(576);rr(sr);const ar=new Array(60);rr(ar);const Br=new Array(512);rr(Br);const Er=new Array(256);rr(Er);const cr=new Array(29);rr(cr);const Cr=new Array(30);function fr(t,e,r,n,A){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=A,this.has_stree=t&&t.length}let lr,ur,_r;function Ir(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}rr(Cr);const Dr=t=>t<256?Br[t]:Br[256+(t>>>7)],hr=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Rr=(t,e,r)=>{t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,hr(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},Tr=(t,e,r)=>{Rr(t,r[2*e],r[2*e+1])},Fr=(t,e)=>{let r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1},Pr=(t,e,r)=>{const n=new Array(16);let A,i,o=0;for(A=1;A<=15;A++)o=o+r[A-1]<<1,n[A]=o;for(i=0;i<=e;i++){let e=t[2*i+1];0!==e&&(t[2*i]=Fr(n[e]++,e))}},Or=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Lr=t=>{t.bi_valid>8?hr(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},yr=(t,e,r,n)=>{const A=2*e,i=2*r;return t[A]<t[i]||t[A]===t[i]&&n[e]<=n[r]},Mr=(t,e,r)=>{const n=t.heap[r];let A=r<<1;for(;A<=t.heap_len&&(A<t.heap_len&&yr(e,t.heap[A+1],t.heap[A],t.depth)&&A++,!yr(e,n,t.heap[A],t.depth));)t.heap[r]=t.heap[A],r=A,A<<=1;t.heap[r]=n},Nr=(t,e,r)=>{let n,A,i,o,s=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+s++],n+=(255&t.pending_buf[t.sym_buf+s++])<<8,A=t.pending_buf[t.sym_buf+s++],0===n?Tr(t,A,e):(i=Er[A],Tr(t,i+256+1,e),o=nr[i],0!==o&&(A-=cr[i],Rr(t,A,o)),n--,i=Dr(n),Tr(t,i,r),o=Ar[i],0!==o&&(n-=Cr[i],Rr(t,n,o)))}while(s<t.sym_next);Tr(t,256,e)},Sr=(t,e)=>{const r=e.dyn_tree,n=e.stat_desc.static_tree,A=e.stat_desc.has_stree,i=e.stat_desc.elems;let o,s,a,B=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<i;o++)0!==r[2*o]?(t.heap[++t.heap_len]=B=o,t.depth[o]=0):r[2*o+1]=0;for(;t.heap_len<2;)a=t.heap[++t.heap_len]=B<2?++B:0,r[2*a]=1,t.depth[a]=0,t.opt_len--,A&&(t.static_len-=n[2*a+1]);for(e.max_code=B,o=t.heap_len>>1;o>=1;o--)Mr(t,r,o);a=i;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Mr(t,r,1),s=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=s,r[2*a]=r[2*o]+r[2*s],t.depth[a]=(t.depth[o]>=t.depth[s]?t.depth[o]:t.depth[s])+1,r[2*o+1]=r[2*s+1]=a,t.heap[1]=a++,Mr(t,r,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const r=e.dyn_tree,n=e.max_code,A=e.stat_desc.static_tree,i=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,a=e.stat_desc.max_length;let B,E,c,C,f,l,u=0;for(C=0;C<=15;C++)t.bl_count[C]=0;for(r[2*t.heap[t.heap_max]+1]=0,B=t.heap_max+1;B<573;B++)E=t.heap[B],C=r[2*r[2*E+1]+1]+1,C>a&&(C=a,u++),r[2*E+1]=C,E>n||(t.bl_count[C]++,f=0,E>=s&&(f=o[E-s]),l=r[2*E],t.opt_len+=l*(C+f),i&&(t.static_len+=l*(A[2*E+1]+f)));if(0!==u){do{for(C=a-1;0===t.bl_count[C];)C--;t.bl_count[C]--,t.bl_count[C+1]+=2,t.bl_count[a]--,u-=2}while(u>0);for(C=a;0!==C;C--)for(E=t.bl_count[C];0!==E;)c=t.heap[--B],c>n||(r[2*c+1]!==C&&(t.opt_len+=(C-r[2*c+1])*r[2*c],r[2*c+1]=C),E--)}})(t,e),Pr(r,B,t.bl_count)},dr=(t,e,r)=>{let n,A,i=-1,o=e[1],s=0,a=7,B=4;for(0===o&&(a=138,B=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)A=o,o=e[2*(n+1)+1],++s<a&&A===o||(s<B?t.bl_tree[2*A]+=s:0!==A?(A!==i&&t.bl_tree[2*A]++,t.bl_tree[32]++):s<=10?t.bl_tree[34]++:t.bl_tree[36]++,s=0,i=A,0===o?(a=138,B=3):A===o?(a=6,B=3):(a=7,B=4))},Ur=(t,e,r)=>{let n,A,i=-1,o=e[1],s=0,a=7,B=4;for(0===o&&(a=138,B=3),n=0;n<=r;n++)if(A=o,o=e[2*(n+1)+1],!(++s<a&&A===o)){if(s<B)do{Tr(t,A,t.bl_tree)}while(0!=--s);else 0!==A?(A!==i&&(Tr(t,A,t.bl_tree),s--),Tr(t,16,t.bl_tree),Rr(t,s-3,2)):s<=10?(Tr(t,17,t.bl_tree),Rr(t,s-3,3)):(Tr(t,18,t.bl_tree),Rr(t,s-11,7));s=0,i=A,0===o?(a=138,B=3):A===o?(a=6,B=3):(a=7,B=4)}};let Gr=!1;const mr=(t,e,r,n)=>{Rr(t,0+(n?1:0),3),Lr(t),hr(t,r),hr(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r};var br={_t:t=>{Gr||((()=>{let t,e,r,n,A;const i=new Array(16);for(r=0,n=0;n<28;n++)for(cr[n]=r,t=0;t<1<<nr[n];t++)Er[r++]=n;for(Er[r-1]=n,A=0,n=0;n<16;n++)for(Cr[n]=A,t=0;t<1<<Ar[n];t++)Br[A++]=n;for(A>>=7;n<30;n++)for(Cr[n]=A<<7,t=0;t<1<<Ar[n]-7;t++)Br[256+A++]=n;for(e=0;e<=15;e++)i[e]=0;for(t=0;t<=143;)sr[2*t+1]=8,t++,i[8]++;for(;t<=255;)sr[2*t+1]=9,t++,i[9]++;for(;t<=279;)sr[2*t+1]=7,t++,i[7]++;for(;t<=287;)sr[2*t+1]=8,t++,i[8]++;for(Pr(sr,287,i),t=0;t<30;t++)ar[2*t+1]=5,ar[2*t]=Fr(t,5);lr=new fr(sr,nr,257,286,15),ur=new fr(ar,Ar,0,30,15),_r=new fr(new Array(0),ir,0,19,7)})(),Gr=!0),t.l_desc=new Ir(t.dyn_ltree,lr),t.d_desc=new Ir(t.dyn_dtree,ur),t.bl_desc=new Ir(t.bl_tree,_r),t.bi_buf=0,t.bi_valid=0,Or(t)},It:mr,Dt:(t,e,r,n)=>{let A,i,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),Sr(t,t.l_desc),Sr(t,t.d_desc),o=(t=>{let e;for(dr(t,t.dyn_ltree,t.l_desc.max_code),dr(t,t.dyn_dtree,t.d_desc.max_code),Sr(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*or[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),A=t.opt_len+3+7>>>3,i=t.static_len+3+7>>>3,i<=A&&(A=i)):A=i=r+5,r+4<=A&&-1!==e?mr(t,e,r,n):4===t.strategy||i===A?(Rr(t,2+(n?1:0),3),Nr(t,sr,ar)):(Rr(t,4+(n?1:0),3),((t,e,r,n)=>{let A;for(Rr(t,e-257,5),Rr(t,r-1,5),Rr(t,n-4,4),A=0;A<n;A++)Rr(t,t.bl_tree[2*or[A]+1],3);Ur(t,t.dyn_ltree,e-1),Ur(t,t.dyn_dtree,r-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),Nr(t,t.dyn_ltree,t.dyn_dtree)),Or(t),n&&Lr(t)},ht:(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(Er[r]+256+1)]++,t.dyn_dtree[2*Dr(e)]++),t.sym_next===t.sym_end),Rt:t=>{Rr(t,2,3),Tr(t,256,sr),(t=>{16===t.bi_valid?(hr(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}};var pr=(t,e,r,n)=>{let A=65535&t|0,i=t>>>16&65535|0,o=0;for(;0!==r;){o=r>2e3?2e3:r,r-=o;do{A=A+e[n++]|0,i=i+A|0}while(--o);A%=65521,i%=65521}return A|i<<16|0};const wr=new Uint32Array((()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e})());var Hr=(t,e,r,n)=>{const A=wr,i=n+r;t^=-1;for(let r=n;r<i;r++)t=t>>>8^A[255&(t^e[r])];return-1^t},Kr={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"},gr={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{_t:Vr,It:Jr,Dt:Xr,ht:vr,Rt:Zr}=br,{Z_NO_FLUSH:xr,Z_PARTIAL_FLUSH:kr,Z_FULL_FLUSH:Wr,Z_FINISH:Qr,Z_BLOCK:jr,Z_OK:Yr,Z_STREAM_END:zr,Z_STREAM_ERROR:qr,Z_DATA_ERROR:$r,Z_BUF_ERROR:tn,Z_DEFAULT_COMPRESSION:en,Z_FILTERED:rn,Z_HUFFMAN_ONLY:nn,Z_RLE:An,Z_FIXED:on,Z_DEFAULT_STRATEGY:sn,Z_UNKNOWN:an,Z_DEFLATED:Bn}=gr,En=(t,e)=>(t.msg=Kr[e],e),cn=t=>2*t-(t>4?9:0),Cn=t=>{let e=t.length;for(;--e>=0;)t[e]=0},fn=t=>{let e,r,n,A=t.w_size;e=t.hash_size,n=e;do{r=t.head[--n],t.head[n]=r>=A?r-A:0}while(--e);e=A,n=e;do{r=t.prev[--n],t.prev[n]=r>=A?r-A:0}while(--e)};let ln=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask;const un=t=>{const e=t.state;let r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))},_n=(t,e)=>{Xr(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,un(t.strm)},In=(t,e)=>{t.pending_buf[t.pending++]=e},Dn=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},hn=(t,e,r,n)=>{let A=t.avail_in;return A>n&&(A=n),0===A?0:(t.avail_in-=A,e.set(t.input.subarray(t.next_in,t.next_in+A),r),1===t.state.wrap?t.adler=pr(t.adler,e,A,r):2===t.state.wrap&&(t.adler=Hr(t.adler,e,A,r)),t.next_in+=A,t.total_in+=A,A)},Rn=(t,e)=>{let r,n,A=t.max_chain_length,i=t.strstart,o=t.prev_length,s=t.nice_match;const a=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,B=t.window,E=t.w_mask,c=t.prev,C=t.strstart+258;let f=B[i+o-1],l=B[i+o];t.prev_length>=t.good_match&&(A>>=2),s>t.lookahead&&(s=t.lookahead);do{if(r=e,B[r+o]===l&&B[r+o-1]===f&&B[r]===B[i]&&B[++r]===B[i+1]){i+=2,r++;do{}while(B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&B[++i]===B[++r]&&i<C);if(n=258-(C-i),i=C-258,n>o){if(t.match_start=e,o=n,n>=s)break;f=B[i+o-1],l=B[i+o]}}}while((e=c[e&E])>a&&0!=--A);return o<=t.lookahead?o:t.lookahead},Tn=t=>{const e=t.w_size;let r,n,A;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-262)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),fn(t),n+=e),0===t.strm.avail_in)break;if(r=hn(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=3)for(A=t.strstart-t.insert,t.ins_h=t.window[A],t.ins_h=ln(t,t.ins_h,t.window[A+1]);t.insert&&(t.ins_h=ln(t,t.ins_h,t.window[A+3-1]),t.prev[A&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=A,A++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)},Fn=(t,e)=>{let r,n,A,i=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,s=t.strm.avail_in;do{if(r=65535,A=t.bi_valid+42>>3,t.strm.avail_out<A)break;if(A=t.strm.avail_out-A,n=t.strstart-t.block_start,r>n+t.strm.avail_in&&(r=n+t.strm.avail_in),r>A&&(r=A),r<i&&(0===r&&e!==Qr||e===xr||r!==n+t.strm.avail_in))break;o=e===Qr&&r===n+t.strm.avail_in?1:0,Jr(t,0,0,o),t.pending_buf[t.pending-4]=r,t.pending_buf[t.pending-3]=r>>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,un(t.strm),n&&(n>r&&(n=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,r-=n),r&&(hn(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(0===o);return s-=t.strm.avail_in,s&&(s>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=s&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-s,t.strm.next_in),t.strstart),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?4:e!==xr&&e!==Qr&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(A=t.window_size-t.strstart,t.strm.avail_in>A&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,A+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),A>t.strm.avail_in&&(A=t.strm.avail_in),A&&(hn(t.strm,t.window,t.strstart,A),t.strstart+=A,t.insert+=A>t.w_size-t.insert?t.w_size-t.insert:A),t.high_water<t.strstart&&(t.high_water=t.strstart),A=t.bi_valid+42>>3,A=t.pending_buf_size-A>65535?65535:t.pending_buf_size-A,i=A>t.w_size?t.w_size:A,n=t.strstart-t.block_start,(n>=i||(n||e===Qr)&&e!==xr&&0===t.strm.avail_in&&n<=A)&&(r=n>A?A:n,o=e===Qr&&0===t.strm.avail_in&&r===n?1:0,Jr(t,t.block_start,r,o),t.block_start+=r,un(t.strm)),o?3:1)},Pn=(t,e)=>{let r,n;for(;;){if(t.lookahead<262){if(Tn(t),t.lookahead<262&&e===xr)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=ln(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-262&&(t.match_length=Rn(t,r)),t.match_length>=3)if(n=vr(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=ln(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=ln(t,t.ins_h,t.window[t.strstart+1]);else n=vr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(_n(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===Qr?(_n(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(_n(t,!1),0===t.strm.avail_out)?1:2},On=(t,e)=>{let r,n,A;for(;;){if(t.lookahead<262){if(Tn(t),t.lookahead<262&&e===xr)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=ln(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-262&&(t.match_length=Rn(t,r),t.match_length<=5&&(t.strategy===rn||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){A=t.strstart+t.lookahead-3,n=vr(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=A&&(t.ins_h=ln(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(_n(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=vr(t,0,t.window[t.strstart-1]),n&&_n(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=vr(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===Qr?(_n(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(_n(t,!1),0===t.strm.avail_out)?1:2};function Ln(t,e,r,n,A){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=A}const yn=[new Ln(0,0,0,0,Fn),new Ln(4,4,8,4,Pn),new Ln(4,5,16,8,Pn),new Ln(4,6,32,32,Pn),new Ln(4,4,16,16,On),new Ln(8,16,32,32,On),new Ln(8,16,128,128,On),new Ln(8,32,128,256,On),new Ln(32,128,258,1024,On),new Ln(32,258,258,4096,On)];function Mn(){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=Bn,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),Cn(this.dyn_ltree),Cn(this.dyn_dtree),Cn(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),Cn(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Cn(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 Nn=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||42!==e.status&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&113!==e.status&&666!==e.status?1:0},Sn=t=>{if(Nn(t))return En(t,qr);t.total_in=t.total_out=0,t.data_type=an;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=-2,Vr(e),Yr},dn=t=>{const e=Sn(t);var r;return e===Yr&&((r=t.state).window_size=2*r.w_size,Cn(r.head),r.max_lazy_match=yn[r.level].max_lazy,r.good_match=yn[r.level].good_length,r.nice_match=yn[r.level].nice_length,r.max_chain_length=yn[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),e},Un=(t,e,r,n,A,i)=>{if(!t)return qr;let o=1;if(e===en&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),A<1||A>9||r!==Bn||n<8||n>15||e<0||e>9||i<0||i>on||8===n&&1!==o)return En(t,qr);8===n&&(n=9);const s=new Mn;return t.state=s,s.strm=t,s.status=42,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=A+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<<A+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=e,s.strategy=i,s.method=r,dn(t)};var Gn={deflateInit:(t,e)=>Un(t,e,Bn,15,8,sn),deflateInit2:Un,deflateReset:dn,deflateResetKeep:Sn,deflateSetHeader:(t,e)=>Nn(t)||2!==t.state.wrap?qr:(t.state.gzhead=e,Yr),deflate:(t,e)=>{if(Nn(t)||e>jr||e<0)return t?En(t,qr):qr;const r=t.state;if(!t.output||0!==t.avail_in&&!t.input||666===r.status&&e!==Qr)return En(t,0===t.avail_out?tn:qr);const n=r.last_flush;if(r.last_flush=e,0!==r.pending){if(un(t),0===t.avail_out)return r.last_flush=-1,Yr}else if(0===t.avail_in&&cn(e)<=cn(n)&&e!==Qr)return En(t,tn);if(666===r.status&&0!==t.avail_in)return En(t,tn);if(42===r.status&&0===r.wrap&&(r.status=113),42===r.status){let e=Bn+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=nn||r.level<2?0:r.level<6?1:6===r.level?2:3,e|=n<<6,0!==r.strstart&&(e|=32),e+=31-e%31,Dn(r,e),0!==r.strstart&&(Dn(r,t.adler>>>16),Dn(r,65535&t.adler)),t.adler=1,r.status=113,un(t),0!==r.pending)return r.last_flush=-1,Yr}if(57===r.status)if(t.adler=0,In(r,31),In(r,139),In(r,8),r.gzhead)In(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),In(r,255&r.gzhead.time),In(r,r.gzhead.time>>8&255),In(r,r.gzhead.time>>16&255),In(r,r.gzhead.time>>24&255),In(r,9===r.level?2:r.strategy>=nn||r.level<2?4:0),In(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(In(r,255&r.gzhead.extra.length),In(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Hr(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(In(r,0),In(r,0),In(r,0),In(r,0),In(r,0),In(r,9===r.level?2:r.strategy>=nn||r.level<2?4:0),In(r,3),r.status=113,un(t),0!==r.pending)return r.last_flush=-1,Yr;if(69===r.status){if(r.gzhead.extra){let e=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let A=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+A),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>e&&(t.adler=Hr(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex+=A,un(t),0!==r.pending)return r.last_flush=-1,Yr;e=0,n-=A}let A=new Uint8Array(r.gzhead.extra);r.pending_buf.set(A.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>e&&(t.adler=Hr(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let e,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Hr(t.adler,r.pending_buf,r.pending-n,n)),un(t),0!==r.pending)return r.last_flush=-1,Yr;n=0}e=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,In(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>n&&(t.adler=Hr(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let e,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Hr(t.adler,r.pending_buf,r.pending-n,n)),un(t),0!==r.pending)return r.last_flush=-1,Yr;n=0}e=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,In(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>n&&(t.adler=Hr(t.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(un(t),0!==r.pending))return r.last_flush=-1,Yr;In(r,255&t.adler),In(r,t.adler>>8&255),t.adler=0}if(r.status=113,un(t),0!==r.pending)return r.last_flush=-1,Yr}if(0!==t.avail_in||0!==r.lookahead||e!==xr&&666!==r.status){let n=0===r.level?Fn(r,e):r.strategy===nn?((t,e)=>{let r;for(;;){if(0===t.lookahead&&(Tn(t),0===t.lookahead)){if(e===xr)return 1;break}if(t.match_length=0,r=vr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(_n(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Qr?(_n(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(_n(t,!1),0===t.strm.avail_out)?1:2})(r,e):r.strategy===An?((t,e)=>{let r,n,A,i;const o=t.window;for(;;){if(t.lookahead<=258){if(Tn(t),t.lookahead<=258&&e===xr)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(A=t.strstart-1,n=o[A],n===o[++A]&&n===o[++A]&&n===o[++A])){i=t.strstart+258;do{}while(n===o[++A]&&n===o[++A]&&n===o[++A]&&n===o[++A]&&n===o[++A]&&n===o[++A]&&n===o[++A]&&n===o[++A]&&A<i);t.match_length=258-(i-A),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=vr(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=vr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(_n(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Qr?(_n(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(_n(t,!1),0===t.strm.avail_out)?1:2})(r,e):yn[r.level].func(r,e);if(3!==n&&4!==n||(r.status=666),1===n||3===n)return 0===t.avail_out&&(r.last_flush=-1),Yr;if(2===n&&(e===kr?Zr(r):e!==jr&&(Jr(r,0,0,!1),e===Wr&&(Cn(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),un(t),0===t.avail_out))return r.last_flush=-1,Yr}return e!==Qr?Yr:r.wrap<=0?zr:(2===r.wrap?(In(r,255&t.adler),In(r,t.adler>>8&255),In(r,t.adler>>16&255),In(r,t.adler>>24&255),In(r,255&t.total_in),In(r,t.total_in>>8&255),In(r,t.total_in>>16&255),In(r,t.total_in>>24&255)):(Dn(r,t.adler>>>16),Dn(r,65535&t.adler)),un(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Yr:zr)},deflateEnd:t=>{if(Nn(t))return qr;const e=t.state.status;return t.state=null,113===e?En(t,$r):Yr},deflateSetDictionary:(t,e)=>{let r=e.length;if(Nn(t))return qr;const n=t.state,A=n.wrap;if(2===A||1===A&&42!==n.status||n.lookahead)return qr;if(1===A&&(t.adler=pr(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){0===A&&(Cn(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(r-n.w_size,r),0),e=t,r=n.w_size}const i=t.avail_in,o=t.next_in,s=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,Tn(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=ln(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Tn(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=s,t.avail_in=i,n.wrap=A,Yr},deflateInfo:"pako deflate (from Nodeca project)"};const mn=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var bn=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const e in r)mn(r,e)&&(t[e]=r[e])}}return t},pn=t=>{let e=0;for(let r=0,n=t.length;r<n;r++)e+=t[r].length;const r=new Uint8Array(e);for(let e=0,n=0,A=t.length;e<A;e++){let A=t[e];r.set(A,n),n+=A.length}return r};let wn=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){wn=!1}const Hn=new Uint8Array(256);for(let t=0;t<256;t++)Hn[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Hn[254]=Hn[254]=1;var Kn=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,r,n,A,i,o=t.length,s=0;for(A=0;A<o;A++)r=t.charCodeAt(A),55296==(64512&r)&&A+1<o&&(n=t.charCodeAt(A+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),A++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),i=0,A=0;i<s;A++)r=t.charCodeAt(A),55296==(64512&r)&&A+1<o&&(n=t.charCodeAt(A+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),A++)),r<128?e[i++]=r:r<2048?(e[i++]=192|r>>>6,e[i++]=128|63&r):r<65536?(e[i++]=224|r>>>12,e[i++]=128|r>>>6&63,e[i++]=128|63&r):(e[i++]=240|r>>>18,e[i++]=128|r>>>12&63,e[i++]=128|r>>>6&63,e[i++]=128|63&r);return e},gn=(t,e)=>{const r=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,A;const i=new Array(2*r);for(A=0,n=0;n<r;){let e=t[n++];if(e<128){i[A++]=e;continue}let o=Hn[e];if(o>4)i[A++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n<r;)e=e<<6|63&t[n++],o--;o>1?i[A++]=65533:e<65536?i[A++]=e:(e-=65536,i[A++]=55296|e>>10&1023,i[A++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&wn)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r})(i,A)},Vn=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let r=e-1;for(;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+Hn[t[r]]>e?r:e};var Jn=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 Xn=Object.prototype.toString,{Z_NO_FLUSH:vn,Z_SYNC_FLUSH:Zn,Z_FULL_FLUSH:xn,Z_FINISH:kn,Z_OK:Wn,Z_STREAM_END:Qn,Z_DEFAULT_COMPRESSION:jn,Z_DEFAULT_STRATEGY:Yn,Z_DEFLATED:zn}=gr;function qn(t){this.options=bn({level:jn,method:zn,chunkSize:16384,windowBits:15,memLevel:8,strategy:Yn},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Jn,this.strm.avail_out=0;let r=Gn.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==Wn)throw new Error(Kr[r]);if(e.header&&Gn.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?Kn(e.dictionary):"[object ArrayBuffer]"===Xn.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,r=Gn.deflateSetDictionary(this.strm,t),r!==Wn)throw new Error(Kr[r]);this.Tt=!0}}function $n(t,e){const r=new qn(e);if(r.push(t,!0),r.err)throw r.msg||Kr[r.err];return r.result}qn.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize;let A,i;if(this.ended)return!1;for(i=e===~~e?e:!0===e?kn:vn,"string"==typeof t?r.input=Kn(t):"[object ArrayBuffer]"===Xn.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(i===Zn||i===xn)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(A=Gn.deflate(r,i),A===Qn)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),A=Gn.deflateEnd(this.strm),this.onEnd(A),this.ended=!0,A===Wn;if(0!==r.avail_out){if(i>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},qn.prototype.onData=function(t){this.chunks.push(t)},qn.prototype.onEnd=function(t){t===Wn&&(this.result=pn(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var tA={Deflate:qn,deflate:$n,deflateRaw:function(t,e){return(e=e||{}).raw=!0,$n(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,$n(t,e)},constants:gr};var eA=function(t,e){let r,n,A,i,o,s,a,B,E,c,C,f,l,u,_,I,D,h,R,T,F,P,O,L;const y=t.state;r=t.next_in,O=t.input,n=r+(t.avail_in-5),A=t.next_out,L=t.output,i=A-(e-t.avail_out),o=A+(t.avail_out-257),s=y.dmax,a=y.wsize,B=y.whave,E=y.wnext,c=y.window,C=y.hold,f=y.bits,l=y.lencode,u=y.distcode,_=(1<<y.lenbits)-1,I=(1<<y.distbits)-1;t:do{f<15&&(C+=O[r++]<<f,f+=8,C+=O[r++]<<f,f+=8),D=l[C&_];e:for(;;){if(h=D>>>24,C>>>=h,f-=h,h=D>>>16&255,0===h)L[A++]=65535&D;else{if(!(16&h)){if(0==(64&h)){D=l[(65535&D)+(C&(1<<h)-1)];continue e}if(32&h){y.mode=16191;break t}t.msg="invalid literal/length code",y.mode=16209;break t}R=65535&D,h&=15,h&&(f<h&&(C+=O[r++]<<f,f+=8),R+=C&(1<<h)-1,C>>>=h,f-=h),f<15&&(C+=O[r++]<<f,f+=8,C+=O[r++]<<f,f+=8),D=u[C&I];r:for(;;){if(h=D>>>24,C>>>=h,f-=h,h=D>>>16&255,!(16&h)){if(0==(64&h)){D=u[(65535&D)+(C&(1<<h)-1)];continue r}t.msg="invalid distance code",y.mode=16209;break t}if(T=65535&D,h&=15,f<h&&(C+=O[r++]<<f,f+=8,f<h&&(C+=O[r++]<<f,f+=8)),T+=C&(1<<h)-1,T>s){t.msg="invalid distance too far back",y.mode=16209;break t}if(C>>>=h,f-=h,h=A-i,T>h){if(h=T-h,h>B&&y.sane){t.msg="invalid distance too far back",y.mode=16209;break t}if(F=0,P=c,0===E){if(F+=a-h,h<R){R-=h;do{L[A++]=c[F++]}while(--h);F=A-T,P=L}}else if(E<h){if(F+=a+E-h,h-=E,h<R){R-=h;do{L[A++]=c[F++]}while(--h);if(F=0,E<R){h=E,R-=h;do{L[A++]=c[F++]}while(--h);F=A-T,P=L}}}else if(F+=E-h,h<R){R-=h;do{L[A++]=c[F++]}while(--h);F=A-T,P=L}for(;R>2;)L[A++]=P[F++],L[A++]=P[F++],L[A++]=P[F++],R-=3;R&&(L[A++]=P[F++],R>1&&(L[A++]=P[F++]))}else{F=A-T;do{L[A++]=L[F++],L[A++]=L[F++],L[A++]=L[F++],R-=3}while(R>2);R&&(L[A++]=L[F++],R>1&&(L[A++]=L[F++]))}break}}break}}while(r<n&&A<o);R=f>>3,r-=R,f-=R<<3,C&=(1<<f)-1,t.next_in=r,t.next_out=A,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=A<o?o-A+257:257-(A-o),y.hold=C,y.bits=f};const rA=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]),nA=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]),AA=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]),iA=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 oA=(t,e,r,n,A,i,o,s)=>{const a=s.bits;let B,E,c,C,f,l,u=0,_=0,I=0,D=0,h=0,R=0,T=0,F=0,P=0,O=0,L=null;const y=new Uint16Array(16),M=new Uint16Array(16);let N,S,d,U=null;for(u=0;u<=15;u++)y[u]=0;for(_=0;_<n;_++)y[e[r+_]]++;for(h=a,D=15;D>=1&&0===y[D];D--);if(h>D&&(h=D),0===D)return A[i++]=20971520,A[i++]=20971520,s.bits=1,0;for(I=1;I<D&&0===y[I];I++);for(h<I&&(h=I),F=1,u=1;u<=15;u++)if(F<<=1,F-=y[u],F<0)return-1;if(F>0&&(0===t||1!==D))return-1;for(M[1]=0,u=1;u<15;u++)M[u+1]=M[u]+y[u];for(_=0;_<n;_++)0!==e[r+_]&&(o[M[e[r+_]]++]=_);if(0===t?(L=U=o,l=20):1===t?(L=rA,U=nA,l=257):(L=AA,U=iA,l=0),O=0,_=0,u=I,f=i,R=h,T=0,c=-1,P=1<<h,C=P-1,1===t&&P>852||2===t&&P>592)return 1;for(;;){N=u-T,o[_]+1<l?(S=0,d=o[_]):o[_]>=l?(S=U[o[_]-l],d=L[o[_]-l]):(S=96,d=0),B=1<<u-T,E=1<<R,I=E;do{E-=B,A[f+(O>>T)+E]=N<<24|S<<16|d|0}while(0!==E);for(B=1<<u-1;O&B;)B>>=1;if(0!==B?(O&=B-1,O+=B):O=0,_++,0==--y[u]){if(u===D)break;u=e[r+o[_]]}if(u>h&&(O&C)!==c){for(0===T&&(T=h),f+=I,R=u-T,F=1<<R;R+T<D&&(F-=y[R+T],!(F<=0));)R++,F<<=1;if(P+=1<<R,1===t&&P>852||2===t&&P>592)return 1;c=O&C,A[c]=h<<24|R<<16|f-i|0}}return 0!==O&&(A[f+O]=u-T<<24|64<<16|0),s.bits=h,0};const{Z_FINISH:sA,Z_BLOCK:aA,Z_TREES:BA,Z_OK:EA,Z_STREAM_END:cA,Z_NEED_DICT:CA,Z_STREAM_ERROR:fA,Z_DATA_ERROR:lA,Z_MEM_ERROR:uA,Z_BUF_ERROR:_A,Z_DEFLATED:IA}=gr,DA=16209,hA=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function RA(){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 TA=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<16180||e.mode>16211?1:0},FA=t=>{if(TA(t))return fA;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=16180,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,EA},PA=t=>{if(TA(t))return fA;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,FA(t)},OA=(t,e)=>{let r;if(TA(t))return fA;const n=t.state;return e<0?(r=0,e=-e):(r=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?fA:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,PA(t))},LA=(t,e)=>{if(!t)return fA;const r=new RA;t.state=r,r.strm=t,r.window=null,r.mode=16180;const n=OA(t,e);return n!==EA&&(t.state=null),n};let yA,MA,NA=!0;const SA=t=>{if(NA){yA=new Int32Array(512),MA=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(oA(1,t.lens,0,288,yA,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;oA(2,t.lens,0,32,MA,0,t.work,{bits:5}),NA=!1}t.lencode=yA,t.lenbits=9,t.distcode=MA,t.distbits=5},dA=(t,e,r,n)=>{let A;const i=t.state;return null===i.window&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new Uint8Array(i.wsize)),n>=i.wsize?(i.window.set(e.subarray(r-i.wsize,r),0),i.wnext=0,i.whave=i.wsize):(A=i.wsize-i.wnext,A>n&&(A=n),i.window.set(e.subarray(r-n,r-n+A),i.wnext),(n-=A)?(i.window.set(e.subarray(r-n,r),0),i.wnext=n,i.whave=i.wsize):(i.wnext+=A,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=A))),0};var UA={inflateReset:PA,inflateReset2:OA,inflateResetKeep:FA,inflateInit:t=>LA(t,15),inflateInit2:LA,inflate:(t,e)=>{let r,n,A,i,o,s,a,B,E,c,C,f,l,u,_,I,D,h,R,T,F,P,O=0;const L=new Uint8Array(4);let y,M;const N=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(TA(t)||!t.output||!t.input&&0!==t.avail_in)return fA;r=t.state,16191===r.mode&&(r.mode=16192),o=t.next_out,A=t.output,a=t.avail_out,i=t.next_in,n=t.input,s=t.avail_in,B=r.hold,E=r.bits,c=s,C=a,P=EA;t:for(;;)switch(r.mode){case 16180:if(0===r.wrap){r.mode=16192;break}for(;E<16;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(2&r.wrap&&35615===B){0===r.wbits&&(r.wbits=15),r.check=0,L[0]=255&B,L[1]=B>>>8&255,r.check=Hr(r.check,L,2,0),B=0,E=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&B)<<8)+(B>>8))%31){t.msg="incorrect header check",r.mode=DA;break}if((15&B)!==IA){t.msg="unknown compression method",r.mode=DA;break}if(B>>>=4,E-=4,F=8+(15&B),0===r.wbits&&(r.wbits=F),F>15||F>r.wbits){t.msg="invalid window size",r.mode=DA;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=512&B?16189:16191,B=0,E=0;break;case 16181:for(;E<16;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(r.flags=B,(255&r.flags)!==IA){t.msg="unknown compression method",r.mode=DA;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=DA;break}r.head&&(r.head.text=B>>8&1),512&r.flags&&4&r.wrap&&(L[0]=255&B,L[1]=B>>>8&255,r.check=Hr(r.check,L,2,0)),B=0,E=0,r.mode=16182;case 16182:for(;E<32;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.head&&(r.head.time=B),512&r.flags&&4&r.wrap&&(L[0]=255&B,L[1]=B>>>8&255,L[2]=B>>>16&255,L[3]=B>>>24&255,r.check=Hr(r.check,L,4,0)),B=0,E=0,r.mode=16183;case 16183:for(;E<16;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.head&&(r.head.xflags=255&B,r.head.os=B>>8),512&r.flags&&4&r.wrap&&(L[0]=255&B,L[1]=B>>>8&255,r.check=Hr(r.check,L,2,0)),B=0,E=0,r.mode=16184;case 16184:if(1024&r.flags){for(;E<16;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.length=B,r.head&&(r.head.extra_len=B),512&r.flags&&4&r.wrap&&(L[0]=255&B,L[1]=B>>>8&255,r.check=Hr(r.check,L,2,0)),B=0,E=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(f=r.length,f>s&&(f=s),f&&(r.head&&(F=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(i,i+f),F)),512&r.flags&&4&r.wrap&&(r.check=Hr(r.check,n,f,i)),s-=f,i+=f,r.length-=f),r.length))break t;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===s)break t;f=0;do{F=n[i+f++],r.head&&F&&r.length<65536&&(r.head.name+=String.fromCharCode(F))}while(F&&f<s);if(512&r.flags&&4&r.wrap&&(r.check=Hr(r.check,n,f,i)),s-=f,i+=f,F)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===s)break t;f=0;do{F=n[i+f++],r.head&&F&&r.length<65536&&(r.head.comment+=String.fromCharCode(F))}while(F&&f<s);if(512&r.flags&&4&r.wrap&&(r.check=Hr(r.check,n,f,i)),s-=f,i+=f,F)break t}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;E<16;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(4&r.wrap&&B!==(65535&r.check)){t.msg="header crc mismatch",r.mode=DA;break}B=0,E=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=16191;break;case 16189:for(;E<32;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}t.adler=r.check=hA(B),B=0,E=0,r.mode=16190;case 16190:if(0===r.havedict)return t.next_out=o,t.avail_out=a,t.next_in=i,t.avail_in=s,r.hold=B,r.bits=E,CA;t.adler=r.check=1,r.mode=16191;case 16191:if(e===aA||e===BA)break t;case 16192:if(r.last){B>>>=7&E,E-=7&E,r.mode=16206;break}for(;E<3;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}switch(r.last=1&B,B>>>=1,E-=1,3&B){case 0:r.mode=16193;break;case 1:if(SA(r),r.mode=16199,e===BA){B>>>=2,E-=2;break t}break;case 2:r.mode=16196;break;case 3:t.msg="invalid block type",r.mode=DA}B>>>=2,E-=2;break;case 16193:for(B>>>=7&E,E-=7&E;E<32;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if((65535&B)!=(B>>>16^65535)){t.msg="invalid stored block lengths",r.mode=DA;break}if(r.length=65535&B,B=0,E=0,r.mode=16194,e===BA)break t;case 16194:r.mode=16195;case 16195:if(f=r.length,f){if(f>s&&(f=s),f>a&&(f=a),0===f)break t;A.set(n.subarray(i,i+f),o),s-=f,i+=f,a-=f,o+=f,r.length-=f;break}r.mode=16191;break;case 16196:for(;E<14;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(r.nlen=257+(31&B),B>>>=5,E-=5,r.ndist=1+(31&B),B>>>=5,E-=5,r.ncode=4+(15&B),B>>>=4,E-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=DA;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;E<3;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.lens[N[r.have++]]=7&B,B>>>=3,E-=3}for(;r.have<19;)r.lens[N[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,y={bits:r.lenbits},P=oA(0,r.lens,0,19,r.lencode,0,r.work,y),r.lenbits=y.bits,P){t.msg="invalid code lengths set",r.mode=DA;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;O=r.lencode[B&(1<<r.lenbits)-1],_=O>>>24,I=O>>>16&255,D=65535&O,!(_<=E);){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(D<16)B>>>=_,E-=_,r.lens[r.have++]=D;else{if(16===D){for(M=_+2;E<M;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(B>>>=_,E-=_,0===r.have){t.msg="invalid bit length repeat",r.mode=DA;break}F=r.lens[r.have-1],f=3+(3&B),B>>>=2,E-=2}else if(17===D){for(M=_+3;E<M;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}B>>>=_,E-=_,F=0,f=3+(7&B),B>>>=3,E-=3}else{for(M=_+7;E<M;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}B>>>=_,E-=_,F=0,f=11+(127&B),B>>>=7,E-=7}if(r.have+f>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=DA;break}for(;f--;)r.lens[r.have++]=F}}if(r.mode===DA)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=DA;break}if(r.lenbits=9,y={bits:r.lenbits},P=oA(1,r.lens,0,r.nlen,r.lencode,0,r.work,y),r.lenbits=y.bits,P){t.msg="invalid literal/lengths set",r.mode=DA;break}if(r.distbits=6,r.distcode=r.distdyn,y={bits:r.distbits},P=oA(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,y),r.distbits=y.bits,P){t.msg="invalid distances set",r.mode=DA;break}if(r.mode=16199,e===BA)break t;case 16199:r.mode=16200;case 16200:if(s>=6&&a>=258){t.next_out=o,t.avail_out=a,t.next_in=i,t.avail_in=s,r.hold=B,r.bits=E,eA(t,C),o=t.next_out,A=t.output,a=t.avail_out,i=t.next_in,n=t.input,s=t.avail_in,B=r.hold,E=r.bits,16191===r.mode&&(r.back=-1);break}for(r.back=0;O=r.lencode[B&(1<<r.lenbits)-1],_=O>>>24,I=O>>>16&255,D=65535&O,!(_<=E);){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(I&&0==(240&I)){for(h=_,R=I,T=D;O=r.lencode[T+((B&(1<<h+R)-1)>>h)],_=O>>>24,I=O>>>16&255,D=65535&O,!(h+_<=E);){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}B>>>=h,E-=h,r.back+=h}if(B>>>=_,E-=_,r.back+=_,r.length=D,0===I){r.mode=16205;break}if(32&I){r.back=-1,r.mode=16191;break}if(64&I){t.msg="invalid literal/length code",r.mode=DA;break}r.extra=15&I,r.mode=16201;case 16201:if(r.extra){for(M=r.extra;E<M;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.length+=B&(1<<r.extra)-1,B>>>=r.extra,E-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;O=r.distcode[B&(1<<r.distbits)-1],_=O>>>24,I=O>>>16&255,D=65535&O,!(_<=E);){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(0==(240&I)){for(h=_,R=I,T=D;O=r.distcode[T+((B&(1<<h+R)-1)>>h)],_=O>>>24,I=O>>>16&255,D=65535&O,!(h+_<=E);){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}B>>>=h,E-=h,r.back+=h}if(B>>>=_,E-=_,r.back+=_,64&I){t.msg="invalid distance code",r.mode=DA;break}r.offset=D,r.extra=15&I,r.mode=16203;case 16203:if(r.extra){for(M=r.extra;E<M;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}r.offset+=B&(1<<r.extra)-1,B>>>=r.extra,E-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=DA;break}r.mode=16204;case 16204:if(0===a)break t;if(f=C-a,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=DA;break}f>r.wnext?(f-=r.wnext,l=r.wsize-f):l=r.wnext-f,f>r.length&&(f=r.length),u=r.window}else u=A,l=o-r.offset,f=r.length;f>a&&(f=a),a-=f,r.length-=f;do{A[o++]=u[l++]}while(--f);0===r.length&&(r.mode=16200);break;case 16205:if(0===a)break t;A[o++]=r.length,a--,r.mode=16200;break;case 16206:if(r.wrap){for(;E<32;){if(0===s)break t;s--,B|=n[i++]<<E,E+=8}if(C-=a,t.total_out+=C,r.total+=C,4&r.wrap&&C&&(t.adler=r.check=r.flags?Hr(r.check,A,C,o-C):pr(r.check,A,C,o-C)),C=a,4&r.wrap&&(r.flags?B:hA(B))!==r.check){t.msg="incorrect data check",r.mode=DA;break}B=0,E=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;E<32;){if(0===s)break t;s--,B+=n[i++]<<E,E+=8}if(4&r.wrap&&B!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=DA;break}B=0,E=0}r.mode=16208;case 16208:P=cA;break t;case DA:P=lA;break t;case 16210:return uA;case 16211:default:return fA}return t.next_out=o,t.avail_out=a,t.next_in=i,t.avail_in=s,r.hold=B,r.bits=E,(r.wsize||C!==t.avail_out&&r.mode<DA&&(r.mode<16206||e!==sA))&&dA(t,t.output,t.next_out,C-t.avail_out),c-=t.avail_in,C-=t.avail_out,t.total_in+=c,t.total_out+=C,r.total+=C,4&r.wrap&&C&&(t.adler=r.check=r.flags?Hr(r.check,A,C,t.next_out-C):pr(r.check,A,C,t.next_out-C)),t.data_type=r.bits+(r.last?64:0)+(16191===r.mode?128:0)+(16199===r.mode||16194===r.mode?256:0),(0===c&&0===C||e===sA)&&P===EA&&(P=_A),P},inflateEnd:t=>{if(TA(t))return fA;let e=t.state;return e.window&&(e.window=null),t.state=null,EA},inflateGetHeader:(t,e)=>{if(TA(t))return fA;const r=t.state;return 0==(2&r.wrap)?fA:(r.head=e,e.done=!1,EA)},inflateSetDictionary:(t,e)=>{const r=e.length;let n,A,i;return TA(t)?fA:(n=t.state,0!==n.wrap&&16190!==n.mode?fA:16190===n.mode&&(A=1,A=pr(A,e,r,0),A!==n.check)?lA:(i=dA(t,e,r,r),i?(n.mode=16210,uA):(n.havedict=1,EA)))},inflateInfo:"pako inflate (from Nodeca project)"};var GA=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 mA=Object.prototype.toString,{Z_NO_FLUSH:bA,Z_FINISH:pA,Z_OK:wA,Z_STREAM_END:HA,Z_NEED_DICT:KA,Z_STREAM_ERROR:gA,Z_DATA_ERROR:VA,Z_MEM_ERROR:JA}=gr;function XA(t){this.options=bn({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Jn,this.strm.avail_out=0;let r=UA.inflateInit2(this.strm,e.windowBits);if(r!==wA)throw new Error(Kr[r]);if(this.header=new GA,UA.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Kn(e.dictionary):"[object ArrayBuffer]"===mA.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=UA.inflateSetDictionary(this.strm,e.dictionary),r!==wA)))throw new Error(Kr[r])}function vA(t,e){const r=new XA(e);if(r.push(t),r.err)throw r.msg||Kr[r.err];return r.result}XA.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize,A=this.options.dictionary;let i,o,s;if(this.ended)return!1;for(o=e===~~e?e:!0===e?pA:bA,"[object ArrayBuffer]"===mA.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),i=UA.inflate(r,o),i===KA&&A&&(i=UA.inflateSetDictionary(r,A),i===wA?i=UA.inflate(r,o):i===VA&&(i=KA));r.avail_in>0&&i===HA&&r.state.wrap>0&&0!==t[r.next_in];)UA.inflateReset(r),i=UA.inflate(r,o);switch(i){case gA:case VA:case KA:case JA:return this.onEnd(i),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||i===HA))if("string"===this.options.to){let t=Vn(r.output,r.next_out),e=r.next_out-t,A=gn(r.output,t);r.next_out=e,r.avail_out=n-e,e&&r.output.set(r.output.subarray(t,t+e),0),this.onData(A)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(i!==wA||0!==s){if(i===HA)return i=UA.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},XA.prototype.onData=function(t){this.chunks.push(t)},XA.prototype.onEnd=function(t){t===wA&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=pn(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var ZA={Inflate:XA,inflate:vA,inflateRaw:function(t,e){return(e=e||{}).raw=!0,vA(t,e)},ungzip:vA,constants:gr};const{Deflate:xA,deflate:kA,deflateRaw:WA,gzip:QA}=tA,{Inflate:jA,inflate:YA,inflateRaw:zA,ungzip:qA}=ZA;var $A={Deflate:xA,deflate:kA,deflateRaw:WA,gzip:QA,Inflate:jA,inflate:YA,inflateRaw:zA,ungzip:qA,constants:gr},ti=5,ei=11,ri=13,ni=14;function Ai(t,e,r,n){var A=t|e<<8,i=A>>11&31,o=A>>5&63,s=31&A;return r[n+0]=i<<3|i>>2,r[n+1]=o<<2|o>>4,r[n+2]=s<<3|s>>2,r[n+3]=255,A}var ii=new Uint8Array(16),oi=new Uint8Array(16);function si(t,e,r,n){var A=0;0!=(6&n)&&(A=8),function(t,e,r,n){for(var A=Ai(e[r+0],e[r+1],ii,0),i=Ai(e[r+2],e[r+3],ii,4),o=0;o<3;o++){var s=ii[o],a=ii[4+o];n&&A<=i?(ii[8+o]=(s+a)/2,ii[12+o]=0):(ii[8+o]=(2*s+a)/3,ii[12+o]=(s+2*a)/3)}for(ii[11]=255,ii[15]=n&&A<=i?0:255,o=0;o<4;++o){var B=e[r+4+o];oi[4*o+0]=3&B,oi[4*o+1]=B>>2&3,oi[4*o+2]=B>>4&3,oi[4*o+3]=B>>6&3}for(o=0;o<16;++o)for(var E=4*oi[o],c=0;c<4;++c)t[4*o+c]=ii[E+c]}(t,e,r+A,0!=(1&n)),0!=(2&n)?function(t,e,r){for(var n=0;n<8;++n){var A=bytes[r+n],i=15&A,o=240&A;t[8*n+3]=i|i<<4,t[8*n+7]=o|o>>4}}(t,0,r):0!=(4&n)&&function(t,e,r){var n=e[r+0],A=e[r+1];if(ii[0]=n,ii[1]=A,n<=A){for(var i=1;i<5;++i)ii[1+i]=((5-i)*n+i*A)/5;ii[6]=0,ii[7]=255}else for(i=1;i<7;++i)ii[1+i]=((7-i)*n+i*A)/7;r+=2;var o=0;for(i=0;i<2;++i){for(var s=0,a=0;a<3;++a){s|=e[r++]<<8*a}for(a=0;a<8;++a){var B=s>>3*a&7;oi[o++]=B}}for(i=0;i<16;++i)t[4*i+3]=ii[oi[i]]}(t,e,r)}var ai=new Uint16Array(4);\n/*! @brief Decompresses an image in memory.\n\n @param rgba\t\tStorage for the decompressed pixels.\n @param width\tThe width of the source image.\n @param height\tThe height of the source image.\n @param blocks\tThe compressed DXT blocks.\n @param flags\tCompression flags.\n\n The decompressed pixels will be written as a contiguous array of width*height\n 16 rgba values, with each component as 1 byte each. In memory this is:\n\n { r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height\n\n The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,\n however, DXT1 will be used by default if none is specified. All other flags\n are ignored.\n\n Internally this function calls squish::Decompress for each block.\n */\nvar Bi=new Uint8Array(64);function Ei(t){}Ei.decode=function(t,e,r,n,A){if(null!=t&&null!=n&&0!=r&&0!=e){var i=0;1&(i=A>11||5===A?4:33)&&32&i?function(t,e,r,n){for(var A=t,i=0,o=0,s=0,a=0,B=0,E=0,c=0,C=0,f=0,l=e/4,u=r/4,_=0;_<u;_++)for(var I=0;I<l;I++)s=4*((u-_)*l+I),ai[0]=n[s],ai[1]=n[s+1],a=31&ai[0],B=2016&ai[0],E=63488&ai[0],c=31&ai[1],C=2016&ai[1],f=63488&ai[1],ai[2]=5*a+3*c>>3|5*B+3*C>>3&2016|5*E+3*f>>3&63488,ai[3]=5*c+3*a>>3|5*C+3*B>>3&2016|5*f+3*E>>3&63488,i=n[s+2],A[o=4*_*e+4*I]=ai[3&i],A[o+1]=ai[i>>2&3],A[o+2]=ai[i>>4&3],A[o+3]=ai[i>>6&3],A[o+=e]=ai[i>>8&3],A[o+1]=ai[i>>10&3],A[o+2]=ai[i>>12&3],A[o+3]=ai[i>>14],i=n[s+3],A[o+=e]=ai[3&i],A[o+1]=ai[i>>2&3],A[o+2]=ai[i>>4&3],A[o+3]=ai[i>>6&3],A[o+=e]=ai[i>>8&3],A[o+1]=ai[i>>10&3],A[o+2]=ai[i>>12&3],A[o+3]=ai[i>>14]}(t,e,r,n):function(t,e,r,n,A,i){for(var o=0!=(1&A)?8:16,s=0,a=0;a<r;a+=4)for(var B=0;B<e;B+=4){si(Bi,n,s,A);for(var E=0,c=0;c<4;++c)for(var C=0;C<4;++C){var f=B+C,l=a+c;if(f<e&&l<r){var u=4*(e*(r-l)+f);if(i===ri||i===ni)t[u+2]=Bi[E++],t[u+1]=Bi[E++],t[u+0]=Bi[E++],t[u+3]=Bi[E++];else for(var _=0;_<4;++_)t[u++]=Bi[E++]}else E+=4}s+=o}}(t,e,r,n,i,A)}};var ci=function(){var t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),e=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var r,n="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";WebAssembly.validate(t)&&(n="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");var A=WebAssembly.instantiate(function(t){for(var r=new Uint8Array(t.length),n=0;n<t.length;++n){var A=t.charCodeAt(n);r[n]=A>96?A-71:A>64?A-65:A>47?A+4:A>46?63:62}var i=0;for(let n=0;n<t.length;++n)r[i++]=r[n]<60?e[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,i)}(n),{}).then((function(t){(r=t.instance).exports.__wasm_call_ctors()}));function i(t,e,n,A,i,o){var s=r.exports.sbrk,a=n+3&-4,B=s(a*A),E=s(i.length),c=new Uint8Array(r.exports.memory.buffer);c.set(i,E);var C=t(B,n,A,E,i.length);if(0==C&&o&&o(B,a,A),e.set(c.subarray(B,B+n*A)),s(B-s(0)),0!=C)throw new Error("Malformed buffer data: "+C)}var o={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},s={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:A,supported:!0,decodeVertexBuffer:function(t,e,n,A,s){i(r.exports.meshopt_decodeVertexBuffer,t,e,n,A,r.exports[o[s]])},decodeIndexBuffer:function(t,e,n,A){i(r.exports.meshopt_decodeIndexBuffer,t,e,n,A)},decodeIndexSequence:function(t,e,n,A){i(r.exports.meshopt_decodeIndexSequence,t,e,n,A)},decodeGltfBuffer:function(t,e,n,A,a,B){i(r.exports[s[a]],t,e,n,A,r.exports[o[B]])}}}();function Ci(){}Ci.s3tc=!0,Ci.pvrtc=!1,Ci.etc1=!1;const fi=1,li=2,ui=3,_i=0,Ii=1,Di=2,hi={0:Uint32Array.BYTES_PER_ELEMENT,1:Float32Array.BYTES_PER_ELEMENT,2:Float64Array.BYTES_PER_ELEMENT},Ri=10,Ti=11,Fi=1,Pi=2,Oi=16,Li=32,yi=1,Mi=4,Ni=16,Si=32,di=64,Ui=128,Gi=512,mi=1024;function bi(t,e,r){r=t.byteLength;return t=t.subarray(0,0+r),new TextDecoder("utf-8").decode(t)}function pi(t,e,r){let n=e.getUint32(r,!0);return r+=Uint32Array.BYTES_PER_ELEMENT,{string:bi(new Uint8Array(t,r,n)),bytesOffset:r+=n,length:n}}function wi(t,e,r,n){let A={},i=[],o=new Array(16);for(let t=0;t<16;t++)o[t]=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;A.matrix=o,A.skeletonNames=i;let s=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let n=0;n<s;n++){let n=pi(t,e,r);i.push(n.string),r=n.bytesOffset}return n.push(A),r}function Hi(t,e,r,n,A){let i={};i.rangeList=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,i.rangeMode=e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT;let o={};o.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,o.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,o.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;let s=e.getFloat64(r,!0);if(r+=Float64Array.BYTES_PER_ELEMENT,i.boundingSphere={center:o,radius:s},3===A){const t={};t.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,t.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,t.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;const n={};n.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,n.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,n.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;const A={};A.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,A.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,A.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;const o={};o.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,o.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,o.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,i.obb={xExtent:n,yExtent:A,zExtent:o,obbCenter:t}}let a=pi(t,e,r),B=a.string;r=a.bytesOffset;let E=B.indexOf("Geometry");if(-1!==E){let t=B.substring(E);B=B.replace(t,"")}i.childTile=B,i.geodes=[];let c=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let n=0;n<c;n++)r=wi(t,e,r,i.geodes);if(n.push(i),3===A){r=pi(t,e,r).bytesOffset}return r}function Ki(t,e,r,n){let A=e.getUint32(r,!0);if(n.verticesCount=A,(r+=Uint32Array.BYTES_PER_ELEMENT)<=0)return r;let i=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;let o=e.getUint16(r,!0);o=i*Float32Array.BYTES_PER_ELEMENT,r+=Uint16Array.BYTES_PER_ELEMENT;let s=A*i*Float32Array.BYTES_PER_ELEMENT,a=new Uint8Array(t,r,s);r+=s;let B=n.vertexAttributes,E=n.attrLocation;return E.aPosition=B.length,B.push({index:E.aPosition,typedArray:a,componentsPerAttribute:i,componentDatatype:5126,offsetInBytes:0,strideInBytes:o,normalize:!1}),r}function gi(t,e,r,n){let A=e.getUint32(r,!0);if(r+=Uint32Array.BYTES_PER_ELEMENT,A<=0)return r;let i=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;let o=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;let s=A*i*Float32Array.BYTES_PER_ELEMENT,a=new Uint8Array(t,r,s);r+=s;let B=n.vertexAttributes,E=n.attrLocation;return E.aNormal=B.length,B.push({index:E.aNormal,typedArray:a,componentsPerAttribute:i,componentDatatype:5126,offsetInBytes:0,strideInBytes:o,normalize:!1}),r}function Vi(t,e,r,n){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let i,o=n.verticesCount;if(A>0){e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT,r+=2*Uint8Array.BYTES_PER_ELEMENT;let n=A*Uint8Array.BYTES_PER_ELEMENT*4;i=new Uint8Array(t,r,n).slice(0,n),r+=n}else{i=new Uint8Array(4*o);for(let t=0;t<o;t++)i[4*t]=255,i[4*t+1]=255,i[4*t+2]=255,i[4*t+3]=255}let s=n.vertexAttributes,a=n.attrLocation;return a.aColor=s.length,s.push({index:a.aColor,typedArray:i,componentsPerAttribute:4,componentDatatype:5121,offsetInBytes:0,strideInBytes:4,normalize:!0}),n.vertexColor=i,r}function Ji(t,e,r,n){let A=e.getUint32(r,!0);if(r+=Uint32Array.BYTES_PER_ELEMENT,A<=0)return r;e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT,r+=2*Uint8Array.BYTES_PER_ELEMENT;let i=A*Uint8Array.BYTES_PER_ELEMENT*4,o=new Uint8Array(t,r,i);r+=i;let s=n.vertexAttributes,a=n.attrLocation;return a.aSecondColor=s.length,s.push({index:a.aSecondColor,typedArray:o,componentsPerAttribute:4,componentDatatype:5121,offsetInBytes:0,strideInBytes:4,normalize:!0}),r}function Xi(t,e,r,n){let A=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,r+=Uint16Array.BYTES_PER_ELEMENT;for(let i=0;i<A;i++){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let o=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT;let s=A*o*Float32Array.BYTES_PER_ELEMENT,a=new Uint8Array(t,r,s);r+=s;let B="aTexCoord"+i,E=n.vertexAttributes,c=n.attrLocation;c[B]=E.length,E.push({index:c[B],typedArray:a,componentsPerAttribute:o,componentDatatype:5126,offsetInBytes:0,strideInBytes:o*Float32Array.BYTES_PER_ELEMENT,normalize:!1})}return r}function vi(t,e,r,n){let A=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,r+=Uint16Array.BYTES_PER_ELEMENT;let i=n.vertexAttributes,o=n.attrLocation;for(let s=0;s<A;s++){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let s=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT;let a=A*s*Float32Array.BYTES_PER_ELEMENT;if(17===s||29===s){let e=new Uint8Array(t,r,a);n.instanceCount=A,n.instanceMode=s,n.instanceBuffer=e,n.instanceIndex=1;let B,E=s*A*4,c=e.slice(0,E);n.vertexColorInstance=c,17===s?(B=17*Float32Array.BYTES_PER_ELEMENT,o.uv2=i.length,i.push({index:o.uv2,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:0,strideInBytes:B,instanceDivisor:1}),o.uv3=i.length,i.push({index:o.uv3,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:4*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv4=i.length,i.push({index:o.uv4,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:8*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.secondary_colour=i.length,i.push({index:o.secondary_colour,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:12*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv6=i.length,i.push({index:o.uv6,componentsPerAttribute:4,componentDatatype:5121,normalize:!0,offsetInBytes:16*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1})):29===s&&(B=29*Float32Array.BYTES_PER_ELEMENT,o.uv1=i.length,i.push({index:o.uv1,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:0,strideInBytes:B,instanceDivisor:1,byteLength:a}),o.uv2=i.length,i.push({index:o.uv2,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:4*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv3=i.length,i.push({index:o.uv3,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:8*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv4=i.length,i.push({index:o.uv4,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:12*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv5=i.length,i.push({index:o.uv5,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:16*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv6=i.length,i.push({index:o.uv6,componentsPerAttribute:4,componentDatatype:5126,normalize:!1,offsetInBytes:20*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv7=i.length,i.push({index:o.uv7,componentsPerAttribute:3,componentDatatype:5126,normalize:!1,offsetInBytes:24*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.secondary_colour=i.length,i.push({index:o.secondary_colour,componentsPerAttribute:4,componentDatatype:5121,normalize:!0,offsetInBytes:27*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}),o.uv9=i.length,i.push({index:o.uv9,componentsPerAttribute:4,componentDatatype:5121,normalize:!0,offsetInBytes:28*Float32Array.BYTES_PER_ELEMENT,strideInBytes:B,instanceDivisor:1}))}else{let t=A*s;n.instanceBounds=new Float32Array(t);for(let A=0;A<t;A++)n.instanceBounds[A]=e.getFloat32(r+A*Float32Array.BYTES_PER_ELEMENT,!0)}r+=a}return r}function Zi(t,e,r,n,A){if(3===A&&(e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT),r=Vi(t,e,r=gi(t,e,r=Ki(t,e,r,n),n),n),3!==A&&(r=Ji(t,e,r,n)),r=vi(t,e,r=Xi(t,e,r,n),n),3===A){r=function(t,e,r,n){const A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let i=0;i<A;i++){const A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const o=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;const s=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;const a=A*o*hi[s],B=new Uint8Array(t,r,a);r+=a;const E=n.vertexAttributes,c=n.attrLocation,C="aCustom"+i;c[C]=E.length,E.push({index:c[C],typedArray:B,componentsPerAttribute:o,componentDatatype:5126,offsetInBytes:0,strideInBytes:0,normalize:!1})}return r}(t,e,r,n);const A=pi(t,e,r);r=A.bytesOffset,n.customVertexAttribute=JSON.parse(A.string);const i="aCustom"+n.customVertexAttribute.TextureCoordMatrix,o="aCustom"+n.customVertexAttribute.VertexWeight;void 0!==n.attrLocation[i]&&(n.attrLocation.aTextureCoordMatrix=n.attrLocation[i],delete n.attrLocation[i]),void 0!==n.attrLocation[o]&&(n.attrLocation.aVertexWeight=n.attrLocation[o],delete n.attrLocation[o]);let s=r%4;s&&(s=4-s),r=function(t,e,r,n){const A=e.getUint32(r,!0);if(r+=Uint32Array.BYTES_PER_ELEMENT,A<=0)return r;const i=e.getUint16(r,!0);return r+=Uint16Array.BYTES_PER_ELEMENT,e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT,r+=A*i*Float32Array.BYTES_PER_ELEMENT}(0,e,r+=s)}return r}function xi(t,e,r,n,A,i){let o,s=0;const a=A.vertexAttributes,B=A.attrLocation;switch(e){case Mi:case Ni:case Si:s=2*Uint16Array.BYTES_PER_ELEMENT,0!=(16&i)||e!==Ni&&e!==Si||(s=2*Float32Array.BYTES_PER_ELEMENT),o=new Uint8Array(t*s);break;case di:case Ui:s=4*Uint8Array.BYTES_PER_ELEMENT,o=new Uint8Array(4*t);break;case Gi:case mi:s=Float32Array.BYTES_PER_ELEMENT*r,o=new Uint8Array(t*r*4);break;default:s=4*Uint16Array.BYTES_PER_ELEMENT,o=new Uint8Array(t*s)}let E,c;switch(ci.decodeVertexBuffer(o,t,s,n,n.length),e){case yi:B.aPosition=a.length,a.push({index:B.aPosition,typedArray:new Uint16Array(o.buffer,0,o.length/2),componentsPerAttribute:4,componentDatatype:5122,offsetInBytes:0,strideInBytes:0,normalize:!1}),A.verticesCount=t;break;case Mi:B.aNormal=a.length,a.push({index:B.aNormal,typedArray:new Int16Array(o.buffer,0,o.length/2),componentsPerAttribute:2,componentDatatype:5122,offsetInBytes:0,strideInBytes:0,normalize:!1});break;case Ni:0==(16&i)?(c=5126,E=new Float32Array(o.buffer,0,o.length/4)):(c=5122,E=new Uint16Array(o.buffer,0,o.length/2)),B.aTexCoord0=a.length,a.push({index:B.aTexCoord0,typedArray:E,componentsPerAttribute:2,componentDatatype:c,offsetInBytes:0,strideInBytes:0,normalize:!1});break;case Si:0==(16&i)?(c=5126,E=new Float32Array(o.buffer,0,o.length/4)):(c=5122,E=new Uint16Array(o.buffer,0,o.length/2)),B.aTexCoord1=a.length,a.push({index:B.aTexCoord1,typedArray:E,componentsPerAttribute:2,componentDatatype:c,offsetInBytes:0,strideInBytes:0,normalize:!1});break;case di:B.aColor=a.length,a.push({index:B.aColor,typedArray:o,componentsPerAttribute:4,componentDatatype:5121,offsetInBytes:0,strideInBytes:0,normalize:!0});break;case Ui:B.aSecondColor=a.length,a.push({index:B.aSecondColor,typedArray:o,componentsPerAttribute:4,componentDatatype:5120,offsetInBytes:0,strideInBytes:0,normalize:!1});break;case Gi:B.aCustom0=a.length,a.push({index:B.aCustom0,typedArray:new Float32Array(o.buffer,0,o.length/4),componentsPerAttribute:r,componentDatatype:5126,offsetInBytes:0,strideInBytes:0,normalize:!1});break;case mi:B.aCustom1=a.length,a.push({index:B.aCustom1,typedArray:new Float32Array(o.buffer,0,o.length/4),componentsPerAttribute:r,componentDatatype:5126,offsetInBytes:0,strideInBytes:0,normalize:!1})}}function ki(t,e,r,n,A){const i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT,n.compressOptions=i;const o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT,n.minVerticesValue={x:0,y:0,z:0,w:0},n.minTexCoordValue=[{x:0,y:0},{x:0,y:0}],n.texCoordCompressConstant=[{x:0,y:0,z:0},{x:0,y:0,z:0}];for(let A=0;A<o;A++){const s=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT,n.vertCompressConstant=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,n.minVerticesValue.x=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,n.minVerticesValue.y=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,n.minVerticesValue.z=e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT;const a=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const B=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const E=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const c=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const C=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const f=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const l=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT;const u=e.getFloat64(r,!0);r+=Float64Array.BYTES_PER_ELEMENT,n.minTexCoordValue[0].x=E,n.minTexCoordValue[0].y=c,n.minTexCoordValue[1].x=l,n.minTexCoordValue[1].y=u,n.texCoordCompressConstant[0].x=a,n.texCoordCompressConstant[0].y=B,n.texCoordCompressConstant[1].x=C,n.texCoordCompressConstant[1].y=f;const _=e.getInt32(r,!0);r+=Int32Array.BYTES_PER_ELEMENT;for(let A=0;A<_;A++){const A=e.getInt32(r,!0);r+=Int32Array.BYTES_PER_ELEMENT;let o=0;A!==Gi&&A!==mi||(o=e.getInt32(r,!0),r+=Int32Array.BYTES_PER_ELEMENT);const a=e.getInt32(r,!0);r+=Int32Array.BYTES_PER_ELEMENT;const B=new Uint8Array(t,r,a);let E=(r+=Uint8Array.BYTES_PER_ELEMENT*a)%4;E&&(E=4-E),r+=E,xi(s,A,o,B,n,i)}let I=pi(t,e,r);r=I.bytesOffset,n.customVertexAttribute=JSON.parse(I.string);let D="aCustom"+n.customVertexAttribute.TextureCoordMatrix,h="aCustom"+n.customVertexAttribute.VertexWeight;void 0!==n.attrLocation[D]&&(n.attrLocation.aTextureCoordMatrix=n.attrLocation[D],A===o-1&&delete n.attrLocation[D]),void 0!==n.attrLocation[h]&&(n.attrLocation.aVertexWeight=n.attrLocation[h],A===o-1&&delete n.attrLocation[h]);let R=r%4;R&&(R=4-R),r+=R}return r}function Wi(t,e,r,n,A){const i=e.getInt32(r,!0);r+=Int32Array.BYTES_PER_ELEMENT;for(let A=0;A<i;A++){const A={},i=e.getInt32(r,!0);if(r+=Int32Array.BYTES_PER_ELEMENT,i<1)continue;const o=e.getInt8(r,!0);r+=Int8Array.BYTES_PER_ELEMENT,e.getInt8(r,!0),r+=Int8Array.BYTES_PER_ELEMENT;const s=e.getInt8(r,!0);r+=Int8Array.BYTES_PER_ELEMENT,e.getInt8(r,!0),r+=Int8Array.BYTES_PER_ELEMENT;const a=e.getInt32(r,!0);let B;r+=Int32Array.BYTES_PER_ELEMENT,13!==s?(B=new Uint8Array(t,r,a),r+=Uint8Array.BYTES_PER_ELEMENT*a):(B=new Uint32Array(t,r,a),r+=Uint32Array.BYTES_PER_ELEMENT*a);let E,c=r%4;c&&(c=4-c),r+=c,13!==s?(E=new Uint8Array(i*Uint32Array.BYTES_PER_ELEMENT),ci.decodeIndexBuffer(E,i,Uint32Array.BYTES_PER_ELEMENT,B)):E=B;const C=e.getInt32(r,!0);r+=Int32Array.BYTES_PER_ELEMENT,A.indexType=o;const f=0===o?new Uint16Array(i):new Uint32Array(i);A.indicesCount=i;const l=new Uint32Array(E.buffer,E.byteOffset,E.byteLength/4);f.set(l,0),A.indicesTypedArray=f,A.primitiveType=s;for(let n=0;n<C;n++){const n=pi(t,e,r);r=n.bytesOffset,A.materialCode=n.string}n.push(A),c=r%4,c&&(c=4-c),r+=c}return r}function Qi(t,e,r,n){let A=e.getUint32(r,!0);return n.compressOptions=A,r+=Uint32Array.BYTES_PER_ELEMENT,r=(A&Fi)===Fi?function(t,e,r,n){let A=e.getUint32(r,!0);if(n.verticesCount=A,(r+=Uint32Array.BYTES_PER_ELEMENT)<=0)return r;let i=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;let o=e.getUint16(r,!0);o=i*Int16Array.BYTES_PER_ELEMENT,r+=Uint16Array.BYTES_PER_ELEMENT;let s=e.getFloat32(r,!0);r+=Float32Array.BYTES_PER_ELEMENT;let a={};a.x=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,a.y=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,a.z=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,a.w=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,n.vertCompressConstant=s,n.minVerticesValue=a;let B=A*i*Int16Array.BYTES_PER_ELEMENT,E=new Uint8Array(t,r,B);r+=B;let c=n.vertexAttributes,C=n.attrLocation;return C.aPosition=c.length,c.push({index:C.aPosition,typedArray:E,componentsPerAttribute:i,componentDatatype:5122,offsetInBytes:0,strideInBytes:o,normalize:!1}),r}(t,e,r,n):Ki(t,e,r,n),r=(A&Pi)===Pi?function(t,e,r,n){let A=e.getUint32(r,!0);if(r+=Uint32Array.BYTES_PER_ELEMENT,A<=0)return r;e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT;let i=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT;let o=2*A*Int16Array.BYTES_PER_ELEMENT,s=new Uint8Array(t,r,o);r+=o;let a=n.vertexAttributes,B=n.attrLocation;return B.aNormal=a.length,a.push({index:B.aNormal,typedArray:s,componentsPerAttribute:2,componentDatatype:5122,offsetInBytes:0,strideInBytes:i,normalize:!1}),r}(t,e,r,n):gi(t,e,r,n),r=Ji(t,e,r=Vi(t,e,r,n),n),r=(A&Oi)===Oi?function(t,e,r,n){n.texCoordCompressConstant=[],n.minTexCoordValue=[];let A=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,r+=Uint16Array.BYTES_PER_ELEMENT;for(let i=0;i<A;i++){let A=e.getUint8(r,!0);r+=Uint8Array.BYTES_PER_ELEMENT,r+=3*Uint8Array.BYTES_PER_ELEMENT;let o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let s=e.getUint16(r,!0);r+=Uint16Array.BYTES_PER_ELEMENT,e.getUint16(r,!0),r+=Uint16Array.BYTES_PER_ELEMENT;let a=e.getFloat32(r,!0);r+=Float32Array.BYTES_PER_ELEMENT,n.texCoordCompressConstant.push(a);let B={};B.x=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,B.y=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,B.z=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,B.w=e.getFloat32(r,!0),r+=Float32Array.BYTES_PER_ELEMENT,n.minTexCoordValue.push(B);let E=o*s*Int16Array.BYTES_PER_ELEMENT,c=new Uint8Array(t,r,E),C=(r+=E)%4;0!==C&&(r+=4-C);let f="aTexCoord"+i,l=n.vertexAttributes,u=n.attrLocation;if(u[f]=l.length,l.push({index:u[f],typedArray:c,componentsPerAttribute:s,componentDatatype:5122,offsetInBytes:0,strideInBytes:s*Int16Array.BYTES_PER_ELEMENT,normalize:!1}),A){E=o*Float32Array.BYTES_PER_ELEMENT;let e=new Uint8Array(t,r,E);r+=E,n.texCoordZMatrix=!0,f="aTexCoordZ"+i,u[f]=l.length,l.push({index:u[f],typedArray:e,componentsPerAttribute:1,componentDatatype:5126,offsetInBytes:0,strideInBytes:Float32Array.BYTES_PER_ELEMENT,normalize:!1})}}return r}(t,e,r,n):Xi(t,e,r,n),(A&Li)===Li&&(n.textureCoordIsW=!0),r=vi(t,e,r,n)}function ji(t,e,r,n,A){let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let o=0;o<i;o++){let i={};3===A&&(e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT);let o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let s=e.getUint8(r,!0);r+=Uint8Array.BYTES_PER_ELEMENT,e.getUint8(r,!0),r+=Uint8Array.BYTES_PER_ELEMENT;let a=e.getUint8(r,!0);if(r+=Uint8Array.BYTES_PER_ELEMENT,r+=Uint8Array.BYTES_PER_ELEMENT,o>0){let e,n=null;1===s||3===s?(e=o*Uint32Array.BYTES_PER_ELEMENT,n=new Uint8Array(t,r,e)):(e=o*Uint16Array.BYTES_PER_ELEMENT,n=new Uint8Array(t,r,e),o%2!=0&&(e+=2)),i.indicesTypedArray=n,r+=e}i.indicesCount=o,i.indexType=s,i.primitiveType=a;let B=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let n=0;n<B;n++){let n=pi(t,e,r),A=n.string;r=n.bytesOffset,i.materialCode=A}if(0!==r%4){r+=4-r%4}n.push(i)}return r}let Yi={red:0,green:0,blue:0,alpha:0};function zi(t,e,r){let n=t.vertexAttributes,A=t.attrLocation,i=n.length;A[1===r?"instanceId":"batchId"]=i,n.push({index:i,typedArray:e,componentsPerAttribute:1,componentDatatype:5126,offsetInBytes:0,strideInBytes:0,instanceDivisor:r})}Ci.parseBuffer=function(t){let e=0,r={version:void 0,groupNode:void 0,geoPackage:{},matrials:void 0,texturePackage:{}},n=new DataView(t);r.version=n.getFloat32(e,!0),e+=Float32Array.BYTES_PER_ELEMENT,r.version>=2&&(n.getUint32(e,!0),e+=Uint32Array.BYTES_PER_ELEMENT),r.version>=3&&(n.getUint32(e,!0),e+=Uint32Array.BYTES_PER_ELEMENT),n.getUint32(e,!0),e+=Uint32Array.BYTES_PER_ELEMENT;let A=function(t,e){let r=new Uint8Array(t,e);return $A.inflate(r).buffer}(t,e);n=new DataView(A),e=0;let i=n.getUint32(e,!0);return e+=Uint32Array.BYTES_PER_ELEMENT,e=function(t,e,r,n){let A={},i=[];e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;let o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let A=0;A<o;A++)r=Hi(t,e,r,i,n.version);A.pageLods=i;let s=r%4;return 0!==s&&(r+=4-s),n.groupNode=A,r}(A,n,e,r),e=function(t,e,r,n,A){e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let o=0;o<i;o++){3===A&&(e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT);let i=pi(t,e,r),o=i.string;r=i.bytesOffset;let s=i.length%4;0!==s&&(r+=4-s);let a=e.getUint32(r,!0);if(r+=Int32Array.BYTES_PER_ELEMENT,3===A)switch(a){case _i:a=fi;break;case Ii:a=ui;break;case Di:a=li}let B={vertexAttributes:[],attrLocation:{},instanceCount:0,instanceMode:0,instanceIndex:-1};a===fi?r=Zi(t,e,r,B,A):a===li&&3===A?r=ki(t,e,r,B):a===li&&(r=Qi(t,e,r,B));let E=[];r=a===li&&3===A?Wi(t,e,r,E):ji(t,e,r,E,A);let c=void 0;2===E.length&&13===E[1].primitiveType&&E[1].indicesCount>=3&&(c=S3MEdgeProcessor.createEdgeDataByIndices(B,E[1])),n[o]={vertexPackage:B,arrIndexPackage:E,edgeGeometry:c},3===A&&(e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT,e.getFloat64(r,!0),r+=Float64Array.BYTES_PER_ELEMENT)}if(3!==A){r+=e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT}return r}(A,n,e,r.geoPackage,r.version),e=function(t,e,r,n){e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let i=0;i<A;i++){let A=pi(t,e,r),i=A.string;r=A.bytesOffset;let o=A.length%4;0!==o&&(r+=4-o),e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;let s=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let a=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let B=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let E=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let c=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let C=new Uint8Array(t,r,E);r+=E;let f=c===Ri||c===Ti?33776:33779;if(22===B&&(f=36196),!Ci.s3tc&&(33776===f||33779===f)){let t=new Uint8Array(s*a*4);Ei.decode(t,s,a,C,c),C=t,B=0,f=c===Ri||c===Ri?273:4369}n[i]={id:i,width:s,height:a,compressType:B,nFormat:c,internalFormat:f,arrayBufferView:C}}return r}(A,n,e,r.texturePackage),e=function(t,e,r,n){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let i=bi(new Uint8Array(t,r,A));return r+=A,n.materials=JSON.parse(i),r}(A,n,e,r),function(t,e,r,n,A,i){if(3===i&&(n=e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT),1==(1&n)){e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;let n=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let o=0;o<n;o++){let n=pi(t,e,r),o=n.string;r=n.bytesOffset;let s=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let a={};if(A[o].pickInfo=a,-1==A[o].vertexPackage.instanceIndex){let t=new Float32Array(A[o].vertexPackage.verticesCount);for(let n=0;n<s;n++){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let o=[];for(let A=0;A<i;A++){let A=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT,t.fill(n,A,A+i),o.push({vertexColorOffset:A,vertexColorCount:i,batchId:n})}a[A]=o}zi(A[o].vertexPackage,t,void 0)}else{let t=A[o].vertexPackage.instanceCount,n=A[o].vertexPackage.instanceBuffer,B=A[o].vertexPackage.instanceMode,E=new Float32Array(t),c=[];for(let t=0;t<s;t++){let t=e.getUint32(r,!0);c.push(t),r+=Uint32Array.BYTES_PER_ELEMENT;let n=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(let t=0;t<n;t++)e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT,3===i&&(e.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT)}let C=17===B?16:28;C*=Float32Array.BYTES_PER_ELEMENT;for(let e=0;e<t;e++){E[e]=e;let t=e*B*Float32Array.BYTES_PER_ELEMENT+C;Cesium.Color.unpack(n,t,Yi);let r=2===i?c[e]:Yi.red+256*Yi.green+65536*Yi.blue;void 0===a[r]&&(a[r]={vertexColorCount:1,instanceIds:[],vertexColorOffset:e}),a[r].instanceIds.push(e)}zi(A[o].vertexPackage,E,1)}}}}(A,n,e,i,r.geoPackage,r.version),r};class qi{constructor(t,e,{width:r,height:n,colorDepth:A,format:i}){if(this.format=i,this.offset=e,this.depth=A,this.stride=\n/*!\n * decode-bmp\n * https://github.com/LinusU/decode-bmp\n * MIT License\n */\nfunction(t){const e=t%4;return e?t+4-e:t}(r*this.depth/8),this.size=this.stride*n,this.data=t.subarray(this.offset,this.offset+this.size),this.size!==this.data.byteLength)throw new Error("Truncated bitmap data")}get(t,e,r){const n=this.format.indexOf(r);if(1===this.depth){return(this.data[e*this.stride+(t/8|0)]&1<<7-t%8*1)>>7-t%8*1}if(2===this.depth){return(this.data[e*this.stride+(t/4|0)]&3<<6-t%4*2)>>>6-t%4*2}if(4===this.depth){return(this.data[e*this.stride+(t/2|0)]&15<<4-t%2*4)>>>4-t%2*4}return this.data[e*this.stride+t*(this.depth/8)+n]}}function $i(t,e,r,n,{width:A=0,height:i=0,icon:o=!1}={}){const s=new DataView(e,r,n);let a,B,E,c,C;o?(a=s.getUint32(0,!0),B=s.getUint32(4,!0)/1|0,E=s.getUint32(8,!0)/2|0,c=s.getUint16(14,!0),C=s.getUint32(32,!0)):(!function(t){if(19778!==t)throw new Error("Invalid magic byte 0x"+t.toString(16))}(s.getUint16(0,!0)),a=14+s.getUint32(14,!0),B=s.getUint32(18,!0),E=s.getUint32(22,!0),c=s.getUint16(28,!0),C=s.getUint32(46,!0)),0===C&&c<=8&&(C=1<<c);const f=0===B?A:B,l=0===E?i:E,u=new Uint8Array(s.buffer,s.byteOffset+a,s.byteLength-a),_=t.byteLength===f*l*4;return C?function(t,e,r,{width:n,height:A,colorDepth:i,colorCount:o,icon:s}){if(8!==i&&4!==i&&2!==i&&1!==i)throw new Error(`A color depth of ${i} is not supported`);const a=new qi(r,0,{width:o,height:1,colorDepth:32,format:"BGRA"}),B=new qi(r,a.offset+a.size,{width:n,height:A,colorDepth:i,format:"C"}),E=s?new qi(r,B.offset+B.size,{width:n,height:A,colorDepth:1,format:"A"}):null,c=t;let C=0;for(let t=0;t<A;t++)for(let r=0;r<n;r++){const n=B.get(r,A-t-1,"C");c[C++]=a.get(n,0,"R"),c[C++]=a.get(n,0,"G"),c[C++]=a.get(n,0,"B"),e&&(c[C++]=E&&E.get(r,A-t-1,"A")?0:255)}return c}(t,_,u,{width:f,height:l,colorDepth:c,colorCount:C,icon:o}):function(t,e,r,{width:n,height:A,colorDepth:i,icon:o}){if(32!==i&&24!==i)throw new Error(`A color depth of ${i} is not supported`);const s=new qi(r,0,{width:n,height:A,colorDepth:i,format:"BGRA"}),a=24===i&&o?new qi(r,s.offset+s.size,{width:n,height:A,colorDepth:1,format:"A"}):null,B=t;let E=0;for(let t=0;t<A;t++)for(let r=0;r<n;r++)B[E++]=s.get(r,A-t-1,"R"),B[E++]=s.get(r,A-t-1,"G"),B[E++]=s.get(r,A-t-1,"B"),e&&(B[E++]=32===i?s.get(r,A-t-1,"A"):a&&a.get(r,A-t-1,"A")?0:255);return B}(t,_,u,{width:f,height:l,colorDepth:c,icon:o})}var to=Object.freeze({DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGBA_ASTC_4x4_WEBGL:37808,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGBA_BPTC_UNORM:36492,HALF_FLOAT_OES:36193,DOUBLE:5130,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,COLOR:6144,DEPTH:6145,STENCIL:6146,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,MAX_3D_TEXTURE_SIZE:32883,UNSIGNED_INT_2_10_10_10_REV:33640,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,MAX_TEXTURE_LOD_BIAS:34045,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,VERTEX_ATTRIB_ARRAY_INTEGER:35069,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,UNSIGNED_INT_10F_11F_11F_REV:35899,RGB9_E5:35901,UNSIGNED_INT_5_9_9_9_REV:35902,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,RASTERIZER_DISCARD:35977,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,UNSIGNED_INT_24_8:34042,DEPTH24_STENCIL8:35056,UNSIGNED_NORMALIZED:35863,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,MAX_SAMPLES:36183,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,VERTEX_ARRAY_BINDING:34229,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,SIGNED_NORMALIZED:36764,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,INVALID_INDEX:4294967295,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,SAMPLER_BINDING:35097,RGB10_A2UI:36975,INT_2_10_10_10_REV:36255,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497,TEXTURE_IMMUTABLE_FORMAT:37167,MAX_ELEMENT_INDEX:36203,TEXTURE_IMMUTABLE_LEVELS:33503,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047});let eo={UNSIGNED_BYTE:to.UNSIGNED_BYTE,UNSIGNED_SHORT:to.UNSIGNED_SHORT,UNSIGNED_INT:to.UNSIGNED_INT,FLOAT:to.FLOAT,HALF_FLOAT:to.HALF_FLOAT_OES,UNSIGNED_INT_24_8:to.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:to.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:to.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:to.UNSIGNED_SHORT_5_6_5,toWebGLConstant:function(t,e){switch(t){case eo.UNSIGNED_BYTE:return to.UNSIGNED_BYTE;case eo.UNSIGNED_SHORT:return to.UNSIGNED_SHORT;case eo.UNSIGNED_INT:return to.UNSIGNED_INT;case eo.FLOAT:return to.FLOAT;case eo.HALF_FLOAT:return e.webgl2?to.HALF_FLOAT:to.HALF_FLOAT_OES;case eo.UNSIGNED_INT_24_8:return to.UNSIGNED_INT_24_8;case eo.UNSIGNED_SHORT_4_4_4_4:return to.UNSIGNED_SHORT_4_4_4_4;case eo.UNSIGNED_SHORT_5_5_5_1:return to.UNSIGNED_SHORT_5_5_5_1;case eo.UNSIGNED_SHORT_5_6_5:return eo.UNSIGNED_SHORT_5_6_5}},isPacked:function(t){return t===eo.UNSIGNED_INT_24_8||t===eo.UNSIGNED_SHORT_4_4_4_4||t===eo.UNSIGNED_SHORT_5_5_5_1||t===eo.UNSIGNED_SHORT_5_6_5},sizeInBytes:function(t){switch(t){case eo.UNSIGNED_BYTE:return 1;case eo.UNSIGNED_SHORT:case eo.UNSIGNED_SHORT_4_4_4_4:case eo.UNSIGNED_SHORT_5_5_5_1:case eo.UNSIGNED_SHORT_5_6_5:case eo.HALF_FLOAT:return 2;case eo.UNSIGNED_INT:case eo.FLOAT:case eo.UNSIGNED_INT_24_8:return 4}},validate:function(t){return t===eo.UNSIGNED_BYTE||t===eo.UNSIGNED_SHORT||t===eo.UNSIGNED_INT||t===eo.FLOAT||t===eo.HALF_FLOAT||t===eo.UNSIGNED_INT_24_8||t===eo.UNSIGNED_SHORT_4_4_4_4||t===eo.UNSIGNED_SHORT_5_5_5_1||t===eo.UNSIGNED_SHORT_5_6_5}};var ro=Object.freeze(eo);let no={DEPTH_COMPONENT:to.DEPTH_COMPONENT,DEPTH_STENCIL:to.DEPTH_STENCIL,ALPHA:to.ALPHA,RGB:to.RGB,RGBA:to.RGBA,LUMINANCE:to.LUMINANCE,LUMINANCE_ALPHA:to.LUMINANCE_ALPHA,RGB_DXT1:to.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:to.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:to.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:to.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:to.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:to.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:to.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:to.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:to.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:to.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:to.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:to.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:to.COMPRESSED_RGBA_BPTC_UNORM,componentsLength:function(t){switch(t){case no.RGB:return 3;case no.RGBA:return 4;case no.LUMINANCE_ALPHA:return 2;case no.ALPHA:case no.LUMINANCE:default:return 1}},validate:function(t){return t===no.DEPTH_COMPONENT||t===no.DEPTH_STENCIL||t===no.ALPHA||t===no.RGB||t===no.RGBA||t===no.LUMINANCE||t===no.LUMINANCE_ALPHA||t===no.RGB_DXT1||t===no.RGBA_DXT1||t===no.RGBA_DXT3||t===no.RGBA_DXT5||t===no.RGB_PVRTC_4BPPV1||t===no.RGB_PVRTC_2BPPV1||t===no.RGBA_PVRTC_4BPPV1||t===no.RGBA_PVRTC_2BPPV1||t===no.RGBA_ASTC||t===no.RGB_ETC1||t===no.RGB8_ETC2||t===no.RGBA8_ETC2_EAC||t===no.RGBA_BC7},isColorFormat:function(t){return t===no.ALPHA||t===no.RGB||t===no.RGBA||t===no.LUMINANCE||t===no.LUMINANCE_ALPHA},isDepthFormat:function(t){return t===no.DEPTH_COMPONENT||t===no.DEPTH_STENCIL},isCompressedFormat:function(t){return t===no.RGB_DXT1||t===no.RGBA_DXT1||t===no.RGBA_DXT3||t===no.RGBA_DXT5||t===no.RGB_PVRTC_4BPPV1||t===no.RGB_PVRTC_2BPPV1||t===no.RGBA_PVRTC_4BPPV1||t===no.RGBA_PVRTC_2BPPV1||t===no.RGBA_ASTC||t===no.RGB_ETC1||t===no.RGB8_ETC2||t===no.RGBA8_ETC2_EAC||t===no.RGBA_BC7},isDXTFormat:function(t){return t===no.RGB_DXT1||t===no.RGBA_DXT1||t===no.RGBA_DXT3||t===no.RGBA_DXT5},isPVRTCFormat:function(t){return t===no.RGB_PVRTC_4BPPV1||t===no.RGB_PVRTC_2BPPV1||t===no.RGBA_PVRTC_4BPPV1||t===no.RGBA_PVRTC_2BPPV1},isASTCFormat:function(t){return t===no.RGBA_ASTC},isETC1Format:function(t){return t===no.RGB_ETC1},isETC2Format:function(t){return t===no.RGB8_ETC2||t===no.RGBA8_ETC2_EAC},isBC7Format:function(t){return t===no.RGBA_BC7},compressedTextureSizeInBytes:function(t,e,r){switch(t){case no.RGB_DXT1:case no.RGBA_DXT1:case no.RGB_ETC1:case no.RGB8_ETC2:return Math.floor((e+3)/4)*Math.floor((r+3)/4)*8;case no.RGBA_DXT3:case no.RGBA_DXT5:case no.RGBA_ASTC:case no.RGBA8_ETC2_EAC:return Math.floor((e+3)/4)*Math.floor((r+3)/4)*16;case no.RGB_PVRTC_4BPPV1:case no.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(e,8)*Math.max(r,8)*4+7)/8);case no.RGB_PVRTC_2BPPV1:case no.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(e,16)*Math.max(r,8)*2+7)/8);case no.RGBA_BC7:return Math.ceil(e/4)*Math.ceil(r/4)*16;default:return 0}},textureSizeInBytes:function(t,e,r,n){let A=no.componentsLength(t);return ro.isPacked(e)&&(A=1),A*ro.sizeInBytes(e)*r*n},alignmentInBytes:function(t,e,r){let n=no.textureSizeInBytes(t,e,r,1)%4;return 0===n?4:2===n?2:1},createTypedArray:function(t,e,r,n){let A,i=ro.sizeInBytes(e);return A=i===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:i===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:i===Float32Array.BYTES_PER_ELEMENT&&e===ro.FLOAT?Float32Array:Uint32Array,new A(no.componentsLength(t)*r*n)},flipY:function(t,e,r,n,A){if(1===A)return t;let i=no.createTypedArray(e,r,n,A),o=no.componentsLength(e),s=n*o;for(let e=0;e<A;++e){let r=e*n*o,a=(A-e-1)*n*o;for(let e=0;e<s;++e)i[a+e]=t[r+e]}return i},toInternalFormat:function(t,e,r){if(!r.webgl2)return t;if(t===no.DEPTH_STENCIL)return to.DEPTH24_STENCIL8;if(t===no.DEPTH_COMPONENT){if(e===ro.UNSIGNED_SHORT)return to.DEPTH_COMPONENT16;if(e===ro.UNSIGNED_INT)return to.DEPTH_COMPONENT24}if(e===ro.FLOAT)switch(t){case no.RGBA:return to.RGBA32F;case no.RGB:return to.RGB32F;case no.RG:return to.RG32F;case no.R:return to.R32F}if(e===ro.HALF_FLOAT)switch(t){case no.RGBA:return to.RGBA16F;case no.RGB:return to.RGB16F;case no.RG:return to.RG16F;case no.R:return to.R16F}return t}};var Ao=Object.freeze(no);function io(t,e,r,n,A,i){const o=function(t,e,r,n){let A=t.length,i=r,o=n,s=0;for(;i>0&&o>0;){let t=Ao.compressedTextureSizeInBytes(e,i,o);if(s+=t,i>>=1,o>>=1,0===i&&0===o)break;i=Math.max(i,1),o=Math.max(o,1)}return s===A}(t,r,A,i);if(!o)return null;const s=6410===r||4369===r;let a=0,B=A,E=i;const c=[];do{let n=Ao.compressedTextureSizeInBytes(r,B,E),A=new Uint8Array(t.buffer,e+a,n);c.push(A),B=Math.max(B>>1,1),E=Math.max(E>>1,1),a+=n}while(a<t.byteLength&&o);return{flipY:s,mipmap:c}}const oo=1,so=2,ao=4,Bo=16;function Eo(t,e){const r={};if(t.compressOptions){let e=t.compressOptions;(e&oo)===oo&&(r.COMPRESS_VERTEX=1),(e&so)===so&&(r.COMPRESS_NORMAL=1),(e&ao)===ao&&(r.COMPRESS_COLOR=1),(e&Bo)===Bo&&(r.COMPRESS_TEXCOORD=1)}e.push(r)}function co(t){if(t&&Ft(t)){const e=[];for(const r in t)e.push(t[r]);return e}return t}function Co(t,e){const r={},n=t.compressOptions;(n&oo)===oo&&(r.decode_position_min=co(t.minVerticesValue),r.decode_position_normConstant=co(t.vertCompressConstant)),(n&so)===so&&(r.normal_rangeConstant=co(t.normalRangeConstant)),(n&Bo)===Bo&&(t.texCoordCompressConstant.length>0&&(r.decode_texCoord0_min=co(t.minTexCoordValue[0]),r.decode_texCoord0_normConstant=co(t.texCoordCompressConstant[0]),r.decode_texCoord0_vNormConstant=co(t.texCoordCompressConstant[0])),t.texCoordCompressConstant.length>1&&(r.decode_texCoord1_min=co(t.minTexCoordValue[1]),r.decode_texCoord1_normConstant=co(t.texCoordCompressConstant[1]),r.decode_texCoord1_vNormConstant=co(t.texCoordCompressConstant[1])),t.texCoordCompressConstant.length>2&&(r.decode_texCoord2_min=co(t.minTexCoordValue[2]),r.decode_texCoord2_normConstant=co(t.texCoordCompressConstant[2])),t.texCoordCompressConstant.length>3&&(r.decode_texCoord3_min=co(t.minTexCoordValue[3]),r.decode_texCoord3_normConstant=co(t.texCoordCompressConstant[3])),t.texCoordCompressConstant.length>4&&(r.decode_texCoord4_min=co(t.minTexCoordValue[4]),r.decode_texCoord4_normConstant=co(t.texCoordCompressConstant[4])),t.texCoordCompressConstant.length>5&&(r.decode_texCoord5_min=co(t.minTexCoordValue[5]),r.decode_texCoord5_normConstant=co(t.texCoordCompressConstant[5])),t.texCoordCompressConstant.length>6&&(r.decode_texCoord6_min=co(t.minTexCoordValue[6]),r.decode_texCoord6_normConstant=co(t.texCoordCompressConstant[6])),t.texCoordCompressConstant.length>7&&(r.decode_texCoord7_min=co(t.minTexCoordValue[7]),r.decode_texCoord7_normConstant=co(t.texCoordCompressConstant[7]))),e.push(r)}function fo(t,e){let r,n,A,i=t.bytesOffset,o=Ci.parseBuffer(t.buffer,i),s=o.geoPackage,a=o.groupNode.pageLods,B=[],E=[],c=[],C=[],f=[],l=[],u=[],_=[],I=[];if(!a[0].geodes[0])return null;let D=a[0].geodes[0].matrix;const h=[];let R={};for(let t=0;t<o.materials.material.length;t++)R[o.materials.material[t].material.id]=o.materials.material[t].material;let T=0,F=Number.MAX_VALUE,P=Number.MAX_VALUE,O=Number.MAX_VALUE,L=Number.MIN_VALUE,y=Number.MIN_VALUE,M=Number.MIN_VALUE;for(let t in s){let e=s[t].vertexPackage;r=e.verticesCount;let i=e.vertexAttributes[0].typedArray.buffer,o=e.vertexAttributes[0].typedArray.byteOffset,a=e.vertexAttributes[0].componentsPerAttribute;A=new(Ee(e.vertexAttributes[0].componentDatatype))(i,e.vertexAttributes[0].offsetInBytes+o,r*a);const D=co(e.minVerticesValue)||[0,0,0],N=co(e.vertCompressConstant)||0;for(let t=0;t<r;t++){let e=A[t*a]*N+D[0],r=A[t*a+1]*N+D[1],n=A[t*a+2]*N+D[2];F=Math.min(F,e),P=Math.min(P,r),O=Math.min(O,n),L=Math.max(L,e),y=Math.max(y,r),M=Math.max(M,n)}B.push(A),go("aColor",e,i,r,C),go("aTexCoord0",e,i,r,c),go("aTextureCoordMatrix",e,i,r,h),go("batchId",e,i,r,f),Eo(e,u),Co(e,_);let S=s[t].arrIndexPackage[0].indicesTypedArray,d=S.byteLength/s[t].arrIndexPackage[0].indicesCount;n=new(4===d?Uint32Array:2===d?Uint16Array:Uint8Array)(S.buffer,(s[t].arrIndexPackage[0].bytesOffset||0)+S.byteOffset,s[t].arrIndexPackage[0].indicesCount),E.push(n),T+=n.length,I.push(r);let U=s[t].arrIndexPackage[0].materialCode;l.push(R[U])}let N=[F,P,O],S=[L,y,M];const d=o.version;return function(t,e,r,n,A,i,o,s,a,B,E,c,C,f,l,u,_,I,D){let h=0;for(const t in a)a[t].width*a[t].height*4>h&&(h=a[t].width*a[t].height*4);(!uo||h>uo)&&(lo=new Uint8ClampedArray(h+122),uo=h);const R=[],T={magFilter:9729,minFilter:9729,wrapS:10497,wrapT:10497},F={},P={},O=[],L=[],y=[];for(let B=0;B<r.length;B++){const D=e[B],h=t[B],M=r[B],N=A&&A[B]&&A[B],S=i&&i[B],d=n&&n[B]&&n[B],U=o&&o[B]&&o[B],G=s&&s[B]&&s[B],m={POSITION:{array:M,componentType:ce(M.constructor),count:h,byteOffset:M.byteOffset,byteStride:0,byteLength:M.byteLength,type:Ce(M.length/h),itemSize:M.length/h,name:"POSITION",min:E,max:c}};O.indexOf(M.buffer)<0&&O.push(M.buffer),N&&Vo(m,"TEXCOORD_0",N,h,O),S&&Vo(m,"TextureCoordMatrix",S,h,O),d&&Vo(m,"NORMAL",d,h,O),U&&Vo(m,"COLOR_0",U,h,O),G&&Vo(m,"_BATCHID",G,h,O);const b={attributes:m,material:B,compressDefines:l[B],compressUniforms:u[B],indices:{array:D.slice(),itemSize:1,byteLength:D.byteLength,byteOffset:0,byteStride:0,name:D,count:D.length,componentType:5123},mode:4};O.push(b.indices.array.buffer);const p={primitives:[b],index:B};P[B]=p;const w={mesh:B,nodeIndex:B,matrix:I};F[B]=w,L.push({nodes:[w]});const H=f[B],K={uFillForeColor:[1,1,1,1]};let g=H.ambient;K.ambientColor=[g.r,g.g,g.b,g.a];let V=H.diffuse;K.uDiffuseColor=[V.r,V.g,V.b,V.a];let J=H.specular;K.specularColor=[J.r,J.g,J.b,J.a],K.shininess=H.shininess,K.bTransparentSorting=H.transparentsorting;let X=H.textureunitstates;if(X.length){K.uTexMatrix=X[0].textureunitstate.texmodmatrix;const t=X[0].textureunitstate.id,e=a[t];if(K.uTexture0Width=e.width,X[1]){const t=X[1].textureunitstate.id,e=a[t];K.uTexture1Width=e.width}}y.push({pbrMetallicRoughness:{baseColorFactor:[.8,.8,.8,1],metallicFactor:0,roughnessFactor:.5},extensions:{KHR_techniques_webgl:{technique:0,values:K}}}),R.push(Do(B,f,C,a,_).then(t=>{if(!t)return null;const{array:e,mipmap:r,width:n,height:A,format:i,flipY:o}=t;if(e&&O.indexOf(e.buffer)<0&&O.push(e.buffer),r)for(let t=0;t<r.length;t++)e&&O.indexOf(r[t].buffer)<0&&O.push(r[t].buffer);let s=T;return r&&(s={magFilter:T.magFilter,minFilter:9987,wrapS:T.wrapS,wrapT:T.wrapT}),{materialIndex:B,image:{mipmap:r,array:e,flipY:!!o,width:n,height:A,mimeType:"image/bmp"},sampler:s,format:i,source:B}}))}return Promise.all(R).then(t=>{t=t.filter(t=>!!t);for(let e=0;e<t.length;e++){const{materialIndex:r}=t[e];let n="uTexture";y[r].extensions.KHR_techniques_webgl.values.uTexture&&(n="uTexture2"),y[r].extensions.KHR_techniques_webgl.values[n]={"index":e,"texCoord":r},delete t[e].materialIndex}return{transferables:O,gltf:{"asset":{"generator":"S3M","version":"2.0","s3mVersion":D},"scene":0,"scenes":L,"nodes":F,"meshes":P,"materials":y,"skins":[],"animations":null,"textures":t,"transferables":[{},{},{},{},{}]}}})}(I,E,B,null,c,h,C,f,o.texturePackage,0,N,S,[],l,u,_,e,D,d).then(({gltf:t,transferables:e})=>({gltf:t,featureTable:{"BATCH_LENGTH":0},transferables:e,pageLods:a}))}Ci.multiplyByPoint=function(t,e,r){let n=e.x,A=e.y,i=e.z,o=t[0]*n+t[4]*A+t[8]*i+t[12],s=t[1]*n+t[5]*A+t[9]*i+t[13],a=t[2]*n+t[6]*A+t[10]*i+t[14];return r.x=o,r.y=s,r.z=a,r};let lo,uo=0;let _o=!1;if("undefined"!=typeof OffscreenCanvas){let t;try{t=new OffscreenCanvas(2,2).getContext("2d",{willReadFrequently:!0})}catch(En){}t&&"undefined"!=typeof createImageBitmap&&(_o=!0)}const Io={};function Do(t,e,r,n,A){const i=lo;return new Promise((function(r){!function(t){if(e[t].textureunitstates[0]){let o,s=e[t].textureunitstates[0].textureunitstate.id,a=n[s],B=a.arrayBufferView,E=a.nFormat,c=a.internalFormat;if(function(t){return t===Lo||t===yo||t===Mo||t===No||t===So||t===Uo||t===Go||t===mo||t===bo||t===po||t===wo||t===Ho||t===Ko}(c)&&a.width===a.height){const t=io(B,B.byteOffset,c,0,a.width,a.height);if(t){const{mipmap:e,flipY:n}=t;return void r({format:c,mipmap:e,flipY:n,width:a.width,height:a.height})}}o=E>ei||E===ti?122+a.width*a.height*4:61+a.width*a.height,Ei.decode(i.subarray(122),a.width,a.height,B,E),function(t,e,r){let n=r*(4*e+e%4),A=n+o,i=new DataView(t);var o=0;i.setUint16(o,19778,!0),o+=2,i.setUint32(o,A,!0),o+=4,i.setUint32(o,0,!0),o+=4,i.setUint32(o,122,!0),o+=4,i.setUint32(o,108,!0),o+=4,i.setUint32(o,e,!0),o+=4,i.setUint32(o,r,!0),o+=4,i.setUint16(o,1,!0),o+=2,i.setUint16(o,32,!0),o+=2,i.setUint32(o,this.compress,!0),o+=4,i.setUint32(o,n,!0),o+=4,i.setUint32(o,2835,!0),o+=4,i.setUint32(o,2835,!0),o+=4,i.setUint8(o,0,!0),o+=4,i.setUint32(o,0,!0),o+=4,i.setUint32(o,16711680,!0),o+=4,i.setUint32(o,65280,!0),o+=4,i.setUint32(o,255,!0),o+=4,i.setUint32(o,4278190080,!0),o+=4,i.setUint32(o,1466527264,!0),o+=4}(i.buffer,a.width,a.height);let{width:C,height:f}=a;ho(C)||(C=Ro(C)),ho(f)||(f=Ro(f));const l=A;let u;l&&(C=Math.min(l,C),f=Math.min(l,f));let _=6408;const I=a.width*a.height*4;!_o||C===a.width&&f===a.height?(u=new Uint8Array(3*I/4),_=6407):(Io[I]||(Io[I]=new Uint8Array(I)),u=Io[I]),u=$i(u,i.buffer,0,o),!_o||C===a.width&&f===a.height||(u=function(t,e,r,n,A){To||(To=new OffscreenCanvas(2,2),Fo=To.getContext("2d"),Po=new OffscreenCanvas(2,2),Oo=Po.getContext("2d",{willReadFrequently:!0}));const i=new ImageData(new Uint8ClampedArray(t.buffer),e,r);return To.width=e,To.height=r,Fo.putImageData(i,0,0),Po.width=n,Po.height=A,Oo.drawImage(To,0,0,n,A),Oo.getImageData(0,0,n,A).data}(u,a.width,a.height,C,f)),u.buffer===(Io[I]&&Io[I].buffer)&&(u=new Uint8Array(u)),r({array:u,width:C,height:f,format:_})}else r(null)}(t)}))}function ho(t){return 0==(t&t-1)&&0!==t}function Ro(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}let To,Fo,Po,Oo;const Lo=33776,yo=33777,Mo=33778,No=33779,So=35840,Uo=35841,Go=35842,mo=35843,bo=37808,po=36196,wo=37492,Ho=37496,Ko=36492;function go(t,e,r,n,A){let i=e.attrLocation[t];if(i){const t=e.vertexAttributes[i];if(t.typedArray.buffer!==r)A.push(t.typedArray);else{let e=t.componentsPerAttribute;let i=new(Ee(t.componentDatatype))(r,t.offsetInBytes+t.typedArray.byteOffset,n*e);A.push(i)}}else A.push(void 0)}function Vo(t,e,r,n,A){t[e]={array:r,componentType:ce(r.constructor),count:n,byteOffset:r.byteOffset,byteStride:0,byteLength:r.byteLength,type:Ce(r.length/n),itemSize:r.length/n,name:e},A.indexOf(r.buffer)<0&&A.push(r.buffer)}var Jo=ko("DXT1"),Xo=ko("DXT3"),vo=ko("DXT5"),Zo=ko("DX10"),xo=function(t){var e,r,n=new Int32Array(t,0,31);if(542327876!==n[0])throw new Error("Invalid magic number in DDS header");if(4&!n[20])throw new Error("Unsupported format, must contain a FourCC code");var A=n[21];switch(A){case Jo:e=8,r="dxt1";break;case Xo:e=16,r="dxt3";break;case vo:e=16,r="dxt5";break;case 116:r="rgba32f";break;case Zo:var i=new Uint32Array(t.slice(128,148));r=i[0];var o=i[1];if(i[2],i[3],i[4],3!==o||2!==r)throw new Error("Unsupported DX10 texture format "+r);r="rgba32f";break;default:throw new Error("Unsupported FourCC code: "+(s=A,String.fromCharCode(255&s,s>>8&255,s>>16&255,s>>24&255)))}var s;var a=n[2],B=1;131072&a&&(B=Math.max(1,n[7]));var E=!1;512&n[28]&&(E=!0);var c,C=n[4],f=n[3],l=n[1]+4,u=C,_=f,I=[];A===Zo&&(l+=20);if(E)for(var D=0;D<6;D++){if("rgba32f"!==r)throw new Error("Only RGBA32f cubemaps are supported");C=u,f=_;for(var h=Math.log(C)/Math.log(2)+1,R=0;R<h;R++)c=C*f*16,I.push({offset:l,length:c,shape:[C,f]}),R<B&&(l+=c),C=Math.floor(C/2),f=Math.floor(f/2)}else for(R=0;R<B;R++)c=Math.max(4,C)/4*Math.max(4,f)/4*e,I.push({offset:l,length:c,shape:[C,f]}),l+=c,C=Math.floor(C/2),f=Math.floor(f/2);return{shape:[u,_],images:I,format:r,flags:a,cubemap:E}};function ko(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}const Wo=Math.PI/180,Qo=6378137*Math.PI/180;function jo(t,e,r){if("EPSG:3857"===r)return function(t,e){const r=85.0511287798,n=e[0],A=Math.max(Math.min(r,e[1]),-r);let i;i=0===A?0:Math.log(Math.tan((90+A)*Wo/2))/Wo;return t[0]=n*Qo,t[1]=i*Qo,t}(t,e);if("EPSG:4326"===r||"EPSG:4490"===r||"identity"===r)return Yo(t,e);if("baidu"===r)return Yo(t,e);throw new Error("unsupported projection:"+r)}function Yo(t,e){return t[0]=e[0],t[1]=e[1],t}const zo=A([]),qo=Ie().draco,$o=Ie().ktx2,ts={"pbrMetallicRoughness":{"baseColorFactor":[.5,.5,.5,1],"metallicFactor":0,"roughnessFactor":.5}},es={"position":{name:"POSITION",accessor:{"componentType":5126,"type":"VEC3"}},"normal":{name:"NORMAL",accessor:{"componentType":5126,"type":"VEC3"}},"uv0":{name:"TEXCOORD_0",accessor:{"componentType":5126,"type":"VEC2"}},"color":{name:"COLOR_0",accessor:{"componentType":5121,"type":"VEC4"}},"uv-region":{name:"uvRegion",accessor:{"componentType":5123,"type":"VEC4"}},"feature-index":{name:"_BATCHID",accessor:{"componentType":5125,"type":"SCALAR"}},"faceRange":{name:"faceRange",accessor:{"componentType":5125,"type":"VEC2"}}};function rs(t,e,r,n){const i=[],o=[],s=[];for(let e=0;e<t.meshes.length;e++){const{geometry:r,material:n}=t.meshes[e],A=Y.getArrayBuffer(r.url);A.xhr.url=r.url,s.push(A.xhr);const a=A.then(t=>({buffer:t}));i.push(a);const B=[];if(Bs(n,B),B.length){const t=B.map(t=>{const e=Y.getArrayBuffer(t.url);return e.xhr.url=t.url,s.push(e.xhr),e.then(e=>e&&e.status?null:{buffer:e,mimeType:t.mimeType,format:t.format})});i.push(...t)}o[e]=B.length}const a=Promise.all(i).then(i=>{for(let t=0;t<i.length;t++)if(!i[t]||!i[t].buffer)return Promise.resolve(null);const s=[];let a=0;for(let t=0;t<o.length;t++){const e=o[t];s.push({geoBuffer:{data:i[a].buffer.data},textureBuffers:i.slice(a+1,e+a+1).map(t=>({data:t.buffer.data,mimeType:t.mimeType,format:t.format}))}),a+=1+e}return function(t,e,r,n,i){const o={asset:{generator:"i3s",version:"2.0"},extensions:{},scene:0,scenes:[{nodes:[]}],nodes:{},meshes:{},materials:[],skins:[],animations:null,textures:[],transferables:[]},s=[];for(let a=0;a<t.meshes.length;a++){let{material:B}=t.meshes[a];const{geometry:E}=t.meshes[a];let c;const C=e[a].geoBuffer.data;if(!C)continue;const f=us(C);c=f?As(o,a,E,C,t.transform,t.center,i):os(o,a,E,C,t.transform,t.center,i),s.push(c),o.nodes[a]={mesh:a,nodeIndex:a,matrix:A([])},o.scenes[0].nodes[a]=o.nodes[a],B||(B=ts);const l=as(a,o,B,e[a].textureBuffers,r,n);s.push(l)}return Promise.all(s).then(()=>({gltf:o,featureTable:{BATCH_LENGTH:0},transferables:o.transferables}))}(t,s,e,n,r)});return a.xhr=s,a}const ns={"magFilter":9728,"minFilter":9728,"wrapR":33071,"wrapS":33071,"wrapT":33071};function As(t,e,r,n,A,i,o){const s=r.info.compressedAttributes.attributes.reduce((t,e,r)=>{const n=es[e];if(!n)return t;return t[n.name||e]=r,t},{});return qo(n,{attributes:s,metadatas:{"POSITION":[{name:"i3s-scale_x",type:"double"},{name:"i3s-scale_y",type:"double"}]},useUniqueIDs:!1,skipAttributeTransform:!1}).then(r=>ss(r,t,e,A,i,o))}const is={position:function(t,e,r){const n=3*t.vertexCount,A=new Float32Array(e,r,n);return t.position={array:A,componentType:5126,itemSize:3,count:n/3,meta:{"i3s-scale_x":1,"i3s-scale_y":1},type:"VEC3"},r+=4*n},normal:function(t,e,r){const n=3*t.vertexCount,A=new Float32Array(e,r,n);return t.normal={array:A,componentType:5126,itemSize:3,count:n/3,type:"VEC3"},r+=4*n},uv0:function(t,e,r){const n=2*t.vertexCount,A=new Float32Array(e,r,n);return t.uv0={array:A,componentType:5126,itemSize:2,count:n/2,type:"VEC2"},r+=4*n},color:function(t,e,r){const n=4*t.vertexCount,A=new Uint8Array(e,r,n);return t.color={array:A,componentType:5121,itemSize:4,count:n/4,type:"VEC4"},r+=n},featureId:function(t,e,r){return r+=8*t.featureCount},id:function(t,e,r){return r+=8*t.featureCount},faceRange:function(t,e,r){const n=2*t.featureCount,A=new Uint32Array(e,r,n);return t.faceRange={array:A,componentType:5125,itemSize:2,count:n/2,type:"VEC2"},r+=4*n},uvRegion:function(t,e,r){const n=4*t.vertexCount,A=new Uint16Array(e,r,n);return t["uv-region"]={array:A,componentType:5123,itemSize:4,count:n/4,type:"VEC4"},r+=2*n},region:function(t,e,r){const n=4*t.vertexCount,A=new Uint16Array(e,r,n);return t["uv-region"]={array:A,componentType:5123,itemSize:4,count:n/4,type:"VEC4"},r+=2*n}};function os(t,e,r,n,A,i,o){const s={vertexCount:0},a=new DataView(n);try{let t=0;s.vertexCount=a.getUint32(t,1),t+=4,s.featureCount=a.getUint32(t,1),t+=4;const e=r.info.ordering?null:r.info;if(e){const r=[];for(const t in e)"offset"!==t&&""!==t&&r.push(t);for(let e=0;e<r.length;e++)is[r[e]]?t=is[r[e]](s,n,t):console.error("Unknown decoder for",r[e])}else{const e=r.info;let A=e.ordering,i=e.featureAttributeOrder;const o=null;o&&o.geometryData&&o.geometryData[0]&&o.geometryData[0].params;for(let e=0;e<A.length;e++){const r=is[A[e]];r||console.log(A[e]),t=r(s,n,t)}for(let e=0;e<i.length;e++){const r=is[i[e]];r||console.log(i[e]),t=r(s,n,t)}}}catch(t){}s.scale_x=1,s.scale_y=1;const B={};for(const t in s){const e=es[t]&&es[t].name;e&&(B[e]=s[t])}if(s.faceRange){const t=s.faceRange.array,e=t.length/2,r=(E=e)<=255?Uint8Array:E<=65535?Uint16Array:Uint32Array,n=new r(B.POSITION.array.length/3);for(let e=0;e<t.length-1;e+=2){const r=e/2,A=t[e],i=t[e+1];for(let t=A;t<=i;t++)n[3*t]=r,n[3*t+1]=r,n[3*t+2]=r}B._BATCHID={componentType:ce(r),array:n,itemSize:1,count:n.length,type:"SCALAR"}}var E;return ss({attributes:B},t,e,A,i,o)}function ss(t,e,r,n,A,i){const o={attributes:t.attributes,material:r,indices:t.indices,mode:4};!function(t){const e=t.array,r=t.meta&&t.meta["i3s-scale_x"],n=t.meta&&t.meta["i3s-scale_y"];if(r&&n&&(1!==r||1!==n))for(let t=0;t<e.length;t+=3)e[t]*=r.value,e[t+1]*=n.value}(t.attributes.POSITION);const s=function(t,e,r,n){const A=r;let i,o=[0,0,0,1];const s=[0,0],a=jo([],r,n);a[2]=r[2];const E=e&&B(zo,e);return be(t,t=>(o[0]=t[0],o[1]=t[1],o[2]=t[2],E||(o=P(o,o,e)),A&&u(o,o,A),jo(s,o,n),i=o[2],t[0]=s[0]-a[0],t[1]=s[1]-a[1],t[2]=i-a[2],t)),a}(t.attributes.POSITION,n,A,i);e.meshes[r]={primitives:[o],index:r},e.extensions.MAPTALKS_RTC={projCenter:s},e.extensions.CESIUM_RTC={rtcCoord:A};for(const r in t.attributes)ls(e.transferables,t.attributes[r].array.buffer);return t.indices&&ls(e.transferables,t.indices.array.buffer),o}function as(t,e,r,n,A,i){const o=n.map(t=>function(t,e,r,n,A){if("dds"===e){const e=xo(t),n=e.images.map(e=>new Uint8Array(t,e.offset,e.length)),A="dxt1"===e.format?33777:33779;return Promise.resolve({image:{mipmap:n,width:e.shape[0],height:e.shape[1],mimeType:r},sampler:ns,format:A})}if("png"===e||"jpg"===e)return function(t,e){Es||(Es=new OffscreenCanvas(2,2),cs=Es.getContext("2d",{willReadFrequently:!0}));const r=new Blob([new Uint8Array(t)]);return createImageBitmap(r).then(t=>{let{width:r,height:n}=t;Cs(r)||(r=fs(r)),Cs(n)||(n=fs(n));const A=e;A&&(r=Math.min(A,r),n=Math.min(A,n)),Es.width=r,Es.height=n,cs.drawImage(t,0,0,r,n),t.close();const i=cs.getImageData(0,0,r,n);return{width:r,height:n,array:new Uint8Array(i.data)}}).catch(()=>({width:2,height:2,array:new Uint8Array(4)}))}(t,A).then(t=>{t.mimeType=r;return{image:t,sampler:ns,format:6408}});if("ktx2"===e)return $o(t,n).then(t=>(t.mimeType=r,{image:t,sampler:ns,format:t.format}));return null}(t.data,t.format,t.mimeType,A,i).then(t=>{if(t.image)if(t.image.array)ls(e.transferables,t.image.array.buffer);else if(t.image.mipmap)for(let r=0;r<t.image.mipmap.length;r++)ls(e.transferables,t.image.mipmap[r].buffer);return t}));return Promise.all(o).then(n=>{!function t(e,r,n,A){const i=JSON.parse(JSON.stringify(n)),o=r.textures;A.ptr||(A.ptr=0);for(const e in n)n[e]&&n[e].url?(o.push(A[A.ptr++]),i[e]={index:o.length-1},void 0!==n[e].factor&&(i[e].scale=n[e].factor)):Ft(n[e])&&(i[e]=t(-1,r,n[e],A));e>=0&&(r.materials[e]=i);return i}(t,e,r,n)})}function Bs(t,e){for(const r in t)t[r]&&t[r].url?e.push({url:t[r].url,mimeType:t[r].mimeType,format:t[r].format}):Ft(t[r])&&Bs(t[r],e)}let Es,cs;function Cs(t){return 0==(t&t-1)&&0!==t}function fs(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function ls(t,e){e&&(t.indexOf(e)>=0||t.push(e))}function us(t){const e=new Uint8Array(t,0,5);return e[0]==="D".charCodeAt()&&e[1]==="R".charCodeAt()&&e[2]==="A".charCodeAt()&&e[3]==="C".charCodeAt()&&e[4]==="O".charCodeAt()}const _s=[1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1],Is=[0,0,1,0,0,1,0,0,-1,0,0,0,0,0,0,1],Ds="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;let hs,Rs=!1;if("undefined"!=typeof OffscreenCanvas){try{hs=new OffscreenCanvas(2,2).getContext("2d",{willReadFrequently:!0})}catch(En){}hs&&"undefined"!=typeof createImageBitmap&&(Rs=!0)}const Ts=A([]),Fs=[0,0,0],Ps=[],Os=[],Ls=[],ys=[];class Ms{constructor(t,e,r,n){this.id=t,this.options=e,this.Ft=this.requestImage.bind(this),this.Pt=r,this.Ot={},n(null,{},[])}Lt(t){this.yt||(this.i=t,this.Mt=new Pe,this.yt=new De(this.Ft,ut,t),this.Nt=new he(this.Ft,ut,t))}requestImage(t,e){Rs?fetch(t).then(t=>t.arrayBuffer()).then(t=>{const e=new self.Blob([new Uint8Array(t)]);return createImageBitmap(e)}).then(t=>{(void 0).width=t.width,(void 0).height=t.height,hs.drawImage(t,0,0);const r=hs.getImageData(0,0,(void 0).width,(void 0).height);t.close(),e(null,{width:t.width,height:t.height,data:new Uint8Array(r.data)})}):this.Pt("requestImage",{url:t},null,e)}loadTile(t,e){this.Lt(t.supportedFormats);const r=t.url,n=t.arraybuffer;if(function(t){return t.indexOf("i3s:")>=0}(r)){const n=t.i3sInfo,A=this.options.services[t.rootIdx].maxTextureSize||1024,i=rs(n,t.supportedFormats,this.options.projection,A);return i.then(t=>{if(delete this.Ot[r],!t)return void e({status:404,url:r,i3sInfo:n});if(!Object.keys(t.gltf.meshes).length)return void e({status:404,url:r,i3sInfo:n});t.gltf.url=r;const{transferables:A}=t;t.magic="b3dm",e(null,t,A)}),void(this.Ot[r]=i.xhr)}if(n){delete this.Ot[r];const A=new DataView(n),i=Xt(A,0);if("{"===i[0]||" "===i[0]||"<"===i[0]){const A=function(t,e,r){if(Ds){const n=new Uint8Array(t,e,r);return Ds.decode(n)}return Mt(new Uint8Array(t,e,r))}(n,0,n.byteLength),i=JSON.parse(A);this.St(t.rootIdx,i,n,r,e)}else{const o=A.getFloat32(0,!0);1===o||2===o||3===o?this.dt(n,r,t,e):this.Ut(n,r,t,i,e)}}else{const n=this.options.services[t.rootIdx];let A=n.urlParams;A&&(A=(r.indexOf("?")>0?"&":"?")+A);const i=r.replace(/\\+/g,"%2B");let o=Y.getArrayBuffer(i+(A||""),n.fetchOptions);const s=o.xhr;o=o.then(n=>{delete this.Ot[r],n&&n.status?e(n):(t.arraybuffer=n&&n.data,this.loadTile(t,e))}).catch(t=>{delete this.Ot[r],e(t)}),this.Ot[r]=s}}Ut(t,e,r,n,A){const i=this.options.services[r.rootIdx];if("b3dm"===n){this.yt.load(e,t,0,0,{maxTextureSize:i.maxTextureSize||1024}).then(t=>{if(t.error)return void A(t);const{content:e,transferables:n}=this.Gt(t,r);A(null,e,n)}).catch(t=>{A(t)})}else if("pnts"===n){const n=r.transform;this.Mt.load(e,t).then(t=>{const{content:e,transferables:i}=this.bt(t,n,r.rootIdx);A(null,e,i)})}else if("i3dm"===n){const n=r.transform;this.Nt.load(e,t,0,0,{maxTextureSize:i.maxTextureSize||1024}).then(t=>{const{content:e,transferables:i}=this.bt(t,n,r.rootIdx);A(null,e,i)})}else if("cmpt"===n){new Le(this.Ft,ut,this.i,i.maxTextureSize||1024).load(e,t,0,0,{maxTextureSize:i.maxTextureSize||1024}).then(t=>{const{content:e,transferables:n}=this.pt(t,r);A(null,e,n)}).catch(t=>{A(t)})}}dt(t,e,r,n){fo({buffer:t,bytesOffset:0},this.options.services[r.rootIdx].maxTextureSize||1024).then(t=>{t.gltf.url=e;const{content:A,transferables:i}=this.Gt(t,r);if(A.magic="b3dm",t.pageLods){const e=this.wt(t.pageLods);e.length&&(A.children=e)}n(null,A,i)})}wt(t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];if(!n.childTile)continue;const A={boundingVolume:{sphere:[n.boundingSphere.center.x,n.boundingSphere.center.y,n.boundingSphere.center.z,n.boundingSphere.radius]},content:{uri:n.childTile},geometricError:n.boundingSphere.radius/n.rangeList*16,refine:"REPLACE"};e.push(A)}return e}St(t,e,r,n,A){return e.dataType&&e.position?void A(null,He(e)):(e.capabilities,void A(null,e))}pt(t,e){const{tiles:r}=t,n={magic:"cmpt",content:[]},A=[];for(let t=0;t<r.length;t++){const{magic:i}=r[t];if("b3dm"===i){const{content:i,transferables:o}=this.Gt(r[t],e);Us(A,o),n.content.push(i)}else if("i3dm"===i||"pnts"===i){const{transform:i,rootIdx:o}=e,{content:s,transferables:a}=this.bt(r[t],i,o);Us(A,a),n.content.push(s)}else if("cmpt"===i){const{content:i,transferables:o}=this.pt(r[t],e);Us(A,o),n.content.push(i)}}return{content:n,transferables:A}}Gt(t,e){const{gltf:r,transferables:n,featureTable:A}=t,i=function(t){if(!t||!t.meshes)return!1;let e=1;const r=[];for(const n in t.meshes){const A=t.meshes[n],{primitives:i}=A;if(i)for(let t=0;t<i.length;t++){const n=i[t].attributes&&i[t].attributes.POSITION;if(!n||!n.array)continue;n.array.buffer.visited||(n.array.buffer.visited=e++);const A=e-1+"-"+(n.byteOffset||0);if(r.indexOf(A)>=0)return!0;r.push(A)}}return!1}(r);return this.Ht(t.gltf),t.gltf.asset||(t.gltf.asset={}),i?(t.gltf.asset.sharePosition=!0,this.Kt(r,A,e.upAxis,e.transform)):this.gt(r,A,e.upAxis,e.transform),delete t.transferables,{content:t,transferables:n}}bt(t,e,n){const{featureTable:A}=t,i=t.pnts||t.i3dm,o=A&&A.RTC_CENTER||[0,0,0];if(A.EAST_NORTH_UP&&!i.NORMAL_UP&&!i.NORMAL_UP_OCT32P){const e=new Float32Array(3*i.POSITION.array.length),n=[],A=[],s=[];be(i.POSITION,(t,i)=>{u(s,t,o),ae(s,null,n),r(A,n);!function(t,e){t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8]}(e.subarray(9*i,9*(i+1)),A)}),i.INSTANCE_ROTATION={byteStride:0,byteOffset:0,itemSize:9,componentType:5126,array:e},t.transferables.push(e.buffer)}const s={xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0,hmin:1/0,hmax:-1/0};Ss(i.POSITION.array,3,o,Ts,s);const a=ds(s),B=f([],a),E=[1/0,1/0,1/0],c=[-1/0,-1/0,-1/0];be(i.POSITION,t=>{t[0]=t[0]+o[0]-B[0],t[1]=t[1]+o[1]-B[1],t[2]=t[2]+o[2]-B[2],t[0]<E[0]&&(E[0]=t[0]),t[1]<E[1]&&(E[1]=t[1]),t[2]<E[2]&&(E[2]=t[2]),t[0]>c[0]&&(c[0]=t[0]),t[1]>c[1]&&(c[1]=t[1]),t[2]>c[2]&&(c[2]=t[2])}),i.POSITION.min=E,i.POSITION.max=c,e&&P(a,a,e);const C=this.Vt(a);t.rtcCenter=B,t.rtcCoord=C,t.rootIdx=n;const l=t.transferables;return delete t.transferables,{content:t,transferables:l}}Ht(t){if(!Array.isArray(t.textures))return;const e=t.textures;for(let t=0;t<e.length;t++){const r=e[t].image&&e[t].image.array;if(r&&r.length){const n=r[0],A=r[1],i=r[2],o=r[3];let s=!0;for(let t=4;t<r.length;t+=4)if(r[t]!==n||r[t+1]!==A||r[t+2]!==i||r[t+3]!==o){s=!1;break}s&&(e[t].image.color=[n/255,A/255,i/255,o/255],delete e[t].image.array)}}}abortTileLoading(t,e){const r=this.Ot[t.url];if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t].abort();else r&&r.abort&&r.abort();delete this.Ot[t.url],e(null)}Jt(t,e,r,n){const o=e&&e.RTC_CENTER||t.extensions&&t.extensions.CESIUM_RTC&&t.extensions.CESIUM_RTC.center;let s=_s;"X"===(r=r&&r.toUpperCase())?s=Is:"Z"===r&&(s=Ts),t.extensions=t.extensions||{},t.extensions.CESIUM_RTC||(t.extensions.CESIUM_RTC={}),o&&(t.extensions.CESIUM_RTC.center=o),t.extensions.MAPTALKS_RTC={};const a={xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0,hmin:1/0,hmax:-1/0};ye(t,t=>{if(!(t.attributes&&t.attributes.POSITION))return;const e=A(Ps);t.matrices&&Gs(e,t.matrices);const r=t.attributes.POSITION.array,B=t.attributes.POSITION.itemSize;i(e,s,e),n&&i(e,n,e),Ss(r,B,o||Fs,e,a,t.compressUniforms)});const B=ds(a);return{rtcCenter:o,modelCenter:B,upAxisTransform:s}}Kt(t,e,r,n){const{modelCenter:o,upAxisTransform:s,rtcCenter:a}=this.Jt(t,e,r),B=f([],o);n&&P(o,o,n),t.extensions.CESIUM_RTC.rtcCoord=this.Vt(o),a||(ye(t,t=>{if(t.attributes&&t.attributes.POSITION){const e=t.attributes.POSITION;if(e.array.buffer.projected&&e.array.buffer.projected[e.byteOffset])return;const r=A(Ps);t.matrices&&Gs(r,t.matrices),i(r,s,r);const n=function(t,e){var r=e[0],n=e[1],A=e[2],i=e[3],o=e[4],s=e[5],a=e[6],B=e[7],E=e[8],c=e[9],C=e[10],f=e[11],l=e[12],u=e[13],_=e[14],I=e[15],D=r*s-n*o,h=r*a-A*o,R=r*B-i*o,T=n*a-A*s,F=n*B-i*s,P=A*B-i*a,O=E*u-c*l,L=E*_-C*l,y=E*I-f*l,M=c*_-C*u,N=c*I-f*u,S=C*I-f*_,d=D*S-h*N+R*M+T*y-F*L+P*O;return d?(d=1/d,t[0]=(s*S-a*N+B*M)*d,t[1]=(A*N-n*S-i*M)*d,t[2]=(u*P-_*F+I*T)*d,t[3]=(C*F-c*P-f*T)*d,t[4]=(a*y-o*S-B*L)*d,t[5]=(r*S-A*y+i*L)*d,t[6]=(_*R-l*P-I*h)*d,t[7]=(E*P-C*R+f*h)*d,t[8]=(o*N-s*y+B*O)*d,t[9]=(n*y-r*N-i*O)*d,t[10]=(l*F-u*R+I*D)*d,t[11]=(c*R-E*F-f*D)*d,t[12]=(s*L-o*M-a*O)*d,t[13]=(r*M-n*L+A*O)*d,t[14]=(u*h-l*T-_*D)*d,t[15]=(E*T-c*h+C*D)*d,t):null}(Os,r),o=[1/0,1/0,1/0],a=[-1/0,-1/0,-1/0];be(e,t=>{P(t,t,r),t[0]=t[0]-B[0],t[1]=t[1]-B[1],t[2]=t[2]-B[2],P(t,t,n),t[0]<o[0]&&(o[0]=t[0]),t[1]<o[1]&&(o[1]=t[1]),t[2]<o[2]&&(o[2]=t[2]),t[0]>a[0]&&(a[0]=t[0]),t[1]>a[1]&&(a[1]=t[1]),t[2]>a[2]&&(a[2]=t[2])}),e.min=o,e.max=a,e.array.buffer.projected||(e.array.buffer.projected={}),e.array.buffer.projected[e.byteOffset]=1}}),t.extensions.CESIUM_RTC.center=B)}gt(t,e,r,n){const{modelCenter:A,rtcCenter:i}=this.Jt(t,e,r,n),o=this.Xt(A);t.extensions.MAPTALKS_RTC.projCenter=o,t.extensions.CESIUM_RTC.rtcCoord=this.Vt(A),ye(t,e=>{if(e.attributes&&e.attributes.POSITION){e.attributes.NORMAL&&this.vt(e.attributes.NORMAL,e.matrices,r),e.attributes.TANGENT&&this.vt(e.attributes.TANGENT,e.matrices,r);const{newPositions:A}=this.Zt(e.attributes.POSITION,e.matrices,i,t.extensions.MAPTALKS_RTC,r,n,e.compressUniforms),{componentType:o}=e.attributes.POSITION;5126!==o&&(e.attributes.POSITION.array=new Float32Array(A))}});for(const e in t.nodes){t.nodes[e].matrix=Ts}}Xt(t){0===y(t)?l(Ls,0,0,-6378137):wt(Ls,t);const e=this.options.projection;jo(ys,Ls,e);const r=Ls[2],n=[];return n[0]=ys[0],n[1]=ys[1],n[2]=r,n}vt(t,e,A){let i;i="Y"===A?_s:"X"===A?Is:Ts;const o=n([],i);if(Gs(o,e),B(o,Ts))return;const s=r([],o),a=[];be(t,t=>(function(t,e,r){var n=e[0],A=e[1],i=e[2];t[0]=n*r[0]+A*r[3]+i*r[6],t[1]=n*r[1]+A*r[4]+i*r[7],t[2]=n*r[2]+A*r[5]+i*r[8]}(a,t,s),R(a,a),f(t,a),a))}Zt(t,e,r,n,i,o,s){if(t.array.buffer.projected&&t.array.buffer.projected[t.byteOffset])return null;const a=A([]);Gs(a,e);const E=this.options.projection;i=i&&i.toUpperCase();const c=r;let C=null;"Y"===i?C=_s:"X"===i&&(C=Is);let f=[0,0,0,1];const _=[0,0,0],I=[0,0],D=n.projCenter,h=o&&B(Ts,o),R=t.min=t.min||[],T=t.max=t.max||[];l(R,1/0,1/0,1/0),l(T,-1/0,-1/0,-1/0);const F=s||{},{decode_position_min:O,decode_position_normConstant:L}=F;let M=[0,0,0,0],N=1;O&&(M=O),L&&(N=L);const S=[];return be(t,t=>{if(f[0]=t[0]*N+M[0],f[1]=t[1]*N+M[1],f[2]=t[2]*N+M[2],f=P(f,f,a),C&&(f=P(f,f,C)),c&&u(f,f,c),o&&!h&&(f=P(f,f,o)),0===y(f)?l(_,0,0,-6378137):wt(_,f),jo(I,_,E),t instanceof Float32Array)t[0]=I[0]-D[0],t[1]=I[1]-D[1],t[2]=_[2]-D[2];else{const e=I[0]-D[0],r=I[1]-D[1],n=_[2]-D[2];S.push(e),S.push(r),S.push(n),S.push(t[3])}return t[0]<R[0]&&(R[0]=t[0]),t[1]<R[1]&&(R[1]=t[1]),t[2]<R[2]&&(R[2]=t[2]),t[0]>T[0]&&(T[0]=t[0]),t[1]>T[1]&&(T[1]=t[1]),t[2]>T[2]&&(T[2]=t[2]),t}),t.array.buffer.projected||(t.array.buffer.projected={}),t.array.buffer.projected[t.byteOffset]=1,{projCenter:D,newPositions:S}}Vt(t){return 0===y(t)?l([],0,0,-6378137):wt([],t)}onRemove(){}}const Ns=[];function Ss(t,e,r,n,A,i){const o=i||{},{decode_position_min:s,decode_position_normConstant:a}=o;let B=[0,0,0,0],E=1;s&&(B=s),a&&(E=a);for(let i=0,o=t.length;i<o;i+=e){const{xmin:o,ymin:s,xmax:a,ymax:c,hmin:C,hmax:f}=A;l(Ns,t[i]*E+B[0],t[i+1]*E+B[1],t[i+2]*E+B[2]),P(Ns,Ns,n);const _=u(Ns,r,Ns);_[0]<o&&(A.xmin=_[0]),_[0]>a&&(A.xmax=_[0]),_[1]<s&&(A.ymin=_[1]),_[1]>c&&(A.ymax=_[1]),e>2&&(_[2]<C&&(A.hmin=_[2]),_[2]>f&&(A.hmax=_[2]))}}function ds(t){const{xmax:e,ymax:r,xmin:n,ymin:A,hmin:i,hmax:o}=t,s=[(n+e)/2,(A+r)/2,(i+o)/2];return e===-1/0&&(s[0]=0),r===-1/0&&(s[1]=0),o===-1/0&&(s[2]=0),isNaN(s[2])&&(s[2]=0),s}function Us(t,e){for(let r=0;r<e.length;r++)t.indexOf(e[r])<0&&t.push(e[r])}function Gs(t,e){const r=t;for(let t=e.length-1;t>=0;t--)i(r,e[t],r);return r}let ms=0;class bs{constructor(t){this.workerId=t,this.workers={},this.xt={}}addLayer({actorId:t,mapId:e,layerId:r,params:n},A){if(this.kt(e,r))return;const i=this.Wt(e,r),o=n.options,s=this.send.bind(this,t);this.workers[i]=new Ms(r,o,s,A)}removeLayer({mapId:t,layerId:e},r){const n=this.kt(t,e),A=this.Wt(t,e);delete this.workers[A],n&&n.onRemove(r)}loadTile({mapId:t,layerId:e,params:r},n){const A=this.kt(t,e);A&&A.loadTile(r,n)}abortTileLoading({mapId:t,layerId:e,params:r},n){const A=this.kt(t,e);A&&A.abortTileLoading(r,n)}receive(t){const e=t.callback,r=this.xt[e];delete this.xt[e],r&&t.error?r(new Error(t.error)):r&&r(null,t.data)}send(t,e,r,n,A){const i=A?`${t}-${ms++}`:null;A&&(this.xt[i]=A),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:e,params:r,callback:String(i)},n||[])}Wt(t,e){return`${t}-${e}`}kt(t,e){const r=this.Wt(t,e);return this.workers[r]}}t.initialize=function(){},t.onmessage=function(t,e){const r=t.data;this.dispatcher||(this.dispatcher=new bs(t.workerId)),"<response>"===t.type?this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t):this.dispatcher[r.command]({actorId:r.actorId,mapId:r.mapId,layerId:r.layerId,params:r.params},(t,r,n)=>{t instanceof Error&&(t={message:t.message}),e(t,r,n)})},Object.defineProperty(t,"Qt",{value:!0})}';for(
7
7
  /*!
8
8
  * Contains code from THREE.js
9
9
  * MIT License
10
10
  * https://github.com/mrdoob/three.js
11
- */;for(var A=[],c=0;c<6;c++)A[c]=[];var l=[];function f(t,e,r){p(t);for(var n=0;n<6;n++)if(!r||"0"!==r.charAt(n)){var i=A[n];if(l[0]=i[0]>0?e[1][0]:e[0][0],l[1]=i[1]>0?e[1][1]:e[0][1],l[2]=i[2]>0?e[1][2]:e[0][2],y(i,l)<0)return!1}return!0}var h=3,u=6,E=9,_=4,B=7,d=10,C=5,T=8,m=11;function g(t,e){var r=e,n=t,i=e,s=n[0],o=n[1],a=n[2],A=Math.abs(s*i[h]+o*i[u]+a*i[E])+Math.abs(s*i[_]+o*i[B]+a*i[d])+Math.abs(s*i[C]+o*i[T]+a*i[m]),c=y(t,r);return!(c<=-A)}function p(t){var e=t,r=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8],h=e[9],u=e[10],E=e[11],_=e[12],B=e[13],d=e[14],C=e[15];R(A[0],s-r,l-o,E-f,C-_),R(A[1],s+r,l+o,E+f,C+_),R(A[2],s+n,l+a,E+h,C+B),R(A[3],s-n,l-a,E-h,C-B),R(A[4],s-i,l-c,E-u,C-d),R(A[5],s+i,l+c,E+u,C+d)}function R(t,e,r,n,i){var s=1/Math.sqrt(e*e+r*r+n*n);return t[0]=e*s,t[1]=r*s,t[2]=n*s,t[3]=i*s,t}function y(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]}function I(t){return null==t}function b(t){for(let e=1;e<arguments.length;e++){const r=arguments[e];for(const e in r)t[e]=r[e]}return t}function S(t){return null!=t&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function P(t){return"object"==typeof t&&!!t}function M(t){return"number"==typeof t&&!isNaN(t)}function N(t){return t*Math.PI/180}function D(t){return t/Math.PI*180}function O(t){let e=document.createElement("a");return e.href=t,t=e.href,e=null,t}function L(t){return Math.sign?Math.sign(t):0===(t=+t)||isNaN(t)?Number(t):t>0?1:-1}const F=[1,1,1,1,2,2,3,0];function x(t){const e=t.length;let r="";for(let n=0;n<e;){let i=t[n++];if(128&i){let r=F[i>>3&7];if(!(64&i)||!r||n+r>e)return null;for(i&=63>>r;r>0;r-=1){const e=t[n++];if(128!=(192&e))return null;i=i<<6|63&e}}r+=String.fromCharCode(i)}return r}function w(t,e,r){return t[3*r]=e[0],t[3*r+1]=e[1],t[3*r+2]=e[2],t}function v(t){return t.flat?t.flat(1/0):t.reduce(((t,e)=>t.concat(e)),[])}function U(t){return t<256?Uint8Array:t<65536?Uint16Array:Uint32Array}function G(t){return 0===t.indexOf("data:")}function H(t){const e=t.indexOf("base64,"),r=t.substring(e+7),n=window.atob(r),i=n.length,s=new Uint8Array(i);for(let t=0;t<i;t++)s[t]=n.charCodeAt(t);return s.buffer}function V(t){for(let e=1;e<arguments.length;e++){const r=arguments[e];if(r)for(let e=0,n=r.length;e<n;e++)t.push(r[e])}return t.length}var K=Object.freeze({__proto__:null,isNil:I,extend:b,isFunction:S,isObject:P,isNumber:M,toRadian:N,toDegree:D,getAbsoluteURL:O,sign:L,stringFromUTF8Array:x,setColumn3:w,flatArr:v,getBatchIdArrayType:U,isBase64:G,base64URLToArrayBuffer:H,pushIn:V});var k=1e-6,X="undefined"!=typeof Float32Array?Float32Array:Array;function z(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function J(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3],a=e[4],A=e[5],c=e[6],l=e[7],f=e[8],h=e[9],u=e[10],E=e[11],_=e[12],B=e[13],d=e[14],C=e[15],T=r[0],m=r[1],g=r[2],p=r[3];return t[0]=T*n+m*a+g*f+p*_,t[1]=T*i+m*A+g*h+p*B,t[2]=T*s+m*c+g*u+p*d,t[3]=T*o+m*l+g*E+p*C,T=r[4],m=r[5],g=r[6],p=r[7],t[4]=T*n+m*a+g*f+p*_,t[5]=T*i+m*A+g*h+p*B,t[6]=T*s+m*c+g*u+p*d,t[7]=T*o+m*l+g*E+p*C,T=r[8],m=r[9],g=r[10],p=r[11],t[8]=T*n+m*a+g*f+p*_,t[9]=T*i+m*A+g*h+p*B,t[10]=T*s+m*c+g*u+p*d,t[11]=T*o+m*l+g*E+p*C,T=r[12],m=r[13],g=r[14],p=r[15],t[12]=T*n+m*a+g*f+p*_,t[13]=T*i+m*A+g*h+p*B,t[14]=T*s+m*c+g*u+p*d,t[15]=T*o+m*l+g*E+p*C,t}function Y(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function Z(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function W(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],o=r+r,a=n+n,A=i+i,c=r*o,l=n*o,f=n*a,h=i*o,u=i*a,E=i*A,_=s*o,B=s*a,d=s*A;return t[0]=1-f-E,t[1]=l+d,t[2]=h-B,t[3]=0,t[4]=l-d,t[5]=1-c-E,t[6]=u+_,t[7]=0,t[8]=h+B,t[9]=u-_,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function j(){var t=new X(3);return X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Q(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function q(t,e,r){var n=new X(3);return n[0]=t,n[1]=e,n[2]=r,n}function $(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function tt(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function et(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function rt(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function nt(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function it(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function st(t,e){var r=e[0],n=e[1],i=e[2],s=r*r+n*n+i*i;return s>0&&(s=1/Math.sqrt(s),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s),t}function ot(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function at(t,e,r){var n=e[0],i=e[1],s=e[2],o=r[0],a=r[1],A=r[2];return t[0]=i*A-s*a,t[1]=s*o-n*A,t[2]=n*a-i*o,t}var At=rt,ct=nt,lt=Q;function ft(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function ht(){var t=new X(4);return X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function ut(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function Et(t,e,r,n){var i=e[0],s=e[1],o=e[2],a=e[3],A=r[0],c=r[1],l=r[2],f=r[3],h=void 0,u=void 0,E=void 0,_=void 0,B=void 0;return(u=i*A+s*c+o*l+a*f)<0&&(u=-u,A=-A,c=-c,l=-l,f=-f),1-u>k?(h=Math.acos(u),E=Math.sin(h),_=Math.sin((1-n)*h)/E,B=Math.sin(n*h)/E):(_=1-n,B=n),t[0]=_*i+B*A,t[1]=_*s+B*c,t[2]=_*o+B*l,t[3]=_*a+B*f,t}j(),function(){var t,e=(t=new X(4),X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var _t,Bt=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t};j(),q(1,0,0),q(0,1,0),ht(),ht(),_t=new X(9),X!=Float32Array&&(_t[1]=0,_t[2]=0,_t[3]=0,_t[5]=0,_t[6]=0,_t[7]=0),_t[0]=1,_t[4]=1,_t[8]=1;
11
+ */
12
+ var a=[],c=0;c<6;c++)a[c]=[];var A=[];function l(t,e,n){h(t);for(var r=0;r<6;r++)if(!n||"0"!==n.charAt(r)){var i=a[r];if(A[0]=i[0]>0?e[1][0]:e[0][0],A[1]=i[1]>0?e[1][1]:e[0][1],A[2]=i[2]>0?e[1][2]:e[0][2],E(i,A)<0)return!1}return!0}function f(t,e){var n=e,r=t,i=e,o=r[0],s=r[1],a=r[2],c=Math.abs(o*i[3]+s*i[6]+a*i[9])+Math.abs(o*i[4]+s*i[7]+a*i[10])+Math.abs(o*i[5]+s*i[8]+a*i[11]),A=E(t,n);return!(A<=-c)}function h(t){var e=t,n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],c=e[5],A=e[6],l=e[7],f=e[8],h=e[9],E=e[10],d=e[11],_=e[12],B=e[13],C=e[14],T=e[15];u(a[0],o-n,l-s,d-f,T-_),u(a[1],o+n,l+s,d+f,T+_),u(a[2],o+r,l+c,d+h,T+B),u(a[3],o-r,l-c,d-h,T-B),u(a[4],o-i,l-A,d-E,T-C),u(a[5],o+i,l+A,d+E,T+C)}function u(t,e,n,r,i){var o=1/Math.sqrt(e*e+n*n+r*r);return t[0]=e*o,t[1]=n*o,t[2]=r*o,t[3]=i*o,t}function E(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]}function d(t){return null==t}function _(t){for(let e=1;e<arguments.length;e++){const n=arguments[e];for(const e in n)t[e]=n[e]}return t}function B(t){return null!=t&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function C(t){return"object"==typeof t&&!!t}function T(t){return"number"==typeof t&&!isNaN(t)}function m(t){return t*Math.PI/180}function g(t){return t/Math.PI*180}function p(t){let e=document.createElement("a");return e.href=t,t=e.href,e=null,t}function y(t){return Math.sign?Math.sign(t):0===(t=+t)||isNaN(t)?Number(t):t>0?1:-1}const R=[1,1,1,1,2,2,3,0];function I(t){const e=t.length;let n="";for(let r=0;r<e;){let i=t[r++];if(128&i){let n=R[i>>3&7];if(!(64&i)||!n||r+n>e)return null;for(i&=63>>n;n>0;n-=1){const e=t[r++];if(128!=(192&e))return null;i=i<<6|63&e}}n+=String.fromCharCode(i)}return n}function b(t,e,n){return t[3*n]=e[0],t[3*n+1]=e[1],t[3*n+2]=e[2],t}function x(t){return t.flat?t.flat(1/0):t.reduce((t,e)=>t.concat(e),[])}function M(t){return t<256?Uint8Array:t<65536?Uint16Array:Uint32Array}function P(t){return 0===t.indexOf("data:")}function N(t){const e=t.indexOf("base64,"),n=t.substring(e+7),r=window.atob(n),i=r.length,o=new Uint8Array(i);for(let t=0;t<i;t++)o[t]=r.charCodeAt(t);return o.buffer}function D(t){for(let e=1;e<arguments.length;e++){const n=arguments[e];if(n)for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t.length}var S=Object.freeze({__proto__:null,isNil:d,extend:_,isFunction:B,isObject:C,isNumber:T,toRadian:m,toDegree:g,getAbsoluteURL:p,sign:y,stringFromUTF8Array:I,setColumn3:b,flatArr:x,getBatchIdArrayType:M,isBase64:P,base64URLToArrayBuffer:N,pushIn:D});var O="undefined"!=typeof Float32Array?Float32Array:Array;function L(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function F(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],c=e[5],A=e[6],l=e[7],f=e[8],h=e[9],u=e[10],E=e[11],d=e[12],_=e[13],B=e[14],C=e[15],T=n[0],m=n[1],g=n[2],p=n[3];return t[0]=T*r+m*a+g*f+p*d,t[1]=T*i+m*c+g*h+p*_,t[2]=T*o+m*A+g*u+p*B,t[3]=T*s+m*l+g*E+p*C,T=n[4],m=n[5],g=n[6],p=n[7],t[4]=T*r+m*a+g*f+p*d,t[5]=T*i+m*c+g*h+p*_,t[6]=T*o+m*A+g*u+p*B,t[7]=T*s+m*l+g*E+p*C,T=n[8],m=n[9],g=n[10],p=n[11],t[8]=T*r+m*a+g*f+p*d,t[9]=T*i+m*c+g*h+p*_,t[10]=T*o+m*A+g*u+p*B,t[11]=T*s+m*l+g*E+p*C,T=n[12],m=n[13],g=n[14],p=n[15],t[12]=T*r+m*a+g*f+p*d,t[13]=T*i+m*c+g*h+p*_,t[14]=T*o+m*A+g*u+p*B,t[15]=T*s+m*l+g*E+p*C,t}function w(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function v(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function U(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n+n,a=r+r,c=i+i,A=n*s,l=r*s,f=r*a,h=i*s,u=i*a,E=i*c,d=o*s,_=o*a,B=o*c;return t[0]=1-f-E,t[1]=l+B,t[2]=h-_,t[3]=0,t[4]=l-B,t[5]=1-A-E,t[6]=u+d,t[7]=0,t[8]=h+_,t[9]=u-d,t[10]=1-A-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function G(){var t=new O(3);return O!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function H(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)}function V(t,e,n){var r=new O(3);return r[0]=t,r[1]=e,r[2]=n,r}function K(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function k(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function X(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function z(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Y(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function J(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function Z(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t}function W(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function j(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],c=n[2];return t[0]=i*c-o*a,t[1]=o*s-r*c,t[2]=r*a-i*s,t}var Q=z,q=Y,$=H;function tt(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function et(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*s,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*s,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*s,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*s,t}function nt(){var t=new O(4);return O!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function rt(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function it(t,e,n,r){var i=e[0],o=e[1],s=e[2],a=e[3],c=n[0],A=n[1],l=n[2],f=n[3],h=void 0,u=void 0,E=void 0,d=void 0,_=void 0;return(u=i*c+o*A+s*l+a*f)<0&&(u=-u,c=-c,A=-A,l=-l,f=-f),1-u>1e-6?(h=Math.acos(u),E=Math.sin(h),d=Math.sin((1-r)*h)/E,_=Math.sin(r*h)/E):(d=1-r,_=r),t[0]=d*i+_*c,t[1]=d*o+_*A,t[2]=d*s+_*l,t[3]=d*a+_*f,t}G(),function(){var t,e=(t=new O(4),O!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var ot,st=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t};G(),V(1,0,0),V(0,1,0),nt(),nt(),ot=new O(9),O!=Float32Array&&(ot[1]=0,ot[2]=0,ot[3]=0,ot[5]=0,ot[6]=0,ot[7]=0),ot[0]=1,ot[4]=1,ot[8]=1;
12
13
  /*!
13
- * @maptalks/gltf-loader v0.27.2
14
+ * @maptalks/gltf-loader v0.83.0
14
15
  * LICENSE : UNLICENSED
15
- * (c) 2016-2022 maptalks.org
16
+ * (c) 2016-2023 maptalks.org
16
17
  */
17
- let dt=0;function Ct(t){return null==t}function Tt(t){return!Ct(t)}function mt(t){for(let e=1;e<arguments.length;e++){const r=arguments[e];for(const e in r)t[e]=r[e]}return t}function gt(t){switch(t){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:return Uint16Array;case 5124:return Int32Array;case 5125:return Uint32Array;case 5126:return Float32Array}throw new Error("unsupported bufferView's component type: "+t)}function pt(t){return 0===t.indexOf("data:")&&t.indexOf("base64,")>0}function Rt(t){const e=function(t){return"undefined"!=typeof self?self.atob(t):window.atob(t)}(t.substring(t.indexOf(",")+1)),r=e.length,n=new Uint8Array(r);for(let t=0;t<r;t++)n[t]=e.charCodeAt(t);return n.buffer}const yt=[],It=[],bt=[],St=[0,0,0],Pt=ut([]),Mt=[1,1,1];function Nt(t,e,r,n,i,s,o){const a=gt(o);if((0===i||i===n*a.BYTES_PER_ELEMENT)&&s%a.BYTES_PER_ELEMENT==0){const i=new a(e,s,r*n);return t.set(i),t}0===i&&(i=n*a.BYTES_PER_ELEMENT);const A=new Uint8Array(n*a.BYTES_PER_ELEMENT);for(let o=0;o<r;o++){let r=null;const c=new Uint8Array(e,i*o+s,n*a.BYTES_PER_ELEMENT);A.set(c),r=new a(A.buffer,0,n);for(let e=0;e<n;e++)t[o*n+e]=r[e]}return t}const Dt="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;function Ot(t,e,r){const n=new Uint8Array(t,e,r);return Dt.decode(n)}const Lt={get:function(t,e={}){e||(e={});const r=new AbortController,n=r.signal,i=mt({},e);i.signal=n,i.method||(i.method="GET");const s=fetch(t,i).then((t=>{const r=this.i(t,e.responseType);return r.message?r:r.then((r=>"arraybuffer"===e.responseType?{data:r,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),contentType:t.headers.get("Content-Type")}:r)).catch((t=>{if(!t.code||t.code!==DOMException.ABORT_ERR)throw t}))})).catch((t=>{if(!t.code||t.code!==DOMException.ABORT_ERR)throw t}));return s.xhr=r,s},i:(t,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`}:"arraybuffer"===e?t.arrayBuffer():"json"===e?t.json():t.text(),getArrayBuffer:(t,e={})=>(e||(e={}),e.responseType="arraybuffer",Lt.get(t,e)),getJSON:function(t,e={}){return e&&e.jsonp?Lt.jsonp(t):((e=e||{}).responseType="json",Lt.get(t,e))},jsonp:function(t){const e="_maptalks_jsonp_"+dt++;t.match(/\?/)?t+="&callback="+e:t+="?callback="+e;let r=document.createElement("script");return r.type="text/javascript",r.src=t,new Promise((t=>{window[e]=function(n){document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[e],t(n)},document.getElementsByTagName("head")[0].appendChild(r)}))}};class Ft{constructor(t,e,r){this.o=t,this.decoders=e,this.A=r,this.images={},this.l={}}requestImageFromBufferURI(t,e,r){if(this.buffers[t.id]){const n=this.buffers[t.id],i=this.h(e,n);return this.getImageByBuffer(i,r)}if(this.l[t.id])return this.l[t.id].then((()=>{const n=this.buffers[t.id],i=this.h(e,n);return this.getImageByBuffer(i,r)}));if(pt(t.uri)){const n=this.buffers[t.id]=Rt(t.uri),i=this.h(e,n);return this.getImageByBuffer(i,r)}return this.l[t.id]=Lt.getArrayBuffer(t.uri,null).then((n=>{const i=this.buffers[t.id]=n.data,s=this.h(e,i);return this.getImageByBuffer(s,r)}))}getImageByBuffer(t,e){if(this.images[e.id])return Promise.resolve(this.images[e.id]);const r=this.decoders;if(r[e.mimeType])return r[e.mimeType](t,{supportedFormats:this.A});if("image/crn"===e.mimeType||"image/ktx2"===e.mimeType||"image/cttf"===e.mimeType)return console.warn("missing transcoder for "+e.mimeType,", visit https://maptalks.com/docs/transcoders for details"),Promise.resolve(null);{const r=new Blob([t],{type:e.mimeType}),n=URL.createObjectURL(r);return this.u(e.id,n)}}requestExternalImage(t){if(this.images[t.id])return Promise.resolve(this.images[t.id]);const e=0===t.uri.indexOf("data:image/")?t.uri:this.rootPath+"/"+t.uri;return this.l[t.id]?this.l[t.id].then((()=>this.images[t.id])):this.l[t.id]=this.u(t.id,e)}u(t,e){return new Promise(((r,n)=>{this.o(e,((i,s)=>{i?n(i):(URL.revokeObjectURL(e),this.images[t]=s,r(this.images[t]))}))}))}}const xt=["SCALAR",1,"VEC2",2,"VEC3",3,"VEC4",4,"MAT2",4,"MAT3",9,"MAT4",16];class wt{constructor(t,e,r){this.rootPath=t,this.gltf=e,this._=!1,this.glbBuffer=r,this.buffers={},this.requests={},this.accessors={},this.B()}C(t,e){const r=this.gltf,n=r.accessors[e];if(void 0===n.bufferView)return this.accessors[n.id]=this.T(t,e,null,0),Promise.resolve(this.accessors[n.id]);if(n&&this.accessors[n.id])return Promise.resolve(this.accessors[n.id]);const i=r.bufferViews[n.bufferView];return this.m(i).then((r=>{const{buffer:i,byteOffset:s}=r;return this.accessors[n.id]=this.T(t,e,i,s)}))}m(t){const e=this.gltf.buffers[t.buffer];if(this.buffers[e.id]){const t=this.buffers[e.id];return Promise.resolve({buffer:t,byteOffset:0})}if(this.requests[e.id])return this.requests[e.id].then((()=>{const t=this.buffers[e.id];return Promise.resolve({buffer:t,byteOffset:0})}));if("binary_glTF"!==t.buffer&&"KHR_binary_glTF"!==t.buffer&&e.uri){if(pt(e.uri)){const t=this.buffers[e.id]=Rt(e.uri);return Promise.resolve({buffer:t,byteOffset:0})}let t;const r=e.uri.indexOf("blob:")>=0;return t=e.uri.indexOf("://")>0||r?e.uri:this.rootPath+"/"+e.uri,this.requests[e.id]=Lt.getArrayBuffer(t,null).then((n=>(r&&URL.revokeObjectURL(t),{buffer:this.buffers[e.id]=n.data,byteOffset:0})))}return Promise.resolve({buffer:this.glbBuffer.buffer,byteOffset:this.glbBuffer.byteOffset})}T(t,e,r,n=0){const i=this.gltf,s=i.accessors[e],o=void 0!==s.bufferView?i.bufferViews[s.bufferView]:{},a=(o.byteOffset||0)+n,A=this.g(s.type),c=gt(s.componentType),l=o.byteStride||0,f={array:void 0,name:t,accessorName:e,byteLength:s.count*A*c.BYTES_PER_ELEMENT,componentType:s.componentType,count:s.count,type:s.type,itemSize:A};if(s.min&&(f.min=s.min),s.max&&(f.max=s.max),r)if(this._)f.byteStride=l,f.byteOffset=a+(s.byteOffset||0),!l||l===A*c.BYTES_PER_ELEMENT||"indices"===t||"input"===t||"output"===t||t.indexOf("morph")>=0?(f.array=this.p(r,s.count,A,a+(s.byteOffset||0),c),f.array.buffer.byteLength===f.byteLength&&(f.byteOffset=0)):f.array=new Uint8Array(r,a,o.byteLength);else if(s.interleaved){f.byteStride=0,f.byteOffset=0;const t=new c(s.count*A);f.array=Nt(t,r,s.count,A,l,a+(s.byteOffset||0),s.componentType)}else f.byteStride=0,f.array=this.p(r,s.count,A,a+(s.byteOffset||0),c),f.byteOffset=f.array.byteOffset;else{f.array=new c(s.count);const t=f.min||f.max;t&&(f.array[0]=t[0],f.array[1]=t[1],f.array[2]=t[2])}return f}B(){const t=this.gltf.accessors;if(Array.isArray(t))for(let e=0;e<t.length;e++)for(let r=0;r<t.length;r++)e!==r&&t[e].bufferView===t[r].bufferView&&(t[e].interleaved=t[r].interleaved=!0);else for(const e in t)for(const r in t)e!==r&&t[e].bufferView===t[r].bufferView&&(t[e].interleaved=t[r].interleaved=!0)}p(t,e,r,n,i){return n%i.BYTES_PER_ELEMENT!=0&&(t=t.slice(n,n+e*r*i.BYTES_PER_ELEMENT),n=0),new i(t,n,r*e)}g(t){const e=xt.indexOf(t);return xt[e+1]}requestKHRTechniquesWebgl(t){const{shaders:e}=t,r=e.map((t=>{if(void 0!==t.bufferView){const e=this.gltf.bufferViews[t.bufferView],{byteLength:r}=e;return this.m(e).then((n=>{const{buffer:i,byteOffset:s}=n,o=Ot(i,s+(e.byteOffset||0),r);return t.content=o,t}))}if(t.uri){if(pt(t.uri)){const e=Rt(t.uri),r=Ot(e,0,e.byteLength);return t.content=r,Promise.resolve(t)}{const e=this.rootPath+"/"+t.uri;return Lt.get(e).then((e=>(t.content=e,t)))}}return Promise.resolve(t)}));return Promise.all(r).then((()=>t))}}class vt extends Ft{constructor(t,e,r,n,i,s){super(n,i,s),this.rootPath=t,this.gltf=e,this.requests={},this.buffers={},this.glbBuffer=r,this.accessor=new wt(t,e,r)}iterate(t,e){const r=this.gltf[e];if(!r)return;let n=0;for(const e in r)t(e,r[e],n++)}createNode(t){const e={};if(Tt(t.name)&&(e.name=t.name),Tt(t.children)&&(e.children=t.children),Tt(t.jointName)&&(e.jointName=t.jointName),Tt(t.matrix)&&(e.matrix=t.matrix),Tt(t.rotation)&&(e.rotation=t.rotation),Tt(t.scale)&&(e.scale=t.scale),Tt(t.translation)&&(e.translation=t.translation),Tt(t.extras)&&(e.extras=t.extras),Tt(t.meshes)&&(e.mesh=t.meshes[0]),e.translation||e.rotation||e.scale){const t=function(t,e){if(e.matrix)return e.matrix;if(e.translation||e.scale||e.rotation){const r=Y(yt,e.translation||St),n=W(It,e.rotation||Pt),i=Z(bt,e.scale||Mt);return J(i,n,i),J(t,r,i)}return z(t)}([],e);delete e.translation,delete e.rotation,delete e.scale,e.matrix=t}return e}R(t){const e={};for(const r in t){const n=t[r];let i,s;n.instanceTechnique&&n.instanceTechnique.values?(i=n.instanceTechnique,s=i.values.diffuse):(i=n,s=i.values.tex||i.values.diffuseTex||i.values.diffuse);const o={baseColorTexture:{index:s}};n.name&&(o.name=n.name),n.extensions&&(o.extensions=n.extensions),n.extras&&(o.extras=n.extras),e[r]=o}return e}I(t){if(t.bufferView||t.extensions&&(t.extensions.KHR_binary_glTF||t.extensions.binary_glTF)){const e=t.bufferView?t:t.extensions.KHR_binary_glTF||t.extensions.binary_glTF;t.extensions&&(t.mimeType=e.mimeType,t.width=e.width,t.height=e.height);const r=this.gltf.bufferViews[e.bufferView],n=(r.byteOffset||0)+this.glbBuffer.byteOffset,i=r.byteLength,s=this.buffers[e.bufferView]=new Uint8Array(this.glbBuffer.buffer,n,i);return this.getImageByBuffer(s,t)}return this.requestExternalImage(t)}S(t){const e=this.gltf.textures[t];if(!e)return null;const r=this.gltf.images[e.source];return this.I(r).then((t=>{const n=this.gltf.samplers[e.sampler];return{image:{array:t.data,width:t.width,height:t.height,index:e.source,mimeType:r.mimeType,name:r.name,extras:r.extras},sampler:n}}))}getBaseColorTexture(t){const e=this.gltf.materials[t];let r,n;if(e.instanceTechnique&&e.instanceTechnique.values?(r=e.instanceTechnique,n=r.values.diffuse):(r=e,n=r.values.tex||r.values.diffuseTex||r.values.diffuse),void 0===n||void 0===this.gltf.textures)return null;const i=this.gltf.textures[n];if(!i)return null;const s=this.gltf.samplers[i.sampler];return{format:i.format||6408,internalFormat:i.internalFormat||6408,type:i.type||5121,sampler:s,source:this.gltf.images[i.source]}}getMaterial(){return null}getAnimations(){return null}}class Ut extends Ft{constructor(t,e,r,n,i,s){super(n,i,s),this.rootPath=t,this.gltf=e,this.glbBuffer=r,this.buffers={},this.requests={},this.accessor=new wt(t,e,r)}iterate(t,e){const r=this.gltf[e];if(r)for(let e=0;e<r.length;e++)t(e,r[e],e)}createNode(t){const e={};return mt(e,t),!Tt(t.weights)&&this.gltf.meshes&&Tt(e.mesh)?e.weights=this.gltf.meshes[e.mesh].weights:t.weights&&(e.weights=t.weights),e}S(t){const e=this.gltf.textures[t];if(!e)return null;const r=this.gltf.images[e.source];return this.I(r).then((t=>{if(!t)return null;const n={image:{array:t.data,mipmap:t.mipmap,width:t.width,height:t.height,index:e.source,mimeType:r.mimeType,name:r.name,extensions:r.extensions,extras:r.extras}};mt(n,e);const i=Tt(e.sampler)?this.gltf.samplers[e.sampler]:void 0;return i&&(n.sampler=i),t.format&&(n.format=t.format),n}))}I(t){if(!Tt(t.bufferView))return this.requestExternalImage(t);{const e=this.gltf.bufferViews[t.bufferView],r=this.gltf.buffers[e.buffer];if(r.uri)return this.requestImageFromBufferURI(r,e,t);if(this.glbBuffer)return this.P(e,t)}return null}P(t,e){const r=this.h(t,this.glbBuffer.buffer,this.glbBuffer.byteOffset);return this.getImageByBuffer(r,e)}h(t,e,r){r=r||0;const n=t.byteOffset+r,i=t.byteLength;return new Uint8Array(e,n,i)}M(t,e){const r=new Array(t.byteLength);for(let e=0;e<t.byteLength;e++)r[e]=String.fromCharCode(t[e]);return r.join(""),"data:"+(e=e||"image/png")+";base64,"+function(t){return"undefined"!=typeof self?self.btoa(t):window.btoa(t)}(unescape(encodeURIComponent(r)))}getAnimations(t){const e=[];return t.forEach((t=>{e.push(this.getSamplers(t.samplers))})),Promise.all(e).then((e=>{for(let r=0;r<e.length;r++)t[r].samplers=e[r];return t}))}getSamplers(t){const e=[];for(let r=0;r<t.length;r++)(Tt(t[r].input)||Tt(t[r].output))&&(e.push(this.accessor.C("input",t[r].input)),e.push(this.accessor.C("output",t[r].output)));return Promise.all(e).then((e=>{for(let r=0;r<e.length/2;r++)t[r].input=e[2*r],t[r].output=e[2*r+1],t[r].interpolation||(t[r].interpolation="LINEAR");return t}))}}const Gt="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;class Ht{static read(t,e=0,r=0){r||(r=t.byteLength);const n=new DataView(t,e,r),i=n.getUint32(4,!0);if(1===i)return Ht.readV1(n,e);if(2===i)return Ht.readV2(t,e);throw new Error("Unsupported glb version : "+i)}static readV1(t,e){const r=t.getUint32(8,!0),n=t.getUint32(12,!0);if(r!==t.byteLength)throw new Error("Length in GLB header is inconsistent with glb's byte length.");const i=Vt(t.buffer,20+e,n);return{json:JSON.parse(i),glbBuffer:{byteOffset:20+e+n,buffer:t.buffer,byteLength:r}}}static readV2(t,e){let r,n,i;const s=new DataView(t,e+12);let o=0;for(;o<s.byteLength;){const a=s.getUint32(o,!0);o+=4;const A=s.getUint32(o,!0);if(o+=4,1313821514===A)r=Vt(t,e+12+o,a);else if(5130562===A){i=e+12+o,n=a;break}o+=a}return{json:JSON.parse(r),glbBuffer:{byteOffset:i,buffer:t,byteLength:n}}}}function Vt(t,e,r){if(Gt){const n=new Uint8Array(t,e,r);return Gt.decode(n)}return function(t){const e=t.length;let r="";for(let n=0;n<e;){let i=t[n++];if(128&i){let r=Kt[i>>3&7];if(!(64&i)||!r||n+r>e)return null;for(i&=63>>r;r>0;r-=1){const e=t[n++];if(128!=(192&e))return null;i=i<<6|63&e}}r+=String.fromCharCode(i)}return r}(new Uint8Array(t,e,r))}const Kt=[1,1,1,1,2,2,3,0],kt=[0,0,0],Xt=[0,0,0,1],zt=[1,1,1],Jt={TRANSLATION:[0,0,0],ROTATION:[0,0,0,1],SCALE:[1,1,1]},Yt={PREVIOUS:null,NEXT:null,PREINDEX:null,NEXTINDEX:null,INTERPOLATION:null},Zt={N(t,e,r,n,i,s,o,a){const A=Tt(t)?e.animations:[e.animations[0]],c={};for(let e=0;e<A.length;e++){const l=A[e],f=l.name||e;if(Tt(t)&&f!==t)continue;const h=l.channelsMap[r];if(h)for(let t=0;t<h.length;t++){const e=h[t];"translation"===e.target.path?(this.D(i,l.samplers[e.sampler],n,1),c.translation=$(kt,i)):"rotation"===e.target.path?(this.O(s,l.samplers[e.sampler],n,1),c.rotation=Bt(Xt,s)):"scale"===e.target.path?(this.D(o,l.samplers[e.sampler],n,1),c.scale=$(zt,o)):"weights"===e.target.path&&a&&(this.D(a,l.samplers[e.sampler],n,a.length),c.weights=a)}}return c},D(t,e,r,n){switch(e.interpolation){case"LINEAR":{const i=this.L(Yt,e,r,1*n);i&&(t=function(t,e,r,n){for(let i=0;i<t.length;i++)t[i]=e[i]+n*(r[i]-e[i]);return t}(t,i.PREVIOUS,i.NEXT,i.INTERPOLATION));break}case"STEP":{const i=this.L(Yt,e,r,1*n);i&&(t=function(t,e){for(let r=0;r<t.length;r++)t[r]=e[r];return t}(t,...i.PREVIOUS));break}case"CUBICSPLINE":{const i=this.L(Yt,e,r,3*n);i&&(t=this.F(t,i,e.input.array,3*n));break}}return t},O(t,e,r){switch(e.interpolation){case"LINEAR":{const n=this.L(Yt,e,r,1);n&&Et(t,n.PREVIOUS,n.NEXT,n.INTERPOLATION);break}case"STEP":{const n=this.L(Yt,e,r,1);n&&(t=ft(t,...n.PREVIOUS));break}case"CUBICSPLINE":{const n=this.L(Yt,e,r,3);if(n){for(let t=0;t<n.PREVIOUS.length;t++)n.PREVIOUS[t]=Math.acos(n.PREVIOUS[t]),n.NEXT[t]=Math.acos(n.NEXT[t]);t=this.F(t,n,e.input.array,3);for(let e=0;e<t.length;e++)t[e]=Math.cos(t[e])}break}}return t},v(t,e){const r=t.length;let n,i,s,o=0,a=r-1,A=Math.floor((o+a)/2);for(;o<=r-1&&a>=0;){if(o===a)return null;if(t[A]<=e&&e<=t[A+1]){const r=t[A];return n=A,i=A+1,s=(e-r)/(t[A+1]-r),{preIndx:n,nextIndex:i,interpolation:s}}e<t[A]?(a=A,A=Math.floor((o+a)/2)):t[A+1]<e&&(o=A,A=Math.floor((o+a)/2))}return null},L(t,e,r,n){const i=e.input.array,s=e.output.array,o=e.output.itemSize;(r<i[0]||r>i[i.length-1])&&(r=Math.max(i[0],Math.min(i[i.length-1],r))),r===i[i.length-1]&&(r=i[0]);const a=this.v(i,r);if(!a||!a.nextIndex)return null;const{preIndx:A,nextIndex:c,interpolation:l}=a;t.PREINDEX=A,t.NEXTINDEX=c,t.INTERPOLATION=l;const f=o*n;return t.PREVIOUS=s.subarray(t.PREINDEX*f,(t.PREINDEX+1)*f),t.NEXT=s.subarray(t.NEXTINDEX*f,(t.NEXTINDEX+1)*f),t},F(t,e,r,n){const i=e.INTERPOLATION,s=r[e.PREINDEX],o=r[e.NEXTINDEX];for(let r=0;r<3;r++){const a=e.PREVIOUS[n+r],A=(o-s)*e.PREVIOUS[2*n+r],c=e.NEXT[3+r],l=(o-s)*e.NEXT[r],f=(2*Math.pow(i,3)-3*Math.pow(i,2)+1)*a+(Math.pow(i,3)-2*Math.pow(i,2)+i)*A+(2*-Math.pow(i,3)+3*Math.pow(i,2))*c+(Math.pow(i,3)-Math.pow(i,2))*l;t[r]=f}return t},getAnimationClip(t,e,r,n){const i=t.nodes[e]&&t.nodes[e].weights;return tt(kt,...Jt.TRANSLATION),ft(Xt,...Jt.ROTATION),tt(zt,...Jt.SCALE),this.N(n,t,e,r,kt,Xt,zt,i)},getTimeSpan(t){if(!t.animations)return null;if(t.timeSpan)return t.timeSpan;const e=t.animations;return t.timeSpan={},e.forEach(((e,r)=>{let n=-1/0,i=1/0;const s=e.channels;for(let t=0;t<s.length;t++){const r=s[t],o=e.samplers[r.sampler].input.array;o[o.length-1]>n&&(n=o[o.length-1]),o[0]<i&&(i=o[0])}const o=e.name||r;t.timeSpan[o]={max:n,min:i}})),t.timeSpan},getTimeSpanByName(t,e){const r=this.getTimeSpan(t);return r?Tt(e)?r[e]:r[Object.keys(r)[0]]:null}};let Wt=!1;if("undefined"!=typeof OffscreenCanvas){let t;try{t=new OffscreenCanvas(2,2).getContext("2d")}catch(on){}t&&"undefined"!=typeof createImageBitmap&&(Wt=!0)}const jt="undefined"==typeof document?null:document.createElement("canvas");class Qt{constructor(t,e,r){if(this.options=r||{},this.options.decoders||(this.options.decoders={}),e.buffer instanceof ArrayBuffer){const{json:r,glbBuffer:n}=Ht.read(e.buffer,e.byteOffset,e.byteLength);this.U(t,r,n)}else this.U(t,e);this.G=new wt(this.rootPath,this.gltf,this.glbBuffer),this.H()}H(){const t=this.gltf.extensionsRequired;if(t){if(t.indexOf("KHR_draco_mesh_compression")>=0&&!this.options.decoders.draco)throw new Error("KHR_draco_mesh_compression is required but @maptalks/transcoders.draco is not loaded");if(t.indexOf("KHR_texture_basisu")>=0&&!this.options.decoders.ktx2)throw new Error("KHR_texture_basisu is required but @maptalks/transcoders.ktx2 is not loaded")}}V(){const t=this.gltf.extensions;return t&&t.KHR_techniques_webgl?this.G.requestKHRTechniquesWebgl(t.KHR_techniques_webgl).then((e=>(t.KHR_techniques_webgl=e,t))):Promise.resolve(t)}load(t){t=t||{};const e=this.K(t),r=this.k(),n=this.X(),i=this.V();return Promise.all([e,r,n,i]).then((t=>(t[0].animations=t[1],t[0].textures=t[2],t[0].extensions=t[3],t[0].transferables=this.transferables||[],this.createChannelsMap(t[0]),t[0])))}createChannelsMap(t){const e=t.animations;if(e)for(let t=0;t<e.length;t++){const r=e[t];r.channelsMap={};for(let t=0;t<r.channels.length;t++){const e=r.channels[t];r.channelsMap[e.target.node]||(r.channelsMap[e.target.node]=[]),r.channelsMap[e.target.node].push(e)}}}getExternalResources(){const t=[];if(this.gltf){const{buffers:e,images:r}=this.gltf;for(let r=0;r<e.length;r++)e[r].uri&&e[r].uri.indexOf("data:application/octet-stream;base64")<0&&t.push({type:"buffer",uri:e[r].uri});for(let e=0;e<r.length;e++)r[e].uri&&r[e].uri.indexOf("data:image/")<0&&t.push({type:"image",uri:r[e].uri})}return t}static getAnimationClip(t,e,r,n){return Zt.getAnimationClip(t,e,r,n)}static getAnimationTimeSpan(t,e){return Zt.getTimeSpanByName(t,e)}static getTypedArrayCtor(t){return gt(t)}static readInterleavedArray(t,e,r,n,i,s,o){return Nt(t,e,r,n,i,s,o)}U(t,e,r){this.gltf=e,this.glbBuffer=r,this.version=e.asset?+e.asset.version:1,this.rootPath=t,this.buffers={},this.requests={},this.options.requestImage=Wt?ee.bind(this):this.options.requestImage||qt,this.options.transferable&&(this.transferables=[]),2===this.version?(this.adapter=new Ut(t,e,r,this.options.requestImage,this.options.decoders||{},this.options.supportedFormats||{}),this.adapter.iterate(((t,e,r)=>{e.id="buffer_"+r}),"buffers"),this.adapter.iterate(((t,e,r)=>{e.id="image_"+r}),"images"),this.adapter.iterate(((t,e,r)=>{e.id="accessor_"+r}),"accessors")):(this.adapter=new vt(t,e,r,this.options.requestImage,this.options.decoders||{},this.options.supportedFormats||{}),this.adapter.iterate(((t,e,r)=>{e.id="accessor_"+r}),"accessors"),this.adapter.iterate(((t,e,r)=>{e.id="image_"+r}),"images"))}J(t,e){if(t.children&&t.children.length>0){if(!("number"==typeof(r=t.children[0])&&isFinite(r)||function(t){return!Ct(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}(t.children[0])))return t;const n=t.children.map((t=>{const r=e[t];return r.nodeIndex=t,this.J(r,e)}));t.children=n}var r;return t}K(t){return this.Y(t).then((t=>{const e=this.scenes=[];let r;for(const e in t)t[e]=this.J(t[e],t),t[e].nodeIndex=Number(e)?Number(e):e;this.adapter.iterate(((n,i,s)=>{const o={};i.name&&(o.name=i.name),i.nodes&&(o.nodes=i.nodes.map((e=>t[e]))),this.gltf.scene===n&&(r=s),e.push(o)}),"scenes");const n={asset:this.gltf.asset,scene:r,scenes:e,nodes:t,meshes:this.meshes,materials:this.gltf.materials,skins:this.skins};if(this.gltf.extensions&&(n.extensions=this.gltf.extensions),1===this.version){const t=this.adapter.R(this.gltf.materials);n.materials=t}return n}))}Y(t){return this.Z(t).then((()=>{const t=this.nodes={};return this.adapter.iterate(((e,r)=>{const n=this.adapter.createNode(r,this.meshes,this.skins);t[e]=n}),"nodes"),t}))}W(){this.skins=[];const t=[];return this.adapter.iterate(((e,r,n)=>{t.push(this.j(r).then((t=>{t.index=n,this.skins.push(t)})))}),"skins"),t}j(t){const e=t.inverseBindMatrices;return this.adapter.accessor.C("inverseBindMatrices",e).then((e=>(t.inverseBindMatrices=e,e&&e.buffer&&this.transferables&&this.transferables.indexOf(e.buffer)<0&&this.transferables.push(e.buffer),t)))}k(){const t=this.gltf.animations;return Tt(t)?this.adapter.getAnimations(t):null}Z(t){this.meshes={};let e=[];return this.adapter.iterate(((r,n,i)=>{e.push(this.q(n,t).then((t=>{t.index=i,this.meshes[r]=t})))}),"meshes"),e=e.concat(this.W()),Promise.all(e)}q(t,e){const r=t.primitives.map((t=>this.$(t,e))).filter((t=>!!t));return Promise.all(r).then((e=>{const r={};return mt(r,t),r.primitives=e,r}))}X(){const t=this.gltf.textures;if(!t)return null;const e=[];for(const r in t)e.push(this.adapter.S(r));return Promise.all(e).then((e=>{if(this.transferables)for(let t=0;t<e.length;t++){const r=e[t].image.array;if(e[t]&&r){let t;t=r instanceof ImageBitmap?r:r.buffer,t&&this.transferables.indexOf(t)<0&&this.transferables.push(t)}}if(!Array.isArray(t)){const r={},n=Object.keys(t);for(let t=0;t<e.length;t++)e[t]&&(r[n[t]]=e[t]);return r}return e}))}$(t,e){let r;const n=[],i=t.extensions;if(Tt(t.targets))for(let e=0;e<t.targets.length;e++){const r=t.targets[e];for(const t in r){const i=this.adapter.accessor.C(`morphTargets_${t}_${e}`,r[t]);i&&n.push(i)}}if(i&&i.KHR_draco_mesh_compression){if(!this.options.decoders.draco&&(!this.gltf.extensionsRequired||!this.gltf.extensionsRequired.indexOf("KHR_draco_mesh_compression")<0))return null;const t=this.options.decoders.draco,{bufferView:s,attributes:o}=i.KHR_draco_mesh_compression,a=this.gltf.bufferViews[s],A=this.G.m(a).then((r=>{const{buffer:n,byteOffset:i}=r;let{byteOffset:s,byteLength:A}=a;s||(s=0);const c=new DataView(n,i+s,A),l={attributes:o,useUniqueIDs:!1,skipAttributeTransform:e.skipAttributeTransform};return t(c,l).then((t=>{const e=Object.values(t.attributes);return t.indices&&e.push(t.indices),e}))}));n.push(A),r=Promise.all(n)}else{const e=t.attributes;for(const t in e){const r=this.adapter.accessor.C(t,e[t]);r&&n.push(r)}if(Tt(t.indices)){const e=this.adapter.accessor.C("indices",t.indices);e&&n.push(e)}r=Promise.all(n)}return r.then((e=>{if(i&&i.KHR_draco_mesh_compression){const r=t.targets?t.targets.length:0;e[r]=e[r].concat(e.slice(0,r)),e=e[r]}let r,n;const s={attributes:e.reduce(((t,e)=>{if("indices"===e.name)r=e;else if(e.name.indexOf("morphTargets_")>-1)n=n||{},n[e.name.slice(13)]=e;else{if(!("POSITION"!==e.name||e.min&&e.max)){const t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0],{itemSize:n,array:i}=e,s=i.length/n;for(let e=0;e<s;e++)for(let s=0;s<n;s++){const o=e*n+s;i[o]<t[s]&&(t[s]=i[o]),i[o]>r[s]&&(r[s]=i[o])}if(e.quantization){const n=e.quantization,i=n.range/(1<<n.quantizationBits),s=n.minValues;it(t,t,i),et(t,t,s),it(r,r,i),et(r,r,s)}e.min=t,e.max=r}t[e.name]=e}return this.transferables&&e.array.buffer&&this.transferables.indexOf(e.array.buffer)<0&&this.transferables.push(e.array.buffer),t}),{}),material:t.material};return r&&(s.indices=r),n&&(s.morphTargets=n),s.mode=Tt(t.mode)?t.mode:4,Tt(t.extras)&&(s.extras=t.extras),s}))}}function qt(t,e){const r=new Image;r.crossOrigin="",r.onload=()=>{if(!jt)return void e(new Error("There is no canvas to draw image!"));jt.width=r.width,jt.height=r.height;const t=jt.getContext("2d",{willReadFrequently:!0});t.drawImage(r,0,0,r.width,r.height);const n=t.getImageData(0,0,r.width,r.height),i={width:r.width,height:r.height,data:new Uint8Array(n.data)};e(null,i)},r.onerror=function(t){e(t)},r.src=t}let $t,te;function ee(t,e){$t||($t=new OffscreenCanvas(2,2),te=$t.getContext("2d",{willReadFrequently:!0})),fetch(t).then((t=>t.arrayBuffer())).then((t=>{const e=new Blob([new Uint8Array(t)]);return createImageBitmap(e)})).then((t=>{let{width:r,height:n}=t;re(r)||(r=ne(r)),re(n)||(n=ne(n));const i=this.options.maxTextureSize;i&&(r=Math.min(i,r),n=Math.min(i,n)),$t.width=r,$t.height=n,te.drawImage(t,0,0,r,n),t.close();const s=te.getImageData(0,0,r,n);e(null,{width:r,height:n,data:new Uint8Array(s.data)})})).catch((t=>{console.warn(t),e(t)}))}function re(t){return 0==(t&t-1)&&0!==t}function ne(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}const ie="undefined"==typeof document?null:document.createElement("canvas");class se extends i.worker.Actor{constructor(t,e){super(t),this.mapId=e}initialize(t){t(null)}loadTile(t,e,r){let n=null;e&&e.arraybuffer&&(n=[e.arraybuffer]);const i={mapId:this.mapId,layerId:t,command:"loadTile",params:e};this.send(i,n,r)}abortTileLoading(t,e,r){const n={mapId:this.mapId,layerId:t,command:"abortTileLoading",params:{url:e}};this.broadcast(n,null,r)}addLayer(t,e,r){const n={actorId:this.actorId,mapId:this.mapId,layerId:t,command:"addLayer",params:{options:e}};this.broadcast(n,null,r)}removeLayer(t,e){const r={mapId:this.mapId,layerId:t,command:"removeLayer"};this.broadcast(r,null,e)}requestImage({url:t},e){const r=new Image;r.onload=()=>{if(!this.isActive())return;if(!ie)return void e(new Error("There is no canvas to draw image!"));const t=function(t){if(oe(t.width)&&oe(t.height))return t;let e=t.width,r=t.height;oe(e)||(e=ae(e));oe(r)||(r=ae(r));const n=document.createElement("canvas");n.width=e,n.height=r,n.getContext("2d").drawImage(t,0,0,e,r);const i=t.src,s=i.lastIndexOf("/")+1,o=i.substring(s);return console.warn(`Texture(${o})'s size is not power of two, resize from (${t.width}, ${t.height}) to (${e}, ${r})`),n}(r);ie.width=t.width,ie.height=t.height;const n=ie.getContext("2d",{willReadFrequently:!0});n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),s={width:t.width,height:t.height,data:new Uint8Array(i.data)};e(null,s,[s.data.buffer])},r.onerror=function(t){e(t)},r.src=t}}function oe(t){return 0==(t&t-1)&&0!==t}function ae(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}class Ae{constructor(t,e){this.max=t,this.currentSize=0,this.onRemove=e,this.reset()}reset(){if(this.data){const t=this.data.values();for(const e of t)this.onRemove(e)}return this.data=new Map,this.currentSize=0,this}clear(){this.reset(),delete this.onRemove}add(t,e){if(!e)return this;if(e.node&&e.node.memorySize&&(this.currentSize+=e.node.memorySize),this.has(t)){const r=this.data.get(t);r&&r.node&&r.node.memorySize&&(this.currentSize-=r.node.memorySize),this.data.delete(t),this.data.set(t,e)}else this.data.set(t,e);return this}shrink(){if(this.currentSize>this.max){const t=this.data.keys();let e=t.next();for(;this.currentSize>this.max&&void 0!==e.value;){if(!this.data.get(e.value).current){const t=this.getAndRemove(e.value);t&&this.onRemove(t)}e=t.next()}}}has(t){return this.data.has(t)}keys(){const t=new Array(this.data.size);let e=0;const r=this.data.keys();for(let n of r)t[e++]=n;return t}getAndRemove(t){if(!this.has(t))return null;const e=this.data.get(t);return e.node&&e.node.memorySize&&(this.currentSize-=e.node.memorySize),this.data.delete(t),e}get(t){if(!this.has(t))return null;const e=this.data.get(t);return this.data.delete(t),this.data.set(t,e),e}remove(t){if(!this.has(t))return this;const e=this.data.get(t);return e.node&&e.node.memorySize&&(this.currentSize-=e.node.memorySize),this.data.delete(t),this.onRemove(e),this}setMaxSize(t){return this.max=t,this.shrink(),this}getMemorySize(){let t=0;const e=this.data.values();for(const r of e){const e=r&&r.node;e&&e.memorySize&&(t+=e.memorySize)}return t}markAll(t){const e=this.data.values();for(const r of e)r.current=t}}function ce(t,e){if(t.scenes&&t.scenes.length)for(let r=0,n=t.scenes.length;r<n;r++){const n=t.scenes[r].nodes;for(let r=0,i=n.length;r<i;r++){const i=[];Be(n[r],i,t,e)}}}const le=[],fe=[],he=[],ue=[0,0,0],Ee=ut([]),_e=[1,1,1];function Be(t,e,r,n){const i=e.slice(0);if(t.matrix)i.push(t.matrix);else if(t.rotation||t.translation||t.scale){const e=Y(le,t.translation||ue),r=W(fe,t.rotation||Ee),n=Z(he,t.scale||_e);J(n,r,n);const s=J([],e,n);i.push(s)}if(t.children&&t.children.length)for(let e=0,s=t.children.length;e<s;e++)Be(t.children[e],i,r,n);if(void 0!==t.mesh){const e=t.mesh,s=r.meshes[e];if(s){const t=i.slice(0),o=s.primitives;for(let i=0,s=o.length;i<s;i++){const s=o[i];s&&(s.matrices=t,n(s,e,i,r))}}}}function de(t,e,r){let{componentType:n,byteOffset:i,byteStride:s,itemSize:o}=e;const a=e.array.buffer,A=n?Qt.getTypedArrayCtor(n):e.array.constructor;if(i=void 0===i?e.array.byteOffset:i,s=s||0,!s||s===o*A.BYTES_PER_ELEMENT&&i%A.BYTES_PER_ELEMENT==0){const e=new A(a,i+r*o*A.BYTES_PER_ELEMENT,o);return t.set(e),t}s||(s=o*A.BYTES_PER_ELEMENT);const c=new Uint8Array(a,s*r+i,o*A.BYTES_PER_ELEMENT);return new Uint8Array(t.buffer).set(c),t}function Ce(t,e,r,n){t[4*e]=r[n],t[4*e+1]=r[n+4],t[4*e+2]=r[n+8],t[4*e+3]=r[n+12]}const Te=new Array(3),me=new Array(3),ge=[40680631590769,40680631590769,40408299984661.445];function pe(t,e,r,n){const i=ge,s=Math.cos(r);Te[0]=s*Math.cos(e),Te[1]=s*Math.sin(e),Te[2]=Math.sin(r),Le(Te,Te),nt(me,i,Te);const o=Math.sqrt(ot(Te,me));var a,A,c;return A=me,c=o,(a=me)[0]=A[0]/c,a[1]=A[1]/c,a[2]=A[2]/c,it(Te,Te,n),et(t,me,Te)}const Re=[1/6378137,1/6378137,1/6356752.314245179],ye=[1/40680631590769,1/40680631590769,1/40408299984661.445],Ie=new Array(3),be=new Array(3),Se=new Array(3);function Pe(t,e){const r=ye,n=function(t,e,r,n,i){const s=e[0],o=e[1],a=e[2],A=r[0],c=r[1],l=r[2],f=s*s*A*A,h=o*o*c*c,u=a*a*l*l,E=f+h+u,_=Math.sqrt(1/E),B=it(Me,e,_);if(E<i)return isFinite(_)?B:void 0;const d=n[0],C=n[1],T=n[2],m=Ne;m[0]=B[0]*d*2,m[1]=B[1]*C*2,m[2]=B[2]*T*2;let g,p,R,y,I,b,S,P,M,N,D,O=(1-_)*Oe(e)/(.5*Oe(m)),L=0;do{O-=L,R=1/(1+O*d),y=1/(1+O*C),I=1/(1+O*T),b=R*R,S=y*y,P=I*I,M=b*R,N=S*y,D=P*I,g=f*b+h*S+u*P-1,p=f*M*d+h*N*C+u*D*T;L=g/(-2*p)}while(Math.abs(g)>De);return t[0]=s*R,t[1]=o*y,t[2]=a*I,t}(Ie,e,Re,r,.1);let i=ct(be,n,r);i=Le(i,i);const s=At(Se,e,n),o=Math.atan2(i[1],i[0]),a=Math.asin(i[2]),A=L(ot(s,e))*Oe(s);return t[0]=D(o),t[1]=D(a),t[2]=A,t}const Me=new Array(3),Ne=new Array(3),De=1e-12;function Oe(t){return Q(t)}function Le(t,e){const r=e[0],n=e[1],i=e[2];let s=r*r+n*n+i*i;return s>0&&(s=Math.sqrt(s),t[0]=e[0]/s,t[1]=e[1]/s,t[2]=e[2]/s),t}function Fe(t,e){return nt(e,t,ye),st(e,e)}function xe(t,e){var r=t[0],n=t[1],i=Math.cos(n),s=i*Math.cos(r),o=i*Math.sin(r),a=Math.sin(n);return e.x=s,e.y=o,e.z=a,st(e,e)}var we=Object.freeze({__proto__:null,radianToCartesian3:pe,cartesian3ToDegree:Pe,normalizeCartesian:Le,geodeticSurfaceNormal:Fe,geodeticSurfaceNormalCartographic:xe});const ve=1e-14,Ue=1e-15;function Ge(t,e,r,n){r=r||0,n=n||r;var i=Math.abs(t-e);return i<=n||i<=r*Math.max(Math.abs(t),Math.abs(e))}function He(t,e){let r="";for(let n=0;n<4;n++){const i=t.getUint8(e+n);r+=String.fromCharCode(i)}return r}const Ve="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;function Ke(t,e,r){const n=new Uint8Array(t,e,r);return Ve?JSON.parse(Ve.decode(n)):JSON.parse(x(n))}function ke(t,e,r){const n=new Uint8Array(t,e,r);return Ve?JSON.parse(Ve.decode(n)):JSON.parse(x(n))}function Xe(t,e,r){return{offset:e,byteLength:r}}function ze(t,e,r,n){const{byteOffset:i,componentType:s,type:o}=t,{ctor:a,type:A}=Qe(s||"UNSIGNED_SHORT"),c=We(o);return{byteStride:0,byteOffset:i+r,itemSize:c,count:n*c,componentType:A,array:new a(e,r+i,n*c)}}function Je(t,e,r,n){const i=ze(t,e,r,n);return i.array.buffer.byteLength!==e.byteLength&&(i.array=i.array.slice()),i}function Ye(t,e,r,n){const{byteOffset:i,componentType:s,type:o}=t,{ctor:a}=Qe(s||"UNSIGNED_SHORT"),A=We(o),c=new a(e,i,r*A);return 1===A?c[n]:c.subarray(n*A,n*A+A)}const Ze={"SCALAR":1,"VEC2":2,"VEC3":3,"VEC4":4};function We(t){return t?Ze[t]:1}const je={"BYTE":{ctor:Int8Array,type:5120,name:"Int8Array"},"UNSIGNED_BYTE":{ctor:Uint8Array,type:5121,name:"Uint8Array"},"SHORT":{ctor:Int16Array,type:5122,name:"Int16Array"},"UNSIGNED_SHORT":{ctor:Uint16Array,type:5123,name:"Uint16Array"},"INT":{ctor:Int32Array,type:5124,name:"Int32Array"},"UNSIGNED_INT":{ctor:Uint32Array,type:5125,name:"Uint32Array"},"FLOAT":{ctor:Float32Array,type:5126,name:"Float32Array"},"DOUBLE":{ctor:Float64Array,type:5126,name:"Float64Array"}};function Qe(t){return je[t]}function qe(t){for(let e in je)if(t===je[e].ctor)return je[e].type;throw new Error("unrecognized ctor:"+t)}function $e(t,e,r,n){const i=t,s=e.length/3;for(let t=0;t<s;t++)i[3*t]=e[3*t]/65535*n[0]+r[0],i[3*t+1]=e[3*t+1]/65535*n[1]+r[1],i[3*t+2]=e[3*t+2]/65535*n[2]+r[2];return i}function tr(t,e,r){let n=t.getUint32(12,!0),i=t.getUint32(16,!0),s=t.getUint32(20,!0),o=t.getUint32(24,!0);const a=t.buffer;let A,c,l={},f={};n>0&&(l=Ke(a,e,n),e+=n),i>0&&(A=function(t,e,r){return{offset:e,byteLength:r}}(0,e,i),e+=i),s>0&&(f=ke(a,e,s),e+=s);const h=Xe(0,e,o);return c=a.slice(h.offset,h.offset+h.byteLength),r.push(c),{featureTable:l,featureTableBin:A,batchTable:f,batchTableBin:c}}var er={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},rr={},nr={east:[],north:[],up:[],west:[],south:[],down:[]},ir=[],sr=[],or=[];const ar=[0,0,0];function Ar(t,e,r){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=t[15],r}const cr=(ur={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}}[lr="east"][fr="north"],rr[Er=lr+fr]?hr=rr[Er]:(hr=function(t,e,r){if(function(t,e){var r=t[0],n=t[1],i=t[2],s=e[0],o=e[1],a=e[2];return Math.abs(r-s)<=k*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-o)<=k*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=k*Math.max(1,Math.abs(i),Math.abs(a))}(t,ar))$(ir,er[lr]),$(sr,er[fr]),$(or,er[ur]);else if(Ge(t[0],0,ve)&&Ge(t[1],0,ve)){var n=L(t[2]);$(ir,er[lr]),"east"!==lr&&"west"!==lr&&it(ir,ir,n),$(sr,er[fr]),"east"!==fr&&"west"!==fr&&it(sr,sr,n),$(or,er[ur]),"east"!==ur&&"west"!==ur&&it(or,or,n)}else{Fe(t,nr.up);var i=nr.up,s=nr.east;s[0]=-t[1],s[1]=t[0],s[2]=0,st(nr.east,s),at(nr.north,i,s),it(nr.down,nr.up,-1),it(nr.west,nr.east,-1),it(nr.south,nr.north,-1),ir=nr[lr],sr=nr[fr],or=nr[ur]}return r[0]=ir[0],r[1]=ir[1],r[2]=ir[2],r[3]=0,r[4]=sr[0],r[5]=sr[1],r[6]=sr[2],r[7]=0,r[8]=or[0],r[9]=or[1],r[10]=or[2],r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r},rr[Er]=hr),hr);var lr,fr,hr,ur,Er;const _r=[],Br=[],dr=[],Cr=[],Tr=[],mr=[],gr=[],pr={x:0,y:0},Rr={x:0,y:0},yr=Math.PI/180;const Ir={"programs":[{"attributes":["aPosition","instanceId","batchId","aTexCoord0","aTexCoord1","aNormal","aColor","uv2","uv3","uv4","secondary_colour","uv6"],"fragmentShader":1,"vertexShader":0}],"shaders":[{"type":35633,"content":"precision highp float;\n\n#include <gl2_vert>\n\n attribute vec4 aPosition;\n\n#ifdef VertexColor\n\n attribute vec4 aColor0;\n\n#endif\n\n#ifdef VertexNormal\n\n attribute vec3 aNormal;\n\n#endif\n\n#ifdef Instance\n\n attribute float instanceId;\n\n#else\n\n attribute float batchId;\n\n#endif \n\n\n\n#ifdef HAS_VertexWeight\n\n attribute float aVertexWeight;\n\n#endif\n\n\n\n#ifdef HAS_TextureCoordMatrix\n\n attribute vec2 aTextureCoordMatrix;\n\n#endif\n\n\n\n#ifdef TexCoord\n\n attribute vec4 aTexCoord;\n\n varying vec4 vTexCoord;\n\n uniform mat4 uTexMatrix;\n\n#ifdef COMPUTE_TEXCOORD\n\n uniform float uTexture0Width;\n\n varying vec4 vTexMatrix;\n\n varying vec4 vTexCoordTransform;\n\n varying vec2 vIsRGBA;\n\n#endif\n\n#endif\n\n\n\n#ifdef TexCoord2\n\n attribute vec4 aTexCoord1;\n\n uniform float uTexture1Width;\n\n varying vec4 vTexMatrix2;\n\n#endif\n\n#ifdef InstanceBim\n\n attribute vec4 uv2;\n\n attribute vec4 uv3;\n\n attribute vec4 uv4;\n\n attribute vec4 secondary_colour;\n\n attribute vec4 uv6; \n\n#endif\n\n\n\n#ifdef InstancePipe\n\n attribute vec4 uv1;\n\n attribute vec4 uv2;\n\n attribute vec4 uv3;\n\n attribute vec4 uv4;\n\n attribute vec4 uv5;\n\n attribute vec4 uv6;\n\n attribute vec4 uv7;\n\n attribute vec4 secondary_colour;\n\n attribute vec4 uv9;\n\n#endif\n\n uniform vec4 uFillForeColor;\n\n uniform vec4 uSelectedColor;\n\n varying vec4 vPositionMC;\n\n varying vec3 vPositionEC;\n\n#ifdef VertexNormal\n\n varying vec3 vNormalEC;\n\n#endif\n\n varying vec4 vColor;\n\n const float SHIFT_LEFT8 = 256.0;\n\n const float SHIFT_RIGHT8 = 1.0 / 256.0;\n\n const float SHIFT_RIGHT4 = 1.0 / 16.0;\n\n const float SHIFT_LEFT4 = 16.0;\n\n void getTextureMatrixFromZValue(in float nZ, inout float XTran, inout float YTran, inout float scale, inout float isRGBA)\n\n {\n\n if(nZ <= 0.0)\n\n {\n\n return;\n\n }\n\n float nDel8 = floor(nZ * SHIFT_RIGHT8);\n\n float nDel16 = floor(nDel8 * SHIFT_RIGHT8);\n\n float nDel20 = floor(nDel16 * SHIFT_RIGHT4);\n\n isRGBA = floor(nDel20);\n\n YTran = nZ - nDel8 * SHIFT_LEFT8;\n\n XTran = nDel8 - nDel16 * SHIFT_LEFT8;\n\n float nLevel = nDel16 - nDel20 * SHIFT_LEFT4;\n\n scale = 1.0 / pow(2.0, nLevel);\n\n }\n\n \n\n void operation(vec4 operationType, vec4 color, vec4 selectedColor, inout vec4 vertexColor)\n\n {\n\n float right_2 = operationType.x * 0.5;\n\n float right_4 = right_2 * 0.5;\n\n float right_8 = right_4 * 0.5;\n\n float right_16 = right_8 * 0.5;\n\n float isSetColor = fract(right_2);\n\n if(isSetColor > 0.1)\n\n {\n\n vertexColor *= color;\n\n }\n\n float isPicked = fract(floor(right_2)* 0.5);\n\n if(isPicked > 0.1)\n\n {\n\n vertexColor *= selectedColor;\n\n }\n\n float isHide = fract(floor(right_4)* 0.5);\n\n if(isHide > 0.1)\n\n {\n\n vertexColor.a = 0.0;\n\n }\n\n }\n\n \n\n#ifdef COMPRESS_TEXCOORD\n\n#ifdef TexCoord\n\n uniform vec2 decode_texCoord0_min;\n\n#endif\n\n#ifdef TexCoord2\n\n uniform vec2 decode_texCoord1_min;\n\n#endif\n\n#ifdef MeshOPT_Compress\n\n uniform vec3 decode_texCoord0_vNormConstant;\n\n uniform vec3 decode_texCoord1_vNormConstant;\n\n#else\n\n uniform float decode_texCoord0_normConstant;\n\n uniform float decode_texCoord1_normConstant;\n\n#endif\n\n#endif\n\n\n\n#ifdef COMPRESS_VERTEX\n\n uniform vec4 decode_position_min;\n\n uniform float decode_position_normConstant;\n\n#endif\n\n\n\n#ifdef COMPRESS_NORMAL\n\n uniform float normal_rangeConstant;\n\n#endif\n\n\n\nuniform mat4 modelMatrix;\n\nuniform mat4 modelViewMatrix;\n\nuniform mat4 projMatrix;\n\nuniform mat3 modelNormalMatrix;\n\n\n\n\n\n\n\nfloat czm_signNotZero(float value) {\n\n return value >= 0.0 ? 1.0 : -1.0;\n\n}\n\nvec2 czm_signNotZero(vec2 value) {\n\n return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\n\n}\n\n\n\nvec3 czm_octDecode(vec2 encoded, float range) {\n\n if (encoded.x == 0.0 && encoded.y == 0.0) {\n\n return vec3(0.0, 0.0, 0.0);\n\n }\n\n encoded = encoded / range * 2.0 - 1.0;\n\n vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\n\n if (v.z < 0.0) {\n\n v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);\n\n }\n\n return normalize(v);\n\n}\n\n\n\nvec4 czm_updatePositionDepth(vec4 coords) {\n\n coords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;\n\n return coords;\n\n}\n\n\n\nvoid main()\n\n{\n\n#ifdef COMPRESS_VERTEX\n\n vec4 vertexPos = vec4(1.0);\n\n vertexPos = vec4(aPosition.xyz, 1.0);\n\n#else\n\n vec4 vertexPos = aPosition;\n\n#endif\n\n#ifdef TexCoord\n\n\n\n#ifdef COMPRESS_TEXCOORD\n\n#ifdef MeshOPT_Compress\n\n vec2 texCoord0;\n\n texCoord0.x = aTexCoord.x * decode_texCoord0_vNormConstant.x;\n\n texCoord0.y = aTexCoord.y * decode_texCoord0_vNormConstant.y;\n\n vTexCoord.xy = decode_texCoord0_min + texCoord0.xy;\n\n#else\n\n vTexCoord.xy = decode_texCoord0_min.xy + aTexCoord.xy * decode_texCoord0_normConstant;\n\n#endif\n\n#else\n\n vTexCoord.xy = aTexCoord.xy;\n\n#endif\n\n\n\n#ifdef COMPUTE_TEXCOORD\n\n vTexMatrix = vec4(0.0,0.0,1.0,0.0);\n\n vIsRGBA.x = 0.0;\n\n vTexCoordTransform.x = aTexCoord.z;\n\n #ifdef HAS_TextureCoordMatrix\n\n vTexCoordTransform.x = aTextureCoordMatrix.x;\n\n #endif\n\n if(vTexCoordTransform.x < -90000.0)\n\n {\n\n vTexMatrix.z = -1.0;\n\n }\n\n getTextureMatrixFromZValue(floor(vTexCoordTransform.x), vTexMatrix.x, vTexMatrix.y, vTexMatrix.z, vIsRGBA.x);\n\n vTexMatrix.w = log2(uTexture0Width * vTexMatrix.z);\n\n#endif\n\n#endif\n\n\n\n#ifdef TexCoord2\n\n\n\n #ifdef COMPRESS_TEXCOORD\n\n #ifdef MeshOPT_Compress\n\n vec2 texCoord1;\n\n texCoord1.x = aTexCoord1.x * decode_texCoord1_vNormConstant.x;\n\n texCoord1.y = aTexCoord1.y * decode_texCoord1_vNormConstant.y;\n\n vTexCoord.zw = decode_texCoord1_min + texCoord1.xy;\n\n #else\n\n vTexCoord.zw = decode_texCoord1_min.xy + aTexCoord1.xy * decode_texCoord1_normConstant;\n\n #endif\n\n #else\n\n vTexCoord.zw = aTexCoord1.xy;\n\n #endif\n\n\n\n vTexMatrix2 = vec4(0.0,0.0,1.0,0.0);\n\n vIsRGBA.y = 0.0;\n\n vTexCoordTransform.y = aTexCoord1.z;\n\n #ifdef HAS_TextureCoordMatrix\n\n vTexCoordTransform.y = aTextureCoordMatrix.y;\n\n #endif\n\n if(vTexCoordTransform.y < -90000.0)\n\n {\n\n vTexMatrix2.z = -1.0;\n\n }\n\n getTextureMatrixFromZValue(floor(vTexCoordTransform.y), vTexMatrix2.x, vTexMatrix2.y, vTexMatrix2.z, vIsRGBA.y);\n\n vTexMatrix2.w = log2(uTexture1Width * vTexMatrix.z);\n\n#endif\n\n\n\n vec4 vertexColor = uFillForeColor;\n\n#ifdef VertexColor\n\n vertexColor *= aColor0 / 255.0;\n\n#endif\n\n#ifdef VertexNormal\n\n vec3 normal = aNormal;\n\n #ifdef COMPRESS_NORMAL\n\n #ifdef MeshOPT_Compress\n\n normal.x = aNormal.x / 127.0;\n\n normal.y = aNormal.y / 127.0;\n\n normal.z = 1.0 - abs(normal.x) - abs(normal.y);\n\n normal = normalize(normal);\n\n #else\n\n normal = czm_octDecode(aNormal.xy, normal_rangeConstant).zxy;\n\n #endif\n\n #endif\n\n#endif\n\n#ifdef InstanceBim\n\n mat4 worldMatrix;\n\n worldMatrix[0] = uv2;\n\n worldMatrix[1] = uv3;\n\n worldMatrix[2] = uv4;\n\n worldMatrix[3] = vec4(0, 0, 0, 1);\n\n vertexPos = vec4(vertexPos.xyz,1.0) * worldMatrix;\n\n vertexColor *= secondary_colour; \n\n#endif\n\n#ifdef InstancePipe\n\n mat4 worldMatrix;\n\n mat4 worldMatrix0;\n\n mat4 worldMatrix1;\n\n vec4 worldPos0;\n\n vec4 worldPos1;\n\n worldMatrix0[0] = uv1;\n\n worldMatrix0[1] = uv2;\n\n worldMatrix0[2] = uv3;\n\n worldMatrix0[3] = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n worldMatrix1[0] = uv4;\n\n worldMatrix1[1] = uv5;\n\n worldMatrix1[2] = uv6;\n\n worldMatrix1[3] = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n vec4 realVertex = vec4(vertexPos.xyz, 1.0);\n\n realVertex.x = realVertex.x * uv7.z;\n\n worldPos0 = realVertex * worldMatrix0;\n\n worldPos1 = realVertex * worldMatrix1;\n\n vertexColor *= secondary_colour; \n\n #ifdef TexCoord\n\n if(aTexCoord.y > 0.5)\n\n {\n\n vec4 tex4Vec = uTexMatrix * vec4(uv7.y, aTexCoord.x, 0.0, 1.0);\n\n vTexCoord.xy = tex4Vec.xy;\n\n vertexPos = worldPos1;\n\n worldMatrix = worldMatrix1;\n\n }\n\n else\n\n {\n\n vec4 tex4Vec = uTexMatrix * vec4(uv7.x, aTexCoord.x, 0.0, 1.0);\n\n vTexCoord.xy = tex4Vec.xy;\n\n vertexPos = worldPos0;\n\n worldMatrix = worldMatrix0;\n\n }\n\n #endif\n\n #ifdef VertexNormal\n\n normal.x = normal.x * uv7.z;\n\n #endif\n\n#endif\n\n#ifdef Instance \n\n float index = instanceId;\n\n#else\n\n float index = batchId;\n\n#endif \n\n vec4 positionMC = vec4(vertexPos.xyz, 1.0);\n\n vColor = vertexColor;\n\n#ifdef VertexNormal\n\n vNormalEC = modelNormalMatrix * normal;\n\n#endif\n\n vPositionMC = positionMC;\n\n vPositionEC = (modelViewMatrix * positionMC).xyz;\n\n gl_Position = projMatrix * modelViewMatrix * vec4(vertexPos.xyz, 1.0);\n\n}\n\n"},{"type":35632,"content":"#ifdef GL_OES_standard_derivatives\n\n #extension GL_OES_standard_derivatives : enable\n\n#endif\n\n#ifdef GL_EXT_shader_texture_lod\n\n #extension GL_EXT_shader_texture_lod : enable\n\n#endif\n\nprecision highp float;\n\n#include <gl2_frag>\n\n uniform vec4 uDiffuseColor;\n\n#ifdef TexCoord\n\n varying vec4 vTexCoord;\n\n #ifdef COMPUTE_TEXCOORD\n\n uniform sampler2D uTexture;\n\n uniform float uTexture0Width;\n\n varying vec4 vTexCoordTransform;\n\n varying vec4 vTexMatrix;\n\n varying vec2 vIsRGBA;\n\n #endif\n\n#endif\n\n\n\n varying vec4 vPositionMC;\n\n varying vec3 vPositionEC;\n\n varying vec4 vColor;\n\n#ifdef VertexNormal\n\n varying vec3 vNormalEC;\n\n#endif\n\n#ifdef TexCoord2\n\n uniform sampler2D uTexture2;\n\n uniform float uTexture1Width;\n\n varying vec4 vTexMatrix2;\n\n#endif\n\n#ifdef COMPUTE_TEXCOORD\n\n void calculateMipLevel(in vec2 inTexCoord, in float vecTile, in float fMaxMip, inout float mipLevel)\n\n {\n\n vec2 dx = dFdx(inTexCoord * vecTile);\n\n vec2 dy = dFdy(inTexCoord * vecTile);\n\n float dotX = dot(dx, dx);\n\n float dotY = dot(dy, dy);\n\n float dMax = max(dotX, dotY);\n\n float dMin = min(dotX, dotY);\n\n float offset = (dMax - dMin) / (dMax + dMin);\n\n offset = clamp(offset, 0.0, 1.0);\n\n float d = dMax * (1.0 - offset) + dMin * offset;\n\n mipLevel = 0.5 * log2(d);\n\n mipLevel = clamp(mipLevel, 0.0, fMaxMip - 1.62);\n\n }\n\n \n\n void calculateTexCoord(in vec3 inTexCoord, in float scale, in float XTran, in float YTran, in float fTile, in float mipLevel, inout vec2 outTexCoord)\n\n {\n\n if(inTexCoord.z < -9000.0)\n\n {\n\n outTexCoord = inTexCoord.xy;\n\n }\n\n else\n\n {\n\n vec2 fTexCoord = fract(inTexCoord.xy);\n\n float offset = 1.0 * pow(2.0, mipLevel) / fTile;\n\n fTexCoord = clamp(fTexCoord, offset, 1.0 - offset);\n\n outTexCoord.x = (fTexCoord.x + XTran) * scale;\n\n outTexCoord.y = (fTexCoord.y + YTran) * scale;\n\n }\n\n }\n\n \n\n vec4 getTexColorForS3M(sampler2D curTexture, vec3 oriTexCoord, float texTileWidth, float fMaxMipLev, float fTexCoordScale, vec2 vecTexCoordTranslate, float isRGBA)\n\n {\n\n vec4 color = vec4(1.0);\n\n float mipLevel = 0.0;\n\n #ifdef GL_OES_standard_derivatives\n\n calculateMipLevel(oriTexCoord.xy, texTileWidth, fMaxMipLev, mipLevel);\n\n #endif\n\n vec2 realTexCoord;\n\n calculateTexCoord(oriTexCoord, fTexCoordScale, vecTexCoordTranslate.x, vecTexCoordTranslate.y, texTileWidth, mipLevel, realTexCoord);\n\n if(isRGBA > 0.5)\n\n {\n\n vec2 rgbTexCoord;\n\n rgbTexCoord.x = (realTexCoord.x + vecTexCoordTranslate.x * fTexCoordScale) * 0.5;\n\n rgbTexCoord.y = (realTexCoord.y + vecTexCoordTranslate.y * fTexCoordScale) * 0.5;\n\n color = texture2D(curTexture, rgbTexCoord.xy, -10.0);\n\n vec2 vecAlphaTexCoord;\n\n vecAlphaTexCoord.x = rgbTexCoord.x;\n\n vecAlphaTexCoord.y = rgbTexCoord.y + fTexCoordScale * 0.5;\n\n color.a = texture2D(curTexture, vecAlphaTexCoord.xy, -10.0).r;\n\n }\n\n else\n\n {\n\n if(oriTexCoord.z < -9000.0)\n\n {\n\n color = texture2D(curTexture, realTexCoord.xy);\n\n }\n\n else\n\n {\n\n color = texture2DLodEXT(curTexture, realTexCoord.xy, mipLevel);\n\n }\n\n }\n\n \n\n return color;\n\n }\n\n \n\n vec4 getTextureColor()\n\n {\n\n if(vTexMatrix.z < 0.0)\n\n {\n\n return vec4(1.0);\n\n }\n\n float texTileWidth0 = vTexMatrix.z * uTexture0Width;\n\n vec3 realTexCoord = vec3(vTexCoord.xy, vTexCoordTransform.x);\n\n vec4 FColor = getTexColorForS3M(uTexture, realTexCoord, texTileWidth0, vTexMatrix.w, vTexMatrix.z, vTexMatrix.xy, vIsRGBA.x);\n\n #ifdef TexCoord2\n\n float texTileWidth1 = vTexMatrix2.z * uTexture1Width;\n\n realTexCoord = vec3(vTexCoord.zw, vTexCoordTransform.y);\n\n vec4 SColor = getTexColorForS3M(uTexture2, realTexCoord, texTileWidth1, vTexMatrix2.w, vTexMatrix2.z, vTexMatrix2.xy, vIsRGBA.y);\n\n SColor.r = clamp(SColor.r, 0.0, 1.0);\n\n SColor.g = clamp(SColor.g, 0.0, 1.0);\n\n SColor.b = clamp(SColor.b, 0.0, 1.0);\n\n return FColor * SColor;\n\n #else\n\n return FColor;\n\n #endif\n\n }\n\n#endif\n\n\n\n vec3 czm_acesTonemapping(vec3 color) {\n\n float g = 0.985;\n\n float a = 0.065;\n\n float b = 0.0001;\n\n float c = 0.433;\n\n float d = 0.238;\n\n\n\n color = (color * (color + a) - b) / (color * (g * color + c) + d);\n\n\n\n color = clamp(color, 0.0, 1.0);\n\n\n\n return color;\n\n }\n\n vec4 SRGBtoLINEAR4(vec4 srgbIn) {\n\n #ifndef HDR \n\n vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\n\n return vec4(linearOut, srgbIn.a);\n\n #else\n\n return srgbIn;\n\n #endif\n\n }\n\n vec3 LINEARtoSRGB(vec3 linearIn) {\n\n #ifndef HDR \n\n return pow(linearIn, vec3(1.0/2.2));\n\n #else\n\n return linearIn;\n\n #endif\n\n }\n\n vec3 applyTonemapping(vec3 linearIn) {\n\n #ifndef HDR\n\n return czm_acesTonemapping(linearIn);\n\n #else\n\n return linearIn;\n\n #endif\n\n }\n\n \n\n vec3 computeNormal(in vec3 oriVertex)\n\n {\n\n vec3 normal = cross(vec3(dFdx(oriVertex.x), dFdx(oriVertex.y), dFdx(oriVertex.z)), vec3(dFdy(oriVertex.x), dFdy(oriVertex.y), dFdy(oriVertex.z)));\n\n normal = normalize(normal);\n\n return normal;\n\n }\n\n \n\n uniform vec3 light0_viewDirection;\n\n void main()\n\n {\n\n if(vColor.a < 0.1)\n\n {\n\n discard;\n\n } \n\n vec4 baseColorWithAlpha = vColor;\n\n #ifdef COMPUTE_TEXCOORD\n\n baseColorWithAlpha *= SRGBtoLINEAR4(getTextureColor());\n\n #endif\n\n \n\n if(baseColorWithAlpha.a < 0.1)\n\n {\n\n discard;\n\n }\n\n vec3 normal = vec3(0.0);\n\n #ifdef VertexNormal\n\n normal = normalize(vNormalEC);\n\n #endif\n\n normal = length(normal) > 0.1 ? normal : computeNormal(vPositionMC.xyz);\n\n vec3 color = baseColorWithAlpha.rgb;\n\n vec3 dirVectorEC = normalize(light0_viewDirection);\n\n float dotProduct = dot( normal, dirVectorEC );\n\n float dirDiffuseWeight = max( dotProduct, 0.0 );\n\n dirDiffuseWeight = dirDiffuseWeight * 0.5 + 0.5;\n\n color += color * uDiffuseColor.rgb * dirDiffuseWeight;\n\n #ifdef TexCoord\n\n color = LINEARtoSRGB(color);\n\n #endif\n\n glFragColor = vec4(color, baseColorWithAlpha.a);\n\n#if __VERSION__ == 100\n\n gl_FragColor = glFragColor;\n\n#endif\n\n }"}],"techniques":[{"attributes":{"aPosition":{"semantic":"POSITION","type":35666},"instanceId":{"semantic":"instanceId","type":5126},"batchId":{"semantic":"_BATCHID","type":5126},"aTexCoord0":{"semantic":"TEXCOORD_0","type":35664},"aTexCoord1":{"semantic":"aTexCoord1","type":35666},"aNormal":{"semantic":"aNormal","type":35665},"aColor":{"semantic":"COLOR_0","type":35666},"uv2":{"semantic":"uv2","type":35666},"uv3":{"semantic":"uv3","type":35666},"uv4":{"semantic":"uv4","type":35666},"secondary_colour":{"semantic":"secondary_colour","type":35666},"uv6":{"semantic":"uv6","type":35666},"TextureCoordMatrix":{"semantic":"TextureCoordMatrix","type":35664}},"program":0,"uniforms":{"czm_modelView":{"type":35676,"semantic":"MODELVIEW"},"czm_normal":{"type":35675,"semantic":"MODELINVERSETRANSPOSE"},"czm_modelViewProjection":{"type":35676,"semantic":"MODELVIEWPROJECTION"},"uTexMatrix":{"type":35676},"uTexture0Width":{"type":5126},"uFillForeColor":{"type":35666},"uSelectedColor":{"type":35666},"uDiffuseColor":{"type":35666},"uTexture":{"type":35678},"uTexture2":{"type":35678},"uTexture1Width":{"type":5126}}}]},{getTextureMagFilter:br,getTextureMinFilter:Sr,getTextureWrap:Pr,getMaterialType:Mr,getMaterialFormat:Nr,getPrimitive:Dr,getUniqueREGLBuffer:Or}=r.reshader.REGLHelper,Lr=[1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1],Fr=[0,0,1,0,0,1,0,0,-1,0,0,0,0,0,0,1],{loginIBLResOnCanvas:xr,logoutIBLResOnCanvas:wr,getIBLResOnCanvas:vr,getPBRUniforms:Ur}=r.reshader.pbr.PBRUtils,Gr={factor:0,units:0},Hr={specularStrength:0,materialShininess:1},Vr=[1,1,1],Kr=r.mat4.identity([]),kr=t=>t.material instanceof r.reshader.PhongMaterial,Xr=t=>t.material instanceof r.reshader.pbr.StandardMaterial,zr=[!0,!0,!0,!0],Jr=[],Yr=new i.Coordinate(0,0),Zr=new i.Point(0,0),Wr=new i.Point(0,0),jr=new i.Point(0,0),Qr=[],qr=[],$r=[],tn=[],en={"POSITION":"POSITION","NORMAL":"NORMAL","TEXCOORD_0":"TEXCOORD_0","TEXCOORD_1":"TEXCOORD_1","COLOR_0":"COLOR_0","TANGENT":"TANGENT","_BATCHID":"_BATCHID"};class rn{constructor(t,e){this.tt=e,this.et=e.getRenderer().canvas,this.pickingFBO=e.getRenderer().pickingFBO,this.rt=new i.SpatialReference,this.nt=t,this.it=new r.reshader.Renderer(t),this.st={},this.ot={},this.At={},this.ct={},this.lt={},this.ft={},this.ht={},this.ut=new r.reshader.Scene,this.Et=new r.reshader.Scene,this._t=new r.reshader.Scene,this.Bt=new r.reshader.Scene,this.dt=new r.reshader.ResourceLoader(t.texture(2)),this.Ct=this.Tt.bind(this),this.gt=new r.reshader.PhongMaterial({"baseColorFactor":[1,1,1,1]}),this.Rt(),this.yt=new r.reshader.KHRTechniquesWebglManager(this.nt,this.It(),this.dt);const n=this.getMap();n.altitudeToPoint&&(this.bt=n.altitudeToPoint(100,n.getGLRes())/100)}getI3DMMeshes(){return this.lt}getPNTSMeshes(){return this.ct}getB3DMMeshes(){return this.At}getPaintedMeshes(){return this.St}getMap(){return this.tt.getMap()}paint(t,e,n){const i=n&&n.renderTarget,s=n&&n.sceneFilter,o=this.getMap();if(!t.length||!o)return;const a=this.Pt(),A=o.projViewMatrix,c=this.tt.options.services,l=[],h=[];let u=[];const E=[],_=[],B=this.Mt(t);for(let i=0,s=t.length;i<s;i++){const s=t[i].data.node;let o=this.Nt(s);if(!o)continue;this.ft[s.id]&&(o=this.ft[s.id],o=v(o));let a=c[s.Dt].polygonOffset||Gr;S(a)&&(a=a()),Array.isArray(o)||(l[0]=o,o=l);for(let t=0,i=o.length;t<i;t++){const i=o[t].properties.magic;if("b3dm"===i){if(o[t].getBoundingBox&&!f(A,o[t].getBoundingBox()))continue;const{batchIdData:e,batchIdMap:i}=o[t].geometry.properties;if(e&&i){const e=o[t].properties.node.Dt;this.Ot&&this.Ot[e]&&r.HighlightUtil.highlightMesh(this.nt,o[t],this.Ot[e],this.Lt,i),r.HighlightUtil.showOnly(this.nt,o[t],this.Ft&&this.Ft[e],this.xt,i)}n&&n.bloom&&o[t].properties.hlBloomMesh&&(o[t].properties.hlBloomMesh.properties.depthFunc="always",o[t].properties.hlBloomMesh.properties.polygonOffset=a,u.push(o[t].properties.hlBloomMesh)),u.push(o[t])}else"pnts"===i?E.push(o[t]):"i3dm"===i&&_.push(o[t]);o[t].properties.isLeaf=!!e[s.id],o[t].properties.level=B.get(s.wt),o[t].properties.polygonOffset=a,o[t].vt=s,e[s.id]||h.push(o[t])}}let d=0;const C=this.yt.getExcludeFilter();d+=this.Ut(this.Gt,a,[s,kr,C],i,h,u,_),d+=this.Ut(this.Ht,a,[s,Xr,C],i,h,u,_),this.yt.forEachShader(((t,e,r)=>{const n=this.Pt(r);d+=this.Ut(t,n,[s,e],i,h,u,_)})),this.Et.setMeshes(E);const T=this.Vt();return d+=this.it.render(this.Kt,T,this.Et,i&&i.fbo),this.St={pntsMeshes:E,i3dmMeshes:_,b3dmMeshes:u},d}Ut(t,e,r,n,i,s,o){t.filter=r.filter((t=>!!t)),e.debug=!1,e.stencilEnable=!0,e.debug=!1,e.cullFace="back",e.colorMask=zr;let a=0;return this.ut.setMeshes(s),a+=this.it.render(t,e,this.ut,n&&n.fbo),e.stencilEnable=!0,this._t.setMeshes(o),a+=this.it.render(t,e,this._t,n&&n.fbo),a}kt(t,e){return e.vt.Xt-t.vt.Xt}paintRegion(t,e,r,n,i){const s=this.getMap();if(!t.length&&!e.length)return;const o=s.projViewMatrix,a=[];for(let r=0,n=(t=t.concat(e)).length;r<n;r++){const e=t[r].node,n=this.zt(e);n&&(n.getBoundingBox&&!f(o,n.getBoundingBox())||a.push(n))}this.Jt.filter=n,this.Bt.setMeshes(a);const A=this.Yt(r);this.it.render(this.Jt,A,this.Bt,i&&i.fbo)}deleteTile(t){const e=t.node.id;this.Zt(e)}Zt(t){const e=this.ot[t];e&&(e.geometry.dispose(),e.dispose(),delete this.ot[t]);let r=this.At[t]||this.ct[t]||this.lt[t]||this.ft[t]||this.st[t];this.ft[t]?this.Wt(t):r&&(this.jt(r),delete this.At[t],delete this.ct[t],delete this.lt[t],delete this.st[t])}Wt(t){let e=this.ft[t];e=v(e);for(let t=0;t<e.length;t++){const{id:r}=e[t].properties;this.Zt(r)}delete this.ft[t]}jt(t){if(Array.isArray(t))for(let e=0,r=t.length;e<r;e++)this.jt(t[e]);else{r.HighlightUtil.showOnly(this.nt,t),r.HighlightUtil.highlightMesh(this.nt,t);const e=t.geometry.properties.url;if(e){const t=this.ht[e];t&&(t.refCount--,t.refCount<=0&&(t.geometry.dispose(),t.material.dispose(),delete this.ht[e]))}else t.geometry.dispose(),t.material&&t.material.dispose();t.dispose()}}remove(){const t=this.tt;wr(t.getRenderer().canvas,t.getMap());for(const t in this.ft)this.Wt(t);this.ft={};for(const t in this.At)this.Zt(t);this.At={};for(const t in this.ct)this.Zt(t);this.ct={};for(const t in this.lt)this.Zt(t);this.lt={};for(const t in this.st)this.Zt(t);this.st={};for(const t in this.ot)this.Zt(t);this.ot={},this.Gt&&(this.Gt.dispose(),delete this.Gt),this.Ht&&(this.Ht.dispose(),delete this.Ht),this.Kt&&(this.Kt.dispose(),delete this.Kt),this.Jt&&(this.Jt.dispose(),delete this.Jt),this.yt.dispose(),this.picking&&this.picking.dispose()}zt(t){if(!t.boundingVolume||!t.boundingVolume.region)return null;if(this.ot[t.id])return this.ot[t.id];const e=t.boundingVolume.region;let n=new i.Coordinate(D(e[0]),D(e[1])),s=new i.Coordinate(D(e[2]),D(e[3]));n=this.Qt(n),s=this.Qt(s);const o=n.add(s).qt(.5);n._sub(o),s._sub(o);const a=this.$t(e[4],e[5]),A=a.x,c=a.y,l=[n.x,n.y,c,s.x,n.y,c,s.x,s.y,c,n.x,s.y,c,n.x,n.y,A,s.x,n.y,A,s.x,s.y,A,n.x,s.y,A],f=new r.reshader.Geometry({aPosition:l},[0,1,1,2,2,3,3,0,0,4,1,5,2,6,3,7,4,5,5,6,6,7,7,4],0,{primitive:"lines"});f.generateBuffers(this.nt);const h=new r.reshader.Mesh(f),u=r.mat4.identity([]);return h.setLocalTransform(r.mat4.translate(u,u,[o.x,o.y,0])),this.ot[t.id]=h,h}Nt(t){return this.At[t.id]||this.ct[t.id]||this.lt[t.id]||this.ft[t.id]}has(t){return this.Nt(t)||this.st[t.id]}createPntsMesh(t,e,n,i){if(this.ct[e]){const t=this.ct[e];return console.warn(`pnts mesh with id(${e}) was already created.`),i(null,{id:e,mesh:t}),t}const{pnts:s,featureTable:o,rootIdx:a}=t,A=this.tt.options.services[a],c=o.POINTS_LENGTH,l=new r.reshader.Geometry(s,null,c,{primitive:"points",positionAttribute:"POSITION"});l.generateBuffers(this.nt);const f={};s.POSITION?f.HAS_POSITION=1:s.POSITION_QUANTIZED&&(f.HAS_POSITION_QUANTIZED=1),s.RGB?f.HAS_RGB=1:s.RGBA?f.HAS_RGBA=1:s.RGB565&&(f.HAS_RGB565=1),(s.NORMAL||s.NORMAL_OCT16P)&&(f.HAS_NORMAL=1,s.NORMAL_OCT16P&&(f.HAS_NORMAL_OCT16P=1)),t.featureTable.CONSTANT_RGBA&&(t.featureTable.CONSTANT_RGBA=t.featureTable.CONSTANT_RGBA.map((t=>t/255)));const{rtcCenter:h,rtcCoord:u}=t,E=this.te($r,u),_=this.ee([],n,h,u);r.mat4.multiply(_,_,E);const B=this.tt.options.services[a],d=new r.reshader.Mesh(l);if(d.properties.magic="pnts",d.properties.id=e,d.properties.node=n,d.properties.count=c,d.properties.batchTable=t.batchTable,d.properties.batchTableBin=t.batchTableBin,d.properties.serviceIndex=a,d.setDefines(f),Object.defineProperty(d.uniforms,"pointColor",{enumerable:!0,get:function(){return t.featureTable.CONSTANT_RGBA?t.featureTable.CONSTANT_RGBA:B&&B.pointColor||[1,1,1,1]}}),Object.defineProperty(d.uniforms,"pointSize",{enumerable:!0,get:function(){return B&&B.pointSize||2}}),Object.defineProperty(d.uniforms,"pointOpacity",{enumerable:!0,get:function(){return B&&B.pointOpacity||1}}),A.coordOffset){const t=this.re(n.Dt,u);r.mat4.multiply(_,t,_)}return d.setLocalTransform(_),this.ct[e]=d,i(null,{id:e,mesh:[d]}),[d]}createI3DMMesh(t,e,n,i){if(this.lt[e]){const t=this.lt[e];return console.warn(`i3dm mesh with id(${e}) was already created.`),this.st[e]||i(null,{id:e,mesh:t}),t}const s=this.tt.options.services[n.Dt],o=this.ne(n.ie),{i3dm:a,featureTable:A,gltf:c,batchTable:l,batchTableBin:f,count:h}=t,u=A.INSTANCES_LENGTH,{rtcCenter:E,rtcCoord:_}=t,B=this.te($r,_),d=this.ee(tn,n,E,_);r.mat4.multiply(B,d,B);const{POSITION:C,NORMAL_UP:T,NORMAL_RIGHT:m,SCALE:g,SCALE_NON_UNIFORM:p,INSTANCE_ROTATION:R}=a,y={"instance_vectorA":new Float32Array(4*u),"instance_vectorB":new Float32Array(4*u),"instance_vectorC":new Float32Array(4*u)},I=new Float32Array(3),b=new Float32Array(3),S=[],P=new Float32Array(1),M=new Float32Array(3),N=[],D=[],O=[],L=[],F=new Float32Array(9);!function(t,e){let{componentType:r,byteOffset:n,byteStride:i,count:s,itemSize:o}=t;const a=t.array.buffer,A=r?Qt.getTypedArrayCtor(r):t.array.constructor;if(n=void 0===n?t.array.byteOffset:n,i=i||0,s=s||t.array.length/o,(!i||i===o*A.BYTES_PER_ELEMENT)&&n%A.BYTES_PER_ELEMENT==0){const t=new A(a,n,s*o);for(let r=0;r<s*o;r+=o)e(new A(t.buffer,n+r*A.BYTES_PER_ELEMENT,o),r/o);return}const c=new Uint8Array(o*A.BYTES_PER_ELEMENT);i||(i=o*A.BYTES_PER_ELEMENT);for(let t=0;t<s;t++){const r=new Uint8Array(a,i*t+n,o*A.BYTES_PER_ELEMENT);c.set(r),e(new A(c.buffer),t),r.set(c)}}(C,((t,e)=>{T?(de(b,m,e),de(I,T,e),r.vec3.cross(S,b,I),r.vec3.normalize(S,S),w(N,b,0),w(N,I,1),w(N,S,2),r.quat.fromMat3(D,N)):R?(de(F,R,e),r.quat.fromMat3(D,F)):r.quat.identity(D),g?(de(P,g,e),r.vec3.set(O,P[0],P[0],P[0])):p?(de(M,p,e),r.vec3.set(O,...M)):r.vec3.set(O,1,1,1),r.mat4.fromRotationTranslationScale(L,D,t,O),Ce(y.instance_vectorA,e,L,0),Ce(y.instance_vectorB,e,L,1),Ce(y.instance_vectorC,e,L,2)}));const x={};for(const t in y)x[t]={buffer:this.nt.buffer({dimension:y[t].length/u,data:y[t]}),divisor:1};const v=s.shader||"phong";let U=0,G=!0;const H=[];return ce(c,((t,i,a,A)=>{let{geometry:c,material:E}=this.se(t,i,a,A,n,!0,v);E&&!E.isReady()&&(G=!1,U++);const d=new r.reshader.InstancedMesh(x,u,c,E);d.properties.magic="i3dm",d.properties.id=e,d.properties.count=h,d.properties.batchTable=l,d.properties.batchTableBin=f,d.properties.serviceIndex=n.Dt;const C=this.oe(t,c,E,n.Dt,A),T=r.mat4.identity([]);if(t.matrices&&t.matrices.length)for(let e=0;e<t.matrices.length;e++)r.mat4.multiply(T,T,t.matrices[e]);let m;if(r.mat4.multiply(T,o,T),d.setPositionMatrix(T),s.coordOffset){const t=this.re(n.Dt,_);m=r.mat4.multiply([],t,B)}else m=r.mat4.copy([],B);d.setLocalTransform(m),d.setDefines(C),d.properties.polygonOffset={offset:0,factor:0},H.push(d)})),G?(this.lt[e]=H,i(null,{id:e,mesh:H})):(this.st[e]={meshes:H,count:U},H.ae=i),H}createB3DMMesh(t,e,n,s){if(this.At[e]||this.st[e]){const t=this.At[e];return console.warn(`mesh with id(${e}) was already created.`),this.st[e]||s(null,{id:e,mesh:t}),t}let o;if(n.maxExtent){const t=new i.Extent(n.maxExtent).convertTo((t=>this._pointToPrj(t)));o=[t.xmin,t.ymin,t.xmax,t.ymax]}const a=t.gltf,{projCenter:A}=a.extensions.MAPTALKS_RTC,{rtcCoord:c,center:l}=a.extensions.CESIUM_RTC,f=this.ne(n.ie);let h;h=a.asset&&a.asset.sharePosition?this.te($r,c):this.Ae($r,c,A,n.Dt);const u=this.tt.options.services[n.Dt];let E=u.shader||"pbr";if(a.materials)for(let t=0;t<a.materials.length;t++)if(a.materials[t]&&a.materials[t].extensions&&a.materials[t].extensions.KHR_materials_unlit){E=u.shader="phong";break}const _=[];let B=0,d=!0;return ce(a,((i,s,a,A)=>{let{geometry:C,material:T}=this.se(i,s,a,A,n,!1,E);T&&!T.isReady()&&(d=!1,B++);const m=new r.reshader.Mesh(C,T);m.properties.magic="b3dm",m.properties.id=e,m.properties.node=n,m.properties.batchTable=t.batchTable,m.properties.batchTableBin=t.batchTableBin,m.properties.count=t.featureTable.BATCH_LENGTH,m.properties.serviceIndex=n.Dt;const g=this.oe(i,C,T,n.Dt,A);m.setDefines(g);const p=i.compressUniforms;if(p)for(const t in p)m.setUniform(t,p[t]);o&&(g.USE_MAX_EXTENT=1,m.setUniform("maxPrjExtent",o)),Object.prototype.hasOwnProperty.call(m.uniforms,"polygonOpacity")||Object.defineProperty(m.uniforms,"polygonOpacity",{enumerable:!0,get:function(){return M(u.opacity)?u.opacity:1}});let R=r.mat4.identity([]);if(A.asset.sharePosition&&i.matrices&&i.matrices.length)for(let t=0;t<i.matrices.length;t++)r.mat4.multiply(R,R,i.matrices[t]);if(A.asset.sharePosition){const t=this.ee(tn,n,l,c);r.mat4.multiply(R,f,R),r.mat4.multiply(R,h,R),r.mat4.multiply(R,t,R)}else r.mat4.multiply(R,h,R);if(u.coordOffset){const t=this.re([],n.Dt,c);r.mat4.multiply(R,t,R)}m.setLocalTransform(R),_.push(m)})),d?(this.At[e]=_,s(null,{id:e,mesh:_})):(this.st[e]={meshes:_,count:B},_.ae=s),_}ee(t,e,n,s){const o=this.getMap(),a=this.tt.options.services[e.Dt].heightOffset||0,A=new i.Coordinate(s);let c;c=o.altitudeToPoint?this.bt:o.distanceToPointAtRes(100,100,o.getGLRes(),A).y/100;let l=e.matrix?r.mat4.copy(t,e.matrix):r.mat4.identity(t);if(n){Ar(l,r.vec3.transformMat4(Jr,n,l),l)}const f=function(t,e,r,n,i,s,o){e=$(_r,e);const a=pe(_r,e[0]*yr,e[1]*yr,e[2]),A=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}(Br,r),c=n.ellipsoid;var l;l=0===lt(A)?tt(dr,0,0,-6378137):Pe(dr,A),pr.x=l[0],pr.y=l[1];const f=n.project(pr,Rr);Cr[0]=f.x/i,Cr[1]=f.y/i,Cr[2]=(l[2]+o)*s;const h=cr(a,c,Tr),u=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],A=e[6],c=e[7],l=e[8],f=e[9],h=e[10],u=e[11],E=e[12],_=e[13],B=e[14],d=e[15],C=r*a-n*o,T=r*A-i*o,m=r*c-s*o,g=n*A-i*a,p=n*c-s*a,R=i*c-s*A,y=l*_-f*E,I=l*B-h*E,b=l*d-u*E,S=f*B-h*_,P=f*d-u*_,M=h*d-u*B,N=C*M-T*P+m*S+g*b-p*I+R*y;return N?(N=1/N,t[0]=(a*M-A*P+c*S)*N,t[1]=(i*P-n*M-s*S)*N,t[2]=(_*R-B*p+d*g)*N,t[3]=(h*p-f*R-u*g)*N,t[4]=(A*b-o*M-c*I)*N,t[5]=(r*M-i*b+s*I)*N,t[6]=(B*m-E*R-d*T)*N,t[7]=(l*R-h*m+u*T)*N,t[8]=(o*P-a*b+c*y)*N,t[9]=(n*b-r*P-s*y)*N,t[10]=(E*p-_*m+d*C)*N,t[11]=(f*m-l*p-u*C)*N,t[12]=(a*I-o*S-A*y)*N,t[13]=(r*S-n*I+i*y)*N,t[14]=(_*T-E*g-B*C)*N,t[15]=(l*g-f*T+h*C)*N,t):null}(mr,h),E=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}(gr,r),_=function(t,e,r){var n=t[0],i=t[1],s=t[2],o=t[4],a=t[5],A=t[6],c=t[8],l=t[9],f=t[10],h=e[0],u=e[1],E=e[2],_=e[3],B=e[4],d=e[5],C=e[6],T=e[7],m=e[8],g=n*h+o*u+c*E,p=i*h+a*u+l*E,R=s*h+A*u+f*E,y=n*_+o*B+c*d,I=i*_+a*B+l*d,b=s*_+A*B+f*d,S=n*C+o*T+c*m,P=i*C+a*T+l*m,M=s*C+A*T+f*m;return r[0]=g,r[1]=p,r[2]=R,r[3]=0,r[4]=y,r[5]=I,r[6]=b,r[7]=0,r[8]=S,r[9]=P,r[10]=M,r[11]=0,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}(u,E,t);return Ar(t,Cr,_),t}(l,s,l,o.getProjection(),o.getGLRes(),c,a),h=function(t,e){return tt(t,e[12],e[13],e[14]),t}(qr,f);let u=this.tt.options.offset;if(S(u)){u=u(this.tt.ce(e.id).center)}return r.vec3.set(Qr,u[0],u[1],0),r.vec3.sub(h,h,Qr),Ar(f,h,f),f}re(t,e,n){const i=this.tt.options.services[e];if(!i.coordOffset)return null;const s=this.getMap(),o=s.getGLRes();Yr.set(n[0],n[1]);const a=s.coordToPointAtRes(Yr,o,Wr),A=i.coordOffset,c=Yr.set(n[0]+A[0],n[1]+A[1]),l=s.coordToPointAtRes(c,o,jr),f=l.x-a.x,h=l.y-a.y,u=this.le(),E=r.vec3.set(Qr,f,h,(A[2]||0)*u);return r.mat4.fromTranslation(t,E)}le(){const t=this.getMap();let e;return e=t.altitudeToPoint?this.bt:t.distanceToPointAtRes(100,100,t.getGLRes(),Yr).y/100,e}createCMPTMesh(t,e,r,n){if(this.ft[e]){const t=this.ft[e];return console.warn(`mesh with id(${e}) was already created.`),n(null,{id:e,mesh:t}),t}const{content:i}=t,s=[];for(let t=0;t<i.length;t++){const{magic:n}=i[t],o=e+"."+t;"b3dm"===n?this.createB3DMMesh(i[t],o,r,((t,{mesh:e})=>{s.push(e)})):"i3dm"===n?this.createI3DMMesh(i[t],o,r,((t,{mesh:e})=>{s.push(e)})):"pnts"===n?this.createPntsMesh(i[t],o,r,((t,{mesh:e})=>{s.push(e)})):"cmpt"===n&&this.createCMPTMesh(i[t],o,r,((t,{mesh:e})=>{s.push(e)}))}return this.ft[e]=s,n(null,{id:e,mesh:s}),s}oe(t,e,r,n,i){const s=("phong"===(this.tt.options.services[n].shader||"phong")?this.Gt:this.Ht).getGeometryDefines(e);i.asset&&"S3M"===i.asset.generator&&this.fe(s,e,i),e.data.uvRegion&&(s.HAS_I3S_UVREGION=1),e.data[e.desc.normalAttribute]&&(s.VertexNormal=1),e.data[e.desc.color0Attribute]&&(s.VertexColor=1),e.data[e.desc.uv0Attribute]&&(s.TexCoord=1),e.data[e.desc.textureCoordMatrixAttribute]&&(s.HAS_TextureCoordMatrix=1),r.get("uTexture")&&(s.COMPUTE_TEXCOORD=1),r.get("uTexture2")&&(s.TexCoord2=1),"MESHOPT"===this.tt.he&&(s.MeshOPT_Compress=1),this.hasIBL()&&(s.HAS_IBL_LIGHTING=1);return b(s,t.compressDefines),s}fe(t,e,r){e.data.aNormal&&(t.VertexNormal=1),e.data.instanceId&&(t.Instance=1),e.data.aTexCoord0&&(t.TexCoord=1),e.data.aColor&&(t.VertexColor=1),e.data.aTexCoord1&&(t.TexCoord2=1),e.data.uv2&&(t.InstanceBim=1),e.data.aTexCoord0&&r.textures.length&&(t.COMPUTE_TEXCOORD=1)}se(t,e,r,n,i,s,o){let a=!1;n.asset&&"S3M"===n.asset.generator&&(a=!0,n.extensions=n.extensions||{},n.extensions.KHR_techniques_webgl=Ir);const A=n.url+"-"+e+"-"+r;if(this.ht[A])return this.ht[A].refCount++,this.ht[A];let c,l;const f=n.materials[t.material];if(n.extensions&&n.extensions.KHR_techniques_webgl&&f.extensions&&f.extensions.KHR_techniques_webgl){const e=this.ue(t,n,s,a);c=e.material,l=e.geometry;this.tt.options.services[i.Dt].fillEmptyDataInMissingAttribute&&(l.desc.fillEmptyDataInMissingAttribute=!0)}else{l=this.Ee(t,s,en);const e=this.tt.options.services[i.Dt],r=e.ambientLight;let a=e.environmentExposure;const A=e.material,f=this.getMap().getLightManager(),h=f&&f.getAmbientLight();if(r&&(!h||h.color)&&void 0===a){const t=h&&h.color?h.color[0]:.2;a=r[0]/t}c=this._e(t.material,n,o,A||Hr,a||1)}c&&!c.isReady()?c.Be=i.id:c||(c=this.gt);const h={refCount:1,geometry:l,material:c};return l.properties.url=A,this.ht[A]=h,h}ue(t,e,r,n){const{geometry:i,material:s}=this.yt.createMesh(t,e,r,n);return{geometry:i,material:s}}Ee(t,e,n){const i=t.attributes,s="COLOR_0";let o=i._BATCHID&&i._BATCHID.array;if(o&&o.byteOffset&&(o=new o.constructor(o)),i[s]){const t=i[s].array||i[s];if(t instanceof Float32Array){const e=new Uint8Array(t.length);for(let r=0;r<e.length;r++)e[r]=Math.round(255*t[r]);i[s].array?(i[s].array=e,i[s].componentType=5121):i[s]=e}}const a={};for(const t in i){const e=Or(this.nt,i[t],{dimension:i[t].itemSize}),r=n[t]||t;a[r]={buffer:e},i[t].quantization&&(a[r].quantization=i[t].quantization),r===n.POSITION&&(a[r].array=i[t].array,a[r].min=i[t].min,a[r].max=i[t].max)}delete t.attributes;const A=t.indices?t.indices.array?t.indices.array.slice():t.indices:null,c=new r.reshader.Geometry(a,A,0,{positionAttribute:n.POSITION,normalAttribute:n.NORMAL,uv0Attribute:n.TEXCOORD_0,uv1Attribute:n.TEXCOORD_1,color0Attribute:n.COLOR_0,tangentAttribute:n.TANGENT,pickingIdAttribute:n._BATCHID,primitive:void 0===t.mode?"triangles":Dr(t.mode)});return o&&A&&(c.properties.batchIdData=o,c.properties.batchIdMap=function(t,e){if(!e)return null;const r=new Map;for(let n=0;n<e.length;n++){const i=e[n],s=t[i];let o=r.get(s);o||(o=[],r.set(s,o)),o.push(i)}return r}
18
+ let at=0;function ct(t){return null==t}function At(t){return!ct(t)}function lt(t){for(let e=1;e<arguments.length;e++){const n=arguments[e];for(const e in n)t[e]=n[e]}return t}function ft(t){switch(t){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:return Uint16Array;case 5124:return Int32Array;case 5125:return Uint32Array;case 5126:return Float32Array}throw new Error("unsupported bufferView's component type: "+t)}function ht(t){return 0===t.indexOf("data:")&&t.indexOf("base64,")>0}function ut(t){const e=function(t){return"undefined"!=typeof self?self.atob(t):window.atob(t)}(t.substring(t.indexOf(",")+1)),n=e.length,r=new Uint8Array(n);for(let t=0;t<n;t++)r[t]=e.charCodeAt(t);return r.buffer}const Et=[],dt=[],_t=[],Bt=[0,0,0],Ct=rt([]),Tt=[1,1,1];function mt(t,e,n,r,i,o,s){const a=ft(s);if((0===i||i===r*a.BYTES_PER_ELEMENT)&&o%a.BYTES_PER_ELEMENT==0){const i=new a(e,o,n*r);return t.set(i),t}0===i&&(i=r*a.BYTES_PER_ELEMENT);const c=new Uint8Array(r*a.BYTES_PER_ELEMENT);for(let s=0;s<n;s++){let n=null;const A=new Uint8Array(e,i*s+o,r*a.BYTES_PER_ELEMENT);c.set(A),n=new a(c.buffer,0,r);for(let e=0;e<r;e++)t[s*r+e]=n[e]}return t}const gt="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;function pt(t,e,n){const r=new Uint8Array(t,e,n);return gt.decode(r)}const yt={get:function(t,e={}){e||(e={});const n=new AbortController,r=n.signal,i=lt({},e);i.signal=r,i.method||(i.method="GET");const o=fetch(t,i).then(t=>{const n=this.i(t,e.responseType);return n.message?n:n.then(n=>"arraybuffer"===e.responseType?{data:n,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),contentType:t.headers.get("Content-Type")}:n).catch(t=>{if(!t.code||t.code!==DOMException.ABORT_ERR)throw t})}).catch(t=>{if(!t.code||t.code!==DOMException.ABORT_ERR)throw t});return o.xhr=n,o},i:(t,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`}:"arraybuffer"===e?t.arrayBuffer():"json"===e?t.json():t.text(),getArrayBuffer:(t,e={})=>(e||(e={}),e.responseType="arraybuffer",yt.get(t,e)),getJSON:function(t,e={}){return e&&e.jsonp?yt.jsonp(t):((e=e||{}).responseType="json",yt.get(t,e))},jsonp:function(t){const e="_maptalks_jsonp_"+at++;t.match(/\?/)?t+="&callback="+e:t+="?callback="+e;let n=document.createElement("script");return n.type="text/javascript",n.src=t,new Promise(t=>{window[e]=function(r){document.getElementsByTagName("head")[0].removeChild(n),n=null,delete window[e],t(r)},document.getElementsByTagName("head")[0].appendChild(n)})}};class Rt{constructor(t,e,n){this.o=t,this.decoders=e,this.s=n,this.images={},this.A={}}requestImageFromBufferURI(t,e,n){if(this.buffers[t.id]){const r=this.buffers[t.id],i=this.l(e,r);return this.getImageByBuffer(i,n)}if(this.A[t.id])return this.A[t.id].then(()=>{const r=this.buffers[t.id],i=this.l(e,r);return this.getImageByBuffer(i,n)});if(ht(t.uri)){const r=this.buffers[t.id]=ut(t.uri),i=this.l(e,r);return this.getImageByBuffer(i,n)}return this.A[t.id]=yt.getArrayBuffer(t.uri,null).then(r=>{const i=this.buffers[t.id]=r.data,o=this.l(e,i);return this.getImageByBuffer(o,n)})}getImageByBuffer(t,e){if(this.images[e.id])return Promise.resolve(this.images[e.id]);const n=this.decoders;if(n[e.mimeType])return n[e.mimeType](t,{supportedFormats:this.s});if("image/crn"===e.mimeType||"image/ktx2"===e.mimeType||"image/cttf"===e.mimeType)return console.warn("missing transcoder for "+e.mimeType,", visit https://maptalks.com/docs/transcoders for details"),Promise.resolve(null);{const n=new Blob([t],{type:e.mimeType}),r=URL.createObjectURL(n);return this.h(e.id,r)}}requestExternalImage(t){if(this.images[t.id])return Promise.resolve(this.images[t.id]);const e=0===t.uri.indexOf("data:image/")?t.uri:this.rootPath+"/"+t.uri;return this.A[t.id]?this.A[t.id].then(()=>this.images[t.id]):this.A[t.id]=this.h(t.id,e)}h(t,e){return new Promise((n,r)=>{this.o(e,(i,o)=>{i?r(i):(URL.revokeObjectURL(e),this.images[t]=o,n(this.images[t]))})})}}const It=["SCALAR",1,"VEC2",2,"VEC3",3,"VEC4",4,"MAT2",4,"MAT3",9,"MAT4",16],bt=[];class xt{constructor(t,e,n){this.rootPath=t,this.gltf=e,this.u=!1,this.glbBuffer=n,this.buffers={},this.requests={},this.accessors={},this._()}B(t,e){const n=this.gltf,r=n.accessors[e];if(void 0===r.bufferView)return this.accessors[r.id]=this.C(t,e,null,0),Promise.resolve(this.accessors[r.id]);if(r&&this.accessors[r.id])return Promise.resolve(this.accessors[r.id]);const i=n.bufferViews[r.bufferView];return this.T(i).then(n=>{const{buffer:i,byteOffset:o}=n;return this.accessors[r.id]=this.C(t,e,i,o)})}T(t){const e=this.gltf.buffers[t.buffer];if(this.buffers[e.id]){const t=this.buffers[e.id];return Promise.resolve({buffer:t,byteOffset:0})}if(this.requests[e.id])return this.requests[e.id].then(()=>{const t=this.buffers[e.id];return Promise.resolve({buffer:t,byteOffset:0})});if("binary_glTF"!==t.buffer&&"KHR_binary_glTF"!==t.buffer&&e.uri){if(ht(e.uri)){const t=this.buffers[e.id]=ut(e.uri);return Promise.resolve({buffer:t,byteOffset:0})}let t;const n=e.uri.indexOf("blob:")>=0;return t=e.uri.indexOf("://")>0||n?e.uri:this.rootPath+"/"+e.uri,this.requests[e.id]=yt.getArrayBuffer(t,null).then(r=>(n&&URL.revokeObjectURL(t),{buffer:this.buffers[e.id]=r.data,byteOffset:0}))}return Promise.resolve({buffer:this.glbBuffer.buffer,byteOffset:this.glbBuffer.byteOffset})}C(t,e,n,r=0){const i=this.gltf,o=i.accessors[e],s=void 0!==o.bufferView?i.bufferViews[o.bufferView]:{},a=(s.byteOffset||0)+r,c=this.m(o.type),A=ft(o.componentType),l=s.byteStride||0,f={array:void 0,name:t,accessorName:e,byteLength:o.count*c*A.BYTES_PER_ELEMENT,componentType:o.componentType,count:o.count,type:o.type,itemSize:c,max:o.max,min:o.min,extensions:o.extensions};if(o.min&&(f.min=o.min),o.max&&(f.max=o.max),n)if(this.u)f.byteStride=l,f.byteOffset=a+(o.byteOffset||0),!l||l===c*A.BYTES_PER_ELEMENT||"indices"===t||"input"===t||"output"===t||t.indexOf("morph")>=0?(f.array=this.g(n,o.count,c,a+(o.byteOffset||0),A),f.array.buffer.byteLength===f.byteLength&&(f.byteOffset=0)):f.array=new Uint8Array(n,a,s.byteLength);else if(o.interleaved){f.byteStride=0,f.byteOffset=0;const t=new A(o.count*c);if(f.array=mt(t,n,o.count,c,l,a+(o.byteOffset||0),o.componentType),f.extensions&&f.extensions.WEB3D_quantized_attributes&&c>2){const t=new Float32Array(f.array.length),{decodeMatrix:e}=f.extensions.WEB3D_quantized_attributes;for(let n=0;n<f.array.length;n+=c){bt[0]=f.array[n],bt[1]=f.array[n+1],bt[2]=f.array[n+2],bt[3]=1;const r=et(bt,bt,e);t[n]=r[0],t[n+1]=r[1],t[n+2]=r[2]}f.componentType=5126,f.array=t}}else f.byteStride=0,f.array=this.g(n,o.count,c,a+(o.byteOffset||0),A),f.byteOffset=f.array.byteOffset;else{f.array=new A(o.count);const t=f.min||f.max;t&&(f.array[0]=t[0],f.array[1]=t[1],f.array[2]=t[2])}return f}_(){const t=this.gltf.accessors;if(Array.isArray(t))for(let e=0;e<t.length;e++)for(let n=0;n<t.length;n++)e!==n&&t[e].bufferView===t[n].bufferView&&(t[e].interleaved=t[n].interleaved=!0);else for(const e in t)for(const n in t)e!==n&&t[e].bufferView===t[n].bufferView&&(t[e].interleaved=t[n].interleaved=!0)}g(t,e,n,r,i){return r%i.BYTES_PER_ELEMENT!=0&&(t=t.slice(r,r+e*n*i.BYTES_PER_ELEMENT),r=0),new i(t,r,n*e)}m(t){const e=It.indexOf(t);return It[e+1]}requestKHRTechniquesWebgl(t){const{shaders:e}=t,n=e.map(t=>{if(void 0!==t.bufferView){const e=this.gltf.bufferViews[t.bufferView],{byteLength:n}=e;return this.T(e).then(r=>{const{buffer:i,byteOffset:o}=r,s=pt(i,o+(e.byteOffset||0),n);return t.content=s,t})}if(t.uri){if(ht(t.uri)){const e=ut(t.uri),n=pt(e,0,e.byteLength);return t.content=n,Promise.resolve(t)}{const e=this.rootPath+"/"+t.uri;return yt.get(e).then(e=>(t.content=e,t))}}return Promise.resolve(t)});return Promise.all(n).then(()=>t)}}class Mt extends Rt{constructor(t,e,n,r,i,o){super(r,i,o),this.rootPath=t,this.gltf=e,this.requests={},this.buffers={},this.glbBuffer=n,this.accessor=new xt(t,e,n)}iterate(t,e){const n=this.gltf[e];if(!n)return;let r=0;for(const e in n)t(e,n[e],r++)}createNode(t){const e={};if(At(t.name)&&(e.name=t.name),At(t.children)&&(e.children=t.children),At(t.jointName)&&(e.jointName=t.jointName),At(t.matrix)&&(e.matrix=t.matrix),At(t.rotation)&&(e.rotation=t.rotation),At(t.scale)&&(e.scale=t.scale),At(t.translation)&&(e.translation=t.translation),At(t.extras)&&(e.extras=t.extras),At(t.meshes)&&(e.mesh=t.meshes[0]),e.translation||e.rotation||e.scale){const t=function(t,e){if(e.matrix)return e.matrix;if(e.translation||e.scale||e.rotation){const n=w(Et,e.translation||Bt),r=U(dt,e.rotation||Ct),i=v(_t,e.scale||Tt);return F(i,r,i),F(t,n,i)}return L(t)}([],e);delete e.translation,delete e.rotation,delete e.scale,e.matrix=t}return e}p(t){const e={};for(const n in t){const r=t[n];let i,o;r.instanceTechnique&&r.instanceTechnique.values?(i=r.instanceTechnique,o=i.values.diffuse):(i=r,o=i.values.tex||i.values.diffuseTex||i.values.diffuse);const s={baseColorTexture:{index:o}};r.name&&(s.name=r.name),r.extensions&&(s.extensions=r.extensions),r.extras&&(s.extras=r.extras),e[n]=s}return e}R(t){if(t.bufferView||t.extensions&&(t.extensions.KHR_binary_glTF||t.extensions.binary_glTF)){const e=t.bufferView?t:t.extensions.KHR_binary_glTF||t.extensions.binary_glTF;t.extensions&&(t.mimeType=e.mimeType,t.width=e.width,t.height=e.height);const n=this.gltf.bufferViews[e.bufferView],r=(n.byteOffset||0)+this.glbBuffer.byteOffset,i=n.byteLength,o=this.buffers[e.bufferView]=new Uint8Array(this.glbBuffer.buffer,r,i);return this.getImageByBuffer(o,t)}return this.requestExternalImage(t)}I(t){const e=this.gltf.textures[t];if(!e)return null;const n=this.gltf.images[e.source];return this.R(n).then(t=>{const r=this.gltf.samplers[e.sampler];return{image:{array:t.data,width:t.width,height:t.height,index:e.source,mimeType:n.mimeType,name:n.name,extras:n.extras},sampler:r}})}getBaseColorTexture(t){const e=this.gltf.materials[t];let n,r;if(e.instanceTechnique&&e.instanceTechnique.values?(n=e.instanceTechnique,r=n.values.diffuse):(n=e,r=n.values.tex||n.values.diffuseTex||n.values.diffuse),void 0===r||void 0===this.gltf.textures)return null;const i=this.gltf.textures[r];if(!i)return null;const o=this.gltf.samplers[i.sampler];return{format:i.format||6408,internalFormat:i.internalFormat||6408,type:i.type||5121,sampler:o,source:this.gltf.images[i.source]}}getMaterial(){return null}getAnimations(){return null}}class Pt extends Rt{constructor(t,e,n,r,i,o){super(r,i,o),this.rootPath=t,this.gltf=e,this.glbBuffer=n,this.buffers={},this.requests={},this.accessor=new xt(t,e,n)}iterate(t,e){const n=this.gltf[e];if(n)for(let e=0;e<n.length;e++)t(e,n[e],e)}createNode(t){const e={};return lt(e,t),!At(t.weights)&&this.gltf.meshes&&At(e.mesh)?e.weights=this.gltf.meshes[e.mesh].weights:t.weights&&(e.weights=t.weights),e}I(t){const e=this.gltf.textures[t];if(!e)return null;let n=e.source;if(e.extensions&&e.extensions.EXT_texture_webp&&(n=e.extensions.EXT_texture_webp.source),!At(n))return null;const r=this.gltf.images[n];return this.R(r).then(t=>{if(!t)return null;const n={image:{array:t.data,mipmap:t.mipmap,width:t.width,height:t.height,index:e.source,mimeType:r.mimeType,name:r.name,extensions:r.extensions,extras:r.extras}};lt(n,e);const i=At(e.sampler)?this.gltf.samplers[e.sampler]:void 0;return i&&(n.sampler=i,n.sampler.magFilter=i.magFilter||9729,n.sampler.minFilter=i.minFilter||9729,n.sampler.wrapS=i.wrapS||10497,n.sampler.wrapT=i.wrapT||10497),t.format&&(n.format=t.format),n})}R(t){if(!At(t.bufferView))return this.requestExternalImage(t);{const e=this.gltf.bufferViews[t.bufferView],n=this.gltf.buffers[e.buffer];if(n.uri)return this.requestImageFromBufferURI(n,e,t);if(this.glbBuffer)return this.M(e,t)}return null}M(t,e){const n=this.l(t,this.glbBuffer.buffer,this.glbBuffer.byteOffset);return this.getImageByBuffer(n,e)}l(t,e,n){n=n||0;const r=t.byteOffset+n,i=t.byteLength;return new Uint8Array(e,r,i)}P(t,e){const n=new Array(t.byteLength);for(let e=0;e<t.byteLength;e++)n[e]=String.fromCharCode(t[e]);return n.join(""),"data:"+(e=e||"image/png")+";base64,"+function(t){return"undefined"!=typeof self?self.btoa(t):window.btoa(t)}(unescape(encodeURIComponent(n)))}getAnimations(t){const e=[];return t.forEach(t=>{e.push(this.getSamplers(t.samplers))}),Promise.all(e).then(e=>{for(let n=0;n<e.length;n++)t[n].samplers=e[n];return t})}getSamplers(t){const e=[];for(let n=0;n<t.length;n++)(At(t[n].input)||At(t[n].output))&&(e.push(this.accessor.B("input",t[n].input)),e.push(this.accessor.B("output",t[n].output)));return Promise.all(e).then(e=>{for(let n=0;n<e.length/2;n++)t[n].input=e[2*n],t[n].output=e[2*n+1],t[n].interpolation||(t[n].interpolation="LINEAR");return t})}}const Nt="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;class Dt{static read(t,e=0,n=0){n||(n=t.byteLength);const r=new DataView(t,e,n),i=r.getUint32(4,!0);if(1===i)return Dt.readV1(r,e);if(2===i)return Dt.readV2(t,e);throw new Error("Unsupported glb version : "+i)}static readV1(t,e){const n=t.getUint32(8,!0),r=t.getUint32(12,!0);if(n!==t.byteLength)throw new Error("Length in GLB header is inconsistent with glb's byte length.");const i=St(t.buffer,20+e,r);return{json:JSON.parse(i),glbBuffer:{byteOffset:20+e+r,buffer:t.buffer,byteLength:n}}}static readV2(t,e){let n,r,i;const o=new DataView(t,e+12);let s=0;for(;s<o.byteLength;){const a=o.getUint32(s,!0);s+=4;const c=o.getUint32(s,!0);if(s+=4,1313821514===c)n=St(t,e+12+s,a);else if(5130562===c){i=e+12+s,r=a;break}s+=a}return{json:JSON.parse(n),glbBuffer:{byteOffset:i,buffer:t,byteLength:r}}}}function St(t,e,n){if(Nt){const r=new Uint8Array(t,e,n);return Nt.decode(r)}return function(t){const e=t.length;let n="";for(let r=0;r<e;){let i=t[r++];if(128&i){let n=Ot[i>>3&7];if(!(64&i)||!n||r+n>e)return null;for(i&=63>>n;n>0;n-=1){const e=t[r++];if(128!=(192&e))return null;i=i<<6|63&e}}n+=String.fromCharCode(i)}return n}(new Uint8Array(t,e,n))}const Ot=[1,1,1,1,2,2,3,0],Lt=[0,0,0],Ft=[0,0,0,1],wt=[1,1,1],vt={TRANSLATION:[0,0,0],ROTATION:[0,0,0,1],SCALE:[1,1,1]},Ut={PREVIOUS:null,NEXT:null,PREINDEX:null,NEXTINDEX:null,INTERPOLATION:null},Gt={N(t,e,n,r,i,o,s,a){const c=At(t)?e.animations:[e.animations[0]],A={};for(let e=0;e<c.length;e++){const l=c[e],f=l.name||e;if(At(t)&&f!==t)continue;const h=l.channelsMap[n];if(h)for(let t=0;t<h.length;t++){const e=h[t];"translation"===e.target.path?(this.D(i,l.samplers[e.sampler],r,1),A.translation=K(Lt,i)):"rotation"===e.target.path?(this.S(o,l.samplers[e.sampler],r,1),A.rotation=st(Ft,o)):"scale"===e.target.path?(this.D(s,l.samplers[e.sampler],r,1),A.scale=K(wt,s)):"weights"===e.target.path&&a&&(this.D(a,l.samplers[e.sampler],r,a.length),A.weights=a)}}return A},D(t,e,n,r){switch(e.interpolation){case"LINEAR":{const i=this.O(Ut,e,n,1*r);i&&(t=function(t,e,n,r){for(let i=0;i<t.length;i++)t[i]=e[i]+r*(n[i]-e[i]);return t}(t,i.PREVIOUS,i.NEXT,i.INTERPOLATION));break}case"STEP":{const i=this.O(Ut,e,n,1*r);i&&(t=function(t,e){for(let n=0;n<t.length;n++)t[n]=e[n];return t}(t,...i.PREVIOUS));break}case"CUBICSPLINE":{const i=this.O(Ut,e,n,3*r);i&&(t=this.L(t,i,e.input.array,3*r));break}}return t},S(t,e,n){switch(e.interpolation){case"LINEAR":{const r=this.O(Ut,e,n,1);r&&it(t,r.PREVIOUS,r.NEXT,r.INTERPOLATION);break}case"STEP":{const r=this.O(Ut,e,n,1);r&&(t=tt(t,...r.PREVIOUS));break}case"CUBICSPLINE":{const r=this.O(Ut,e,n,3);if(r){for(let t=0;t<r.PREVIOUS.length;t++)r.PREVIOUS[t]=Math.acos(r.PREVIOUS[t]),r.NEXT[t]=Math.acos(r.NEXT[t]);t=this.L(t,r,e.input.array,3);for(let e=0;e<t.length;e++)t[e]=Math.cos(t[e])}break}}return t},F(t,e){const n=t.length;let r,i,o,s=0,a=n-1,c=Math.floor((s+a)/2);for(;s<=n-1&&a>=0;){if(s===a)return null;if(t[c]<=e&&e<=t[c+1]){const n=t[c];return r=c,i=c+1,o=(e-n)/(t[c+1]-n),{preIndx:r,nextIndex:i,interpolation:o}}e<t[c]?(a=c,c=Math.floor((s+a)/2)):t[c+1]<e&&(s=c,c=Math.floor((s+a)/2))}return null},O(t,e,n,r){const i=e.input.array,o=e.output.array,s=e.output.itemSize;(n<i[0]||n>i[i.length-1])&&(n=Math.max(i[0],Math.min(i[i.length-1],n))),n===i[i.length-1]&&(n=i[0]);const a=this.F(i,n);if(!a||!a.nextIndex)return null;const{preIndx:c,nextIndex:A,interpolation:l}=a;t.PREINDEX=c,t.NEXTINDEX=A,t.INTERPOLATION=l;const f=s*r;return t.PREVIOUS=o.subarray(t.PREINDEX*f,(t.PREINDEX+1)*f),t.NEXT=o.subarray(t.NEXTINDEX*f,(t.NEXTINDEX+1)*f),t},L(t,e,n,r){const i=e.INTERPOLATION,o=n[e.PREINDEX],s=n[e.NEXTINDEX];for(let n=0;n<3;n++){const a=e.PREVIOUS[r+n],c=(s-o)*e.PREVIOUS[2*r+n],A=e.NEXT[3+n],l=(s-o)*e.NEXT[n],f=(2*Math.pow(i,3)-3*Math.pow(i,2)+1)*a+(Math.pow(i,3)-2*Math.pow(i,2)+i)*c+(2*-Math.pow(i,3)+3*Math.pow(i,2))*A+(Math.pow(i,3)-Math.pow(i,2))*l;t[n]=f}return t},getAnimationClip(t,e,n,r){const i=t.nodes[e]&&t.nodes[e].weights;return k(Lt,...vt.TRANSLATION),tt(Ft,...vt.ROTATION),k(wt,...vt.SCALE),this.N(r,t,e,n,Lt,Ft,wt,i)},getTimeSpan(t){if(!t.animations)return null;if(t.timeSpan)return t.timeSpan;const e=t.animations;return t.timeSpan={},e.forEach((e,n)=>{let r=-1/0,i=1/0;const o=e.channels;for(let t=0;t<o.length;t++){const n=o[t],s=e.samplers[n.sampler].input.array;s[s.length-1]>r&&(r=s[s.length-1]),s[0]<i&&(i=s[0])}const s=e.name||n;t.timeSpan[s]={max:r,min:i}}),t.timeSpan},getTimeSpanByName(t,e){const n=this.getTimeSpan(t);return n?At(e)?n[e]:n[Object.keys(n)[0]]:null}};let Ht=!1;if("undefined"!=typeof OffscreenCanvas){let t;try{t=new OffscreenCanvas(2,2).getContext("2d")}catch(Xn){}t&&"undefined"!=typeof createImageBitmap&&(Ht=!0)}const Vt="undefined"==typeof document?null:document.createElement("canvas");class Kt{constructor(t,e,n){if(this.options=n||{},this.options.decoders||(this.options.decoders={}),e.buffer instanceof ArrayBuffer){const{json:n,glbBuffer:r}=Dt.read(e.buffer,e.byteOffset,e.byteLength);this.v(t,n,r)}else this.v(t,e);this.U=new xt(this.rootPath,this.gltf,this.glbBuffer),this.G()}G(){const t=this.gltf.extensionsRequired;if(t){if(t.indexOf("KHR_draco_mesh_compression")>=0&&!this.options.decoders.draco)throw new Error("KHR_draco_mesh_compression is required but @maptalks/transcoders.draco is not loaded");if(t.indexOf("KHR_texture_basisu")>=0&&!this.options.decoders.ktx2)throw new Error("KHR_texture_basisu is required but @maptalks/transcoders.ktx2 is not loaded")}}H(){const t=this.gltf.extensions;return t&&t.KHR_techniques_webgl?this.U.requestKHRTechniquesWebgl(t.KHR_techniques_webgl).then(e=>(t.KHR_techniques_webgl=e,t)):Promise.resolve(t)}load(t){t=t||{};const e=this.V(t),n=this.K(),r=this.k(),i=this.H();return Promise.all([e,n,r,i]).then(t=>(t[0].animations=t[1],t[0].textures=t[2],t[0].extensions=t[3],t[0].transferables=this.transferables||[],this.createChannelsMap(t[0]),t[0]))}createChannelsMap(t){const e=t.animations;if(e)for(let t=0;t<e.length;t++){const n=e[t];n.channelsMap={};for(let t=0;t<n.channels.length;t++){const e=n.channels[t];n.channelsMap[e.target.node]||(n.channelsMap[e.target.node]=[]),n.channelsMap[e.target.node].push(e)}}}getExternalResources(){const t=[];if(this.gltf){const{buffers:e,images:n}=this.gltf;for(let n=0;n<e.length;n++)e[n].uri&&e[n].uri.indexOf("data:application/octet-stream;base64")<0&&t.push({type:"buffer",uri:e[n].uri});for(let e=0;e<n.length;e++)n[e].uri&&n[e].uri.indexOf("data:image/")<0&&t.push({type:"image",uri:n[e].uri})}return t}static getAnimationClip(t,e,n,r){return Gt.getAnimationClip(t,e,n,r)}static getAnimationTimeSpan(t,e){return Gt.getTimeSpanByName(t,e)}static getTypedArrayCtor(t){return ft(t)}static readInterleavedArray(t,e,n,r,i,o,s){return mt(t,e,n,r,i,o,s)}v(t,e,n){this.gltf=e,this.glbBuffer=n,this.version=e.asset?+e.asset.version:1,this.rootPath=t,this.buffers={},this.requests={},this.options.requestImage=Ht?Yt.bind(this):this.options.requestImage||kt,this.options.transferable&&(this.transferables=[]),2===this.version?(this.adapter=new Pt(t,e,n,this.options.requestImage,this.options.decoders||{},this.options.supportedFormats||{}),this.adapter.iterate((t,e,n)=>{e.id="buffer_"+n},"buffers"),this.adapter.iterate((t,e,n)=>{e.id="image_"+n},"images"),this.adapter.iterate((t,e,n)=>{e.id="accessor_"+n},"accessors")):(this.adapter=new Mt(t,e,n,this.options.requestImage,this.options.decoders||{},this.options.supportedFormats||{}),this.adapter.iterate((t,e,n)=>{e.id="accessor_"+n},"accessors"),this.adapter.iterate((t,e,n)=>{e.id="image_"+n},"images"))}X(t,e){if(t.children&&t.children.length>0){if(!("number"==typeof(n=t.children[0])&&isFinite(n)||function(t){return!ct(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}(t.children[0])))return t;const r=t.children.map(t=>{const n=e[t];return n.nodeIndex=t,this.X(n,e)});t.children=r}var n;return t}V(t){return this.Y(t).then(t=>{const e=this.scenes=[];let n;for(const e in t)t[e]=this.X(t[e],t),t[e].nodeIndex=Number(e)?Number(e):e;this.adapter.iterate((r,i,o)=>{const s={};i.name&&(s.name=i.name),i.nodes&&(s.nodes=i.nodes.map(e=>t[e])),this.gltf.scene===r&&(n=o),e.push(s)},"scenes");const r={textures:this.gltf.textures,asset:this.gltf.asset,scene:n,scenes:e,nodes:t,meshes:this.meshes,materials:this.gltf.materials,skins:this.skins,extensionsRequired:this.gltf.extensionsRequired,extensionsUsed:this.gltf.extensionsUsed};if(this.gltf.extensions&&(r.extensions=this.gltf.extensions),1===this.version){const t=this.adapter.p(this.gltf.materials);r.materials=t}return r})}Y(t){return this.J(t).then(()=>{const t=this.nodes={};return this.adapter.iterate((e,n)=>{const r=this.adapter.createNode(n,this.meshes,this.skins);t[e]=r},"nodes"),t})}Z(){this.skins=[];const t=[];return this.adapter.iterate((e,n,r)=>{t.push(this.W(n).then(t=>{t.index=r,this.skins.push(t)}))},"skins"),t}W(t){const e=t.inverseBindMatrices;return this.adapter.accessor.B("inverseBindMatrices",e).then(e=>(t.inverseBindMatrices=e,e&&e.buffer&&this.transferables&&this.transferables.indexOf(e.buffer)<0&&this.transferables.push(e.buffer),t))}K(){const t=this.gltf.animations;return At(t)?this.adapter.getAnimations(t):null}J(t){this.meshes={};let e=[];return this.adapter.iterate((n,r,i)=>{e.push(this.j(r,t).then(t=>{t.index=i,this.meshes[n]=t}))},"meshes"),e=e.concat(this.Z()),Promise.all(e)}j(t,e){const n=t.primitives.map(t=>this.q(t,e)).filter(t=>!!t);return Promise.all(n).then(e=>{const n={};return lt(n,t),n.primitives=e,n})}k(){const t=this.gltf.textures;if(!t)return null;const e=[];for(const n in t)e.push(this.adapter.I(n));return Promise.all(e).then(e=>{if(this.transferables)for(let t=0;t<e.length;t++){const n=e[t].image.array;if(e[t]&&n){let t;t=n instanceof ImageBitmap?n:n.buffer,t&&this.transferables.indexOf(t)<0&&this.transferables.push(t)}}if(!Array.isArray(t)){const n={},r=Object.keys(t);for(let t=0;t<e.length;t++)e[t]&&(n[r[t]]=e[t]);return n}return e})}q(t,e){let n;const r=[],i=t.extensions;if(At(t.targets))for(let e=0;e<t.targets.length;e++){const n=t.targets[e];for(const t in n){const i=this.adapter.accessor.B(`morphTargets_${t}_${e}`,n[t]);i&&r.push(i)}}if(i&&i.KHR_draco_mesh_compression){if(!this.options.decoders.draco&&(!this.gltf.extensionsRequired||!this.gltf.extensionsRequired.indexOf("KHR_draco_mesh_compression")<0))return null;const t=this.options.decoders.draco,{bufferView:o,attributes:s}=i.KHR_draco_mesh_compression,a=this.gltf.bufferViews[o],c=this.U.T(a).then(n=>{const{buffer:r,byteOffset:i}=n;let{byteOffset:o}=a;const c=a.byteLength;o||(o=0);const A=new DataView(r,i+o,c),l={attributes:s,useUniqueIDs:!1,skipAttributeTransform:e.skipAttributeTransform};return t(A,l).then(t=>{const e=Object.values(t.attributes);return t.indices&&e.push(t.indices),e})});r.push(c),n=Promise.all(r)}else{const e=t.attributes;for(const t in e){const n=this.adapter.accessor.B(t,e[t]);n&&r.push(n)}if(At(t.indices)){const e=this.adapter.accessor.B("indices",t.indices);e&&r.push(e)}n=Promise.all(r)}return n.then(e=>{if(i&&i.KHR_draco_mesh_compression){const n=t.targets?t.targets.length:0;e[n]=e[n].concat(e.slice(0,n)),e=e[n]}let n,r;const o={attributes:e.reduce((t,e)=>{if("indices"===e.name)n=e;else if(e.name.indexOf("morphTargets_")>-1)r=r||{},r[e.name.slice(13)]=e;else{if(!("POSITION"!==e.name||e.min&&e.max)){const t=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0],{itemSize:r,array:i}=e,o=i.length/r;for(let e=0;e<o;e++)for(let o=0;o<r;o++){const s=e*r+o;i[s]<t[o]&&(t[o]=i[s]),i[s]>n[o]&&(n[o]=i[s])}if(e.quantization){const r=e.quantization,i=r.range/(1<<r.quantizationBits),o=r.minValues;J(t,t,i),X(t,t,o),J(n,n,i),X(n,n,o)}e.min=t,e.max=n}t[e.name]=e}return this.transferables&&e.array.buffer&&this.transferables.indexOf(e.array.buffer)<0&&this.transferables.push(e.array.buffer),t},{}),material:t.material};return n&&(o.indices=n),r&&(o.morphTargets=r),o.mode=At(t.mode)?t.mode:4,At(t.extras)&&(o.extras=t.extras),o})}}function kt(t,e){const n=new Image;n.crossOrigin="",n.onload=()=>{if(!Vt)return void e(new Error("There is no canvas to draw image!"));Vt.width=n.width,Vt.height=n.height;const t=Vt.getContext("2d",{willReadFrequently:!0});t.drawImage(n,0,0,n.width,n.height);const r=t.getImageData(0,0,n.width,n.height),i={width:n.width,height:n.height,data:new Uint8Array(r.data)};e(null,i)},n.onerror=function(t){e(t)},n.src=t}let Xt,zt;function Yt(t,e){Xt||(Xt=new OffscreenCanvas(2,2),zt=Xt.getContext("2d",{willReadFrequently:!0})),fetch(t).then(t=>t.arrayBuffer()).then(t=>{const e=new Blob([new Uint8Array(t)]);return createImageBitmap(e)}).then(t=>{let{width:n,height:r}=t;Jt(n)||(n=Zt(n)),Jt(r)||(r=Zt(r));const i=this.options.maxTextureSize;i&&(n=Math.min(i,n),r=Math.min(i,r)),Xt.width=n,Xt.height=r,zt.drawImage(t,0,0,n,r),t.close();const o=zt.getImageData(0,0,n,r);e(null,{width:n,height:r,data:new Uint8Array(o.data)})}).catch(t=>{console.warn(t),e(t)})}function Jt(t){return 0==(t&t-1)&&0!==t}function Zt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}const Wt="undefined"==typeof document?null:document.createElement("canvas");class jt extends i.worker.Actor{constructor(t,e){super(t),this.mapId=e}initialize(t){t(null)}loadTile(t,e,n){let r=null;e&&e.arraybuffer&&(r=[e.arraybuffer]);const i={mapId:this.mapId,layerId:t,command:"loadTile",params:e};this.send(i,r,n)}abortTileLoading(t,e,n){const r={mapId:this.mapId,layerId:t,command:"abortTileLoading",params:{url:e}};this.broadcast(r,null,n)}addLayer(t,e,n){const r={actorId:this.actorId,mapId:this.mapId,layerId:t,command:"addLayer",params:{options:e}};this.broadcast(r,null,n)}removeLayer(t,e){const n={mapId:this.mapId,layerId:t,command:"removeLayer"};this.broadcast(n,null,e)}requestImage({url:t},e){const n=new Image;n.onload=()=>{if(!this.isActive())return;if(!Wt)return void e(new Error("There is no canvas to draw image!"));const t=function(t){if(Qt(t.width)&&Qt(t.height))return t;let e=t.width,n=t.height;Qt(e)||(e=qt(e));Qt(n)||(n=qt(n));const r=document.createElement("canvas");r.width=e,r.height=n,r.getContext("2d").drawImage(t,0,0,e,n);const i=t.src,o=i.lastIndexOf("/")+1,s=i.substring(o);return console.warn(`Texture(${s})'s size is not power of two, resize from (${t.width}, ${t.height}) to (${e}, ${n})`),r}(n);Wt.width=t.width,Wt.height=t.height;const r=Wt.getContext("2d",{willReadFrequently:!0});r.drawImage(t,0,0,t.width,t.height);const i=r.getImageData(0,0,t.width,t.height),o={width:t.width,height:t.height,data:new Uint8Array(i.data)};e(null,o,[o.data.buffer])},n.onerror=function(t){e(t)},n.src=t}}function Qt(t){return 0==(t&t-1)&&0!==t}function qt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}class $t{constructor(t,e){this.max=t,this.currentSize=0,this.onRemove=e,this.reset()}reset(){if(this.data){const t=this.data.values();for(const e of t)this.onRemove(e)}return this.data=new Map,this.currentSize=0,this}clear(){this.reset(),delete this.onRemove}add(t,e){if(!e)return this;if(e.node&&e.node.memorySize&&(this.currentSize+=e.node.memorySize),this.has(t)){const n=this.data.get(t);n&&n.node&&n.node.memorySize&&(this.currentSize-=n.node.memorySize),this.data.delete(t),this.data.set(t,e)}else this.data.set(t,e);return this}shrink(){if(this.currentSize>this.max){const t=this.data.keys();let e=t.next();for(;this.currentSize>this.max&&void 0!==e.value;){if(!this.data.get(e.value).current){const t=this.getAndRemove(e.value);t&&this.onRemove(t)}e=t.next()}}}has(t){return this.data.has(t)}keys(){const t=new Array(this.data.size);let e=0;const n=this.data.keys();for(const r of n)t[e++]=r;return t}getAndRemove(t){if(!this.has(t))return null;const e=this.data.get(t);return e.node&&e.node.memorySize&&(this.currentSize-=e.node.memorySize),this.data.delete(t),e}get(t){if(!this.has(t))return null;const e=this.data.get(t);return this.data.delete(t),this.data.set(t,e),e}remove(t){if(!this.has(t))return this;const e=this.data.get(t);return e.node&&e.node.memorySize&&(this.currentSize-=e.node.memorySize),this.data.delete(t),this.onRemove(e),this}setMaxSize(t){return this.max=t,this.shrink(),this}getMemorySize(){let t=0;const e=this.data.values();for(const n of e){const e=n&&n.node;e&&e.memorySize&&(t+=e.memorySize)}return t}markAll(t){const e=this.data.values();for(const n of e)n.current=t}}function te(t,e){if(t.scenes&&t.scenes.length)for(let n=0,r=t.scenes.length;n<r;n++){const r=t.scenes[n].nodes;for(let n=0,i=r.length;n<i;n++){const i=[];ae(r[n],i,t,e)}}}const ee=[],ne=[],re=[],ie=[0,0,0],oe=rt([]),se=[1,1,1];function ae(t,e,n,r){const i=e.slice(0);if(t.matrix)i.push(t.matrix);else if(t.rotation||t.translation||t.scale){const e=w(ee,t.translation||ie),n=U(ne,t.rotation||oe),r=v(re,t.scale||se);F(r,n,r);const o=F([],e,r);i.push(o)}if(t.children&&t.children.length)for(let e=0,o=t.children.length;e<o;e++)ae(t.children[e],i,n,r);if(void 0!==t.mesh){const e=t.mesh,o=n.meshes[e];if(o){const t=i.slice(0),s=o.primitives;for(let i=0,o=s.length;i<o;i++){const o=s[i];o&&(o.matrices=t,r(o,e,i,n))}}}}function ce(t,e,n){let{byteOffset:r,byteStride:i}=e;const{componentType:o,itemSize:s}=e,a=e.array.buffer,c=o?Kt.getTypedArrayCtor(o):e.array.constructor;if(r=void 0===r?e.array.byteOffset:r,i=i||0,!i||i===s*c.BYTES_PER_ELEMENT&&r%c.BYTES_PER_ELEMENT==0){const e=new c(a,r+n*s*c.BYTES_PER_ELEMENT,s);return t.set(e),t}i||(i=s*c.BYTES_PER_ELEMENT);const A=new Uint8Array(a,i*n+r,s*c.BYTES_PER_ELEMENT);return new Uint8Array(t.buffer).set(A),t}function Ae(t,e,n,r){t[4*e]=n[r],t[4*e+1]=n[r+4],t[4*e+2]=n[r+8],t[4*e+3]=n[r+12]}const le=new Array(3),fe=new Array(3),he=[40680631590769,40680631590769,40408299984661.445];function ue(t,e,n,r){const i=he,o=Math.cos(n);le[0]=o*Math.cos(e),le[1]=o*Math.sin(e),le[2]=Math.sin(n),ye(le,le),Y(fe,i,le);const s=Math.sqrt(W(le,fe));var a,c,A;return c=fe,A=s,(a=fe)[0]=c[0]/A,a[1]=c[1]/A,a[2]=c[2]/A,J(le,le,r),X(t,fe,le)}const Ee=[1/6378137,1/6378137,1/6356752.314245179],de=[1/40680631590769,1/40680631590769,1/40408299984661.445],_e=new Array(3),Be=new Array(3),Ce=new Array(3);function Te(t,e){const n=de,r=function(t,e,n,r,i){const o=e[0],s=e[1],a=e[2],c=n[0],A=n[1],l=n[2],f=o*o*c*c,h=s*s*A*A,u=a*a*l*l,E=f+h+u,d=Math.sqrt(1/E),_=J(me,e,d);if(E<i)return isFinite(d)?_:void 0;const B=r[0],C=r[1],T=r[2],m=ge;m[0]=_[0]*B*2,m[1]=_[1]*C*2,m[2]=_[2]*T*2;let g,p,y,R,I,b,x,M,P,N,D,S=(1-d)*pe(e)/(.5*pe(m)),O=0;do{S-=O,y=1/(1+S*B),R=1/(1+S*C),I=1/(1+S*T),b=y*y,x=R*R,M=I*I,P=b*y,N=x*R,D=M*I,g=f*b+h*x+u*M-1,p=f*P*B+h*N*C+u*D*T;O=g/(-2*p)}while(Math.abs(g)>1e-12);return t[0]=o*y,t[1]=s*R,t[2]=a*I,t}(_e,e,Ee,n,.1);let i=q(Be,r,n);i=ye(i,i);const o=Q(Ce,e,r),s=Math.atan2(i[1],i[0]),a=Math.asin(i[2]),c=y(W(o,e))*pe(o);return t[0]=g(s),t[1]=g(a),t[2]=c,t}const me=new Array(3),ge=new Array(3);function pe(t){return H(t)}function ye(t,e){const n=e[0],r=e[1],i=e[2];let o=n*n+r*r+i*i;return o>0&&(o=Math.sqrt(o),t[0]=e[0]/o,t[1]=e[1]/o,t[2]=e[2]/o),t}function Re(t,e){return Y(e,t,de),Z(e,e)}function Ie(t,e){const n=t[0],r=t[1],i=Math.cos(r),o=i*Math.cos(n),s=i*Math.sin(n),a=Math.sin(r);return e.x=o,e.y=s,e.z=a,Z(e,e)}var be=Object.freeze({__proto__:null,radianToCartesian3:ue,cartesian3ToDegree:Te,normalizeCartesian:ye,geodeticSurfaceNormal:Re,geodeticSurfaceNormalCartographic:Ie});function xe(t,e,n,r){n=n||0,r=r||n;const i=Math.abs(t-e);return i<=r||i<=n*Math.max(Math.abs(t),Math.abs(e))}function Me(t,e){let n="";for(let r=0;r<4;r++){const i=t.getUint8(e+r);n+=String.fromCharCode(i)}return n}const Pe="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;function Ne(t,e,n){const r=new Uint8Array(t,e,n);return Pe?JSON.parse(Pe.decode(r)):JSON.parse(I(r))}function De(t,e,n){const r=new Uint8Array(t,e,n);return Pe?JSON.parse(Pe.decode(r)):JSON.parse(I(r))}function Se(t,e,n){return{offset:e,byteLength:n}}function Oe(t,e,n,r){const{byteOffset:i,componentType:o,type:s}=t,{ctor:a,type:c}=Ge(o||"UNSIGNED_SHORT"),A=ve(s);return{byteStride:0,byteOffset:i+n,itemSize:A,count:r*A,componentType:c,array:new a(e,n+i,r*A)}}function Le(t,e,n,r){const i=Oe(t,e,n,r);return i.array.buffer.byteLength!==e.byteLength&&(i.array=i.array.slice()),i}function Fe(t,e,n,r){const{byteOffset:i,componentType:o,type:s}=t,{ctor:a}=Ge(o||"UNSIGNED_SHORT"),c=ve(s),A=new a(e,i,n*c);return 1===c?A[r]:A.subarray(r*c,r*c+c)}const we={"SCALAR":1,"VEC2":2,"VEC3":3,"VEC4":4};function ve(t){return t?we[t]:1}const Ue={"BYTE":{ctor:Int8Array,type:5120,name:"Int8Array"},"UNSIGNED_BYTE":{ctor:Uint8Array,type:5121,name:"Uint8Array"},"SHORT":{ctor:Int16Array,type:5122,name:"Int16Array"},"UNSIGNED_SHORT":{ctor:Uint16Array,type:5123,name:"Uint16Array"},"INT":{ctor:Int32Array,type:5124,name:"Int32Array"},"UNSIGNED_INT":{ctor:Uint32Array,type:5125,name:"Uint32Array"},"FLOAT":{ctor:Float32Array,type:5126,name:"Float32Array"},"DOUBLE":{ctor:Float64Array,type:5126,name:"Float64Array"}};function Ge(t){return Ue[t]}function He(t){for(const e in Ue)if(t===Ue[e].ctor)return Ue[e].type;throw new Error("unrecognized ctor:"+t)}function Ve(t,e,n,r){const i=t,o=e.length/3;for(let t=0;t<o;t++)i[3*t]=e[3*t]/65535*r[0]+n[0],i[3*t+1]=e[3*t+1]/65535*r[1]+n[1],i[3*t+2]=e[3*t+2]/65535*r[2]+n[2];return i}function Ke(t,e,n){const r=t.getUint32(12,!0),i=t.getUint32(16,!0),o=t.getUint32(20,!0),s=t.getUint32(24,!0),a=t.buffer;let c,A={},l={},f=null;r>0&&(A=Ne(a,e,r),e+=r),i>0&&(c=function(t,e,n){return{offset:e,byteLength:n}}(0,e,i),e+=i),o>0&&(l=De(a,e,o),e+=o);const h=Se(0,e,s);return f=a.slice(h.offset,h.offset+h.byteLength),n.push(f),{featureTable:A,featureTableBin:c,batchTable:l,batchTableBin:f}}const ke={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Xe={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},ze={},Ye={east:[],north:[],up:[],west:[],south:[],down:[]};let Je=[],Ze=[],We=[];const je=[0,0,0];function Qe(t,e,n){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=e[0],n[13]=e[1],n[14]=e[2],n[15]=t[15],n}const qe=function(t,e){const n=ke[t][e];let r;const i=t+e;return ze[i]?r=ze[i]:(r=function(r,i,o){if(function(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],s=e[1],a=e[2];return Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-s)<=1e-6*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-a)<=1e-6*Math.max(1,Math.abs(i),Math.abs(a))}(r,je))K(Je,Xe[t]),K(Ze,Xe[e]),K(We,Xe[n]);else if(xe(r[0],0,1e-14)&&xe(r[1],0,1e-14)){const i=y(r[2]);K(Je,Xe[t]),"east"!==t&&"west"!==t&&J(Je,Je,i),K(Ze,Xe[e]),"east"!==e&&"west"!==e&&J(Ze,Ze,i),K(We,Xe[n]),"east"!==n&&"west"!==n&&J(We,We,i)}else{Re(r,Ye.up);const i=Ye.up,o=Ye.east;o[0]=-r[1],o[1]=r[0],o[2]=0,Z(Ye.east,o),j(Ye.north,i,o),J(Ye.down,Ye.up,-1),J(Ye.west,Ye.east,-1),J(Ye.south,Ye.north,-1),Je=Ye[t],Ze=Ye[e],We=Ye[n]}return o[0]=Je[0],o[1]=Je[1],o[2]=Je[2],o[3]=0,o[4]=Ze[0],o[5]=Ze[1],o[6]=Ze[2],o[7]=0,o[8]=We[0],o[9]=We[1],o[10]=We[2],o[11]=0,o[12]=r[0],o[13]=r[1],o[14]=r[2],o[15]=1,o},ze[i]=r),r}("east","north"),$e=[],tn=[],en=[],nn=[],rn=[],on=[],sn=[],an={x:0,y:0},cn={x:0,y:0},An=Math.PI/180;const ln={"programs":[{"attributes":["aPosition","instanceId","batchId","aTexCoord0","aTexCoord1","aNormal","aColor","uv2","uv3","uv4","secondary_colour","uv6"],"fragmentShader":1,"vertexShader":0}],"shaders":[{"type":35633,"content":"#include <gl2_vert>\n\nuniform mat4 czm_modelViewProjection;\n\nuniform mat4 czm_modelView;\n\nuniform mat3 czm_normal;\n\n\n\nattribute vec4 aPosition;\n\n\n\n#ifdef VertexColor\n\n attribute vec4 aColor;\n\n#endif\n\n#ifdef VertexNormal\n\n attribute vec3 aNormal;\n\n#endif\n\n#ifdef Instance\n\n attribute float instanceId;\n\n#else\n\n attribute float batchId;\n\n#endif\n\n\n\n#ifdef TexCoord\n\n attribute vec4 aTexCoord0;\n\n varying vec4 vTexCoord;\n\n uniform mat4 uTexMatrix;\n\n#ifdef COMPUTE_TEXCOORD\n\n uniform float uTexture0Width;\n\n varying vec4 vTexMatrix;\n\n varying vec4 vTexCoordTransform;\n\n varying vec2 vIsRGBA;\n\n#endif\n\n#endif\n\n\n\n#ifdef TexCoord2\n\n attribute vec4 aTexCoord1;\n\n uniform float uTexture1Width;\n\n varying vec4 vTexMatrix2;\n\n#endif\n\n#ifdef InstanceBim\n\n attribute vec4 uv2;\n\n attribute vec4 uv3;\n\n attribute vec4 uv4;\n\n attribute vec4 secondary_colour;\n\n attribute vec4 uv6;\n\n#endif\n\n\n\n uniform vec4 uFillForeColor;\n\n uniform vec4 uSelectedColor;\n\n varying vec4 vSecondColor;\n\n varying vec4 vPositionMC;\n\n varying vec3 vPositionEC;\n\n#ifdef VertexNormal\n\n varying vec3 vNormalEC;\n\n#endif\n\n varying vec4 vColor;\n\n\n\n const float SHIFT_LEFT8 = 256.0;\n\n const float SHIFT_RIGHT8 = 1.0 / 256.0;\n\n const float SHIFT_RIGHT4 = 1.0 / 16.0;\n\n const float SHIFT_LEFT4 = 16.0;\n\n void getTextureMatrixFromZValue(in float nZ, inout float XTran, inout float YTran, inout float scale, inout float isRGBA)\n\n {\n\n if(nZ <= 0.0)\n\n {\n\n return;\n\n }\n\n float nDel8 = floor(nZ * SHIFT_RIGHT8);\n\n float nDel16 = floor(nDel8 * SHIFT_RIGHT8);\n\n float nDel20 = floor(nDel16 * SHIFT_RIGHT4);\n\n isRGBA = floor(nDel20);\n\n YTran = nZ - nDel8 * SHIFT_LEFT8;\n\n XTran = nDel8 - nDel16 * SHIFT_LEFT8;\n\n float nLevel = nDel16 - nDel20 * SHIFT_LEFT4;\n\n scale = 1.0 / pow(2.0, nLevel);\n\n }\n\n\n\n void operation(vec4 operationType, vec4 color, vec4 selectedColor, inout vec4 vertexColor)\n\n {\n\n float right_2 = operationType.x * 0.5;\n\n float right_4 = right_2 * 0.5;\n\n float right_8 = right_4 * 0.5;\n\n float right_16 = right_8 * 0.5;\n\n float isSetColor = fract(right_2);\n\n if(isSetColor > 0.1)\n\n {\n\n vertexColor *= color;\n\n }\n\n float isPicked = fract(floor(right_2)* 0.5);\n\n if(isPicked > 0.1)\n\n {\n\n vertexColor *= selectedColor;\n\n }\n\n float isHide = fract(floor(right_4)* 0.5);\n\n if(isHide > 0.1)\n\n {\n\n vertexColor.a = 0.0;\n\n }\n\n }\n\n\n\n void main()\n\n {\n\n #ifdef TexCoord\n\n vTexCoord.xy = aTexCoord0.xy;\n\n #ifdef COMPUTE_TEXCOORD\n\n vTexMatrix = vec4(0.0,0.0,1.0,0.0);\n\n vIsRGBA.x = 0.0;\n\n vTexCoordTransform.x = aTexCoord0.z;\n\n if(vTexCoordTransform.x < -90000.0)\n\n {\n\n vTexMatrix.z = -1.0;\n\n }\n\n getTextureMatrixFromZValue(floor(vTexCoordTransform.x), vTexMatrix.x, vTexMatrix.y, vTexMatrix.z, vIsRGBA.x);\n\n vTexMatrix.w = log2(uTexture0Width * vTexMatrix.z);\n\n #endif\n\n #endif\n\n\n\n #ifdef TexCoord2\n\n vTexCoord.zw = aTexCoord1.xy;\n\n vTexMatrix2 = vec4(0.0,0.0,1.0,0.0);\n\n vIsRGBA.y = 0.0;\n\n vTexCoordTransform.y = aTexCoord1.z;\n\n if(vTexCoordTransform.y < -90000.0)\n\n {\n\n vTexMatrix2.z = -1.0;\n\n }\n\n getTextureMatrixFromZValue(floor(vTexCoordTransform.y), vTexMatrix2.x, vTexMatrix2.y, vTexMatrix2.z, vIsRGBA.y);\n\n vTexMatrix2.w = log2(uTexture1Width * vTexMatrix.z);\n\n #endif\n\n\n\n vec4 vertexPos = aPosition;\n\n vec4 vertexColor = uFillForeColor;\n\n#ifdef VertexColor\n\n vertexColor *= aColor / 255.0;\n\n#endif\n\n#ifdef VertexNormal\n\n vec3 normal = aNormal;\n\n#endif\n\n #ifdef InstanceBim\n\n mat4 worldMatrix;\n\n worldMatrix[0] = uv2;\n\n worldMatrix[1] = uv3;\n\n worldMatrix[2] = uv4;\n\n worldMatrix[3] = vec4(0, 0, 0, 1);\n\n vertexPos = vec4(vertexPos.xyz,1.0) * worldMatrix;\n\n vertexColor *= secondary_colour;\n\n #endif\n\n\n\n\n\n #ifdef Instance\n\n float index = instanceId;\n\n #else\n\n float index = batchId;\n\n #endif\n\n vec4 positionMC = vec4(vertexPos.xyz, 1.0);\n\n vColor = vertexColor;\n\n #ifdef VertexNormal\n\n vNormalEC = czm_normal * normal;\n\n #endif\n\n vPositionMC = positionMC;\n\n vPositionEC = (czm_modelView * positionMC).xyz;\n\n gl_Position = czm_modelViewProjection * vec4(vertexPos.xyz, 1.0);\n\n }\n\n"},{"type":35632,"content":"#ifdef GL_OES_standard_derivatives\n\n #extension GL_OES_standard_derivatives : enable\n\n #define support_standard_derivatives 1\n\n#endif\n\n#ifdef GL_EXT_shader_texture_lod\n\n #extension GL_EXT_shader_texture_lod : enable\n\n #define support_shader_texture_lod 1\n\n#endif\n\n\n\nprecision highp float;\n\n\n\n#include <gl2_frag>\n\n\n\n#if __VERSION__ == 300\n\n #define support_standard_derivatives 1\n\n #define support_shader_texture_lod 1\n\n#endif\n\n\n\n uniform vec3 czm_lightDirectionEC;\n\n uniform vec4 uDiffuseColor;\n\n#ifdef TexCoord\n\n varying vec4 vTexCoord;\n\n#ifdef COMPUTE_TEXCOORD\n\n uniform sampler2D uTexture;\n\n uniform highp float uTexture0Width;\n\n varying vec4 vTexCoordTransform;\n\n varying vec4 vTexMatrix;\n\n varying vec2 vIsRGBA;\n\n#endif\n\n#endif\n\n\n\n varying vec4 vColor;\n\n varying vec4 vPositionMC;\n\n varying vec3 vPositionEC;\n\n#ifdef VertexNormal\n\n varying vec3 vNormalEC;\n\n#endif\n\n#ifdef TexCoord2\n\n uniform sampler2D uTexture2;\n\n uniform float uTexture1Width;\n\n varying vec4 vTexMatrix2;\n\n#endif\n\n#ifdef COMPUTE_TEXCOORD\n\n void calculateMipLevel(in vec2 inTexCoord, in float vecTile, in float fMaxMip, inout float mipLevel)\n\n {\n\n vec2 dx = dFdx(inTexCoord * vecTile);\n\n vec2 dy = dFdy(inTexCoord * vecTile);\n\n float dotX = dot(dx, dx);\n\n float dotY = dot(dy, dy);\n\n float dMax = max(dotX, dotY);\n\n float dMin = min(dotX, dotY);\n\n float offset = (dMax - dMin) / (dMax + dMin);\n\n offset = clamp(offset, 0.0, 1.0);\n\n float d = dMax * (1.0 - offset) + dMin * offset;\n\n mipLevel = 0.5 * log2(d);\n\n mipLevel = clamp(mipLevel, 0.0, fMaxMip - 1.62);\n\n }\n\n\n\n void calculateTexCoord(in vec3 inTexCoord, in float scale, in float XTran, in float YTran, in float fTile, in float mipLevel, inout vec2 outTexCoord)\n\n {\n\n if(inTexCoord.z < -9000.0)\n\n {\n\n outTexCoord = inTexCoord.xy;\n\n }\n\n else\n\n {\n\n vec2 fTexCoord = fract(inTexCoord.xy);\n\n float offset = 1.0 * pow(2.0, mipLevel) / fTile;\n\n fTexCoord = clamp(fTexCoord, offset, 1.0 - offset);\n\n outTexCoord.x = (fTexCoord.x + XTran) * scale;\n\n outTexCoord.y = (fTexCoord.y + YTran) * scale;\n\n }\n\n }\n\n\n\n vec4 getTexColorForS3M(sampler2D curTexture, vec3 oriTexCoord, float texTileWidth, float fMaxMipLev, float fTexCoordScale, vec2 vecTexCoordTranslate, float isRGBA)\n\n {\n\n vec4 color = vec4(1.0);\n\n float mipLevel = 0.0;\n\n #ifdef support_standard_derivatives\n\n calculateMipLevel(oriTexCoord.xy, texTileWidth, fMaxMipLev, mipLevel);\n\n #endif\n\n vec2 realTexCoord;\n\n calculateTexCoord(oriTexCoord, fTexCoordScale, vecTexCoordTranslate.x, vecTexCoordTranslate.y, texTileWidth, mipLevel, realTexCoord);\n\n if(isRGBA > 0.5)\n\n {\n\n vec2 rgbTexCoord;\n\n rgbTexCoord.x = (realTexCoord.x + vecTexCoordTranslate.x * fTexCoordScale) * 0.5;\n\n rgbTexCoord.y = (realTexCoord.y + vecTexCoordTranslate.y * fTexCoordScale) * 0.5;\n\n color = texture2D(curTexture, rgbTexCoord.xy, -10.0);\n\n vec2 vecAlphaTexCoord;\n\n vecAlphaTexCoord.x = rgbTexCoord.x;\n\n vecAlphaTexCoord.y = rgbTexCoord.y + fTexCoordScale * 0.5;\n\n color.a = texture2D(curTexture, vecAlphaTexCoord.xy, -10.0).r;\n\n }\n\n else\n\n {\n\n if(oriTexCoord.z < -9000.0)\n\n {\n\n color = texture2D(curTexture, realTexCoord.xy);\n\n }\n\n else\n\n {\n\n #ifdef support_shader_texture_lod\n\n color = texture2DLodEXT(curTexture, realTexCoord.xy, mipLevel);\n\n #else\n\n color = texture2D(curTexture, realTexCoord.xy, mipLevel);\n\n #endif\n\n }\n\n }\n\n\n\n return color;\n\n }\n\n\n\n vec4 getTextureColor()\n\n {\n\n if(vTexMatrix.z < 0.0)\n\n {\n\n return vec4(1.0);\n\n }\n\n float texTileWidth0 = vTexMatrix.z * uTexture0Width;\n\n vec3 realTexCoord = vec3(vTexCoord.xy, vTexCoordTransform.x);\n\n vec4 FColor = getTexColorForS3M(uTexture, realTexCoord, texTileWidth0, vTexMatrix.w, vTexMatrix.z, vTexMatrix.xy, vIsRGBA.x);\n\n #ifdef TexCoord2\n\n float texTileWidth1 = vTexMatrix2.z * uTexture1Width;\n\n realTexCoord = vec3(vTexCoord.zw, vTexCoordTransform.y);\n\n vec4 SColor = getTexColorForS3M(uTexture2, realTexCoord, texTileWidth1, vTexMatrix2.w, vTexMatrix2.z, vTexMatrix2.xy, vIsRGBA.y);\n\n SColor.r = clamp(SColor.r, 0.0, 1.0);\n\n SColor.g = clamp(SColor.g, 0.0, 1.0);\n\n SColor.b = clamp(SColor.b, 0.0, 1.0);\n\n return FColor * SColor;\n\n #else\n\n return FColor;\n\n #endif\n\n }\n\n#endif\n\n vec4 SRGBtoLINEAR4(vec4 srgbIn)\n\n {\n\n #ifndef HDR\n\n vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\n\n return vec4(linearOut, srgbIn.a);\n\n #else\n\n return srgbIn;\n\n #endif\n\n }\n\n vec3 LINEARtoSRGB(vec3 linearIn)\n\n {\n\n #ifndef HDR\n\n return pow(linearIn, vec3(1.0/2.2));\n\n #else\n\n return linearIn;\n\n #endif\n\n }\n\n\n\n vec3 computeNormal(in vec3 oriVertex)\n\n {\n\n vec3 normal = cross(vec3(dFdx(oriVertex.x), dFdx(oriVertex.y), dFdx(oriVertex.z)), vec3(dFdy(oriVertex.x), dFdy(oriVertex.y), dFdy(oriVertex.z)));\n\n normal = normalize(normal);\n\n return normal;\n\n }\n\n\n\n void main()\n\n {\n\n if(vColor.a < 0.1)\n\n {\n\n discard;\n\n }\n\n vec4 baseColorWithAlpha = vColor;\n\n #ifdef COMPUTE_TEXCOORD\n\n baseColorWithAlpha *= SRGBtoLINEAR4(getTextureColor());\n\n #endif\n\n\n\n if(baseColorWithAlpha.a < 0.1)\n\n {\n\n discard;\n\n }\n\n vec3 normal = vec3(0.0);\n\n #ifdef VertexNormal\n\n normal = normalize(vNormalEC);\n\n #endif\n\n normal = length(normal) > 0.1 ? normal : computeNormal(vPositionMC.xyz);\n\n vec3 color = baseColorWithAlpha.rgb;\n\n vec3 dirVectorEC = normalize(czm_lightDirectionEC);\n\n float dotProduct = dot( normal, dirVectorEC );\n\n float dirDiffuseWeight = max( dotProduct, 0.0 );\n\n dirDiffuseWeight = dirDiffuseWeight * 0.5 + 0.5;\n\n color += color * uDiffuseColor.rgb * dirDiffuseWeight;\n\n #ifdef TexCoord\n\n color = LINEARtoSRGB(color);\n\n #endif\n\n glFragColor = vec4(color, baseColorWithAlpha.a);\n\n#if __VERSION__ == 100\n\n gl_FragColor = glFragColor;\n\n#endif\n\n }\n\n"}],"techniques":[{"attributes":{"aPosition":{"semantic":"POSITION","type":35666},"instanceId":{"semantic":"instanceId","type":5126},"batchId":{"semantic":"_BATCHID","type":5126},"aTexCoord0":{"semantic":"TEXCOORD_0","type":35664},"aTexCoord1":{"semantic":"aTexCoord1","type":35666},"aNormal":{"semantic":"aNormal","type":35665},"aColor":{"semantic":"COLOR_0","type":35666},"uv2":{"semantic":"uv2","type":35666},"uv3":{"semantic":"uv3","type":35666},"uv4":{"semantic":"uv4","type":35666},"secondary_colour":{"semantic":"secondary_colour","type":35666},"uv6":{"semantic":"uv6","type":35666},"TextureCoordMatrix":{"semantic":"TextureCoordMatrix","type":35664}},"program":0,"uniforms":{"czm_modelView":{"type":35676,"semantic":"MODELVIEW"},"czm_normal":{"type":35675,"semantic":"MODELINVERSETRANSPOSE"},"czm_modelViewProjection":{"type":35676,"semantic":"MODELVIEWPROJECTION"},"uTexMatrix":{"type":35676},"uTexture0Width":{"type":5126},"uFillForeColor":{"type":35666},"uSelectedColor":{"type":35666},"uDiffuseColor":{"type":35666},"uTexture":{"type":35678},"uTexture2":{"type":35678},"uTexture1Width":{"type":5126}}}]};const{getTextureMagFilter:fn,getTextureMinFilter:hn,getTextureWrap:un,getMaterialType:En,getMaterialFormat:dn,getPrimitive:_n,getUniqueREGLBuffer:Bn}=n.reshader.REGLHelper,Cn=[1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1],Tn=[0,0,1,0,0,1,0,0,-1,0,0,0,0,0,0,1],{loginIBLResOnCanvas:mn,logoutIBLResOnCanvas:gn,getIBLResOnCanvas:pn,getPBRUniforms:yn}=n.reshader.pbr.PBRUtils,Rn={factor:0,units:0},In={specularStrength:0,materialShininess:1},bn=[1,1,1],xn=n.mat4.identity([]),Mn=t=>t.material instanceof n.reshader.PhongMaterial,Pn=t=>t.material instanceof n.reshader.pbr.StandardMaterial,Nn=[!0,!0,!0,!0],Dn=[],Sn=new i.Coordinate(0,0),On=new i.Point(0,0),Ln=new i.Point(0,0),Fn=new i.Point(0,0),wn=[],vn=[],Un=[],Gn=[],Hn={"POSITION":"POSITION","NORMAL":"NORMAL","TEXCOORD_0":"TEXCOORD_0","TEXCOORD_1":"TEXCOORD_1","COLOR_0":"COLOR_0","TANGENT":"TANGENT","_BATCHID":"_BATCHID"};class Vn{constructor(t,e){this.$=e,this.tt=e.getRenderer().canvas,this.pickingFBO=e.getRenderer().pickingFBO,this.et=new i.SpatialReference,this.nt=t,this.rt=new n.reshader.Renderer(t),this.it={},this.ot={},this.st={},this.ct={},this.At={},this.lt={},this.ft={},this.ht=new n.reshader.Scene,this.ut=new n.reshader.Scene,this.Et=new n.reshader.Scene,this.dt=new n.reshader.Scene,this._t=new n.reshader.ResourceLoader(t.texture(2)),this.Bt=this.Ct.bind(this),this.Tt=new n.reshader.PhongMaterial({"baseColorFactor":[1,1,1,1]}),this.gt(),this.pt=new n.reshader.KHRTechniquesWebglManager(this.nt,this.yt(),this._t);const r=this.getMap();r.altitudeToPoint&&(this.Rt=r.altitudeToPoint(100,r.getGLRes())/100)}getI3DMMeshes(){return this.At}getPNTSMeshes(){return this.ct}getB3DMMeshes(){return this.st}getPaintedMeshes(){return this.It}getMap(){return this.$.getMap()}paint(t,e,r){const i=r&&r.renderTarget,o=r&&r.sceneFilter,s=this.getMap();if(!t.length||!s)return null;const a=this.bt(),c=s.projViewMatrix,A=this.$.options.services,f=[],h=[],u=[],E=[],d=[],_=this.xt(t);for(let i=0,o=t.length;i<o;i++){const o=t[i].data.node;let s=this.Mt(o);if(!s)continue;this.lt[o.id]&&(s=this.lt[o.id],s=x(s));let a=A[o.Pt].polygonOffset||Rn;B(a)&&(a=a()),Array.isArray(s)||(f[0]=s,s=f);for(let t=0,i=s.length;t<i;t++){const i=s[t].properties.magic;if("b3dm"===i){if(s[t].getBoundingBox&&!l(c,s[t].getBoundingBox()))continue;const{batchIdData:e,batchIdMap:i}=s[t].geometry.properties;if(e&&i){const e=s[t].properties.node.Pt;this.Nt&&this.Nt[e]&&n.HighlightUtil.highlightMesh(this.nt,s[t],this.Nt[e],this.Dt,i),n.HighlightUtil.showOnly(this.nt,s[t],this.St&&this.St[e],this.Ot,i)}r&&r.bloom&&s[t].properties.hlBloomMesh&&(s[t].properties.hlBloomMesh.properties.depthFunc="always",s[t].properties.hlBloomMesh.properties.polygonOffset=a,u.push(s[t].properties.hlBloomMesh)),u.push(s[t])}else"pnts"===i?E.push(s[t]):"i3dm"===i&&d.push(s[t]);s[t].properties.isLeaf=!!e[o.id],s[t].properties.level=_.get(o.Lt),s[t].properties.polygonOffset=a,s[t].Ft=o,e[o.id]||h.push(s[t]),this.wt(s[t])}}let C=0;const T=this.pt.getExcludeFilter();C+=this.vt(this.Ut,a,[o,Mn,T],i,h,u,d),C+=this.vt(this.Gt,a,[o,Pn,T],i,h,u,d),this.pt.forEachShader((t,e,n)=>{const r=this.bt(n);C+=this.vt(t,r,[o,e],i,h,u,d)}),this.ut.setMeshes(E);const m=this.Ht();return C+=this.rt.render(this.Vt,m,this.ut,i&&i.fbo),this.It={pntsMeshes:E,i3dmMeshes:d,b3dmMeshes:u},C}vt(t,e,n,r,i,o,s){t.filter=n.filter(t=>!!t),e.debug=!1,e.stencilEnable=!0,e.debug=!1,e.cullFace="back",e.colorMask=Nn;let a=0;return this.ht.setMeshes(o),a+=this.rt.render(t,e,this.ht,r&&r.fbo),e.stencilEnable=!0,this.Et.setMeshes(s),a+=this.rt.render(t,e,this.Et,r&&r.fbo),a}Kt(t,e){return e.Ft.kt-t.Ft.kt}paintRegion(t,e,n,r,i){const o=this.getMap();if(!t.length&&!e.length)return;const s=o.projViewMatrix,a=[];for(let n=0,r=(t=t.concat(e)).length;n<r;n++){const e=t[n].node,r=this.Xt(e);r&&(r.getBoundingBox&&!l(s,r.getBoundingBox())||a.push(r))}this.zt.filter=r,this.dt.setMeshes(a);const c=this.Yt(n);this.rt.render(this.zt,c,this.dt,i&&i.fbo)}deleteTile(t){const e=t.node.id;this.Jt(e)}Jt(t){const e=this.ot[t];e&&(e.geometry.dispose(),e.dispose(),delete this.ot[t]);const n=this.st[t]||this.ct[t]||this.At[t]||this.lt[t]||this.it[t];this.lt[t]?this.Zt(t):n&&(this.Wt(n),delete this.st[t],delete this.ct[t],delete this.At[t],delete this.it[t])}Zt(t){let e=this.lt[t];e=x(e);for(let t=0;t<e.length;t++){const{id:n}=e[t].properties;this.Jt(n)}delete this.lt[t]}Wt(t){if(Array.isArray(t))for(let e=0,n=t.length;e<n;e++)this.Wt(t[e]);else{n.HighlightUtil.showOnly(this.nt,t),n.HighlightUtil.highlightMesh(this.nt,t);const e=t.geometry.properties.url;if(e){const t=this.ft[e];t&&(t.refCount--,t.refCount<=0&&(t.geometry.dispose(),t.material.dispose(),delete this.ft[e]))}else t.geometry.dispose(),t.material&&t.material.dispose();t.dispose()}}remove(){const t=this.$;gn(t.getRenderer().canvas,t.getMap());for(const t in this.lt)this.Zt(t);this.lt={};for(const t in this.st)this.Jt(t);this.st={};for(const t in this.ct)this.Jt(t);this.ct={};for(const t in this.At)this.Jt(t);this.At={};for(const t in this.it)this.Jt(t);this.it={};for(const t in this.ot)this.Jt(t);this.ot={},this.Ut&&(this.Ut.dispose(),delete this.Ut),this.Gt&&(this.Gt.dispose(),delete this.Gt),this.Vt&&(this.Vt.dispose(),delete this.Vt),this.zt&&(this.zt.dispose(),delete this.zt),this.pt.dispose(),this.picking&&this.picking.dispose()}Xt(t){if(!t.boundingVolume||!t.boundingVolume.region)return null;if(this.ot[t.id])return this.ot[t.id];const e=t.boundingVolume.region;let r=new i.Coordinate(g(e[0]),g(e[1])),o=new i.Coordinate(g(e[2]),g(e[3]));r=this.jt(r),o=this.jt(o);const s=r.add(o).Qt(.5);r._sub(s),o._sub(s);const a=this.qt(e[4],e[5]),c=a.x,A=a.y,l=[r.x,r.y,A,o.x,r.y,A,o.x,o.y,A,r.x,o.y,A,r.x,r.y,c,o.x,r.y,c,o.x,o.y,c,r.x,o.y,c],f=new n.reshader.Geometry({aPosition:l},[0,1,1,2,2,3,3,0,0,4,1,5,2,6,3,7,4,5,5,6,6,7,7,4],0,{primitive:"lines"});f.generateBuffers(this.nt);const h=new n.reshader.Mesh(f),u=n.mat4.identity([]);return h.setLocalTransform(n.mat4.translate(u,u,[s.x,s.y,0])),this.ot[t.id]=h,h}Mt(t){return this.st[t.id]||this.ct[t.id]||this.At[t.id]||this.lt[t.id]}has(t){return this.Mt(t)||this.it[t.id]}createPntsMesh(t,e,r,i){if(this.ct[e]){const t=this.ct[e];return console.warn(`pnts mesh with id(${e}) was already created.`),i(null,{id:e,mesh:t}),t}const{pnts:o,featureTable:s,rootIdx:a}=t,c=this.$.options.services[a],A=s.POINTS_LENGTH,l=new n.reshader.Geometry(o,null,A,{primitive:"points",positionAttribute:"POSITION"});l.generateBuffers(this.nt);const f={};o.POSITION?f.HAS_POSITION=1:o.POSITION_QUANTIZED&&(f.HAS_POSITION_QUANTIZED=1),o.RGB?f.HAS_RGB=1:o.RGBA?f.HAS_RGBA=1:o.RGB565&&(f.HAS_RGB565=1),(o.NORMAL||o.NORMAL_OCT16P)&&(f.HAS_NORMAL=1,o.NORMAL_OCT16P&&(f.HAS_NORMAL_OCT16P=1)),t.featureTable.CONSTANT_RGBA&&(t.featureTable.CONSTANT_RGBA=t.featureTable.CONSTANT_RGBA.map(t=>t/255));const{rtcCenter:h,rtcCoord:u}=t,E=this.$t(Un,u),d=this.te([],r,h,u);n.mat4.multiply(d,d,E);const _=this.$.options.services[a],B=new n.reshader.Mesh(l);if(B.properties.magic="pnts",B.properties.id=e,B.properties.node=r,B.properties.count=A,B.properties.batchTable=t.batchTable,B.properties.batchTableBin=t.batchTableBin,B.properties.serviceIndex=a,B.setDefines(f),Object.defineProperty(B.uniforms,"pointColor",{enumerable:!0,get:function(){return t.featureTable.CONSTANT_RGBA?t.featureTable.CONSTANT_RGBA:_&&_.pointColor||[1,1,1,1]}}),Object.defineProperty(B.uniforms,"pointSize",{enumerable:!0,get:function(){return _&&_.pointSize||2}}),Object.defineProperty(B.uniforms,"pointOpacity",{enumerable:!0,get:function(){return _&&_.pointOpacity||1}}),c.coordOffset){const t=this.ee(r.Pt,u);n.mat4.multiply(d,t,d)}return B.setLocalTransform(d),this.ct[e]=B,i(null,{id:e,mesh:[B]}),[B]}createI3DMMesh(t,e,r,i){if(this.At[e]){const t=this.At[e];return console.warn(`i3dm mesh with id(${e}) was already created.`),this.it[e]||i(null,{id:e,mesh:t}),t}const o=this.$.options.services[r.Pt],s=this.ne(r.re),{i3dm:a,featureTable:c,gltf:A,batchTable:l,batchTableBin:f,count:h}=t,u=c.INSTANCES_LENGTH,{rtcCenter:E,rtcCoord:d}=t,_=this.$t(Un,d),B=this.te(Gn,r,E,d);n.mat4.multiply(_,B,_);const{POSITION:C,NORMAL_UP:T,NORMAL_RIGHT:m,SCALE:g,SCALE_NON_UNIFORM:p,INSTANCE_ROTATION:y}=a,R={"instance_vectorA":new Float32Array(4*u),"instance_vectorB":new Float32Array(4*u),"instance_vectorC":new Float32Array(4*u)},I=new Float32Array(3),x=new Float32Array(3),M=[],P=new Float32Array(1),N=new Float32Array(3),D=[],S=[],O=[],L=[],F=new Float32Array(9);!function(t,e){let{byteOffset:n,byteStride:r,count:i}=t;const{componentType:o,itemSize:s}=t,a=t.array.buffer,c=o?Kt.getTypedArrayCtor(o):t.array.constructor;if(n=void 0===n?t.array.byteOffset:n,r=r||0,i=i||t.array.length/s,(!r||r===s*c.BYTES_PER_ELEMENT)&&n%c.BYTES_PER_ELEMENT==0){const t=new c(a,n,i*s);for(let r=0;r<i*s;r+=s){e(new c(t.buffer,n+r*c.BYTES_PER_ELEMENT,s),r/s)}return}const A=new Uint8Array(s*c.BYTES_PER_ELEMENT);r||(r=s*c.BYTES_PER_ELEMENT);for(let t=0;t<i;t++){const i=new Uint8Array(a,r*t+n,s*c.BYTES_PER_ELEMENT);A.set(i);e(new c(A.buffer),t),i.set(A)}}(C,(t,e)=>{T?(ce(x,m,e),ce(I,T,e),n.vec3.cross(M,x,I),n.vec3.normalize(M,M),b(D,x,0),b(D,I,1),b(D,M,2),n.quat.fromMat3(S,D)):y?(ce(F,y,e),n.quat.fromMat3(S,F)):n.quat.identity(S),g?(ce(P,g,e),n.vec3.set(O,P[0],P[0],P[0])):p?(ce(N,p,e),n.vec3.set(O,...N)):n.vec3.set(O,1,1,1),n.mat4.fromRotationTranslationScale(L,S,t,O),Ae(R.instance_vectorA,e,L,0),Ae(R.instance_vectorB,e,L,1),Ae(R.instance_vectorC,e,L,2)});const w={};for(const t in R)w[t]={buffer:this.nt.buffer({dimension:R[t].length/u,data:R[t]}),divisor:1};const v=o.shader||"phong";let U=0,G=!0;const H=[];return te(A,(t,i,a,c)=>{const{geometry:A,material:E}=this.ie(t,i,a,c,r,!0,v);E&&!E.isReady()&&(G=!1,U++);const B=new n.reshader.InstancedMesh(w,u,A,E);B.properties.magic="i3dm",B.properties.id=e,B.properties.count=h,B.properties.batchTable=l,B.properties.batchTableBin=f,B.properties.serviceIndex=r.Pt;const C=this.oe(t,A,E,r.Pt,c);this.se(B,t.attributes);const T=n.mat4.identity([]);if(t.matrices&&t.matrices.length)for(let e=0;e<t.matrices.length;e++)n.mat4.multiply(T,T,t.matrices[e]);let m;if(n.mat4.multiply(T,s,T),B.setPositionMatrix(T),o.coordOffset){const t=this.ee(r.Pt,d);m=n.mat4.multiply([],t,_)}else m=n.mat4.copy([],_);B.setLocalTransform(m),B.setDefines(C),B.properties.polygonOffset={offset:0,factor:0},H.push(B),delete t.attributes}),G?(this.At[e]=H,i(null,{id:e,mesh:H})):(this.it[e]={meshes:H,count:U},H.ae=i),H}createB3DMMesh(t,e,r,o){if(this.st[e]||this.it[e]){const t=this.st[e];return console.warn(`mesh with id(${e}) was already created.`),this.it[e]||o(null,{id:e,mesh:t}),t}let s;if(r.maxExtent){const t=new i.Extent(r.maxExtent).convertTo(t=>this._pointToPrj(t));s=[t.xmin,t.ymin,t.xmax,t.ymax]}const a=t.gltf,{projCenter:c}=a.extensions.MAPTALKS_RTC,{rtcCoord:A,center:l}=a.extensions.CESIUM_RTC,f=this.ne(r.re);let h;h=a.asset&&a.asset.sharePosition?this.$t(Un,A):this.ce(Un,A,c,r.Pt);const u=this.$.options.services[r.Pt];let E=u.shader||"pbr";if(a.materials)for(let t=0;t<a.materials.length;t++)if(a.materials[t]&&a.materials[t].extensions&&a.materials[t].extensions.KHR_materials_unlit){E=u.shader="phong";break}const d=[];let _=0,B=!0;return te(a,(i,o,a,c)=>{const{geometry:C,material:m}=this.ie(i,o,a,c,r,!1,E);m&&!m.isReady()&&(B=!1,_++);const g=new n.reshader.Mesh(C,m);g.properties.magic="b3dm",g.properties.id=e,g.properties.node=r,g.properties.batchTable=t.batchTable,g.properties.batchTableBin=t.batchTableBin,g.properties.count=t.featureTable.BATCH_LENGTH,g.properties.serviceIndex=r.Pt;const p=this.oe(i,C,m,r.Pt,c);g.setDefines(p);const y=i.compressUniforms;if(y)for(const t in y)g.setUniform(t,y[t]);this.se(g,i.attributes),s&&(p.USE_MAX_EXTENT=1,g.setUniform("maxPrjExtent",s)),Object.prototype.hasOwnProperty.call(g.uniforms,"polygonOpacity")||Object.defineProperty(g.uniforms,"polygonOpacity",{enumerable:!0,get:function(){return T(u.opacity)?u.opacity:1}});const R=n.mat4.identity([]);if(c.asset.sharePosition&&i.matrices&&i.matrices.length)for(let t=0;t<i.matrices.length;t++)n.mat4.multiply(R,R,i.matrices[t]);if(c.asset.sharePosition){const t=this.te(Gn,r,l,A);n.mat4.multiply(R,f,R),n.mat4.multiply(R,h,R),n.mat4.multiply(R,t,R)}else n.mat4.multiply(R,h,R);if(u.coordOffset){const t=this.ee([],r.Pt,A);n.mat4.multiply(R,t,R)}g.setLocalTransform(R),d.push(g),delete i.attributes}),B?(this.st[e]=d,o(null,{id:e,mesh:d})):(this.it[e]={meshes:d,count:_},d.ae=o),d}se(t,e){if(e&&e.TEXCOORD_0&&e.TEXCOORD_0.extensions&&e.TEXCOORD_0.extensions.WEB3D_quantized_attributes){const n=e.TEXCOORD_0.extensions.WEB3D_quantized_attributes.decodeMatrix;t.setUniform("decodeMatrix",n)}}te(t,e,r,o){const s=this.getMap(),a=this.$.options.services[e.Pt].heightOffset||0,c=new i.Coordinate(o);let A;A=s.altitudeToPoint?this.Rt:s.distanceToPointAtRes(100,100,s.getGLRes(),c).y/100;const l=e.matrix?n.mat4.copy(t,e.matrix):n.mat4.identity(t);if(r){Qe(l,n.vec3.transformMat4(Dn,r,l),l)}const f=function(t,e,n,r,i,o,s){e=K($e,e);const a=ue($e,e[0]*An,e[1]*An,e[2]),c=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}(tn,n),A=r.ellipsoid;let l;l=0===$(c)?k(en,0,0,-6378137):Te(en,c),an.x=l[0],an.y=l[1];const f=r.project(an,cn);nn[0]=f.x/i,nn[1]=f.y/i,nn[2]=(l[2]+s)*o;const h=qe(a,A,rn),u=function(t,e,n){const r=t[0],i=t[1],o=t[2],s=t[4],a=t[5],c=t[6],A=t[8],l=t[9],f=t[10],h=e[0],u=e[1],E=e[2],d=e[3],_=e[4],B=e[5],C=e[6],T=e[7],m=e[8],g=r*h+s*u+A*E,p=i*h+a*u+l*E,y=o*h+c*u+f*E,R=r*d+s*_+A*B,I=i*d+a*_+l*B,b=o*d+c*_+f*B,x=r*C+s*T+A*m,M=i*C+a*T+l*m,P=o*C+c*T+f*m;return n[0]=g,n[1]=p,n[2]=y,n[3]=0,n[4]=R,n[5]=I,n[6]=b,n[7]=0,n[8]=x,n[9]=M,n[10]=P,n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n}(function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],A=e[7],l=e[8],f=e[9],h=e[10],u=e[11],E=e[12],d=e[13],_=e[14],B=e[15],C=n*a-r*s,T=n*c-i*s,m=n*A-o*s,g=r*c-i*a,p=r*A-o*a,y=i*A-o*c,R=l*d-f*E,I=l*_-h*E,b=l*B-u*E,x=f*_-h*d,M=f*B-u*d,P=h*B-u*_,N=C*P-T*M+m*x+g*b-p*I+y*R;return N?(N=1/N,t[0]=(a*P-c*M+A*x)*N,t[1]=(i*M-r*P-o*x)*N,t[2]=(d*y-_*p+B*g)*N,t[3]=(h*p-f*y-u*g)*N,t[4]=(c*b-s*P-A*I)*N,t[5]=(n*P-i*b+o*I)*N,t[6]=(_*m-E*y-B*T)*N,t[7]=(l*y-h*m+u*T)*N,t[8]=(s*M-a*b+A*R)*N,t[9]=(r*b-n*M-o*R)*N,t[10]=(E*p-d*m+B*C)*N,t[11]=(f*m-l*p-u*C)*N,t[12]=(a*I-s*x-c*R)*N,t[13]=(n*x-r*I+i*R)*N,t[14]=(d*T-E*g-_*C)*N,t[15]=(l*g-f*T+h*C)*N,t):null}(on,h),function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}(sn,n),t);return Qe(t,nn,u),t}(l,o,l,s.getProjection(),s.getGLRes(),A,a),h=function(t,e){return k(t,e[12],e[13],e[14]),t}(vn,f);let u=this.$.options.offset;if(B(u)){u=u(this.$.Ae(e.id).center)}return n.vec3.set(wn,u[0],u[1],0),n.vec3.sub(h,h,wn),Qe(f,h,f),f}ee(t,e,r){const i=this.$.options.services[e];if(!i.coordOffset)return null;const o=this.getMap(),s=o.getGLRes();Sn.set(r[0],r[1]);const a=o.coordToPointAtRes(Sn,s,Ln),c=i.coordOffset,A=Sn.set(r[0]+c[0],r[1]+c[1]),l=o.coordToPointAtRes(A,s,Fn),f=l.x-a.x,h=l.y-a.y,u=this.le(),E=n.vec3.set(wn,f,h,(c[2]||0)*u);return n.mat4.fromTranslation(t,E)}le(){const t=this.getMap();let e;return e=t.altitudeToPoint?this.Rt:t.distanceToPointAtRes(100,100,t.getGLRes(),Sn).y/100,e}createCMPTMesh(t,e,n,r){if(this.lt[e]){const t=this.lt[e];return console.warn(`mesh with id(${e}) was already created.`),r(null,{id:e,mesh:t}),t}const{content:i}=t,o=[];for(let t=0;t<i.length;t++){const{magic:r}=i[t],s=e+"."+t;"b3dm"===r?this.createB3DMMesh(i[t],s,n,(t,{mesh:e})=>{o.push(e)}):"i3dm"===r?this.createI3DMMesh(i[t],s,n,(t,{mesh:e})=>{o.push(e)}):"pnts"===r?this.createPntsMesh(i[t],s,n,(t,{mesh:e})=>{o.push(e)}):"cmpt"===r&&this.createCMPTMesh(i[t],s,n,(t,{mesh:e})=>{o.push(e)})}return this.lt[e]=o,r(null,{id:e,mesh:o}),o}oe(t,e,n,r,i){const o=("phong"===(this.$.options.services[r].shader||"phong")?this.Ut:this.Gt).getGeometryDefines(e);i.asset&&"S3M"===i.asset.generator&&this.fe(o,e),e.data.uvRegion&&(o.HAS_I3S_UVREGION=1),e.data[e.desc.normalAttribute]&&(o.VertexNormal=1),e.data[e.desc.color0Attribute]&&(o.VertexColor=1),e.data[e.desc.uv0Attribute]&&(o.TexCoord=1),e.data[e.desc.textureCoordMatrixAttribute]&&(o.HAS_TextureCoordMatrix=1),n.get("uTexture")&&(o.COMPUTE_TEXCOORD=1),n.get("uTexture2")&&(o.TexCoord2=1),"MESHOPT"===this.$.he&&(o.MeshOPT_Compress=1),this.hasIBL()&&(o.HAS_IBL_LIGHTING=1),t.attributes&&t.attributes.TEXCOORD_0&&"WEB3D_quantized_attributes"===t.attributes.TEXCOORD_0.extensions&&(o.HAS_WEB3D_quantized_attributes_TEXCOORD=1);return _(o,t.compressDefines),o}wt(t){const e=this.$.getRenderer();e&&e.updateMaskDefines(t)}fe(t,e){e.data.aNormal&&(t.VertexNormal=1),e.data.instanceId&&(t.Instance=1),e.data.aTexCoord0&&(t.TexCoord=1),e.data.aColor&&(t.VertexColor=1),e.data.aTexCoord1&&(t.TexCoord2=1),e.data.uv2&&(t.InstanceBim=1)}ie(t,e,n,r,i,o,s){let a=!1;r.asset&&"S3M"===r.asset.generator&&(a=!0,r.extensions=r.extensions||{},r.extensions.KHR_techniques_webgl=function(t){if(3===t){const t=JSON.parse(JSON.stringify(ln));return t.shaders[0].content="precision highp float;\n\n#include <gl2_vert>\n\n attribute vec4 aPosition;\n\n#ifdef VertexColor\n\n attribute vec4 aColor0;\n\n#endif\n\n#ifdef VertexNormal\n\n attribute vec3 aNormal;\n\n#endif\n\n#ifdef Instance\n\n attribute float instanceId;\n\n#else\n\n attribute float batchId;\n\n#endif \n\n\n\n#ifdef HAS_VertexWeight\n\n attribute float aVertexWeight;\n\n#endif\n\n\n\n#ifdef HAS_TextureCoordMatrix\n\n attribute vec2 aTextureCoordMatrix;\n\n#endif\n\n\n\n#ifdef TexCoord\n\n attribute vec4 aTexCoord;\n\n varying vec4 vTexCoord;\n\n uniform mat4 uTexMatrix;\n\n#ifdef COMPUTE_TEXCOORD\n\n uniform float uTexture0Width;\n\n varying vec4 vTexMatrix;\n\n varying vec4 vTexCoordTransform;\n\n varying vec2 vIsRGBA;\n\n#endif\n\n#endif\n\n\n\n#ifdef TexCoord2\n\n attribute vec4 aTexCoord1;\n\n uniform float uTexture1Width;\n\n varying vec4 vTexMatrix2;\n\n#endif\n\n#ifdef InstanceBim\n\n attribute vec4 uv2;\n\n attribute vec4 uv3;\n\n attribute vec4 uv4;\n\n attribute vec4 secondary_colour;\n\n attribute vec4 uv6; \n\n#endif\n\n\n\n#ifdef InstancePipe\n\n attribute vec4 uv1;\n\n attribute vec4 uv2;\n\n attribute vec4 uv3;\n\n attribute vec4 uv4;\n\n attribute vec4 uv5;\n\n attribute vec4 uv6;\n\n attribute vec4 uv7;\n\n attribute vec4 secondary_colour;\n\n attribute vec4 uv9;\n\n#endif\n\n uniform vec4 uFillForeColor;\n\n uniform vec4 uSelectedColor;\n\n varying vec4 vPositionMC;\n\n varying vec3 vPositionEC;\n\n#ifdef VertexNormal\n\n varying vec3 vNormalEC;\n\n#endif\n\n varying vec4 vColor;\n\n const float SHIFT_LEFT8 = 256.0;\n\n const float SHIFT_RIGHT8 = 1.0 / 256.0;\n\n const float SHIFT_RIGHT4 = 1.0 / 16.0;\n\n const float SHIFT_LEFT4 = 16.0;\n\n void getTextureMatrixFromZValue(in float nZ, inout float XTran, inout float YTran, inout float scale, inout float isRGBA)\n\n {\n\n if(nZ <= 0.0)\n\n {\n\n return;\n\n }\n\n float nDel8 = floor(nZ * SHIFT_RIGHT8);\n\n float nDel16 = floor(nDel8 * SHIFT_RIGHT8);\n\n float nDel20 = floor(nDel16 * SHIFT_RIGHT4);\n\n isRGBA = floor(nDel20);\n\n YTran = nZ - nDel8 * SHIFT_LEFT8;\n\n XTran = nDel8 - nDel16 * SHIFT_LEFT8;\n\n float nLevel = nDel16 - nDel20 * SHIFT_LEFT4;\n\n scale = 1.0 / pow(2.0, nLevel);\n\n }\n\n \n\n void operation(vec4 operationType, vec4 color, vec4 selectedColor, inout vec4 vertexColor)\n\n {\n\n float right_2 = operationType.x * 0.5;\n\n float right_4 = right_2 * 0.5;\n\n float right_8 = right_4 * 0.5;\n\n float right_16 = right_8 * 0.5;\n\n float isSetColor = fract(right_2);\n\n if(isSetColor > 0.1)\n\n {\n\n vertexColor *= color;\n\n }\n\n float isPicked = fract(floor(right_2)* 0.5);\n\n if(isPicked > 0.1)\n\n {\n\n vertexColor *= selectedColor;\n\n }\n\n float isHide = fract(floor(right_4)* 0.5);\n\n if(isHide > 0.1)\n\n {\n\n vertexColor.a = 0.0;\n\n }\n\n }\n\n \n\n#ifdef COMPRESS_TEXCOORD\n\n#ifdef TexCoord\n\n uniform vec2 decode_texCoord0_min;\n\n#endif\n\n#ifdef TexCoord2\n\n uniform vec2 decode_texCoord1_min;\n\n#endif\n\n#ifdef MeshOPT_Compress\n\n uniform vec3 decode_texCoord0_vNormConstant;\n\n uniform vec3 decode_texCoord1_vNormConstant;\n\n#else\n\n uniform float decode_texCoord0_normConstant;\n\n uniform float decode_texCoord1_normConstant;\n\n#endif\n\n#endif\n\n\n\n#ifdef COMPRESS_VERTEX\n\n uniform vec4 decode_position_min;\n\n uniform float decode_position_normConstant;\n\n#endif\n\n\n\n#ifdef COMPRESS_NORMAL\n\n uniform float normal_rangeConstant;\n\n#endif\n\n\n\nuniform mat4 modelMatrix;\n\nuniform mat4 modelViewMatrix;\n\nuniform mat4 projMatrix;\n\nuniform mat3 modelNormalMatrix;\n\n\n\n\n\n\n\nfloat czm_signNotZero(float value) {\n\n return value >= 0.0 ? 1.0 : -1.0;\n\n}\n\nvec2 czm_signNotZero(vec2 value) {\n\n return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\n\n}\n\n\n\nvec3 czm_octDecode(vec2 encoded, float range) {\n\n if (encoded.x == 0.0 && encoded.y == 0.0) {\n\n return vec3(0.0, 0.0, 0.0);\n\n }\n\n encoded = encoded / range * 2.0 - 1.0;\n\n vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\n\n if (v.z < 0.0) {\n\n v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);\n\n }\n\n return normalize(v);\n\n}\n\n\n\nvec4 czm_updatePositionDepth(vec4 coords) {\n\n coords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;\n\n return coords;\n\n}\n\n\n\nvoid main()\n\n{\n\n#ifdef COMPRESS_VERTEX\n\n vec4 vertexPos = vec4(1.0);\n\n vertexPos = vec4(aPosition.xyz, 1.0);\n\n#else\n\n vec4 vertexPos = aPosition;\n\n#endif\n\n#ifdef TexCoord\n\n\n\n#ifdef COMPRESS_TEXCOORD\n\n#ifdef MeshOPT_Compress\n\n vec2 texCoord0;\n\n texCoord0.x = aTexCoord.x * decode_texCoord0_vNormConstant.x;\n\n texCoord0.y = aTexCoord.y * decode_texCoord0_vNormConstant.y;\n\n vTexCoord.xy = decode_texCoord0_min + texCoord0.xy;\n\n#else\n\n vTexCoord.xy = decode_texCoord0_min.xy + aTexCoord.xy * decode_texCoord0_normConstant;\n\n#endif\n\n#else\n\n vTexCoord.xy = aTexCoord.xy;\n\n#endif\n\n\n\n#ifdef COMPUTE_TEXCOORD\n\n vTexMatrix = vec4(0.0,0.0,1.0,0.0);\n\n vIsRGBA.x = 0.0;\n\n vTexCoordTransform.x = aTexCoord.z;\n\n #ifdef HAS_TextureCoordMatrix\n\n vTexCoordTransform.x = aTextureCoordMatrix.x;\n\n #endif\n\n if(vTexCoordTransform.x < -90000.0)\n\n {\n\n vTexMatrix.z = -1.0;\n\n }\n\n getTextureMatrixFromZValue(floor(vTexCoordTransform.x), vTexMatrix.x, vTexMatrix.y, vTexMatrix.z, vIsRGBA.x);\n\n vTexMatrix.w = log2(uTexture0Width * vTexMatrix.z);\n\n#endif\n\n#endif\n\n\n\n#ifdef TexCoord2\n\n\n\n #ifdef COMPRESS_TEXCOORD\n\n #ifdef MeshOPT_Compress\n\n vec2 texCoord1;\n\n texCoord1.x = aTexCoord1.x * decode_texCoord1_vNormConstant.x;\n\n texCoord1.y = aTexCoord1.y * decode_texCoord1_vNormConstant.y;\n\n vTexCoord.zw = decode_texCoord1_min + texCoord1.xy;\n\n #else\n\n vTexCoord.zw = decode_texCoord1_min.xy + aTexCoord1.xy * decode_texCoord1_normConstant;\n\n #endif\n\n #else\n\n vTexCoord.zw = aTexCoord1.xy;\n\n #endif\n\n\n\n vTexMatrix2 = vec4(0.0,0.0,1.0,0.0);\n\n vIsRGBA.y = 0.0;\n\n vTexCoordTransform.y = aTexCoord1.z;\n\n #ifdef HAS_TextureCoordMatrix\n\n vTexCoordTransform.y = aTextureCoordMatrix.y;\n\n #endif\n\n if(vTexCoordTransform.y < -90000.0)\n\n {\n\n vTexMatrix2.z = -1.0;\n\n }\n\n getTextureMatrixFromZValue(floor(vTexCoordTransform.y), vTexMatrix2.x, vTexMatrix2.y, vTexMatrix2.z, vIsRGBA.y);\n\n vTexMatrix2.w = log2(uTexture1Width * vTexMatrix.z);\n\n#endif\n\n\n\n vec4 vertexColor = uFillForeColor;\n\n#ifdef VertexColor\n\n vertexColor *= aColor0 / 255.0;\n\n#endif\n\n#ifdef VertexNormal\n\n vec3 normal = aNormal;\n\n #ifdef COMPRESS_NORMAL\n\n #ifdef MeshOPT_Compress\n\n normal.x = aNormal.x / 127.0;\n\n normal.y = aNormal.y / 127.0;\n\n normal.z = 1.0 - abs(normal.x) - abs(normal.y);\n\n normal = normalize(normal);\n\n #else\n\n normal = czm_octDecode(aNormal.xy, normal_rangeConstant).zxy;\n\n #endif\n\n #endif\n\n#endif\n\n#ifdef InstanceBim\n\n mat4 worldMatrix;\n\n worldMatrix[0] = uv2;\n\n worldMatrix[1] = uv3;\n\n worldMatrix[2] = uv4;\n\n worldMatrix[3] = vec4(0, 0, 0, 1);\n\n vertexPos = vec4(vertexPos.xyz,1.0) * worldMatrix;\n\n vertexColor *= secondary_colour; \n\n#endif\n\n#ifdef InstancePipe\n\n mat4 worldMatrix;\n\n mat4 worldMatrix0;\n\n mat4 worldMatrix1;\n\n vec4 worldPos0;\n\n vec4 worldPos1;\n\n worldMatrix0[0] = uv1;\n\n worldMatrix0[1] = uv2;\n\n worldMatrix0[2] = uv3;\n\n worldMatrix0[3] = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n worldMatrix1[0] = uv4;\n\n worldMatrix1[1] = uv5;\n\n worldMatrix1[2] = uv6;\n\n worldMatrix1[3] = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n vec4 realVertex = vec4(vertexPos.xyz, 1.0);\n\n realVertex.x = realVertex.x * uv7.z;\n\n worldPos0 = realVertex * worldMatrix0;\n\n worldPos1 = realVertex * worldMatrix1;\n\n vertexColor *= secondary_colour; \n\n #ifdef TexCoord\n\n if(aTexCoord.y > 0.5)\n\n {\n\n vec4 tex4Vec = uTexMatrix * vec4(uv7.y, aTexCoord.x, 0.0, 1.0);\n\n vTexCoord.xy = tex4Vec.xy;\n\n vertexPos = worldPos1;\n\n worldMatrix = worldMatrix1;\n\n }\n\n else\n\n {\n\n vec4 tex4Vec = uTexMatrix * vec4(uv7.x, aTexCoord.x, 0.0, 1.0);\n\n vTexCoord.xy = tex4Vec.xy;\n\n vertexPos = worldPos0;\n\n worldMatrix = worldMatrix0;\n\n }\n\n #endif\n\n #ifdef VertexNormal\n\n normal.x = normal.x * uv7.z;\n\n #endif\n\n#endif\n\n#ifdef Instance \n\n float index = instanceId;\n\n#else\n\n float index = batchId;\n\n#endif \n\n vec4 positionMC = vec4(vertexPos.xyz, 1.0);\n\n vColor = vertexColor;\n\n#ifdef VertexNormal\n\n vNormalEC = modelNormalMatrix * normal;\n\n#endif\n\n vPositionMC = positionMC;\n\n vPositionEC = (modelViewMatrix * positionMC).xyz;\n\n gl_Position = projMatrix * modelViewMatrix * vec4(vertexPos.xyz, 1.0);\n\n}\n\n",t.shaders[1].content="#ifdef GL_OES_standard_derivatives\n\n #extension GL_OES_standard_derivatives : enable\n\n#endif\n\n#ifdef GL_EXT_shader_texture_lod\n\n #extension GL_EXT_shader_texture_lod : enable\n\n#endif\n\nprecision highp float;\n\n#include <gl2_frag>\n\n uniform vec4 uDiffuseColor;\n\n#ifdef TexCoord\n\n varying vec4 vTexCoord;\n\n #ifdef COMPUTE_TEXCOORD\n\n uniform sampler2D uTexture;\n\n uniform float uTexture0Width;\n\n varying vec4 vTexCoordTransform;\n\n varying vec4 vTexMatrix;\n\n varying vec2 vIsRGBA;\n\n #endif\n\n#endif\n\n\n\n varying vec4 vPositionMC;\n\n varying vec3 vPositionEC;\n\n varying vec4 vColor;\n\n#ifdef VertexNormal\n\n varying vec3 vNormalEC;\n\n#endif\n\n#ifdef TexCoord2\n\n uniform sampler2D uTexture2;\n\n uniform float uTexture1Width;\n\n varying vec4 vTexMatrix2;\n\n#endif\n\n#ifdef COMPUTE_TEXCOORD\n\n void calculateMipLevel(in vec2 inTexCoord, in float vecTile, in float fMaxMip, inout float mipLevel)\n\n {\n\n vec2 dx = dFdx(inTexCoord * vecTile);\n\n vec2 dy = dFdy(inTexCoord * vecTile);\n\n float dotX = dot(dx, dx);\n\n float dotY = dot(dy, dy);\n\n float dMax = max(dotX, dotY);\n\n float dMin = min(dotX, dotY);\n\n float offset = (dMax - dMin) / (dMax + dMin);\n\n offset = clamp(offset, 0.0, 1.0);\n\n float d = dMax * (1.0 - offset) + dMin * offset;\n\n mipLevel = 0.5 * log2(d);\n\n mipLevel = clamp(mipLevel, 0.0, fMaxMip - 1.62);\n\n }\n\n \n\n void calculateTexCoord(in vec3 inTexCoord, in float scale, in float XTran, in float YTran, in float fTile, in float mipLevel, inout vec2 outTexCoord)\n\n {\n\n if(inTexCoord.z < -9000.0)\n\n {\n\n outTexCoord = inTexCoord.xy;\n\n }\n\n else\n\n {\n\n vec2 fTexCoord = fract(inTexCoord.xy);\n\n float offset = 1.0 * pow(2.0, mipLevel) / fTile;\n\n fTexCoord = clamp(fTexCoord, offset, 1.0 - offset);\n\n outTexCoord.x = (fTexCoord.x + XTran) * scale;\n\n outTexCoord.y = (fTexCoord.y + YTran) * scale;\n\n }\n\n }\n\n \n\n vec4 getTexColorForS3M(sampler2D curTexture, vec3 oriTexCoord, float texTileWidth, float fMaxMipLev, float fTexCoordScale, vec2 vecTexCoordTranslate, float isRGBA)\n\n {\n\n vec4 color = vec4(1.0);\n\n float mipLevel = 0.0;\n\n #ifdef GL_OES_standard_derivatives\n\n calculateMipLevel(oriTexCoord.xy, texTileWidth, fMaxMipLev, mipLevel);\n\n #endif\n\n vec2 realTexCoord;\n\n calculateTexCoord(oriTexCoord, fTexCoordScale, vecTexCoordTranslate.x, vecTexCoordTranslate.y, texTileWidth, mipLevel, realTexCoord);\n\n if(isRGBA > 0.5)\n\n {\n\n vec2 rgbTexCoord;\n\n rgbTexCoord.x = (realTexCoord.x + vecTexCoordTranslate.x * fTexCoordScale) * 0.5;\n\n rgbTexCoord.y = (realTexCoord.y + vecTexCoordTranslate.y * fTexCoordScale) * 0.5;\n\n color = texture2D(curTexture, rgbTexCoord.xy, -10.0);\n\n vec2 vecAlphaTexCoord;\n\n vecAlphaTexCoord.x = rgbTexCoord.x;\n\n vecAlphaTexCoord.y = rgbTexCoord.y + fTexCoordScale * 0.5;\n\n color.a = texture2D(curTexture, vecAlphaTexCoord.xy, -10.0).r;\n\n }\n\n else\n\n {\n\n if(oriTexCoord.z < -9000.0)\n\n {\n\n color = texture2D(curTexture, realTexCoord.xy);\n\n }\n\n else\n\n {\n\n #ifdef GL_EXT_shader_texture_lod\n\n color = texture2DLodEXT(curTexture, realTexCoord.xy, mipLevel);\n\n #else\n\n color = texture2D(curTexture, realTexCoord.xy, mipLevel);\n\n #endif\n\n }\n\n }\n\n \n\n return color;\n\n }\n\n \n\n vec4 getTextureColor()\n\n {\n\n if(vTexMatrix.z < 0.0)\n\n {\n\n return vec4(1.0);\n\n }\n\n float texTileWidth0 = vTexMatrix.z * uTexture0Width;\n\n vec3 realTexCoord = vec3(vTexCoord.xy, vTexCoordTransform.x);\n\n vec4 FColor = getTexColorForS3M(uTexture, realTexCoord, texTileWidth0, vTexMatrix.w, vTexMatrix.z, vTexMatrix.xy, vIsRGBA.x);\n\n #ifdef TexCoord2\n\n float texTileWidth1 = vTexMatrix2.z * uTexture1Width;\n\n realTexCoord = vec3(vTexCoord.zw, vTexCoordTransform.y);\n\n vec4 SColor = getTexColorForS3M(uTexture2, realTexCoord, texTileWidth1, vTexMatrix2.w, vTexMatrix2.z, vTexMatrix2.xy, vIsRGBA.y);\n\n SColor.r = clamp(SColor.r, 0.0, 1.0);\n\n SColor.g = clamp(SColor.g, 0.0, 1.0);\n\n SColor.b = clamp(SColor.b, 0.0, 1.0);\n\n return FColor * SColor;\n\n #else\n\n return FColor;\n\n #endif\n\n }\n\n#endif\n\n\n\n vec3 czm_acesTonemapping(vec3 color) {\n\n float g = 0.985;\n\n float a = 0.065;\n\n float b = 0.0001;\n\n float c = 0.433;\n\n float d = 0.238;\n\n\n\n color = (color * (color + a) - b) / (color * (g * color + c) + d);\n\n\n\n color = clamp(color, 0.0, 1.0);\n\n\n\n return color;\n\n }\n\n vec4 SRGBtoLINEAR4(vec4 srgbIn) {\n\n #ifndef HDR \n\n vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\n\n return vec4(linearOut, srgbIn.a);\n\n #else\n\n return srgbIn;\n\n #endif\n\n }\n\n vec3 LINEARtoSRGB(vec3 linearIn) {\n\n #ifndef HDR \n\n return pow(linearIn, vec3(1.0/2.2));\n\n #else\n\n return linearIn;\n\n #endif\n\n }\n\n vec3 applyTonemapping(vec3 linearIn) {\n\n #ifndef HDR\n\n return czm_acesTonemapping(linearIn);\n\n #else\n\n return linearIn;\n\n #endif\n\n }\n\n \n\n vec3 computeNormal(in vec3 oriVertex)\n\n {\n\n vec3 normal = cross(vec3(dFdx(oriVertex.x), dFdx(oriVertex.y), dFdx(oriVertex.z)), vec3(dFdy(oriVertex.x), dFdy(oriVertex.y), dFdy(oriVertex.z)));\n\n normal = normalize(normal);\n\n return normal;\n\n }\n\n \n\n uniform vec3 light0_viewDirection;\n\n void main()\n\n {\n\n if(vColor.a < 0.1)\n\n {\n\n discard;\n\n } \n\n vec4 baseColorWithAlpha = vColor;\n\n #ifdef COMPUTE_TEXCOORD\n\n baseColorWithAlpha *= SRGBtoLINEAR4(getTextureColor());\n\n #endif\n\n \n\n if(baseColorWithAlpha.a < 0.1)\n\n {\n\n discard;\n\n }\n\n vec3 normal = vec3(0.0);\n\n #ifdef VertexNormal\n\n normal = normalize(vNormalEC);\n\n #endif\n\n normal = length(normal) > 0.1 ? normal : computeNormal(vPositionMC.xyz);\n\n vec3 color = baseColorWithAlpha.rgb;\n\n vec3 dirVectorEC = normalize(light0_viewDirection);\n\n float dotProduct = dot( normal, dirVectorEC );\n\n float dirDiffuseWeight = max( dotProduct, 0.0 );\n\n dirDiffuseWeight = dirDiffuseWeight * 0.5 + 0.5;\n\n color += color * uDiffuseColor.rgb * dirDiffuseWeight;\n\n #ifdef TexCoord\n\n color = LINEARtoSRGB(color);\n\n #endif\n\n glFragColor = vec4(color, baseColorWithAlpha.a);\n\n #if __VERSION__ == 100\n\n gl_FragColor = glFragColor;\n\n #endif\n\n}",t}return ln}(r.asset.s3mVersion));const c=r.url+"-"+e+"-"+n;if(this.ft[c])return this.ft[c].refCount++,this.ft[c];let A,l;const f=r.materials&&r.materials[t.material];if(r.extensions&&r.extensions.KHR_techniques_webgl&&f.extensions&&f.extensions.KHR_techniques_webgl){const e=this.ue(t,r,o,a);A=e.material,l=e.geometry;this.$.options.services[i.Pt].fillEmptyDataInMissingAttribute&&(l.desc.fillEmptyDataInMissingAttribute=!0)}else{l=this.Ee(t,o,Hn);const e=this.$.options.services[i.Pt],n=e.ambientLight;let a=e.environmentExposure;const c=e.material,f=this.getMap().getLightManager(),h=f&&f.getAmbientLight();if(n&&(!h||h.color)&&void 0===a){const t=h&&h.color?h.color[0]:.2;a=n[0]/t}A=this.de(t.material,r,s,c||In,a||1)}A&&!A.isReady()?A._e=i.id:A||(A=this.Tt);const h={refCount:1,geometry:l,material:A};return l.properties.url=c,this.ft[c]=h,h}ue(t,e,n,r){const{geometry:i,material:o}=this.pt.createMesh(t,e,n,r);return{geometry:i,material:o}}Ee(t,e,r){const i=t.attributes;let o=i._BATCHID&&i._BATCHID.array;if(o&&o.byteOffset&&(o=new o.constructor(o)),i.COLOR_0){const t=i.COLOR_0.array||i.COLOR_0;if(t instanceof Float32Array){const e=new Uint8Array(t.length);for(let n=0;n<e.length;n++)e[n]=Math.round(255*t[n]);i.COLOR_0.array?(i.COLOR_0.array=e,i.COLOR_0.componentType=5121):i.COLOR_0=e}}const s={};for(const t in i){const e=Bn(this.nt,i[t],{dimension:i[t].itemSize}),n=r[t]||t;s[n]={buffer:e},i[t].quantization&&(s[n].quantization=i[t].quantization),n===r.POSITION&&(s[n].array=i[t].array,s[n].min=i[t].min,s[n].max=i[t].max)}const a=t.indices?t.indices.array?t.indices.array.slice():t.indices:null,c=new n.reshader.Geometry(s,a,0,{positionAttribute:r.POSITION,normalAttribute:r.NORMAL,uv0Attribute:r.TEXCOORD_0,uv1Attribute:r.TEXCOORD_1,color0Attribute:r.COLOR_0,tangentAttribute:r.TANGENT,pickingIdAttribute:r._BATCHID,primitive:void 0===t.mode?"triangles":_n(t.mode)});return o&&a&&(c.properties.batchIdData=o,c.properties.batchIdMap=function(t,e){if(!e)return null;const n=new Map;for(let r=0;r<e.length;r++){const i=e[r],o=t[i];let s=n.get(o);s||(s=[],n.set(o,s)),s.push(i)}return n}
18
19
  /*!
19
- * @maptalks/gl v0.81.2
20
+ * @maptalks/gl v0.83.0
20
21
  * LICENSE : UNLICENSED
21
22
  * (c) 2016-2023 maptalks.com
22
- */(o,A)),c.generateBuffers(this.nt,{excludeElementsInVAO:e}),c}Ae(t,e,n,i){const s=r.mat4.identity(t),o=this.getMap();Yr.x=n[0],Yr.y=n[1];const a=this._prjToPoint(Yr),A=this.de(),c=1/(o.getGLZoom?o.getResolution(o.getGLZoom()):o.getGLRes());Yr.x=e[0],Yr.y=e[1];const l=this.le();let f=this.tt.options.offset;S(f)&&(f=f(Yr));const h=this.tt.options.services[i].heightOffset||0;return r.vec3.set(qr,a.x-f[0],a.y-f[1],l*n[2]+l*h),r.mat4.translate(s,s,qr),r.vec3.set(A,c,c,l),r.mat4.scale(s,s,A),s}te(t,e){const n=r.mat4.identity(t),i=this.getMap(),s=this.de();Yr.x=e[0],Yr.y=e[1];const o=i.distanceToPointAtRes(100,100,i.getGLRes(),Yr);let a;return a=i.altitudeToPoint?this.bt:o.y/100,r.vec3.set(s,o.x/100*1.01,o.y/100*1.01,a),r.mat4.scale(n,n,s),n}Rt(){const t={x:0,y:0,width:()=>this.et?this.et.width:1,height:()=>this.et?this.et.height:1};this.Jt=new r.reshader.MeshShader({vert:"attribute vec3 aPosition;\n\n\n\nuniform mat4 projViewModelMatrix;\n\n\n\nvoid main() {\n\n gl_Position = projViewModelMatrix * vec4(aPosition, 1.0);\n\n}\n\n",frag:"precision mediump float;\nuniform vec3 color;\nvoid main() {\n gl_FragColor = vec4(color, 1.0);\n}\n",uniforms:["color",{name:"projViewModelMatrix",type:"function",fn:(t,e)=>r.mat4.multiply([],e.projViewMatrix,e.modelMatrix)}],extraCommandProps:{viewport:t}});const e=[],n=[];this.Kt=new r.reshader.MeshShader({vert:"const float SHIFT_RIGHT_11 = 1.0 / 2048.0;\n\nconst float SHIFT_RIGHT_5 = 1.0 / 32.0;\n\nconst float SHIFT_LEFT_11 = 2048.0;\n\nconst float SHIFT_LEFT_5 = 32.0;\n\nconst float NORMALIZE_6 = 1.0 / 64.0;\n\nconst float NORMALIZE_5 = 1.0 / 32.0;\n\n\n\n#ifdef HAS_POSITION\n\n attribute vec3 POSITION;\n\n#endif\n\n\n\n#if defined(HAS_RGB)\n\n attribute vec3 RGB;\n\n#elif defined(HAS_RGBA)\n\n attribute vec4 RGBA;\n\n#elif defined(HAS_RGB565)\n\n attribute float RGB565;\n\n#endif\n\n\n\nuniform vec4 pointColor;\n\nuniform float pointSize;\n\n\n\nuniform mat4 projViewModelMatrix;\n\nuniform float pointOpacity;\n\n\n\nvarying vec4 vColor;\n\n\n\n#ifdef HAS_NORMAL\n\n #ifdef HAS_NORMAL_OCT16P\n\n attribute vec2 NORMAL_OCT16P;\n\n float signNotZero(float value) {\n\n return value >= 0.0 ? 1.0 : -1.0;\n\n }\n\n vec2 signNotZero(vec2 value) {\n\n return vec2(signNotZero(value.x), signNotZero(value.y));\n\n }\n\n vec3 octDecode(vec2 encoded, float range) {\n\n if (encoded.x == 0.0 && encoded.y == 0.0) {\n\n return vec3(0.0, 0.0, 0.0);\n\n }\n\n encoded = encoded / range * 2.0 - 1.0;\n\n vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\n\n if (v.z < 0.0) {\n\n v.xy = (1.0 - abs(v.yx)) * signNotZero(v.xy);\n\n }\n\n return normalize(v);\n\n }\n\n vec3 octDecode(vec2 encoded) {\n\n return octDecode(encoded, 255.0);\n\n }\n\n #else\n\n attribute vec3 NORMAL;\n\n #endif\n\n uniform vec3 lightDir;\n\n uniform mat3 modelNormalMatrix;\n\n uniform mat4 positionMatrix;\n\n float getLambertDiffuse(vec3 lightDir, vec3 normal) {\n\n return max(dot(-lightDir, normal), 0.0);\n\n }\n\n#endif\n\n\n\nvoid main() {\n\n #if defined(HAS_RGB)\n\n vColor = vec4(RGB / 255.0, 1.0) * pointOpacity;\n\n #elif defined(HAS_RGBA)\n\n vColor = RGBA / 255.0 * pointOpacity;\n\n #elif defined(HAS_RGB565)\n\n float compressed = RGB565;\n\n float r = floor(compressed * SHIFT_RIGHT_11);\n\n compressed -= r * SHIFT_LEFT_11;\n\n float g = floor(compressed * SHIFT_RIGHT_5);\n\n compressed -= g * SHIFT_LEFT_5;\n\n float b = compressed;\n\n vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5);\n\n vColor = vec4(rgb, 1.0);\n\n #else\n\n vColor = pointColor;\n\n #endif\n\n\n\n #ifdef HAS_POSITION\n\n vec3 localPos = POSITION;\n\n #endif\n\n\n\n #ifdef HAS_NORMAL\n\n mat3 positionNormalMatrix = mat3(positionMatrix);\n\n mat3 normalMatrix = modelNormalMatrix * positionNormalMatrix;\n\n #ifdef HAS_NORMAL_OCT16P\n\n vec3 localNormal = octDecode(NORMAL_OCT16P);\n\n #else\n\n vec3 localNormal = NORMAL;\n\n #endif\n\n vec3 normal = normalize(normalMatrix * localNormal);\n\n float colorStrength = getLambertDiffuse(lightDir, normal);\n\n colorStrength = max(colorStrength, 0.5);\n\n vColor *= colorStrength;\n\n #endif\n\n\n\n gl_Position = projViewModelMatrix * vec4(localPos, 1.0);\n\n gl_PointSize = pointSize;\n\n}\n\n",frag:"#define SHADER_NAME PNTS\n\nprecision mediump float;\n\n\n\nvarying vec4 vColor;\n\n\n\nvoid main() {\n\n gl_FragColor = vColor;\n\n}\n\n",uniforms:[{name:"projViewModelMatrix",type:"function",fn:(t,e)=>r.mat4.multiply(n,e.projViewMatrix,e.modelMatrix)},{name:"modelNormalMatrix",type:"function",fn:(t,n)=>r.mat3.fromMat4(e,n.modelMatrix)}],extraCommandProps:{viewport:t,blend:{enable:!0,func:{src:"src alpha",dst:"one minus src alpha"},equation:"add"},depth:{enable:!0,range:[0,1],func:"<"}}});const i=this.It();this.Gt=new r.reshader.PhongShader({extraCommandProps:i}),this.Ht=new r.reshader.pbr.StandardShader({extraCommandProps:i});const s=this.tt;xr(s.getRenderer().canvas,this.nt,s.getMap()),this.picking=new r.reshader.FBORayPicking(this.it,{vert:this.Ht.vert,extraCommandProps:i,uniforms:this.Ht.uniforms,defines:{"PICKING_MODE":1,"ENABLE_PICKING":1,"HAS_PICKING_ID":1}},this.pickingFBO,this.getMap())}It(){return{viewport:{x:0,y:0,width:()=>this.et?this.et.width:1,height:()=>this.et?this.et.height:1},colorMask:(t,e)=>e.colorMask||zr,cull:{enable:!0,face:(t,e)=>e.cullFace||"back"},stencil:{enable:(t,e)=>!0===e.stencilEnable,func:{cmp:(t,e)=>e.meshProperties.isLeaf?"always":">=",ref:(t,e)=>e.meshProperties.level},opFront:{fail:"keep",zfail:"keep",zpass:"replace"},opBack:{fail:"keep",zfail:"keep",zpass:"replace"}},depth:{enable:!0,range:[0,1],func:(t,e)=>e.meshProperties.depthFunc||"<"},blend:{enable:!0,func:{src:"src alpha",dst:"one minus src alpha"},equation:"add"},polygonOffset:{enable:!0,offset:(t,e)=>e.meshProperties.polygonOffset}}}Yt(t){return{projViewMatrix:this.getMap().projViewMatrix,color:t&&t.color||[0,1,0]}}Vt(t){const e=this.getMap(),n=e.getLightManager(),i=(n&&n.getDirectionalLight()||{}).direction||[1,1,-1],s=t&&t.pointOpacity||1;return{projViewMatrix:e.projViewMatrix,pointOpacity:s,lightDir:r.vec3.normalize(i,i)}}Pt(){const t=this.getMap(),e=this.tt.getRenderer().canvas,{iblTexes:r,dfgLUT:n}=vr(e),i=Ur(t,r,n);return b(i,{czm_lightDirectionEC:i.light0_viewDirection,lightSpecular:[1,1,1],viewMatrix:t.viewMatrix,projMatrix:t.projMatrix,projViewMatrix:t.projViewMatrix,outSize:[e.width,e.height],polygonFill:[1,1,1,1],polygonOpacity:1}),i}_e(t,e,n,i,s){const o=e.materials[t];if(!o||!o.baseColorTexture&&!o.pbrMetallicRoughness)return null;const a=b({},i);if(o.baseColorTexture){const t=e.textures[o.baseColorTexture.index];let r;t&&!t.image.color&&(r=this.S(t)),a.baseColorFactor=t&&t.image.color||o.baseColorFactor||[1,1,1,1],r&&(a.baseColorTexture=r)}else{if(o.normalTexture){const t=this.S(e.textures[o.normalTexture.index]),r=o.normalTexture.scale||1;a.normalTexture=t,a.normalMapFactor=r}if(o.occlusionTexture){const t=this.S(e.textures[o.occlusionTexture.index]),r=o.occlusionTexture.strength||1;a.occlusionTexture=t,a.occlusionFactor=r}if(o.emissiveTexture){const t=this.S(e.textures[o.emissiveTexture.index]);a.emissiveTexture=t}o.emissiveFactor&&(a.emissiveFactor=o.emissiveFactor);const t=o.pbrMetallicRoughness;if(t){if(t.baseColorFactor&&(a.baseColorFactor=t.baseColorFactor),t.baseColorTexture&&void 0!==t.baseColorTexture.index){const n=e.textures[t.baseColorTexture.index];n.image&&n.image.color?a.baseColorFactor=a.baseColorFactor?r.vec4.multiply(a.baseColorFactor,a.baseColorFactor,n.image.color):n.image.color:(a.baseColorTexture=this.S(n),a.baseColorTexture.getREGLTexture(this.nt))}if(I(t.metallicFactor)||(a.metallicFactor=t.metallicFactor),I(t.roughnessFactor)||(a.roughnessFactor=t.roughnessFactor),o.metallicRoughnessTexture){const t=this.S(e.textures[o.metallicRoughnessTexture.index]);a.metallicRoughnessTexture=t}}}if(o.s3mMaterial)return new r.reshader.Material(a);if(a.environmentExposure=s,o.extensions&&o.extensions.KHR_materials_unlit)return a.environmentExposure=1,a.ambientColor=[1,1,1],a.light0_diffuse=[0,0,0,0],a.lightSpecular=[0,0,0],new r.reshader.PhongMaterial(a);let A=new r.reshader.pbr.StandardMaterial(a);"phong"===n&&(A=r.reshader.PhongMaterial.convertFrom(A));const c=o.pbrMetallicRoughness,l=c&&c.baseColorTexture&&c.baseColorTexture.extensions;return l&&l.KHR_texture_transform&&(A.set("khr_offset",l.KHR_texture_transform.offset||[0,0]),A.set("khr_rotation",l.KHR_texture_transform.rotation||0),A.set("khr_scale",l.KHR_texture_transform.scale||[1,1])),A.once("complete",this.Ct),A}S(t){const e={type:t.type?Mr(t.type):"uint8",format:t.format?Nr(t.format):"rgba",flipY:!!t.flipY},n=t.image;n.array?e.data=n.array:n.mipmap&&(e.mipmap=n.mipmap),e.width=n.width,e.height=n.height;const i=t.sampler||t.texture&&t.texture.sampler;return i&&(i.magFilter&&(e.mag=br(i.magFilter)),i.minFilter&&(e.min=Sr(i.minFilter)),i.wrapS&&(e.wrapS=Pr(i.wrapS)),i.wrapT&&(e.wrapT=Pr(i.wrapT))),new r.reshader.Texture2D(e,this.dt)}Ce(t){const e=t.image,r=window.URL||window.webkitURL,n=new Blob([e.array],{type:e.mimeType});return r.createObjectURL(n)}Tt({target:t}){const e=t.Be,r=this.st[e];if(r.count--,!r.count){const t=r.meshes;this.At[e]=t,delete this.st[e];const n=t.ae;delete t.ae,n(null,{mesh:r.meshes,id:e})}}de(){return Vr}Qt(t){return this.tt.Qt(t)}$t(t,e){const r=this.getMap();return r.getGLZoom?r.distanceToPoint(t,e,r.getGLZoom()):r.distanceToPointAtRes(t,e,r.getGLRes())}_pointToPrj(t){const e=this.getMap();return e.getGLZoom?e._pointToPrj(t,e.getGLZoom()):e._pointToPrjAtRes(t,e.getGLRes())}_prjToPoint(t){const e=this.getMap();return e.getGLZoom?e._prjToPoint(t,e.getGLZoom()):e._prjToPointAtRes(t,e.getGLRes(),Zr)}ne(t){return"Y"===t?Lr:"X"===t?Fr:Kr}pick(t,e,r=3){const n=this.tt;if(!n||!n.options.picking)return[];if(!this.pickingFBO||!this.picking)return[];const i=this.getMap(),s=this.Pt(),o=this.picking;o.render(this.ut.getMeshes().filter((t=>!t.bloom)),s,!0);let a={};o.getRenderedMeshes().length&&(a=o.pick(t,e,r,s,{viewMatrix:i.viewMatrix,projMatrix:i.projMatrix,returnPoint:n.options.pickingPoint}));const{meshId:A,pickingId:c,point:l,coordinate:f}=a,h=(0===A||A)&&o.getMeshAt(A);if(!h||!h.geometry)return[];const u=h.properties;l&&l.length&&(l[0]=Math.round(1e5*l[0])/1e5,l[1]=Math.round(1e5*l[1])/1e5,l[2]=Math.round(1e5*l[2])/1e5);const E={batchId:c};if(n.options.debug&&(E.debugInfo=u),u&&u.batchTable){const{batchTable:t,batchTableBin:e,count:r}=u,n=c;for(const i in t)void 0!==t[i].byteOffset?E[i]=Ye(t[i],e,r,n):E[i]=t[i][n]}return[{service:h.properties.serviceIndex,data:E,point:l,coordinate:f}]}Mt(t){let e=new Set;for(let r=0,n=t.length;r<n;r++){const n=t[r].data.node;this.Nt(n)&&e.add(n.wt)}e=Array.from(e),e.sort();const r=new Map,n=e.length;for(let t=0;t<n;t++)r.set(e[t],t);return r}highlight(t){this.Ot=t;const e=this.tt.getRenderer();this.Lt=e.getFrameTimestamp(),e.setToRedraw(!0)}cancelAllHighlight(){this.Ot=null;const t=this.tt.getRenderer();this.Lt=t.getFrameTimestamp(),t.setToRedraw(!0)}showOnly(t){this.Ft=t;const e=this.tt.getRenderer();this.xt=e.getFrameTimestamp(),e.setToRedraw(!0)}cancelShowOnly(){this.Ft=null;const t=this.tt.getRenderer();this.xt=t.getFrameTimestamp(),t.setToRedraw(!0)}Te(){if(!this.St)return[];const t={},e=[];for(const r in this.St){const n=this.St[r];if(n)for(let r=0;r<n.length;r++){const i=n[r],s=i&&i.geometry;if(!i||!s)continue;const o=i.properties.serviceIndex;t[o]||(t[o]=new Set);const a=s.properties.batchIdData;if(a)for(let r=0;r<a.length;r++)t[o].has(a[r])||(e.push({id:a[r],service:o}),t[o].add(a[r]))}}return e}hasIBL(){const t=this.getMap().getLightManager();return!!(t&&t.getAmbientResource())}}const nn=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")},sn=nn(),on=sn.gl_trans__coders=sn.gl_trans__coders||{};function an(t,e){if(e)for(let r=0;r<e.length;r++){t[e[r].id||e[r].index]=e[r]}}on.inject=function(t){const e=t.toString(),r=e.indexOf("{")+1,n=e.substring(0,r),i=sn.gl_trans__coders=sn.gl_trans__coders||{};let s=`${n}\n const _____getGlobal = ${nn.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;for(const t in i)"inject"!==t&&"getTranscoder"!==t&&"registerTranscoder"!==t&&(s+='tran_____scoders["'+t+'"] ='+i[t].toString()+"\n;");return s+="\n"+e.substring(n.length),s},on.registerTranscoder=function(t,e){on[t]=e},on.getTranscoder=function(t){return on[t]};const An=[];class cn{constructor(t,e,r,n){this.me=t,this.Dt=e,this.ge=n,this.pe=r.version,t.indexOf("i3s:tileset:")<0?(this.pe<=1.6?this.Re="root":this.Re=0,r.version=this.pe):(this.Re=t.substring("i3s:tileset:".length),this.pe>1.6&&(this.Re=parseInt(this.Re))),this.me=t,this.ye=r}load(){const t=this.ye,e=t.layerScene.baseUrl;if(this.pe<=1.6)return t[this.Re]&&t[this.Re].lodSelection?(this.Ie=t[this.Re],this.be()):new Promise((r=>{let n=e+"/nodes/"+this.Re;t.layerScene.eslpk&&(n+="/3dNodeIndexDocument.json"),this.ge(this.Dt,n,(()=>{this.Ie=t[this.Re],r(this.be())}))}));if(this.pe>=1.7){if(t[this.Re])return this.Ie=t[this.Re],this.be();const r=Math.floor(this.Re/t.nodesPerPage);return new Promise((n=>{let i=e+"/nodepages/"+r;t.layerScene.eslpk&&(i+=".json"),this.ge(this.Dt,i,(()=>{this.Ie=t[this.Re],n(this.be())}))}))}return null}getTileset(){return this.Se}getChildrenURL(){return this.Pe}be(){const t=this.ye,e=t.layerScene.baseUrl,r=this.Ie.children,n=[],i={};if(r)for(let s=0;s<r.length;s++)if(this.pe<=1.6){const o=r[s].id;if(t[o])continue;const a=o;i[a]||(i[a]=new Promise((r=>{let n=e+"/nodes/"+a;t.layerScene.eslpk&&(n+="/3dNodeIndexDocument.json"),this.ge(this.Dt,n,(()=>{r()}))})),n.push(i[a]))}else{const o=r[s];if(t[o])continue;const a=Math.floor(o/t.nodesPerPage);i[a]||(i[a]=new Promise((r=>{let n=e+"/nodepages/"+a;t.layerScene.eslpk&&(n+=".json"),this.ge(this.Dt,n,(()=>{r()}))})),n.push(i[a]))}return n.length?Promise.all(n).then((()=>this.Me())):this.Me()}Me(){return Promise.resolve(this.Ne())}De(t){an(this.ye,t)}Ne(){return{asset:{i3s:!0,version:"1.0",gltfUpAxis:"Z"},geometricError:Number.MAX_VALUE,root:this.Oe(this.Ie,!0)}}Oe(t){const e=this.pe,r=this.ye,n=t;var i,s=n.obb,o=n.mbs,a={};if(o)i=ln([],o[0],o[1],o[2]),a.sphere=[...i,o[3]];else if(s){const t=function(t,e,r){const n=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],o=r+r,a=n+n,A=i+i,c=r*o,l=n*o,f=n*a,h=i*o,u=i*a,E=i*A,_=s*o,B=s*a,d=s*A;return t[0]=1-f-E,t[3]=l-d,t[6]=h+B,t[1]=l+d,t[4]=1-c-E,t[7]=u-_,t[2]=h-B,t[5]=u+_,t[8]=1-c-f,t}([],r);return n[0]=n[0]*e[0],n[1]=n[1]*e[0],n[2]=n[2]*e[0],n[3]=n[3]*e[1],n[4]=n[4]*e[1],n[5]=n[5]*e[1],n[6]=n[6]*e[2],n[7]=n[7]*e[2],n[8]=n[8]*e[2],[...t,...n]}(i=ln([],s.center[0],s.center[1],s.center[2]),s.halfSize,s.quaternion),e=t[3]+t[6]+t[9],r=t[4]+t[7]+t[10],n=t[5]+t[8]+t[11];tt(An,e,r,n);const o=lt(An);a.sphere=[...i,o]}var A=1/0,c=0;if(n.mbs?c=n.mbs[3]:n.obb&&(c=Math.max(Math.max(n.obb.halfSize[0],n.obb.halfSize[1]),n.obb.halfSize[2])),void 0!==n.lodThreshold)"maxScreenThresholdSQ"===r.lodSelectionMetricType?A=c/(Math.sqrt(n.lodThreshold)/(.25*Math.PI)):console.error("Unsupported lodSelectionMetricType in Layer");else if(void 0!==n.lodSelection)for(var l=0;l<n.lodSelection.length;l++)"maxScreenThreshold"===n.lodSelection[l].metricType&&(A=c/n.lodSelection[l].maxError);(A===1/0||isNaN(A))&&(A=1e5);var f=16*A;const h=z([]),u=n.children;var E;if(u){E=[];const t=this.ye;for(let r=0;r<u.length;r++){const n=e<=1.6?u[r].id:u[r];if(!t[n]){E=null;break}E.push(this.Oe(t[n]))}}var _={refine:"REPLACE",boundingVolume:a,transform:h,geometricError:f};return e<=1.6?t.lodSelection?t.geometryData&&(_.content={uri:"i3s:mesh:"+(t.id||t.index)}):_.content={uri:"i3s:tileset:"+(t.id||t.index)}:u&&u.length&&!E?_.content={uri:"i3s:tileset:"+(t.id||t.index)}:n.mesh&&(_.content={uri:"i3s:mesh:"+(t.id||t.index)}),E&&E.length&&(_.children=E),_}getJSON(){return this.Ie}}function ln(t,e,r,n){return pe(t,N(e),N(r),n)}const fn=!!on.ktx2,hn=r.mat4.identity([]),un=(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){}return!1})();function En(t){return t.indexOf("i3s:mesh")>=0}const _n="i3s:mesh:".length;function Bn(t,e,r,n,i){const s=e.layerScene.eslpk,o=function(t,e){const r=e.substring(_n);return t>=1.7?parseInt(r):r}(e.version,t),a=e[o],A=e.layerScene.baseUrl,c=[];let l=!1;const f=hn;let h,u;if(e.version<=1.6){if(!a.geometryData)return null;const t=a.geometryData.length;if(!t)return null;let r=A+`/nodes/${a.id}/`+a.geometryData[t-1].href;s&&(r+=".bin");const n={geometry:{url:r,info:e.layerScene.store.defaultGeometrySchema}};let i=a.textureData&&a.textureData[0]&&a.textureData[0].href;if(i){const t=e.layerScene.store.textureEncoding[0];let r;r="image/jpeg"===t?"jpg":"png",s&&(i+="."+r);const o={pbrMetallicRoughness:{baseColorTexture:{url:A+`/nodes/${a.id}/`+i,factor:1,format:r,mimeType:t},metallicFactor:0}};n.material=o}c.push(n)}else{h=a.mesh.geometry,u=a.mesh.material;const t=e.layerScene.geometryDefinitions[h.definition],{geometryBuffers:o}=t;l=n&&2===o.length;const f=on.draco&&l?o[1]:o[0],E=on.draco&&l?1:0;let _=A+`/nodes/${h.resource}/geometries/`+E;s&&(_+=".bin");const B={geometry:{url:_,info:f}};if(i&&un&&l&&!on.draco)throw new Error("Must import @maptalks/transcoder.draco to load i3s draco compressed geometry");const d=e.layerScene.materialDefinitions,C=e.layerScene.textureSetDefinitions;let T,m=0;if(u&&(m=d[u.definition]),d){T=function(t,e,r,n,i,s){const o=JSON.parse(JSON.stringify(t));return dn(o,e,r,n,i,s),o}(m,C,A,u.resource,r,e.layerScene.eslpk)}else T={pbrMetallicRoughness:{metallicFactor:0}};B.material=T,c.push(B)}return{dracoCompression:l,meshes:c,nodeIndex:o,center:a.obb&&a.obb.center||a.mbs&&[a.mbs[0],a.mbs[1],a.mbs[2]],transform:f}}function dn(t,e,r,n,i,s){for(const o in t)if(t[o]&&t[o].textureSetDefinitionId>=0){const a=e[t[o].textureSetDefinitionId],A="images/"+a.formats[0].format,c=Cn(a.formats,i),l={url:r+`/nodes/${n}/textures/${c.name}`,factor:void 0===t[o].factor?1:t[o].factor,format:c.format,mimeType:A};if(s){let t="";switch(c.format){case"dds":t="bin.dds";break;case"jpg":case"png":t=c.format}l.url+="."+t}t[o]=l}else P(t[o])&&dn(t[o],e,r,n,i,s)}function Cn(t,e){for(let r=0;r<=t.length;r++){const n=t[r].format;if("dds"===n&&e.hasExtension("WEBGL_compressed_texture_s3tc"))return t[r];if("jpg"===n||"png"===n)return t[r];if("ktx2"===n&&fn)return t[r]}return null}const Tn=[];class mn extends i.renderer.CanvasRenderer{constructor(t){super(t),this.prepareWorker(),this.tilesLoading={},this.tileCache=new Ae(1024*t.options.maxGPUMemory*1024,this.deleteTile.bind(this)),this.Le={},this.Fe=[],this.ge=this.xe.bind(this)}getAnalysisMeshes(){if(!this.painter)return Tn;const t=this.painter.getPaintedMeshes();if(!t)return Tn;const e=[],{b3dmMeshes:r,pntsMeshes:n,i3dmMeshes:i}=t;return r.length&&V(e,r),n.length&&V(e,n),i.length&&V(e,i),e}needToRedraw(){return!!this.getMap().isInteracting()||(!!this.Fe.length||super.needToRedraw())}getFrameTimestamp(){return this.we}drawOnInteracting(t,e,r){this.draw(e,r)}draw(t,e){this.we=t;const r=this.prepareCanvas();if(r&&!r.intersects(this.canvasExtent2D))return void this.completeRender();const{root:n,tiles:i}=this.layer.getTiles(),s=i.length;if(!i||!s)return void this.completeRender();this.ve(),this.Ue();const{selectedTiles:o,leaves:a,requests:A}=this.Ge(n,i);A.length&&this.loadTiles(A),this.He(o,a,e),this.Ve(),A.length||this.completeRender()}Ge(t,e){const r=this.layer.getRootTiles();let n=[];this.Ke();let i=0;const s=this.ke(),o={};let a=!1,A=!1;for(let t=0;t<e.length;t++){const s=e[t],c=s.node;if(o[c.id])continue;const l=r[c.Dt];o[c.id]=1;let f=!1;const h=this.getCachedTile(c.id);if(this.Xe(c.id)?(i++,f=A=!0,this.tilesLoading[c.id].current=!0):h?(this.getTileOpacity(h)<1&&(f=A=!0),(!s.node.ze||l.isS3M||!s.node.children||s.node.ze<=500)&&(a=!0,s.selected=!0,s.data=h)):this.painter.has(c)||(f=A=!0,n.push(c)),!f)continue;if(this.Je(s))a=!0;else{this.Ye(s).length&&(a=!0)}}let c=[],l={};if(a&&({selectedTiles:c,leaves:l}=this.Ze(t)),n.length>1&&(n.sort(gn),s)){const t=s-i;n=t>0?n.slice(0,t):[]}return{loading:A,requests:n,selectedTiles:c,leaves:l}}Ze(t){const e=[],r={};let n;const i=[t],s=[];for(;i.length>0||s.length>0;){if(s.length>0){const t=s[s.length-1];if(t.We===i.length){s.pop(),t===n&&(t.leave=!0,r[t.node.id]=1),e.push(t);continue}}const t=i.pop(),o=t.children;if(t.selected)if("add"===t.node.refine)r[t.node.id]=1,t.selectionDepth=s.length,e.push(t);else{if(t.selectionDepth=s.length,n=t,0===o.length){t.leave=!0,r[t.node.id]=1,e.push(t);continue}s.push(t),t.We=i.length}for(let t=0;t<o.length;t++)i.push(o[t])}return{selectedTiles:e,leaves:r}}Je(t){if(!t.parent)return null;let e=t.parent;for(;e&&e.level>=0;){const t=e.node.id;if(this.tileCache.has(t))return e.selected=!0,e.data=this.tileCache.get(t),e;e=e.parent}return null}Ye(t){const e=[];if(!t.node.children||!t.node.children.length)return e;const r=t.wt+1,n=[t.node];for(;n.length>0;){const i=n.pop().children;for(let s=0,o=i.length;s<o;s++){if((!i[s].content||!i[s].content.url)&&i[s].children&&i[s].children.length){n.push(i[s]);continue}const o=i[s].id;if(this.tileCache.has(o)){const r=this.layer.je(i[s],t);r.selected=!0,r.data=this.tileCache.get(o),t.children.push(r),e.push(r)}else i[s].wt<=r&&n.push(i[s])}}return e}He(t,e,r){this.tileCache.markAll(!1);for(let e=0,r=t.length;e<r;e++){const r=t[e].data;r.current=!0,this.tileCache.add(t[e].node.id,r)}this.tileCache.shrink();const n={tiles:t,leaves:e};this.onDrawTileStart(n);const i=this.painter.paint(t,e,r);this.onDrawTileEnd(n),i&&this.layer.fire("canvasisdirty",{renderCount:i})}onDrawTileStart(){}onDrawTileEnd(){}loadTiles(t){for(let e=0,r=t.length;e<r;e++){const r=t[e];this.tilesLoading[r.id]={current:!0,node:r},this.loadTile(r)}}loadTile(t){let e=t.content.url;if(G(e)){const r=H(e);return void this.Qe(e,r,t)}if(function(t){return t.indexOf("i3s:tileset")>=0}(e)){const r=t.Dt,n=this.qe[r];return new cn(e,r,n,this.ge).load().then((r=>{this.onTilesetLoad(r,t,e)}))}t&&-1===e.indexOf("http://")&&-1===e.indexOf("https://")&&!En(e)&&(e=t.baseUrl+e);const r=this.layer.options.services[t.Dt];if(r.ajaxInMainThread){let n=r.urlParams;n&&(n=(e.indexOf("?")>0?"&":"?")+n);let i=Lt.getArrayBuffer(e+(n||""),r.fetchOptions);const s=i.xhr;i=i.then((r=>{delete this.Le[e],r?this.Qe(e,r.data,t):this.onTileError(null,t)})).catch((r=>{delete this.Le[e],this.onTileError(r,t)})),this.Le[e]=s}else this.Qe(e,null,t)}Qe(t,e,n){let i=this.A;i||(i=r.reshader.Util.getSupportedFormats(this.gl.gl||this.gl),this.A=i);const s=this.layer.options.services[n.Dt];s.isSuperMapiServer&&(t=function(t,e){const r=t.substring(e.length),n=r.split("/"),i=[];for(let t=0;t<n.length;t++)i.push(encodeURIComponent(n[t]));return e+i.join("/")}(t,n.baseUrl));const o={url:t=this.layer.getTileUrl(t,n.baseUrl,s),arraybuffer:e,rootIdx:n.Dt,upAxis:n.ie,transform:n.matrix,supportedFormats:i};if(En(t)){const e=this.qe[n.Dt];if(o.i3sInfo=Bn(t,e,this.regl,this.layer.options.enableI3SCompressedGeometry,this.layer.options.forceI3SCompressedGeometry),!o.i3sInfo)return void this.onTileError({status:404},n)}this.workerConn.loadTile(this.layer.getId(),o,((e,r)=>{if(e)return void this.onTileError(e,n);const{magic:i}=r;"b3dm"===i||"pnts"===i||"i3dm"===i||"cmpt"===i?this.Fe.push({data:r,tile:n}):this.onTilesetLoad(r,n,t)}))}Ue(){const t=this.getMap(),e=this.layer.options.meshLimitPerFrame;let r=0;for(;this.Fe.length&&(r<e||!t.isInteracting());){const{data:t,tile:e}=this.Fe.shift(),{magic:n}=t;"b3dm"===n?this.painter.createB3DMMesh(t,e.id,e,((r,{mesh:n})=>{this.$e(t,e,r,n)})):"pnts"===n?this.painter.createPntsMesh(t,e.id,e,((r,{mesh:n})=>{this.$e(t,e,r,n)})):"i3dm"===n?this.painter.createI3DMMesh(t,e.id,e,((r,{mesh:n})=>{this.$e(t,e,r,n)})):"cmpt"===n&&this.painter.createCMPTMesh(t,e.id,e,((r,{mesh:n})=>{this.$e(t,e,r,n)})),r++}}$e(t,e,r,n){if(r)this.onTileError(r,e);else{const r=this.tr(n);e.memorySize=r,this.onTileLoad(t,e)}}tr(t){let e=0;if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]&&(e+=this.tr(t[r]));else t&&(e+=t.getMemorySize());return e}onTileLoad(t,e){this.layer&&(delete this.tilesLoading[e.id],this.layer.onTileLoad(t,e),this.er(e),this.setToRedraw(),this.layer.fire("tileload",{node:e}))}onTilesetLoad(t,e,r){this.layer&&(this.layer.he=t.extensions&&t.extensions["s3m:VertexCompressionType"],t.capabilities||t.layers&&t.layers[0]&&t.layers[0].capabilities?this.rr(t,e,r):(delete this.tilesLoading[e.id],this.layer.onTilesetLoad(t,e,r)))}onTileError(t,e){if(!this.layer)return;const r=e.content.url;console.warn("failed to load 3d tile: "+r),console.warn(t),delete this.tilesLoading[e.id],this.nr(e,t),this.setToRedraw(),this.layer.fire("tileerror",{node:e,error:t})}getCachedTile(t){return this.tileCache.get(t)}nr(t,e){const r={loadTime:i.Util.now(),current:!0,error:e,node:t};this.tileCache.add(t.id,r)}er(t){const e={loadTime:i.Util.now(),current:!0,node:t};this.tileCache.add(t.id,e)}abortTileLoading(t){if(!t||!this.workerConn)return;const e=t.node.content.url;if(this.layer.options.services[t.node.Dt].ajaxInMainThread){const t=this.Le[e];t&&t.abort()}else this.workerConn.abortTileLoading(this.layer.getId(),e);delete this.Le[e]}Ke(){if(this.tilesLoading)for(const t in this.tilesLoading)this.tilesLoading[t].current=!1}deleteTile(t){this.painter.deleteTile(t)}createContext(){const t=this.layer,e=t.options.glOptions||{alpha:!0,depth:!0,stencil:!0,preserveDrawingBuffer:!0,antialias:t.options.antialias},n=this.canvas.gl&&this.canvas.gl.wrap;n?(this.gl=this.canvas.gl.wrap(),this.regl=this.canvas.gl.regl):(this.glOptions=e,this.gl=this.ir(this.canvas,e)),this.regl=this.regl||r.createREGL({gl:this.gl,attributes:e,extensions:["OES_element_index_uint"],optionalExtensions:t.options.optionalExtensions||[]}),n&&(this.canvas.pickingFBO=this.canvas.pickingFBO||this.regl.framebuffer(this.canvas.width,this.canvas.height)),this.pickingFBO=this.canvas.pickingFBO||this.regl.framebuffer(this.canvas.width,this.canvas.height),this.painter=new rn(this.regl,t),this.layer.sr()}prepareWorker(){const t=this.getMap();this.workerConn||(this.workerConn=new se("@maptalks/3dtiles",t.id));const e=this.workerConn;if(!e.isActive())return;let r=this.layer.options||{};r=b({},r),delete r.offset,r.projection=t.getSpatialReference().getProjection().code;const n=this.layer.getId();e.addLayer(n,r,(t=>{if(t)throw t;this.layer&&(this.ready=!0,this.layer.fire("workerready"))}))}onRemove(){this.painter&&this.painter.remove(),this.pickingFBO&&(this.canvas.pickingFBO||this.pickingFBO.destroy(),delete this.pickingFBO),this.workerConn&&(this.workerConn.removeLayer(this.layer.getId(),(t=>{if(t)throw t})),this.workerConn.remove(),delete this.workerConn),this.clear(),delete this.tileCache,super.onRemove()}clear(){this.Ve(!0),this.tileCache.reset(),this.tilesLoading={},super.clear()}clearCanvas(){this.regl&&this.regl.clear({color:[0,0,0,0],depth:1,stencil:0}),super.clearCanvas()}getTileOpacity(){return 1}getStencilValue(){return 0}Ve(t){this.ar||(this.ar=Date.now());const e=Date.now();if(t||!(e-this.ar<this.layer.options.retireInterval)){this.ar=e;for(const e in this.tilesLoading){const r=this.tilesLoading[e];!t&&r.current||this.abortTileLoading(r)}}}ke(){return this.getMap().isInteracting()?this.layer.options.loadingLimitOnInteracting:this.layer.options.loadingLimit}ir(t,e){const r=["webgl","experimental-webgl"];let n=null;for(let i=0;i<r.length;++i){try{n=t.getContext(r[i],e)}catch(t){}if(n)break}return n}Xe(t){return!!this.tilesLoading[t]}getI3DMMeshes(){return this.painter.getI3DMMeshes()}getPNTSMeshes(){return this.painter.getPNTSMeshes()}getB3DMMeshes(){return this.painter.getB3DMMeshes()}readBatchData(t,e,r){return ze(t,e,0,r)}ve(){if(!this.Ar)return;const t=this.layer.options.i3sNodepageLimitPerFrame||Number.MAX_VALUE;let e=0;const r=[];for(const n in this.Ar){const i=this.Ar[n];if("pending"===i.status)continue;i.status="pending";const s=i.rootIdx;if(r.push(Lt.getJSON(n).then((t=>{delete this.Ar[n];const e=this.qe[s];if(e){t.nodes?an(e,t.nodes):(e[t.id]=t,an(e,t.children));for(let t=0;t<i.length;t++)i[t]();this.setToRedraw()}else this.setToRedraw()}))),e++,e>=t)break}r.length&&Promise.all(r)}xe(t,e,r){this.Ar||(this.Ar={}),this.Ar[e]=this.Ar[e]||[],this.Ar[e].rootIdx=t,this.Ar[e].push(r),this.setToRedraw()}rr(t,e,r){this.qe||(this.qe=[]);const n=e.Dt;this.qe[n]||(this.qe[n]={});const i=this.qe[n],s=this.layer.options.services[n];t.layers&&(t=t.layers[0],"/"!==r[r.length-1]&&(r+="/"),r+="layers/0"),i.version=+(s.i3sVersion||t.store.version),function(t,e,r,n,i,s){if(!i.layerScene){i.layerScene=t,i.nodesPerPage=t.nodePages&&t.nodePages.nodesPerPage||64,i.lodSelectionMetricType=t.nodePages&&t.nodePages.lodSelectionMetricType;let e=n;if(i.layerScene.eslpk=e.indexOf("3dSceneLayer.json")>=0,e.endsWith(".json")){const t=n.lastIndexOf("/");e=t<0?"./":n.substring(0,t)}i.layerScene.baseUrl=function(t){return t.split("?")[0]}(e)}return new cn(n,e,i,s).load()}(t,n,0,r,i,this.ge).then((t=>{this.onTilesetLoad(t,e,r)}))}pick(t,e,r){return this.painter?this.painter.pick(t,e,r&&r.tolerance):[]}highlight(t){if(this.Ot||(this.Ot=[]),Array.isArray(t))for(let e=0;e<t.length;e++){const r=t[e].service||0;let n=this.Ot[r];n||(n=this.Ot[r]=new Map),n.set(t[e].id,t[e])}else{const e=t.service||0;let r=this.Ot[e];r||(r=this.Ot[e]=new Map),r.set(t.id,t)}this.painter.highlight(this.Ot)}cancelHighlight(t,e){if(!this.Ot)return;const r=this.Ot[t];if(r){if(Array.isArray(e))for(let t=0;t<e.length;t++)r.delete(e[t]);else r.delete(e);this.painter.highlight(this.Ot)}}cancelAllHighlight(){delete this.Ot,this.painter.cancelAllHighlight()}showOnly(t){if(this.Ft||(this.Ft=[]),Array.isArray(t))for(let e=0;e<t.length;e++){const r=t[e].service||0;let n=this.Ft[r];n||(n=this.Ft[r]=new Map),n.set(t[e].id,t[e])}else{const e=t.service||0;let r=this.Ft[e];r||(r=this.Ft[e]=new Map),r.set(t.id,t)}this.painter.showOnly(this.Ft)}cancelShowOnly(){delete this.Ft,this.painter.cancelShowOnly()}Te(){return this.painter?this.painter.Te():[]}}function gn(t,e){return t.Xt-e.Xt}function pn(t,e,r){return t[0]=e[r],t[1]=e[r+3],t[2]=e[r+6],t}function Rn(t,e,r){return Math.sqrt(function(t,e,r){var n=rt(yn,r,t),i=pn(In,e,0),s=pn(bn,e,1),o=pn(Sn,e,2),a=lt(i),A=lt(s),c=lt(o);st(i,i),st(s,s),st(o,o);var l=Pn;l[0]=ot(n,i),l[1]=ot(n,s),l[2]=ot(n,o);var f,h=0;l[0]<-a?h+=(f=l[0]+a)*f:l[0]>a&&(h+=(f=l[0]-a)*f);l[1]<-A?h+=(f=l[1]+A)*f:l[1]>A&&(h+=(f=l[1]-A)*f);l[2]<-c?h+=(f=l[2]+c)*f:l[2]>c&&(h+=(f=l[2]-c)*f);return h}(t,e,r))}const yn=[],In=[],bn=[],Sn=[],Pn=[];const Mn=2*Math.PI;class Nn{constructor(t,e,r,n){this.west=t,this.south=e,this.east=r,this.north=n}static contains(t,e){var r=e[0],n=e[1],i=t.west,s=t.east;return s<i&&(s+=Mn,r<0&&(r+=Mn)),(r>i||Ge(r,i,1e-14))&&(r<s||Ge(r,s,1e-14))&&n>=t.south&&n<=t.north}static southwest(t,e){return e[0]=t.west,e[1]=t.south,e[2]=0,e}static northeast(t,e){return e[0]=t.east,e[1]=t.north,e[2]=0,e}static southeast(t,e){return e[0]=t.east,e[1]=t.south,e[2]=0,e}static northwest(t,e){return e[0]=t.west,e[1]=t.north,e[2]=0,e}}const Dn=[0,0,1];function On(t,e){return pe(e,t[0],t[1],t[2])}class Ln{constructor(t,e){this.normal=r.vec3.copy([],t),this.distance=e}static fromPointNormal(t,e,n){var i=-r.vec3.dot(e,t);return r.vec3.copy(n.normal,e),n.distance=i,n}}const Fn=[],xn=[],wn=[],vn=[],Un=[],Gn=[],Hn=[],Vn=[],Kn=[],kn=[],Xn=new Ln([1,0,0],0),zn=[];class Jn{constructor(t){this.southwestCornerCartesian=[],this.northeastCornerCartesian=[],this.westNormal=[],this.eastNormal=[],this.southNormal=[],this.northNormal=[],this.rectangle=new Nn(...t),this.minimumHeight=t[4],this.maximumHeight=t[5],this.computeBox(this.rectangle)}distanceToCamera(t,e){var n,i,s,o=0;if(!Nn.contains(this.rectangle,e)){var a=this.southwestCornerCartesian,A=this.northeastCornerCartesian,c=this.westNormal,l=this.southNormal,f=this.eastNormal,h=this.northNormal,u=r.vec3.subtract(zn,t,a),E=r.vec3.dot(u,c),_=r.vec3.dot(u,l),B=r.vec3.subtract(zn,t,A),d=r.vec3.dot(B,f),C=r.vec3.dot(B,h);E>0?o+=E*E:d>0&&(o+=d*d),_>0?o+=_*_:C>0&&(o+=C*C)}if(n=e[2],i=this.minimumHeight,n>(s=this.maximumHeight)){var T=n-s;o+=T*T}else if(n<i){var m=i-n;o+=m*m}return Math.sqrt(o)}computeBox(t){const e=this;On(Nn.southwest(t,xn),e.southwestCornerCartesian),On(Nn.northeast(t,xn),e.northeastCornerCartesian),Fn[0]=t.west,Fn[1]=.5*(t.south+t.north),Fn[2]=0;var n=On(Fn,wn),i=r.vec3.cross(Un,n,Dn);r.vec3.normalize(e.westNormal,i),Fn[0]=t.east;var s=On(Fn,Vn),o=r.vec3.cross(Un,Dn,s);r.vec3.normalize(e.eastNormal,o);var a,A=r.vec3.subtract(Un,n,s),c=r.vec3.normalize(vn,A),l=t.south;if(l>0){Fn[0]=.5*(t.west+t.east),Fn[1]=l;var f=On(Fn,Kn);r.vec3.copy(kn,c);var h=Ln.fromPointNormal(e.southwestCornerCartesian,e.westNormal,Xn);Yn(Kn,kn,h,e.southwestCornerCartesian),a=Fe(f,Gn)}else a=xe(Nn.southeast(t,xn),Gn);var u=r.vec3.cross(Hn,a,A);r.vec3.normalize(e.southNormal,u);var E,_=t.north;if(_<0){Fn[0]=.5*(t.west+t.east),Fn[1]=_;var B=On(Fn,Kn);r.vec3.scale(kn,c,-1);var d=Ln.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,Xn);Yn(Kn,kn,d,e.northeastCornerCartesian),E=Fe(B,Gn)}else E=xe(Nn.northwest(t,xn),Gn);var C=r.vec3.cross(Hn,A,E);r.vec3.normalize(e.northNormal,C)}}function Yn(t,e,n,i){var s=t,o=e,a=n.normal,A=r.vec3.dot(a,o);if(!(Math.abs(A)<Ue)){var c=(-n.distance-r.vec3.dot(a,s))/A;if(!(c<0))return i=r.vec3.scale(i,o,c),r.vec3.add(i,s,i)}}const Zn=new i.Extent(0,0,0,0),Wn=new i.Extent(0,0,0,0),jn=[],Qn=[],qn=[],$n=[],ti=new i.Point(0,0),ei=[],ri=new i.Coordinate(0,0),ni=r.mat4.identity([]),ii=[0,0];class si extends i.Layer{constructor(t,e){super(t,e),this.cr(),this.Le={},this.lr=[]}cr(){let t=this.options.services.map((t=>t.url));this.hr=t.map(((t,e)=>function(t,e){t=O(t);const n={visible:1,baseUrl:t.substring(0,t.lastIndexOf("/"))+"/",content:{url:t},refine:"replace",matrix:r.mat4.identity([]),Dt:e,wt:0};return n}(t,e))),this.fire("rootready",{roots:this.hr.slice(0)})}showService(t){return this.ur(t,1),this}hideService(t){return this.ur(t,0),this}setToRedraw(){const t=this.getRenderer();t&&t.setToRedraw()}ur(t,e){const r=this.hr[t];if(!r)return;r.visible=e;const n=this.getRenderer();n&&n.setToRedraw()}getTileUrl(t){return t}getExtent(t){if(!t&&0!==t){const t=new i.Extent;for(let e=0;e<this.hr.length;e++)if(this.hr[e].boundingVolume){const r=this.boundingVolumeToExtent(this.hr[e]);t._combine(r)}return t}return this.hr[t]&&this.hr[t].boundingVolume?this.boundingVolumeToExtent(this.hr[t]):null}boundingVolumeToExtent(t){const e=t.boundingVolume.Er?ni:t.matrix,n=this.getMap();if(t.boundingVolume.region){const e=t.boundingVolume.region;return new i.Extent(D(e[0]),D(e[1]),D(e[2]),D(e[3]))}if(t.boundingVolume.sphere){const s=t.boundingVolume.sphere,o=Pe([],r.vec3.transformMat4([],s,e)),a=s[3],A=n.locate(o,-a,a),c=n.locate(o,a,-a);return new i.Extent(A,c)}if(t.boundingVolume.box){const s=t.boundingVolume.box,o=r.vec3.transformMat4([],s,e),a=new i.Coordinate(Pe([],o)),A=s.slice(3);r.mat3.multiply(A,r.mat3.fromMat4([],t.matrix),A);const c=r.vec3.length(A.slice(0,3)),l=r.vec3.length(A.slice(3,6)),f=r.vec3.length(A.slice(6,9)),h=Math.max(c,l,f),u=n.locate(a,-h,h),E=n.locate(a,h,-h);return new i.Extent(u,E)}return null}getRootTiles(){return this.hr}getTiles(){const t=this.getRenderer();if(!t.ready)return this._r(),{tiles:$n};const e=this.getMap(),n=e.cameraPosition;let i,s;if(e.getGLZoom)s=e.pointToDistance(n[2],0,e.getGLZoom()),ri.set(n[0],n[1]),i=e.pointToCoord(ri,e.getGLZoom());else{const t=e.getGLRes();s=e.pointAtResToDistance(n[2],0,t),ri.set(n[0],n[1]),i=e.pointAtResToCoord(ri,t)}this.Br=this.Br||[],r.vec3.set(this.Br,N(i.x),N(i.y),s),this.dr=pe(this.dr||[],this.Br[0],this.Br[1],this.Br[2]),this.Cr=2*Math.tan(.5*N(e.getFov()));const o=e.projViewMatrix,a={children:[],level:-1};let A=a;const c=[];for(let e=0;e<this.hr.length;e++){const r=this.hr[e];if(!r.visible)continue;let n=1/0;const i=[r],s=this.Tr(e);for(;i.length>0;){const e=i.pop();for(e.id||this.mr(e);A.level>=e.wt;)A=A.parent;const r=this.gr(e,s,o);if(r<1){let t=A;for(;t&&!t.content;)t=t.parent;0===r&&t&&t.content&&this.pr(c,t);if(!1===this.options.services[e.Dt].alwaysShow)continue;if(!(0===r&&e.wt<=n))continue;e.content&&(n=e.wt)}e.Xt<1/0&&this.Rr(e);const a=this.je(e,A);A.children.push(a);const l=e.children,f=l&&l.length,h=a.content;if(!f&&h&&this.pr(c,a),f){h&&"add"===e.refine&&this.pr(c,a),A=a;const r=l[0].parent;let n=!1;for(let s=0,o=l.length;s<o;s++){if(r){const e=t.getCachedTile(l[s].id);if(e&&e.error&&404!==e.error.status)continue;n=!0}else{n=!0,l[s].parent=e,l[s].ie=e.ie,l[s].baseUrl=e.baseUrl;const t=l[s].content&&(l[s].content.url||l[s].content.uri);t&&(G(t)||t.indexOf("i3s:")>=0?l[s].baseUrl=e.baseUrl:-1===t.indexOf("http://")&&-1===t.indexOf("https://")?l[s].content.url=e.baseUrl+t:l[s].baseUrl=t.substring(0,t.lastIndexOf("/")+1))}i.push(l[s])}!n&&h&&this.pr(c,a)}}}return{root:a,tiles:c}}pr(t,e){const{viewerRequestVolume:r}=e.node;r&&!function(t,e,r){if(r.region){const e=r.region;if(t[0]>=e[0]&&t[0]<=e[2]&&t[1]>=e[1]&&t[1]<=e[3])return!0}else{if(r.sphere)return oi(r,e);if(r.box)return 0===ai(r,e)}return!1}(this.Br,this.dr,r)||t.push(e)}je(t,e){return{id:t.id,node:t,children:[],level:t.wt,parent:e,content:t.content&&t.content.url}}mr(t){t.id=i.Util.GUID(),t.matrix=t.transform||r.mat4.identity([]),t.yr=this.Ir(t),t.parent&&(function(t){return t.content&&t.content.uri&&t.content.uri.indexOf("i3s:")>=0}(t)||(t.matrix=r.mat4.multiply(t.matrix,t.parent.matrix,t.matrix)),t.Dt=t.parent.Dt,void 0===t.wt&&(t.wt=t.parent.wt+1),t.maxExtent=t.parent.maxExtent),t.refine=t.refine&&t.refine.toLowerCase()||"replace",t.content&&!t.content.url&&t.content.uri&&(t.content.url=t.content.uri),this.br(t)}br(t){const e=t.boundingVolume;if(!e||e.Er)return;const n=this.options.services[t.Dt],i=n.heightOffset||0,s=this.options.offset,o=S(s)||s[0]||s[1],a=n.coordOffset||ii;if(!Array.isArray(a))throw new Error("service.coordOffset must be an array");if(!t.boundingVolume||!i&&r.mat4.exactEquals(t.matrix,ni)&&!o&&a===ii)return;const{region:A,box:c,sphere:l}=e;if(A){const t=this.Sr([D(A[0]),D(A[1])]);A[0]=N(t.x+a[0]),A[1]=N(t.y+a[1]);const e=this.Sr([D(A[2]),D(A[3])]);A[2]=N(e.x+a[0]),A[3]=N(e.y+a[1]),A[4]+=i+(a[2]||0),A[5]+=i+(a[2]||0)}else if(c||l){const e=c||l,n=r.vec3.transformMat4(jn,e,t.matrix),s=Pe(Qn,n),o=this.Sr([s[0]+a[0],s[1]+a[1]]);s[0]=o.x,s[1]=o.y,s[2]+=i+(a[2]||0),pe(e,N(s[0]),N(s[1]),s[2])}e.Er=!0}Ir(t){return void 0===t.geometricError||!t.boundingVolume}Rr(t){let e=t.parent;for(;e&&e.yr&&!(e.Xt<=t.Xt);)e.Xt=t.Xt,e=t.parent}onTileLoad(t,e){if(t.children&&(!e.children||!e.children.length)){e.children=t.children;const r=e.content.url;e.baseUrl=r.substring(0,r.lastIndexOf("/")+1);const n=this.getRenderer();n&&n.setToRedraw()}}onTilesetLoad(t,e,n){if(!t)return void console.warn("invalid tileset at : "+n);const i=this.options.services[e.Dt],s=(t.asset&&t.asset.gltfUpAxis||e&&e.ie||i.upAxis||"Y").toUpperCase();t.root.baseUrl=n.substring(0,n.lastIndexOf("/")+1);const o=n.indexOf("realspace/")>-1;0===e.wt&&(t.asset&&t.asset.s3mType&&o||i.isSuperMapiServer)&&(t.root.baseUrl+="data/path/");const a=t.asset.i3s,A=!!t.asset.s3mType;if(t.root.ie=s,e){const n=e.Dt,i=this.hr[n];A&&!i.isS3M&&(i.isS3M=A);const s=e.boundingVolume;b(e,t.root),e.refine=e.refine&&e.refine.toLowerCase()||"replace",s&&(e.boundingVolume=s);const o=t.root.transform;o&&(e.parent?a||(e.matrix=r.mat4.multiply([],e.parent.matrix,o)):e.matrix=o),this.br(e),e.Pr=e.content,delete e.content,t.root.content&&(e.content=t.root.content),e.yr=this.Ir(e);const c=e.content&&(e.content.url||e.content.uri);c&&e.content.uri&&(e.content.url=e.content.uri,delete e.content.uri),a||!c||G(c)||-1!==c.indexOf("http://")||-1!==c.indexOf("https://")||(e.content.url=e.baseUrl+c)}this._r(),this.fire("loadtileset",{tileset:t,index:e&&e.Dt,url:n})}gr(t,e,r){if(t.Xt=1/0,0===t.wt||t.yr)return 1;if(!this.Mr(t,e,r))return-1;if(0===t.geometricError)return 1;let n=this.options.services[t.Dt].maximumScreenSpaceError;null==n&&(n=8);let i=this.Nr(t);return 0===i&&t.parent&&(i=.5*(t.parent.ze||0)),i>=n?1:0}Qt(t,e){e||(e=new i.Point(0,0));const r=this.getMap();return r.getGLZoom?r.coordToPoint(t,r.getGLZoom(),e):r.coordToPointAtRes(t,r.getGLRes(),e)}Mr(t,e,n){const s=t.id;let o=this.lr[s];const{boundingVolume:a}=t,c=a.sphere;let l=a.region;const h=a.box;if(!o){let e,n,A;if(h&&(l=function(t,e){for(let e=0;e<9;e++)di[e]=t[e+3];const n=di;r.mat4.exactEquals(e,ni)||r.mat3.multiply(n,r.mat3.fromMat4(ei,e),n);const i=r.vec3.copy(Ai,t),s=r.vec3.set(ci,n[0],n[1],n[2]),o=r.vec3.set(li,n[3],n[4],n[5]),a=r.vec3.set(fi,n[6],n[7],n[8]);hi[0]=hi[0]||[];const A=r.vec3.copy(hi[0],i);r.vec3.sub(A,A,s),r.vec3.sub(A,A,o),r.vec3.sub(A,A,a),hi[1]=hi[1]||[];const c=r.vec3.copy(hi[1],i);r.vec3.sub(c,c,s),r.vec3.sub(c,c,o),r.vec3.add(c,c,a),hi[2]=hi[2]||[];const l=r.vec3.copy(hi[2],i);r.vec3.sub(l,l,s),r.vec3.add(l,l,o),r.vec3.sub(l,l,a),hi[3]=hi[3]||[];const f=r.vec3.copy(hi[3],i);r.vec3.sub(f,f,s),r.vec3.add(f,f,o),r.vec3.add(f,f,a),hi[4]=hi[4]||[];const h=r.vec3.copy(hi[4],i);r.vec3.add(h,h,s),r.vec3.sub(h,h,o),r.vec3.sub(h,h,a),hi[5]=hi[5]||[];const u=r.vec3.copy(hi[5],i);r.vec3.add(u,u,s),r.vec3.sub(u,u,o),r.vec3.add(u,u,a),hi[6]=hi[6]||[];const E=r.vec3.copy(hi[6],i);r.vec3.add(E,E,s),r.vec3.add(E,E,o),r.vec3.sub(E,E,a),hi[7]=hi[7]||[];const _=r.vec3.copy(hi[7],i);r.vec3.add(_,_,s),r.vec3.add(_,_,o),r.vec3.add(_,_,a);for(let t=0;t<hi.length;t++)ui[t]=ui[t]||[],Pe(ui[t],hi[t]),Ei[t]=ui[t][0],_i[t]=ui[t][1],Bi[t]=ui[t][2];return[N(Math.min(...Ei)),N(Math.min(..._i)),N(Math.max(...Ei)),N(Math.max(..._i)),Math.min(...Bi),Math.max(...Bi)]}(h,t.matrix),a.region=l),l){e=Zn.set(D(l[0]),D(l[1]),D(l[2]),D(l[3]));const t=e.getCenter(),r=this.Dr(t);e=e.convertTo((t=>this.Qt(t,ti)),Wn),A=l[4],n=l[5],o=this.lr[s]=[[e.xmin,e.ymin,A*r[2]],[e.xmax,e.ymax,n*r[2]]],o.center=t}else if(c){const t=Pe(jn,c),e=new i.Coordinate(t),r=this.Qt(e,ti).toArray(),n=this.Dr(e);r.push(t[2]*n[2]),o=this.lr[s]=[r,c[3]*n[2]],o.center=e}}if(e){if(l)Zn.xmin=o[0][0],Zn.ymin=o[0][1],Zn.xmax=o[1][0],Zn.ymax=o[1][1];else if(c){const t=o[2];Zn.xmin=o[0][0]-t,Zn.ymin=o[0][1]-t,Zn.xmax=o[0][0]+t,Zn.ymax=o[0][1]+t}else if(h){const t=o[1],e=o[2];Zn.xmin=o[0][0]-t,Zn.ymin=o[0][1]-e,Zn.xmax=o[0][0]+t,Zn.ymax=o[0][1]+e}if(!e.intersects(Zn))return!1}return l?f(n,o):c?function(t,e,r){p(t);for(var n=e[0],i=-e[1],s=0;s<6;s++)if((!r||"0"!==r.charAt(s))&&y(A[s],n)<i)return!1;return!0}(n,o):!!h&&function(t,e,r){p(t);for(var n=0;n<6;n++)if(!(r&&"0"===r.charAt(n)||g(A[n],e)))return!1;return!0}(n,o)}Dr(t){const e=this.getMap(),n=e.distanceToPointAtRes(100,100,e.getGLRes(),t);let i;return i=e.altitudeToPoint?e.altitudeToPoint(100,e.getGLRes())/100:n.y/100,r.vec3.set(qn,n.x/100*1.01,n.y/100*1.01,i),qn}Sr(t){Array.isArray(t)&&(t=new i.Coordinate(t));let e=this.options.offset;if(S(e)&&(e=e(Array.isArray(t)?new i.Coordinate(t):t)),e[0]||e[1]){const r=this.getMap(),n=r.getGLRes(),i=r.coordToPointAtRes(t,n);return i._sub(e),r.pointAtResToCoord(i,n)}return t}Tr(t){const e=this.options.services[t].maxExtent;if(!e)return null;const r=this.hr[t];return r.maxExtent||(r.maxExtent=new i.Extent(e).convertTo((t=>this.Qt(t)))),r.maxExtent}Nr(t){const e=this.Cr,r=t.geometricError;if(0===r)return t.ze=0,0;const n=this.getMap();let i;t.boundingVolume.region?i=function(t,e,r){t.Or||(t.Or=new Jn(t.boundingVolume.region));return t.Or.distanceToCamera(e,r)}(t,this.dr,this.Br):t.boundingVolume.sphere?i=oi(t.boundingVolume,this.dr):t.boundingVolume.box&&(i=ai(t.boundingVolume,this.dr));const s=Math.max(Math.abs(i),1e-7),o=r*n.height/(s*e);return t.Xt=i,t.ze=o,o}_r(){const t=this.getRenderer();t&&t.setToRedraw()}ce(t){return this.lr[t]}identify(t,e={}){const r=this.getMap(),n=this.getRenderer();if(!r||!n)return[];const s=r.coordToContainerPoint(new i.Coordinate(t));return this.identifyAtPoint(s,e)}identifyAtPoint(t,e={}){const r=this.getMap(),n=this.getRenderer();if(!r||!n)return[];const i=r.getDevicePixelRatio();return n.pick(t.x*i,t.y*i,e)}getCurrentBatchIDs(){const t=this.getMap(),e=this.getRenderer();return t&&e?e.Te():[]}highlight(t){const e=this.getRenderer();return e?(e.highlight(t),this):(this.Ot||(this.Ot=[]),this.Ot.push(t),this)}sr(){if(this.Ot){for(let t=0;t<this.Ot.length;t++)this.highlight(this.Ot[t]);delete this.Ot}}cancelHighlight(t,e){const r=this.getRenderer();return r?(r.cancelHighlight(t,e),this):this}cancelAllHighlight(){const t=this.getRenderer();return t?(t.cancelAllHighlight(),this):this}showOnly(t){const e=this.getRenderer();return e?(e.showOnly(t),this):(this.Ft||(this.Ft=[]),this.Ft.push(t),this)}Lr(){if(this.Ft){for(let t=0;t<this.Ft.length;t++)this.showOnly(this.Ft[t]);delete this.Ft}}cancelShowOnly(t){const e=this.getRenderer();return e?(e.cancelShowOnly(t),this):this}}function oi(t,e){const n=t.sphere,i=r.vec3.dist(n,e),s=t.sphere[3];return i<s?0:i-s}function ai(t,e){const n=t.box;return Rn(r.vec3.set(jn,n[0],n[1],n[2]),r.mat3.set(ei,n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11]),e)}si.mergeOptions({"maxGPUMemory":512,"retireInterval":2e3,"loadingLimitOnInteracting":5,"loadingLimit":0,"renderer":"gl","forceRenderOnZooming":!0,"forceRenderOnRotating":!0,"forceRenderOnMoving":!0,"debug":!1,"debugOutline":[0,1,0],"meshLimitPerFrame":1,"i3sNodepageLimitPerFrame":1,"enableI3SCompressedGeometry":!0,"forceI3SCompressedGeometry":!0,"picking":!0,"pickingPoint":!0,"geometryEvents":!1,"antialias":!1,"optionalExtensions":["ANGLE_instanced_arrays","OES_element_index_uint","OES_standard_derivatives","OES_vertex_array_object","OES_texture_half_float","OES_texture_half_float_linear","OES_texture_float","OES_texture_float_linear","WEBGL_depth_texture","EXT_shader_texture_lod","WEBGL_compressed_texture_astc","WEBGL_compressed_texture_etc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb"],"offset":[0,0]}),si.registerRenderer("gl",mn),si.registerJSONType("Geo3DTilesLayer");const Ai=[],ci=[],li=[],fi=[],hi=[],ui=[],Ei=[],_i=[],Bi=[],di=[];let Ci=null;function Ti(){return Ci||(Ci={"image/crn":on.crn&&on.crn(),"image/ktx2":on.ktx2&&on.ktx2(),"image/cttf":on.ktx2&&on.ktx2(),"draco":on.draco&&on.draco()}),Ci}class mi{constructor(t,e,r){this.o=t,this.Fr=e||Qt,this.A=r,this.wr=Ti()}static createEmptyB3DM(){return{featureTable:null,batchTable:null,gltf:{}}}load(t,e,r=0,n=0,i){return e?(n||(n=e.byteLength),this.vr(t,e,r,n,i)):Lt.getArrayBuffer(t,{}).then((e=>{const i=e.data;return n||(n=i.byteLength),this.vr(t,i,r,n)}))}vr(t,e,r,n,i){const s=i&&i.maxTextureSize,o=this.Ur(e,r,n,t);if(o.error)return Promise.resolve(o);const a=t.substring(0,t.lastIndexOf("/")),A=new this.Fr(a,o.glb,{transferable:!0,requestImage:this.o,decoders:this.wr,supportedFormats:this.A,maxTextureSize:s});return A.load({skipAttributeTransform:!1}).then((e=>{e.url=`${t}-${r}-${n}`;const i=A.transferables;for(let t=0;t<o.transferables.length;t++)i.indexOf(o.transferables[t])<0&&i.push(o.transferables[t]);return{magic:"b3dm",count:o.count,transferables:i,featureTable:o.featureTable,batchTable:o.batchTable,batchTableBin:o.batchTableBin,gltf:e}}))}Ur(t,e,r,n){const i=new DataView(t,e,r),s=i.getUint32(4,!0);if(1!==s){const t="Unsupported b3dm version: "+s+", url:"+n;return console.warn(t),{error:t}}if(i.getUint32(8,!0)!==i.byteLength){const t="Length in b3dm header is inconsistent with b3dm's byte length, url: "+n;return console.warn(t),{error:t}}let o,a=i.getUint32(12,!0),A=i.getUint32(16,!0),c=i.getUint32(20,!0),l=i.getUint32(24,!0),f=28+e;c>=570425344?(f-=8,o=a,c=A,l=0,a=0,A=0):l>=570425344&&(f-=4,o=c,c=a,l=A,a=0,A=0);const h=[t];let u,E,_;if(a>0?(u=Ke(t,f,a),f+=a,o=u.BATCH_LENGTH):u={"BATCH_LENGTH":o},A>0&&(f+=A),c>0&&(E=ke(t,f,c),f+=c,l>0)){const e=Xe(0,f,l);_=t.slice(e.offset,e.offset+e.byteLength),f+=l,h.push(_)}const B=u.BATCH_LENGTH,d={};if(u&&u.BATCH_ID){d.BATCH_ID=Je(u.BATCH_ID,t,undefined.offset,B);const e=d.BATCH_ID.array&&d.BATCH_ID.array.buffer;e&&h.indexOf(e)<0&&h.push(e)}return{count:o,transferables:h,featureTable:u,batchTable:E,batchTableBin:_,b3dm:d,glb:{buffer:t,byteOffset:f,byteLength:i.byteLength+i.byteOffset-f}}}Gr(){return null}}class gi{constructor(t,e,r,n){this.o=t,this.Fr=e||Qt,this.A=r,this.wr=Ti(),this.Hr=n}load(t,e,r=0,n=0,i){return e?(n||(n=e.byteLength),this.vr(t,e,r,n,i)):Lt.getArrayBuffer(t,{}).then((e=>{const i=e.data;return n||(n=i.byteLength),this.vr(t,i,r,n)}))}vr(t,e,r,n,i){return this.Vr(t,e,r,n,i).then((({gltf:i,transferables:s})=>{const o=this.Kr(e,r,n,t);if(o.error)return Promise.resolve(o);for(let t=0;t<s.length;t++)-1===o.transferables.indexOf(s[t])&&o.transferables.push(s[t]);return delete i.transferables,Promise.resolve({magic:"i3dm",count:o.count,transferables:o.transferables,featureTable:o.featureTable,batchTable:o.batchTable,batchTableBin:o.batchTableBin,i3dm:o.i3dm,gltf:i})}))}Vr(t,e,r,n,i){const s=i&&i.maxTextureSize,o={transferable:!0,requestImage:this.o,decoders:this.wr,supportedFormats:this.A,maxTextureSize:s},a=new DataView(e,r,n),A=32+a.getUint32(12,!0)+a.getUint32(16,!0)+a.getUint32(20,!0)+a.getUint32(24,!0);if(0===a.getUint32(28,!0)){let n=x(new Uint8Array(e,A+r,a.byteLength-A));-1==n.indexOf("://")&&(n=t.substring(0,t.lastIndexOf("/"))+"/"+n);return n.indexOf(".glb")>0?Lt.getArrayBuffer(n,{}).then((t=>this.kr(n,{buffer:t.data,byteOffset:0},o))):Lt.getJSON(n,{}).then((t=>this.kr(n,t,o)))}{const n={buffer:e,byteOffset:A+r,byteLength:a.byteLength-A};return this.kr(t,n,o)}}kr(t,e,r){const n=t.substring(0,t.lastIndexOf("/")),i=new this.Fr(n,e,r);return i.load({skipAttributeTransform:!0}).then((r=>{let n=0,s=0;return e.buffer&&(n=e.byteOffset||0,s=e.byteLength||0),r.url=`${t}-${n}-${s}`,{transferables:i.transferables,gltf:r}}))}Kr(t,e,r,n){const i=new DataView(t,e,r),s=i.getUint32(4,!0);if(1!==s){const t="Unsupported pnts version: "+s+", url:"+n;return console.warn(t),{error:t}}if(i.getUint32(8,!0)!==i.byteLength){const t="Length in pnts header is inconsistent with pnts's byte length, url: "+n;return console.warn(t),{error:t}}const o=[t],{featureTable:a,featureTableBin:A,batchTable:c,batchTableBin:l}=tr(i,32+e,o),f={},h=a.INSTANCES_LENGTH;if(a.POSITION){const{byteOffset:e}=a.POSITION;f.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:new Float32Array(t,e+A.offset,3*h).slice()},o.push(f.POSITION.array.buffer)}else if(a.POSITION_QUANTIZED){const e=a.QUANTIZED_VOLUME_OFFSET,r=a.QUANTIZED_VOLUME_SCALE,{byteOffset:n}=a.POSITION_QUANTIZED;f.POSITION={byteStride:12,byteOffset:0,itemSize:3,count:h,componentType:5126,array:this.Xr(new Uint16Array(t,n+A.offset,3*h),e,r)},o.push(f.POSITION.array.buffer)}if(a.BATCH_ID){f.BATCH_ID=Je(a.BATCH_ID,t,A.offset,h);const e=f.BATCH_ID.array&&f.BATCH_ID.array.buffer;e&&o.indexOf(e)<0&&o.push(e)}if(a.NORMAL_UP){let{byteOffset:e}=a.NORMAL_UP;f.NORMAL_UP={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:new Float32Array(t,e+A.offset,3*h).slice()},o.push(f.NORMAL_UP.array.buffer),e=a.NORMAL_RIGHT.byteOffset,f.NORMAL_RIGHT={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:new Float32Array(t,e+A.offset,3*h).slice()},o.push(f.NORMAL_RIGHT.array.buffer)}else if(a.NORMAL_UP_OCT32P){let{byteOffset:e}=a.NORMAL_UP_OCT32P;f.NORMAL_UP={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:this.zr(new Uint16Array(t,e+A.offset,2*h))},o.push(f.NORMAL_UP.array.buffer),e=a.NORMAL_RIGHT_OCT32P.byteOffset,f.NORMAL_RIGHT={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:this.zr(new Uint16Array(t,e+A.offset,2*h))},o.push(f.NORMAL_RIGHT.array.buffer)}if(a.SCALE){const{byteOffset:e}=a.SCALE;f.SCALE={byteStride:0,byteOffset:0,itemSize:1,count:h,componentType:5126,array:new Float32Array(t,e+A.offset,h).slice()},o.push(f.SCALE.array.buffer)}else if(a.SCALE_NON_UNIFORM){const{byteOffset:e}=a.SCALE_NON_UNIFORM;f.SCALE_NON_UNIFORM={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:new Float32Array(t,e+A.offset,3*h).slice()},o.push(f.SCALE_NON_UNIFORM.array.buffer)}return{count:h,batchTable:c,batchTableBin:l,featureTable:a,i3dm:f,transferables:o}}zr(t){const e=t.length/2,r=new Float32Array(3*e),n=[];for(let i=0;i<e;i++)pi(n,t[2*i],t[2*i+1],65535),r[3*i]=n[0],r[3*i+1]=n[1],r[3*i+2]=n[2];return r}Xr(t,e,r){return $e(new Float32Array(t.length),t,e,r)}Gr(){return null}}function pi(t,e,r,n){if(t[0]=Ri(e,n),t[1]=Ri(r,n),t[2]=1-(Math.abs(t[0])+Math.abs(t[1])),t[2]<0){const e=t[0];t[0]=(1-Math.abs(t[1]))*yi(e),t[1]=(1-Math.abs(e))*yi(t[1])}return st(t,t)}function Ri(t,e){return e=function(t,e){if(null!=t)return t;return e}(e,255),function(t,e,r){return t<e?e:t>r?r:t}(t,0,e)/e*2-1}function yi(t){return t<0?-1:1}class Ii{constructor(){}load(t,e,r=0,n=0){return e?(n||(n=e.byteLength),this.vr(t,e,r,n)):Lt.getArrayBuffer(t,{}).then((e=>{const i=e.data;return n||(n=i.byteLength),this.vr(t,i,r,n)}))}vr(t,e,r,n){return this.Jr(e,r,n,t).then((t=>t.error?t:{magic:"pnts",count:t.count,transferables:t.transferables,featureTable:t.featureTable,batchTable:t.batchTable,batchTableBin:t.batchTableBin,pnts:t.pnts}))}Jr(t,e,r,n){const i=new DataView(t,e,r),s=i.getUint32(4,!0);if(1!==s){const t="Unsupported pnts version: "+s+", url:"+n;return console.warn(t),{error:t}}if(i.getUint32(8,!0)!==i.byteLength){const t="Length in pnts header is inconsistent with pnts's byte length, url: "+n;return console.warn(t),{error:t}}const o=[t],{featureTable:a,featureTableBin:A,batchTable:c,batchTableBin:l}=tr(i,e+28,o),f=a.QUANTIZED_VOLUME_OFFSET,h=a.QUANTIZED_VOLUME_SCALE,u=a.POINTS_LENGTH;let E,_={};if(a.extensions&&a.extensions["3DTILES_draco_point_compression"]){_=a.extensions["3DTILES_draco_point_compression"],E=new DataView(t,_.byteOffset+A.offset,_.byteLength);const e={attributes:_.properties,useUniqueIDs:!1};return this.Yr||(this.Yr=Ti().draco),this.Yr(E,e).then((e=>{const r=e.attributes;!a.POSITION&&!a.POSITION_QUANTIZED||r.POSITION||r.POSITION_QUANTIZED||(r.POSITION=a.POSITION,r.POSITION_QUANTIZED=a.POSITION_QUANTIZED),!(a.RGB||a.RGBA||a.RGB565)||r.RGB||r.RGBA||r.RGB565||(r.RGB=a.RGB,r.RGBA=a.RGBA,r.RGB565=a.RGB565),!a.NORMAL&&!a.NORMAL_OCT16P||r.NORMAL||r.NORMAL_OCT16P||(r.NORMAL=a.NORMAL,r.NORMAL_OCT16P=a.NORMAL_OCT16P);const n=this.Zr(t,e.attributes,A.offset,u,o,f,h);if(e.attributes.BATCH_ID){const t=e.attributes.BATCH_ID.array;n.BATCH_ID={byteStride:0,byteOffset:0,itemSize:1,count:t.length,componentType:qe(t.constructor),array:t},o.push(t.buffer)}else if(a.BATCH_ID||Object.keys(c).length){a.BATCH_ID?n.BATCH_ID=Je(a.BATCH_ID,t,A.offset,u):n.BATCH_ID=bi(u);const e=n.BATCH_ID.array&&n.BATCH_ID.array.buffer;e&&o.indexOf(e)<0&&o.push(e)}return{count:u,batchTable:c,batchTableBin:l,featureTable:a,pnts:n,transferables:o}}))}const B=this.Zr(t,a,A.offset,u,o,f,h);if(a.BATCH_ID||Object.keys(c).length){a.BATCH_ID?B.BATCH_ID=Je(a.BATCH_ID,t,A.offset,u):B.BATCH_ID=bi(u);const e=B.BATCH_ID.array&&B.BATCH_ID.array.buffer;e&&o.indexOf(e)<0&&o.push(e)}return Promise.resolve({count:u,batchTable:c,batchTableBin:l,featureTable:a,pnts:B,transferables:o})}Zr(t,e,r,n,i,s,o){const a={};if(e.POSITION){let{byteOffset:s,array:o}=e.POSITION;s=s||0;const A=o?0:r;if(!o){const e=t.slice(s+A,s+A+3*n*4);o=new Float32Array(e)}a.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5126,array:o},i.push(o.buffer)}else if(e.POSITION_QUANTIZED){let{byteOffset:A,array:c}=e.POSITION_QUANTIZED;A=A||0;const l=c?0:r;a.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5126,array:this.Xr(c||new Uint16Array(t,A+l,3*n),s,o)},i.push(a.POSITION.array.buffer)}if(e.RGBA){let{byteOffset:s,array:o}=e.RGBA;s=s||0;const A=o?0:r;if(!o){const e=t.slice(s+A,s+A+4*n);o=new Uint8Array(e)}a.RGBA={byteStride:0,byteOffset:0,itemSize:4,count:n,componentType:5121,array:o},i.push(o.buffer)}else if(e.RGB){let{byteOffset:s,array:o}=e.RGB;s=s||0;const A=o?0:r;if(!o){const e=t.slice(s+A,s+A+3*n);o=new Uint8Array(e)}a.RGB={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5121,array:o},i.push(o.buffer)}else if(e.RGB565){let{byteOffset:s,array:o}=e.RGB565;s=s||0;const A=o?0:r;if(!o){const e=t.slice(s+A,s+A+2*n);o=new Uint16Array(e)}a.RGB565={byteStride:0,byteOffset:0,itemSize:1,count:n,componentType:5123,array:o},i.push(o.buffer)}if(e.NORMAL){let{byteOffset:s,array:o}=e.NORMAL;s=s||0;const A=o?0:r;if(!o){const e=t.slice(s+A,s+A+3*n*4);o=new Float32Array(e)}a.NORMAL={byteStride:0,byteOffset:0,itemSize:3,count:n,componentType:5126,array:o},i.push(o.buffer)}else if(e.NORMAL_OCT16P){let{byteOffset:s,array:o}=e.NORMAL_OCT16P;s=s||0;const A=o?0:r;if(!o){const e=t.slice(s+A,s+A+2*n);o=new Uint8Array(e)}a.NORMAL_OCT16P={byteStride:0,byteOffset:0,itemSize:2,count:n,componentType:5121,array:o},i.push(o.buffer)}return a}Xr(t,e,r){return $e(new Float32Array(t.length),t,e,r)}Gr(){return null}}function bi(t){const e=U(t),r=new e(t);for(let e=0;e<t;e++)r[e]=e;return{byteStride:0,byteOffset:0,itemSize:1,count:t,componentType:qe(e),array:r}}class Si{constructor(t,e,r,n){this.A=r,this.o=t,this.Fr=e||Qt,this.Hr=n}load(t,e,r=0,n=0,i){return e?this.vr(t,e,r,n,i):Lt.getArrayBuffer(t,{}).then((e=>{const i=e.data;return this.vr(t,i,r,n)}))}vr(t,e,r,n,i){n||(n=e.byteLength);const s=this.Wr(e,t,r,n),o=[];for(let r=0;r<s.length;r++){let n;if("b3dm"===s[r].magic)n=new mi(this.o,this.Fr,this.A);else if("i3dm"===s[r].magic)n=new gi(this.o,this.Fr,this.A,this.Hr);else if("pnts"===s[r].magic)n=new Ii;else{if("cmpt"!==s[r].magic){console.warn("Unsupported magic in CMPT tile:",s[r].magic);continue}n=new Si(this.o,this.Fr,this.A,this.Hr)}o.push(n.load(t,e,s[r].offset,s[r].byteLength,i).then((t=>t)))}return Promise.all(o).then((t=>({magic:"cmpt",tiles:t})))}Wr(t,e,r,n){const i=new DataView(t,r,n),s=i.getUint32(4,!0);if(1!==s){const t="Unsupported cmpt version: "+s+", url:"+e;return console.warn(t),{error:t}}if(16===i.byteLength)return[];const o=[],a=i.getUint32(12,!0);let A=16;for(let e=0;e<a;e++){const e=He(i,A),n=i.getUint32(A+8,!0);o.push({magic:e,buffer:t,offset:A+r,byteLength:n}),A+=n}return o}}if(s.transcoders){const t=i.Map.VERSION;if(t.indexOf("1.0.0-beta")>=0||t.indexOf("1.0.0-alpha")>=0){const t=s.transcoders.inject(a);i.registerWorkerAdapter("@maptalks/3dtiles",t)}else i.registerWorkerAdapter("@maptalks/3dtiles",(function(){return s.transcoders.inject(a)}))}else i.registerWorkerAdapter("@maptalks/3dtiles",a);t.B3DMLoader=mi,t.CMPTLoader=Si,t.Geo3DTilesLayer=si,t.Geo3DTilesUtil=K,t.Geo3DTransform=we,Object.defineProperty(t,"t",{value:!0}),"undefined"!=typeof console&&console.log("@maptalks/3dtiles v0.23.1")}));
23
+ */(o,a)),c.generateBuffers(this.nt,{excludeElementsInVAO:e}),c}ce(t,e,r,i){const o=n.mat4.identity(t),s=this.getMap();Sn.x=r[0],Sn.y=r[1];const a=this._prjToPoint(Sn),c=this.Be(),A=1/(s.getGLZoom?s.getResolution(s.getGLZoom()):s.getGLRes());Sn.x=e[0],Sn.y=e[1];const l=this.le();let f=this.$.options.offset;B(f)&&(f=f(Sn));const h=this.$.options.services[i].heightOffset||0;return n.vec3.set(vn,a.x-f[0],a.y-f[1],l*r[2]+l*h),n.mat4.translate(o,o,vn),n.vec3.set(c,A,A,l),n.mat4.scale(o,o,c),o}$t(t,e){const r=n.mat4.identity(t),i=this.getMap(),o=this.Be();Sn.x=e[0],Sn.y=e[1];const s=i.distanceToPointAtRes(100,100,i.getGLRes(),Sn);let a;return a=i.altitudeToPoint?this.Rt:s.y/100,n.vec3.set(o,s.x/100*1.01,s.y/100*1.01,a),n.mat4.scale(r,r,o),r}gt(){const t={x:0,y:0,width:()=>this.tt?this.tt.width:1,height:()=>this.tt?this.tt.height:1};this.zt=new n.reshader.MeshShader({vert:"attribute vec3 aPosition;\n\n\n\nuniform mat4 projViewModelMatrix;\n\n\n\nvoid main() {\n\n gl_Position = projViewModelMatrix * vec4(aPosition, 1.0);\n\n}\n\n",frag:"precision mediump float;\nuniform vec3 color;\nvoid main() {\n gl_FragColor = vec4(color, 1.0);\n}\n",uniforms:["color",{name:"projViewModelMatrix",type:"function",fn:(t,e)=>n.mat4.multiply([],e.projViewMatrix,e.modelMatrix)}],extraCommandProps:{viewport:t}});const e=[],r=[];this.Vt=new n.reshader.MeshShader({vert:"const float SHIFT_RIGHT_11 = 1.0 / 2048.0;\n\nconst float SHIFT_RIGHT_5 = 1.0 / 32.0;\n\nconst float SHIFT_LEFT_11 = 2048.0;\n\nconst float SHIFT_LEFT_5 = 32.0;\n\nconst float NORMALIZE_6 = 1.0 / 64.0;\n\nconst float NORMALIZE_5 = 1.0 / 32.0;\n\n\n\n#ifdef HAS_POSITION\n\n attribute vec3 POSITION;\n\n#endif\n\n\n\n#if defined(HAS_RGB)\n\n attribute vec3 RGB;\n\n#elif defined(HAS_RGBA)\n\n attribute vec4 RGBA;\n\n#elif defined(HAS_RGB565)\n\n attribute float RGB565;\n\n#endif\n\n\n\nuniform vec4 pointColor;\n\nuniform float pointSize;\n\n\n\nuniform mat4 projViewModelMatrix;\n\nuniform float pointOpacity;\n\n\n\nvarying vec4 vColor;\n\n\n\n#ifdef HAS_NORMAL\n\n #ifdef HAS_NORMAL_OCT16P\n\n attribute vec2 NORMAL_OCT16P;\n\n float signNotZero(float value) {\n\n return value >= 0.0 ? 1.0 : -1.0;\n\n }\n\n vec2 signNotZero(vec2 value) {\n\n return vec2(signNotZero(value.x), signNotZero(value.y));\n\n }\n\n vec3 octDecode(vec2 encoded, float range) {\n\n if (encoded.x == 0.0 && encoded.y == 0.0) {\n\n return vec3(0.0, 0.0, 0.0);\n\n }\n\n encoded = encoded / range * 2.0 - 1.0;\n\n vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\n\n if (v.z < 0.0) {\n\n v.xy = (1.0 - abs(v.yx)) * signNotZero(v.xy);\n\n }\n\n return normalize(v);\n\n }\n\n vec3 octDecode(vec2 encoded) {\n\n return octDecode(encoded, 255.0);\n\n }\n\n #else\n\n attribute vec3 NORMAL;\n\n #endif\n\n uniform vec3 lightDir;\n\n uniform mat3 modelNormalMatrix;\n\n uniform mat4 positionMatrix;\n\n float getLambertDiffuse(vec3 lightDir, vec3 normal) {\n\n return max(dot(-lightDir, normal), 0.0);\n\n }\n\n#endif\n\n\n\nvoid main() {\n\n #if defined(HAS_RGB)\n\n vColor = vec4(RGB / 255.0, 1.0) * pointOpacity;\n\n #elif defined(HAS_RGBA)\n\n vColor = RGBA / 255.0 * pointOpacity;\n\n #elif defined(HAS_RGB565)\n\n float compressed = RGB565;\n\n float r = floor(compressed * SHIFT_RIGHT_11);\n\n compressed -= r * SHIFT_LEFT_11;\n\n float g = floor(compressed * SHIFT_RIGHT_5);\n\n compressed -= g * SHIFT_LEFT_5;\n\n float b = compressed;\n\n vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5);\n\n vColor = vec4(rgb, 1.0);\n\n #else\n\n vColor = pointColor;\n\n #endif\n\n\n\n #ifdef HAS_POSITION\n\n vec3 localPos = POSITION;\n\n #endif\n\n\n\n #ifdef HAS_NORMAL\n\n mat3 positionNormalMatrix = mat3(positionMatrix);\n\n mat3 normalMatrix = modelNormalMatrix * positionNormalMatrix;\n\n #ifdef HAS_NORMAL_OCT16P\n\n vec3 localNormal = octDecode(NORMAL_OCT16P);\n\n #else\n\n vec3 localNormal = NORMAL;\n\n #endif\n\n vec3 normal = normalize(normalMatrix * localNormal);\n\n float colorStrength = getLambertDiffuse(lightDir, normal);\n\n colorStrength = max(colorStrength, 0.5);\n\n vColor *= colorStrength;\n\n #endif\n\n\n\n gl_Position = projViewModelMatrix * vec4(localPos, 1.0);\n\n gl_PointSize = pointSize;\n\n}\n\n",frag:"#define SHADER_NAME PNTS\n\nprecision mediump float;\n\n\n\nvarying vec4 vColor;\n\n\n\nvoid main() {\n\n gl_FragColor = vColor;\n\n}\n\n",uniforms:[{name:"projViewModelMatrix",type:"function",fn:(t,e)=>n.mat4.multiply(r,e.projViewMatrix,e.modelMatrix)},{name:"modelNormalMatrix",type:"function",fn:(t,r)=>n.mat3.fromMat4(e,r.modelMatrix)}],extraCommandProps:{viewport:t,blend:{enable:!0,func:{src:"src alpha",dst:"one minus src alpha"},equation:"add"},depth:{enable:!0,range:[0,1],func:"<"}}});const i=this.yt();this.Ut=new n.reshader.PhongShader({extraCommandProps:i}),this.Gt=new n.reshader.pbr.StandardShader({extraCommandProps:i});const o=this.$;mn(o.getRenderer().canvas,this.nt,o.getMap()),this.picking=new n.reshader.FBORayPicking(this.rt,{vert:this.Gt.vert,extraCommandProps:i,uniforms:this.Gt.uniforms,defines:{"PICKING_MODE":1,"ENABLE_PICKING":1,"HAS_PICKING_ID":1}},this.pickingFBO,this.getMap())}yt(){return{viewport:{x:0,y:0,width:()=>this.tt?this.tt.width:1,height:()=>this.tt?this.tt.height:1},colorMask:(t,e)=>e.colorMask||Nn,cull:{enable:!0,face:(t,e)=>e.cullFace||"back"},stencil:{enable:(t,e)=>!0===e.stencilEnable,func:{cmp:(t,e)=>e.meshProperties.isLeaf?"always":">=",ref:(t,e)=>e.meshProperties.level},opFront:{fail:"keep",zfail:"keep",zpass:"replace"},opBack:{fail:"keep",zfail:"keep",zpass:"replace"}},depth:{enable:!0,range:[0,1],func:(t,e)=>e.meshProperties.depthFunc||"<"},blend:{enable:!0,func:{src:"src alpha",dst:"one minus src alpha"},equation:"add"},polygonOffset:{enable:!0,offset:(t,e)=>e.meshProperties.polygonOffset}}}Yt(t){return{projViewMatrix:this.getMap().projViewMatrix,color:t&&t.color||[0,1,0]}}Ht(t){const e=this.getMap(),r=e.getLightManager(),i=(r&&r.getDirectionalLight()||{}).direction||[1,1,-1],o=t&&t.pointOpacity||1;return{projViewMatrix:e.projViewMatrix,pointOpacity:o,lightDir:n.vec3.normalize(i,i)}}bt(){const t=this.getMap(),e=this.$.getRenderer().canvas,{iblTexes:n,dfgLUT:r}=pn(e),i=yn(t,n,r),o=this.$.getRenderer().getMaskUniforms();return _(i,{czm_lightDirectionEC:i.light0_viewDirection,lightSpecular:[1,1,1],viewMatrix:t.viewMatrix,projMatrix:t.projMatrix,projViewMatrix:t.projViewMatrix,outSize:[e.width,e.height],polygonFill:[1,1,1,1],polygonOpacity:1}),_(i,o),i}de(t,e,r,i,o){const s=e.materials&&e.materials[t];if(!s||!s.baseColorTexture&&!s.pbrMetallicRoughness)return null;const a=_({},i);if(s.baseColorTexture){const t=e.textures[s.baseColorTexture.index];let n;t&&!t.image.color&&(n=this.I(t)),a.baseColorFactor=t&&t.image.color||s.baseColorFactor||[1,1,1,1],n&&(a.baseColorTexture=n)}else{if(s.normalTexture){const t=this.I(e.textures[s.normalTexture.index]),n=s.normalTexture.scale||1;a.normalTexture=t,a.normalMapFactor=n}if(s.occlusionTexture){const t=this.I(e.textures[s.occlusionTexture.index]),n=s.occlusionTexture.strength||1;a.occlusionTexture=t,a.occlusionFactor=n}if(s.emissiveTexture){const t=this.I(e.textures[s.emissiveTexture.index]);a.emissiveTexture=t}s.emissiveFactor&&(a.emissiveFactor=s.emissiveFactor);const t=s.pbrMetallicRoughness;if(t){if(t.baseColorFactor&&(a.baseColorFactor=t.baseColorFactor),t.baseColorTexture&&void 0!==t.baseColorTexture.index){const r=e.textures[t.baseColorTexture.index];r.image&&r.image.color?a.baseColorFactor=a.baseColorFactor?n.vec4.multiply(a.baseColorFactor,a.baseColorFactor,r.image.color):r.image.color:(a.baseColorTexture=this.I(r),a.baseColorTexture.getREGLTexture(this.nt))}if(d(t.metallicFactor)||(a.metallicFactor=t.metallicFactor),d(t.roughnessFactor)||(a.roughnessFactor=t.roughnessFactor),s.metallicRoughnessTexture){const t=this.I(e.textures[s.metallicRoughnessTexture.index]);a.metallicRoughnessTexture=t}}}if(s.s3mMaterial)return new n.reshader.Material(a);if(a.environmentExposure=o,s.extensions&&s.extensions.KHR_materials_unlit)return a.environmentExposure=1,a.ambientColor=[1,1,1],a.light0_diffuse=[0,0,0,0],a.lightSpecular=[0,0,0],new n.reshader.PhongMaterial(a);let c=new n.reshader.pbr.StandardMaterial(a);"phong"===r&&(c=n.reshader.PhongMaterial.convertFrom(c));const A=s.pbrMetallicRoughness,l=A&&A.baseColorTexture&&A.baseColorTexture.extensions;return l&&l.KHR_texture_transform&&(c.set("khr_offset",l.KHR_texture_transform.offset||[0,0]),c.set("khr_rotation",l.KHR_texture_transform.rotation||0),c.set("khr_scale",l.KHR_texture_transform.scale||[1,1])),c.once("complete",this.Bt),c}I(t){const e={type:t.type?En(t.type):"uint8",format:t.format?dn(t.format):"rgba",flipY:!!t.flipY},r=t.image;r.array?e.data=r.array:r.mipmap&&(e.mipmap=r.mipmap),e.width=r.width,e.height=r.height;const i=t.sampler||t.texture&&t.texture.sampler;return i&&(i.magFilter&&(e.mag=fn(i.magFilter)),i.minFilter&&(e.min=hn(i.minFilter)),i.wrapS&&(e.wrapS=un(i.wrapS)),i.wrapT&&(e.wrapT=un(i.wrapT))),new n.reshader.Texture2D(e,this._t)}Ce(t){const e=t.image,n=window.URL||window.webkitURL,r=new Blob([e.array],{type:e.mimeType});return n.createObjectURL(r)}Ct({target:t}){const e=t._e,n=this.it[e];if(n.count--,!n.count){const t=n.meshes;this.st[e]=t,delete this.it[e];const r=t.ae;delete t.ae,r(null,{mesh:n.meshes,id:e})}}Be(){return bn}jt(t){return this.$.jt(t)}qt(t,e){const n=this.getMap();return n.getGLZoom?n.distanceToPoint(t,e,n.getGLZoom()):n.distanceToPointAtRes(t,e,n.getGLRes())}_pointToPrj(t){const e=this.getMap();return e.getGLZoom?e._pointToPrj(t,e.getGLZoom()):e._pointToPrjAtRes(t,e.getGLRes())}_prjToPoint(t){const e=this.getMap();return e.getGLZoom?e._prjToPoint(t,e.getGLZoom()):e._prjToPointAtRes(t,e.getGLRes(),On)}ne(t){return"Y"===t?Cn:"X"===t?Tn:xn}pick(t,e,n=3){const r=this.$;if(!r||!r.options.picking)return[];if(!this.pickingFBO||!this.picking)return[];const i=this.getMap(),o=this.bt(),s=this.picking;s.render(this.ht.getMeshes().filter(t=>!t.bloom),o,!0);let a={};s.getRenderedMeshes().length&&(a=s.pick(t,e,n,o,{viewMatrix:i.viewMatrix,projMatrix:i.projMatrix,returnPoint:r.options.pickingPoint}));const{meshId:c,pickingId:A,point:l,coordinate:f}=a,h=(0===c||c)&&s.getMeshAt(c);if(!h||!h.geometry)return[];const u=h.properties;l&&l.length&&(l[0]=Math.round(1e5*l[0])/1e5,l[1]=Math.round(1e5*l[1])/1e5,l[2]=Math.round(1e5*l[2])/1e5);const E={batchId:A};if(r.options.debug&&(E.debugInfo=u),u&&u.batchTable){const{batchTable:t,batchTableBin:e,count:n}=u,r=A;for(const i in t)void 0!==t[i].byteOffset?E[i]=Fe(t[i],e,n,r):E[i]=t[i][r]}return[{service:h.properties.serviceIndex,data:E,point:l,coordinate:f}]}xt(t){let e=new Set;for(let n=0,r=t.length;n<r;n++){const r=t[n].data.node;this.Mt(r)&&e.add(r.Lt)}e=Array.from(e),e.sort();const n=new Map,r=e.length;for(let t=0;t<r;t++)n.set(e[t],t);return n}highlight(t){this.Nt=t;const e=this.$.getRenderer();this.Dt=e.getFrameTimestamp(),e.setToRedraw(!0)}cancelAllHighlight(){this.Nt=null;const t=this.$.getRenderer();this.Dt=t.getFrameTimestamp(),t.setToRedraw(!0)}showOnly(t){this.St=t;const e=this.$.getRenderer();this.Ot=e.getFrameTimestamp(),e.setToRedraw(!0)}cancelShowOnly(){this.St=null;const t=this.$.getRenderer();this.Ot=t.getFrameTimestamp(),t.setToRedraw(!0)}Te(){if(!this.It)return[];const t={},e=[];for(const n in this.It){const r=this.It[n];if(r)for(let n=0;n<r.length;n++){const i=r[n],o=i&&i.geometry;if(!i||!o)continue;const s=i.properties.serviceIndex;t[s]||(t[s]=new Set);const a=o.properties.batchIdData;if(a)for(let n=0;n<a.length;n++)t[s].has(a[n])||(e.push({id:a[n],service:s}),t[s].add(a[n]))}}return e}hasIBL(){const t=this.getMap().getLightManager();return!!(t&&t.getAmbientResource())}}const Kn=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")},kn=Kn(),Xn=kn.gl_trans__coders=kn.gl_trans__coders||{};function zn(t,e){if(e)for(let n=0;n<e.length;n++){t[e[n].id||e[n].index]=e[n]}}Xn.inject=function(t){const e=t.toString(),n=e.indexOf("{")+1,r=e.substring(0,n),i=kn.gl_trans__coders=kn.gl_trans__coders||{};let o=`${r}\n const _____getGlobal = ${Kn.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;for(const t in i)"inject"!==t&&"getTranscoder"!==t&&"registerTranscoder"!==t&&(o+='tran_____scoders["'+t+'"] ='+i[t].toString()+"\n;");return o+="\n"+e.substring(r.length),o},Xn.registerTranscoder=function(t,e){Xn[t]=e},Xn.getTranscoder=function(t){return Xn[t]};const Yn=[];class Jn{constructor(t,e,n,r){this.me=t,this.Pt=e,this.ge=r,this.pe=n.version,t.indexOf("i3s:tileset:")<0?(this.pe<=1.6?this.ye="root":this.ye=0,n.version=this.pe):(this.ye=t.substring("i3s:tileset:".length),this.pe>1.6&&(this.ye=parseInt(this.ye))),this.me=t,this.Re=n}load(){const t=this.Re,e=t.layerScene.baseUrl;if(this.pe<=1.6)return t[this.ye]&&t[this.ye].lodSelection?(this.Ie=t[this.ye],this.be()):new Promise(n=>{let r=e+"/nodes/"+this.ye;t.layerScene.eslpk&&(r+="/3dNodeIndexDocument.json"),this.ge(this.Pt,r,()=>{this.Ie=t[this.ye],n(this.be())})});if(this.pe>=1.7){if(t[this.ye])return this.Ie=t[this.ye],this.be();const n=Math.floor(this.ye/t.nodesPerPage);return new Promise(r=>{let i=e+"/nodepages/"+n;t.layerScene.eslpk&&(i+=".json"),this.ge(this.Pt,i,()=>{this.Ie=t[this.ye],r(this.be())})})}return null}getTileset(){return this.xe}getChildrenURL(){return this.Me}be(){const t=this.Re,e=t.layerScene.baseUrl,n=this.Ie.children,r=[],i={};if(n)for(let o=0;o<n.length;o++)if(this.pe<=1.6){const s=n[o].id;if(t[s])continue;const a=s;i[a]||(i[a]=new Promise(n=>{let r=e+"/nodes/"+a;t.layerScene.eslpk&&(r+="/3dNodeIndexDocument.json"),this.ge(this.Pt,r,()=>{n()})}),r.push(i[a]))}else{const s=n[o];if(t[s])continue;const a=Math.floor(s/t.nodesPerPage);i[a]||(i[a]=new Promise(n=>{let r=e+"/nodepages/"+a;t.layerScene.eslpk&&(r+=".json"),this.ge(this.Pt,r,()=>{n()})}),r.push(i[a]))}return r.length?Promise.all(r).then(()=>this.Pe()):this.Pe()}Pe(){return Promise.resolve(this.Ne())}De(t){zn(this.Re,t)}Ne(){return{asset:{i3s:!0,version:"1.0",gltfUpAxis:"Z"},geometricError:Number.MAX_VALUE,root:this.Se(this.Ie,!0)}}Se(t){const e=this.pe,n=this.Re,r=t,i=r.obb,o=r.mbs,s={};let a;if(o)a=Zn([],o[0],o[1],o[2]),s.sphere=[...a,o[3]];else if(i){a=Zn([],i.center[0],i.center[1],i.center[2]);const t=function(t,e,n){const r=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n+n,a=r+r,c=i+i,A=n*s,l=r*s,f=r*a,h=i*s,u=i*a,E=i*c,d=o*s,_=o*a,B=o*c;return t[0]=1-f-E,t[3]=l-B,t[6]=h+_,t[1]=l+B,t[4]=1-A-E,t[7]=u-d,t[2]=h-_,t[5]=u+d,t[8]=1-A-f,t}([],n);return r[0]=r[0]*e[0],r[1]=r[1]*e[0],r[2]=r[2]*e[0],r[3]=r[3]*e[1],r[4]=r[4]*e[1],r[5]=r[5]*e[1],r[6]=r[6]*e[2],r[7]=r[7]*e[2],r[8]=r[8]*e[2],[...t,...r]}(a,i.halfSize,i.quaternion),e=t[3]+t[6]+t[9],n=t[4]+t[7]+t[10],r=t[5]+t[8]+t[11];k(Yn,e,n,r);const o=$(Yn);s.sphere=[...a,o]}let c=1/0,A=0;if(r.mbs?A=r.mbs[3]:r.obb&&(A=Math.max(Math.max(r.obb.halfSize[0],r.obb.halfSize[1]),r.obb.halfSize[2])),void 0!==r.lodThreshold)if("maxScreenThresholdSQ"===n.lodSelectionMetricType){c=A/(Math.sqrt(r.lodThreshold)/(.25*Math.PI))}else console.error("Unsupported lodSelectionMetricType in Layer");else if(void 0!==r.lodSelection)for(let t=0;t<r.lodSelection.length;t++)"maxScreenThreshold"===r.lodSelection[t].metricType&&(c=A/r.lodSelection[t].maxError);(c===1/0||isNaN(c))&&(c=1e5);const l=16*c,f=L([]),h=r.children;let u;if(h){u=[];const t=this.Re;for(let n=0;n<h.length;n++){const r=e<=1.6?h[n].id:h[n];if(!t[r]){u=null;break}u.push(this.Se(t[r]))}}const E={refine:"REPLACE",boundingVolume:s,transform:f,geometricError:l};return e<=1.6?t.lodSelection?t.geometryData&&(E.content={uri:"i3s:mesh:"+(t.id||t.index)}):E.content={uri:"i3s:tileset:"+(t.id||t.index)}:h&&h.length&&!u?E.content={uri:"i3s:tileset:"+(t.id||t.index)}:r.mesh&&(E.content={uri:"i3s:mesh:"+(t.id||t.index)}),u&&u.length&&(E.children=u),E}getJSON(){return this.Ie}}function Zn(t,e,n,r){return ue(t,m(e),m(n),r)}const Wn=!!Xn.ktx2,jn=n.mat4.identity([]),Qn=(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){}return!1})();function qn(t){return t.indexOf("i3s:mesh")>=0}const $n="i3s:mesh:".length;function tr(t,e,n,r,i){const o=e.layerScene.eslpk,s=function(t,e){const n=e.substring($n);return t>=1.7?parseInt(n):n}(e.version,t),a=e[s],c=e.layerScene.baseUrl,A=[];let l=!1;const f=jn;let h,u;if(e.version<=1.6){if(!a.geometryData)return null;const t=a.geometryData.length;if(!t)return null;let n=c+`/nodes/${a.id}/`+a.geometryData[t-1].href;o&&(n+=".bin");const r={geometry:{url:n,info:e.layerScene.store.defaultGeometrySchema}};let i=a.textureData&&a.textureData[0]&&a.textureData[0].href;if(i){const t=e.layerScene.store.textureEncoding[0];let n;n="image/jpeg"===t?"jpg":"png",o&&(i+="."+n);const s={pbrMetallicRoughness:{baseColorTexture:{url:c+`/nodes/${a.id}/`+i,factor:1,format:n,mimeType:t},metallicFactor:0}};r.material=s}A.push(r)}else{h=a.mesh.geometry,u=a.mesh.material;const t=e.layerScene.geometryDefinitions[h.definition],{geometryBuffers:s}=t;l=r&&2===s.length;const f=Xn.draco&&l?s[1]:s[0],E=Xn.draco&&l?1:0;let d=c+`/nodes/${h.resource}/geometries/`+E;o&&(d+=".bin");const _={geometry:{url:d,info:f}};if(i&&Qn&&l&&!Xn.draco)throw new Error("Must import @maptalks/transcoder.draco to load i3s draco compressed geometry");const B=e.layerScene.materialDefinitions,T=e.layerScene.textureSetDefinitions;let m,g=0;if(u&&(g=B[u.definition]),B){m=function(t,e,n,r,i,o){const s=JSON.parse(JSON.stringify(t));return function t(e,n,r,i,o,s){for(const a in e)if(e[a]&&e[a].textureSetDefinitionId>=0){const t=n[e[a].textureSetDefinitionId],c="images/"+t.formats[0].format,A=er(t.formats,o),l={url:r+`/nodes/${i}/textures/${A.name}`,factor:void 0===e[a].factor?1:e[a].factor,format:A.format,mimeType:c};if(s){let t="";switch(A.format){case"dds":t="bin.dds";break;case"jpg":case"png":t=A.format}l.url+="."+t}e[a]=l}else C(e[a])&&t(e[a],n,r,i,o,s)}(s,e,n,r,i,o),s}(g,T,c,u.resource,n,e.layerScene.eslpk)}else m={pbrMetallicRoughness:{metallicFactor:0}};_.material=m,A.push(_)}return{dracoCompression:l,meshes:A,nodeIndex:s,center:a.obb&&a.obb.center||a.mbs&&[a.mbs[0],a.mbs[1],a.mbs[2]],transform:f}}function er(t,e){for(let n=0;n<=t.length;n++){const r=t[n].format;if("dds"===r&&e.hasExtension("WEBGL_compressed_texture_s3tc"))return t[n];if("jpg"===r||"png"===r)return t[n];if("ktx2"===r&&Wn)return t[n]}return null}const nr=[];class rr extends(n.MaskRendererMixin(i.renderer.CanvasRenderer)){constructor(t){super(t),this.prepareWorker(),this.tilesLoading={},this.tileCache=new $t(1024*t.options.maxGPUMemory*1024,this.deleteTile.bind(this)),this.Oe={},this.Le=[],this.ge=this.Fe.bind(this)}getAnalysisMeshes(){if(!this.painter)return nr;const t=this.painter.getPaintedMeshes();if(!t)return nr;const e=[],{b3dmMeshes:n,pntsMeshes:r,i3dmMeshes:i}=t;return n.length&&D(e,n),r.length&&D(e,r),i.length&&D(e,i),e}needToRedraw(){return!!this.getMap().isInteracting()||(!!this.Le.length||super.needToRedraw())}getFrameTimestamp(){return this.we}drawOnInteracting(t,e,n){this.draw(e,n)}draw(t,e){this.we=t;const n=this.prepareCanvas();if(n&&!n.intersects(this.canvasExtent2D))return void this.completeRender();const{root:r,tiles:i}=this.layer.getTiles(),o=i.length;if(!i||!o)return void this.completeRender();this.ve(),this.Ue();const{selectedTiles:s,leaves:a,requests:c}=this.Ge(r,i);c.length&&this.loadTiles(c),this.He(s,a,e),this.Ve(),c.length||this.completeRender()}Ge(t,e){const n=this.layer.getRootTiles();let r=[];this.Ke();let i=0;const o=this.ke(),s={};let a=!1,c=!1;for(let t=0;t<e.length;t++){const o=e[t],A=o.node;if(s[A.id])continue;const l=n[A.Pt];s[A.id]=1;let f=!1;const h=this.getCachedTile(A.id);if(this.Xe(A.id)?(i++,f=c=!0,this.tilesLoading[A.id].current=!0):h?(this.getTileOpacity(h)<1&&(f=c=!0),(!o.node.ze||l.isS3M||!o.node.children||o.node.ze<=500)&&(a=!0,o.selected=!0,o.data=h)):this.painter.has(A)||(f=c=!0,r.push(A)),!f)continue;if(this.Ye(o))a=!0;else{this.Je(o).length&&(a=!0)}}let A=[],l={};if(a&&({selectedTiles:A,leaves:l}=this.Ze(t)),r.length>1&&(r.sort(ir),o)){const t=o-i;r=t>0?r.slice(0,t):[]}return{loading:c,requests:r,selectedTiles:A,leaves:l}}Ze(t){const e=[],n={};let r;const i=[t],o=[];for(;i.length>0||o.length>0;){if(o.length>0){const t=o[o.length-1];if(t.We===i.length){o.pop(),t===r&&(t.leave=!0,n[t.node.id]=1),e.push(t);continue}}const t=i.pop(),s=t.children;if(t.selected)if("add"===t.node.refine)n[t.node.id]=1,t.selectionDepth=o.length,e.push(t);else{if(t.selectionDepth=o.length,r=t,0===s.length){t.leave=!0,n[t.node.id]=1,e.push(t);continue}o.push(t),t.We=i.length}for(let t=0;t<s.length;t++)i.push(s[t])}return{selectedTiles:e,leaves:n}}Ye(t){if(!t.parent)return null;let e=t.parent;for(;e&&e.level>=0;){const t=e.node.id;if(this.tileCache.has(t))return e.selected=!0,e.data=this.tileCache.get(t),e;e=e.parent}return null}Je(t){const e=[];if(!t.node.children||!t.node.children.length)return e;const n=t.Lt+1,r=[t.node];for(;r.length>0;){const i=r.pop().children;for(let o=0,s=i.length;o<s;o++){if((!i[o].content||!i[o].content.url)&&i[o].children&&i[o].children.length){r.push(i[o]);continue}const s=i[o].id;if(this.tileCache.has(s)){const n=this.layer.je(i[o],t);n.selected=!0,n.data=this.tileCache.get(s),t.children.push(n),e.push(n)}else i[o].Lt<=n&&r.push(i[o])}}return e}He(t,e,n){this.tileCache.markAll(!1);for(let e=0,n=t.length;e<n;e++){const n=t[e].data;n.current=!0,this.tileCache.add(t[e].node.id,n)}this.tileCache.shrink();const r={tiles:t,leaves:e};this.onDrawTileStart(r);const i=this.painter.paint(t,e,n);this.onDrawTileEnd(r),i&&this.layer.fire("canvasisdirty",{renderCount:i})}onDrawTileStart(){}onDrawTileEnd(){}loadTiles(t){for(let e=0,n=t.length;e<n;e++){const n=t[e];this.tilesLoading[n.id]={current:!0,node:n},this.loadTile(n)}}loadTile(t){let e=t.content.url;if(P(e)){const n=N(e);return this.Qe(e,n,t),null}if(function(t){return t.indexOf("i3s:tileset")>=0}(e)){const n=t.Pt,r=this.qe[n];return new Jn(e,n,r,this.ge).load().then(n=>{this.onTilesetLoad(n,t,e)})}t&&-1===e.indexOf("http://")&&-1===e.indexOf("https://")&&!qn(e)&&(e=t.baseUrl+e);const n=this.layer.options.services[t.Pt];if(n.ajaxInMainThread){let r=n.urlParams;r&&(r=(e.indexOf("?")>0?"&":"?")+r);let i=yt.getArrayBuffer(e+(r||""),n.fetchOptions);const o=i.xhr;i=i.then(n=>{delete this.Oe[e],n?this.Qe(e,n.data,t):this.onTileError(null,t)}).catch(n=>{delete this.Oe[e],this.onTileError(n,t)}),this.Oe[e]=o}else this.Qe(e,null,t);return null}Qe(t,e,r){let i=this.s;i||(i=n.reshader.Util.getSupportedFormats(this.gl.gl||this.gl),this.s=i);const o=this.layer.options.services[r.Pt];o.isSuperMapiServer&&(t=function(t,e){const n=t.substring(e.length).split("/"),r=[];for(let t=0;t<n.length;t++)r.push(encodeURIComponent(n[t]));return e+r.join("/")}(t,r.baseUrl));const s={url:t=this.layer.getTileUrl(t,r.baseUrl,o),arraybuffer:e,rootIdx:r.Pt,upAxis:r.re,transform:r.matrix,supportedFormats:i};if(qn(t)){const e=this.qe[r.Pt];if(s.i3sInfo=tr(t,e,this.regl,this.layer.options.enableI3SCompressedGeometry,this.layer.options.forceI3SCompressedGeometry),!s.i3sInfo)return void this.onTileError({status:404},r)}this.workerConn.loadTile(this.layer.getId(),s,(e,n)=>{if(e)return void this.onTileError(e,r);const{magic:i}=n;"b3dm"===i||"pnts"===i||"i3dm"===i||"cmpt"===i?this.Le.push({data:n,tile:r}):this.onTilesetLoad(n,r,t)})}Ue(){const t=this.getMap(),e=this.layer.options.meshLimitPerFrame;let n=0;for(;this.Le.length&&(n<e||!t.isInteracting());){const{data:t,tile:e}=this.Le.shift(),{magic:r}=t;"b3dm"===r?this.painter.createB3DMMesh(t,e.id,e,(n,{mesh:r})=>{this.$e(t,e,n,r)}):"pnts"===r?this.painter.createPntsMesh(t,e.id,e,(n,{mesh:r})=>{this.$e(t,e,n,r)}):"i3dm"===r?this.painter.createI3DMMesh(t,e.id,e,(n,{mesh:r})=>{this.$e(t,e,n,r)}):"cmpt"===r&&this.painter.createCMPTMesh(t,e.id,e,(n,{mesh:r})=>{this.$e(t,e,n,r)}),n++}}$e(t,e,n,r){if(n)this.onTileError(n,e);else{const n=this.tn(r);e.memorySize=n,this.onTileLoad(t,e)}}tn(t){let e=0;if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&(e+=this.tn(t[n]));else t&&(e+=t.getMemorySize());return e}onTileLoad(t,e){this.layer&&(delete this.tilesLoading[e.id],this.layer.onTileLoad(t,e),this.en(e),this.setToRedraw(),this.layer.fire("tileload",{node:e}))}onTilesetLoad(t,e,n){this.layer&&(this.layer.he=t.extensions&&t.extensions["s3m:VertexCompressionType"],t.capabilities||t.layers&&t.layers[0]&&t.layers[0].capabilities?this.nn(t,e,n):(delete this.tilesLoading[e.id],this.layer.onTilesetLoad(t,e,n)))}onTileError(t,e){if(!this.layer)return;const n=e.content.url;console.warn("failed to load 3d tile: "+n),console.warn(t),delete this.tilesLoading[e.id],this.rn(e,t),this.setToRedraw(),this.layer.fire("tileerror",{node:e,error:t})}getCachedTile(t){return this.tileCache.get(t)}rn(t,e){const n={loadTime:i.Util.now(),current:!0,error:e,node:t};this.tileCache.add(t.id,n)}en(t){const e={loadTime:i.Util.now(),current:!0,node:t};this.tileCache.add(t.id,e)}abortTileLoading(t){if(!t||!this.workerConn)return;const e=t.node.content.url;if(this.layer.options.services[t.node.Pt].ajaxInMainThread){const t=this.Oe[e];t&&t.abort()}else this.workerConn.abortTileLoading(this.layer.getId(),e);delete this.Oe[e]}Ke(){if(this.tilesLoading)for(const t in this.tilesLoading)this.tilesLoading[t].current=!1}deleteTile(t){this.painter.deleteTile(t)}createContext(){const t=this.layer,e=t.options.glOptions||{alpha:!0,depth:!0,stencil:!0,preserveDrawingBuffer:!0,antialias:t.options.antialias},r=this.canvas.gl&&this.canvas.gl.wrap;r?(this.gl=this.canvas.gl.wrap(),this.regl=this.canvas.gl.regl):(this.glOptions=e,this.gl=this.in(this.canvas,e)),this.regl=this.regl||n.createREGL({gl:this.gl,attributes:e,extensions:["OES_element_index_uint"],optionalExtensions:t.options.optionalExtensions||[]}),r&&(this.canvas.pickingFBO=this.canvas.pickingFBO||this.regl.framebuffer(this.canvas.width,this.canvas.height)),this.pickingFBO=this.canvas.pickingFBO||this.regl.framebuffer(this.canvas.width,this.canvas.height),this.painter=new Vn(this.regl,t),this.layer.sn()}prepareWorker(){const t=this.getMap();this.workerConn||(this.workerConn=new jt("@maptalks/3dtiles",t.id));const e=this.workerConn;if(!e.isActive())return;let n=this.layer.options||{};n=_({},n),delete n.offset,n.projection=t.getSpatialReference().getProjection().code;const r=this.layer.getId();e.addLayer(r,n,t=>{if(t)throw t;this.layer&&(this.ready=!0,this.layer.fire("workerready"))})}onRemove(){this.painter&&this.painter.remove(),this.pickingFBO&&(this.canvas.pickingFBO||this.pickingFBO.destroy(),delete this.pickingFBO),this.workerConn&&(this.workerConn.removeLayer(this.layer.getId(),t=>{if(t)throw t}),this.workerConn.remove(),delete this.workerConn),this.clear(),delete this.tileCache,super.onRemove()}clear(){this.Ve(!0),this.tileCache.reset(),this.tilesLoading={},super.clear()}clearCanvas(){this.regl&&this.regl.clear({color:[0,0,0,0],depth:1,stencil:0}),super.clearCanvas()}getTileOpacity(){return 1}getStencilValue(){return 0}Ve(t){this.an||(this.an=Date.now());const e=Date.now();if(t||!(e-this.an<this.layer.options.retireInterval)){this.an=e;for(const e in this.tilesLoading){const n=this.tilesLoading[e];!t&&n.current||this.abortTileLoading(n)}}}ke(){return this.getMap().isInteracting()?this.layer.options.loadingLimitOnInteracting:this.layer.options.loadingLimit}in(t,e){const n=["webgl","experimental-webgl"];let r=null;for(let i=0;i<n.length;++i){try{r=t.getContext(n[i],e)}catch(t){}if(r)break}return r}Xe(t){return!!this.tilesLoading[t]}getI3DMMeshes(){return this.painter.getI3DMMeshes()}getPNTSMeshes(){return this.painter.getPNTSMeshes()}getB3DMMeshes(){return this.painter.getB3DMMeshes()}readBatchData(t,e,n){return Oe(t,e,0,n)}ve(){if(!this.cn)return;const t=this.layer.options.i3sNodepageLimitPerFrame||Number.MAX_VALUE;let e=0;const n=[];for(const r in this.cn){const i=this.cn[r];if("pending"===i.status)continue;i.status="pending";const o=i.rootIdx;if(n.push(yt.getJSON(r).then(t=>{delete this.cn[r];const e=this.qe[o];if(e){t.nodes?zn(e,t.nodes):(e[t.id]=t,zn(e,t.children));for(let t=0;t<i.length;t++)i[t]();this.setToRedraw()}else this.setToRedraw()})),e++,e>=t)break}n.length&&Promise.all(n)}Fe(t,e,n){this.cn||(this.cn={}),this.cn[e]=this.cn[e]||[],this.cn[e].rootIdx=t,this.cn[e].push(n),this.setToRedraw()}nn(t,e,n){this.qe||(this.qe=[]);const r=e.Pt;this.qe[r]||(this.qe[r]={});const i=this.qe[r],o=this.layer.options.services[r];t.layers&&(t=t.layers[0],"/"!==n[n.length-1]&&(n+="/"),n+="layers/0"),i.version=+(o.i3sVersion||t.store.version),function(t,e,n,r,i,o){if(!i.layerScene){i.layerScene=t,i.nodesPerPage=t.nodePages&&t.nodePages.nodesPerPage||64,i.lodSelectionMetricType=t.nodePages&&t.nodePages.lodSelectionMetricType;let e=r;i.layerScene.eslpk=e.indexOf("3dSceneLayer.json")>=0;if(e.endsWith(".json")){const t=r.lastIndexOf("/");e=t<0?"./":r.substring(0,t)}i.layerScene.baseUrl=function(t){return t.split("?")[0]}(e)}return new Jn(r,e,i,o).load()}(t,r,0,n,i,this.ge).then(t=>{this.onTilesetLoad(t,e,n)})}pick(t,e,n){return this.painter?this.painter.pick(t,e,n&&n.tolerance):[]}highlight(t){if(this.Nt||(this.Nt=[]),Array.isArray(t))for(let e=0;e<t.length;e++){const n=t[e].service||0;let r=this.Nt[n];r||(r=this.Nt[n]=new Map),r.set(t[e].id,t[e])}else{const e=t.service||0;let n=this.Nt[e];n||(n=this.Nt[e]=new Map),n.set(t.id,t)}this.painter.highlight(this.Nt)}cancelHighlight(t,e){if(!this.Nt)return;const n=this.Nt[t];if(n){if(Array.isArray(e))for(let t=0;t<e.length;t++)n.delete(e[t]);else n.delete(e);this.painter.highlight(this.Nt)}}cancelAllHighlight(){delete this.Nt,this.painter.cancelAllHighlight()}showOnly(t){if(this.St||(this.St=[]),Array.isArray(t))for(let e=0;e<t.length;e++){const n=t[e].service||0;let r=this.St[n];r||(r=this.St[n]=new Map),r.set(t[e].id,t[e])}else{const e=t.service||0;let n=this.St[e];n||(n=this.St[e]=new Map),n.set(t.id,t)}this.painter.showOnly(this.St)}cancelShowOnly(){delete this.St,this.painter.cancelShowOnly()}Te(){return this.painter?this.painter.Te():[]}}function ir(t,e){return t.kt-e.kt}function or(t,e,n){return t[0]=e[n],t[1]=e[n+3],t[2]=e[n+6],t}function sr(t,e,n){return Math.sqrt(function(t,e,n){const r=z(ar,n,t),i=or(cr,e,0),o=or(Ar,e,1),s=or(lr,e,2),a=$(i),c=$(o),A=$(s);Z(i,i),Z(o,o),Z(s,s);const l=fr;l[0]=W(r,i),l[1]=W(r,o),l[2]=W(r,s);let f,h=0;l[0]<-a?(f=l[0]+a,h+=f*f):l[0]>a&&(f=l[0]-a,h+=f*f);l[1]<-c?(f=l[1]+c,h+=f*f):l[1]>c&&(f=l[1]-c,h+=f*f);l[2]<-A?(f=l[2]+A,h+=f*f):l[2]>A&&(f=l[2]-A,h+=f*f);return h}(t,e,n))}const ar=[],cr=[],Ar=[],lr=[],fr=[];const hr=2*Math.PI;class ur{constructor(t,e,n,r){this.west=t,this.south=e,this.east=n,this.north=r}static contains(t,e){let n=e[0];const r=e[1],i=t.west;let o=t.east;return o<i&&(o+=hr,n<0&&(n+=hr)),(n>i||xe(n,i,1e-14))&&(n<o||xe(n,o,1e-14))&&r>=t.south&&r<=t.north}static southwest(t,e){return e[0]=t.west,e[1]=t.south,e[2]=0,e}static northeast(t,e){return e[0]=t.east,e[1]=t.north,e[2]=0,e}static southeast(t,e){return e[0]=t.east,e[1]=t.south,e[2]=0,e}static northwest(t,e){return e[0]=t.west,e[1]=t.north,e[2]=0,e}}const Er=[0,0,1];function dr(t,e){return ue(e,t[0],t[1],t[2])}class _r{constructor(t,e){this.normal=n.vec3.copy([],t),this.distance=e}static fromPointNormal(t,e,r){const i=-n.vec3.dot(e,t);return n.vec3.copy(r.normal,e),r.distance=i,r}}const Br=[],Cr=[],Tr=[],mr=[],gr=[],pr=[],yr=[],Rr=[],Ir=[],br=[],xr=new _r([1,0,0],0),Mr=[];class Pr{constructor(t){this.southwestCornerCartesian=[],this.northeastCornerCartesian=[],this.westNormal=[],this.eastNormal=[],this.southNormal=[],this.northNormal=[],this.rectangle=new ur(...t),this.minimumHeight=t[4],this.maximumHeight=t[5],this.computeBox(this.rectangle)}distanceToCamera(t,e){let r=0;if(!ur.contains(this.rectangle,e)){const e=this.southwestCornerCartesian,i=this.northeastCornerCartesian,o=this.westNormal,s=this.southNormal,a=this.eastNormal,c=this.northNormal,A=n.vec3.subtract(Mr,t,e),l=n.vec3.dot(A,o),f=n.vec3.dot(A,s),h=n.vec3.subtract(Mr,t,i),u=n.vec3.dot(h,a),E=n.vec3.dot(h,c);l>0?r+=l*l:u>0&&(r+=u*u),f>0?r+=f*f:E>0&&(r+=E*E)}const i=e[2],o=this.minimumHeight,s=this.maximumHeight;if(i>s){const t=i-s;r+=t*t}else if(i<o){const t=o-i;r+=t*t}return Math.sqrt(r)}computeBox(t){const e=this;dr(ur.southwest(t,Cr),e.southwestCornerCartesian),dr(ur.northeast(t,Cr),e.northeastCornerCartesian),Br[0]=t.west,Br[1]=.5*(t.south+t.north),Br[2]=0;const r=dr(Br,Tr),i=n.vec3.cross(gr,r,Er);n.vec3.normalize(e.westNormal,i),Br[0]=t.east;const o=dr(Br,Rr),s=n.vec3.cross(gr,Er,o);n.vec3.normalize(e.eastNormal,s);const a=n.vec3.subtract(gr,r,o),c=n.vec3.normalize(mr,a),A=t.south;let l;if(A>0){Br[0]=.5*(t.west+t.east),Br[1]=A;const r=dr(Br,Ir);n.vec3.copy(br,c);const i=_r.fromPointNormal(e.southwestCornerCartesian,e.westNormal,xr);Nr(Ir,br,i,e.southwestCornerCartesian),l=Re(r,pr)}else l=Ie(ur.southeast(t,Cr),pr);const f=n.vec3.cross(yr,l,a);n.vec3.normalize(e.southNormal,f);const h=t.north;let u;if(h<0){Br[0]=.5*(t.west+t.east),Br[1]=h;const r=dr(Br,Ir);n.vec3.scale(br,c,-1);const i=_r.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,xr);Nr(Ir,br,i,e.northeastCornerCartesian),u=Re(r,pr)}else u=Ie(ur.northwest(t,Cr),pr);const E=n.vec3.cross(yr,a,u);n.vec3.normalize(e.northNormal,E)}}function Nr(t,e,r,i){const o=t,s=e,a=r.normal,c=n.vec3.dot(a,s);if(Math.abs(c)<1e-15)return;const A=(-r.distance-n.vec3.dot(a,o))/c;return A<0?void 0:(i=n.vec3.scale(i,s,A),n.vec3.add(i,o,i))}const Dr=new i.Extent(0,0,0,0),Sr=new i.Extent(0,0,0,0),Or=[],Lr=[],Fr=[],wr=[],vr=new i.Point(0,0),Ur=[],Gr=new i.Coordinate(0,0),Hr=n.mat4.identity([]),Vr=[0,0];class Kr extends(n.MaskLayerMixin(i.Layer)){constructor(t,e){super(t,e),this.An(),this.Oe={},this.ln=[]}An(){const t=this.options.services.map(t=>t.url);this.hn=t.map((t,e)=>function(t,e){t=p(t);return{visible:1,baseUrl:t.substring(0,t.lastIndexOf("/"))+"/",content:{url:t},refine:"replace",matrix:n.mat4.identity([]),Pt:e,Lt:0}}(t,e)),this.fire("rootready",{roots:this.hn.slice(0)})}showService(t){return this.un(t,1),this}hideService(t){return this.un(t,0),this}setToRedraw(){const t=this.getRenderer();t&&t.setToRedraw()}un(t,e){const n=this.hn[t];if(!n)return;n.visible=e;const r=this.getRenderer();r&&r.setToRedraw()}getTileUrl(t){return t}getExtent(t){if(!t&&0!==t){const t=new i.Extent;for(let e=0;e<this.hn.length;e++)if(this.hn[e].boundingVolume){const n=this.boundingVolumeToExtent(this.hn[e]);t._combine(n)}return t}return this.hn[t]&&this.hn[t].boundingVolume?this.boundingVolumeToExtent(this.hn[t]):null}boundingVolumeToExtent(t){const e=t.boundingVolume.En?Hr:t.matrix,r=this.getMap();if(t.boundingVolume.region){const e=t.boundingVolume.region;return new i.Extent(g(e[0]),g(e[1]),g(e[2]),g(e[3]))}if(t.boundingVolume.sphere){const o=t.boundingVolume.sphere,s=Te([],n.vec3.transformMat4([],o,e)),a=o[3],c=r.locate(s,-a,a),A=r.locate(s,a,-a);return new i.Extent(c,A)}if(t.boundingVolume.box){const o=t.boundingVolume.box,s=n.vec3.transformMat4([],o,e),a=new i.Coordinate(Te([],s)),c=o.slice(3);n.mat3.multiply(c,n.mat3.fromMat4([],t.matrix),c);const A=n.vec3.length(c.slice(0,3)),l=n.vec3.length(c.slice(3,6)),f=n.vec3.length(c.slice(6,9)),h=Math.max(A,l,f),u=r.locate(a,-h,h),E=r.locate(a,h,-h);return new i.Extent(u,E)}return null}getRootTiles(){return this.hn}getTiles(){const t=this.getRenderer();if(!t.ready)return this.dn(),{tiles:wr};const e=this.getMap(),r=e.cameraPosition;let i,o;if(e.getGLZoom)o=e.pointToDistance(r[2],0,e.getGLZoom()),Gr.set(r[0],r[1]),i=e.pointToCoord(Gr,e.getGLZoom());else{const t=e.getGLRes();o=e.pointAtResToDistance(r[2],0,t),Gr.set(r[0],r[1]),i=e.pointAtResToCoord(Gr,t)}this._n=this._n||[],n.vec3.set(this._n,m(i.x),m(i.y),o),this.Bn=ue(this.Bn||[],this._n[0],this._n[1],this._n[2]),this.Cn=2*Math.tan(.5*m(e.getFov()));const s=e.projViewMatrix,a={children:[],level:-1};let c=a;const A=[];for(let e=0;e<this.hn.length;e++){const n=this.hn[e];if(!n.visible)continue;let r=1/0;const i=[n],o=this.Tn(e);for(;i.length>0;){const e=i.pop();for(e.id||this.mn(e);c.level>=e.Lt;)c=c.parent;const n=this.gn(e,o,s);if(n<1){let t=c;for(;t&&!t.content;)t=t.parent;0===n&&t&&t.content&&this.pn(A,t);if(!1===this.options.services[e.Pt].alwaysShow)continue;if(!(0===n&&e.Lt<=r))continue;e.content&&(r=e.Lt)}e.kt<1/0&&this.yn(e);const a=this.je(e,c);c.children.push(a);const l=e.children,f=l&&l.length,h=a.content;if(!f&&h&&this.pn(A,a),f){h&&"add"===e.refine&&this.pn(A,a),c=a;const n=l[0].parent;let r=!1;for(let o=0,s=l.length;o<s;o++){if(n){const e=t.getCachedTile(l[o].id);if(e&&e.error&&404!==e.error.status)continue;r=!0}else{r=!0,l[o].parent=e,l[o].re=e.re,l[o].baseUrl=e.baseUrl;const t=l[o].content&&(l[o].content.url||l[o].content.uri);t&&(P(t)||t.indexOf("i3s:")>=0?l[o].baseUrl=e.baseUrl:-1===t.indexOf("http://")&&-1===t.indexOf("https://")?l[o].content.url=e.baseUrl+t:l[o].baseUrl=t.substring(0,t.lastIndexOf("/")+1))}i.push(l[o])}!r&&h&&this.pn(A,a)}}}return{root:a,tiles:A}}pn(t,e){const{viewerRequestVolume:n}=e.node;n&&!function(t,e,n){if(n.region){const e=n.region;if(t[0]>=e[0]&&t[0]<=e[2]&&t[1]>=e[1]&&t[1]<=e[3])return!0}else{if(n.sphere)return kr(n,e);if(n.box)return 0===Xr(n,e)}return!1}(this._n,this.Bn,n)||t.push(e)}je(t,e){return{id:t.id,node:t,children:[],level:t.Lt,parent:e,content:t.content&&t.content.url}}mn(t){t.id=i.Util.GUID(),t.matrix=t.transform||n.mat4.identity([]),t.Rn=this.In(t),t.parent&&(function(t){return t.content&&t.content.uri&&t.content.uri.indexOf("i3s:")>=0}(t)||(t.matrix=n.mat4.multiply(t.matrix,t.parent.matrix,t.matrix)),t.Pt=t.parent.Pt,void 0===t.Lt&&(t.Lt=t.parent.Lt+1),t.maxExtent=t.parent.maxExtent),t.refine=t.refine&&t.refine.toLowerCase()||"replace",t.content&&!t.content.url&&t.content.uri&&(t.content.url=t.content.uri),this.bn(t)}bn(t){const e=t.boundingVolume;if(!e||e.En)return;const r=this.options.services[t.Pt],i=r.heightOffset||0,o=this.options.offset,s=B(o)||o[0]||o[1],a=r.coordOffset||Vr;if(!Array.isArray(a))throw new Error("service.coordOffset must be an array");if(!t.boundingVolume||!i&&n.mat4.exactEquals(t.matrix,Hr)&&!s&&a===Vr)return;const{region:c,box:A,sphere:l}=e;if(c){const t=this.xn([g(c[0]),g(c[1])]);c[0]=m(t.x+a[0]),c[1]=m(t.y+a[1]);const e=this.xn([g(c[2]),g(c[3])]);c[2]=m(e.x+a[0]),c[3]=m(e.y+a[1]),c[4]+=i+(a[2]||0),c[5]+=i+(a[2]||0)}else if(A||l){const e=A||l,r=n.vec3.transformMat4(Or,e,t.matrix),o=Te(Lr,r),s=this.xn([o[0]+a[0],o[1]+a[1]]);o[0]=s.x,o[1]=s.y,o[2]+=i+(a[2]||0),ue(e,m(o[0]),m(o[1]),o[2])}e.En=!0}In(t){return void 0===t.geometricError||!t.boundingVolume}yn(t){let e=t.parent;for(;e&&e.Rn&&!(e.kt<=t.kt);)e.kt=t.kt,e=t.parent}onTileLoad(t,e){if(t.children&&(!e.children||!e.children.length)){e.children=t.children;const n=e.content.url;e.baseUrl=n.substring(0,n.lastIndexOf("/")+1);const r=this.getRenderer();r&&r.setToRedraw()}}onTilesetLoad(t,e,r){if(!t)return void console.warn("invalid tileset at : "+r);const i=this.options.services[e.Pt],o=(t.asset&&t.asset.gltfUpAxis||e&&e.re||i.upAxis||"Y").toUpperCase();t.root.baseUrl=r.substring(0,r.lastIndexOf("/")+1);const s=r.indexOf("realspace/")>-1;0===e.Lt&&(t.asset&&t.asset.s3mType&&s||i.isSuperMapiServer)&&(t.root.baseUrl+="data/path/");const a=t.asset.i3s,c=!!t.asset.s3mType;if(t.root.re=o,e){const r=e.Pt,i=this.hn[r];c&&!i.isS3M&&(i.isS3M=c);const o=e.boundingVolume;_(e,t.root),e.refine=e.refine&&e.refine.toLowerCase()||"replace",o&&(e.boundingVolume=o);const s=t.root.transform;s&&(e.parent?a||(e.matrix=n.mat4.multiply([],e.parent.matrix,s)):e.matrix=s),this.bn(e),e.Mn=e.content,delete e.content,t.root.content&&(e.content=t.root.content),e.Rn=this.In(e);const A=e.content&&(e.content.url||e.content.uri);A&&e.content.uri&&(e.content.url=e.content.uri,delete e.content.uri),a||!A||P(A)||-1!==A.indexOf("http://")||-1!==A.indexOf("https://")||(e.content.url=e.baseUrl+A)}this.dn(),this.fire("loadtileset",{tileset:t,index:e&&e.Pt,url:r})}gn(t,e,n){if(t.kt=1/0,0===t.Lt||t.Rn)return 1;if(!this.Pn(t,e,n))return-1;if(0===t.geometricError)return 1;let r=this.options.services[t.Pt].maximumScreenSpaceError;null==r&&(r=16);let i=this.Nn(t);return 0===i&&t.parent&&(i=.5*(t.parent.ze||0)),i>=r?1:0}jt(t,e){e||(e=new i.Point(0,0));const n=this.getMap();return n.getGLZoom?n.coordToPoint(t,n.getGLZoom(),e):n.coordToPointAtRes(t,n.getGLRes(),e)}Pn(t,e,r){const o=t.id;let s=this.ln[o];const{boundingVolume:c}=t,A=c.sphere;let u=c.region;const d=c.box;if(!s){let e,r,a;if(d&&(u=function(t,e){for(let e=0;e<9;e++)t[e+3]!==1/0&&t[e+3]!==-1/0||(t[e+3]=6378137*Math.sign(t[e+3])*3),ti[e]=t[e+3];const r=ti;n.mat4.exactEquals(e,Hr)||n.mat3.multiply(r,n.mat3.fromMat4(Ur,e),r);const i=n.vec3.copy(zr,t),o=n.vec3.set(Yr,r[0],r[1],r[2]),s=n.vec3.set(Jr,r[3],r[4],r[5]),a=n.vec3.set(Zr,r[6],r[7],r[8]);Wr[0]=Wr[0]||[];const c=n.vec3.copy(Wr[0],i);n.vec3.sub(c,c,o),n.vec3.sub(c,c,s),n.vec3.sub(c,c,a),Wr[1]=Wr[1]||[];const A=n.vec3.copy(Wr[1],i);n.vec3.sub(A,A,o),n.vec3.sub(A,A,s),n.vec3.add(A,A,a),Wr[2]=Wr[2]||[];const l=n.vec3.copy(Wr[2],i);n.vec3.sub(l,l,o),n.vec3.add(l,l,s),n.vec3.sub(l,l,a),Wr[3]=Wr[3]||[];const f=n.vec3.copy(Wr[3],i);n.vec3.sub(f,f,o),n.vec3.add(f,f,s),n.vec3.add(f,f,a),Wr[4]=Wr[4]||[];const h=n.vec3.copy(Wr[4],i);n.vec3.add(h,h,o),n.vec3.sub(h,h,s),n.vec3.sub(h,h,a),Wr[5]=Wr[5]||[];const u=n.vec3.copy(Wr[5],i);n.vec3.add(u,u,o),n.vec3.sub(u,u,s),n.vec3.add(u,u,a),Wr[6]=Wr[6]||[];const E=n.vec3.copy(Wr[6],i);n.vec3.add(E,E,o),n.vec3.add(E,E,s),n.vec3.sub(E,E,a),Wr[7]=Wr[7]||[];const d=n.vec3.copy(Wr[7],i);n.vec3.add(d,d,o),n.vec3.add(d,d,s),n.vec3.add(d,d,a);for(let t=0;t<Wr.length;t++)jr[t]=jr[t]||[],Te(jr[t],Wr[t]),Qr[t]=jr[t][0],qr[t]=jr[t][1],$r[t]=jr[t][2];return[m(Math.min(...Qr)),m(Math.min(...qr)),m(Math.max(...Qr)),m(Math.max(...qr)),Math.min(...$r),Math.max(...$r)]}(d,t.matrix),c.region=u),u){e=Dr.set(g(u[0]),g(u[1]),g(u[2]),g(u[3]));const t=e.getCenter(),n=this.Dn(t);e=e.convertTo(t=>this.jt(t,vr),Sr),a=u[4],r=u[5],s=this.ln[o]=[[e.xmin,e.ymin,a*n[2]],[e.xmax,e.ymax,r*n[2]]],s.center=t}else if(A){const t=Te(Or,A),e=new i.Coordinate(t),n=this.jt(e,vr).toArray(),r=this.Dn(e);n.push(t[2]*r[2]),s=this.ln[o]=[n,A[3]*r[2]],s.center=e}}if(e){if(u)Dr.xmin=s[0][0],Dr.ymin=s[0][1],Dr.xmax=s[1][0],Dr.ymax=s[1][1];else if(A){const t=s[2];Dr.xmin=s[0][0]-t,Dr.ymin=s[0][1]-t,Dr.xmax=s[0][0]+t,Dr.ymax=s[0][1]+t}else if(d){const t=s[1],e=s[2];Dr.xmin=s[0][0]-t,Dr.ymin=s[0][1]-e,Dr.xmax=s[0][0]+t,Dr.ymax=s[0][1]+e}if(!e.intersects(Dr))return!1}return u?l(r,s):A?function(t,e,n){h(t);for(var r=e[0],i=-e[1],o=0;o<6;o++){if(!n||"0"!==n.charAt(o))if(E(a[o],r)<i)return!1}return!0}(r,s):!!d&&function(t,e,n){h(t);for(var r=0;r<6;r++){if(!n||"0"!==n.charAt(r))if(!f(a[r],e))return!1}return!0}(r,s)}Dn(t){const e=this.getMap(),r=e.distanceToPointAtRes(100,100,e.getGLRes(),t);let i;return i=e.altitudeToPoint?e.altitudeToPoint(100,e.getGLRes())/100:r.y/100,n.vec3.set(Fr,r.x/100*1.01,r.y/100*1.01,i),Fr}xn(t){Array.isArray(t)&&(t=new i.Coordinate(t));let e=this.options.offset;if(B(e)&&(e=e(Array.isArray(t)?new i.Coordinate(t):t)),e[0]||e[1]){const n=this.getMap(),r=n.getGLRes(),i=n.coordToPointAtRes(t,r);return i._sub(e),n.pointAtResToCoord(i,r)}return t}Tn(t){const e=this.options.services[t].maxExtent;if(!e)return null;const n=this.hn[t];return n.maxExtent||(n.maxExtent=new i.Extent(e).convertTo(t=>this.jt(t))),n.maxExtent}Nn(t){const e=this.Cn,n=t.geometricError;if(0===n)return t.ze=0,0;const r=this.getMap();let i;t.boundingVolume.region?i=function(t,e,n){t.Sn||(t.Sn=new Pr(t.boundingVolume.region));return t.Sn.distanceToCamera(e,n)}(t,this.Bn,this._n):t.boundingVolume.sphere?i=kr(t.boundingVolume,this.Bn):t.boundingVolume.box&&(i=Xr(t.boundingVolume,this.Bn));const o=Math.max(Math.abs(i),1e-7),s=n*r.height/(o*e);return t.kt=i,t.ze=s,s}dn(){const t=this.getRenderer();t&&t.setToRedraw()}Ae(t){return this.ln[t]}identify(t,e={}){const n=this.getMap(),r=this.getRenderer();if(!n||!r)return[];const o=n.coordToContainerPoint(new i.Coordinate(t));return this.identifyAtPoint(o,e)}identifyAtPoint(t,e={}){const n=[];if(!e.excludeMasks){const r=this.identifyMask(t,e);r&&r.length&&D(n,r)}const r=this.getMap(),i=this.getRenderer();if(!r||!i)return[];const o=r.getDevicePixelRatio();return D(n,i.pick(t.x*o,t.y*o,e)),n}getCurrentBatchIDs(){const t=this.getMap(),e=this.getRenderer();return t&&e?e.Te():[]}highlight(t){const e=this.getRenderer();return e?(e.highlight(t),this):(this.Nt||(this.Nt=[]),this.Nt.push(t),this)}sn(){if(this.Nt){for(let t=0;t<this.Nt.length;t++)this.highlight(this.Nt[t]);delete this.Nt}}cancelHighlight(t,e){const n=this.getRenderer();return n?(n.cancelHighlight(t,e),this):this}cancelAllHighlight(){const t=this.getRenderer();return t?(t.cancelAllHighlight(),this):this}showOnly(t){const e=this.getRenderer();return e?(e.showOnly(t),this):(this.St||(this.St=[]),this.St.push(t),this)}On(){if(this.St){for(let t=0;t<this.St.length;t++)this.showOnly(this.St[t]);delete this.St}}cancelShowOnly(t){const e=this.getRenderer();return e?(e.cancelShowOnly(t),this):this}setServiceOpacity(t,e){const n=this.options.services[t];n&&(n.opacity=e);const r=this.getRenderer();return r?(r.setToRedraw(),this):this}}function kr(t,e){const r=t.sphere,i=n.vec3.dist(r,e),o=t.sphere[3];return i<o?0:i-o}function Xr(t,e){const r=t.box;return sr(n.vec3.set(Or,r[0],r[1],r[2]),n.mat3.set(Ur,r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11]),e)}Kr.mergeOptions({"maxGPUMemory":512,"retireInterval":2e3,"loadingLimitOnInteracting":5,"loadingLimit":0,"renderer":"gl","forceRenderOnZooming":!0,"forceRenderOnRotating":!0,"forceRenderOnMoving":!0,"debug":!1,"debugOutline":[0,1,0],"meshLimitPerFrame":1,"i3sNodepageLimitPerFrame":1,"enableI3SCompressedGeometry":!0,"forceI3SCompressedGeometry":!0,"picking":!0,"pickingPoint":!0,"geometryEvents":!1,"antialias":!1,"optionalExtensions":["ANGLE_instanced_arrays","OES_element_index_uint","OES_standard_derivatives","OES_vertex_array_object","OES_texture_half_float","OES_texture_half_float_linear","OES_texture_float","OES_texture_float_linear","WEBGL_depth_texture","EXT_shader_texture_lod","WEBGL_compressed_texture_astc","WEBGL_compressed_texture_etc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb"],"offset":[0,0]}),Kr.registerRenderer("gl",rr),Kr.registerJSONType("Geo3DTilesLayer");const zr=[],Yr=[],Jr=[],Zr=[],Wr=[],jr=[],Qr=[],qr=[],$r=[],ti=[];let ei=null;function ni(){return ei||(ei={"image/crn":Xn.crn&&Xn.crn(),"image/ktx2":Xn.ktx2&&Xn.ktx2(),"image/cttf":Xn.ktx2&&Xn.ktx2(),"draco":Xn.draco&&Xn.draco()}),ei}class ri{constructor(t,e,n){this.o=t,this.Ln=e||Kt,this.s=n,this.Fn=ni()}static createEmptyB3DM(){return{featureTable:null,batchTable:null,gltf:{}}}load(t,e,n=0,r=0,i){return e?(r||(r=e.byteLength),this.wn(t,e,n,r,i)):yt.getArrayBuffer(t,{}).then(e=>{const i=e.data;return r||(r=i.byteLength),this.wn(t,i,n,r)})}wn(t,e,n,r,i){const o=i&&i.maxTextureSize,s=this.vn(e,n,r,t);if(s.error)return Promise.resolve(s);const a=t.substring(0,t.lastIndexOf("/")),c=new this.Ln(a,s.glb,{transferable:!0,requestImage:this.o,decoders:this.Fn,supportedFormats:this.s,maxTextureSize:o});return c.load({skipAttributeTransform:!1}).then(e=>{e.url=`${t}-${n}-${r}`;const i=c.transferables;for(let t=0;t<s.transferables.length;t++)i.indexOf(s.transferables[t])<0&&i.push(s.transferables[t]);return{magic:"b3dm",count:s.count,transferables:i,featureTable:s.featureTable,batchTable:s.batchTable,batchTableBin:s.batchTableBin,gltf:e}})}vn(t,e,n,r){const i=new DataView(t,e,n),o=i.getUint32(4,!0);if(1!==o){const t="Unsupported b3dm version: "+o+", url:"+r;return console.warn(t),{error:t}}if(i.getUint32(8,!0)!==i.byteLength){const t="Length in b3dm header is inconsistent with b3dm's byte length, url: "+r;return console.warn(t),{error:t}}let s,a=i.getUint32(12,!0),c=i.getUint32(16,!0),A=i.getUint32(20,!0),l=i.getUint32(24,!0),f=28+e;A>=570425344?(f-=8,s=a,A=c,l=0,a=0,c=0):l>=570425344&&(f-=4,s=A,A=a,l=c,a=0,c=0);const h=[t];let u,E,d;if(a>0?(u=Ne(t,f,a),f+=a,s=u.BATCH_LENGTH):u={"BATCH_LENGTH":s},c>0&&(f+=c),A>0&&(E=De(t,f,A),f+=A,l>0)){const e=Se(0,f,l);d=t.slice(e.offset,e.offset+e.byteLength),f+=l,h.push(d)}const _=u.BATCH_LENGTH,B={};if(u&&u.BATCH_ID){B.BATCH_ID=Le(u.BATCH_ID,t,(void 0).offset,_);const e=B.BATCH_ID.array&&B.BATCH_ID.array.buffer;e&&h.indexOf(e)<0&&h.push(e)}return{count:s,transferables:h,featureTable:u,batchTable:E,batchTableBin:d,b3dm:B,glb:{buffer:t,byteOffset:f,byteLength:i.byteLength+i.byteOffset-f}}}Un(){return null}}class ii{constructor(t,e,n,r){this.o=t,this.Ln=e||Kt,this.s=n,this.Fn=ni(),this.Gn=r}load(t,e,n=0,r=0,i){return e?(r||(r=e.byteLength),this.wn(t,e,n,r,i)):yt.getArrayBuffer(t,{}).then(e=>{const i=e.data;return r||(r=i.byteLength),this.wn(t,i,n,r)})}wn(t,e,n,r,i){return this.Hn(t,e,n,r,i).then(({gltf:i,transferables:o})=>{const s=this.Vn(e,n,r,t);if(s.error)return Promise.resolve(s);for(let t=0;t<o.length;t++)-1===s.transferables.indexOf(o[t])&&s.transferables.push(o[t]);return delete i.transferables,Promise.resolve({magic:"i3dm",count:s.count,transferables:s.transferables,featureTable:s.featureTable,batchTable:s.batchTable,batchTableBin:s.batchTableBin,i3dm:s.i3dm,gltf:i})})}Hn(t,e,n,r,i){const o=i&&i.maxTextureSize,s={transferable:!0,requestImage:this.o,decoders:this.Fn,supportedFormats:this.s,maxTextureSize:o},a=new DataView(e,n,r),c=32+a.getUint32(12,!0)+a.getUint32(16,!0)+a.getUint32(20,!0)+a.getUint32(24,!0);if(0===a.getUint32(28,!0)){let r=I(new Uint8Array(e,c+n,a.byteLength-c));-1==r.indexOf("://")&&(r=t.substring(0,t.lastIndexOf("/"))+"/"+r);return r.indexOf(".glb")>0?yt.getArrayBuffer(r,{}).then(t=>this.Kn(r,{buffer:t.data,byteOffset:0},s)):yt.getJSON(r,{}).then(t=>this.Kn(r,t,s))}{const r={buffer:e,byteOffset:c+n,byteLength:a.byteLength-c};return this.Kn(t,r,s)}}Kn(t,e,n){const r=t.substring(0,t.lastIndexOf("/")),i=new this.Ln(r,e,n);return i.load({skipAttributeTransform:!0}).then(n=>{let r=0,o=0;return e.buffer&&(r=e.byteOffset||0,o=e.byteLength||0),n.url=`${t}-${r}-${o}`,{transferables:i.transferables,gltf:n}})}Vn(t,e,n,r){const i=new DataView(t,e,n),o=i.getUint32(4,!0);if(1!==o){const t="Unsupported pnts version: "+o+", url:"+r;return console.warn(t),{error:t}}if(i.getUint32(8,!0)!==i.byteLength){const t="Length in pnts header is inconsistent with pnts's byte length, url: "+r;return console.warn(t),{error:t}}const s=[t],{featureTable:a,featureTableBin:c,batchTable:A,batchTableBin:l}=Ke(i,32+e,s),f={},h=a.INSTANCES_LENGTH;if(a.POSITION){const{byteOffset:e}=a.POSITION;f.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:new Float32Array(t,e+c.offset,3*h).slice()},s.push(f.POSITION.array.buffer)}else if(a.POSITION_QUANTIZED){const e=a.QUANTIZED_VOLUME_OFFSET,n=a.QUANTIZED_VOLUME_SCALE,{byteOffset:r}=a.POSITION_QUANTIZED;f.POSITION={byteStride:12,byteOffset:0,itemSize:3,count:h,componentType:5126,array:this.kn(new Uint16Array(t,r+c.offset,3*h),e,n)},s.push(f.POSITION.array.buffer)}if(a.BATCH_ID){f.BATCH_ID=Le(a.BATCH_ID,t,c.offset,h);const e=f.BATCH_ID.array&&f.BATCH_ID.array.buffer;e&&s.indexOf(e)<0&&s.push(e)}if(a.NORMAL_UP){let{byteOffset:e}=a.NORMAL_UP;f.NORMAL_UP={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:new Float32Array(t,e+c.offset,3*h).slice()},s.push(f.NORMAL_UP.array.buffer),e=a.NORMAL_RIGHT.byteOffset,f.NORMAL_RIGHT={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:new Float32Array(t,e+c.offset,3*h).slice()},s.push(f.NORMAL_RIGHT.array.buffer)}else if(a.NORMAL_UP_OCT32P){let{byteOffset:e}=a.NORMAL_UP_OCT32P;f.NORMAL_UP={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:this.Xn(new Uint16Array(t,e+c.offset,2*h))},s.push(f.NORMAL_UP.array.buffer),e=a.NORMAL_RIGHT_OCT32P.byteOffset,f.NORMAL_RIGHT={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:this.Xn(new Uint16Array(t,e+c.offset,2*h))},s.push(f.NORMAL_RIGHT.array.buffer)}if(a.SCALE){const{byteOffset:e}=a.SCALE;f.SCALE={byteStride:0,byteOffset:0,itemSize:1,count:h,componentType:5126,array:new Float32Array(t,e+c.offset,h).slice()},s.push(f.SCALE.array.buffer)}else if(a.SCALE_NON_UNIFORM){const{byteOffset:e}=a.SCALE_NON_UNIFORM;f.SCALE_NON_UNIFORM={byteStride:0,byteOffset:0,itemSize:3,count:h,componentType:5126,array:new Float32Array(t,e+c.offset,3*h).slice()},s.push(f.SCALE_NON_UNIFORM.array.buffer)}return{count:h,batchTable:A,batchTableBin:l,featureTable:a,i3dm:f,transferables:s}}Xn(t){const e=t.length/2,n=new Float32Array(3*e),r=[];for(let i=0;i<e;i++)oi(r,t[2*i],t[2*i+1],65535),n[3*i]=r[0],n[3*i+1]=r[1],n[3*i+2]=r[2];return n}kn(t,e,n){return Ve(new Float32Array(t.length),t,e,n)}Un(){return null}}function oi(t,e,n,r){if(t[0]=si(e,r),t[1]=si(n,r),t[2]=1-(Math.abs(t[0])+Math.abs(t[1])),t[2]<0){const e=t[0];t[0]=(1-Math.abs(t[1]))*ai(e),t[1]=(1-Math.abs(e))*ai(t[1])}return Z(t,t)}function si(t,e){return function(t,e,n){return t<e?e:t>n?n:t}(t,0,e=function(t,e){if(null!=t)return t;return e}(e,255))/e*2-1}function ai(t){return t<0?-1:1}class ci{constructor(){}load(t,e,n=0,r=0){return e?(r||(r=e.byteLength),this.wn(t,e,n,r)):yt.getArrayBuffer(t,{}).then(e=>{const i=e.data;return r||(r=i.byteLength),this.wn(t,i,n,r)})}wn(t,e,n,r){return this.zn(e,n,r,t).then(t=>t.error?t:{magic:"pnts",count:t.count,transferables:t.transferables,featureTable:t.featureTable,batchTable:t.batchTable,batchTableBin:t.batchTableBin,pnts:t.pnts})}zn(t,e,n,r){const i=new DataView(t,e,n),o=i.getUint32(4,!0);if(1!==o){const t="Unsupported pnts version: "+o+", url:"+r;return console.warn(t),{error:t}}if(i.getUint32(8,!0)!==i.byteLength){const t="Length in pnts header is inconsistent with pnts's byte length, url: "+r;return console.warn(t),{error:t}}const s=[t],{featureTable:a,featureTableBin:c,batchTable:A,batchTableBin:l}=Ke(i,e+28,s),f=a.QUANTIZED_VOLUME_OFFSET,h=a.QUANTIZED_VOLUME_SCALE,u=a.POINTS_LENGTH;let E,d={};if(a.extensions&&a.extensions["3DTILES_draco_point_compression"]){d=a.extensions["3DTILES_draco_point_compression"],E=new DataView(t,d.byteOffset+c.offset,d.byteLength);const e={attributes:d.properties,useUniqueIDs:!1};return this.Yn||(this.Yn=ni().draco),this.Yn(E,e).then(e=>{const n=e.attributes;!a.POSITION&&!a.POSITION_QUANTIZED||n.POSITION||n.POSITION_QUANTIZED||(n.POSITION=a.POSITION,n.POSITION_QUANTIZED=a.POSITION_QUANTIZED),!(a.RGB||a.RGBA||a.RGB565)||n.RGB||n.RGBA||n.RGB565||(n.RGB=a.RGB,n.RGBA=a.RGBA,n.RGB565=a.RGB565),!a.NORMAL&&!a.NORMAL_OCT16P||n.NORMAL||n.NORMAL_OCT16P||(n.NORMAL=a.NORMAL,n.NORMAL_OCT16P=a.NORMAL_OCT16P);const r=this.Jn(t,e.attributes,c.offset,u,s,f,h);if(e.attributes.BATCH_ID){const t=e.attributes.BATCH_ID.array;r.BATCH_ID={byteStride:0,byteOffset:0,itemSize:1,count:t.length,componentType:He(t.constructor),array:t},s.push(t.buffer)}else if(a.BATCH_ID||Object.keys(A).length){a.BATCH_ID?r.BATCH_ID=Le(a.BATCH_ID,t,c.offset,u):r.BATCH_ID=Ai(u);const e=r.BATCH_ID.array&&r.BATCH_ID.array.buffer;e&&s.indexOf(e)<0&&s.push(e)}return{count:u,batchTable:A,batchTableBin:l,featureTable:a,pnts:r,transferables:s}})}const _=this.Jn(t,a,c.offset,u,s,f,h);if(a.BATCH_ID||Object.keys(A).length){a.BATCH_ID?_.BATCH_ID=Le(a.BATCH_ID,t,c.offset,u):_.BATCH_ID=Ai(u);const e=_.BATCH_ID.array&&_.BATCH_ID.array.buffer;e&&s.indexOf(e)<0&&s.push(e)}return Promise.resolve({count:u,batchTable:A,batchTableBin:l,featureTable:a,pnts:_,transferables:s})}Jn(t,e,n,r,i,o,s){const a={};if(e.POSITION){let{byteOffset:o,array:s}=e.POSITION;o=o||0;const c=s?0:n;if(!s){const e=t.slice(o+c,o+c+3*r*4);s=new Float32Array(e)}a.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:r,componentType:5126,array:s},i.push(s.buffer)}else if(e.POSITION_QUANTIZED){let{byteOffset:c}=e.POSITION_QUANTIZED;const{array:A}=e.POSITION_QUANTIZED;c=c||0;const l=A?0:n;a.POSITION={byteStride:0,byteOffset:0,itemSize:3,count:r,componentType:5126,array:this.kn(A||new Uint16Array(t,c+l,3*r),o,s)},i.push(a.POSITION.array.buffer)}if(e.RGBA){let{byteOffset:o,array:s}=e.RGBA;o=o||0;const c=s?0:n;if(!s){const e=t.slice(o+c,o+c+4*r);s=new Uint8Array(e)}a.RGBA={byteStride:0,byteOffset:0,itemSize:4,count:r,componentType:5121,array:s},i.push(s.buffer)}else if(e.RGB){let{byteOffset:o,array:s}=e.RGB;o=o||0;const c=s?0:n;if(!s){const e=t.slice(o+c,o+c+3*r);s=new Uint8Array(e)}a.RGB={byteStride:0,byteOffset:0,itemSize:3,count:r,componentType:5121,array:s},i.push(s.buffer)}else if(e.RGB565){let{byteOffset:o,array:s}=e.RGB565;o=o||0;const c=s?0:n;if(!s){const e=t.slice(o+c,o+c+2*r);s=new Uint16Array(e)}a.RGB565={byteStride:0,byteOffset:0,itemSize:1,count:r,componentType:5123,array:s},i.push(s.buffer)}if(e.NORMAL){let{byteOffset:o,array:s}=e.NORMAL;o=o||0;const c=s?0:n;if(!s){const e=t.slice(o+c,o+c+3*r*4);s=new Float32Array(e)}a.NORMAL={byteStride:0,byteOffset:0,itemSize:3,count:r,componentType:5126,array:s},i.push(s.buffer)}else if(e.NORMAL_OCT16P){let{byteOffset:o,array:s}=e.NORMAL_OCT16P;o=o||0;const c=s?0:n;if(!s){const e=t.slice(o+c,o+c+2*r);s=new Uint8Array(e)}a.NORMAL_OCT16P={byteStride:0,byteOffset:0,itemSize:2,count:r,componentType:5121,array:s},i.push(s.buffer)}return a}kn(t,e,n){return Ve(new Float32Array(t.length),t,e,n)}Un(){return null}}function Ai(t){const e=M(t),n=new e(t);for(let e=0;e<t;e++)n[e]=e;return{byteStride:0,byteOffset:0,itemSize:1,count:t,componentType:He(e),array:n}}class li{constructor(t,e,n,r){this.s=n,this.o=t,this.Ln=e||Kt,this.Gn=r}load(t,e,n=0,r=0,i){return e?this.wn(t,e,n,r,i):yt.getArrayBuffer(t,{}).then(e=>{const i=e.data;return this.wn(t,i,n,r)})}wn(t,e,n,r,i){r||(r=e.byteLength);const o=this.Zn(e,t,n,r),s=[];for(let n=0;n<o.length;n++){let r;if("b3dm"===o[n].magic)r=new ri(this.o,this.Ln,this.s);else if("i3dm"===o[n].magic)r=new ii(this.o,this.Ln,this.s,this.Gn);else if("pnts"===o[n].magic)r=new ci;else{if("cmpt"!==o[n].magic){console.warn("Unsupported magic in CMPT tile:",o[n].magic);continue}r=new li(this.o,this.Ln,this.s,this.Gn)}s.push(r.load(t,e,o[n].offset,o[n].byteLength,i).then(t=>t))}return Promise.all(s).then(t=>({magic:"cmpt",tiles:t}))}Zn(t,e,n,r){const i=new DataView(t,n,r),o=i.getUint32(4,!0);if(1!==o){const t="Unsupported cmpt version: "+o+", url:"+e;return console.warn(t),{error:t}}if(16===i.byteLength)return[];const s=[],a=i.getUint32(12,!0);let c=16;for(let e=0;e<a;e++){const e=Me(i,c),r=i.getUint32(c+8,!0);s.push({magic:e,buffer:t,offset:c+n,byteLength:r}),c+=r}return s}}if(o.transcoders){const t=i.Map.VERSION;if(t.indexOf("1.0.0-beta")>=0||t.indexOf("1.0.0-alpha")>=0){const t=o.transcoders.inject(s);i.registerWorkerAdapter("@maptalks/3dtiles",t)}else i.registerWorkerAdapter("@maptalks/3dtiles",(function(){return o.transcoders.inject(s)}))}else i.registerWorkerAdapter("@maptalks/3dtiles",s);t.B3DMLoader=ri,t.CMPTLoader=li,t.Geo3DTilesLayer=Kr,t.Geo3DTilesUtil=S,t.Geo3DTransform=be,Object.defineProperty(t,"t",{value:!0}),"undefined"!=typeof console&&console.log("@maptalks/3dtiles v0.83.0")}));