leiting-bim 2.2.3 → 2.2.4
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.
package/leiting-bim.umd.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
`)),e)})}const Gh=[];for(let i=0;i<256;i++){let e=i;for(let t=0;t<8;t++)e&1?e=e>>>1^3988292384:e=e>>>1;Gh[i]=e}class Xo{constructor(e){this.crc=e||-1}append(e){let t=this.crc|0;for(let n=0,s=e.length|0;n<s;n++)t=t>>>8^Gh[(t^e[n])&255];this.crc=t}get(){return~this.crc}}class Uh extends TransformStream{constructor(){let e;const t=new Xo;super({transform(n,s){t.append(n),s.enqueue(n)},flush(){const n=new Uint8Array(4);new DataView(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}}function vb(i){if(typeof TextEncoder==Ei){i=unescape(encodeURIComponent(i));const e=new Uint8Array(i.length);for(let t=0;t<e.length;t++)e[t]=i.charCodeAt(t);return e}else return new TextEncoder().encode(i)}const pt={concat(i,e){if(i.length===0||e.length===0)return i.concat(e);const t=i[i.length-1],n=pt.getPartial(t);return n===32?i.concat(e):pt._shiftRight(e,n,t|0,i.slice(0,i.length-1))},bitLength(i){const e=i.length;if(e===0)return 0;const t=i[e-1];return(e-1)*32+pt.getPartial(t)},clamp(i,e){if(i.length*32<e)return i;i=i.slice(0,Math.ceil(e/32));const t=i.length;return e=e&31,t>0&&e&&(i[t-1]=pt.partial(e,i[t-1]&2147483648>>e-1,1)),i},partial(i,e,t){return i===32?e:(t?e|0:e<<32-i)+i*1099511627776},getPartial(i){return Math.round(i/1099511627776)||32},_shiftRight(i,e,t,n){for(n===void 0&&(n=[]);e>=32;e-=32)n.push(t),t=0;if(e===0)return n.concat(i);for(let r=0;r<i.length;r++)n.push(t|i[r]>>>e),t=i[r]<<32-e;const s=i.length?i[i.length-1]:0,o=pt.getPartial(s);return n.push(pt.partial(e+o&31,e+o>32?t:n.pop(),1)),n}},Jo={bytes:{fromBits(i){const t=pt.bitLength(i)/8,n=new Uint8Array(t);let s;for(let o=0;o<t;o++)(o&3)===0&&(s=i[o/4]),n[o]=s>>>24,s<<=8;return n},toBits(i){const e=[];let t,n=0;for(t=0;t<i.length;t++)n=n<<8|i[t],(t&3)===3&&(e.push(n),n=0);return t&3&&e.push(pt.partial(8*(t&3),n)),e}}},Vh={};Vh.sha1=class{constructor(i){const e=this;e.blockSize=512,e._init=[1732584193,4023233417,2562383102,271733878,3285377520],e._key=[1518500249,1859775393,2400959708,3395469782],i?(e._h=i._h.slice(0),e._buffer=i._buffer.slice(0),e._length=i._length):e.reset()}reset(){const i=this;return i._h=i._init.slice(0),i._buffer=[],i._length=0,i}update(i){const e=this;typeof i=="string"&&(i=Jo.utf8String.toBits(i));const t=e._buffer=pt.concat(e._buffer,i),n=e._length,s=e._length=n+pt.bitLength(i);if(s>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");const o=new Uint32Array(t);let r=0;for(let a=e.blockSize+n-(e.blockSize+n&e.blockSize-1);a<=s;a+=e.blockSize)e._block(o.subarray(16*r,16*(r+1))),r+=1;return t.splice(0,16*r),e}finalize(){const i=this;let e=i._buffer;const t=i._h;e=pt.concat(e,[pt.partial(1,1)]);for(let n=e.length+2;n&15;n++)e.push(0);for(e.push(Math.floor(i._length/4294967296)),e.push(i._length|0);e.length;)i._block(e.splice(0,16));return i.reset(),t}_f(i,e,t,n){if(i<=19)return e&t|~e&n;if(i<=39)return e^t^n;if(i<=59)return e&t|e&n|t&n;if(i<=79)return e^t^n}_S(i,e){return e<<i|e>>>32-i}_block(i){const e=this,t=e._h,n=Array(80);for(let c=0;c<16;c++)n[c]=i[c];let s=t[0],o=t[1],r=t[2],a=t[3],l=t[4];for(let c=0;c<=79;c++){c>=16&&(n[c]=e._S(1,n[c-3]^n[c-8]^n[c-14]^n[c-16]));const h=e._S(5,s)+e._f(c,o,r,a)+l+n[c]+e._key[Math.floor(c/20)]|0;l=a,a=r,r=e._S(30,o),o=s,s=h}t[0]=t[0]+s|0,t[1]=t[1]+o|0,t[2]=t[2]+r|0,t[3]=t[3]+a|0,t[4]=t[4]+l|0}};const Qh={};Qh.aes=class{constructor(i){const e=this;e._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],e._tables[0][0][0]||e._precompute();const t=e._tables[0][4],n=e._tables[1],s=i.length;let o,r,a,l=1;if(s!==4&&s!==6&&s!==8)throw new Error("invalid aes key size");for(e._key=[r=i.slice(0),a=[]],o=s;o<4*s+28;o++){let c=r[o-1];(o%s===0||s===8&&o%s===4)&&(c=t[c>>>24]<<24^t[c>>16&255]<<16^t[c>>8&255]<<8^t[c&255],o%s===0&&(c=c<<8^c>>>24^l<<24,l=l<<1^(l>>7)*283)),r[o]=r[o-s]^c}for(let c=0;o;c++,o--){const h=r[c&3?o:o-4];o<=4||c<4?a[c]=h:a[c]=n[0][t[h>>>24]]^n[1][t[h>>16&255]]^n[2][t[h>>8&255]]^n[3][t[h&255]]}}encrypt(i){return this._crypt(i,0)}decrypt(i){return this._crypt(i,1)}_precompute(){const i=this._tables[0],e=this._tables[1],t=i[4],n=e[4],s=[],o=[];let r,a,l,c;for(let h=0;h<256;h++)o[(s[h]=h<<1^(h>>7)*283)^h]=h;for(let h=r=0;!t[h];h^=a||1,r=o[r]||1){let u=r^r<<1^r<<2^r<<3^r<<4;u=u>>8^u&255^99,t[h]=u,n[u]=h,c=s[l=s[a=s[h]]];let p=c*16843009^l*65537^a*257^h*16843008,f=s[u]*257^u*16843008;for(let m=0;m<4;m++)i[m][h]=f=f<<24^f>>>8,e[m][u]=p=p<<24^p>>>8}for(let h=0;h<5;h++)i[h]=i[h].slice(0),e[h]=e[h].slice(0)}_crypt(i,e){if(i.length!==4)throw new Error("invalid aes block size");const t=this._key[e],n=t.length/4-2,s=[0,0,0,0],o=this._tables[e],r=o[0],a=o[1],l=o[2],c=o[3],h=o[4];let u=i[0]^t[0],p=i[e?3:1]^t[1],f=i[2]^t[2],m=i[e?1:3]^t[3],y=4,g,A,v;for(let C=0;C<n;C++)g=r[u>>>24]^a[p>>16&255]^l[f>>8&255]^c[m&255]^t[y],A=r[p>>>24]^a[f>>16&255]^l[m>>8&255]^c[u&255]^t[y+1],v=r[f>>>24]^a[m>>16&255]^l[u>>8&255]^c[p&255]^t[y+2],m=r[m>>>24]^a[u>>16&255]^l[p>>8&255]^c[f&255]^t[y+3],y+=4,u=g,p=A,f=v;for(let C=0;C<4;C++)s[e?3&-C:C]=h[u>>>24]<<24^h[p>>16&255]<<16^h[f>>8&255]<<8^h[m&255]^t[y++],g=u,u=p,p=f,f=m,m=g;return s}};const bb={getRandomValues(i){const e=new Uint32Array(i.buffer),t=n=>{let s=987654321;const o=4294967295;return function(){return s=36969*(s&65535)+(s>>16)&o,n=18e3*(n&65535)+(n>>16)&o,(((s<<16)+n&o)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let n=0,s;n<i.length;n+=4){const o=t((s||Math.random())*4294967296);s=o()*987654071,e[n/4]=o()*4294967296|0}return i}},zh={};zh.ctrGladman=class{constructor(i,e){this._prf=i,this._initIv=e,this._iv=e}reset(){this._iv=this._initIv}update(i){return this.calculate(this._prf,i,this._iv)}incWord(i){if((i>>24&255)===255){let e=i>>16&255,t=i>>8&255,n=i&255;e===255?(e=0,t===255?(t=0,n===255?n=0:++n):++t):++e,i=0,i+=e<<16,i+=t<<8,i+=n}else i+=1<<24;return i}incCounter(i){(i[0]=this.incWord(i[0]))===0&&(i[1]=this.incWord(i[1]))}calculate(i,e,t){let n;if(!(n=e.length))return[];const s=pt.bitLength(e);for(let o=0;o<n;o+=4){this.incCounter(t);const r=i.encrypt(t);e[o]^=r[0],e[o+1]^=r[1],e[o+2]^=r[2],e[o+3]^=r[3]}return pt.clamp(e,s)}};const Xi={importKey(i){return new Xi.hmacSha1(Jo.bytes.toBits(i))},pbkdf2(i,e,t,n){if(t=t||1e4,n<0||t<0)throw new Error("invalid params to pbkdf2");const s=(n>>5)+1<<2;let o,r,a,l,c;const h=new ArrayBuffer(s),u=new DataView(h);let p=0;const f=pt;for(e=Jo.bytes.toBits(e),c=1;p<(s||1);c++){for(o=r=i.encrypt(f.concat(e,[c])),a=1;a<t;a++)for(r=i.encrypt(r),l=0;l<r.length;l++)o[l]^=r[l];for(a=0;p<(s||1)&&a<o.length;a++)u.setInt32(p,o[a]),p+=4}return h.slice(0,n/8)}};Xi.hmacSha1=class{constructor(i){const e=this,t=e._hash=Vh.sha1,n=[[],[]];e._baseHash=[new t,new t];const s=e._baseHash[0].blockSize/32;i.length>s&&(i=new t().update(i).finalize());for(let o=0;o<s;o++)n[0][o]=i[o]^909522486,n[1][o]=i[o]^1549556828;e._baseHash[0].update(n[0]),e._baseHash[1].update(n[1]),e._resultHash=new t(e._baseHash[0])}reset(){const i=this;i._resultHash=new i._hash(i._baseHash[0]),i._updated=!1}update(i){const e=this;e._updated=!0,e._resultHash.update(i)}digest(){const i=this,e=i._resultHash.finalize(),t=new i._hash(i._baseHash[1]).update(e).finalize();return i.reset(),t}encrypt(i){if(this._updated)throw new Error("encrypt on already updated hmac called!");return this.update(i),this.digest(i)}};const Cb=typeof crypto!=Ei&&typeof crypto.getRandomValues==Ki,Hh="Invalid password",Yh="Invalid signature",sl="zipjs-abort-check-password";function $h(i){return Cb?crypto.getRandomValues(i):bb.getRandomValues(i)}const Mn=16,wb="raw",jh={name:"PBKDF2"},Eb={name:"HMAC"},xb="SHA-1",Ib=Object.assign({hash:Eb},jh),ol=Object.assign({iterations:1e3,hash:{name:xb}},jh),Sb=["deriveBits"],Es=[8,12,16],xs=[16,24,32],xi=10,Mb=[0,0,0,0],Zo=typeof crypto!=Ei,Is=Zo&&crypto.subtle,Wh=Zo&&typeof Is!=Ei,Kt=Jo.bytes,Tb=Qh.aes,Bb=zh.ctrGladman,_b=Xi.hmacSha1;let qh=Zo&&Wh&&typeof Is.importKey==Ki,Kh=Zo&&Wh&&typeof Is.deriveBits==Ki;class kb extends TransformStream{constructor({password:e,rawPassword:t,signed:n,encryptionStrength:s,checkPasswordOnly:o}){super({start(){Object.assign(this,{ready:new Promise(r=>this.resolveReady=r),password:Zh(e,t),signed:n,strength:s-1,pending:new Uint8Array})},async transform(r,a){const l=this,{password:c,strength:h,resolveReady:u,ready:p}=l;c?(await Db(l,h,c,kt(r,0,Es[h]+2)),r=kt(r,Es[h]+2),o?a.error(new Error(sl)):u()):await p;const f=new Uint8Array(r.length-xi-(r.length-xi)%Mn);a.enqueue(Xh(l,r,f,0,xi,!0))},async flush(r){const{signed:a,ctr:l,hmac:c,pending:h,ready:u}=this;if(c&&l){await u;const p=kt(h,0,h.length-xi),f=kt(h,h.length-xi);let m=new Uint8Array;if(p.length){const y=Ms(Kt,p);c.update(y);const g=l.update(y);m=Ss(Kt,g)}if(a){const y=kt(Ss(Kt,c.digest()),0,xi);for(let g=0;g<xi;g++)if(y[g]!=f[g])throw new Error(Yh)}r.enqueue(m)}}})}}class Pb extends TransformStream{constructor({password:e,rawPassword:t,encryptionStrength:n}){let s;super({start(){Object.assign(this,{ready:new Promise(o=>this.resolveReady=o),password:Zh(e,t),strength:n-1,pending:new Uint8Array})},async transform(o,r){const a=this,{password:l,strength:c,resolveReady:h,ready:u}=a;let p=new Uint8Array;l?(p=await Nb(a,c,l),h()):await u;const f=new Uint8Array(p.length+o.length-o.length%Mn);f.set(p,0),r.enqueue(Xh(a,o,f,p.length,0))},async flush(o){const{ctr:r,hmac:a,pending:l,ready:c}=this;if(a&&r){await c;let h=new Uint8Array;if(l.length){const u=r.update(Ms(Kt,l));a.update(u),h=Ss(Kt,u)}s.signature=Ss(Kt,a.digest()).slice(0,xi),o.enqueue(rl(h,s.signature))}}}),s=this}}function Xh(i,e,t,n,s,o){const{ctr:r,hmac:a,pending:l}=i,c=e.length-s;l.length&&(e=rl(l,e),t=Fb(t,c-c%Mn));let h;for(h=0;h<=c-Mn;h+=Mn){const u=Ms(Kt,kt(e,h,h+Mn));o&&a.update(u);const p=r.update(u);o||a.update(p),t.set(Ss(Kt,p),h+n)}return i.pending=kt(e,h),t}async function Db(i,e,t,n){const s=await Jh(i,e,t,kt(n,0,Es[e])),o=kt(n,Es[e]);if(s[0]!=o[0]||s[1]!=o[1])throw new Error(Hh)}async function Nb(i,e,t){const n=$h(new Uint8Array(Es[e])),s=await Jh(i,e,t,n);return rl(n,s)}async function Jh(i,e,t,n){i.password=null;const s=await Lb(wb,t,Ib,!1,Sb),o=await Rb(Object.assign({salt:n},ol),s,8*(xs[e]*2+2)),r=new Uint8Array(o),a=Ms(Kt,kt(r,0,xs[e])),l=Ms(Kt,kt(r,xs[e],xs[e]*2)),c=kt(r,xs[e]*2);return Object.assign(i,{keys:{key:a,authentication:l,passwordVerification:c},ctr:new Bb(new Tb(a),Array.from(Mb)),hmac:new _b(l)}),c}async function Lb(i,e,t,n,s){if(qh)try{return await Is.importKey(i,e,t,n,s)}catch{return qh=!1,Xi.importKey(e)}else return Xi.importKey(e)}async function Rb(i,e,t){if(Kh)try{return await Is.deriveBits(i,e,t)}catch{return Kh=!1,Xi.pbkdf2(e,i.salt,ol.iterations,t)}else return Xi.pbkdf2(e,i.salt,ol.iterations,t)}function Zh(i,e){return e===Se?vb(i):e}function rl(i,e){let t=i;return i.length+e.length&&(t=new Uint8Array(i.length+e.length),t.set(i,0),t.set(e,i.length)),t}function Fb(i,e){if(e&&e>i.length){const t=i;i=new Uint8Array(e),i.set(t,0)}return i}function kt(i,e,t){return i.subarray(e,t)}function Ss(i,e){return i.fromBits(e)}function Ms(i,e){return i.toBits(e)}const Ts=12;class Ob extends TransformStream{constructor({password:e,passwordVerification:t,checkPasswordOnly:n}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),iu(this,e)},transform(s,o){const r=this;if(r.password){const a=eu(r,s.subarray(0,Ts));if(r.password=null,a.at(-1)!=r.passwordVerification)throw new Error(Hh);s=s.subarray(Ts)}n?o.error(new Error(sl)):o.enqueue(eu(r,s))}})}}class Gb extends TransformStream{constructor({password:e,passwordVerification:t}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),iu(this,e)},transform(n,s){const o=this;let r,a;if(o.password){o.password=null;const l=$h(new Uint8Array(Ts));l[Ts-1]=o.passwordVerification,r=new Uint8Array(n.length+l.length),r.set(tu(o,l),0),a=Ts}else r=new Uint8Array(n.length),a=0;r.set(tu(o,n),a),s.enqueue(r)}})}}function eu(i,e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=nu(i)^e[n],al(i,t[n]);return t}function tu(i,e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=nu(i)^e[n],al(i,e[n]);return t}function iu(i,e){const t=[305419896,591751049,878082192];Object.assign(i,{keys:t,crcKey0:new Xo(t[0]),crcKey2:new Xo(t[2])});for(let n=0;n<e.length;n++)al(i,e.charCodeAt(n))}function al(i,e){let[t,n,s]=i.keys;i.crcKey0.append([e]),t=~i.crcKey0.get(),n=ou(Math.imul(ou(n+su(t)),134775813)+1),i.crcKey2.append([n>>>24]),s=~i.crcKey2.get(),i.keys=[t,n,s]}function nu(i){const e=i.keys[2]|2;return su(Math.imul(e,e^1)>>>8)}function su(i){return i&255}function ou(i){return i&4294967295}const ru="Invalid uncompressed size",Ub="deflate-raw",Vb="deflate64-raw";class Qb extends TransformStream{constructor(e,{chunkSize:t,CompressionStreamZlib:n,CompressionStream:s}){super({});const{compressed:o,encrypted:r,useCompressionStream:a,zipCrypto:l,signed:c,level:h}=e,u=this;let p,f,m=super.readable;(!r||l)&&c&&(p=new Uh,m=Xt(m,p)),o&&(m=lu(m,a,{level:h,chunkSize:t},s,n,s)),r&&(l?m=Xt(m,new Gb(e)):(f=new Pb(e),m=Xt(m,f))),au(u,m,()=>{let y;r&&!l&&(y=f.signature),(!r||l)&&c&&(y=new DataView(p.value.buffer).getUint32(0)),u.signature=y})}}class zb extends TransformStream{constructor(e,{chunkSize:t,DecompressionStreamZlib:n,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:r,signed:a,signature:l,compressed:c,useCompressionStream:h,deflate64:u}=e;let p,f,m=super.readable;r&&(o?m=Xt(m,new Ob(e)):(f=new kb(e),m=Xt(m,f))),c&&(m=lu(m,h,{chunkSize:t,deflate64:u},s,n,s)),(!r||o)&&a&&(p=new Uh,m=Xt(m,p)),au(this,m,()=>{if((!r||o)&&a){const y=new DataView(p.value.buffer);if(l!=y.getUint32(0,!1))throw new Error(Yh)}})}}function au(i,e,t){e=Xt(e,new TransformStream({flush:t})),Object.defineProperty(i,"readable",{get(){return e}})}function lu(i,e,t,n,s,o){const r=e&&n?n:s||o,a=t.deflate64?Vb:Ub;try{i=Xt(i,new r(a,t))}catch(l){if(e)if(s)i=Xt(i,new s(a,t));else if(o)i=Xt(i,new o(a,t));else throw l;else throw l}return i}function Xt(i,e){return i.pipeThrough(e)}const Hb="message",Yb="start",$b="pull",cu="data",jb="ack",du="close",Wb="deflate",hu="inflate";class qb extends TransformStream{constructor(e,t){super({});const n=this,{codecType:s}=e;let o;s.startsWith(Wb)?o=Qb:s.startsWith(hu)&&(o=zb),n.outputSize=0;let r=0;const a=new o(e,t),l=super.readable,c=new TransformStream({transform(u,p){u&&u.length&&(r+=u.length,p.enqueue(u))},flush(){Object.assign(n,{inputSize:r})}}),h=new TransformStream({transform(u,p){if(u&&u.length&&(p.enqueue(u),n.outputSize+=u.length,e.outputSize!==Se&&n.outputSize>e.outputSize))throw new Error(ru)},flush(){const{signature:u}=a;Object.assign(n,{signature:u,inputSize:r})}});Object.defineProperty(n,"readable",{get(){return l.pipeThrough(c).pipeThrough(a).pipeThrough(h)}})}}class Kb extends TransformStream{constructor(e){let t;super({transform:n,flush(s){t&&t.length&&s.enqueue(t)}});function n(s,o){if(t){const r=new Uint8Array(t.length+s.length);r.set(t),r.set(s,t.length),s=r,t=null}s.length>e?(o.enqueue(s.slice(0,e)),n(s.slice(e),o)):t=s}}}let uu=typeof Worker!=Ei,fu=()=>{};function Xb({initModule:i}){fu=i}class ll{constructor(e,{readable:t,writable:n},{options:s,config:o,streamOptions:r,useWebWorkers:a,transferStreams:l,workerURI:c},h){const{signal:u}=r;return Object.assign(e,{busy:!0,readable:t.pipeThrough(new Kb(o.chunkSize)).pipeThrough(new Jb(r),{signal:u}),writable:n,options:Object.assign({},s),workerURI:c,transferStreams:l,terminate(){return new Promise(p=>{const{worker:f,busy:m}=e;f?(m?e.resolveTerminated=p:(f.terminate(),p()),e.interface=null):p()})},onTaskFinished(){const{resolveTerminated:p}=e;p&&(e.resolveTerminated=null,e.terminated=!0,e.worker.terminate(),p()),e.busy=!1,h(e)}}),(a&&uu?Zb:pu)(e,o)}}class Jb extends TransformStream{constructor({onstart:e,onprogress:t,size:n,onend:s}){let o=0;super({async start(){e&&await cl(e,n)},async transform(r,a){o+=r.length,t&&await cl(t,o,n),a.enqueue(r)},async flush(){s&&await cl(s,o)}})}}async function cl(i,...e){try{await i(...e)}catch{}}function pu(i,e){return{run:()=>eC(i,e)}}function Zb(i,e){const{baseURI:t,chunkSize:n}=e;let{wasmURI:s}=e;if(!i.interface){typeof s==Ki&&(s=s());let o;try{o=nC(i.workerURI,t,i)}catch{return uu=!1,pu(i,e)}Object.assign(i,{worker:o,interface:{run:()=>tC(i,{chunkSize:n,wasmURI:s,baseURI:t})}})}return i.interface}async function eC({options:i,readable:e,writable:t,onTaskFinished:n},s){let o;try{if(!i.useCompressionStream)try{await fu(s)}catch{i.useCompressionStream=!0}o=new qb(i,s),await e.pipeThrough(o).pipeTo(t,{preventClose:!0,preventAbort:!0});const{signature:r,inputSize:a,outputSize:l}=o;return{signature:r,inputSize:a,outputSize:l}}catch(r){throw o&&(r.outputSize=o.outputSize),r}finally{n()}}async function tC(i,e){let t,n;const s=new Promise((u,p)=>{t=u,n=p});Object.assign(i,{reader:null,writer:null,resolveResult:t,rejectResult:n,result:s});const{readable:o,options:r}=i,{writable:a,closed:l}=iC(i.writable),c=er({type:Yb,options:r,config:e,readable:o,writable:a},i);c||Object.assign(i,{reader:o.getReader(),writer:a.getWriter()});const h=await s;return c||await a.getWriter().close(),await l,h}function iC(i){let e;const t=new Promise(s=>e=s);return{writable:new WritableStream({async write(s){const o=i.getWriter();await o.ready,await o.write(s),o.releaseLock()},close(){e()},abort(s){return i.getWriter().abort(s)}}),closed:t}}let mu=!0;function nC(i,e,t){const n={type:"module"};let s,o;if(typeof i==Ki&&(i=i()),i.startsWith("data:")||i.startsWith("blob:"))try{o=new Worker(i)}catch{o=new Worker(i,n)}else{try{s=new URL(i,e)}catch{s=i}o=new Worker(s,n)}return o.addEventListener(Hb,r=>sC(r,t)),o}function er(i,{worker:e,writer:t,onTaskFinished:n,transferStreams:s}){try{const{value:o,readable:r,writable:a}=i,l=[];if(o&&(i.value=o,l.push(i.value.buffer)),s&&mu?(r&&l.push(r),a&&l.push(a)):i.readable=i.writable=null,l.length)try{return e.postMessage(i,l),!0}catch{mu=!1,i.readable=i.writable=null,e.postMessage(i)}else e.postMessage(i)}catch(o){throw t&&t.releaseLock(),n(),o}}async function sC({data:i},e){const{type:t,value:n,messageId:s,result:o,error:r}=i,{reader:a,writer:l,resolveResult:c,rejectResult:h,onTaskFinished:u}=e;try{if(r){const{message:f,stack:m,code:y,name:g,outputSize:A}=r,v=new Error(f);Object.assign(v,{stack:m,code:y,name:g,outputSize:A}),p(v)}else{if(t==$b){const{value:f,done:m}=await a.read();er({type:cu,value:f,done:m,messageId:s},e)}t==cu&&(await l.ready,await l.write(new Uint8Array(n)),er({type:jb,messageId:s},e)),t==du&&p(null,o)}}catch(f){er({type:du,messageId:s},e),p(f)}function p(f,m){f?h(f):c(m),l&&l.releaseLock(),u()}}let Ji=[];const dl=[];let gu=0;async function oC(i,e){const{options:t,config:n}=e,{transferStreams:s,useWebWorkers:o,useCompressionStream:r,compressed:a,signed:l,encrypted:c}=t,{workerURI:h,maxWorkers:u}=n;e.transferStreams=s||s===Se;const p=!a&&!l&&!c&&!e.transferStreams;return e.useWebWorkers=!p&&(o||o===Se&&n.useWebWorkers),e.workerURI=e.useWebWorkers&&h?h:Se,t.useCompressionStream=r||r===Se&&n.useCompressionStream,(await f()).run();async function f(){const y=Ji.find(g=>!g.busy);if(y)return yu(y),new ll(y,i,e,m);if(Ji.length<u){const g={indexWorker:gu};return gu++,Ji.push(g),new ll(g,i,e,m)}else return new Promise(g=>dl.push({resolve:g,stream:i,workerOptions:e}))}function m(y){if(dl.length){const[{resolve:g,stream:A,workerOptions:v}]=dl.splice(0,1);g(new ll(y,A,v,m))}else y.worker?(yu(y),rC(y,e)):Ji=Ji.filter(g=>g!=y)}}function rC(i,e){const{config:t}=e,{terminateWorkerTimeout:n}=t;Number.isFinite(n)&&n>=0&&(i.terminated?i.terminated=!1:i.terminateTimeout=setTimeout(async()=>{Ji=Ji.filter(s=>s!=i);try{await i.terminate()}catch{}},n))}function yu(i){const{terminateTimeout:e}=i;e&&(clearTimeout(e),i.terminateTimeout=null)}const aC="Writer iterator completed too soon",lC="Content-Type",cC=64*1024,Au="writable";class hl{constructor(){this.size=0}init(){this.initialized=!0}}class vu extends hl{get readable(){const e=this,{chunkSize:t=cC}=e,n=new ReadableStream({start(){this.chunkOffset=0},async pull(s){const{offset:o=0,size:r,diskNumberStart:a}=n,{chunkOffset:l}=this,c=r===Se?t:Math.min(t,r-l),h=await tt(e,o+l,c,a);s.enqueue(h),l+t>r||r===Se&&!h.length&&c?s.close():this.chunkOffset+=t}});return n}}class tr extends vu{constructor(e){super(),Object.assign(this,{blob:e,size:e.size})}async readUint8Array(e,t){const n=this,s=e+t;let r=await(e||s<n.size?n.blob.slice(e,s):n.blob).arrayBuffer();return r.byteLength>t&&(r=r.slice(e,s)),new Uint8Array(r)}}class dC extends hl{constructor(e){super();const t=this,n=new TransformStream,s=[];e&&s.push([lC,e]),Object.defineProperty(t,Au,{get(){return n.writable}}),t.blob=new Response(n.readable,{headers:s}).blob()}getData(){return this.blob}}class hC extends dC{constructor(e){super(e),Object.assign(this,{encoding:e,utf8:!e||e.toLowerCase()=="utf-8"})}async getData(){const{encoding:e,utf8:t}=this,n=await super.getData();if(n.text&&t)return n.text();{const s=new FileReader;return new Promise((o,r)=>{Object.assign(s,{onload:({target:a})=>o(a.result),onerror:()=>r(s.error)}),s.readAsText(n,e)})}}}class uC extends vu{constructor(e){super(),this.readers=e}async init(){const e=this,{readers:t}=e;e.lastDiskNumber=0,e.lastDiskOffset=0,await Promise.all(t.map(async(n,s)=>{await n.init(),s!=t.length-1&&(e.lastDiskOffset+=n.size),e.size+=n.size})),super.init()}async readUint8Array(e,t,n=0){const s=this,{readers:o}=this;let r,a=n;a==-1&&(a=o.length-1);let l=e;for(;o[a]&&l>=o[a].size;)l-=o[a].size,a++;const c=o[a];if(c){const h=c.size;if(l+t<=h)r=await tt(c,l,t);else{const u=h-l;r=new Uint8Array(t);const p=await tt(c,l,u);r.set(p,0);const f=await s.readUint8Array(e+u,t-u,n);r.set(f,u),p.length+f.length<t&&(r=r.subarray(0,p.length+f.length))}}else r=new Uint8Array;return s.lastDiskNumber=Math.max(a,s.lastDiskNumber),r}}class bu extends hl{constructor(e,t=4294967295){super();const n=this;Object.assign(n,{diskNumber:0,diskOffset:0,size:0,maxSize:t,availableSize:t});let s,o,r;const a=new WritableStream({async write(h){const{availableSize:u}=n;if(r)h.length>=u?(await l(h.subarray(0,u)),await c(),n.diskOffset+=s.size,n.diskNumber++,r=null,await this.write(h.subarray(u))):await l(h);else{const{value:p,done:f}=await e.next();if(f&&!p)throw new Error(aC);s=p,s.size=0,s.maxSize&&(n.maxSize=s.maxSize),n.availableSize=n.maxSize,await ir(s),o=p.writable,r=o.getWriter(),await this.write(h)}},async close(){await r.ready,await c()}});Object.defineProperty(n,Au,{get(){return a}});async function l(h){const u=h.length;u&&(await r.ready,await r.write(h),s.size+=u,n.size+=u,n.availableSize-=u)}async function c(){await r.close()}}}class fC{constructor(e){return Array.isArray(e)&&(e=new uC(e)),e instanceof ReadableStream&&(e={readable:e}),e}}class pC{constructor(e){return e.writable===Se&&typeof e.next==Ki&&(e=new bu(e)),e instanceof WritableStream&&(e={writable:e}),e.size===Se&&(e.size=0),e instanceof bu||Object.assign(e,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),e}}async function ir(i,e){if(i.init&&!i.initialized)await i.init(e);else return Promise.resolve()}function tt(i,e,t,n){return i.readUint8Array(e,t,n)}const Cu="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split(""),mC=Cu.length==256;function gC(i){if(mC){let e="";for(let t=0;t<i.length;t++)e+=Cu[i[t]];return e}else return new TextDecoder().decode(i)}function nr(i,e){return e&&e.trim().toLowerCase()=="cp437"?gC(i):new TextDecoder(e).decode(i)}const wu="filename",Eu="rawFilename",xu="comment",Iu="rawComment",Su="uncompressedSize",Mu="compressedSize",Tu="offset",Bu="diskNumberStart",ul="lastModDate",fl="rawLastModDate",_u="lastAccessDate",yC="rawLastAccessDate",ku="creationDate",Pu="rawCreationDate",AC=[wu,Eu,Su,Mu,ul,fl,xu,Iu,_u,ku,Pu,Tu,Bu,"internalFileAttributes","externalFileAttributes","msdosAttributesRaw","msdosAttributes","msDosCompatible","zip64","encrypted","version","versionMadeBy","zipCrypto","directory","executable","compressionMethod","signature","extraField","extraFieldUnix","extraFieldInfoZip","uid","gid","unixMode","setuid","setgid","sticky","bitFlag","filenameUTF8","commentUTF8","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp"];class Du{constructor(e){AC.forEach(t=>this[t]=e[t])}}const vC="filenameEncoding",bC="commentEncoding",CC="decodeText",wC="extractPrependedData",EC="extractAppendedData",xC="password",IC="rawPassword",SC="passThrough",MC="signal",TC="checkPasswordOnly",BC="checkOverlappingEntryOnly",_C="checkOverlappingEntry",kC="checkSignature",PC="useWebWorkers",DC="useCompressionStream",NC="transferStreams",LC="preventClose",pl="File format is not recognized",RC="End of central directory not found",FC="End of Zip64 central directory locator not found",OC="Central directory header not found",GC="Local file header not found",UC="Zip64 extra field not found",VC="File contains encrypted entry",QC="Encryption method not supported",Nu="Compression method not supported",Lu="Split zip file",zC="Overlapping entry found",Ru="utf-8",HC="UTF8",Fu="cp437",YC=[[Su,qi],[Mu,qi],[Tu,qi],[Bu,qt]],$C={[qt]:{getValue:Me,bytes:4},[qi]:{getValue:Tn,bytes:8}};class ml{constructor(e,t={}){Object.assign(this,{reader:new fC(e),options:t,config:gb(),readRanges:[]})}async*getEntriesGenerator(e={}){const t=this;let{reader:n}=t;const{config:s}=t;if(await ir(n),(n.size===Se||!n.readUint8Array)&&(n=new tr(await new Response(n.readable).blob()),await ir(n)),n.size<Sn)throw new Error(pl);n.chunkSize=yb(s);const o=await ZC(n,Uv,n.size,Sn,qt*16);if(!o){const b=await tt(n,0,4),B=Te(b);throw Me(B)==Bh?new Error(Lu):new Error(RC)}const r=Te(o);let a=Me(r,12),l=Me(r,16);const c=o.offset,h=Ze(r,20),u=c+Sn+h;let p=Ze(r,4);const f=n.lastDiskNumber||0;let m=Ze(r,6),y=Ze(r,8),g=0,A=0;if(l==qi||a==qi||y==qt||m==qt){const b=await tt(n,o.offset-Za,Za),B=Te(b);if(Me(B,0)==Vv){l=Tn(B,8);let L=await tt(n,l,el,-1),O=Te(L);const N=o.offset-Za-el;if(Me(O,0)!=kh&&l!=N){const D=l;l=N,l>D&&(g=l-D),L=await tt(n,l,el,-1),O=Te(L)}if(Me(O,0)!=kh)throw new Error(FC);p==qt&&(p=Me(O,16)),m==qt&&(m=Me(O,20)),y==qt&&(y=Tn(O,32)),a==qi&&(a=Tn(O,40)),l-=a}}if(l>=n.size&&(g=n.size-l-a-Sn,l=n.size-a-Sn),f!=p)throw new Error(Lu);if(l<0)throw new Error(pl);let v=0,C=await tt(n,l,a,m),w=Te(C);if(a){const b=o.offset-a;if(Me(w,v)!=_h&&l!=b){const B=l;l=b,l>B&&(g+=l-B),C=await tt(n,l,a,m),w=Te(C)}}const M=o.offset-l-(n.lastDiskOffset||0);if(a!=M&&M>=0&&(a=M,C=await tt(n,l,a,m),w=Te(C)),l<0||l>=n.size)throw new Error(pl);const x=it(t,e,vC),I=it(t,e,bC);for(let b=0;b<y;b++){const B=new jC(n,s,t.options);if(Me(w,v)!=_h)throw new Error(OC);Ou(B,w,v+6);const L=!!B.bitFlag.languageEncodingFlag,O=v+46,N=O+B.filenameLength,D=N+B.extraFieldLength,E=Ze(w,v+4),T=E>>8==0,P=E>>8==3,F=C.subarray(O,N),V=Ze(w,v+32),G=D+V,k=C.subarray(D,G),_=L,U=L,H=Me(w,v+38),q=H&Ja,X={readOnly:!!(q&ib),hidden:!!(q&nb),system:!!(q&sb),directory:!!(q&tb),archive:!!(q&ob)},de=Me(w,v+42)+g,fe=it(t,e,CC)||nr,me=_?Ru:x||Fu,be=U?Ru:I||Fu;let _e=fe(F,me);_e===Se&&(_e=nr(F,me));let Je=fe(k,be);Je===Se&&(Je=nr(k,be)),Object.assign(B,{versionMadeBy:E,msDosCompatible:T,compressedSize:0,uncompressedSize:0,commentLength:V,offset:de,diskNumberStart:Ze(w,v+34),internalFileAttributes:Ze(w,v+36),externalFileAttributes:H,msdosAttributesRaw:q,msdosAttributes:X,rawFilename:F,filenameUTF8:_,commentUTF8:U,rawExtraField:C.subarray(N,D),rawComment:k,filename:_e,comment:Je}),A=Math.max(de,A),Gu(B,B,w,v+6);const lt=B.externalFileAttributes>>16&qt;B.unixMode===Se&&(lt&(rb|il|tl))!=0&&(B.unixMode=lt);const ct=!!(B.unixMode&ab),Bt=!!(B.unixMode&lb),vt=!!(B.unixMode&cb),j=B.unixMode!==Se?(B.unixMode&il)!=0:P&&(lt&il)!=0,Y=B.unixMode!==Se&&(B.unixMode&Rh)==tl,te=(lt&Rh)==tl;Object.assign(B,{setuid:ct,setgid:Bt,sticky:vt,unixExternalUpper:lt,internalFileAttribute:B.internalFileAttributes,externalFileAttribute:B.externalFileAttributes,executable:j,directory:Y||te||T&&X.directory||_e.endsWith(db)&&!B.uncompressedSize,zipCrypto:B.encrypted&&!B.extraFieldAES});const ze=new Du(B);ze.getData=($t,yn)=>B.getData($t,ze,t.readRanges,yn),ze.arrayBuffer=async $t=>{const yn=new TransformStream,[Yi]=await Promise.all([new Response(yn.readable).arrayBuffer(),B.getData(yn,ze,t.readRanges,$t)]);return Yi},v=G;const{onprogress:It}=e;if(It)try{await It(b+1,y,new Du(B))}catch{}yield ze}const S=it(t,e,wC),R=it(t,e,EC);return S&&(t.prependedData=A>0?await tt(n,0,A):new Uint8Array),t.comment=h?await tt(n,c+Sn,h):new Uint8Array,R&&(t.appendedData=u<n.size?await tt(n,u,n.size-u):new Uint8Array),!0}async getEntries(e={}){const t=[];for await(const n of this.getEntriesGenerator(e))t.push(n);return t}async close(){}}class jC{constructor(e,t,n){Object.assign(this,{reader:e,config:t,options:n})}async getData(e,t,n,s={}){const o=this,{reader:r,offset:a,diskNumberStart:l,extraFieldAES:c,extraFieldZip64:h,compressionMethod:u,config:p,bitFlag:f,signature:m,rawLastModDate:y,uncompressedSize:g,compressedSize:A}=o,{dataDescriptor:v}=f,C=t.localDirectory={},w=await tt(r,a,nl,l),M=Te(w);let x=it(o,s,xC),I=it(o,s,IC);const S=it(o,s,SC);if(x=x&&x.length&&x,I=I&&I.length&&I,c&&c.originalCompressionMethod!=Fv)throw new Error(Nu);if(u!=Rv&&u!=Lv&&u!=Th&&!S)throw new Error(Nu);if(Me(M,0)!=Ov)throw new Error(GC);Ou(C,M,4);const{extraFieldLength:R,filenameLength:b,lastAccessDate:B,creationDate:L}=C;C.rawExtraField=R?await tt(r,a+nl+b,R,l):new Uint8Array,Gu(o,C,M,4,!0),Object.assign(t,{lastAccessDate:B,creationDate:L});const O=o.encrypted&&C.encrypted&&!S,N=O&&!c;if(S||(t.zipCrypto=N),O){if(!N&&c.strength===Se)throw new Error(QC);if(!x&&!I)throw new Error(VC)}const D=a+nl+b+R,E=A,T=r.readable;Object.assign(T,{diskNumberStart:l,offset:D,size:E});const P=it(o,s,MC),F=it(o,s,TC);let V=it(o,s,_C);const G=it(o,s,BC);G&&(V=!0);const{onstart:k,onprogress:_,onend:U}=s,H=u==Th;let q=it(o,s,DC);H&&(q=!1);const X={options:{codecType:hu,password:x,rawPassword:I,zipCrypto:N,encryptionStrength:c&&c.strength,signed:it(o,s,kC)&&!S,passwordVerification:N&&(v?y>>>8&Ja:m>>>24&Ja),outputSize:S?A:g,signature:m,compressed:u!=0&&!S,encrypted:o.encrypted&&!S,useWebWorkers:it(o,s,PC),useCompressionStream:q,transferStreams:it(o,s,NC),deflate64:H,checkPasswordOnly:F},config:p,streamOptions:{signal:P,size:E,onstart:k,onprogress:_,onend:U}};V&&await JC({reader:r,fileEntry:t,offset:a,diskNumberStart:l,signature:m,compressedSize:A,uncompressedSize:g,dataOffset:D,dataDescriptor:v||C.bitFlag.dataDescriptor,extraFieldZip64:h||C.extraFieldZip64,readRanges:n});let de;try{if(!G){F&&(e=new WritableStream),e=new pC(e),await ir(e,S?A:g),{writable:de}=e;const{outputSize:fe}=await oC({readable:T,writable:de},X);if(e.size+=fe,fe!=(S?A:g))throw new Error(ru)}}catch(fe){if(fe.outputSize!==Se&&(e.size+=fe.outputSize),!F||fe.message!=sl)throw fe}finally{!it(o,s,LC)&&de&&!de.locked&&await de.getWriter().close()}return F||G?Se:e.getData?e.getData():de}}function Ou(i,e,t){const n=i.rawBitFlag=Ze(e,t+2),s=(n&Dh)==Dh,o=Me(e,t+6);Object.assign(i,{encrypted:s,version:Ze(e,t),bitFlag:{level:(n&eb)>>1,dataDescriptor:(n&Nh)==Nh,languageEncodingFlag:(n&Lh)==Lh},rawLastModDate:o,lastModDate:ew(o),filenameLength:Ze(e,t+22),extraFieldLength:Ze(e,t+24)})}function Gu(i,e,t,n,s){const{rawExtraField:o}=e,r=e.extraField=new Map,a=Te(new Uint8Array(o));let l=0;try{for(;l<o.length;){const v=Ze(a,l),C=Ze(a,l+2);r.set(v,{type:v,data:o.slice(l+4,l+4+C)}),l+=4+C}}catch{}const c=Ze(t,n+4);Object.assign(e,{signature:Me(t,n+hb),compressedSize:Me(t,n+ub),uncompressedSize:Me(t,n+fb)});const h=r.get(Hv);h&&(WC(h,e),e.extraFieldZip64=h);const u=r.get(qv);u&&(Uu(u,wu,Eu,e,i),e.extraFieldUnicodePath=u);const p=r.get(Kv);p&&(Uu(p,xu,Iu,e,i),e.extraFieldUnicodeComment=p);const f=r.get(Yv);f?(qC(f,e,c),e.extraFieldAES=f):e.compressionMethod=c;const m=r.get($v);m&&(KC(m,e),e.extraFieldNTFS=m);const y=r.get(Zv);if(y)Vu(y,e,!1),e.extraFieldUnix=y;else{const v=r.get(Jv);v&&(Vu(v,e,!0),e.extraFieldInfoZip=v)}const g=r.get(Wv);g&&(XC(g,e,s),e.extraFieldExtendedTimestamp=g);const A=r.get(Xv);A&&(e.extraFieldUSDZ=A)}function WC(i,e){e.zip64=!0;const t=Te(i.data),n=YC.filter(([s,o])=>e[s]==o);for(let s=0,o=0;s<n.length;s++){const[r,a]=n[s];if(e[r]==a){const l=$C[a];e[r]=i[r]=l.getValue(t,o),o+=l.bytes}else if(i[r])throw new Error(UC)}}function Uu(i,e,t,n,s){const o=Te(i.data),r=new Xo;r.append(s[t]);const a=Te(new Uint8Array(4));a.setUint32(0,r.get(),!0);const l=Me(o,1);Object.assign(i,{version:Ii(o,0),[e]:nr(i.data.subarray(5)),valid:!s.bitFlag.languageEncodingFlag&&l==Me(a,0)}),i.valid&&(n[e]=i[e],n[e+HC]=!0)}function qC(i,e,t){const n=Te(i.data),s=Ii(n,4);Object.assign(i,{vendorVersion:Ii(n,0),vendorId:Ii(n,2),strength:s,originalCompressionMethod:t,compressionMethod:Ze(n,5)}),e.compressionMethod=i.compressionMethod}function KC(i,e){const t=Te(i.data);let n=4,s;try{for(;n<i.data.length&&!s;){const o=Ze(t,n),r=Ze(t,n+2);o==jv&&(s=i.data.slice(n+4,n+4+r)),n+=4+r}}catch{}try{if(s&&s.length==24){const o=Te(s),r=o.getBigUint64(0,!0),a=o.getBigUint64(8,!0),l=o.getBigUint64(16,!0);Object.assign(i,{rawLastModDate:r,rawLastAccessDate:a,rawCreationDate:l});const c=gl(r),h=gl(a),u=gl(l),p={lastModDate:c,lastAccessDate:h,creationDate:u};Object.assign(i,p),Object.assign(e,p)}}catch{}}function Vu(i,e,t){try{const n=Te(new Uint8Array(i.data));let s=0;const o=Ii(n,s++),r=Ii(n,s++),a=i.data.subarray(s,s+r);s+=r;const l=Qu(a),c=Ii(n,s++),h=i.data.subarray(s,s+c);s+=c;const u=Qu(h);let p=Se;if(!t&&s+2<=i.data.length){const f=i.data;p=new DataView(f.buffer,f.byteOffset+s,2).getUint16(0,!0)}Object.assign(i,{version:o,uid:l,gid:u,unixMode:p}),l!==Se&&(e.uid=l),u!==Se&&(e.gid=u),p!==Se&&(e.unixMode=p)}catch{}}function Qu(i){const e=new Uint8Array(4);return e.set(i,0),new DataView(e.buffer,e.byteOffset,4).getUint32(0,!0)}function XC(i,e,t){const n=Te(i.data),s=Ii(n,0),o=[],r=[];t?((s&1)==1&&(o.push(ul),r.push(fl)),(s&2)==2&&(o.push(_u),r.push(yC)),(s&4)==4&&(o.push(ku),r.push(Pu))):i.data.length>=5&&(o.push(ul),r.push(fl));let a=1;o.forEach((l,c)=>{if(i.data.length>=a+4){const h=Me(n,a);e[l]=i[l]=new Date(h*1e3);const u=r[c];i[u]=h}a+=4})}async function JC({reader:i,fileEntry:e,offset:t,diskNumberStart:n,signature:s,compressedSize:o,uncompressedSize:r,dataOffset:a,dataDescriptor:l,extraFieldZip64:c,readRanges:h}){let u=0;if(n)for(let m=0;m<n;m++){const y=i.readers[m];u+=y.size}let p=0;if(l&&(c?p=zv:p=Qv),p){const m=await tt(i,a+o,p+Ph,n);if(Me(Te(m),0)==Gv){const g=Me(Te(m),4);let A,v;c?(A=Tn(Te(m),8),v=Tn(Te(m),16)):(A=Me(Te(m),8),v=Me(Te(m),12)),(e.encrypted&&!e.zipCrypto||g==s)&&A==o&&v==r&&(p+=Ph)}}const f={start:u+t,end:u+a+o+p,fileEntry:e};for(const m of h)if(m.fileEntry!=e&&f.start>=m.start&&f.start<m.end){const y=new Error(zC);throw y.overlappingEntry=m.fileEntry,y}h.push(f)}async function ZC(i,e,t,n,s){const o=new Uint8Array(4),r=Te(o);tw(r,0,e);const a=n+s;return await l(n)||await l(Math.min(a,t));async function l(c){const h=t-c,u=await tt(i,h,c);for(let p=u.length-n;p>=0;p--)if(u[p]==o[0]&&u[p+1]==o[1]&&u[p+2]==o[2]&&u[p+3]==o[3])return{offset:h+p,buffer:u.slice(p,p+n).buffer}}}function it(i,e,t){return e[t]===Se?i.options[t]:e[t]}function ew(i){const e=(i&4294901760)>>16,t=i&qt;try{return new Date(1980+((e&65024)>>9),((e&480)>>5)-1,e&31,(t&63488)>>11,(t&2016)>>5,(t&31)*2,0)}catch{}}function gl(i){return new Date(Number(i/BigInt(1e4)-BigInt(116444736e5)))}function Ii(i,e){return i.getUint8(e)}function Ze(i,e){return i.getUint16(e,!0)}function Me(i,e){return i.getUint32(e,!0)}function Tn(i,e){return Number(i.getBigUint64(e,!0))}function tw(i,e,t){i.setUint32(e,t,!0)}function Te(i){return new DataView(i.buffer)}try{Ko({baseURI:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href})}catch{}const St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function iw(i){let e;i({wasmURI:()=>(e||(e="data:application/wasm;base64,"+(t=>{t=(r=>{const a=(r=(r+"").replace(/[^A-Za-z0-9+/=]/g,"")).length,l=[];for(let c=0;a>c;c+=4){const h=St.indexOf(r[c])<<18|St.indexOf(r[c+1])<<12|(63&St.indexOf(r[c+2]))<<6|63&St.indexOf(r[c+3]);l.push(h>>16&255),r[c+2]!=="="&&l.push(h>>8&255),r[c+3]!=="="&&l.push(255&h)}return new Uint8Array(l)})(t);let n=new Uint8Array(1024),s=0;for(let r=0;r<t.length;){const a=t[r++];if(128&a){const l=3+(127&a),c=t[r++]<<8|t[r++],h=s-c;o(s+l);for(let u=0;l>u;u++)n[s++]=n[h+u]}else{const l=a;o(s+l);for(let c=0;l>c&&r<t.length;c++)n[s++]=t[r++]}}return(r=>{let a="";const l=r.length;let c=0;for(;l>c+2;c+=3){const u=r[c]<<16|r[c+1]<<8|r[c+2];a+=St[u>>18&63]+St[u>>12&63]+St[u>>6&63]+St[63&u]}const h=l-c;if(h===1){const u=r[c]<<16;a+=St[u>>18&63]+St[u>>12&63]+"=="}else if(h===2){const u=r[c]<<16|r[c+1]<<8;a+=St[u>>18&63]+St[u>>12&63]+St[u>>6&63]+"="}return a})(new Uint8Array(n.buffer.slice(0,s)));function o(r){if(n.length<r){let a=2*n.length;for(;r>a;)a*=2;const l=new Uint8Array(a);l.set(n.subarray(0,s)),n=l}}})("FQBhc20BAAAAAUULYAF/AX9gAn9/AIEABYAACwIDf4IABwEBgAARAQaAAAuDAA6BABUDAGAAgAADgAANAQSBABUDAGAHgwAegAAfEgNCQQcABAEABAgIAAIABQIKAIAAB4EAAwEFgQAHAgICgQAHEAEDAAUGAAMDBQQJBAQJAQaAAAEeAAIEAwIEAgIBBAcDAwQFAXABDQ0FBgEBggKCAgYIgACYIkHQ1QQLB4oEHAZtZW1vcnkCAAxpbmZsYXRlOV9uZXcABw2GAA8HaW5pdAAIEYoAEAdfcmF3AAoQhgAUCXByb2Nlc3MAC4cARgZlbmQADhaGAA8QbGFzdF9jb25zdW1lZAARC4QAGYMAbYUANoMAbAEShQBYhwBrARSFAH+DABMHZ3ppcAAVD4UAFIUAfgEWhgBWgQB9AhgVhQAOjQB8AmRliQB8hQAOggB8AhoQiQAPggB8AhsRigATggB8AhwPhQAUhQB8AR2GAFaBAHwJHwRmcmVlAAIVhQAVjACDCgZtYWxsb2MAAQuCAFUKaWFsaXplAAAZX4AADxZkaXJlY3RfZnVuY3Rpb25fdGFibGUBgAAcG2Vtc2NyaXB0ZW5fc3RhY2tfcmVzdG9yZQAFHI4AGwJnZYAAbw51cnJlbnQABiJfX2N4YYAAWwRjcmVtgAASBl9leGNlcIIAXQZyZWZjb3WAACUtPQkSAQBBAQsMACEiDA8XGR4+NTg7CqHlAkECAAu/JwELfyMAQRBrIgokAAJAjwACEiAAQfQBTQRAQaQnKAIAIgNBEIAAEgYLakH4A3GBAAkQSRsiBkEDdiIAdiIBQQNxBIEAMgYBQX9zQQGAAB8GaiICQQN0gAAZDMwnaiIAIAEoAtQnIoAABgQIIgVGggBSCSADQX4gAndxNoACphEBCyAFIAA2AgwgACAFNgIIC4AASAMIaiGAADcBIIIARoAABQRyNgIEgQAPA2oiAYEATQMEQQGBABIHDAsLIAZBrIIAnwMITQ2AABuBAIYEQQIgAIEANQUAIAJrcoAANQQAdHFogQCjA3QiAIIAj4AAH4IAj4AABosAjwUBd3EiA4YAkQECgQCRAQKEAJEBAIAAaIMAhYAACgJqIoAAjIIA3wUgBmsiBYMAjIAAGQIBaoEALgoAIAgEQCAIQXhxgQBuBCEBQbiBAKAEIQICf4AAZQEBgAAZBwN2dCIHcUWEAHgCIAeAAD6AADyBAHWBASEDCyEDgQDpgAB2gAAchACEAQGDAAeAAJyBAIuCARyAAFYCIASAADmAAP6CAHWAAQsCQaiCAQkCC0WAAQkFC2hBAnSAAOYDKSICgQEuAnhxgACqByEEIAIhAQOCAagFKAIQIgCAAIOBAAoBFIAACgENgAB+gAEQhAAqgADZgQFuBQRJIgEbgAA2gAFJASCAAAmAATgBIYEApwILIIAAVAMYIQmAABaAAAkEDCIAR4AASIAACgEIgAA3hAHGgACxAwgMCoIAKQUUIgEEf4AByAIUaoABU4EAdwMBRQ2AANkOQRBqCyEFA0AgBSEHIAGAAZoDFGohgAIFggAwAg0AgADlARCEABCAADEGDQALIAdBgABbCAAMCQtBfyEGgAAfA79/S4IAJwELgAISgAC1AiEGhAD+CAdFDQBBHyEIgAH+ggDygALEA///B4ACxoABwQEmgQJYBnZnIgBrdoICpQpBAXRrQT5qIQgLhALxAQiFATUBAYEBngIAIYECCoEAB4AAPAEZgAAdAwF2a4AAVwgIQR9HG3QhAoUBSYUBNAQDIARPgACTAQGAALcDAyIEgACGAQCAAH8BAYAARAEDgQI/ggFoAQOAAdOBAtQGHXZBBHFqggDcAkYbgAAdAgMbgABkAQKAAI+AAWSBAO6BADECBXKDAIQBBYACzwEIgQK7gADugALPAgdxgQGuAwMgAIUB4QEhgAEdggHAgAFMiAHCAQKAAb4BIYAAbIEByYMBxAEFgQAJhQFTgAGTAQGDAW8DCyIAggByAQWAATkCIASDA02AAEGBAMsBBYEB5wEIgAA5gAAJhAHngAAKjQHngAKTgAAWgwHnAQWCAeeAAA+EAecBBYIB54ABK4ACeoAA+4MB54IDgIgB54IAEIQB5wEDgwHnAQeHA9gBBYEEgoMDQ4AEpoAAjYECnwNBEE+AAI2CA4uAATKGA4ECBWqBAJOAAFeFA66BA1WAABeGA7sBBYsEQIABX4AEJwEhgAHlgANGgQA6gQNWgAN0gQCZgQNlgAJvgABKAbCCAIgCAkmAAIgBsIAAH4IAgYEALAK8J4AAA4EAG4MAiIEAN4kAjYYEMYUAS4QCSgEvgAQ/BQJ/QfwqgAA7gABTAoQrgAAIgQJoBYgrQn83gABXBoArQoCggIAAAQEEgQAOEfwqIApBDGpBcHFB2KrVqgVzgQB6ApArggEnA0HgKoMACAaAIAsiAWqABaKAAZMBa4AEXIEEmQVNDQhB3IEAZAIiBYAAZgHUggAKAQiABKMFIgkgCE2AAUcFCUlyDQmAAvmAAEUDLQAAgAKQgAJvhQX6hADYgQA5BOQqIQCDAlqBAD+BAY2AADwBCIICagNqSQ2BAtuBAhKCAkMEQQAQBIAFdwJ/RoAB+QMBIQOAAMmCAR0BQYAAk4AD+4AGIYEC/AFrgQVTAWqCAs0DcWohgABAAQOBAKsBA4QAq4EBEYMAq4ADRQNqIgeAAHGAAUoBB4AAqwEEgAAqgABfgAFjBUcNAQwFgQA4gABMgADrgQAWggJCgABTgQCVAUaABP4BAoIDFYEAioABCQVBMGogA4EAuIAB7QMMBAuDAXGBAyADIANrgQCJBwJrcSICEASDAC6ABWWAAJaCACuAAJyAAM0ERw0CC4EBaAHggQCWAkEEgQWsgAWohADpggDygQBoAXKBBSQDTXINgANTgABQgAPoCAZBKGpNDQULgADOgwDRgQDPggGsAdiCAA4BAIECTgLYKoEDSQEAgQGFgwFxAQSHAXGDANOBA2uAANUCIgWAANeCABKDAWuBAMcBtIMCe4EBSoAAewEbgQQtAbSDAr2CAmkDQegqgQYwAQCAAFCCABUFQcQnQX+BAAgCyCeDAnuBAAwB8IMCQIEB4IMGz4MHsIAGUAHUgAMQgQZYAtgngQUngAC7A0EgR4AAeYEDAQQDQShrgAAQAXiAAOkBQYECa4AB3oMDDoQHoIIGzoADdIUDCAQCakEogQNsBMAnQYyBAXuBA+CAAc6AAYEBTYEGZAJLcoMA2gQMQQhxgQAKgAHZAgVqgQAwgABRgATNAiAEggBmgAhRggN0ArAngwOPgQFPgAAtgACJgwBvgAClggBvgABWkABvAQOCARMCDAaDAAeFAT0DIAJLiAE1gwH7AQWCAYACAkCBBpmEAYKBBPeEAXoDAQwCgQWcAi0AgQCtgATgAQuEAa6BCSyDAa4BBIECaYEHPIICjAMiBUmEB1kBCIIGTJQBQAEHkAFAAQeZAUCAAGICBUGAB/iBAEEDakEvgABPgAAoAQSABUyACZQDAUEbggksCUHsKikCADcCEIAACwHkgwALAQiAABSCCVuBAHCNAiCEAgyAACABGIAEr4ICE4AAmIMEv4AABQEEgQmQgADPgQL+AyAERoEG6YMFSQF+gAnDAQSDCC+ABnaEALaCCMEBAIAI8gMCQf+BCkOAAAiECQ+AABWEClCABSqBCd+ACQ0BAoUJDYAAEYIJDYIJgoEBNgELgAbDgADagQkNgABggAZ1AkEMgAWyAQiBBS8BH4IHMwH/hAfdAQKAB92AABmQB92AALGAAMUGNgIcIARCggEPAQCABzkDQdQpgAmaggTrgwg3gAKvgQo1AQOCAIoBqIEJlwEFgwmXggllgQCPAQKACAOAAFWCCAOACGKBCAOCB9aAB6KBAi2BCt2CB3wBAoIDqoAH44EHbIEH04MDDoAH8AIiA4EG5wEFggbngQBXARCBAJqAAe8DGEEIgAcEAgQigAgsAkEMhQoHgAHTgQDwgwCBAQiDAMOACNWAACMBGIABAgEMgAA7hAbsgQLygwRHhAapgAZkAU2ACH6AAmqBB8ixBquAAyEEoCdBMIEAOYEDMIIIwIMHFoIC14ADKIIDa4UCwwFqgAYZhQBCgAmMgAaDggAVgAUFAiAIgAbsA2shB4UE4QIgA4ELboED2YoDzAEHgwUbgQDlhAvYgAHgggfzgwAxhwrrhAifjgAxgQIlgwEGgQFAgAFogQWXBANxQQGAAD+AACSACiABCYEAFoACPYIM14MClIAAEYEIzAECgwwCgwKWgAwGgAA5AXaDDJgBAoEC7IcLg4ECd4EANQMYIQaAAEaABC+BBBqCAEWCAR+BACaBAaWAACaAAB+AABiAC1iACRMBA4IJE4IB+4EJp4AAEIEJE4ALh4IKKoAGiYEJE4IEMIAAMIADV4ELGoEJuYIAMYECLAEFgwkTggqKgACSAQaACaiDAGABHIAA5AECgAW2gQoGggEpgAF+gALYgwGrAwINAYACyIMC3oEA1YUA0oEAOwIgBoAAXYEAMAEGgQAsARCBANeCAAoBFIAC5oIMCoAI5IACl4QAtYEDXoEA2YADOoEAJQEYggEEggw0gQJFgAAZARSGABkEByAJaoALzwEDgAAHgQLtAQSBA32AB02GBCSFBNWAAAoCaiCBBPaAABKDAYwBB5MEIAEHrQQggwMpgQAHhAGxgAQoAQKBAGaEBCgBB4AEKAEHkgQogAFbgALUiAQogA8mgwQogg8dhAQoggS1A3QiBYUEKIAD24MAkoYEKAEHgAQogAUHggQoAQKEDCuCBh6DAfSBDnaCBCgBB4EEKIEMC4EB7YML+4EFfYEEKIMLQIIB/IYEKIAA1gEYgAAHhADkgQDyhQEEgQZ2gwuPgwQqgQIvgQAriAEIAQuADLWCA9qCAgABCIMCQoAAZgEcgADQgADOgAJsgAJCgQ8KgACKgQJCggNdgAbvgQDiAQeEDxmBAa+DAECACgCEAkCACgiEAkCCAAqAAkCEDkoCIAiBAISDAMiCC6mAAIaABomCAMaFDC+BAkCCABkBFIUAGYAAXAMEQQ+DCmMBBIEEqYADi4cLuYMEfYYEIYEMCoQAH4AACoEEb4QAHIEFXQFqggGPgAASgwJegQFxkAJeAQSiAl6BD3aAAByAAAcBDIECzYMAB4cCXoIAZoQCXgEEgAJeAQSVBoaCADwDHCADkQaGgQMaghC1hQJYgAK0hAaAgQelgwBxARiBAJgBBJYGh4MCX4UP74AHo4QGh4IJHYEAJoEF8oECXwEHhw9VgQBeARCDEGiBA9iFAOWBAPOCBvSDBN2CABaDEH+DDaGABBuDBPKCANSBDgGDAl+CBPoBCYMCX4AAPIQCX4AB74ACX4EFZ4AAKI0CXwELgwJfhgJdAwIgCYQCXQEJhgJdggAKiAJdAQmBAIKDEEyPAl2DEHOZAl2BC/uKAl2ACXaNAl2ABQKEAB+AAAqAA5KGAl2AAm6EAl2KEeaBDjqCAYWAAmGGEeQBIIMIT4gR5ogCW4ABO4ICRoMB3IEH6YICW4IB8QEIgQb/ghHXgQ6ZgQBugQiAgQFjAQuADg4DEGokgABKBgveCwEIf4EGz4IA7AJBCIEMd4AJqAFrgwLeAXiBCzQCIQWCE5QCAXGBCa8BQYACXYEGgIEFv4AAIoAAL4MLB4AKo4ISvIME6IAE6oQHeoQG3oAHNIAAPIQJxoMG7wEEgA0ViQcygBMMhAcygQ2YggchigcfiwdFgQ3KhRAwiAcdghAwgwcdAQSAAsoBBIISF4IHHYABhIUQMIIHHYIAEIsSF4AIo4ACZoAJQ4EH9QIDR4AOUIABOIICZ4AQ9oQGf4EBHoMBxIIUbQIAD4QF8YEAmYIFUIAN6Y4HYoICwQEEhwdiAQSWB2KJAsWrB2KBAsWCARyBAsWIB2KCAsWCABmBAsWFA6MBBYQRmoEA7QEBgAHShhW7gwHigglggQHAghTZgAlrggvlhglrgA1IggEXhwENAQODAfACRw2BEXGDEE8BuIMACAEPhAmFgQ/4hAmHggBNhgmHjwBNgQ2YhQFdgQKEgAAjgQw3iwJGghJEgAF7jAl4igJGiwGagAIzghKMgQJXAQWIEoeJAleDAgOREoeAADS0AleAAg2RAkCGAOaDDlmHAjOHB1ODAjOCB1OjAjOABsSjAjOGB1WMAjOHB1WOAjOOALiAABQBCIAPz4UDJYABrYULFIELLIMWt4YHKoAE+oILFIAUhIUEz4AG9I0WtYQGq4AICIUGRYIE1oMGIYACSoEJh4AAZYQHKQEAgAcpgASzgAcpAQGDBymAAsyGCYeCBlyGBymGCYeAEzWAAucBf4sJiYMXSIIJiYMFYoABqIECpIENJYMJIpEJj4ABnoAVnYECD4YNtwEAhgmPgQzagxWKgAG7hgcwgBXRhQcwgQBdgAu9gAfpgQD3AgMihgEGgALVggD8gwEKgAAngADjgRRhAQuAAnWBEF6DBjiEARqCAY2CD/qAEZoBxIICEoAFlIASTQIgAIAPwYATTwSMCwEHgAANgQWagAXHgxBjgRJ3ggXOgAEWggXOghB3gACOhAhIgQAmgRKBhAaPhBC7AQyABm2FD4mAAZGRBcOBD4mGA32AACKBA2yEBgSCADCCB/6BAc+BGJmBA5CCDLABBIADbIEV04QWVgEEghaZiBXzAQeAAWGBBeOAATCCBNKAAUWCBeODABCFAVWLBcOAAIqHBcOCDuKAFD2EA4OBBsaFBcOBABuCBcOEAJmHBcOAAEqEA5CAAJYBHIAAUYYDkAEAhwOQgwlXiwOQhBqPggOQgA8VhgOQgQH1gwOQgAAKgAOQAQOCA5CABeWBA5CCAPoBAoIBWoEDuIMJKIADd4IBIYADuoEB8YEDx4UAGYYFr4QA7pEFtIIFhoYFtIATf4QW1oYPsqkFtIIAH4YFtJAATYEauIQBToERp4ICTYMFtIcCN4QFtIIPj5UCN4sBi4cFtIAGtIYFtIsCSIUFtIECSIgFtIACSIUFtK8CSIIFtI8CMYYA5oMFtIcCJIIFtIgCJIgFtJ0CJIkFtJoCJIIA1pACJIIA/ZACJJEAuIENVYQFtIQBrYUHUIEHaYIFtIAcY4YdrIEVzIEFtIAII4UM3oEK0IAEHoUL2YEM3oMQsoUKfIQQx4MKmIIFtIAErIYFtAEBhhtAAQKDBbSBBSeCBbSCEiGAALkDHCAAgwW0AQOFBbSAEW+GDzuBBkiAFmWGBbKAEAWDAJGEDBCCBq+CBUuABbOAAMGCBbMBA4MFs4ABH4EFs4ICDoEBqIIFswEBgQWzAQOBBbOBAAeABbOAAnqAAJWGBbMBAoMFs4QQu4AClYIBWYQA6oMGl4EGCoYa0IMTZIADXYIM4oQTgIMBDQMLC0mBBxEBkIMGe4EVGwFqgQtiAQKCCzWAAHSCA1CCF4UDIAA/gAUCAXSAHo2HE0UBf4ABTAGQhAqQAwELBoAALQYkAAsEACOAE7MCAQGABtUEQcQAEIAQGYMLyAIEa4EZj4AMOoIADoAGHgMA/AuBGM6CBWuAASMBJIEHjQU2AiAgAIASGQMLCxGAACaBAVEBfoIHxQsQEAkL2QIBA39BeoAHMARAQZQIgQBNATGBAjgBfoEcBYQAVYQEuAEggwJ8gAAKASSEAAgKKEEBQdg3IAIRA4AGVoEAVwF8gQBXgweQgADmAzYCOIUBrwQCQb/+gAAJgABlBCAAECODFg8GQR91IgNzgBlXgQKAgBQFgBYugwLSASiDDnwCdkGCGfoEAUEAToAeWYEfa4ABYIIAPYIAXAM0IAKBAj8BLIkAFIAA54EAB4ABloEAG4AI1YIN8YAAX4ADhgEwgALIgQAWATyDACsBJIAAB4AbNYIOHAFCgRtAAXCCCD8BQoAAqAE3gQ3IAkKBgwAUAcyAAOCAACsCtAqCCr4BcIMA0QFUgwAHAlBBggkNgAEJgxmBAyQRAYQBMQEcgAIsjAFtAXCAAW0BEoIB+oEA5oIXlAgEEA0L/SQBIoQhWQIUJIEBeAEZhgEkgQeMAiIShAFsAwQhE4QbV4ECNwETgARnAwAhE4IAfYEEkAHcgAs6AR+AAKcF9AVqIRWAAAgB2IAAEAEbgAAIAfCAAAgBGoMAvwIhFoEAIIAAEAMRQZyBGBkEIRxBmIIACAQdQZQrgAH4AiEegQM2A0AhCoEABwE8gQr5AUGAGDIIAkkhIEF9IQ2AAA4GBkchISATgQIYgQMvAxchEIEY+JEiCpIAAoEJjpEiNoEQgoAiGoABdxdrDhMEBQYHCAkDAgwNARkAGw8iIhQhIoIEfwVMIQYMGYYACoAW0IAACgFsgR5MgQAIASKAC9YDKAJggh8wAwxJG4AAIQQGCyAggR/agABWgAZSBA4hDQyAAZGBBMYCDQ+ADxICCHKAFeABCIEEAIIXjQMKQQKCBrQDRQ0OgRqIAWuBH5KAARADIAp0gBR4gRSggBrSgAAtAwkhCoMgzoERfoACUAMIQcGAAF6AAtKGAMuAABgBdoIWRwZrDgMAAQKABOgBHoENdIIfmAUIA0BBkIAKBoAP7QGQghokARGBICIFdGpBCDuAAjSAAAuAIFiBAF+AACcCgAKAH0YBBIAAB4MAJ4AFCYAAJwEJgQAngAALgArZhAAnApgCggBOAZiEACeDAE4BB40AToAANAGgigBJggBwhwBJgSB3gAIIA0GgK4EEewKgPIMACQMgFEGAETYBDIAFgwERgAA/gAAXgAARBwxqIBUQJBqCAFMBIIkAUgEFjABSAZyAAE4BPIECqgEcgwBKgBCZAQyAIJYDEUEgigBJgAJ2A0EBOoAEcASgKyEdgQFXAR2AA1GAA3gBiYADeAHQgAOEAViAABOAAEKAA2sCQceCBDwCQQGAAqMBIYAKNAQKQQNrgAKngRXuAiEHgQAdgQg2gSB6gAERgQHsBB8LQcSBAZuDC9ECwguBGTQB0YEAEYIcR4AASoERF4gAQ4UAPQIMGoEAGYAX/gEFgAYIAQqAGJaAAByBGa0CQR+CE66CB+mAAh+AAXaBAh8BBYQCH4MBboMS1AMFDAKABWeAAVKBAhsBBoAAVAEKggCRAR2ABZOBCHID//8DgB6CgAAJgCT3AhB2ggsuAkHdgxKfgQChggqqgAJmBBoLQcKCAEABAoEACIMSVoAE/gFEgABagAi2gABUgQOMgAQWgQBbgACzAwJBw4IAJoIC4gNEIgOCCDmCFNiAG+ACAyCBE7EBEIEACoECiYAAKoQDEYAAOQESgBWIAwMQJYMjmQFEgAWJgABkgAAtBBJqIRKBADYCayGBADuAANaBGlCAAA4CBAyBEzCEBckCDBeACNOCAz0CDUuADFmNAR2FAzyEAR2AA3QBaoMDP4IBHoEBnoMAhoEAUoABEAEfgAEXA0GBAoAaKQFkggAQAgV2gAATgAA7AzYCaIIAEAUKdkEPcYAcVQEigAkgAWCAAE4BDoMBvQEOggG9AkEegiHeAkGhigFKgAChgAAMAcWDAjoCACGABCOBBZgBbIADE4ADqgMGIAyBCpsBE4AACQcGQRNNGyEJgADLAwYgCYIN1oAAE4EhHoAALYAC44AADAV0LwGwDoIC6gEAgQLqAQOABGABAIEHZJgESQEKowRJgANhgBrygwBpgAAMhgBpgADbAgdxgQBsiwKnAQSAAMaFAquDAEEBFoMGi4AAB4AGmYEdgYEDNYAADoAGmYADcAUTIBogG4EDbAIiDoIBIQG/ghdnhgEhARaBASEBxoQCYYIBHYABKAEOgQ6AggJKA2QiD4EABwRoaiEMgADcAQuABVqAATKAHaMEKAJYdIACwQEhghVUA1AhIoABAQEJgACbgAOXggEFASKAAzwCGHGACdIHaiIjLQABIoADBoAfOIEK4YEWDoABFYABAYkDPwEJgQEVAQmFAz+AANeAAZ8GIy8BAiIIhRV/gAj3hgEmgAAMgAEfggTEgSPbgQEcAiAGgwEcAQuBFlABf4UGaIACegQQaw4CgAWHgSOUgAl6gg/AhgCMgBAwoQCMigBlAwUgC4IJsgJBh4sDswEJgAGTAQOAAvmAJpuBBmeAAgaBADOAJYmBAJiAJE2ADqCBJp2BALsDIBFqgAAeAi8Bgg7AgBYzjQCXARuoAJeEAhuAAJqACyyDAiCAAjaAAFSCDFiACnOMAFwBGqkAXAEHiABcAQeDAFwD/wBxgCc/gCeGgQIiAwQgDIAAKQILaoACFJYBEYAD3YEFPoIGKoMBuAEEgQG4gQHPgAJigwMhhALIgAWjAWyAF7mEADiCABQELwH0BIMBbwKUCooCtwEVgQK3gABxhQLrhAMAgQasAiAPjALyAaOLAvKCADuABEMBXIME8wFwgAM+gQaZggLuggChgQLwgABDAR+IAEMB8Y0AQ4QGcYYGloADNIQFkYAACwENgwBkAciFBZGBA1cC0DeJAzeCA1UBUIADyosDNwEMgAFugATjgQM3AQuLAzeBJuahAbgBC4ADNQIhD4AC+oAAQIAp14ELUwX/AXFBDoEARwMGIQyAAJ0BBoECGgMMIA+BAGYCIRiAAJUBBoABwoIAlYIBqQIgGIAAhAELgCgPAXaCAIcBD4EAhwEMgBjPgQHkgACIgAR8pwMzgQdCggOYgABGAQCAAe4BD4IAnYEB6wEPgQZlgAVkAiAMgAXeAtA3gAAvAQyDAmwBDIEALwELgQC0gA/SgQP5AkHNgwFzARGBGscBIIEmEYUGfYAACYAknQLQN4MAGwLAAIEAHAMAQdWBB+mHAaqAABwDAkHJhQdAgBnNAXGBBj4BTIUCZoIP0oAGoYoBhoAAvIQA7oAIUqIA7oICSYAAxwEGgwDOhAdLgAfiAiAGgQFagA5dAQyBAPGLBK2FAumAKDABEIMKHwEQgQDthAcUARKBB5qBAEeACR2GAkwCIBCBAI8DECASgQCCAhIMgh3lggebAQqBHJiAAdABCoIHWoAFz4QARoYAIoIAGIAHCIQAGIITBYUAGIIAEgEOlABMgAE8hAA0AQ2AAk6AAAeBC3cCQdCDAI+GCSGDCTIBCoQrvwJEIYIik5IAUIAAyYQAUIAA+AMCQcqFAZuAASEC1DeAK6mBAEABXIMCj4EACwFUkgMkAQuDAySCAp2HAySAB2miAa6CAoeBBmKBApcCIg+DKhiCAcGCB5SAAGIBC4gDHQEPgwMdAQ+GAx0BD4YDHYIDpIgDHaUCL4sDHYUCO4ACGoEDtYAEHIIDxYAAiAEhgAzCgQMlAQqFAyWJAj8BD4YC8wHxigLzhgJYgCsQAwJBy4UBYAEPhgL7ggVpAUiHAwKIAV8DIAYEgybGhQMBgRnrtQMBAUiJAwGBAHKSAv+BAKUBzIQFKYYDB4AAEYQCJQEGgAfOggBNgArEAhcggA8fAQmAAe2CGy4BCYEcvIAAGgEwgCS5gQAIAsw3gxCpAfyLBikBB4QAQQE0gCrEAQOBANaAAAyAEJEBKIAQM4MARAFrggcrggAWgAAiAWuBBtyBE1qBC0WBFIcDBkkbgQAgARKBCvyCLo2AABeBHYmBAZiHC1cBCYILNgMJIQOAAT4DEiAFgAEtgQO3gwOngQblgQf7gQFKAiIDgRJgARCAAHmAA8aBAE2AAWKFA92BFP6SAzOAAcSEAQ6BDLSFABuJA9mAA0aEACKACFKIB0GIBA6BABaEDIqBEZ4BEIMS4QEShiIFgRQ2gAblgRF9gAFBgQlygApJATyHD58BLIABXQQQIBdGgAhVgAP9gCmBgRG8gBgSgSYJgAARgCsIhBCHgBVdATiDBbyCGDeAEh6BFXACKHSBGhKAEj+BEiaAAG8COCCBFbGCHLUDLCIFggAugRGXATCCMO+CADCBKiICLAuDAfWAALuBA6QBBIEBXANrIAWADK6CIFMBNIMemQEsgBHXgwRwgAANgAHoAWqBDNSAACeBAd+AASWBASkGSSIJGyIEgAA4AQmBAGqBAeyBDPeAKH0DBGsggQAXghaAjABPggANATSAIhiACoWAARyDAKsCCUeAGWmAACmAAniAAJYBCYEdWIENZ4EpH4ASW4IRpAIIIIIRpAEEgABcgAAWgRrdAReDES2AEuSCLQUBFIAAF4EVt4ABVgEgggA6gBKxghF2gAPSgRpygABDBBtqQYCAEdyDERiCEMIBRoEAE4ASrYIUOIEOEoEwBYEIfoAAGYABKQcgDUF7IA0bginVAQ2AAJMBF4AAHwENgACZAROAAAiAAagERhshGYMokQHSgwiwAnwhgBFJARSDIBcGGQuUCQEMgBQrhhKngAEhgAjQgAAHgBMngAM0gANCAQ6CB40BEIIatwMCQUCAAY6HJ++CC3OAM+kBAoEz6YEozoEz6IAEwAEOgSBggCGaAQSABWSABh4BDYEFcoEUpYAASgELgADJgSBEAQuADc8CIA2BC+IBCYAEEwQNIAtrgy1rgAmIAU2BLUWCF5sDCSANgAx/gQjUgwArgQAngAGUARCBAEEBCYAAFQEPgBFgAnJBgSOIgAT9gAjNgCFFgCFNggAPAwwgDIYho4AEeQMIEAOBI4GDGTmCDf2DGS4DDWoigABVgABykwBQAQiDAHOEJoqBKSaFK36BAzKBAFKDIP+CAFKDGTOAAFIFCCALSQ2BKDyAAAmBAD2CBmeSAGABDYYm5YACU4EAOYIm5wEIgSUzhCssgyLSgQA5AiAIhQA7ggAsAgcggBa3hzCagRAagAeogBnCAQ2EIgmCJYOBBtWBAYiAMqwBcYABNYEigoEAooALkoEBRIAABwFrgASngAAiAwwhCoINNYMYJIAAEQEIgABhAQqMGcCBIqmGKOyAAB+BBEOABdaEI/+AADUBGIEUFYAAEwEMgRDchQBFigAmgAAfgAAYAxQiB4AWoQEMghnEgAAPARCBM4gBAYAAEIEZxAENgAVJAQ2ABLMDByIKgRnEgAEiggAwgANvgSLMgAAQAQqCADGBBU6AA56EAYaAERaBBkWCGaOAAFEBHIEA8IAYPYIZo4EBnIABZ4EZo4AAjIAAR4sZowEIiBmjAwwgEIQZowEQgQAsghmjggAKgBmjAQqCGaMBCoEFQAEYhAC1gAAoggDZARCDAQ2AEM2DANyBBo+CABkBFIYAGQESgw7OhAHKARGHAgUBEYsByoMB75ICigEShALajgA0gAIQAhIQggX/gAf5AgcLggCYgCi2gQbegQRJgBgtgSVlAxpBfIArbgEOhCPzgBBTAnEbgilIgQBMgRD2AwdLG4IAOgYJIA4gB/yAOmaAA8cBEIADFwILIoEEAocX2wE8gAAHAQ6ABceABA6AAC6ADPwCIAKDAC6CBk2BBluDF6qBACyBBluBBFODGbKACAYBEYEk9YEAHIIFKIAHO4EF24EFI4AMrYAaOYEf2gUYdHILCIEE6gUFEBALS4AZSIEXDgQEf0F+gh43gCExgQZmgQB7jRd4gAAdgDOcgwAXggZyiBePgRj8AR2JF48DIAERgAengQCcgADkBQAQAgsQhAAehBfSAUCMF74FDxATC9KBGSuHJUObGRiBCQyhGRgBtIcZGAEmgQ5DgC0QgAEFgApqgAYFA0giBIATuANBD0uCGwwDQYH+gAVDAXKIGSaCGR6CGSgBIIEAKYMZIYAARo4ZIYYAFI4ZIYAZXZ0ZJIEbaYsZJIAAtIoZJAHEtBkkAkF+jAFmAXGAAWaLABIBH4AAEowZNgEGgBk2BIBEASOEGTYBEIIZNgEXhQFCgxk2AQyEAYqEGS+BAm2GCKeCB1oBA4IHWoIOVAHAgwcYgAAHgRybgRj2AiEdgAAXgRlTgBkTghlTgAe0khlTgRlrghlTgxk7gBAWgxk7gggFARyFGSsDDiESiRjzgRSCgBlTgiGmpRknwwACgAHmgAG7A2sOH4IZZxszNDU2CgsMDQ4PEBEDAhQVASQAJhcYBD4/QEGEGWoDCwwkhgAKgSRZgBlsgw5aghl2ghopgxl2AQqBB/aBDkmAABIBDIAMGQEygwAKghZ0hgFiAgwzgRBnAQaDBQmACgQBN4oWMgEGixYyAQaBDGKBELGBEP+AIPWABKsEn5YCR4E45oEAWwEogwBZgBBNASiBBf2ABMKAHPyAAAICECeBAwcBHIAPLoAALgI7AYEpLwEQgABKBEECECeCIJ8BtYgXUIAEFYAAYgEzggCrASSBNr6AAlyAEFeAAwSABT0DdEGAgANugi39BWpBH3BFggMhggjBAwBBuYsMaIAAQgEHgRafAQiDF9EBh4AO0I0AHgIEdoEDxwNxIgmCDTiADUYCB02CAMYCIgqABwcBCoAMXYEpvgIoIIAhFgQFT3ENgBaXgAWmgjq4Aa6LDeEBA4AUYwEyiwFGATakAUaCC9aABpCCEhWTAKuAAbYEB0GAwIE9nYAAHQHYixL5gwHTASSEGF+BARiCBDKBNo+BADaAOBGBBGSBNOyDAAuAAXcDOgAIgAc+gQArAjoAhDv/gQGagwGPgh0kAwJBtoUTRYEIwAEGgwDbgxlvA0UNNaUA24gAmIEOToEMtwMtABWCJPSLAJSCCIaKAIoBBIYAigG3kACKhQFlgAwMrgCKgAD3gyK8ggFzgSAWmQCYgQKskwEiAbiLAJiBACSAPBsDQYAIgQGnAQeCERmFAKmBAASLAKiABLyAL4CKAKiDGqKCFq4BNoIamIICfYATlIEAvIENJYAP34EI8YIDV4AAaIEAo4AFvIUArgEogACugBvykQCuAgwohQECgQAngg2oARCAABSKAdQBMqcCr4AICoECWoADh4ADj4A8y4ECc4QDlQQYdnJygwPpgghuATCAAScBvo8BJ4EQVYMIrYEIloAC7I8O8YARF4UO8QRBAiEXgAEShgRKASiMAGGDFHsDCyAdgB8UAg0vhB5PgRohjBoGgBhuhBoGAQ+KGgaFAOyGGgaHAOmkHk+BHkeABjsCpDyAAE+BDG+BHWWCD+7/HlyXHlwFqDxBsDyCJqEBzYAABIEACoACM4keXYAAGIAAEoAeFQMUECmgHl4BrIAAUAHNggfagikfARCJHl+KAEuAASiCHmCBAdIBqIEBK48eX4AAQoceX4MXxYE7jIAR8AEGjR4bATKfHlSTADkBKoEAGYQeVIAZlrceVIAATgMGDDCpHkoBBoEAfZMeRAEGhBizAgwtnh5AAQ6AAAoBDoIeQAINLIANIZIeMwEMgA+mgQApAWuAEDyLHjOBBBOFHjMBJ4MEC4IPyoAECwErqAQLkh4hgTmHjx4jgAGbAWCAAD+AHiOBAYyCHiMEBUEeSYEl+wFNhQfBix4qASeKHiqACNeIHiqAFZqDHiqAGWGCHiqDGCcBC4MeKoIcm4QeKoEa440eKoBFTIEeKpgEJIAbR6EEJAEKgQBpgAS0gQBpgAAMjx4qiwJ9AQiAAMaLHioBFYMLkYAAB4geKoAADoALnwIhDYgeLoADOgIiFoIBJYweLgEmkR4ugR5DiR4qgQHhgBGrgT0piBrzARODGvMBGIYWcAEGggEFgRdSARODF88BGYEXT4AdNIQXz4AAvaQeKgEZgR4qhjOpAQ2IASaAAAyFHHIDBSAKggEcAiAKgwEcAQ2LHiqAPQqFHiqAHbyAAn2CAeIBCIQXCIEUcaMX2ocAZQMFIA2eHiqAFOGAAgaBADOMHioBBIIAu4oeKoAgB40AlwEkqACXhAIbgACagBEXgwIghx4qgBnHjQBcASOpAFyAHiqGAFyCHiqAEkSEHiqAA04BC4AA8oEVnwENmx4qggglgQUNhQG4ggZKgQHPgBHwgwQmhALIgBLdph4qASWIHiqBAuuEAwCIHiqHAu6MHiqCADugHioBHogAQ4weKoIAQ4YeJAEWhx4kAwUMK4keJAQEQQZJgBGXA4ICSYIM3aYIsIAFjAIOaoAFFAFrgBo3gQV9AhJrgSgDgRaRgQ7CghaJAxwiDYEXF4ADkoEWwQQgaiEhgAOXgAAMgxtmASKDAA2DA6QBI4EACwFUgAOkgAAHA1AhGYEABwFAgQLIgQ7QAQOBAAeBFheAAAcDMCEkgga/AQ6BA3KFBrSAMJuAAAuBPrgCCGqAGKGCRckBcoIKeYEDTwILIIAroQIgI4ID6oE9DIRBLwEGgQP0gAzngRl0AgR2gQQWgRuUggHKgBtZAy0AAoEZSIEjIoAcU4ADBIADpoEK8QEGgRshAQmAEhWCHdGCAC6CBO2CA9OBEB+CAJiBIYCBAt2CBk0BCogAqIIAnAIIaoAAT4IAeYABAgEEghqmgTyKgBoEgACJgTF+hADfAQqGAv+BAAuGAN+BHPOAANiBIeOBAOYBC4IEyQEihADfhwDbAQiDG+kBCIEDFIIA24AWuIFK9wF/gACWgQC7hEUegRt/ggOIiQNsgQXvghDsgD8SAQOAGuYBGoMAgQEDhAAfgS7tgQA4gACHgQNhgAC3gwBsgwFHgAEighuAgwDaAWqABVgDDCAfgBjwgxs/gBo+gRkcASSBGzyAAdABxIEbPIAbOoAGaoEdGYEXa4EBVAMOICCAACiDB4KAAIkBC4EFmQMOICGDABSBABGAAESBIhaBGQiBLWeCAbKCGvqDAbKCJUSCBpCBQrGBFawBDoEaioEAfIAUzgIiB4AXcaIANoAWOoEEYIAANANrIQmBFnYBDoEET4EAhYAAB4AUuYEZh6sASYABKwEJgQRuAwlBA4EXlogAOoIBtwE6gAFnhQJ/gBT9gQU7AQmAAFWAAjqBAFWAAAeDB5KAFVGAIMKGADwCCUGAQciAFsuDAq6AAJyCAG+BI4ABDIAcS4AAqYQAKIAADIQAZIIACoIAZIIAVoAuT4MF/IEAcoAQJwECgEqvggBmgAJNgQAqgAA+gAWPAUGCC26AEB2EAGaAAOEFLQAEOgCAOqGAFASAABSAAo0BCIMeHYAeG4EBAIId3QMIDB+BHsCBAhmBAqWCAh2AEOGAAh2DArSAANKCCKeCIUuBAf4BGYcALIcDI4YALAELgQnQgiGTAw0cGoAhdoAAFQEbgQDyhgE/gQMegCAsgBsOAU+AJNKAInGBRAiDKKqABPMByJEjD4ADpIoIHIEeLIQjDwENgQNNgAZtqwgcAiANhSMPgABAAgAigAZLiCMPAQuCHV+BJjGAAGmDIw8BE4AAlYAANYMf8oEYgwEFgBvMgBqYA3EgC4gjD4AKDoUf8qUAiIAKLIMDnQELhiMPAQ2PIw+BAFmBARuMCKwBDYIjD4IUw4YjD4Ao2AEIkSMPAsg3gwAblCMPgikPhiMPggSDgAAhiCMPgE4JgQqjiQGGgAC8hADuggqTpSAOgADHhADOiCMPAQuFBI6DIw+AARWBAOaCARWFB86AAjQBDoEPNoItz4si/oAK7YEMXIQDYYABqoIUX4EePoIHUQEKixBlASSkDFqAHwYCIA6CPQmMHZuBRLMBIIJFh4AZO4EHXAFGggecgBHOgSDHgRD4giJGgRGLgQJPgAG/AQODFGGCAJaAADeABK2AAl2DABkBKIEWV4MUcoQQToID2oARQoERQIAZyZwQ6YIAZwIbRoAAMQMAQeeKCOKABVUBEoEs7oMmkIAAEoEWqAGAgAS3AXSDACaTEMkCvf6CHleCE+wCAHGBR/+BDhUCDB6GIISABHKCIGkBBoEBaYMAFIAAZo8AHpEAMoAtyo4AFIISxwHOhSQ4hA8Fgw8WAQaCLAKBJDgBCoM3joMOnYAA2IEANAHPgwK7gRZ7hyQvgAECAcyLJC+CAZIBVIADV4sCvoAcOgIgCogkL4cERKQqioMDp4EdGIwkLwLIN4MHGYAcjIgEPYokL4EEPYAZxYQEPYEHvoEeaIUEPaUAgYsEPYUDW4ABIYEILoAFPAEKggChgB0vggN7gSfPhARFiQNfniQvggFgiyQvggQbgQ53gRBpkiQ0gAFkAiALhCQ0hQQmqic1jAQmgyQ0hAQmgyQ0iQDFgQ03gACEiSQ0AQ6BNTWAKX6AAMCHJCqCA9GBAeiCJCoBBYwkKoII7o8kKgEShiQqgAoUjSQqgQBEiCQqgAAiiiQqgSIugCD1gyY+hyQqAQuDJCqBAB6FEUGJJCqAD/eLCLGOJCoBDoEkKgEOggBNgAUThiQqhie/iANggSkGjQAUhyghhwAUgAA8hQHzggT9gThtgQEDgSvPgA1nggFVhgx4gRJ+AgN2gCFugx28gAWWAWuBEYEBIoQMngETgCNogAh0gROFgQA9AQWBTJyAE4qBA3aBCDMBBYIByIEMposbGYAABwEEgQR9AUeBBP+EBraAQr+BEt+DJKcBBoFUmoMVwQJBuYcSlwEUgAkUgxbyggFegUXxgSzagBKWggHqghZ2gB+hgB93gRtxAQ2EAAoBGIABnoAABwEUgQHEAQWBAgOADNGADKuAAZaAJEyBGriAHTkDC0sbgRLQgAAmgAoYgUSQkBjMhBbrgRL7hBeWhRL/gQD0AUSEEuyEEvqAAF2AUSqAAL8BuogRLQFEhhf9gQDFgQa0gQaohA93AWqBA80BA4UAx4EfrIFE1gEcgVWbggK2AUSACHiAABEBIIEkc4MSC4EAdYEIMwIgA4IU4YFRyoECQYEBGAJJG4ACPpYYaoYAygEFhADKgQB/ghOugA40gADCgCDkgimehBfGgR4Ygh2qgADGAbuSAM+BDNOFAM+CFNmVAM8BJI0AzwEo5ADPgzYliQDPgRzVAkG8iQJdAQWBAfWCBM2HGfSBLvSgCEWDAJyFAJGAAuIDLwEcgU7wAwBBmosJgYIXwIcYnYQaKAFBgDowgCb7gADwAQmDG1GAEhiMHMyMGIKBBGqAFDmCBGgBFIAACIoI+oJGeqAI+oEIpIEjc4IDkgEggVLLAwBB0IoFFYIApYAF6YQXyYIAuYMHo4AAGwEWgRaWgQCpgywOgSwfgUAJpRC7hBN5gQVhgTTHgAlfgVNMgySngShjhyhiAQiBCvaAABCJKGKCCw+WKGKAAG4BOIFKtIUoYoMokI0oYoAAmwEsgQG7ggYvgAbRgQfZAQiABZaFKBWQKGSCKAcENCIGaoAAJwEJgAAngU8ugCWJgSWNAUmBIagBCIAAOIESw4IoZIAAI4AFIYAQBIAmeYEoZIAAlpMoZIFO84AC74IowYsoZIIPXIsoZIAE3IMnnQEEgQGFhChzgEyChShuggDOlShphQKmhwrPgSEqgACmgwq4ARyBWaKDBweBCtSBEQ0DCBAngySPgQALAigLgQFbgQKOgAAHgijxgQXauSi4AQWAKLgBBYMouAEFggCVARuCS8kBHIYouAEXgwJkgyi4AQuAKLmADMQBEIMouQEXgyQjAQeHJCMBJsEkIwEKg0DqAw8QP4UACwFxhwALAR+AAAuMIosBCIAiiwLXJIApQoEhuoFPOAIQNIEiQYArJAIAGoIC44EBY4QiiwEcg03ZgFWegwCZg0qfgQDqgwE0BQRBmgVHgCtdgRpgAYeBA4uFKZGAJteCAx6ADEiAAHmABDCAAXiHA0KBAa0DABA2ggApgwcfgAIdgwE5gAdfASiFRpUBBIBWdYFFNgJBd4MkNQJLG4EP3IQAEAcDQQRKG2pKgAC2gBBCmCI/AwRBKoEQgYIAqoNEToAEcwELgTCxgAB3ARiDDqYB8YIEpIMwDgMwQQyAIUgB8IEY4IEEOIMAsQGIgACHAUqDBgoChAGAGdYCAkiAEoEBwIEIAgEDgBUKgAAMgAJHAcCBUPkBBoACA4MbX4BPNoAAKQIgcoMJdAFsgSUUAh9wgEChBEEfcxCCCGIBbIIX/wQALwEygQAQgQAJAzAQPIEBSYQNAoMFQIIAm4IBLYEBOIQEc4EAYwMEQTmDUfqEBXiCAC+DBhqBGYqBA0uCAHqAFVsBH4IOl5MAHAGLgRxvlQAdgCEOhkzogyMXkwAoggoV7AAcgB77gkjPggGQAQmAAeMBQYBGy4MDzIIBroE2lwICSIQBjpEARgEggBKFlgBigQfVjgF+ggLUgwKigALmgATxASSBCv6BAyaADEWBHtiAC/OABRKBCq+BBPaBAvqECgeCAF2CALKABLGCAH2ABpwCR0GBBGYDCBtyggC4AQOAAAiCXdOAAAgBEIEITQIbcoIAhIAAX4IG1IUATYMcQIAKH4QASYMAqp4AJoIi0YMAKQMvAQagAE8CLQCBE4mcACa9AX2CALeCRYWcAI6CVlmBTU6BCvShAQyZACaIAQyAAcABC4ABs4IYxIAEG4ADQ4EGn4EAN4IDUoIdZYcKQwEgglsygwOBggRbAcWAJpkGBQIJCQkDghSLAduAMFmBUaUB54EMLIJaAoICLoIoTocAxoAHbwIvAYAG6YAG54EOLYEAbYEEaIFD+YImgIJPvAFPgwPrgAoXghm4gADSgjGCASCAAL+BFpGGHtCAEbuCBzaCACMCLEWBBHgBT4QZlIcA0IAARIAGpgFrhQDTggBJhBIwhgLcgRWlgQwTAQaBBPaDDvKDAuuDQLmQAIkBBoUAhAEUglKdigCHgAClAU2RAIeBAL2GAVqBAVKCE+KGCbyAAD0BHIMGEQEUgiBzgQAThAEjgU1PgADvgkaLhADqAQePAGOAGPeAABiFAGOGBTeCAfuAAEqEChWBIPmBC4SDAQqEAiGAEzyDDAaBBb6EAjOGALeBAjCBDuOEBQ6BAIGDBg+BYPKAGBqBB2OKAIaAABaPAOkB24IA6YYARIIre+MA7IArFq4A7LEA6gHniQHLgQNXgQDIhADUgBdjgh1RhQCpgRPDg0tnATCXAImGAB6aA8uJBwaBAIeNBbiBKUeCAs2CNmaCAAqCD66CAAqADAaEAAqDAI6CK3aAADgBdIFF84FJqIED8oAIP4E0NYQIV4IKc4EE/YMHFQMBEDWCMCeFCOCABQQBAoUfnwMCQZSBESaDRHaFAFcDAhA5iABihBUJArQtgwxCgQmrgAAdAVyBYO0BToFkWYELnQIDaoE8xIEADAFsgAOmBEEBEC6DACYBbIId8IAGfQMQNkGABXSCAAuAA6MBG4MA1oAAVgFggwBAgQArhgHzgAANAqAtgUiugAFNAqAtgUhTBCgCmC2JB3SwAB+DAbCBEg+BFD6ADCuAIAmAACSBHxWCADSADPGAEk0BdIQAt4EPK4I/IIIAToEABgKkLZsA+4EQsYAB448A+IUA9IJhNYIBIwKgLYIObJ4BRpkAToACNYMBRIEBv4IjWIMhfYIAy4BF/QKDAoIVWYYBYwFsgyVogQHaAgFFhwAlAklxgA+VgDioiwAqgSFHgQ4ygQCVgBbHggInhgICgi3iwAICgQLsgwEMhCrJuAEMAQeEEWKAAK6AD7OCET+CAO+BWueAMvQBAYFJ0oANxoEV44IPA4Id/IYACoBi0YEzCgGCgRtkgAkGgBFoiQACgAT8gBvygBE6gR4vAQiDWXWAAAyAADWAGfSBAAqBTyuDAAqAAx6BMjqAAAqAC82BY6WAAAqAIKKAXYaBAAoCB0eBPR2BGMCBHoSAE+mBFdOBE7YFA0H6AUmBHreCEVuCP8iAFd6BBAOAIsiBAAqBLMWBHMwBCYJN1IEcrAEJgk26gRyigh3DgC/CgQAKgRDHgSJ8gQENgAnLgBRfgADUgl4Hgjl7gQcFggHjgAMggQMJAQOANLCAL3eCAHCCAyyCAyqBZB2HC3aBACuFAB+CBNeOA2qOAB+BAFqACAOCBaiBG20ELQCQIYADdYASjQJBhIEffYoDe4Au74IuRoMCfoER6wKIE4IAHAGIgCTjggKogicSgQOYgwyqgwOYggKUgQB/gRYUgQHmgQQ8gQNUgwnJhgDMAQOMAK2GAB+CAE2OAMyOAB8CIAWBAB+CAYmoBDaEAJyFBDeEACy0BDeAHeiBAO2BTj8GQQxsQZgggGi3AQCAM/UBC4AATwF+gBmMgzFyAZqACWiBV9gCQX2ANpSBNKSCADwBBoExVoYJ5IAA3oAExIUGCYALCYAKHgUAAQEBAoJU3IABewK4LYMDoQG8gAEKBXRyIgY7gAASghDCAwNBDoEy1JQLLQEGlwyqgREjArktgwyugFXkhQBdAmt2hABdBANBDWuCEbuAAt+AANEBNoAAHoQAcQEKvwBxgCgygQDAgQBzAkEJhABnAgdqgBRDgQBlAhAtggUQhAeaASuBT62CAaqAMZuBD8SCZkSAAA2AFxmFKHuBIluBDQqCTg6BAfyFNAKABRiCAAiAAbuDKOeGED6CACKCB7yDEJiBJK6CBVcBGIECDARMDQMagwhCgQHcgWdXlQDVggOQhAAqlQAjhQhsgA+ymAAmggAjAy0AM50AI4AAC7sAI4cAjwEKnwCPg1EKlgAjghUlgh/cgGp4AXaLEJCDAyoBGIFniAFKgwbIgGaVhlyIAkULgjTzAfqBJyQEQXsLHIBP7og1CwEQgAxhhzavArsBgDaMgRJwixL3gQ63glZcmBL+gAAgAUScACABQJwAILATXgF9ghJoAfGAE/0BC4FQ1AEBgADEAQmCE0sCbBCBcHOAACcBbYET6gcQQAu6CQEVgTXcAUCAJWSCBtICBkGBOZODDdYCIAeBEoICCkGADTSCZvYCdGqCBOWABPCAScuHBPCAABqAFvmCDXuCV76AF9cCIQmAbgwBDoEj+oFA3YIAQoAQTYIAQIEKeoAADIEkY4EAMoEkJ4AABIFOSoAW2YEZpYAlu4EsBgEQgB8JgiomgAA8gi8UgAA8gjtVgi8UgSNEgCG/gQAdgUo2hAOKgySKhABYgRuOBAhLGyGAOd6ADFEBAYImL4A8H4EA04EAzIE67YIAuYIAQYIeXwIgaoEAZQFrgAkAAgBOhGhRgAALgAIXgQCxAkdygBkegjGogCLQATuAI7KDAFKAAO2AAK6HAS6HASkBIoEJPgEKgwCfhAExgABagwEzgWEhgixSgAANgS5jhQFBAkETgUDJgE+KARWEBYwDAA4CgAuPgT3IDCESQe4IIRVBrgghFIE6bQF/gAARAvANgAARA7ANIYAyQQEBgBatBA9BCUuBaXuAZVyBYOABAoAU7QFxgGnDgARZAw90IoAHPQNrIReDEfCAKZOCDWSABIOBCiOBY84DdCEYgAosAX+BEcECIBaFAMKARQOAFDEBGoAyhgISTIRCNAHggjznARSBRSOACimBACaAQWMDBiAVgQdoAwshGoEk7oAIXwIiDoEBYIApw4BGaoMkzAIgGIIOLYEeZIA9EwEHgyyKAiAQgAFJgCUCAQ6BJMsDGSAagQP1gSZCgl+oAwFrdIMBYoE+EgF2glxhAQeAWWCJAhOGAoiAAbSEAoqAbMWAIcyBUswBB4FxF4AAy4FRjQEGgh9cgijBgEx5gwGwghzNAQyDChSCRUkDAiAXgCBFgRpQgwElgQAYBSAPIgkhgDdshwDLgQRQgQC2gBlMgQC2gRVPgRPWgD8kiACygWIHglmngD4JgmzwgwCYAQCCbV6AAJiCAqODX+8CIBOBAFaDWyCAJKGBAmMBDoEJ4oApA4YBiYQAB4Ifk4AApYEg3gFGgADKAQ+AbNeBPZqDGRkBS4Il/wQgDBsigEflAQeAALIBGIIBegERgQFNgQGTBAZ0IRCCL2eBA3EBDIAvvIEhoYA9cYEBToJKM4IC/IAFUAFKgW2bgDzfggJUgQJNggIgAyATaoACRAPTBkuEAlsFE0HRBEuAAl+CFEqAAtqAJUCCRa0CIA+BAReAAtWDCSCAM7WAUtkBdoEBMoAhOoED0oEAbIECNIMDrIEDyQEAgwMPgT5vg04QgwMdhwOTgAAYAQ2BAAiBAzyFJ0EDDgsrgAFfggHLgATbhB/hgQSTgVzwgQAHgmW8gGr4gW8AgwT1A2BB1IIE9QLEA4JxZYQ8goFV5QHVgRgkgRcbAdWABnSCAAeDUS8BAYEdcoMAHoMlpYAQVIEmy4ADNIEOkoFRBYAcz4EoKoEMDYM364AOYYAIxQdBoIbi7X5zgiASAgFxgXHngzBohBwSgAoagAoQAcCAb+6BABaCIaqBAGiBHKKDbyABc4Agu4FrpIAuKAF/gwKuggDlAyADc4InW4FyYYAAPoEQSIAAKokA8YUCXYAAQ4AYjJQAM4ACoQIIdoEAHoACwYkAHocAGYAC4ZMAGYAcDZMAGYAQuJMAGYAHMpMAGYADIZMAGYA71YoAGYIA4oAdUIEA4oAbRIIA4gMLvQWCB5aCA9qAACGAPKCEXiGBCviAADGAAPuBA60E8f8Da4ER+wRB8P8DgCDEgWqOgXKlgXaGA4CAPIAKF4AAW4IAGwMgAHKBWbqCdRKBHpiEAXaDAVSGAFGBZsKBdD2CAXGDBvSBAGMBcIAAUoEHc4EAbYFjLIIAUoAAUIACKQLbAoEMgANBsCuBD3iAbEmCDjeBAmeDAE2DAA2BMtuEAAuBDZmEAAuAb0qFAAuAALaFAAuADiGFAAuBFMCEAAuADtCFAAuBDUyEAAuBae6EAAuADqqFAAuAQOOFAAuABAmFAAuABZiFAAsBDocACwEPgQALgnWugC0IgiAsgCGJgQR3gwD4ggLZggAJgQGkArArgwGlArArhQKIAQKAAr+BAVIBEIcCyKQBUoYAWoEj/4QBzoJsS4ICuIAADYQAC4FmI4QAC4FxyYQAC4ABMIUAC4FooYQAC4FmXIQAC4FsqYQAC4ABMIUAC4ABMIUAC4E/YYQAC4ABMIUAC4ABMIUAC4ABMIUAC4ABMIUAC4UBMIACZIMBDAEQhAELgRezgS9aAnRygAFEAwsLkYkJeoARooMInocJfAEGiAl8ggUQhQl8gCjFhwl8iAjyhwl8ggBCgTpeigl5gUV3hwl4hGZsgXA+giR1BEHAAjaBDMySABeCTJKBFZGPCa2CB0+BJFCjCa2CCR2DCa2ICjeHCa2ALDyCAFyAbpiECo2CdCiABh2BCYyFLmiAEDOICa+ACMoBToEINYBbzAEggENVgWGnhAmyAg0CgFXfgSjkhgmzgQiEgD5BjAFnhwFihURoiAFqgQh/hAm1ggAXASCBCGuFAI6CBbkBFIAGzwUFIhMhFIwJtQKBAoAJMQmgDyEUQeAOIROBCbWBCUICoBCBABEBD4BaUYAHWAENkgmzAgQagQAbAnQigEraAWuAMiCECbQBDYIXHIEJtIBUJYAAIYAH0QEWhAm0gACAAiAVhQDDgCvAAWqALtMBGoAf6IADdoEGqgEOhAm3AROBABOAE4OFCboBDoABdgEUiQm6BA9rIheBAWuBCO8BD4MJugEHgCKBggs7gijzgAbZgQfmAxggDoEH0gMYIBeBB+0BGIMJugEGiQm6ggFpgQfJgilNAiAGjQm6hQLGgAG/hALIggkiAQaBCSIBBoEJuoAAz4FB9IM5f4UJuoF2v4gA64oJGAEZgClKgEaAgAAoAQ2NCRgBD4AITAQPGyIPgRq3ARGACVaHCRiAAPGACvuADKqCCRiAKcCAUESDMYCCAKyBVimDAmWAUdSBCRgBB4AkUoJldYIJFoAj9AISaoABpgHUhgkWAxJB0IIJFgEHgFQCgkX7g07lgE6/AQ2EMO6DMP8BEYAYfYQJFwELgAp+gAM8gQBrgAGRhAMWggkXgAM1ggyqgSzbgQAYgQKKgAKAhwL8giXJhwkYgQVugTXXgjBOhwqoggGkhAqohgp2ARKECnaCNjGCCncDCwuqgBHygQdSgRY6gTIzAwFBnoISRQQAQYgTgAASgAJJgmzJAkEegwAVAfyBYfaGABUBE4J8a4AACYAAWIMD4YgF0oABMAM7AZSAbC2BDqACsC2DRRIBqIAACIEAEAKgLYEToJIAOZYAGQMLrwKCAKyBD++BEi6BDwKAEkABBIASnYA8xYAAEoF04gEEgxKdgg8ugRnIgxBAgkQpgBBAghPBlAAcgAb4gxIsgmLNhABdgBKdihKbgTJGgxI0AgAQgEX5gwBKhxCmgwBKgjValQAchRELlQAfgAL7AXODFTCUAKiGHhODECKEJI+BD+oBEIA3E4MANYBtRIFAYwGngBPQgkdRggDMAwFBCYgBG4EBWIRtkIUA/wG4hAD/lQAgggEfgxK9gBKvmQAqggBKgiIggwGZgQCAgm76gAH7gQE8ghRwgTkkgQA6BMAtC6aFAKmBAeCEAK2CSie8AK2FAIKCTUqBClABSIJtXp4AVIEAP4cAuoAKgIIB9AQLC/wKgGgFgwarhQX4gRtcgxJugQwyASKAKw8BLIETvoEKnYEDVAcJQf+A/59/gjSsAQaDP3qBDB2BB0CBGVmDBzaCIyOABTaBGWyGBmKABxWCAuoBAYFwOgMvAbyEAAgByIAACAJBIINYfIAMh4E9KIAcroAMW4EAOoAhtIIRcIUWKIEYFIQpGoAOX4ANaoIpAIEBFwWYFmoQL4IACgGkhgAKgACwgQDFBJwWEDCCABCABAKBABABqIUAEAGwgwAqAkH+gYAdAkESgQYjgAECgDVggQZyAQKDL7OCN50B8IBBxIMA2oMF5oYyD4EATgEtgQAygBe6AwVBEYABgIEEEQYoAqwtQQqAIsmAWQ6ACm2AJteAAAqCLFCAABuAHKCBeOCCEYaADXyBHpKBGrSBTt6Aeq2DHmiCJjECECuBAICCBByDdcGAAnOAGA2EACGAFVOABCeANWsCciKARriSBC2NAhGJA8eXAmGBOC2FArSEBC0BAY8ELQJBoIBBjAMaEDGCAoeBJhCEAI2CdwKGAIeEAJq5AI+EAz0BDYEqpIEAmoAAlIIKi4Q3AIRMRoEAk4EB6YEt9gH+gls+ggHogUlaggEXAQyEAJCBIYuHATK4AJgBBYIH04kBKoJuggELggEohABngWwKgAKxgH88gwChgACKAQGHAIqAYzDCAIqDCF2WAIqCAGeCABKHAIoEBkH9/4MBJYIAkwENhwEdwwCTkQEfASKAPaKCAksBDIIAmYcAb4UAGAEEgACfgwHKggQ0AQqGA5iAA+uCE3UBCoJCtoEcbooDk4F/a4YAR58DBYEnV6AAwYEZz48AvIgDB4kArIYEDoEEcoAAkAMJEDKFBHCAZ84BB4IADoEgqQExgReWgH0YgiGJBywLC5YLARKBDT8EIGsiD4AqpIJ1Z4BhrYIXj4INCYEX5oElogEAgk1NAtDHgAhxAdCCRymBAAQBSoKDbwNB2CiDDtoC3BaBVeMBf4MVFIIMF4Fqa4ESWoBXbwEogW3ZgBT/ggDagQCkgFd8ASiAAUuFOeCBLzyBFG+AJjmBVP+CcE6BQtiAH0mAgh2ACPiBAMGAfvuDEqGDBPeCHB2ABO+BNG8CCRuBFoSCbjKDBP+CE5+ANG2AACMBrIEajAELgXQrgwBSgB4bgAG3hQGiAdCALZSAChWEAJCCFVSEcM2GAHCAa6GCLFeCCgyBBgWBCduCAXOAAV2DJiCABmyCAPSAB8iDBrkC0CiCABGCAO+AAISAAF2AABUB4IAMBoICQoIAh4JF4gLgFoAAEYAfRAIQM4MAjwHUgACPgjGlAdSFADKCHwiCAJeABm2EAP2JACaFAB6EATSCIYKGAOoBBYMK4YMMcYEA94INhYN4QoAMKIEfuYEWFAEEggAKgBokgR7JgADfhCHNgQr7gC1NgwsCgBw/iACthEPxhgHcgCshhAaQgwCcgACOggCcgwHhggDKgw8MAbyAAieARc2BGfqAcEqBAmYBCYYCcgEQg3wZAQiDW1ABBINOpoJD74I0hIAKRoI8T4IsCIUcOIYUEYIx1YEMrYMAhIMBYYUK94AxP4IJ7wHUgACtgACUBrwETBshEoIHboIBzoEjGIAv1IAx+IEvNoQAPIEktYAX84A0QoAB6IBSZYQ8YoFDwYEANYEHJQVMIgIbIoIXgIGD9oEqEYEFdAIgDIIV/oIX34se14IU8YA+jYEEIIBIMIFWRIMAbINsZIMHzoAAaYAAfIABpQMQamyDB9GANB+HAtmAQN2AFkeAAIaAAcOBACCDAt+AAMqChuKBRyiAAHaCRNkBAYICg4AB4IEK84KAvYE8noIO3oEI0YAASIE6poIOOoNIvIEBHIEArAECggImgl+igQ5egg+4A0ECSoEABYAtGoAAO4EAXYEAlIQAboEOP4IC/4ID8IM4LIEtKYQBR4EBEIE+HYIJWIAfxIEBQoAFfIMFT4MA9IAAFIEIVQIFa4QA8oAR+4UDbIUTBYEK4oAMuIIWuAMAQbqAAkeBAU+BEJCEAhyBGvEBf4I6nwIASIECxYIEioINWIQbhIMNBoMAgIEFBAEPgwJJgS/RggXIhgGkgoIfgQB8AXGABdiBDj2CAmgBS4QD6IQ4NIITv4JD+IIAnIUNpgEPgA5XASSAFa+DAF2AhreBHHGAbuWBA3yBABGABt6JAraBhVKAA62AA1KHAOsFC7YCAQmABxmBOSyCgmyCAsaABtECOwGAP0sBQYACQoAE7gRBB0GKgGbHARuALHGDDkaBHC4BCoE6ZoEEhoMBAYJ1voEK2ICGroADHoNCyIIaBYAZooF5K4IW7oGMzIQC2IAv24EET4EFjgFLgRBtgAbOgAVegSe5gAQHggE9gxotgALtggDHgh/2ghYqggcdhQAlgHDohgLzggLYgAtugRCLATuAAAeDQvqBCuYBCYJ1KoEAHQHAgwAdAsAVgweagAASAcSDABIBxIBivoARWAIKQYA7hIEEtgRGIgMbhQD3gCTwgAMlARuEAQ+CATgC0AiAATiDDESAJPqBAF6CCr2CCY2ACr2BAHqDBpCAIryAEYeBQNGCekOCB7YBL4EFDIEANYFDOIIikIMBgIIAkIEOsoIcfIQHlYEhwYIPJIAHp4AzgwIDSIcH8Y0OgokPI40AHIgH8YATp4UAXIAH8YMPgIEFqIAU+4EMeoEAC4MK7IAk7AKQIYFBcgJ0IoEWpAQvAYYIiwCmAoQIgDawgwBLAQeAAKeAAjaDCJmDAKsBB4gAq4EHeIEAj4JUAIUtQ58Aq4BY14UAYIAAq4MAYIEkJoEAq4QmF4UInwYJQRxrQWyBF7WCf1YCkB6BOnCDAIyAAA8BoIA0hYA0mYMAkoAaCoIJSYBJAocJ/40AhoIuOoQAHJYQcIwJ/QEEgAqSgzSVhAChhABqhAAVhQCrgACCgQB6gQq0gQ1jgCbRgUgggA4SgR8eBIECSRuAAXgBI4MBeIAW94AC4YANoYMAt4ECGYBEpokRN4AAfQEGhgDakgCupBE6hwFsgADHhABggQe6hgFsAQaGI9oDCUEEgVsjgAjFgAFpAR+ADLCAADuAAAsDoBwigACLhAKigTSwgQK8hAIVgwB/hytZqgIHgYAYiwFnjwCghwByhQLShgCwgRzFgBhsgiF/AqAtgUNygALeAy8BgoGGLYJ82AMvAYCBcryBAD2EAhSDXbubA2+iAiKBETCFALiAgMuEAQ2AiIqDALaBeM2DEKEFswsBCn+DBWuBBY8BIoAfEIEw7YAs9wEbghsvhAV5iwV1gI/CghzcgA6LgQcVgALygU2VgTgkg00Xgj+EgmoygIMmgStDggWEgwVxgQs4gj3SgBVJghVjgABmggTFggDEgATFgR1CggSagQJ9gAFbgQJ9gD2OjAElgAHyAQWIASWNAeKJASWNAByIASWAXOCEASUBBYAB3YMAYIGCjYQBJ4EACwELgQqGgSXyhR4ngRXehxA4hBRUgXrdgRA6gQX4gAD0gRTlgh2whQDmASKCSSaDix6DIeSCA0+CAqaAHluCAfWZA02iArKCI/mBBWCBAMCCEhuBbjSABByDAfOBG0GGD86CfFeBBraDAIqBKraBAQwELwG+FYB2H4YEs4kDRsAAlIEEeo0AlIAF/IAAJ4IBZAEFhQ83gB1chFsFgSoXjQ8zgQ4TgQBtggasjA8zgQJrgi9njwHtjAU2gHcFgyfhgVCZgA/HgQaFhgBxhAAagCs/gQAagkrKgDwQhHuAgQfQjQE3AcL6ATcB/oUBN4QPmeIBN4APrJABM4NOxIIBJgHEjgEmAcb6ASYB9oUBJoIqHeQBJoMqOo0BJoAIQYN+WYIj/4IDkYIKA4At4gFGgA1zgQWPAQiBBYqBCgOAAA+ALiGBBY8BCIQKBwL/AYCX+4MQmoEJsYEQmoGRooUMkIBNOoAMC4FKnYMNKIMOBYCNHYEAnYAOzgEEgAyugkONAQSAHRKCGyuAAWKABV+FAECCBLKBBKWBelmEMPOBABiALt6DABgBDYM9nQENgSpzgATvgQ9cghCPgAAIgj4agAuPgw1cgBraigBCggBjggBagXhbgQDtgQy3gQA/hA+tgXl3gQEpgg9Vg39uhA0ehQAVgCmLAwALg4EahIANGYKMDoQ7zoF2X4EACIVf84ApfoEACoEPggEggS+3gRYHgz0KAduAG6oEAUEWTYAru4AGs4BfxgSggAJxgCe4gQBNgzb1AQGAm8aCC9oDQSpGgUA4AgVGgV/lAwBBOYEtAYEG+YACXwML3AmCAYaBkPqAQs6CAhQBLIEr9oAG34Byv4EAD4AAA4BUXoIruoMpOYMXo4J74YJ64YMCLgJBKoAWwAJ1IoB5b4EBtYACSIEAFwFsgwg5AVyAJaiAAYiBi42BmLaABI6BAGuAAtyBYhyDFJsBT4ASTwFLgRbjgBwAAUWAZfIFIARHcnKBZFuCLJyEPNCADFuAanOALKmBArqCAs6AW2qAHU2EFgOFABOAIpmGGnCHABaBk/WAJCqEGmWHABiAHY6GNKSDLnaAHKKEgHOBARiBAAgBOIIAxoFD5IEAt4AfvoI33oIBBIBEMoEAJYE3q4KLFIE3fYEvroALx4EADYAD8YIDboIAXQFcggANgVH9gDfGgQF/hRk/ghyqgDWFAhA3gi0NhwARggBWggANgQdeg4kngTlhhBrqgn4/ggFjgBCcghjugQMTgn/Tg35DgQGEggJ8gRB6gYGUggSbAiwigjMagnvKgRyjgi+MgQJjgQEkgQDZhAAlgi3XggPbAWyDAEOAABeAY6iBAdiAAWQBBIKY/IAAkYEuKIE0KIEASIEDw4FFAIQBIAGwgARGAUGDg9SCCUGBAHCCALCAAEKBAAcCtC2BQI2CErcBtIMAGYEwFoQBe4ADUYNBOIIAkAFsgSTPgQCLgglSgQChgwBBgWkGgQq/AgVJgDrTgABhggBIgQC0AVyBBT+AACMCxC2BHueCABMCxC2CDtUBBIM0JwEBgAMkgZ9RhAFCgTZXgSIAgQL+gQGtgBpkhgD0gi8LhAAlggCygQLVggmMgEILgCo5gQBfgpJ7gwCggTnLgQHphAESgomvggFZmAESgEgVhBOsAWyDA1SFARyCAYeCBo6CAnCCP+yBBYqBMs2BG1iDATaADQEBA4ICP4MBLIGUmoMAjIIAOIUBLIAAo4QAPIABToMAWJABJIQBAYAMkoAKeIQDy4IDCIUD54EBDoAy2IIDt4QCUoFG+IAD0IMhhoAQtAFFhQO0AQaAYV6ElV6CAWODgx6DAKgBOIAFMYIMfINHdoGAO4ID7IAE6gEagzHAgwGWARqCOzWAGJmBA/yDA0qBAwGCAWGBA7KBEucBQYBa0AEDgorSAUGAQkuAHV6AJIUBi4Muz4JjnwEQgAqkgy9fghfJgGs+gRqTgZSshAVsgjkFgBo7hQJxgBT5ggN/gi+VgAAYgAANgUSGgQQ2ggANhAPVgRptg4FPggBdgWVqgwAcgjVdggAWgACQBBALC4SBHe6BADKAZCeCBEiBJ6WCBAOCA0SCXCyCANGBAiuHHWiAOaYBGIEyp4M4rIIAcwEwgh73gUB/hBGLhQAThDpohABGgACkhAf2gAS4gAANgSI8BQuECQEPgQd3gSDogRk+gR2ugiSDhwByA3RBhYJaSAEAgTcpggARgAKzAoYCgjy1gzCEgzmvgTU8hABuAVSDAriDAoyABwSCAe8BSIEABQNYdHOAgKOBS3qAAA2EAq4BNIAfAoMWcIBQpYMU04EHUIAJTIIDR4IStYQBlQEsgAB5gUUWAgNrgQdtggQrAhA6gjXFggD7gjU7ggT1g1N4ggA0gDTFgwNagTR/gQARgTTFggMWgAAFAXCABQSGCQ6SACqBjzybACKCNd2CBnaBhJqGNd2AEVyBNd2EFZ+DJUqBb16BUiSBXVmBDn+EEKyBRMCAF8QCkCOBCDCCDVyKADaCAHsBdIIA34EE34ABP4IADQKkLYEUSIEAlYFFVoABgIMD3QKAAYUeEoIV04AN6wFgggGIgRz7ggEkAUiDB7EBbIMEXwE0gBfTgQGMgCyFgQGCg0X7AVSATfeBAa6BLTmBAEmCAPaEBdeBFIqECR8DEHRzgE6AgXH3AUiCbhYBDIMByoAlXoIBx4EWIYJfWYELGIMKUoUAkYIpSYI1A4QAV4AksIA4K4ILfoM2+ocEuoQAd4IEIYAAD4FUqYQCQ4MCbIFU7oMBjoECXoEAGYIATYILMoIANYEASYQ7S5YBxogaprAAH4ML3IFSwJQBvYQ3FYMA1YcBTII3FIIBy4Kb1IFEoIQGToALSoE3GYIAwAECgzcZgQQXgjcZgwBGiATxgQAHgztQgpoMgaJtgwY4gAFgAU+AR+2HOqeEAF6CaZKEAF4BAYQ6V4GXJIE6pI0AXoI6pIQAYgEbg0YtAqAtgzpRnQBPmQCtgUaZgAdfgSH2Awu+BYARsoID4IALqYAD4oMKa4Kg0IEACYI03oIEUQFqgRSLggAdASyAA5qCBJaBB1SBEaaBlb6AGIyFBa8BcIAKVoFeh4QCR4AKY4I8vYQGL4EAHAFcgwR+ArQtgj7kgQuahAh0AUSBAAUBTIEd6YMRy4FEIoEAioABCIIG6oMQ7IAADIJD/gQgCE8bhCWjgAuDhAmAgwyeghqkghjOpQA7gBe5gA3PhAhogIXWgkb8gQJEgwV5gwFiAgRqgAcmAhA3ggASggfYAXSDADCBB9GBExCABYmEAneBCG6CAP+BQoGAHleCHDuHAzqBDQ2BAzyCBA8BWIAxKIAFnIAf7YBRFoEQJoEStYAAfoKUb4NAfoEqL4AD8gEIhAAmggDogAAFgEpLiAXCggE3ASKAUjSCA/uAHNyDAwWCGs6CAWSFHIeCHayCWIOBGjMBhYEACoQCHIE/0IUJbIMJaQHEgB9TgiMLgyUbggEJgCM+gAJlgWAGAYKCOwqBpCIBAYAADIAIhYEjHICKGIVKgIEDQoEISoI4p4Gc0YIPTII8CoAAQoGlpIECroGKCIEAB4QM74AHjIAUI4UAQQEBgp+Wg4b2gQCPgA0CgABDgRRxgAkhAwurBIAflIEAGQF8gRlHgCjfgQAMAXiDAX0CjAGFDTuECuUCLGuAAuOBGcCBBUoBA4Bh7YIFgAGQgJACggDbgAGVgAxUgAA0ggWQATiAHMmBoHWBURaABZQBB4I9k4Eq9YEu9oEE04NYIoEACoIAmgE0gB2AgQGYgx0pgQrWgF3AgQv/gwAvgBnzgk6gggAyAiALggiTgQAKgVo7hAANgANKgz4KgT34gxIwiGYwhj3/gACAggAtgQV9gT3QgAANgAHRgj4FgAv0gTEugAANgDpAgAKSgTEigAANgAnHgABQgTEWgAANgD4OgASegTEKgAANgD4RgAGDgTD+gAANghRqgQVKgQc8gBAMgg9KgC6rgT4XgAeMgSC4gz4egACfhD4egRB8g4WQgF9PgQAKgkAHgB3cAQaDRdOAETUBBoOhO4JbW4Ico4AA14IU84IeS4Ja5oBt5oMCFIAC7oMn2YAC5oBKAQEggiLrAQODTo2BAPmDAXeALCiCAAqAABSBTpcBDIBNGIBf84IDCYED5gEBgQuugS53AiIJgQLOgRlLgQAEBUkbC6ALgRwpgwlzgSoZhAlzhQl1ggIFiQlzAUWDAheBCXSAQJyAAV2AQuKCBX2RCXOCAmKaCXODB/WTCXOCCWyAApWFHAOCCHEDNgJ4hAVTgGUYgAIVgSJAgABPAWCBToiFAFABgIIA74EC3YIJoYQEdIUJpAEEgAmkgwf2gEy2hibRgh5MgAulgAH9AUGAAUODADWBAGeAVAMBIIEA2YgAbIIC3AF4gqObgwjoAQWFYMiAABiJB5GCBjeBA0KAAAmFCeiDCogBZIAP7oACT5sHx4BQvccJ7YEo3LQJ7QF4gR3fggkrhAF8gD9QgAeegACMgCjkgRsVglojgQDdgwahAaSCAPoCoC2OCa6AHeWEHbKEAiOBBQyCNMyJAh6ABZiVBc+DIGSLCcqCGiOECcsBeIQJy4MCE4IJvAFohQnZgQ5zgZHUhgl5AVyBUIeGCCoBBIUIKoCjT5oI14Kk+IAACgFohQWOggX+hAT38gnUhwm4iAlVkAmzggLUlAm2hANigQoOhgiahgoohgD6AQSCobKDAVWUAC6ABJiCqZ//ASGHASGCAgjoCouGAmG4CouBBF6AjxYDAAs/gg+agQAejxcghj/GlAAfgAAcglI2AgRAgAGUAQOAAA0CgweBN1qFP2KAENOAIiWBLjyATW2Al8aCULCOdeuFDu+BFfgBQYAjsIAAMAF/gFCoAQaCpL0CAEiAP46BE52BFj+CMuiAVRiCesqCBTGBNXiBF4mCBtyAF3qCkRUCCEmBIbwCS3KAFfOAUuKCBRCBdj8ByIAJjYFUz4MAcINePYNXjIEFY4KaDQJBKoEQioABX4IWuQRC//+BgmzZAVSAAAwDgICCgFF3ATeAW8SATlOBAWaACXmCVmiCFoOBAAyBWtqBCt2DVJiBAHWBI8+CAOSAAHeBVUSEABaBT4aJABmCAseCABcBTIcAF4JCFIAAHQHEgR6TgABegFkbgDjKgAAJAZyEMQgBKIEAD4AYXoQAMIEEgIFkuIAARgGcgSwPAQKAXrGAe+eDFRQBOIJXqYAE84QACAFEgks1gpMgg0Q6gAGRAYCCZ2yAQRSAeNaCB/2BAH4BiIEjhIALRQGEgQCOgCoZgGkkggpUATaCRV2BQzUBbIAFngE2gAQbg5DfAhA0ggHdgACMgBN2incXgACngY9Wg19ShRIZg0G7gAUngRpRgQokgWVJg0G9BEE5QSqBJY+AAdSCp0+CK4mBAv6DS0qCNWeDUoqACpeAS++BAGaAE6ODCCuEQ/oGQYgRNgK4gI+lgAALgB8IgBRvgo+xgHpvAayDABWACJaAALyBABUB4IAAFQGggwAVgAijgADfgQAVAX6CeBOAKpCDAL2BAK4BLIAGIoRbhIVEKIIoEgFEgDgahDK+ghZehQuBhkQhgiqgAiA3gQbcgQCrgG1ihQAShEQ3AUiDAReAMFsCDGyAGOQClCCBCVoBNoALK4EDbwJBkIQADwGMgwAPAZKEAA8BgIMADwGWhAAPAXyBDmACC0ODGVyBWjCXGVyCDWuBOE2CGVyBAAqAATmAeSgBSYIEGgMLC+OAjWKAAhQEC6EEaYCzYAVmZmljaYCy5QEgg7TZEwAxLjMuMS4xLW1vdGxleQBpbnaAs20VZCBsaXRlcmFsL2xlbmd0aHMgc2V0hgAcBWNvZGUgiQAZD3Vua25vd24gaGVhZGVyIICz0wFniwAyAmRpgLN3AW6AtAmKABYDYml0hABHECByZXBlYXQAdG9vIG1hbnmFABcHc3ltYm9sc44AGAJvcoYAU4YAJIUAVoKz9IAAXYC0QAFrhQCmAgBigAD4gACaDGVycm9yAHN0cmVhbYQADYoA1QstLSBtaXNzaW5nIIC0pwQtb2YtggBHgAAlAmNvgLQtAmN0hQDjA2NoZYoAF4QAmI0AFwRkYXRhhgAViwELASCBANQFZmFyIGKAtJABAIUAVwJyY4EAgQVtYXRjaIYAMgF3gLT0BG93IHOBtQOGATuCAN4DdHlwhwATiwGyggDQjwB1ggAWhQGvBGNvbXCAtSQBc4C06YACDgR0aG9kgDInEwwLpQIDAAQABQAGAAcACAAJAAqAKQcNDQAPABEAEwAXABsAH4CVbhYrADMAOwBDAFMAYwBzAIMAowDDAOMAgAY4ggABAYCMAAIBgYQAAgGChAACAYOEAAIBhIQAAgGFhAACBZAASQDIghjMgK1JggCEAQeAAIABDYAAegEZgCkpATGAA4wBYYAARgHBgEjqAYGBSOyAQBYEAQYBCIApDAMQARiABbwJMAFAAWABgAHAiQB4hQBwhQBoAYaAAAIBh4AAAgGIgAACAYmAAAIBioAAAgGLgAACAYyAAAIBjYAAAgGOgAACARCAAHIBEoAAiAEIggCAAQaAAQIBBYABBAMEAAyAAJaAHJwCAA6AAKIBD4CwMwQOC7cMtQEsgBzVggABARCMAAIBEYQAAgEShAACAROEAAIBFIQAAgEVhAACARDAASyJAICFAHSFAGyBAGQBFoAAAgEXgAACARiAAAIBGYAAAgEagAACARuAAAIBHIAAAgEdgAACAUCAAAIGoAgAAKANgACIgADQAR6AAAQBD4AAVAEggAAQAiAOgwDgAR6AAASBABSBAAEBoIQAFAETgAAEAQeEABQBDIABOAGMgAAEAUyAAAQBzIAABAEsgAAEAayAAAQBbIAABAHsgAAEARyAAAQBnIAABAFcgAAEAdyAAAQBPIAABAG8gAAEAXyAAAQB/IAABAECgAAEAYKAAAQBQoAABAHCgAAEASKAAAQBooAABAFigAAEAeKAAAQBEoAABAGSgAAEAVKAAAQB0oAABAEygAAEAbKAAAQBcoAABAHygAAEAQqAAAQBioAABAFKgAAEAcqAAAQBKoAABAGqgAAEAWqAAAQB6oAABAEagAAEAZqAAAQBWoAABAHagAAEgHm4AgC6gAAEAXqAAAQB+oAABAEGgAAEAYaAAAQBRoAABAHGgAAEASaAAAQBpoAABAFmgAAEAeaAAAQBFoAABAGWgAAEAVaAAAQB1oAABAE2gAAEAbaAAAQBdoAABAH2gAAEAQ6AAAQBjoAABAFOgAAEAc6AAAQBLoAABAGugAAEAW6AAAQB7oAABAEegAAEAZ6AAAQBXoAABAHegAAEAT6AAAQBvoAABAF+gAAEAf6AAAQBAYAABAGBgAAEAUGAAAQBwYAABAEhgAAEAaGAAAQBYYAABAHhgAAEARGAAAQBkYAABAFRgAAEAdGAAAQBMYAABAGxgAAEAXGAAAQB8YAABAEJgAAEAYmAAAQBSYAABAHJgAAEASmAAAQBqYAABAFpgAAEAemAAAQBGYAABAGZgAAEAVmAAAQB2YAABAE5gAAEAbmAAAQBeYAABAH5gAAEAQWAAAQBhYAABAFFgAAEAcWAAAQBJYAABAGlgAAEAWWAAAQB5YAABAEVgAAEAZWAAAQBVYAABAHVgAAEATWAAAQBtYAABAF1gAAEAfWAAAQBDYAABAGNgAAEAU2AAAQBzYAABIARMwIArYAABAFtgAAEAe2AAAQBHYAABAGdgAAEAV2AAAQB3YAABAE9gAAEAb2AAAQBfYAABAH9gAAEAROAAMIFEwEJAJOAAAgBk4AACAFTgAAIAVOAAAgB04AACAHTgAAIATOAAAgBM4AACAGzgAAIAbOAAAgBc4AACAFzgAAIAfOAAAgB84AACAELgAAIgBDagAQCgAAEgAAIAUuAAAgBS4AACAHLgAAIAcuAAAgBK4AACAErgAAIAauAAAgBq4AACAFrgAAIAWuAAAgB64AACAHrgAAIARuAAAgBG4AACAGbgAAIAZuAAAgBW4AACAFbgAAIAduAAAgB24AACAE7gAAIATuAAAgBu4AACAG7gAAIAXuAAAgBe4AACAH7gAAIAfuAAAiBA7YBB4AACAGHgAAIAYeAAAgBR4AACAFHgAAIAceAAAgBx4AACAEngAAIASeAAAgBp4AACAGngAAIAWeAAAgBZ4AACAHngAAIAeeAAAgBF4AACAEXgAAIAZeAAAgBl4AACAFXgAAIAVeAAAgB14AACAHXgAAIATeAAAgBN4AACAG3gAAIAbeAAAgBd4AACAF3gAAIAfeAAAgB94AACAEPgAAIAQ+AAAgBj4AACAGPgAAIAU+AAAgBT4AACAHPgAAIAc+AAAgBL4AACAEvgAAIAa+AAAgBr4AACAFvgAAIAW+AAAgB74AACAHvgAAIAR+AAAgBH4AACAGfgAAIAZ+AAAgBX4AACAFfgAAIAd+AAAgB34AACAE/gAAIAT+AAAgBv4AACAG/gAAIAX+AAAgBf4AACAH/gAAIAf+AAAiBBAoBQIAABAEggAAEAWCAAAQBEIAABAFQgAAEATCAAAQBcIIFVgMHAEiAAAQBKIAABAFogAAEARiAAAQBWIAABAE4gAAEAXiAAAQBBIAABAFEgAAEASSAAAQBZIAABAEUgAAEAVSAAAQBNIAABAF0gAAEAQOAAEIBg4AABAFDgAAEAcOAAAQBI4AABAGjgAAEAWOAAAQB44AABIC+K4AAdIECxgEFgABcAQWCBUoBFIAABAEMgAAEARyAAASAvlaABEQBBYIGBAEaggXqAQWAA9QBBYADuAEFgAOcgE92gAAEARGAAAQBCYAABAEZgAAEgQACARWAAAQBDYAABAEdgAAEgL59gAKkgQZAAQWAAiyBBaYBBYABtAEFgD3fAxsLTYMfuYcABIC+rooABIEHUYkABAEEjAAEAQWKAAQEQbAcC4C9CosAS40AO4UALwEGhAAEgQWIgQAEgQEKgQAEgQGSgQAEgIS2ggAEAQuEAAQBDIQABIAF24FHeQTgHQsjhQBfhQXLAhARgAVtBgcJBgoFC4A6uAQNAg4BgAclBJQeC2mFAJCFAIiFAICFAHiBAGiBAFyBBh8BEIAABAEUgAAEARiAAAQBHIAABAEggAAEASiAAAQBMIAABAE4gAAEAUCAAAQBUIAABIEGvQFwgAAEAYCAAAQBoIAABAHAgAAEAeCAAG8DHwtyjQBvgQBrgQBngQBjgQBfgQBbgQBXgQBTgQBPgQBLgQBHgQBDgQE8AYCvAEGAUc0CC22BAMcBBIAAAgEIgAAEgQEzgQJLARCAAA6DAAyBnqyAqmuEACSBB3OBAE8BCIAACIEAGIUADIEIt4MADAEggQCUgDKEgQBrAYCBCC8BBIMADIA/SAoBABAMAEGRIQv/gCUfgMDAgIKxBQgJCQoKgEk3gAABAQ2AAAEBDoAAAQEPgAABARCEAAEBEYQAAQEShAABAROEAAEBFIwAAQEVjAABARaMAAEBF4wAAQEYnAABARmcAAEBGpwAAQEbmwABARyBffsEBAQFBYHB1QEHgAABAQiEAAGAXSqCAAEBCowAAYAnsooAAYEBMJkAAYEBTJkAAYEBaLkAAYEBpLkAAYIDdYABzoUBvI0BqJ0BkLwBgAIbHLwAAQEdvAABgA9PgH05A9AqAQ==")),e)})}let Fe,Bn,Mt,Bs;function nw(i){if(Fe=i,{malloc:Bn,free:Mt,memory:Bs}=Fe,typeof Bn!="function"||typeof Mt!="function"||!Bs)throw Fe=Bn=Mt=Bs=null,new Error("Invalid WASM module")}function zu(i,e,t={}){const n=typeof t.level=="number"?t.level:-1,s=typeof t.outBuffer=="number"?t.outBuffer:64*1024,o=typeof t.inBufferSize=="number"?t.inBufferSize:64*1024;return new TransformStream({start(){let r;if(this.out=Bn(s),this.in=Bn(o),this.inBufferSize=o,this._scratch=new Uint8Array(s),i?(this._process=Fe.deflate_process,this._last_consumed=Fe.deflate_last_consumed,this._end=Fe.deflate_end,this.streamHandle=Fe.deflate_new(),e==="gzip"?r=Fe.deflate_init_gzip(this.streamHandle,n):e==="deflate-raw"?r=Fe.deflate_init_raw(this.streamHandle,n):r=Fe.deflate_init(this.streamHandle,n)):e==="deflate64-raw"?(this._process=Fe.inflate9_process,this._last_consumed=Fe.inflate9_last_consumed,this._end=Fe.inflate9_end,this.streamHandle=Fe.inflate9_new(),r=Fe.inflate9_init_raw(this.streamHandle)):(this._process=Fe.inflate_process,this._last_consumed=Fe.inflate_last_consumed,this._end=Fe.inflate_end,this.streamHandle=Fe.inflate_new(),e==="deflate-raw"?r=Fe.inflate_init_raw(this.streamHandle):e==="gzip"?r=Fe.inflate_init_gzip(this.streamHandle):r=Fe.inflate_init(this.streamHandle)),r!==0)throw new Error("init failed:"+r)},transform(r,a){try{const l=r,c=new Uint8Array(Bs.buffer),h=this._process,u=this._last_consumed,p=this.out,f=this._scratch;let m=0;for(;m<l.length;){const y=Math.min(l.length-m,32768);(!this.in||this.inBufferSize<y)&&(this.in&&Mt&&Mt(this.in),this.in=Bn(y),this.inBufferSize=y),c.set(l.subarray(m,m+y),this.in);const g=h(this.streamHandle,this.in,y,p,s,0),A=g&16777215;if(A&&(f.set(c.subarray(p,p+A),0),a.enqueue(f.slice(0,A))),!i){const C=g>>24&255,w=C&128?C-256:C;if(w<0)throw new Error("process error:"+w)}const v=u(this.streamHandle);if(v===0)break;m+=v}}catch(l){this._end&&this.streamHandle&&this._end(this.streamHandle),this.in&&Mt&&Mt(this.in),this.out&&Mt&&Mt(this.out),a.error(l)}},flush(r){try{const a=new Uint8Array(Bs.buffer),l=this._process,c=this.out,h=this._scratch;for(;;){const u=l(this.streamHandle,0,0,c,s,4),p=u&16777215,f=u>>24&255;if(!i){const m=f&128?f-256:f;if(m<0)throw new Error("process error:"+m)}if(p&&(h.set(a.subarray(c,c+p),0),r.enqueue(h.slice(0,p))),f===1||p===0)break}}catch(a){r.error(a)}finally{if(this._end&&this.streamHandle){const a=this._end(this.streamHandle);a!==0&&r.error(new Error("end error:"+a))}this.in&&Mt&&Mt(this.in),this.out&&Mt&&Mt(this.out)}}})}class sw{constructor(e="deflate",t){return zu(!0,e,t)}}class ow{constructor(e="deflate",t){return zu(!1,e,t)}}let Hu=!1;async function rw(i,{baseURI:e}){if(!Hu){let t,n;try{try{n=new URL(i,e)}catch{}t=await(await fetch(n)).arrayBuffer()}catch(o){if(i.startsWith("data:application/wasm;base64,"))t=aw(i);else throw o}const s=await WebAssembly.instantiate(t);nw(s.instance.exports),Hu=!0}}function aw(i){const e=i.split(",")[1],t=atob(e),n=t.length,s=new Uint8Array(n);for(let o=0;o<n;++o)s[o]=t.charCodeAt(o);return s.buffer}let yl;iw(Ko),Xb({initModule:i=>{if(!yl){let{wasmURI:e}=i;typeof e==Ki&&(e=e()),yl=rw(e,i)}return yl}}),Ko({CompressionStreamZlib:sw,DecompressionStreamZlib:ow});const Al={application:{"andrew-inset":"ez",annodex:"anx","atom+xml":"atom","atomcat+xml":"atomcat","atomserv+xml":"atomsrv",bbolin:"lin","cu-seeme":"cu","davmount+xml":"davmount",dsptype:"tsp",ecmascript:["es","ecma"],futuresplash:"spl",hta:"hta","java-archive":"jar","java-serialized-object":"ser","java-vm":"class",m3g:"m3g","mac-binhex40":"hqx",mathematica:["nb","ma","mb"],msaccess:"mdb",msword:["doc","dot","wiz"],mxf:"mxf",oda:"oda",ogg:"ogx",pdf:"pdf","pgp-keys":"key","pgp-signature":["asc","sig"],"pics-rules":"prf",postscript:["ps","ai","eps","epsi","epsf","eps2","eps3"],rar:"rar","rdf+xml":"rdf","rss+xml":"rss",rtf:"rtf","xhtml+xml":["xhtml","xht"],xml:["xml","xsl","xsd","xpdl"],"xspf+xml":"xspf",zip:"zip","vnd.android.package-archive":"apk","vnd.cinderella":"cdy","vnd.google-earth.kml+xml":"kml","vnd.google-earth.kmz":"kmz","vnd.mozilla.xul+xml":"xul","vnd.ms-excel":["xls","xlb","xlt","xlm","xla","xlc","xlw"],"vnd.ms-pki.seccat":"cat","vnd.ms-pki.stl":"stl","vnd.ms-powerpoint":["ppt","pps","pot","ppa","pwz"],"vnd.oasis.opendocument.chart":"odc","vnd.oasis.opendocument.database":"odb","vnd.oasis.opendocument.formula":"odf","vnd.oasis.opendocument.graphics":"odg","vnd.oasis.opendocument.graphics-template":"otg","vnd.oasis.opendocument.image":"odi","vnd.oasis.opendocument.presentation":"odp","vnd.oasis.opendocument.presentation-template":"otp","vnd.oasis.opendocument.spreadsheet":"ods","vnd.oasis.opendocument.spreadsheet-template":"ots","vnd.oasis.opendocument.text":"odt","vnd.oasis.opendocument.text-master":["odm","otm"],"vnd.oasis.opendocument.text-template":"ott","vnd.oasis.opendocument.text-web":"oth","vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","vnd.openxmlformats-officedocument.spreadsheetml.template":"xltx","vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","vnd.openxmlformats-officedocument.presentationml.slideshow":"ppsx","vnd.openxmlformats-officedocument.presentationml.template":"potx","vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","vnd.openxmlformats-officedocument.wordprocessingml.template":"dotx","vnd.smaf":"mmf","vnd.stardivision.calc":"sdc","vnd.stardivision.chart":"sds","vnd.stardivision.draw":"sda","vnd.stardivision.impress":"sdd","vnd.stardivision.math":["sdf","smf"],"vnd.stardivision.writer":["sdw","vor"],"vnd.stardivision.writer-global":"sgl","vnd.sun.xml.calc":"sxc","vnd.sun.xml.calc.template":"stc","vnd.sun.xml.draw":"sxd","vnd.sun.xml.draw.template":"std","vnd.sun.xml.impress":"sxi","vnd.sun.xml.impress.template":"sti","vnd.sun.xml.math":"sxm","vnd.sun.xml.writer":"sxw","vnd.sun.xml.writer.global":"sxg","vnd.sun.xml.writer.template":"stw","vnd.symbian.install":["sis","sisx"],"vnd.visio":["vsd","vst","vss","vsw","vsdx","vssx","vstx","vssm","vstm"],"vnd.wap.wbxml":"wbxml","vnd.wap.wmlc":"wmlc","vnd.wap.wmlscriptc":"wmlsc","vnd.wordperfect":"wpd","vnd.wordperfect5.1":"wp5","x-123":"wk","x-7z-compressed":"7z","x-abiword":"abw","x-apple-diskimage":"dmg","x-bcpio":"bcpio","x-bittorrent":"torrent","x-cbr":["cbr","cba","cbt","cb7"],"x-cbz":"cbz","x-cdf":["cdf","cda"],"x-cdlink":"vcd","x-chess-pgn":"pgn","x-cpio":"cpio","x-csh":"csh","x-director":["dir","dxr","cst","cct","cxt","w3d","fgd","swa"],"x-dms":"dms","x-doom":"wad","x-dvi":"dvi","x-httpd-eruby":"rhtml","x-font":"pcf.Z","x-freemind":"mm","x-gnumeric":"gnumeric","x-go-sgf":"sgf","x-graphing-calculator":"gcf","x-gtar":["gtar","taz"],"x-hdf":"hdf","x-httpd-php":["phtml","pht","php"],"x-httpd-php-source":"phps","x-httpd-php3":"php3","x-httpd-php3-preprocessed":"php3p","x-httpd-php4":"php4","x-httpd-php5":"php5","x-ica":"ica","x-info":"info","x-internet-signup":["ins","isp"],"x-iphone":"iii","x-iso9660-image":"iso","x-java-jnlp-file":"jnlp","x-jmol":"jmz","x-killustrator":"kil","x-latex":"latex","x-lyx":"lyx","x-lzx":"lzx","x-maker":["frm","fb","fbdoc"],"x-ms-wmd":"wmd","x-msdos-program":["com","exe","bat","dll"],"x-netcdf":["nc"],"x-ns-proxy-autoconfig":["pac","dat"],"x-nwc":"nwc","x-object":"o","x-oz-application":"oza","x-pkcs7-certreqresp":"p7r","x-python-code":["pyc","pyo"],"x-qgis":["qgs","shp","shx"],"x-quicktimeplayer":"qtl","x-redhat-package-manager":["rpm","rpa"],"x-ruby":"rb","x-sh":"sh","x-shar":"shar","x-shockwave-flash":["swf","swfl"],"x-silverlight":"scr","x-stuffit":"sit","x-sv4cpio":"sv4cpio","x-sv4crc":"sv4crc","x-tar":"tar","x-tex-gf":"gf","x-tex-pk":"pk","x-texinfo":["texinfo","texi"],"x-trash":["~","%","bak","old","sik"],"x-ustar":"ustar","x-wais-source":"src","x-wingz":"wz","x-x509-ca-cert":["crt","der","cer"],"x-xcf":"xcf","x-xfig":"fig","x-xpinstall":"xpi",applixware:"aw","atomsvc+xml":"atomsvc","ccxml+xml":"ccxml","cdmi-capability":"cdmia","cdmi-container":"cdmic","cdmi-domain":"cdmid","cdmi-object":"cdmio","cdmi-queue":"cdmiq","docbook+xml":"dbk","dssc+der":"dssc","dssc+xml":"xdssc","emma+xml":"emma","epub+zip":"epub",exi:"exi","font-tdpfr":"pfr","gml+xml":"gml","gpx+xml":"gpx",gxf:"gxf",hyperstudio:"stk","inkml+xml":["ink","inkml"],ipfix:"ipfix","jsonml+json":"jsonml","lost+xml":"lostxml","mads+xml":"mads",marc:"mrc","marcxml+xml":"mrcx","mathml+xml":["mathml","mml"],mbox:"mbox","mediaservercontrol+xml":"mscml","metalink+xml":"metalink","metalink4+xml":"meta4","mets+xml":"mets","mods+xml":"mods",mp21:["m21","mp21"],mp4:"mp4s","oebps-package+xml":"opf","omdoc+xml":"omdoc",onenote:["onetoc","onetoc2","onetmp","onepkg"],oxps:"oxps","patch-ops-error+xml":"xer","pgp-encrypted":"pgp",pkcs10:"p10","pkcs7-mime":["p7m","p7c"],"pkcs7-signature":"p7s",pkcs8:"p8","pkix-attr-cert":"ac","pkix-crl":"crl","pkix-pkipath":"pkipath",pkixcmp:"pki","pls+xml":"pls","prs.cww":"cww","pskc+xml":"pskcxml","reginfo+xml":"rif","relax-ng-compact-syntax":"rnc","resource-lists+xml":"rl","resource-lists-diff+xml":"rld","rls-services+xml":"rs","rpki-ghostbusters":"gbr","rpki-manifest":"mft","rpki-roa":"roa","rsd+xml":"rsd","sbml+xml":"sbml","scvp-cv-request":"scq","scvp-cv-response":"scs","scvp-vp-request":"spq","scvp-vp-response":"spp",sdp:"sdp","set-payment-initiation":"setpay","set-registration-initiation":"setreg","shf+xml":"shf","sparql-query":"rq","sparql-results+xml":"srx",srgs:"gram","srgs+xml":"grxml","sru+xml":"sru","ssdl+xml":"ssdl","ssml+xml":"ssml","tei+xml":["tei","teicorpus"],"thraud+xml":"tfi","timestamped-data":"tsd","vnd.3gpp.pic-bw-large":"plb","vnd.3gpp.pic-bw-small":"psb","vnd.3gpp.pic-bw-var":"pvb","vnd.3gpp2.tcap":"tcap","vnd.3m.post-it-notes":"pwn","vnd.accpac.simply.aso":"aso","vnd.accpac.simply.imp":"imp","vnd.acucobol":"acu","vnd.acucorp":["atc","acutc"],"vnd.adobe.air-application-installer-package+zip":"air","vnd.adobe.formscentral.fcdt":"fcdt","vnd.adobe.fxp":["fxp","fxpl"],"vnd.adobe.xdp+xml":"xdp","vnd.adobe.xfdf":"xfdf","vnd.ahead.space":"ahead","vnd.airzip.filesecure.azf":"azf","vnd.airzip.filesecure.azs":"azs","vnd.amazon.ebook":"azw","vnd.americandynamics.acc":"acc","vnd.amiga.ami":"ami","vnd.anser-web-certificate-issue-initiation":"cii","vnd.anser-web-funds-transfer-initiation":"fti","vnd.antix.game-component":"atx","vnd.apple.installer+xml":"mpkg","vnd.apple.mpegurl":"m3u8","vnd.aristanetworks.swi":"swi","vnd.astraea-software.iota":"iota","vnd.audiograph":"aep","vnd.blueice.multipass":"mpm","vnd.bmi":"bmi","vnd.businessobjects":"rep","vnd.chemdraw+xml":"cdxml","vnd.chipnuts.karaoke-mmd":"mmd","vnd.claymore":"cla","vnd.cloanto.rp9":"rp9","vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"vnd.cluetrust.cartomobile-config":"c11amc","vnd.cluetrust.cartomobile-config-pkg":"c11amz","vnd.commonspace":"csp","vnd.contact.cmsg":"cdbcmsg","vnd.cosmocaller":"cmc","vnd.crick.clicker":"clkx","vnd.crick.clicker.keyboard":"clkk","vnd.crick.clicker.palette":"clkp","vnd.crick.clicker.template":"clkt","vnd.crick.clicker.wordbank":"clkw","vnd.criticaltools.wbs+xml":"wbs","vnd.ctc-posml":"pml","vnd.cups-ppd":"ppd","vnd.curl.car":"car","vnd.curl.pcurl":"pcurl","vnd.dart":"dart","vnd.data-vision.rdz":"rdz","vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"vnd.dece.ttml+xml":["uvt","uvvt"],"vnd.dece.unspecified":["uvx","uvvx"],"vnd.dece.zip":["uvz","uvvz"],"vnd.denovo.fcselayout-link":"fe_launch","vnd.dna":"dna","vnd.dolby.mlp":"mlp","vnd.dpgraph":"dpg","vnd.dreamfactory":"dfac","vnd.ds-keypoint":"kpxx","vnd.dvb.ait":"ait","vnd.dvb.service":"svc","vnd.dynageo":"geo","vnd.ecowin.chart":"mag","vnd.enliven":"nml","vnd.epson.esf":"esf","vnd.epson.msf":"msf","vnd.epson.quickanime":"qam","vnd.epson.salt":"slt","vnd.epson.ssf":"ssf","vnd.eszigno3+xml":["es3","et3"],"vnd.ezpix-album":"ez2","vnd.ezpix-package":"ez3","vnd.fdf":"fdf","vnd.fdsn.mseed":"mseed","vnd.fdsn.seed":["seed","dataless"],"vnd.flographit":"gph","vnd.fluxtime.clip":"ftc","vnd.framemaker":["fm","frame","maker","book"],"vnd.frogans.fnc":"fnc","vnd.frogans.ltf":"ltf","vnd.fsc.weblaunch":"fsc","vnd.fujitsu.oasys":"oas","vnd.fujitsu.oasys2":"oa2","vnd.fujitsu.oasys3":"oa3","vnd.fujitsu.oasysgp":"fg5","vnd.fujitsu.oasysprs":"bh2","vnd.fujixerox.ddd":"ddd","vnd.fujixerox.docuworks":"xdw","vnd.fujixerox.docuworks.binder":"xbd","vnd.fuzzysheet":"fzs","vnd.genomatix.tuxedo":"txd","vnd.geogebra.file":"ggb","vnd.geogebra.tool":"ggt","vnd.geometry-explorer":["gex","gre"],"vnd.geonext":"gxt","vnd.geoplan":"g2w","vnd.geospace":"g3w","vnd.gmx":"gmx","vnd.grafeq":["gqf","gqs"],"vnd.groove-account":"gac","vnd.groove-help":"ghf","vnd.groove-identity-message":"gim","vnd.groove-injector":"grv","vnd.groove-tool-message":"gtm","vnd.groove-tool-template":"tpl","vnd.groove-vcard":"vcg","vnd.hal+xml":"hal","vnd.handheld-entertainment+xml":"zmm","vnd.hbci":"hbci","vnd.hhe.lesson-player":"les","vnd.hp-hpgl":"hpgl","vnd.hp-hpid":"hpid","vnd.hp-hps":"hps","vnd.hp-jlyt":"jlt","vnd.hp-pcl":"pcl","vnd.hp-pclxl":"pclxl","vnd.hydrostatix.sof-data":"sfd-hdstx","vnd.ibm.minipay":"mpy","vnd.ibm.modcap":["afp","listafp","list3820"],"vnd.ibm.rights-management":"irm","vnd.ibm.secure-container":"sc","vnd.iccprofile":["icc","icm"],"vnd.igloader":"igl","vnd.immervision-ivp":"ivp","vnd.immervision-ivu":"ivu","vnd.insors.igm":"igm","vnd.intercon.formnet":["xpw","xpx"],"vnd.intergeo":"i2g","vnd.intu.qbo":"qbo","vnd.intu.qfx":"qfx","vnd.ipunplugged.rcprofile":"rcprofile","vnd.irepository.package+xml":"irp","vnd.is-xpr":"xpr","vnd.isac.fcs":"fcs","vnd.jam":"jam","vnd.jcp.javame.midlet-rms":"rms","vnd.jisp":"jisp","vnd.joost.joda-archive":"joda","vnd.kahootz":["ktz","ktr"],"vnd.kde.karbon":"karbon","vnd.kde.kchart":"chrt","vnd.kde.kformula":"kfo","vnd.kde.kivio":"flw","vnd.kde.kontour":"kon","vnd.kde.kpresenter":["kpr","kpt"],"vnd.kde.kspread":"ksp","vnd.kde.kword":["kwd","kwt"],"vnd.kenameaapp":"htke","vnd.kidspiration":"kia","vnd.kinar":["kne","knp"],"vnd.koan":["skp","skd","skt","skm"],"vnd.kodak-descriptor":"sse","vnd.las.las+xml":"lasxml","vnd.llamagraphics.life-balance.desktop":"lbd","vnd.llamagraphics.life-balance.exchange+xml":"lbe","vnd.lotus-1-2-3":"123","vnd.lotus-approach":"apr","vnd.lotus-freelance":"pre","vnd.lotus-notes":"nsf","vnd.lotus-organizer":"org","vnd.lotus-screencam":"scm","vnd.lotus-wordpro":"lwp","vnd.macports.portpkg":"portpkg","vnd.mcd":"mcd","vnd.medcalcdata":"mc1","vnd.mediastation.cdkey":"cdkey","vnd.mfer":"mwf","vnd.mfmp":"mfm","vnd.micrografx.flo":"flo","vnd.micrografx.igx":"igx","vnd.mif":"mif","vnd.mobius.daf":"daf","vnd.mobius.dis":"dis","vnd.mobius.mbk":"mbk","vnd.mobius.mqy":"mqy","vnd.mobius.msl":"msl","vnd.mobius.plc":"plc","vnd.mobius.txf":"txf","vnd.mophun.application":"mpn","vnd.mophun.certificate":"mpc","vnd.ms-artgalry":"cil","vnd.ms-cab-compressed":"cab","vnd.ms-excel.addin.macroenabled.12":"xlam","vnd.ms-excel.sheet.binary.macroenabled.12":"xlsb","vnd.ms-excel.sheet.macroenabled.12":"xlsm","vnd.ms-excel.template.macroenabled.12":"xltm","vnd.ms-fontobject":"eot","vnd.ms-htmlhelp":"chm","vnd.ms-ims":"ims","vnd.ms-lrm":"lrm","vnd.ms-officetheme":"thmx","vnd.ms-powerpoint.addin.macroenabled.12":"ppam","vnd.ms-powerpoint.presentation.macroenabled.12":"pptm","vnd.ms-powerpoint.slide.macroenabled.12":"sldm","vnd.ms-powerpoint.slideshow.macroenabled.12":"ppsm","vnd.ms-powerpoint.template.macroenabled.12":"potm","vnd.ms-project":["mpp","mpt"],"vnd.ms-word.document.macroenabled.12":"docm","vnd.ms-word.template.macroenabled.12":"dotm","vnd.ms-works":["wps","wks","wcm","wdb"],"vnd.ms-wpl":"wpl","vnd.ms-xpsdocument":"xps","vnd.mseq":"mseq","vnd.musician":"mus","vnd.muvee.style":"msty","vnd.mynfc":"taglet","vnd.neurolanguage.nlu":"nlu","vnd.nitf":["ntf","nitf"],"vnd.noblenet-directory":"nnd","vnd.noblenet-sealer":"nns","vnd.noblenet-web":"nnw","vnd.nokia.n-gage.data":"ngdat","vnd.nokia.n-gage.symbian.install":"n-gage","vnd.nokia.radio-preset":"rpst","vnd.nokia.radio-presets":"rpss","vnd.novadigm.edm":"edm","vnd.novadigm.edx":"edx","vnd.novadigm.ext":"ext","vnd.oasis.opendocument.chart-template":"otc","vnd.oasis.opendocument.formula-template":"odft","vnd.oasis.opendocument.image-template":"oti","vnd.olpc-sugar":"xo","vnd.oma.dd2+xml":"dd2","vnd.openofficeorg.extension":"oxt","vnd.openxmlformats-officedocument.presentationml.slide":"sldx","vnd.osgeo.mapguide.package":"mgp","vnd.osgi.dp":"dp","vnd.osgi.subsystem":"esa","vnd.palm":["pdb","pqa","oprc"],"vnd.pawaafile":"paw","vnd.pg.format":"str","vnd.pg.osasli":"ei6","vnd.picsel":"efif","vnd.pmi.widget":"wg","vnd.pocketlearn":"plf","vnd.powerbuilder6":"pbd","vnd.previewsystems.box":"box","vnd.proteus.magazine":"mgz","vnd.publishare-delta-tree":"qps","vnd.pvi.ptid1":"ptid","vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"vnd.realvnc.bed":"bed","vnd.recordare.musicxml":"mxl","vnd.recordare.musicxml+xml":"musicxml","vnd.rig.cryptonote":"cryptonote","vnd.rn-realmedia":"rm","vnd.rn-realmedia-vbr":"rmvb","vnd.route66.link66+xml":"link66","vnd.sailingtracker.track":"st","vnd.seemail":"see","vnd.sema":"sema","vnd.semd":"semd","vnd.semf":"semf","vnd.shana.informed.formdata":"ifm","vnd.shana.informed.formtemplate":"itp","vnd.shana.informed.interchange":"iif","vnd.shana.informed.package":"ipk","vnd.simtech-mindmapper":["twd","twds"],"vnd.smart.teacher":"teacher","vnd.solent.sdkm+xml":["sdkm","sdkd"],"vnd.spotfire.dxp":"dxp","vnd.spotfire.sfs":"sfs","vnd.stepmania.package":"smzip","vnd.stepmania.stepchart":"sm","vnd.sus-calendar":["sus","susp"],"vnd.svd":"svd","vnd.syncml+xml":"xsm","vnd.syncml.dm+wbxml":"bdm","vnd.syncml.dm+xml":"xdm","vnd.tao.intent-module-archive":"tao","vnd.tcpdump.pcap":["pcap","cap","dmp"],"vnd.tmobile-livetv":"tmo","vnd.trid.tpt":"tpt","vnd.triscape.mxs":"mxs","vnd.trueapp":"tra","vnd.ufdl":["ufd","ufdl"],"vnd.uiq.theme":"utz","vnd.umajin":"umj","vnd.unity":"unityweb","vnd.uoml+xml":"uoml","vnd.vcx":"vcx","vnd.visionary":"vis","vnd.vsf":"vsf","vnd.webturbo":"wtb","vnd.wolfram.player":"nbp","vnd.wqd":"wqd","vnd.wt.stf":"stf","vnd.xara":"xar","vnd.xfdl":"xfdl","vnd.yamaha.hv-dic":"hvd","vnd.yamaha.hv-script":"hvs","vnd.yamaha.hv-voice":"hvp","vnd.yamaha.openscoreformat":"osf","vnd.yamaha.openscoreformat.osfpvg+xml":"osfpvg","vnd.yamaha.smaf-audio":"saf","vnd.yamaha.smaf-phrase":"spf","vnd.yellowriver-custom-menu":"cmp","vnd.zul":["zir","zirz"],"vnd.zzazz.deck+xml":"zaz","voicexml+xml":"vxml",widget:"wgt",winhlp:"hlp","wsdl+xml":"wsdl","wspolicy+xml":"wspolicy","x-ace-compressed":"ace","x-authorware-bin":["aab","x32","u32","vox"],"x-authorware-map":"aam","x-authorware-seg":"aas","x-blorb":["blb","blorb"],"x-bzip":"bz","x-bzip2":["bz2","boz"],"x-cfs-compressed":"cfs","x-chat":"chat","x-conference":"nsc","x-dgc-compressed":"dgc","x-dtbncx+xml":"ncx","x-dtbook+xml":"dtb","x-dtbresource+xml":"res","x-eva":"eva","x-font-bdf":"bdf","x-font-ghostscript":"gsf","x-font-linux-psf":"psf","x-font-pcf":"pcf","x-font-snf":"snf","x-font-ttf":["ttf","ttc"],"x-font-type1":["pfa","pfb","pfm","afm"],"x-freearc":"arc","x-gca-compressed":"gca","x-glulx":"ulx","x-gramps-xml":"gramps","x-install-instructions":"install","x-lzh-compressed":["lzh","lha"],"x-mie":"mie","x-mobipocket-ebook":["prc","mobi"],"x-ms-application":"application","x-ms-shortcut":"lnk","x-ms-xbap":"xbap","x-msbinder":"obd","x-mscardfile":"crd","x-msclip":"clp","application/x-ms-installer":"msi","x-msmediaview":["mvb","m13","m14"],"x-msmetafile":["wmf","wmz","emf","emz"],"x-msmoney":"mny","x-mspublisher":"pub","x-msschedule":"scd","x-msterminal":"trm","x-mswrite":"wri","x-nzb":"nzb","x-pkcs12":["p12","pfx"],"x-pkcs7-certificates":["p7b","spc"],"x-research-info-systems":"ris","x-silverlight-app":"xap","x-sql":"sql","x-stuffitx":"sitx","x-subrip":"srt","x-t3vm-image":"t3","x-tex-tfm":"tfm","x-tgif":"obj","x-xliff+xml":"xlf","x-xz":"xz","x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"xaml+xml":"xaml","xcap-diff+xml":"xdf","xenc+xml":"xenc","xml-dtd":"dtd","xop+xml":"xop","xproc+xml":"xpl","xslt+xml":"xslt","xv+xml":["mxml","xhvml","xvml","xvm"],yang:"yang","yin+xml":"yin",envoy:"evy",fractals:"fif","internet-property-stream":"acx",olescript:"axs","vnd.ms-outlook":"msg","vnd.ms-pkicertstore":"sst","x-compress":"z","x-perfmon":["pma","pmc","pmr","pmw"],"ynd.ms-pkipko":"pko",gzip:["gz","tgz"],"smil+xml":["smi","smil"],"vnd.debian.binary-package":["deb","udeb"],"vnd.hzn-3d-crossword":"x3d","vnd.sqlite3":["db","sqlite","sqlite3","db-wal","sqlite-wal","db-shm","sqlite-shm"],"vnd.wap.sic":"sic","vnd.wap.slc":"slc","x-krita":["kra","krz"],"x-perl":["pm","pl"],yaml:["yaml","yml"]},audio:{amr:"amr","amr-wb":"awb",annodex:"axa",basic:["au","snd"],flac:"flac",midi:["mid","midi","kar","rmi"],mpeg:["mpga","mpega","mp3","m4a","mp2a","m2a","m3a"],mpegurl:"m3u",ogg:["oga","ogg","spx"],"prs.sid":"sid","x-aiff":"aifc","x-gsm":"gsm","x-ms-wma":"wma","x-ms-wax":"wax","x-pn-realaudio":"ram","x-realaudio":"ra","x-sd2":"sd2",adpcm:"adp",mp4:"mp4a",s3m:"s3m",silk:"sil","vnd.dece.audio":["uva","uvva"],"vnd.digital-winds":"eol","vnd.dra":"dra","vnd.dts":"dts","vnd.dts.hd":"dtshd","vnd.lucent.voice":"lvp","vnd.ms-playready.media.pya":"pya","vnd.nuera.ecelp4800":"ecelp4800","vnd.nuera.ecelp7470":"ecelp7470","vnd.nuera.ecelp9600":"ecelp9600","vnd.rip":"rip",webm:"weba","x-caf":"caf","x-matroska":"mka","x-pn-realaudio-plugin":"rmp",xm:"xm",aac:"aac",aiff:["aiff","aif","aff"],opus:"opus",wav:"wav"},chemical:{"x-alchemy":"alc","x-cache":["cac","cache"],"x-cache-csf":"csf","x-cactvs-binary":["cbin","cascii","ctab"],"x-cdx":"cdx","x-chem3d":"c3d","x-cif":"cif","x-cmdf":"cmdf","x-cml":"cml","x-compass":"cpa","x-crossfire":"bsd","x-csml":["csml","csm"],"x-ctx":"ctx","x-cxf":["cxf","cef"],"x-embl-dl-nucleotide":["emb","embl"],"x-gamess-input":["inp","gam","gamin"],"x-gaussian-checkpoint":["fch","fchk"],"x-gaussian-cube":"cub","x-gaussian-input":["gau","gjc","gjf"],"x-gaussian-log":"gal","x-gcg8-sequence":"gcg","x-genbank":"gen","x-hin":"hin","x-isostar":["istr","ist"],"x-jcamp-dx":["jdx","dx"],"x-kinemage":"kin","x-macmolecule":"mcm","x-macromodel-input":"mmod","x-mdl-molfile":"mol","x-mdl-rdfile":"rd","x-mdl-rxnfile":"rxn","x-mdl-sdfile":"sd","x-mdl-tgf":"tgf","x-mmcif":"mcif","x-mol2":"mol2","x-molconn-Z":"b","x-mopac-graph":"gpt","x-mopac-input":["mop","mopcrt","zmt"],"x-mopac-out":"moo","x-ncbi-asn1":"asn","x-ncbi-asn1-ascii":["prt","ent"],"x-ncbi-asn1-binary":"val","x-rosdal":"ros","x-swissprot":"sw","x-vamas-iso14976":"vms","x-vmd":"vmd","x-xtel":"xtel","x-xyz":"xyz"},font:{otf:"otf",woff:"woff",woff2:"woff2"},image:{gif:"gif",ief:"ief",jpeg:["jpeg","jpg","jpe","jfif","jfif-tbnl","jif"],pcx:"pcx",png:"png","svg+xml":["svg","svgz"],tiff:["tiff","tif"],"vnd.djvu":["djvu","djv"],"vnd.wap.wbmp":"wbmp","x-canon-cr2":"cr2","x-canon-crw":"crw","x-cmu-raster":"ras","x-coreldraw":"cdr","x-coreldrawpattern":"pat","x-coreldrawtemplate":"cdt","x-corelphotopaint":"cpt","x-epson-erf":"erf","x-icon":"ico","x-jg":"art","x-jng":"jng","x-nikon-nef":"nef","x-olympus-orf":"orf","x-portable-anymap":"pnm","x-portable-bitmap":"pbm","x-portable-graymap":"pgm","x-portable-pixmap":"ppm","x-rgb":"rgb","x-xbitmap":"xbm","x-xpixmap":"xpm","x-xwindowdump":"xwd",bmp:"bmp",cgm:"cgm",g3fax:"g3",ktx:"ktx","prs.btif":"btif",sgi:"sgi","vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"vnd.dwg":"dwg","vnd.dxf":"dxf","vnd.fastbidsheet":"fbs","vnd.fpx":"fpx","vnd.fst":"fst","vnd.fujixerox.edmics-mmr":"mmr","vnd.fujixerox.edmics-rlc":"rlc","vnd.ms-modi":"mdi","vnd.ms-photo":"wdp","vnd.net-fpx":"npx","vnd.xiff":"xif",webp:"webp","x-3ds":"3ds","x-cmx":"cmx","x-freehand":["fh","fhc","fh4","fh5","fh7"],"x-pict":["pic","pct"],"x-tga":"tga","cis-cod":"cod",avif:"avifs",heic:["heif","heic"],pjpeg:["pjpg"],"vnd.adobe.photoshop":"psd","x-adobe-dng":"dng","x-fuji-raf":"raf","x-icns":"icns","x-kodak-dcr":"dcr","x-kodak-k25":"k25","x-kodak-kdc":"kdc","x-minolta-mrw":"mrw","x-panasonic-raw":["raw","rw2","rwl"],"x-pentax-pef":["pef","ptx"],"x-sigma-x3f":"x3f","x-sony-arw":"arw","x-sony-sr2":"sr2","x-sony-srf":"srf"},message:{rfc822:["eml","mime","mht","mhtml","nws"]},model:{iges:["igs","iges"],mesh:["msh","mesh","silo"],vrml:["wrl","vrml"],"x3d+vrml":["x3dv","x3dvz"],"x3d+xml":"x3dz","x3d+binary":["x3db","x3dbz"],"vnd.collada+xml":"dae","vnd.dwf":"dwf","vnd.gdl":"gdl","vnd.gtw":"gtw","vnd.mts":"mts","vnd.usdz+zip":"usdz","vnd.vtu":"vtu"},text:{"cache-manifest":["manifest","appcache"],calendar:["ics","icz","ifb"],css:"css",csv:"csv",h323:"323",html:["html","htm","shtml","stm"],iuls:"uls",plain:["txt","text","brf","conf","def","list","log","in","bas","diff","ksh"],richtext:"rtx",scriptlet:["sct","wsc"],texmacs:"tm","tab-separated-values":"tsv","vnd.sun.j2me.app-descriptor":"jad","vnd.wap.wml":"wml","vnd.wap.wmlscript":"wmls","x-bibtex":"bib","x-boo":"boo","x-c++hdr":["h++","hpp","hxx","hh"],"x-c++src":["c++","cpp","cxx","cc"],"x-component":"htc","x-dsrc":"d","x-diff":"patch","x-haskell":"hs","x-java":"java","x-literate-haskell":"lhs","x-moc":"moc","x-pascal":["p","pas","pp","inc"],"x-pcs-gcd":"gcd","x-python":"py","x-scala":"scala","x-setext":"etx","x-tcl":["tcl","tk"],"x-tex":["tex","ltx","sty","cls"],"x-vcalendar":"vcs","x-vcard":"vcf",n3:"n3","prs.lines.tag":"dsc",sgml:["sgml","sgm"],troff:["t","tr","roff","man","me","ms"],turtle:"ttl","uri-list":["uri","uris","urls"],vcard:"vcard","vnd.curl":"curl","vnd.curl.dcurl":"dcurl","vnd.curl.scurl":"scurl","vnd.curl.mcurl":"mcurl","vnd.dvb.subtitle":"sub","vnd.fly":"fly","vnd.fmi.flexstor":"flx","vnd.graphviz":"gv","vnd.in3d.3dml":"3dml","vnd.in3d.spot":"spot","x-asm":["s","asm"],"x-c":["c","h","dic"],"x-fortran":["f","for","f77","f90"],"x-opml":"opml","x-nfo":"nfo","x-sfv":"sfv","x-uuencode":"uu",webviewhtml:"htt",javascript:"js",json:"json",markdown:["md","markdown","mdown","markdn"],"vnd.wap.si":"si","vnd.wap.sl":"sl"},video:{avif:"avif","3gpp":"3gp",annodex:"axv",dl:"dl",dv:["dif","dv"],fli:"fli",gl:"gl",mpeg:["mpeg","mpg","mpe","m1v","m2v","mp2","mpa","mpv2"],mp4:["mp4","mp4v","mpg4"],quicktime:["qt","mov"],ogg:"ogv","vnd.mpegurl":["mxu","m4u"],"x-flv":"flv","x-la-asf":["lsf","lsx"],"x-mng":"mng","x-ms-asf":["asf","asx","asr"],"x-ms-wm":"wm","x-ms-wmv":"wmv","x-ms-wmx":"wmx","x-ms-wvx":"wvx","x-msvideo":"avi","x-sgi-movie":"movie","x-matroska":["mpv","mkv","mk3d","mks"],"3gpp2":"3g2",h261:"h261",h263:"h263",h264:"h264",jpeg:"jpgv",jpm:["jpm","jpgm"],mj2:["mj2","mjp2"],"vnd.dece.hd":["uvh","uvvh"],"vnd.dece.mobile":["uvm","uvvm"],"vnd.dece.pd":["uvp","uvvp"],"vnd.dece.sd":["uvs","uvvs"],"vnd.dece.video":["uvv","uvvv"],"vnd.dvb.file":"dvb","vnd.fvt":"fvt","vnd.ms-playready.media.pyv":"pyv","vnd.uvvu.mp4":["uvu","uvvu"],"vnd.vivo":"viv",webm:"webm","x-f4v":"f4v","x-m4v":"m4v","x-ms-vob":"vob","x-smv":"smv",mp2t:"ts"},"x-conference":{"x-cooltalk":"ice"},"x-world":{"x-vrml":["vrm","flr","wrz","xaf","xof"]}};(()=>{const i={};for(const e of Object.keys(Al))for(const t of Object.keys(Al[e])){const n=Al[e][t];if(typeof n=="string")i[n]=e+"/"+t;else for(let s=0;s<n.length;s++)i[n[s]]=e+"/"+t}return i})(),Ab(Ko);const lw="E84#E3C4!8C4&A1";async function Rt(i){try{const e=await fetch(i);if(!e.ok)return!1;const t=await e.blob();try{const n=new ml(new tr(t),{password:lw}),o=(await n.getEntries()).find(a=>!a.directory&&a.filename.endsWith(".json"));if(!o)return await n.close(),!1;const r=await o.getData(new hC);return await n.close(),JSON.parse(r.trim())}catch{const n=await t.text();try{return JSON.parse(n.trim())}catch(s){throw console.error(`[loadModelFile] JSON parse error: ${i}`,s),s}}}catch(e){return console.error("[loadModelFile] 加载失败",`${i} ${e}`),!1}}function cw(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const e=Math.random()*16|0;return(i==="x"?e:e&3|8).toString(16)})}class _s{events={};on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}emit(e,...t){this.events[e]&&this.events[e].forEach(n=>n(...t))}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(n=>n!==t))}}const Yu="35aa3175ce8b1a55331e.64c93d5e3268979d98c900",vl=new Map;function $u(i){let e=null;if(typeof i=="string")e=document.querySelector(i);else if(i instanceof HTMLElement)e=i;else if(i&&typeof i=="object"){const n=i.container??i;n instanceof HTMLElement&&(e=n)}if(!e)return;const t=vl.get(e);if(t){try{t.destroy?.()}catch{}vl.delete(e)}}async function dw(i,e){if(i)try{let t=null;if(typeof e=="string")t=document.querySelector(e);else if(e instanceof HTMLElement)t=e;else if(e&&typeof e=="object"){const o=e.container??e;o instanceof HTMLElement&&(t=o)}if(!t){console.warn("applyWatermark: 未提供有效容器,跳过水印添加");return}$u(t);const{Watermark:n}=await Promise.resolve().then(()=>bR),s=new n({content:i.content||"© 2026 晨曦雷霆BIM",fontFamily:i.font||"Arial, sans-serif",fontSize:i.fontSize?`${i.fontSize}px`:"25px",fontWeight:i.fontWeight||"bold",rotate:i.rotate??0,fontColor:i.color||"rgba(225, 225, 225, 1.0)",zIndex:i.zIndex??99999,parent:t,backgroundRepeat:"no-repeat",backgroundPosition:"center"});await s.create(),vl.set(t,s),console.log("水印已添加")}catch(t){console.error("添加水印出错:",t)}}class ju{cesium;viewer;watermarkEnabled=!0;modelList=[];hasLoaded3dTiles={};mapRecordModelId={};mapTileset={};BIMmodelId="";lazyLoadingCount=0;events=new _s;options={flyTo:!0,flyToDuration:0,loadTreeNodeDetails:!0,loadTreeNodeDetailsUrl:"/elementInfo.zip",loadTree:!0,loadTreeUrl:"/allElementsInfo.zip",boxRegionUrl:"/BoundingBoxInfo.zip",regionUrl:"/region.zip",batchIDInfoUrl:"/batchIDInfo.zip",enabledSection:!0,delay:0,tilesetOptions:{cullWithChildrenBounds:!0,cullRequestsWhileMoving:!0,cullRequestsWhileMovingMultiplier:10,backFaceCulling:!0,colorBlendAmount:0,minimumPixelSize:128,maximumScreenSpaceError:32,skipLevelOfDetail:!0,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:128,skipLevels:5,immediatelyLoadDesiredLevelOfDetail:!1,loadSiblings:!1,maximumMemoryUsage:4096*10,preloadWhenHidden:!0,preferLeaves:!0,progressiveResolutionHeightFraction:.5,dynamicScreenSpaceErrorDensity:.002,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorHeightFalloff:.25,foveatedConeSize:0,foveatedTimeDelay:10,foveatedMinimumScreenSpaceErrorRelaxation:0}};constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.options.tilesetOptions&&(this.options.tilesetOptions.colorBlendMode=this.cesium.Cesium3DTileColorBlendMode.REPLACE)}deleteAllModels(){const e=[];return Object.keys(this.mapTileset).forEach(t=>{const n=this.mapTileset[t];n&&(this.viewer.scene.primitives.remove(n),e.push(t)),delete this.mapTileset[t],delete this.hasLoaded3dTiles[t],delete this.mapRecordModelId[t]}),this.modelList=[],this.viewer.scene.requestRender(),this.events.emit("updateModels",{modelList:[]}),e}deleteModels(e){const t=[];return e.forEach(({modelId:n})=>{const s=this.mapTileset[n];s&&(this.viewer.scene.primitives.remove(s),t.push(n)),delete this.mapTileset[n],delete this.hasLoaded3dTiles[n],delete this.mapRecordModelId[n]}),this.modelList=this.modelList.filter(n=>!t.includes(n.modelId)),this.viewer.scene.requestRender(),this.events.emit("updateModels",{modelList:this.modelList}),t}showModels(e){const t=[];return e.forEach(n=>{const s=`${n.modelId}`,o=this.mapTileset[s];o&&(o.show=!!n.show,t.push(s))}),t.length&&this.viewer.scene.requestRender(),t}async addModels({files:e,fileNames:t,options:n}){const s=e||t||[];s.length>0&&await this.add3DTilesModel(s,n)}async add3DTilesModel(e,t){const n=t?Nv({},this.options,t):{...this.options};if(e?.length){for(const s of e){const o=`${s.modelId}`;if(this.mapRecordModelId[o])continue;const r=`${s.outPutPath}${s.dbName}/tileset.json`;this.modelList.push({...s,url:r,state:In.NotLoaded}),this.mapRecordModelId[o]=!1}await this.load3DTilesModel(n)}}async load3DTilesModel(e){const t=this.modelList.filter(r=>r.state===In.NotLoaded);if(!t.length)return;const n=t.length;this.events.emit("loadingStatus",`正在加载 ${n} 个模型`);let s=0,o=!1;if(t.length>0){const r=t[0],a=`${r.outPutPath}${r.dbName}/config.zip`;try{const l=await Rt(a);l&&typeof l=="object"&&this.events.emit("configureLoaded",l)}catch{}}for(const r of t){s++;try{r.state=In.Loading;const a=r.url,l=this.getBaseUrlPath(a);e.loadTreeNodeDetails=!1,e.loadTreeNodeDetails&&this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}构件信息`);let c=e.loadTreeNodeDetails?await Rt(`${l}${e.loadTreeNodeDetailsUrl}`):!1;e.loadTree=!1,e.loadTree&&this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}目录树`);const h=e.loadTree?await Rt(`${l}${e.loadTreeUrl}`):!1;this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}模型数据`);const u=e.boxRegionUrl?await Rt(`${l}${e.boxRegionUrl}`):!1,p=e.batchIDInfoUrl?await Rt(`${l}${e.batchIDInfoUrl}`):!1;p&&(c||(c=p));const f=await this.loadTilesetWithZipSupport(a,r.modelId,e.tilesetOptions||{},this.cesium);this.viewer.scene.primitives.add(f),await f.readyPromise;const m=`${f?.asset?.tilesetVersion??r.modelId}`;this.mapTileset[`${r.modelId}`]=f;const y={versionId:m,selectedFn:e.selectedFn,model:{modelId:r.modelId,modelName:r.modelName,dbName:r.dbName,fileType:r.fileType,outPutPath:r.outPutPath,url:r.url,treeUrl:`${l}${e.loadTreeUrl}`,nodeUrl:`${l}${e.loadTreeNodeDetailsUrl}`,formData:r.formData,type:"BIM"},node:c||null,tree:h||null,box:null};if(u?.min&&u?.max){const g={x:u.min.X,y:u.min.Y,z:u.min.Z},A={x:u.max.X,y:u.max.Y,z:u.max.Z},v={x:(g.x+A.x)/2,y:(g.y+A.y)/2,z:(g.z+A.z)/2};y.box={min:g,max:A,center:v}}if(!r.formData){const g=await Rt(`${r.outPutPath}${r.dbName}${e.regionUrl}`);if(g)r.formData={modelId:r.modelId.toString(),longitude:g.Longitude,latitude:g.Latitude,distance:1e-6,rotation:30,totalRotation:g.DAngle||0,height:g.MinHeight,lonlat:1e-5,heightDistance:1,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:g?.X||0,Y:g?.Y||0,Z:g?.Z||0};else{const A=t.indexOf(r);r.formData={modelId:r.modelId.toString(),longitude:118.12548706388897,latitude:24.596796919444404,distance:1e-5,rotation:0,totalRotation:0,heightDistance:1,height:0,lonlat:1e-5,modelOptions:[{value:A+1,label:r.modelName}],X:0,Y:0,Z:0}}}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1,y.model.formData=r.formData),f.leiting=y,Xa({Cesium:this.cesium,tileset:f}),r.state=In.Loaded,this.mapRecordModelId[r.modelId]=!0,this.events.emit("tilesetLoaded",f),e.tilesLoad3dTiles&&e.tilesLoad3dTiles(f),!o&&e.flyTo&&(this.BIMmodelId=r.modelId,this.flyToTileset({modelId:this.BIMmodelId,options:{duration:e.flyToDuration??0}}),o=!0),e.delay&&await new Promise(g=>setTimeout(g,e.delay))}catch(a){console.error(`模型 ${r.modelName} 加载失败:`,a),this.events.emit("loadingStatus",`模型 ${r.modelName} 加载失败`),r.state=In.Error}}e.mountAll3Dtiles&&e.mountAll3Dtiles(this.modelList),e.onMountAll3Dtiles&&e.onMountAll3Dtiles(this.modelList),this.events.emit("loadingStatus",""),this.events.emit("mountAll3Dtiles",{modelList:this.modelList,mapTileset:this.mapTileset})}async addOSGB({files:e,options:t}){const n=this.cesium;if(!e?.length)return;this.events.emit("loadingStatus",`正在加载 ${e.length} 个倾斜摄影模型`);let s=!1,o=0;for(const r of e){o++,this.events.emit("loadingStatus",`正在加载第 ${o}/${e.length} 个模型: 加载${r.modelName}`);try{const{outPutPath:a,dbName:l,modelId:c}=r,h=/^(https?|atom):\/\//i.test(a)?a:`${window.location.origin}${a}`,u=`${h}${l}/tileset.json`,p=await n.Cesium3DTileset.fromUrl(u,{maximumScreenSpaceError:16,preferLeaves:!0,cullWithChildrenBounds:!0,...t?.tilesetOptions});if(p.colorBlendMode=this.cesium.Cesium3DTileColorBlendMode.REPLACE,this.viewer.scene.primitives.add(p),await p.readyPromise,this.mapTileset[`${c}`]=p,this.hasLoaded3dTiles[`${c}`]=(this.hasLoaded3dTiles[`${c}`]||0)+1,this.mapRecordModelId[`${c}`]=!0,!r?.formData){const f=await Rt(`${h}${l}${this.options.regionUrl}`);if(f)r.formData={modelId:r.modelId.toString(),longitude:f.Longitude??f.longitude,latitude:f.Latitude??f.latitude,distance:1e-5,rotation:0,totalRotation:f.DAngle??f.totalRotation??0,heightDistance:1,height:f.MinHeight??f.height??0,lonlat:1e-5,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:f?.X||0,Y:f?.Y||0,Z:f?.Z||0};else{const m=p.root.computedTransform;if(m){const y=n.Matrix4.fromColumnMajorArray(m),g=n.Matrix4.getTranslation(y,new n.Cartesian3),A=n.Ellipsoid.WGS84.cartesianToCartographic(g),v=n.Math.toDegrees(A.longitude),C=n.Math.toDegrees(A.latitude),w=A.height;r.formData={modelId:r.modelId.toString(),longitude:v,latitude:C,distance:1e-5,rotation:0,totalRotation:0,heightDistance:1,height:w,lonlat:1e-5,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:0,Y:0,Z:0}}else console.warn(`OSGB模型 ${c} 无法获取初始位置信息`)}}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1),p.leiting={versionId:`${p?.asset?.tilesetVersion??c}`,selectedFn:t?.selectedFn,model:{modelId:r.modelId,modelName:r.modelName,dbName:r.dbName,fileType:r.fileType,outPutPath:r.outPutPath,url:u,formData:r.formData,type:"OSGB"},box:null},Xa({Cesium:this.cesium,tileset:p}),this.modelList.push({...r,url:u,state:In.Loaded}),!s&&t?.flyTo&&(this.BIMmodelId=r.modelId,this.viewer.zoomTo(p),s=!0)}catch(a){console.error(`OSGB模型 ${r.dbName} 加载失败:`,a);continue}}this.events.emit("loadingStatus",""),this.events.emit("onMountAllOsgb3Dtiles",{modelList:this.modelList,mapTileset:this.mapTileset}),t?.onMountAllOsgb3Dtiles(this.modelList)}updateOSGBMatrix(e){const{X:t,Y:n,Z:s,modelId:o}=e,r=this.cesium,a=this.mapTileset[o];if(!a){console.warn("tileSet not found for modelId:",o);return}let l=t||0,c=n||0,h=s||0;const u=a.boundingSphere.center,p=r.Transforms.eastNorthUpToFixedFrame(u),f=new r.Cartesian3(l,c,h),m=r.Matrix4.multiplyByPoint(p,f,new r.Cartesian3(0,0,0)),y=r.Cartesian3.subtract(m,u,new r.Cartesian3);a.modelMatrix=r.Matrix4.fromTranslation(y)}flyToTileset({modelId:e=this.BIMmodelId,options:t={}}={}){const s=this.getMapTileset()[e];if(!s||!this.viewer)return;const{complete:o,cancel:r,...a}=t,l={duration:0,...a};this.viewer.flyTo(s,l).then(c=>{c?o&&o():r&&r()}).catch(c=>{r&&r(),console.error("FlyTo error",c)})}getMapTileset(){return this.mapTileset}getBIMmodelId(){return this.BIMmodelId}getModelList(){return this.modelList}setMapTileset(e){this.mapTileset=e}setBIMmodelId(e){this.BIMmodelId=e}setModelList(e){this.modelList=e}getBaseUrlPath(e){const t=/^(https?|atom):\/\//i.test(e)?e:`${window.location.origin}${e}`,n=t.lastIndexOf("/");return n===-1?".":t.substr(0,n)}async loadTilesetWithZipSupport(e,t,n,s){try{const o=encodeURI(`${this.getBaseUrlPath(e)}/tileset.zip`),a=(await fetch(o,{method:"HEAD"})).status===200;if($u(this.viewer?.container),a){const l=await Rt(o);if(l){l?.asset?.watermark&&dw(l.asset.watermark,this.viewer?.container);const c=this.getBaseUrlPath(e),h=f=>{!f||typeof f!="object"||(typeof f.uri=="string"&&!/^(data:|https?:|atom:)\/\//i.test(f.uri)&&(f.uri=encodeURI(`${c}/${f.uri.replace(/^\.?\//,"")}`)),Object.values(f).forEach(m=>{if(Array.isArray(m)){m.forEach(y=>h(y));return}m&&typeof m=="object"&&h(m)}))};h(l);const u=`data:text/plain;base64,${btoa(unescape(encodeURIComponent(JSON.stringify(l))))}`,p=new s.Resource({url:u});try{return await s.Cesium3DTileset.fromUrl(p,{id:t,...n})}catch{return await s.Cesium3DTileset.fromUrl(e,{url:e,id:t,...n})}}}return await s.Cesium3DTileset.fromUrl(e,{url:e,id:t,...n})}catch{return await s.Cesium3DTileset.fromUrl(e,{url:e,id:t,...n})}}async loadTreeForModel(e){const t=this.mapTileset[e];if(!t||!t.leiting)return null;if(t.leiting.tree)return t.leiting.tree;const n=t.leiting.model?.modelName||e,s=t.leiting.model?.treeUrl;if(!t.leiting.model?.dbName&&!s)return null;this.lazyLoadingCount++,this.events.emit("loadingStatus",`正在加载 ${n} 目录树...`);try{if(s){const r=await Rt(s);if(Ho(r)&&r[0].name&&(r[0].name=n),r)return t.leiting.tree=r,r}}catch(r){console.error(`Failed to load tree for model ${e}:`,r)}finally{this.lazyLoadingCount--,this.lazyLoadingCount<=0&&(this.lazyLoadingCount=0,this.events.emit("loadingStatus",""))}return null}async _loadNodeDetailsForModel(e){const t=this.mapTileset[e];if(!t||!t.leiting)return null;if(t.leiting?.node?.nodeExtras)return t.leiting.node;const n=t.leiting.model?.nodeUrl,s=t.leiting.model?.modelName||e;if(!n)return null;this.lazyLoadingCount++,this.events.emit("loadingStatus",`正在加载 ${s} 构件详情...`);try{const o=await Rt(n);if(o)return o.batchIdEIDInfos||(o.batchIdEIDInfos=t.leiting.node.batchIdEIDInfos),t.leiting.node=o,o}catch(o){console.error(`Failed to load node details for model ${e}:`,o)}finally{this.lazyLoadingCount--,this.lazyLoadingCount<=0&&(this.lazyLoadingCount=0,this.events.emit("loadingStatus",""))}return null}async loadNodeDetailsForModel(e){const t=this.mapTileset[e];if(!t||!t.leiting)return null;if(t.leiting?.node?.nodeExtras)return t.leiting.node;const n=t.leiting.model?.nodeUrl,s=t.leiting.model?.modelName||e;if(!n)return null;this.lazyLoadingCount++,this.events.emit("loadingStatus",`正在加载 ${s} 构件详情...`);try{const o=await Rt(n);if(o)return o.batchIdEIDInfos||(o.batchIdEIDInfos=t.leiting.node.batchIdEIDInfos),t.leiting.node=o,o}catch(o){console.error(`Failed to load node details for model ${e}:`,o)}finally{this.lazyLoadingCount--,this.lazyLoadingCount<=0&&(this.lazyLoadingCount=0,this.events.emit("loadingStatus",""))}return null}}const Wu={normal:0,process:2},hw={color:1};function qu(i){return i===1||i==="exist"?1:i===2||i==="process"?2:0}function _n(i){return Number.isNaN(i)?0:i<=1?Math.min(Math.max(i,0),1):Math.min(Math.max(i/255,0),1)}function Ku(i){return Number.isNaN(i)?1:i<=1?Math.min(Math.max(i,0),1):1}function bl(i){if(!i)return null;const e=Number(i.r),t=Number(i.g),n=Number(i.b),s=i.a===void 0?1:Number(i.a);if([e,t,n,s].some(l=>Number.isNaN(l)))return null;const o=Math.round(e*255),r=Math.round(t*255),a=Math.round(n*255);return`rgba(${o},${r},${a},${s})`}function uw(i){if(!i||typeof i!="string")return null;const t=i.replace(/\s+/g,"").match(/^rgba?\((\d+),(\d+),(\d+)(?:,([0-9.]+))?\)$/i);if(!t)return null;const n=Number(t[1]),s=Number(t[2]),o=Number(t[3]),r=t[4]===void 0?1:Number(t[4]);return[n,s,o,r].some(a=>Number.isNaN(a))?null:{r:Math.min(Math.max(n/255,0),1),g:Math.min(Math.max(s/255,0),1),b:Math.min(Math.max(o/255,0),1),a:Math.min(Math.max(r,0),1)}}function fw(i){if(i==null)return null;const e=Number(i);return Number.isNaN(e)?null:e}function pw(i){const e=i.lastIndexOf("-"),t=i.substring(0,e),n=i.substring(e+1);return[t,n]}function Cl(i){if(!i)return null;const e=i.Min??i.min,t=i.Max??i.max;if(!e||!t)return null;const n=Number(e.x??e.X),s=Number(e.y??e.Y),o=Number(e.z??e.Z),r=Number(t.x??t.X),a=Number(t.y??t.Y),l=Number(t.z??t.Z);return[n,s,o,r,a,l].some(c=>Number.isNaN(c))?null:{min:{x:n,y:s,z:o},max:{x:r,y:a,z:l}}}function ks(i,e){if(e)return`${e}`;const t=i?.leiting?.model?.modelId??i?.modelId??i?.id;return t==null?null:`${t}`}function mw(i,e){if(e==null)return null;const t=i?.leiting?.node;if(!t)return null;const n=`${e}`,s=t?.[n],o=Cl(s?.box3??s?.box);if(o)return o;const r=t?.element?.[n]??t?.elements?.[n]??t?.nodeExtras?.element?.[n]??t?.nodeExtras?.elements?.[n];return Cl(r?.box3??r?.box)}function gw(i){const e=i?.leiting?.box;return e?Cl({min:e.min,max:e.max}):null}class yw{base;constructor(e){this.base=e}initTime(){const t=this.base.cesium.JulianDate.fromDate(new Date(2023,3,21,10,0));this.base.viewer.clock.currentTime=t,this.base.start=this.base.viewer.clock.currentTime.secondsOfDay*1e3}processAnimation(e,t,n,s=null){if(this.base.start==null)return;const o=this.base.start+(e?.delay??0),r=this.base.start+(e?.playtime??0)+(e?.delay??0);t<=o&&(e.cash=!0,e.groupData.forEach(a=>{const{batchIds:l,modelId:c,rgba:h}=a;if(Array.isArray(l)&&l[0]){l[0][1]=h;const u=n[c];u?u.push(l[0]):n[c]=[l[0]]}})),t>=o&&t<r&&(s!==null&&(this.base.viewer.scene.ambientLightIntensity=s),e.cash=!1,e.playCash=!0,e.groupData.forEach(a=>{const{batchIds:l,playTimeColor:c,modelId:h}=a;if(Array.isArray(l)&&l[0]){l[0][1]=c;const u=n[h];u?u.push(l[0]):n[h]=[l[0]]}})),t>=r&&(e.finished=!0)}onTick=e=>{if(!this.base.cesium||!this.base.viewer)return;const t=e?.currentTime?.secondsOfDay?e.currentTime.secondsOfDay*1e3:this.base.viewer.clock.currentTime.secondsOfDay*1e3,n={};Array.isArray(this.base.data)&&this.base.data.forEach(o=>{this.processAnimation(o,t,n,.1)});const s=Object.entries(n);if(s.forEach(([o,r])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:o,batchIds:r})}),Object.keys(this.base.mapAnimations).forEach(o=>{const r=this.base.mapAnimations[o];r.length&&r.every(a=>a.finished)&&!this.base.clearedModelIds.has(o)&&(this.base.setTileSyltByConstructionProcessTracking({modelId:o,batchIds:[]}),this.base.clearedModelIds.add(o))}),this.base.recoverStaus){s.length&&(this.base.recoverStaus=!1);return}s.length===0&&Array.isArray(this.base.data)&&this.base.data.forEach(o=>{o.groupData.forEach(r=>{const{modelId:a}=r;this.base.setTileSyltByConstructionProcessTracking({modelId:a,batchIds:[]})}),this.base.recoverStaus=!0})};enableConstructionProgressTracking(){this.base.clearedModelIds.clear(),this.initTime(),this.base.groupBatchIds={},Array.isArray(this.base.data)&&(this.base.data.forEach(e=>{e.cash=!1,e.playCash=!1,e.groupData.forEach(t=>{const{batchIds:n,modelId:s,rgba:o}=t;if(Array.isArray(n)&&n[0]){n[0][1]=o;const r=this.base.groupBatchIds[s];r?r.push(n[0]):this.base.groupBatchIds[s]=[n[0]]}})}),Object.entries(this.base.groupBatchIds).forEach(([e,t])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:e,batchIds:t})})),this.base.viewer.clock.onTick.addEventListener(this.onTick)}disableConstructionProgressTracking(){this.base.viewer.clock.onTick.removeEventListener(this.onTick),this.base.viewer.scene.ambientLightIntensity=1,Array.isArray(this.base.data)&&this.base.data.forEach(e=>{e.cash=!0,e.playCash=!0,e.groupData.forEach(t=>{const{modelId:n}=t,s=[];this.base.setTileSyltByConstructionProcessTracking({modelId:n,batchIds:s})})}),this.base.start=null}freshConstructionProgressTracking(){const e=this.base.viewer.clock.currentTime.secondsOfDay*1e3,t={};Array.isArray(this.base.data)&&this.base.data.forEach(s=>{s.playCash=!1,this.processAnimation(s,e,t)});const n=Object.entries(t);n.forEach(([s,o])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:s,batchIds:o})}),n.length===0&&Array.isArray(this.base.data)&&this.base.data.forEach(s=>{s.groupData.forEach(o=>{const{modelId:r}=o;this.base.setTileSyltByConstructionProcessTracking({modelId:r,batchIds:[]})})})}reStartAnimation(){let e={};this.base.clearedModelIds.clear(),Array.isArray(this.base.data)&&this.base.data.forEach(t=>{t.cash=!1,t.playCash=!1,t.groupData.forEach(n=>{const{batchIds:s,modelId:o,rgba:r}=n;if(Array.isArray(s)&&s[0]){s[0][1]=r;const a=e[o];a?a.push(s[0]):e[o]=[s[0]]}})}),Object.entries(e).forEach(([t,n])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:t,batchIds:n})}),this.initTime()}setAllConstructionProgressTracking(e){this.base.data=e,Array.isArray(this.base.data)&&this.base.data.forEach(t=>{t.cash=!1,t.playCash=!1,t.groupData=[],t.finished=!1,t.mergeCpts.forEach(n=>{const s=[];n.cpts.forEach(l=>{s.push({dbName:n.linkModelId,modelId:n.modelId,elementId:`${l}`,show:!0,rgba:t.rgba??{r:.2,g:.2,b:.2,a:.2}})});const o=Wu.process,r=hw.color,{allElements:a}=this.base.groupByModelId(s);this.base.mapAnimations[n.modelId]=this.base.mapAnimations[n.modelId]||[],this.base.mapAnimations[n.modelId].push(t),Object.entries(a).forEach(([l,c])=>{const[h,u]=pw(l),p=this.base.getTileSyltByConstructionProcessTracking({elementIds:c,modelId:h,color:u,colorRank:o,show:!0,selectionRank:r}),f=t?.playTimeColor?.r??1,m=t?.playTimeColor?.g??1,y=t?.playTimeColor?.b??0,g=t?.playTimeColor?.a??.1,A=this.base.setColor({r:f,g:m,b:y,a:g}),v=this.base.setColor(t.rgba??{r:.2,g:.2,b:.2,a:.2});t.groupData.push({modelId:h,batchIds:p,playTimeColor:A,rgba:v})})})})}}class Aw{base;constructor(e){this.base=e}attachTileset(e,t,n){const s=this.base.cesium;this.base.handler||(this.base.handler=new s.ScreenSpaceEventHandler(this.base.viewer.scene.canvas));const o=ks(e,n);o&&(this.base.tilesetMap[o]=e),t&&(this.base.selectedColor=t),this.bindInputs()}bindInputs(){if(!this.base.handler)return;const e=this.base.cesium;this.base.handler.setInputAction(async t=>{if(!this.base.clickToHighlightEnabled){await this.base.clearSelection();return}let n;try{n=this.base.viewer.scene.pick(t.position)}catch{}if(e.defined(n)&&n instanceof e.Cesium3DTileFeature){await this.base.clearSelection();const s=ks(n.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(n);if(o==="-1")return;let r;const a=this.base.viewer.scene.pickPosition(t.position);if(e.defined(a)){const h=e.Cartographic.fromCartesian(a),u=e.Math.toDegrees(h.longitude),p=e.Math.toDegrees(h.latitude),f=h.height;r=[u,p,f]}const c=(this.base.hasSelectedFeaturesMap[s]||[]).filter(h=>h.rank!==0);if(this.base.hasSelectedFeaturesMap[s]=[...c,{batchId:o,selectedColor:this.base.selectedColor,rank:0,point:r,isTrigger:!0}],this.base.setBaseStyle(s),await this.base.triggerSelectionChange(s),n.tileset.leiting?.selectedFn)if(n.tileset.leiting.node){const h=n.tileset.leiting.node.batchIdEIDInfos[o].elementID,u=n.tileset.leiting.node.nodeExtras.element[h];u.elementId=h,u.modelId=n.tileset.leiting.model.modelId,n.tileset.leiting.selectedFn({elementInfo:u,elementId:h,point:r,modelId:n.tileset.leiting.model.modelId,_propsData:u})}else n.tileset.leiting.selectedFn(null)}else await this.base.clearSelection()},e.ScreenSpaceEventType.LEFT_CLICK),this.base.handler.setInputAction(async t=>{let n;try{n=this.base.viewer.scene.pick(t.position)}catch{}if(e.defined(n)&&n instanceof e.Cesium3DTileFeature){const s=ks(n.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(n);if(o==="-1")return;let r;const a=this.base.viewer.scene.pickPosition(t.position);if(e.defined(a)){const l=e.Cartographic.fromCartesian(a),c=e.Math.toDegrees(l.longitude),h=e.Math.toDegrees(l.latitude),u=l.height;r=[c,h,u]}await this.base.toggleMultiSelect(s,o,this.base.selectedColor,r)}},e.ScreenSpaceEventType.LEFT_CLICK,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(t=>{this.base.ensureSelectionDiv();const n=this.base.viewer?.scene?.screenSpaceCameraController;n&&this.base.cameraControllerState===null&&(this.base.cameraControllerState={enableRotate:n.enableRotate,enableTilt:n.enableTilt,enableLook:n.enableLook},n.enableRotate=!1,n.enableTilt=!1,n.enableLook=!1),this.base.selectStart=this.base.cesium.Cartesian2.clone(t.position),this.base.selectEnd=null,this.base.selectionDiv&&this.base.selectStart&&(this.base.selectionDiv.style.left=`${this.base.selectStart.x}px`,this.base.selectionDiv.style.top=`${this.base.selectStart.y}px`,this.base.selectionDiv.style.width="0px",this.base.selectionDiv.style.height="0px",this.base.selectionDiv.style.display="block")},e.ScreenSpaceEventType.LEFT_DOWN,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(t=>{if(!this.base.selectStart||!this.base.selectionDiv)return;const n=performance.now();if(n-this.base.lastDrawTime<20)return;this.base.lastDrawTime=n,this.base.selectEnd=this.base.cesium.Cartesian2.clone(t.endPosition);const s=Math.min(this.base.selectStart.x,this.base.selectEnd.x),o=Math.min(this.base.selectStart.y,this.base.selectEnd.y),r=Math.abs(this.base.selectStart.x-this.base.selectEnd.x),a=Math.abs(this.base.selectStart.y-this.base.selectEnd.y);this.base.selectionDiv.style.left=`${s}px`,this.base.selectionDiv.style.top=`${o}px`,this.base.selectionDiv.style.width=`${r}px`,this.base.selectionDiv.style.height=`${a}px`,this.base.selectionDiv.style.backgroundColor="rgba(0, 255, 255, 0.5)",this.base.selectionDiv.style.position="absolute",this.base.selectionDiv.style.zIndex="2"},e.ScreenSpaceEventType.MOUSE_MOVE,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(async()=>{if(!this.base.selectStart||!this.base.selectionDiv)return;if(!this.base.selectStart||!this.base.selectEnd){this.base.selectionDiv.style.display="none";const n=this.base.viewer?.scene?.screenSpaceCameraController;n&&this.base.cameraControllerState!==null&&(n.enableRotate=this.base.cameraControllerState.enableRotate,n.enableTilt=this.base.cameraControllerState.enableTilt,n.enableLook=this.base.cameraControllerState.enableLook,this.base.cameraControllerState=null);return}this.base.selectionDiv.style.display="none",await this.base.selectTilesInRectangle(this.base.selectStart,this.base.selectEnd,this.base.selectedColor),this.base.viewer.scene.requestRender(),this.base.selectStart=null,this.base.selectEnd=null;const t=this.base.viewer?.scene?.screenSpaceCameraController;t&&this.base.cameraControllerState!==null&&(t.enableRotate=this.base.cameraControllerState.enableRotate,t.enableTilt=this.base.cameraControllerState.enableTilt,t.enableLook=this.base.cameraControllerState.enableLook,this.base.cameraControllerState=null)},e.ScreenSpaceEventType.LEFT_UP,e.KeyboardEventModifier.CTRL)}unbindInputs(){if(!this.base.handler)return;const e=this.base.cesium;this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_CLICK),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_CLICK,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOWN,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.MOUSE_MOVE,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_UP,e.KeyboardEventModifier.CTRL)}}class vw{cesium;viewer;data;handler;selectedColor="rgba(255,0,0,1.0)";tilesetMap={};hasSelectedFeaturesMap={};colorRankColor=[];showStateMap={};selectedPosition={x:null,y:null};selectionDiv=null;lastDrawTime=0;selectStart=null;selectEnd=null;cameraControllerState=null;start=null;groupBatchIds={};recoverStaus=!1;mapAnimations={};clearedModelIds=new Set;eidToBatchIdMap={};batchIdToElementIdMap={};animationModule;selectionModule;onSelectionChangeCallbacks=[];loadNodeDetailsForModel;loadNodeDetailsCallback;clickToHighlightEnabled=!0;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.animationModule=new yw(this),this.selectionModule=new Aw(this)}attachTileset(e,t,n){this.selectionModule.attachTileset(e,t,n)}setLoadNodeDetailsCallback(e){this.loadNodeDetailsCallback=e}selectionChange(e){e&&typeof e=="function"&&this.onSelectionChangeCallbacks.push(e)}removeSelectionChange(e){this.onSelectionChangeCallbacks=this.onSelectionChangeCallbacks.filter(t=>t!==e)}async triggerSelectionChange(e){if(e)await this.loadNodeDetailsForModel(e);else{const t=Object.keys(this.hasSelectedFeaturesMap);t.length>0&&await Promise.all(t.map(n=>{try{return this.loadNodeDetailsForModel(n)}catch(s){return console.error(`Error loading node details for model ${n}:`,s),Promise.resolve()}}))}if(this.onSelectionChangeCallbacks.length>0){const t=await this.getSelected({rank:0});this.onSelectionChangeCallbacks.forEach(n=>{try{n(t)}catch(s){console.error("Selection callback error:",s)}})}}enableSelection(){this.selectionModule.bindInputs()}disableSelection(){this.selectionModule.unbindInputs()}async clearSelection(e){this.getTargetModelIds(e).forEach(n=>{const s=this.hasSelectedFeaturesMap[n];if(!s?.length)return;const o=s.filter(r=>r.rank!==0);o.length?(this.hasSelectedFeaturesMap[n]=o,this.setBaseStyle(n)):(delete this.hasSelectedFeaturesMap[n],this.applyShowStyleOnly(n))}),this.viewer.scene.requestRender(),await this.triggerSelectionChange(e)}clearExist(e){this.getTargetModelIds(e).forEach(n=>{const s=this.hasSelectedFeaturesMap[n];if(!s?.length)return;const o=s.filter(r=>r.rank!==1);o.length?(this.hasSelectedFeaturesMap[n]=o,this.setBaseStyle(n)):(delete this.hasSelectedFeaturesMap[n],this.applyShowStyleOnly(n))}),this.viewer.scene.requestRender()}clearProcess(e){this.getTargetModelIds(e).forEach(n=>{const s=this.hasSelectedFeaturesMap[n];if(!s?.length)return;const o=s.filter(r=>r.rank!==2);o.length?(this.hasSelectedFeaturesMap[n]=o,this.setBaseStyle(n)):(delete this.hasSelectedFeaturesMap[n],this.applyShowStyleOnly(n))}),this.viewer.scene.requestRender()}async clearAllHaveSelected(){this.getTargetModelIds().forEach(t=>{this.hasSelectedFeaturesMap[t]&&(delete this.hasSelectedFeaturesMap[t],this.applyShowStyleOnly(t))}),this.viewer.scene.requestRender(),await this.triggerSelectionChange()}async loadAllNodeDetailsForModel(){for(const e of Object.keys(this.tilesetMap))await this.loadNodeDetailsForModel(e)}getSelected(e){const t=e&&typeof e=="object"&&"rank"in e?e.rank:e,n=qu(t),s=[];for(const o of Object.keys(this.hasSelectedFeaturesMap))(this.hasSelectedFeaturesMap[o]||[]).forEach(a=>{if(a.rank!==n)return;const l=uw(a.selectedColor);let c=this.getBatchIdToElementIdSync(a.batchId,o);c===null&&(c=a.batchId),a.isTrigger&&s.push({elementId:c,modelId:o,rgba:l||void 0,point:a?.point||void 0})});return s}getBatchIdToElementIdSync(e,t){if(this.batchIdToElementIdMap[t])return this.batchIdToElementIdMap[t].get(e)??null;const s=this.tilesetMap[t]?.leiting?.node?.batchIdEIDInfos;if(s&&Array.isArray(s)){const o=new Map;return s.forEach(r=>{r&&r.elementID&&o.set(`${r.batchId}`,`${r.elementID}`)}),this.batchIdToElementIdMap[t]=o,o.get(e)??null}return null}setAllConstructionProgressTracking(e){this.animationModule.setAllConstructionProgressTracking(e)}initTime(){this.animationModule.initTime()}processAnimation(e,t,n,s=null){this.animationModule.processAnimation(e,t,n,s)}onTick=e=>{this.animationModule.onTick(e)};enableConstructionProgressTracking(){this.animationModule.enableConstructionProgressTracking()}disableConstructionProgressTracking(){this.animationModule.disableConstructionProgressTracking()}freshConstructionProgressTracking(){this.animationModule.freshConstructionProgressTracking()}reStartAnimation(){this.animationModule.reStartAnimation()}setTileSyltByConstructionProcessTracking({modelId:e,batchIds:t}){const n=this.tilesetMap[e];if(!n)return;const s=n?.style?.show?.conditionsExpression?.conditions;Array.isArray(t)&&t.length?s?n.style=new this.cesium.Cesium3DTileStyle({show:{conditions:s},color:{conditions:t}}):n.style=new this.cesium.Cesium3DTileStyle({color:{conditions:t}}):this.applyShowStyleOnly(e),this.viewer.scene.requestRender()}resumeFlyTo(){this.viewer.clock.shouldAnimate=!0}pauseFlyTo(){this.viewer.clock.shouldAnimate=!1}async flyToObjects({selectCpts:e,options:t}){if(!Array.isArray(e)||e.length===0)return;await this.clearSelection(),await this.setSelectColorUserModelCpt(e,{rank:0});const n=this.cesium,s=t?.scale??1,o=[];for(const r of e){const a=r?.modelId;if(a==null)continue;await this.loadNodeDetailsForModel(a);const l=r?.elementId,c=this.tilesetMap[`${a}`];if(!c)continue;const u=mw(c,l)||gw(c);if(!u)continue;const p=new n.Cartesian3(u.min.x,u.min.y,u.min.z),f=new n.Cartesian3(u.max.x,u.max.y,u.max.z),m=c?.root?.computedTransform??c?.modelMatrix;if(m){const y=n.Matrix4.multiplyByPoint(m,p,new n.Cartesian3),g=n.Matrix4.multiplyByPoint(m,f,new n.Cartesian3);o.push(y,g)}else o.push(p,f)}if(o.length){const r=n.BoundingSphere.fromPoints(o);r.radius=r.radius*s;const a=this.viewer.scene.camera,l=new n.HeadingPitchRange(a.heading,a.pitch,0);a.flyToBoundingSphere(r,{duration:t?.duration??0,complete:t?.complete,offset:l})}else{const r=e[0]?.modelId,a=r?this.tilesetMap[`${r}`]:null;a&&this.viewer.flyTo(a,{duration:t?.duration??0,complete:t?.complete})}}setBaseStyle(e){this.getTargetModelIds(e).forEach(n=>{this.setColorStyle(n)})}setColorStyle(e){this.updateTilesetStyle(e)}buildColorConditions(e){const t=this.tilesetMap[e],n=this.hasSelectedFeaturesMap[e];if(!t||!n?.length)return;const s=new Map;n.forEach(l=>{const c=s.get(l.batchId);(!c||l.rank>=c.rank)&&s.set(l.batchId,l)});const o=new Map;if(s.forEach(({batchId:l,selectedColor:c})=>{o.has(c)||o.set(c,new Set),o.get(c)?.add(l)}),this.colorRankColor.length){const l=new Set;this.colorRankColor.forEach(c=>{const h=o.get(c);h&&h.forEach(u=>l.add(u))}),o.forEach((c,h)=>{if(this.colorRankColor.includes(h))return;const u=new Set;c.forEach(p=>{l.has(p)||u.add(p)}),o.set(h,u)})}const r=[...this.colorRankColor.filter(l=>o.has(l)),...Array.from(o.keys()).filter(l=>!this.colorRankColor.includes(l))],a=[];return r.forEach(l=>{const c=o.get(l);if(!c||!c.size)return;const h=Array.from(c).join("|");h&&a.push([`(regExp('^(${h})$').test(\${id}))`,l])}),a.length?a:void 0}updateTilesetStyle(e){const t=this.tilesetMap[e];if(!t)return;t.colorBlendMode=this.cesium.Cesium3DTileColorBlendMode.REPLACE;const n=this.showStateMap[e],s=n?this.buildShowConditions(n.batchIds,n.mode):void 0,o=this.buildColorConditions(e);s||o?t.style=new this.cesium.Cesium3DTileStyle({show:s?{conditions:s}:void 0,color:o?{conditions:o}:void 0}):t.style=void 0,this.viewer.scene.requestRender()}setShowStyle(e){this.getTargetModelIds(e?.modelId).forEach(n=>{const s=this.showStateMap[n]||{batchIds:[],mode:"include"};this.showStateMap[n]={batchIds:e?.batchIds??s.batchIds,mode:e?.mode??s.mode},this.updateTilesetStyle(n)})}setColor(e){if(!e)return this.selectedColor;if(typeof e=="string")return e;const t=_n(Number(e.r)),n=_n(Number(e.g)),s=_n(Number(e.b)),o=Ku(e.a===void 0?1:Number(e.a));return bl({r:t,g:n,b:s,a:o})||this.selectedColor}groupByModelId(e){const t={};return e.forEach(n=>{const s=n?.modelId,o=n?.elementId;if(s==null||o===void 0||o===null)return;const r=n?.color??n?.rgba,a=this.setColor(r??{r:.4,g:.4,b:.4,a:.1}),l=`${s}-${a}`;t[l]||(t[l]=[]),t[l].push(`${o}`)}),{allElements:t,transform:null,box:null}}getBatchIds(e,t){const n=`${t}`,s=`${e}`;if(this.eidToBatchIdMap[n]){const l=this.eidToBatchIdMap[n].get(s);if(l!==void 0)return l}const r=this.tilesetMap[n]?.leiting?.node?.batchIdEIDInfos;if(r&&Array.isArray(r)){const l=new Map;r.forEach(h=>{const u=`${h.elementID}`,p=`${h.batchId}`;l.has(u)||l.set(u,[]),l.get(u).push(p)}),this.eidToBatchIdMap[n]=l;const c=l.get(s);if(c!==void 0)return c}const a=fw(e);return a!=null?[String(a)]:[]}async setComponentVisibility(e){if(Array.isArray(e)){Object.keys(this.showStateMap).forEach(t=>{this.showStateMap[t]={batchIds:[],mode:"exclude"}});for(const t of e){const n=`${t.modelId}`;this.showStateMap[n]||(this.showStateMap[n]={batchIds:[],mode:"exclude"});const s=this.showStateMap[n];if(!t.show){const o=this.getBatchIds(t.elementId,n);s.batchIds.push(...o)}}Object.keys(this.showStateMap).forEach(t=>{this.updateTilesetStyle(t)})}}async isolateComponentVisibility(e){const t={};e.forEach(n=>{const s=`${n.modelId}`;t[s]||(t[s]=new Set),t[s].add(`${n.elementId}`)});for(const n of Object.keys(this.tilesetMap)){await this.loadNodeDetailsForModel(n);const o=this.tilesetMap[n]?.leiting?.node?.batchIdEIDInfos;if(!o)continue;this.showStateMap[n]={batchIds:[],mode:"exclude"};const r=t[n];if(r&&r.size>0){const a=[];for(const l of o)r.has(`${l.elementID}`)||a.push(`${l.batchId}`);this.showStateMap[n].batchIds=a;continue}this.showStateMap[n].batchIds=o.map(a=>a.batchId)}Object.keys(this.showStateMap).forEach(n=>{this.updateTilesetStyle(n)})}async setAllComponentsVisibility(e){const t=this.getTargetModelIds();for(const n of t)await this.loadNodeDetailsForModel(n),e?this.setShowStyle({modelId:n,batchIds:[],mode:"exclude"}):this.setShowStyle({modelId:n,batchIds:[],mode:"include"})}getComponentsByVisibility(e){const t=this.getTargetModelIds(),n=[];return t.forEach(s=>{const o=this.showStateMap[s],r=this.tilesetMap[s];if(!r?.leiting?.node?.batchIdEIDInfos)return;const a=r.leiting.node.batchIdEIDInfos,l=new Set(o?.batchIds??[]),c=o?.mode??"exclude",h=new Set;a.forEach(u=>{const p=l.has(`${u.batchId}`);if((c==="include"?p:!p)===e){const m=`${u.elementID}`;h.has(m)||(n.push({elementId:m,modelId:s}),h.add(m))}})}),n}async _getComponentsByVisibility(e){const t=this.getTargetModelIds();for(const s of t)this.loadNodeDetailsForModel(s);const n=[];return t.forEach(s=>{const o=this.showStateMap[s],r=this.tilesetMap[s];if(!r?.leiting?.node?.batchIdEIDInfos)return;const a=r.leiting.node.batchIdEIDInfos,l=new Set(o?.batchIds??[]),c=o?.mode??"exclude",h=new Set;a.forEach(u=>{const p=l.has(`${u.batchId}`);if((c==="include"?p:!p)===e){const m=`${u.elementID}`;h.has(m)||(n.push({elementId:m,modelId:s}),h.add(m))}})}),n}getTileSyltByConstructionProcessTracking({elementIds:e,modelId:t,color:n,colorRank:s,show:o,selectionRank:r}){const a=this.tilesetMap[t];if(!Array.isArray(e))return[];const l=a.leiting.node,c=new Set(e),h=l.batchIdEIDInfos.filter(p=>c.has(`${p.elementID}`)).map(p=>String(p.batchId));return h.length?(s===Wu.normal&&!this.colorRankColor.includes(n)&&(this.colorRankColor=[n]),[[`(regExp('^(${h.join("|")})$').test(\${id}))`,n]]):[]}async setSelectColorUserModelCpt(e,t){if(!Array.isArray(e))return;const n=new Map,s=t?.rank===void 0?"exist":t?.rank,o=qu(s),r=t?.isTrigger??!0;for(const a of e){const l=a?.modelId;if(l==null)continue;const c=`${l}`;await this.loadNodeDetailsForModel(c);const h=Array.isArray(a?.elementIds)?a.elementIds:a?.elementId?[a.elementId]:[];if(!h.length)continue;const u=bl(a?.rgba)||this.selectedColor;for(const p of h){const f=this.getBatchIds(p,c);if(f.length!==0){n.has(c)||n.set(c,[]);for(const m of f)n.get(c)?.push({batchId:m,selectedColor:u,rank:o,isTrigger:r})}}}for(const[a,l]of n){const c=this.mergeSelections(a,l);this.hasSelectedFeaturesMap[a]=c,this.setBaseStyle(a)}r&&await this.triggerSelectionChange()}async setAllSelectColorUserModelCpt(e,t){const{modelId:n,rgba:s}=e,o=t?.isTrigger??!0;if(!n)return;await this.loadNodeDetailsForModel(n);const r=String(n),a=this.tilesetMap[r];if(!a)return;const l=a?.leiting?.node?.batchIdEIDInfos;if(!l||!Array.isArray(l))return;const c=[];l.forEach(h=>{h&&h.elementID!==void 0&&c.push(h.elementID)}),c.length!==0&&await this.setSelectColorUserModelCpt([{modelId:r,elementIds:c,rgba:s}],{rank:0,isTrigger:o})}getFeatureId(e){if(this.cesium.defined(e)&&this.cesium.defined(e.getProperty)){const t=e.getProperty("id");return t!=null?String(t):"-1"}return"-1"}getTargetModelIds(e){return e?[e]:Object.keys(this.tilesetMap)}buildShowConditions(e,t){const n=e.join("|");return n?t==="include"?[[`(regExp('^(${n})$').test(\${id}))`,"true"],["true","false"]]:[[`(regExp('^(${n})$').test(\${id}))`,"false"],["true","true"]]:t==="include"?[["true","false"]]:void 0}applyShowStyleOnly(e){const t=this.tilesetMap[e];if(!t)return;const n=this.showStateMap[e],s=n?this.buildShowConditions(n.batchIds,n.mode):void 0;s?t.style=new this.cesium.Cesium3DTileStyle({show:{conditions:s}}):t.style=void 0}setSelectedColorRgba(e,t,n,s=1){const o=_n(e),r=_n(t),a=_n(n),l=Ku(s),c=bl({r:o,g:r,b:a,a:l});c&&(this.selectedColor=c)}mergeSelections(e,t){const n=new Map;return(this.hasSelectedFeaturesMap[e]||[]).forEach(o=>n.set(o.batchId,o)),t.forEach(o=>{const r=n.get(o.batchId);(!r||o.rank>r.rank||o.rank===r.rank)&&n.set(o.batchId,o)}),Array.from(n.values())}async toggleMultiSelect(e,t,n,s){const o=this.hasSelectedFeaturesMap[e]||[],r=o.filter(u=>u.rank!==0),a=o.filter(u=>u.rank===0),c=a.some(u=>u.batchId===t)?a.filter(u=>u.batchId!==t):[...a,{batchId:t,selectedColor:n,rank:0,point:s,isTrigger:!0}],h=[...r,...c];h.length?(this.hasSelectedFeaturesMap[e]=h,this.setBaseStyle(e)):(delete this.hasSelectedFeaturesMap[e],this.applyShowStyleOnly(e)),await this.triggerSelectionChange(e)}ensureSelectionDiv(){if(this.selectionDiv)return;const e=document.createElement("div");e.style.display="none",e.style.pointerEvents="none",e.style.border="1px solid rgba(0, 255, 255, 0.8)",this.viewer.container.appendChild(e),this.selectionDiv=e}isRepeatedClick(e){const t=e?.position;return!t||typeof t.x!="number"||typeof t.y!="number"?!1:this.selectedPosition.x===t.x&&this.selectedPosition.y===t.y?!0:(this.selectedPosition.x=t.x,this.selectedPosition.y=t.y,!1)}async selectTilesInRectangle(e,t,n){const s=Math.min(e.x,t.x),o=Math.max(e.x,t.x),r=Math.min(e.y,t.y),a=Math.max(e.y,t.y),l=o-s,c=a-r;if(Math.abs(l)<15||Math.abs(c)<15)return;const h=s+l/2,u=r+c/2,p=new this.cesium.Cartesian2(h,u),f=this.viewer.scene.drillPick(p,void 0,l,c);if(!Array.isArray(f))return;const m=new Map;f.forEach(y=>{if(!(y instanceof this.cesium.Cesium3DTileFeature))return;const g=ks(y.tileset);if(!g||!this.tilesetMap[g])return;const A=this.getFeatureId(y);A!=="-1"&&(m.has(g)||m.set(g,new Set),m.get(g)?.add(A))}),m.forEach((y,g)=>{const A=this.hasSelectedFeaturesMap[g]||[],v=A.filter(x=>x.rank!==0),C=new Set(A.filter(x=>x.rank===0).map(x=>x.batchId)),w=[];y.forEach(x=>{C.has(x)||w.push({batchId:x,selectedColor:n,rank:0,isTrigger:!0})});const M=A.filter(x=>x.rank===0);this.hasSelectedFeaturesMap[g]=[...v,...M,...w],this.setBaseStyle(g)}),await this.triggerSelectionChange()}}class bw{cesium;viewer;tilesetMap={};planeEntities=[];clippingPlanesMap={};activeModelIds=new Set;boxMatrix=null;boxInverseMatrix=null;boxCenter=null;boxOrientation=null;targetZPlus=0;targetZMinus=0;targetXPlus=0;targetXMinus=0;targetYPlus=0;targetYMinus=0;currentPlaneType="";selectedPlane=null;hoveredPlane=null;dragStartPoint=null;moveCallBack=null;downHandler=null;upHandler=null;moveHandler=null;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}attachTileset(e,t){this.tilesetMap[t]=e}open(e,t){!this.tilesetMap[e]||this.activeModelIds.has(e)||(this.activeModelIds.add(e),this.moveCallBack=t?.moveCallBack,this.fitToModels(),this.activeModelIds.size===1&&(this.createPlaneEntities(),this.initEventHandlers()))}setupClippingPlanes(e){const t=this.cesium,n=this.tilesetMap[e];if(!n||!this.boxMatrix)return;const s=new t.ClippingPlaneCollection({planes:[new t.ClippingPlane(new t.Cartesian3(1,0,0),this.targetXMinus),new t.ClippingPlane(new t.Cartesian3(-1,0,0),this.targetXPlus),new t.ClippingPlane(new t.Cartesian3(0,1,0),this.targetYMinus),new t.ClippingPlane(new t.Cartesian3(0,-1,0),this.targetYPlus),new t.ClippingPlane(new t.Cartesian3(0,0,1),this.targetZMinus),new t.ClippingPlane(new t.Cartesian3(0,0,-1),this.targetZPlus)],edgeWidth:2,edgeColor:t.Color.WHITE,enabled:!0,unionClippingRegions:!0}),o=t.Matrix4.inverse(n.root.transform,new t.Matrix4);s.modelMatrix=t.Matrix4.multiply(o,this.boxMatrix,new t.Matrix4),n.clippingPlanes=s,this.clippingPlanesMap[e]=s}createPlaneEntities(){const e=this.cesium,t=this.viewer;this.planeEntities.forEach(s=>t.entities.remove(s)),this.planeEntities=[];const n=["left","right","behind","front","top","down"];for(const s of n){const o=t.entities.add({name:s,position:new e.CallbackProperty(()=>{if(!this.boxMatrix)return e.Cartesian3.ZERO;const r=this.getPlaneOffsetCartesian(s);return e.Matrix4.multiplyByPoint(this.boxMatrix,r,new e.Cartesian3)},!1),orientation:new e.CallbackProperty(()=>this.boxOrientation||e.Quaternion.IDENTITY,!1),plane:{dimensions:new e.CallbackProperty(()=>{if(this.activeModelIds.size===0)return new e.Cartesian2(0,0);const r=.1,a=Math.max(r,this.targetXMinus+this.targetXPlus),l=Math.max(r,this.targetYPlus+this.targetYMinus),c=Math.max(r,this.targetZPlus+this.targetZMinus);return s==="top"||s==="down"?new e.Cartesian2(a,l):s==="left"||s==="right"?new e.Cartesian2(l,c):new e.Cartesian2(a,c)},!1),material:e.Color.WHITE.withAlpha(.1),outline:!0,outlineColor:e.Color.YELLOW,plane:new e.CallbackProperty(()=>new e.Plane(this.getNormalByType(s),0),!1)}});this.planeEntities.push(o)}}getPlaneOffsetCartesian(e){const t=(this.targetXPlus-this.targetXMinus)/2,n=(this.targetYPlus-this.targetYMinus)/2,s=(this.targetZPlus-this.targetZMinus)/2;switch(e){case"left":return new this.cesium.Cartesian3(-this.targetXMinus,n,s);case"right":return new this.cesium.Cartesian3(this.targetXPlus,n,s);case"behind":return new this.cesium.Cartesian3(t,-this.targetYMinus,s);case"front":return new this.cesium.Cartesian3(t,this.targetYPlus,s);case"top":return new this.cesium.Cartesian3(t,n,this.targetZPlus);case"down":return new this.cesium.Cartesian3(t,n,-this.targetZMinus);default:return this.cesium.Cartesian3.ZERO}}getNormalByType(e){const t=this.cesium;switch(e){case"left":return new t.Cartesian3(1,0,0);case"right":return new t.Cartesian3(-1,0,0);case"behind":return new t.Cartesian3(0,1,0);case"front":return new t.Cartesian3(0,-1,0);case"top":return new t.Cartesian3(0,0,-1);case"down":return new t.Cartesian3(0,0,1);default:return t.Cartesian3.UNIT_X}}getPlaneByType(e){const t=this.cesium,n=this.getNormalByType(e),s=t.Cartesian3.negate(n,new t.Cartesian3);let o=0;switch(e){case"left":o=this.targetXMinus;break;case"right":o=this.targetXPlus;break;case"behind":o=this.targetYMinus;break;case"front":o=this.targetYPlus;break;case"top":o=this.targetZPlus;break;case"down":o=this.targetZMinus;break}return new t.Plane(s,-o)}initEventHandlers(){const e=this.cesium,t=this.viewer.scene.canvas,n=this.viewer.scene;this.downHandler=new e.ScreenSpaceEventHandler(t),this.upHandler=new e.ScreenSpaceEventHandler(t),this.moveHandler=new e.ScreenSpaceEventHandler(t),this.moveHandler.setInputAction(s=>{if(this.selectedPlane)return;let o;try{o=n.pick(s.endPosition)}catch{}e.defined(o)&&o.id&&o.id.plane?this.hoveredPlane!==o.id.plane&&(this.hoveredPlane&&(this.hoveredPlane.material=e.Color.WHITE.withAlpha(.1)),this.hoveredPlane=o.id.plane,this.hoveredPlane.material=e.Color.YELLOW.withAlpha(.3),t.style.cursor="pointer"):this.hoveredPlane&&(this.hoveredPlane.material=e.Color.WHITE.withAlpha(.1),this.hoveredPlane=null,t.style.cursor="default")},e.ScreenSpaceEventType.MOUSE_MOVE),this.downHandler.setInputAction(s=>{let o;try{o=n.pick(s.position)}catch{}if(e.defined(o)&&o.id&&o.id.plane){this.currentPlaneType=o.id.name,this.selectedPlane=o.id.plane,this.selectedPlane.material=e.Color.RED.withAlpha(.4),n.screenSpaceCameraController.enableInputs=!1;const r=n.camera.getPickRay(s.position),a=this.boxInverseMatrix,l=e.Matrix4.multiplyByPoint(a,r.origin,new e.Cartesian3),c=e.Matrix4.multiplyByPointAsVector(a,r.direction,new e.Cartesian3);e.Cartesian3.normalize(c,c);const h=new e.Ray(l,c),u=this.getPlaneByType(this.currentPlaneType);this.dragStartPoint=e.IntersectionTests.rayPlane(h,u,new e.Cartesian3),this.dragStartPoint||(this.dragStartPoint=this.getPlaneOffsetCartesian(this.currentPlaneType))}},e.ScreenSpaceEventType.LEFT_DOWN),this.moveHandler.setInputAction(s=>{if(!this.selectedPlane||!this.dragStartPoint)return;const o=n.camera.getPickRay(s.endPosition),r=this.boxInverseMatrix,a=e.Matrix4.multiplyByPoint(r,o.origin,new e.Cartesian3),l=e.Matrix4.multiplyByPointAsVector(r,o.direction,new e.Cartesian3);e.Cartesian3.normalize(l,l);const c=new e.Ray(a,l);let h=new e.Cartesian3;this.currentPlaneType==="top"||this.currentPlaneType==="down"?h=Math.abs(l.x)>Math.abs(l.y)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Y:this.currentPlaneType==="left"||this.currentPlaneType==="right"?h=Math.abs(l.y)>Math.abs(l.z)?e.Cartesian3.UNIT_Y:e.Cartesian3.UNIT_Z:h=Math.abs(l.x)>Math.abs(l.z)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Z;const u=-e.Cartesian3.dot(this.dragStartPoint,h),p=new e.Plane(h,u);let f=e.IntersectionTests.rayPlane(c,p,new e.Cartesian3);if(!f){const y=h===e.Cartesian3.UNIT_X?e.Cartesian3.UNIT_Y:h===e.Cartesian3.UNIT_Y&&(this.currentPlaneType==="top"||this.currentPlaneType==="down")?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Z,g=-e.Cartesian3.dot(this.dragStartPoint,y);f=e.IntersectionTests.rayPlane(c,new e.Plane(y,g),new e.Cartesian3)}if(!f)return;const m=.01;switch(this.currentPlaneType){case"left":this.targetXMinus=Math.max(-this.targetXPlus+m,-f.x);break;case"right":this.targetXPlus=Math.max(-this.targetXMinus+m,f.x);break;case"behind":this.targetYMinus=Math.max(-this.targetYPlus+m,-f.y);break;case"front":this.targetYPlus=Math.max(-this.targetYMinus+m,f.y);break;case"top":this.targetZPlus=Math.max(-this.targetZMinus+m,f.z);break;case"down":this.targetZMinus=Math.max(-this.targetZPlus+m,-f.z);break}this.syncClippingPlanes(),this.moveCallBack&&this.moveCallBack(this.getRangeParams())},e.ScreenSpaceEventType.MOUSE_MOVE),this.upHandler.setInputAction(()=>{this.selectedPlane&&(this.selectedPlane.material=e.Color.WHITE.withAlpha(.1),this.selectedPlane=null,this.currentPlaneType="",this.dragStartPoint=null),n.screenSpaceCameraController.enableInputs=!0,t.style.cursor="default"},e.ScreenSpaceEventType.LEFT_UP)}syncClippingPlanes(){this.activeModelIds.size!==0&&Object.keys(this.clippingPlanesMap).forEach(e=>{const t=this.clippingPlanesMap[e],n=this.tilesetMap[e];if(t&&n&&!t.isDestroyed()){const s=this.cesium;t.get(0).distance=this.targetXMinus,t.get(1).distance=this.targetXPlus,t.get(2).distance=this.targetYMinus,t.get(3).distance=this.targetYPlus,t.get(4).distance=this.targetZMinus,t.get(5).distance=this.targetZPlus;const o=s.Matrix4.inverse(n.root.transform,new s.Matrix4);t.modelMatrix=s.Matrix4.multiply(o,this.boxMatrix,new s.Matrix4)}})}fitToModels(){const e=this.cesium;if(this.activeModelIds.size===0)return;let t=[];if(this.activeModelIds.forEach(u=>{const p=this.tilesetMap[u];p&&p.boundingSphere&&t.push(p.boundingSphere.center)}),t.length===0)return;const n=new e.Cartesian3;t.forEach(u=>e.Cartesian3.add(n,u,n)),this.boxCenter=e.Cartesian3.divideByScalar(n,t.length,new e.Cartesian3),this.boxMatrix=e.Transforms.eastNorthUpToFixedFrame(this.boxCenter),this.boxInverseMatrix=e.Matrix4.inverse(this.boxMatrix,new e.Matrix4),this.boxOrientation=e.Quaternion.fromRotationMatrix(e.Matrix4.getMatrix3(this.boxMatrix,new e.Matrix3));let s=1/0,o=-1/0,r=1/0,a=-1/0,l=1/0,c=-1/0;this.activeModelIds.forEach(u=>{const p=this.tilesetMap[u];if(!p)return;const f=[],m=p.leiting?.box,y=p.root?.boundingVolume?.boundingVolume;if(m&&m.min&&m.max){const{min:g,max:A}=m,v=[new e.Cartesian3(g.x,g.y,g.z),new e.Cartesian3(A.x,g.y,g.z),new e.Cartesian3(g.x,A.y,g.z),new e.Cartesian3(A.x,A.y,g.z),new e.Cartesian3(g.x,g.y,A.z),new e.Cartesian3(A.x,g.y,A.z),new e.Cartesian3(g.x,A.y,A.z),new e.Cartesian3(A.x,A.y,A.z)],C=p.root.transform;v.forEach(w=>{f.push(e.Matrix4.multiplyByPoint(C,w,new e.Cartesian3))})}else if(y&&y.halfAxes){const g=y.center,A=y.halfAxes,v=e.Matrix3.getColumn(A,0,new e.Cartesian3),C=e.Matrix3.getColumn(A,1,new e.Cartesian3),w=e.Matrix3.getColumn(A,2,new e.Cartesian3);for(let M=0;M<8;M++){const x=e.Cartesian3.clone(g,new e.Cartesian3);e.Cartesian3.add(x,e.Cartesian3.multiplyByScalar(v,M&1?1:-1,new e.Cartesian3),x),e.Cartesian3.add(x,e.Cartesian3.multiplyByScalar(C,M&2?1:-1,new e.Cartesian3),x),e.Cartesian3.add(x,e.Cartesian3.multiplyByScalar(w,M&4?1:-1,new e.Cartesian3),x),f.push(x)}}else if(p.boundingSphere){const g=p.boundingSphere,A=g.center,v=g.radius,C=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,A,new e.Cartesian3);s=Math.min(s,C.x-v),o=Math.max(o,C.x+v),r=Math.min(r,C.y-v),a=Math.max(a,C.y+v),l=Math.min(l,C.z-v),c=Math.max(c,C.z+v)}f.forEach(g=>{const A=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,g,new e.Cartesian3);s=Math.min(s,A.x),o=Math.max(o,A.x),r=Math.min(r,A.y),a=Math.max(a,A.y),l=Math.min(l,A.z),c=Math.max(c,A.z)})});const h=1.01;this.targetXMinus=Math.abs(s)*h,this.targetXPlus=Math.abs(o)*h,this.targetYMinus=Math.abs(r)*h,this.targetYPlus=Math.abs(a)*h,this.targetZMinus=Math.abs(l)*h,this.targetZPlus=Math.abs(c)*h,this.activeModelIds.forEach(u=>{this.setupClippingPlanes(u)}),this.viewer.scene.requestRender()}getRangeParams(){const e=this.cesium;return{targetZPlus:this.targetZPlus,targetZMinus:this.targetZMinus,targetXPlus:this.targetXPlus,targetXMinus:this.targetXMinus,targetYPlus:this.targetYPlus,targetYMinus:this.targetYMinus,maxBox:new e.Cartesian3(this.targetXPlus,this.targetYPlus,this.targetZPlus),minBox:new e.Cartesian3(-this.targetXMinus,-this.targetYMinus,-this.targetZMinus)}}updateRange(e){if(!this.boxMatrix)return;e.targetXMinus!==void 0&&(this.targetXMinus=e.targetXMinus),e.targetXPlus!==void 0&&(this.targetXPlus=e.targetXPlus),e.targetYMinus!==void 0&&(this.targetYMinus=e.targetYMinus),e.targetYPlus!==void 0&&(this.targetYPlus=e.targetYPlus),e.targetZPlus!==void 0&&(this.targetZPlus=e.targetZPlus),e.targetZMinus!==void 0&&(this.targetZMinus=e.targetZMinus);const t=.1;this.targetXMinus+this.targetXPlus<t&&(this.targetXPlus=t-this.targetXMinus),this.targetYPlus+this.targetYMinus<t&&(this.targetYPlus=t-this.targetYMinus),this.targetZPlus+this.targetZMinus<t&&(this.targetZPlus=t-this.targetZMinus),this.syncClippingPlanes(),this.viewer.scene.requestRender()}getRange(){return this.getRangeParams()}setBoxVisibility(e){this.planeEntities.forEach(t=>{t.show=e}),this.viewer.scene.requestRender()}close(e){if(e){const t=this.tilesetMap[e];t&&(t.clippingPlanes&&(t.clippingPlanes.enabled=!1),t.clippingPlanes=void 0),delete this.clippingPlanesMap[e],this.activeModelIds.delete(e),this.activeModelIds.size>0&&this.fitToModels()}else Object.keys(this.clippingPlanesMap).forEach(t=>{const n=this.tilesetMap[t];n&&(n.clippingPlanes&&(n.clippingPlanes.enabled=!1),n.clippingPlanes=void 0)}),this.clippingPlanesMap={},this.activeModelIds.clear();this.activeModelIds.size===0&&(this.planeEntities.forEach(t=>{this.viewer.entities.remove(t)}),this.planeEntities=[],this.destroyEventHandlers(),this.boxMatrix=null,this.boxInverseMatrix=null),this.viewer.scene.requestRender()}destroyEventHandlers(){this.downHandler?.destroy(),this.upHandler?.destroy(),this.moveHandler?.destroy(),this.downHandler=this.upHandler=this.moveHandler=null}}let wl=performance.now();const Cw=10;class ww{cesium;viewer;modelInfo={modelName:"Person",modelId:"player_111",url:"person/model.glb",scale:.0032};startTime=0;radian=0;speed=.1;speedVector;position;hpRoll;cameralHpRoll;fixedFrameTransforms;model;transparentTest=!0;gravityTestByMove=!1;gravityTest=!0;lastMoveTime=0;moveInterval=.01;collisionTest=!0;wheelCount=2;isLeftDragging=!1;lastScreenY=0;lastScreenX=0;pauseAnimationFn;resumeAnimationFn;selectedColor;selectedColorRecover;handler;moveState={moveFront:!1,moveBack:!1,moveLeft:!1,moveRight:!1,moveUp:!1,moveDown:!1};onLoading=null;onSuccess=null;onError=null;constructor({cesium:e,viewer:t,modelInfo:n,callbacks:s}){this.cesium=e,this.viewer=t,this.radian=this.cesium.Math.toRadians(4),this.speedVector=new this.cesium.Cartesian3,this.position=new this.cesium.Cartesian3,this.hpRoll=new this.cesium.HeadingPitchRoll,this.cameralHpRoll=new this.cesium.HeadingPitchRoll,this.fixedFrameTransforms=new this.cesium.Transforms.localFrameToFixedFrameGenerator("north","west"),n&&(this.modelInfo=Object.assign(this.modelInfo,n)),s&&(this.onLoading=s.onLoading||null,this.onSuccess=s.onSuccess||null,this.onError=s.onError||null),this.selectedColor=new this.cesium.Color(1,1,1,.4),this.selectedColorRecover=new this.cesium.Color(1,1,1,1);const o=this.viewer.scene.canvas;this.handler=new this.cesium.ScreenSpaceEventHandler(o)}getModel(){return this.model}setPauseAnimation(e){this.pauseAnimationFn=e}setResumeAnimationFn(e){this.resumeAnimationFn=e}async setPersonPosition(e){e&&(this.position=e),this.getModel()?(this.model.modelMatrix=this.cesium.Transforms.headingPitchRollToFixedFrame(e,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),this.model.show=!0,this.initKeyBoard()):await this.openPlayer(),this.setCameralDefault(!1)}setModelInfo(e){e&&(this.modelInfo=Object.assign(this.modelInfo,e))}async openPlayer(){if(this.enablePositionSelection(),this.model){this.model.show=!0,this.initKeyBoard(),this.setCameralDefault(!1);return}this.position&&!(this.position.x===0&&this.position.y===0&&this.position.z===0)?(await this.loadModel(),this.initKeyBoard(),this.setCameralDefault(!1)):this.onLoading&&this.onLoading("请按住 Ctrl + 左键点击场景选择初始位置...")}enablePositionSelection(){this._positionHandler&&(this._positionHandler.destroy(),this._positionHandler=null);const e=new this.cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);e.setInputAction(async t=>{const n=this.viewer.scene;let s;try{s=n.pickPosition(t.position)}catch(o){console.warn("pickPosition failed:",o)}s&&(this.position=s,this.model?(this.model.modelMatrix=this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),this.updatedCamera(),this.onSuccess&&this.onSuccess("已更新漫游位置")):(this.onSuccess&&this.onSuccess("位置已选择,正在加载模型..."),await this.loadModel(),this.initKeyBoard(),this.setCameralDefault(!1)))},this.cesium.ScreenSpaceEventType.LEFT_CLICK,this.cesium.KeyboardEventModifier.CTRL),this._positionHandler=e}_positionHandler;setDefaultPosition(){const e=this.viewer.scene,t=this.viewer.camera,n=new this.cesium.Cartesian2(e.canvas.clientWidth/2,e.canvas.clientHeight/2);let s;try{s=e.pickPosition(n)}catch(o){console.warn("pickPosition failed:",o)}if(s)this.position=s;else{const o=t.direction,a=this.cesium.Cartesian3.add(t.positionWC,this.cesium.Cartesian3.multiplyByScalar(o,10,new this.cesium.Cartesian3),new this.cesium.Cartesian3);this.position=a}}async loadModel(){let e;try{this.onLoading&&this.onLoading("正在加载漫游人物...");const t=await this.cesium.Model.fromGltfAsync({id:this.modelInfo.modelId,url:this.modelInfo.url,modelMatrix:this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),scale:this.modelInfo.scale,allowPicking:!1,debugShowBoundingVolume:!1,debugWireframe:!1,cull:!1,gltfCallback:s=>{e=s.animations},backFaceCulling:!1}),n=()=>{if(e&&e.length>0){console.log("Model has animations:",e.length);try{t.activeAnimations.add({index:0,loop:this.cesium.ModelAnimationLoop.REPEAT,multiplier:1})}catch(s){console.error("Failed to add animation:",s)}this.pauseAnimationFn=()=>{this.viewer.clock.shouldAnimate=!1},this.resumeAnimationFn=()=>{this.viewer.clock.shouldAnimate=!0},this.viewer.clock.shouldAnimate=!1}else console.warn("No animations found in the model.")};t.ready?n():t.readyEvent.addEventListener(n),this.model=await this.viewer.scene.primitives.add(t),this.updatedCamera(),this.onLoading&&this.onLoading(""),this.onSuccess&&this.onSuccess("漫游模型加载完成")}catch(t){console.error("Failed to load model:",t),this.onLoading&&this.onLoading(""),this.onError&&this.onError("漫游模型加载失败")}}initKeyBoard(){const e=this.handler,t=this.cesium;wl=performance.now();const n=(o,r)=>{const a=o.code,l=o.keyCode;a==="KeyA"||l===65?this.moveState.moveLeft=r:a==="KeyW"||l===87?this.moveState.moveFront=r:a==="KeyD"||l===68?this.moveState.moveRight=r:a==="KeyS"||l===83?this.moveState.moveBack=r:a==="KeyQ"||l===81?this.moveState.moveUp=r:(a==="KeyE"||l===69)&&(this.moveState.moveDown=r)};e.setInputAction(o=>{this.wheelCount-=o*.001,this.wheelCount<.1&&(this.wheelCount=.1),this.updatedCamera()},t.ScreenSpaceEventType.WHEEL),this._keydownHandler=o=>{o.target.tagName==="INPUT"||o.target.tagName==="TEXTAREA"||(n(o,!0),this.resumeAnimationFn&&this.resumeAnimationFn())},this._keyupHandler=o=>{o.target.tagName==="INPUT"||o.target.tagName==="TEXTAREA"||(n(o,!1),Object.keys(this.moveState).every(r=>this.moveState[r]==!1)&&this.pauseAnimationFn&&this.pauseAnimationFn())},document.addEventListener("keydown",this._keydownHandler),document.addEventListener("keyup",this._keyupHandler),e.setInputAction(o=>{this.isLeftDragging=!0,this.lastScreenY=o.position.y,this.lastScreenX=o.position.x},this.cesium.ScreenSpaceEventType.LEFT_DOWN),e.setInputAction(o=>{if(!this.isLeftDragging)return;const r=o.endPosition.x,a=o.endPosition.y,l=a-this.lastScreenY,c=r-this.lastScreenX;Math.abs(l)<Math.abs(c)&&(c>0?(this.cameralHpRoll.heading+=this.radian,this.hpRoll.heading+=this.radian):(this.cameralHpRoll.heading-=this.radian,this.hpRoll.heading-=this.radian),s(0),this.lastScreenX=r),this.lastScreenY=a;const h=this.viewer.camera;this.cameralHpRoll.pitch=h.pitch+this.cesium.Math.toRadians(-l*.1),this.updatedCamera()},t.ScreenSpaceEventType.MOUSE_MOVE),e.setInputAction(()=>{this.isLeftDragging&&(this.isLeftDragging=!1)},t.ScreenSpaceEventType.LEFT_UP);const s=o=>{const r=performance.now();if(r-wl<Cw)return;wl=r;const a=1.75;if(o===1?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,this.speed,this.speedVector),this.gravityTestByMove=!0):o===-1?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,-this.speed,this.speedVector),this.gravityTestByMove=!0):o===0?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,0,this.speedVector),this.gravityTestByMove=!1):o===2?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Z,.05,this.speedVector),this.gravityTestByMove=!1):o===-2?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Z,-.05,this.speedVector),this.gravityTestByMove=!1):o===3?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Y,this.speed,this.speedVector),this.gravityTestByMove=!0):o===-3&&(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Y,-this.speed,this.speedVector),this.gravityTestByMove=!0),!this.viewer||!this.model)return;const l=(u,p)=>new this.cesium.Ray(u,p),c=new this.cesium.Cartesian3;this.cesium.Matrix4.getColumn(this.model.modelMatrix,0,c),this.cesium.Cartesian3.normalize(c,c);const h=new this.cesium.Cartesian3;if(this.cesium.Matrix4.getColumn(this.model.modelMatrix,1,h),this.cesium.Cartesian3.normalize(h,h),Math.abs(o)!=2&&this.collisionTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),p=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,a),u);let f=c;o===-1?f=this.cesium.Cartesian3.multiplyByScalar(c,-1,new this.cesium.Cartesian3):o===3?f=h:o===-3&&(f=this.cesium.Cartesian3.multiplyByScalar(h,-1,new this.cesium.Cartesian3));const m=l(p,f),y=this.viewer.scene.pickFromRay(m,[this.model],1);if(y&&y.position&&this.cesium.Cartesian3.distance(p,y.position)<.9&&o!==0)return}if(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,this.speedVector,this.position),this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.gravityTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),p=.5,f=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,p),u),m=new this.cesium.Cartesian3;this.cesium.Cartesian3.subtract(this.position,f,m),this.cesium.Cartesian3.normalize(m,m);const y=l(f,m),g=this.viewer.scene.pickFromRay(y,[this.model],1),A=a,v=this.cesium.Cartesian3.add(f,this.cesium.Cartesian3.multiplyByScalar(c,A,new this.cesium.Cartesian3),new this.cesium.Cartesian3);if(t.defined(g)){const C=t.Cartesian3.distance(f,g.position);C-p>.2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position)),C-p<-.1&&C<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,.2),this.position))}if(!g&&this.gravityTestByMove){const C=l(this.position,m),w=this.viewer.scene.pickFromRay(C,[this.model],1);if(w){const M=this.cesium.Cartesian3.distance(this.position,w.position);Math.abs(M-1)>.05&&M<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position))}}if(g&&this.gravityTestByMove&&this.gravityTest){const C=this.cesium.Cartesian3.distance(v,g.position);Math.abs(C-a)>.1&&(this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,(a-C)/Math.abs(a-C)*.05),this.position))}}if(this.transparentTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),p=1.75,f=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,p),u),m=this.viewer.camera.positionWC,y=f,g=t.Cartesian3.subtract(y,m,new t.Cartesian3),A=t.Cartesian3.distance(f,m),v=t.Cartesian3.normalize(g,new t.Cartesian3),C=new t.Ray(m,v);let w;try{w=this.viewer.scene.pickFromRay(C,void 0,1)}catch{}t.defined(w)&&w.primitive!==this.model&&w.position&&t.Cartesian3.distance(m,w.position)<A&&(this.wheelCount-=.1,this.wheelCount<.1&&(this.wheelCount=.1))}this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.updatedCamera()};this._tickHandler=()=>{const o=performance.now()/1e3;(o-this.lastMoveTime>=this.moveInterval||this.lastMoveTime==0)&&(this.moveState.moveFront?s(1):this.moveState.moveBack?s(-1):this.moveState.moveLeft?s(3):this.moveState.moveRight?s(-3):this.moveState.moveUp?s(2):this.moveState.moveDown&&s(-2),this.lastMoveTime=o)},this.viewer.clock.onTick.addEventListener(this._tickHandler)}updatedCamera(){if(!this.model)return;const e=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),t=1.75,n=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,t),e);this.viewer.camera.viewBoundingSphere(new this.cesium.BoundingSphere(n,this.wheelCount),this.cameralHpRoll)}_keydownHandler;_keyupHandler;_tickHandler;_uiEventListeners=[];bindUiKeys(e){this.unbindUiKeys(),Object.entries(e).forEach(([t,n])=>{if(!n)return;const s=()=>this.setMoveState(t,!0),o=()=>this.setMoveState(t,!1);n.addEventListener("mousedown",s),n.addEventListener("mouseup",o),n.addEventListener("mouseleave",o),n.addEventListener("touchstart",r=>{r.preventDefault(),s()}),n.addEventListener("touchend",r=>{r.preventDefault(),o()}),this._uiEventListeners.push(()=>{n.removeEventListener("mousedown",s),n.removeEventListener("mouseup",o),n.removeEventListener("mouseleave",o),n.removeEventListener("touchstart",s),n.removeEventListener("touchend",o)})})}unbindUiKeys(){this._uiEventListeners.forEach(e=>e()),this._uiEventListeners=[]}openCameraRoam(){const e=this.cesium,t=this.viewer,n=t.camera;this.setDefaultPosition(),this.setCameralDefault(!1);const s=this.handler;let o=!1,r=0,a=0;s.setInputAction(l=>{o=!0,r=l.position.x,a=l.position.y},e.ScreenSpaceEventType.LEFT_DOWN),s.setInputAction(l=>{if(!o)return;const c=l.endPosition.x,h=l.endPosition.y,u=c-r,p=h-a;Math.abs(u)>Math.abs(p)&&(n.heading-=u*.003),n.pitch+=p*.003,r=c,a=h},e.ScreenSpaceEventType.MOUSE_MOVE),s.setInputAction(()=>{o=!1},e.ScreenSpaceEventType.LEFT_UP),s.setInputAction(l=>{this.wheelCount-=l*.001,this.wheelCount<.1&&(this.wheelCount=.1)},e.ScreenSpaceEventType.WHEEL),this._tickHandler=()=>{if(!this.moveState.moveFront&&!this.moveState.moveBack&&!this.moveState.moveLeft&&!this.moveState.moveRight&&!this.moveState.moveUp&&!this.moveState.moveDown)return;const l=(this.speed||.02)*12,c=n.direction,h=n.right,u=n.up;let p=0,f=0,m=0;this.moveState.moveFront&&(p+=c.x*l,f+=c.y*l,m+=c.z*l),this.moveState.moveBack&&(p-=c.x*l,f-=c.y*l,m-=c.z*l),this.moveState.moveRight&&(p+=h.x*l,f+=h.y*l,m+=h.z*l),this.moveState.moveLeft&&(p-=h.x*l,f-=h.y*l,m-=h.z*l),this.moveState.moveUp&&(p+=u.x*l,f+=u.y*l,m+=u.z*l),this.moveState.moveDown&&(p-=u.x*l,f-=u.y*l,m-=u.z*l),n.position=new e.Cartesian3(n.position.x+p,n.position.y+f,n.position.z+m)},t.clock.onTick.addEventListener(this._tickHandler),this.onSuccess&&this.onSuccess("视角漫游已启动")}closePlayer(){const e=this.cesium;this.model&&(this.model.show=!1),this.setCameralDefault(!0),this.handler&&(this.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOWN),this.handler.removeInputAction(e.ScreenSpaceEventType.MOUSE_MOVE),this.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_UP),this.handler.removeInputAction(e.ScreenSpaceEventType.WHEEL)),this._positionHandler&&(this._positionHandler.destroy(),this._positionHandler=null),this._keydownHandler&&document.removeEventListener("keydown",this._keydownHandler),this._keyupHandler&&document.removeEventListener("keyup",this._keyupHandler),this._tickHandler&&this.viewer.clock.onTick.removeEventListener(this._tickHandler),this.unbindUiKeys(),this.viewer.camera.lookAtTransform(e.Matrix4.IDENTITY),this.onLoading&&this.onLoading("")}setSpeed({speed:e}){this.speed=e/50}setParams({gravityTest:e,collisionTest:t,transparentTest:n}){e!==void 0&&(this.gravityTest=e),t!==void 0&&(this.collisionTest=t),n!==void 0&&(this.transparentTest=n)}setMoveState(e,t){this.moveState.hasOwnProperty(e)&&(this.moveState[e]=t,t?this.resumeAnimationFn&&this.resumeAnimationFn():Object.keys(this.moveState).every(n=>this.moveState[n]==!1)&&this.pauseAnimationFn&&this.pauseAnimationFn())}setCameralDefault(e){const t=this.viewer;t.scene.screenSpaceCameraController.enableRotate=e,t.scene.screenSpaceCameraController.enableTranslate=e,t.scene.screenSpaceCameraController.enableZoom=e,t.scene.screenSpaceCameraController.enableLook=e,t.scene.screenSpaceCameraController.enableTilt=e}}class Ew{cesium;viewer;baseCesium;baseTiles;baseCompt;baseSection;basePlayer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.baseCesium=new Wy(e),this.baseTiles=new ju(e),this.baseCompt=new vw(e),this.baseSection=new bw(e),this.basePlayer=new ww({cesium:e.cesium,viewer:e.viewer,modelInfo:{url:e.options?.playerUrl,modelName:e.options?.playerModelName,modelId:e.options?.playerModelId,scale:e.options?.playerScale},callbacks:e.callbacks})}getCesium(){return this.cesium}getViewer(){return this.viewer}setSceneOptions(...e){this.baseCesium.setSceneOptions(...e)}getSnapDomSImageBase64(...e){return this.baseCesium.getSnapDomSImageBase64(...e)}clearBackground(){this.baseCesium.clearBackground()}enableTestLabel(){this.baseCesium.enableTestLabel()}enableCesiumFXAA(e){this.baseCesium.enableCesiumFXAA(e)}updateModelEffect(e){this.baseCesium.updateModelEffect(e)}addModels(...e){return this.baseTiles.addModels(...e)}}class xw{cesium;viewer;mapLayers={};renderGen={};renderGenAll=0;renderGenByModel={};modelId="default";options={flyTo:!0};dxfModelsList=[];open=!1;events=new _s;showGlobal=!0;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t}getMapLayers(e){const t=typeof e=="object"?e?.modelId:e;return t?this.mapLayers[t]||{}:this.mapLayers}setModelId(e){this.modelId=e}getModelId(){return this.modelId}flyToCadModel(e={}){const t=e.modelId||this.modelId,n=this.dxfModelsList.find(s=>s.modelId===t);n&&this.flyToBounds(n)}setDxfOpen(e){this.open=e}getDxfOpen(){return this.open}getDxfModelsList(){return this.dxfModelsList}getDxfModels(e){const t=typeof e=="object"?e?.modelId:e;return t?this.dxfModelsList.find(n=>n.modelId===t):this.dxfModelsList}showJson({modelId:e,show:t}){this.mapLayers[e]&&Object.values(this.mapLayers[e]).forEach(s=>{s.forEach(o=>{o.primitive&&(o.primitive.show=t)})});const n=this.dxfModelsList.find(s=>s.modelId===e);n&&(n.show=t)}showJsonByLayer({modelId:e,show:t,layers:n}){const s=this.dxfModelsList.find(r=>r.modelId===e);if(!s){console.error("Tileset not found for modelId:",e);return}s.hiddenBatchIds||(s.hiddenBatchIds=new Set),s.layerMap&&Array.isArray(n)&&n.forEach(r=>{const a=s.layerMap[r];a!==void 0&&(t?s.hiddenBatchIds.delete(a):s.hiddenBatchIds.add(a))});const o=Array.from(s.hiddenBatchIds);if(o.length>0){const r=o.map(a=>`\${_BATCHID} !== ${a}`).join(" && ");s.style=new this.cesium.Cesium3DTileStyle({show:r})}else s.style=new this.cesium.Cesium3DTileStyle({show:!0});s.hasVisibilityListener||(s.hasVisibilityListener=!0,s.tileVisible.addEventListener(r=>{const a=r.content,l=a.featuresLength;if(l>0&&s.hiddenBatchIds)for(let c=0;c<l;c++)s.hiddenBatchIds.has(c)?a.getFeature(c).show=!1:a.getFeature(c).show=!0}))}flyToBounds(e,t){const n=this.cesium,s=e.boundingSphere?.radius||1e3,o={offset:new n.HeadingPitchRange(0,n.Math.toRadians(-90),s*2),...t},r=o.duration??0;e&&this.viewer.flyTo(e,{duration:r,offset:o.offset})}async loadModelFile(e){try{if(!e||typeof e!="string")return!1;const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status} for ${e}`);if(e.endsWith(".json")||t.headers.get("content-type")?.includes("application/json"))return await t.json();const n=await t.blob(),s=new ml(new tr(n),{password:Yu,useWebWorkers:!1}),r=(await s.getEntries()).find(c=>!c.directory&&c.filename.endsWith(".json"));if(!r)return console.error("未找到 JSON 文件"),await s.close(),!1;const a=await r.arrayBuffer({useWebWorkers:!1});await s.close();const l=new TextDecoder().decode(a);return JSON.parse(l.trim())}catch(t){return console.error("解压或获取失败:",t),!1}}getBaseUrlPath(e){const t=e.lastIndexOf("/");return t===-1?".":e.substring(0,t)}async loadTilesetWithZipSupport(e,t){const n=this.getBaseUrlPath(e),s=encodeURI(`${n}/tileset.zip`);try{if((await fetch(s,{method:"HEAD"})).status===200){const r=await this.loadModelFile(s);if(r){const a=h=>{!h||typeof h!="object"||(typeof h.uri=="string"&&!/^(data:|https?:|atom:)\/\//i.test(h.uri)&&(h.uri=encodeURI(`${n}/${h.uri.replace(/^\.?\//,"")}`)),Object.values(h).forEach(u=>{if(Array.isArray(u)){u.forEach(p=>a(p));return}u&&typeof u=="object"&&a(u)}))};a(r);const l=`data:text/plain;base64,${btoa(unescape(encodeURIComponent(JSON.stringify(r))))}`,c=new this.cesium.Resource({url:l});try{return await this.cesium.Cesium3DTileset.fromUrl(c,t)}catch{return await this.cesium.Cesium3DTileset.fromUrl(e,t)}}}}catch{}return await this.cesium.Cesium3DTileset.fromUrl(e,t)}async addDxfModel({fileNames:e,options:t}){const n=this.renderGenAll;if(e?.length){for(const s of e){if(this.renderGenAll!==n)return;const o=this.renderGenByModel[s.modelId]||0;if((this.renderGenByModel[s.modelId]||0)!==o||~this.dxfModelsList.findIndex(c=>c.modelId===s.modelId))return;/^(https?|atom):\/\//i.test(s.outPutPath)||(s.outPutPath=`${window.location.origin}${s.outPutPath}`);const a=`${s.outPutPath}${s.dbName}/tileset.json`,l={...this.options,...t};try{const c=`${s.outPutPath}${s.dbName}/layerInfo.zip`,h=await this.loadModelFile(c);if(this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;const u=await this.loadTilesetWithZipSupport(a,{allowPicking:!1,clampToTerrain:!0});if(u.maximumScreenSpaceError=0,this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;if(Object.assign(u,{modelId:s.modelId,modelName:s.modelName,deltaLatitude:s.deltaLatitude||0,deltaLongitude:s.deltaLongitude||0,relocated:!0,dbName:s.dbName,outPutPath:s.outPutPath,totalRotation:s.totalRotation||0,layerInfo:h}),s.formData?u.formData=s.formData:u.formData={modelId:u.modelId,longitude:u.deltaLongitude,latitude:u.deltaLatitude,distance:1e-6,rotation:0,totalRotation:u.totalRotation,heightDistance:1,height:0,lonlat:1e-6,modelOptions:[{value:u.modelId,label:u.modelName}],selectPoint:{longitude:0,latitude:0,height:0},selectedMode:!1,X:0,Y:0,Z:0},this.adjustingModelByCad({...u.formData,tileset:u}),Array.isArray(h)){const p=h;u.layerMap={};let f=this.mapLayers[s.modelId];f||(f={},this.mapLayers[s.modelId]=f),p.forEach(m=>{u.layerMap[m.layerName]=m.batchId,f[m.layerName]||(f[m.layerName]=[]),f[m.layerName].push({batchId:m.batchId,color:m.layerColor})})}if(this.dxfModelsList.push(u),this.setModelId(s.modelId),this.viewer.scene.primitives.add(u),this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;l.flyTo&&this.flyToBounds(u),l.onSuccess&&l.onSuccess(u)}catch(c){console.error(`Failed to load tileset or layer info: ${a}`,c)}}this.events.emit("mountAllCad",this.dxfModelsList)}}adjustingModelByCad(e){const t=this.cesium,n=t.Quaternion.fromAxisAngle(t.Cartesian3.UNIT_Z,t.Math.toRadians(e.totalRotation)),s=t.Matrix4.fromRotationTranslation(t.Matrix3.fromQuaternion(n),new t.Cartesian3(0,0,0)),o=t.Cartesian3.fromDegrees(e.longitude,e.latitude,e.height),r=t.Transforms.eastNorthUpToFixedFrame(o);t.Matrix4.multiply(r,s,r),e.tileset?._root&&(e.tileset._root.transform=r)}deleteCad({modelId:e}){this.mapLayers[e]&&(Object.values(this.mapLayers[e]).forEach(n=>{n.forEach(s=>{this.viewer.scene.primitives.remove(s.primitive),s.primitive?.destroy()})}),delete this.mapLayers[e]),this.renderGen[e]=(this.renderGen[e]||0)+1,this.renderGenByModel[e]=(this.renderGenByModel[e]||0)+1;const t=this.dxfModelsList.findIndex(n=>n.modelId===e);if(t>-1){const n=this.dxfModelsList[t];this.viewer.scene.primitives.remove(n),n.destroy&&!n.isDestroyed()&&n.destroy(),this.dxfModelsList.splice(t,1)}}deleteAllCad(){Object.keys(this.mapLayers).forEach(e=>{this.deleteCad({modelId:e})}),[...this.dxfModelsList].forEach(e=>{e.modelId&&this.deleteCad({modelId:e.modelId})})}}function Iw(i){i("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),i("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),i("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var e=1;e<=60;++e)i("EPSG:"+(32600+e),"+proj=utm +zone="+e+" +datum=WGS84 +units=m"),i("EPSG:"+(32700+e),"+proj=utm +zone="+e+" +south +datum=WGS84 +units=m");i("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),i("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),i.WGS84=i["EPSG:4326"],i["EPSG:3785"]=i["EPSG:3857"],i.GOOGLE=i["EPSG:3857"],i["EPSG:900913"]=i["EPSG:3857"],i["EPSG:102113"]=i["EPSG:3857"]}var Zi=1,en=2,kn=3,Sw=4,El=5,Xu=6378137,Mw=6356752314e-3,Ju=.0066943799901413165,Ps=484813681109536e-20,$=Math.PI/2,Tw=.16666666666666666,Bw=.04722222222222222,_w=.022156084656084655,K=1e-10,Oe=.017453292519943295,bt=57.29577951308232,Ae=Math.PI/4,Ds=Math.PI*2,Ge=3.14159265359,Ct={};Ct.greenwich=0,Ct.lisbon=-9.131906111111,Ct.paris=2.337229166667,Ct.bogota=-74.080916666667,Ct.madrid=-3.687938888889,Ct.rome=12.452333333333,Ct.bern=7.439583333333,Ct.jakarta=106.807719444444,Ct.ferro=-17.666666666667,Ct.brussels=4.367975,Ct.stockholm=18.058277777778,Ct.athens=23.7163375,Ct.oslo=10.722916666667;const kw={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}};var Zu=/[\s_\-\/\(\)]/g;function Si(i,e){if(i[e])return i[e];for(var t=Object.keys(i),n=e.toLowerCase().replace(Zu,""),s=-1,o,r;++s<t.length;)if(o=t[s],r=o.toLowerCase().replace(Zu,""),r===n)return i[o]}function xl(i){var e={},t=i.split("+").map(function(a){return a.trim()}).filter(function(a){return a}).reduce(function(a,l){var c=l.split("=");return c.push(!0),a[c[0].toLowerCase()]=c[1],a},{}),n,s,o,r={proj:"projName",datum:"datumCode",rf:function(a){e.rf=parseFloat(a)},lat_0:function(a){e.lat0=a*Oe},lat_1:function(a){e.lat1=a*Oe},lat_2:function(a){e.lat2=a*Oe},lat_ts:function(a){e.lat_ts=a*Oe},lon_0:function(a){e.long0=a*Oe},lon_1:function(a){e.long1=a*Oe},lon_2:function(a){e.long2=a*Oe},alpha:function(a){e.alpha=parseFloat(a)*Oe},gamma:function(a){e.rectified_grid_angle=parseFloat(a)*Oe},lonc:function(a){e.longc=a*Oe},x_0:function(a){e.x0=parseFloat(a)},y_0:function(a){e.y0=parseFloat(a)},k_0:function(a){e.k0=parseFloat(a)},k:function(a){e.k0=parseFloat(a)},a:function(a){e.a=parseFloat(a)},b:function(a){e.b=parseFloat(a)},r:function(a){e.a=e.b=parseFloat(a)},r_a:function(){e.R_A=!0},zone:function(a){e.zone=parseInt(a,10)},south:function(){e.utmSouth=!0},towgs84:function(a){e.datum_params=a.split(",").map(function(l){return parseFloat(l)})},to_meter:function(a){e.to_meter=parseFloat(a)},units:function(a){e.units=a;var l=Si(kw,a);l&&(e.to_meter=l.to_meter)},from_greenwich:function(a){e.from_greenwich=a*Oe},pm:function(a){var l=Si(Ct,a);e.from_greenwich=(l||parseFloat(a))*Oe},nadgrids:function(a){a==="@null"?e.datumCode="none":e.nadgrids=a},axis:function(a){var l="ewnsud";a.length===3&&l.indexOf(a.substr(0,1))!==-1&&l.indexOf(a.substr(1,1))!==-1&&l.indexOf(a.substr(2,1))!==-1&&(e.axis=a)},approx:function(){e.approx=!0},over:function(){e.over=!0}};for(n in t)s=t[n],n in r?(o=r[n],typeof o=="function"?o(s):e[o]=s):e[n]=s;return typeof e.datumCode=="string"&&e.datumCode!=="WGS84"&&(e.datumCode=e.datumCode.toLowerCase()),e.projStr=i,e}class ef{static getId(e){const t=e.find(n=>Array.isArray(n)&&n[0]==="ID");return t&&t.length>=3?{authority:t[1],code:parseInt(t[2],10)}:null}static convertUnit(e,t="unit"){if(!e||e.length<3)return{type:t,name:"unknown",conversion_factor:null};const n=e[1],s=parseFloat(e[2])||null,o=e.find(a=>Array.isArray(a)&&a[0]==="ID"),r=o?{authority:o[1],code:parseInt(o[2],10)}:null;return{type:t,name:n,conversion_factor:s,id:r}}static convertAxis(e){const t=e[1]||"Unknown";let n;const s=t.match(/^\((.)\)$/);if(s){const c=s[1].toUpperCase();if(c==="E")n="east";else if(c==="N")n="north";else if(c==="U")n="up";else throw new Error(`Unknown axis abbreviation: ${c}`)}else n=e[2]?e[2].toLowerCase():"unknown";const o=e.find(c=>Array.isArray(c)&&c[0]==="ORDER"),r=o?parseInt(o[1],10):null,a=e.find(c=>Array.isArray(c)&&(c[0]==="LENGTHUNIT"||c[0]==="ANGLEUNIT"||c[0]==="SCALEUNIT")),l=this.convertUnit(a);return{name:t,direction:n,unit:l,order:r}}static extractAxes(e){return e.filter(t=>Array.isArray(t)&&t[0]==="AXIS").map(t=>this.convertAxis(t)).sort((t,n)=>(t.order||0)-(n.order||0))}static convert(e,t={}){switch(e[0]){case"PROJCRS":t.type="ProjectedCRS",t.name=e[1],t.base_crs=e.find(p=>Array.isArray(p)&&p[0]==="BASEGEOGCRS")?this.convert(e.find(p=>Array.isArray(p)&&p[0]==="BASEGEOGCRS")):null,t.conversion=e.find(p=>Array.isArray(p)&&p[0]==="CONVERSION")?this.convert(e.find(p=>Array.isArray(p)&&p[0]==="CONVERSION")):null;const n=e.find(p=>Array.isArray(p)&&p[0]==="CS");n&&(t.coordinate_system={type:n[1],axis:this.extractAxes(e)});const s=e.find(p=>Array.isArray(p)&&p[0]==="LENGTHUNIT");if(s){const p=this.convertUnit(s);t.coordinate_system.unit=p}t.id=this.getId(e);break;case"BASEGEOGCRS":case"GEOGCRS":t.type="GeographicCRS",t.name=e[1];const o=e.find(p=>Array.isArray(p)&&(p[0]==="DATUM"||p[0]==="ENSEMBLE"));if(o){const p=this.convert(o);o[0]==="ENSEMBLE"?t.datum_ensemble=p:t.datum=p;const f=e.find(m=>Array.isArray(m)&&m[0]==="PRIMEM");f&&f[1]!=="Greenwich"&&(p.prime_meridian={name:f[1],longitude:parseFloat(f[2])})}t.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(e)},t.id=this.getId(e);break;case"DATUM":t.type="GeodeticReferenceFrame",t.name=e[1],t.ellipsoid=e.find(p=>Array.isArray(p)&&p[0]==="ELLIPSOID")?this.convert(e.find(p=>Array.isArray(p)&&p[0]==="ELLIPSOID")):null;break;case"ENSEMBLE":t.type="DatumEnsemble",t.name=e[1],t.members=e.filter(p=>Array.isArray(p)&&p[0]==="MEMBER").map(p=>({type:"DatumEnsembleMember",name:p[1],id:this.getId(p)}));const r=e.find(p=>Array.isArray(p)&&p[0]==="ENSEMBLEACCURACY");r&&(t.accuracy=parseFloat(r[1]));const a=e.find(p=>Array.isArray(p)&&p[0]==="ELLIPSOID");a&&(t.ellipsoid=this.convert(a)),t.id=this.getId(e);break;case"ELLIPSOID":t.type="Ellipsoid",t.name=e[1],t.semi_major_axis=parseFloat(e[2]),t.inverse_flattening=parseFloat(e[3]),e.find(p=>Array.isArray(p)&&p[0]==="LENGTHUNIT")&&this.convert(e.find(p=>Array.isArray(p)&&p[0]==="LENGTHUNIT"),t);break;case"CONVERSION":t.type="Conversion",t.name=e[1],t.method=e.find(p=>Array.isArray(p)&&p[0]==="METHOD")?this.convert(e.find(p=>Array.isArray(p)&&p[0]==="METHOD")):null,t.parameters=e.filter(p=>Array.isArray(p)&&p[0]==="PARAMETER").map(p=>this.convert(p));break;case"METHOD":t.type="Method",t.name=e[1],t.id=this.getId(e);break;case"PARAMETER":t.type="Parameter",t.name=e[1],t.value=parseFloat(e[2]),t.unit=this.convertUnit(e.find(p=>Array.isArray(p)&&(p[0]==="LENGTHUNIT"||p[0]==="ANGLEUNIT"||p[0]==="SCALEUNIT"))),t.id=this.getId(e);break;case"BOUNDCRS":t.type="BoundCRS";const l=e.find(p=>Array.isArray(p)&&p[0]==="SOURCECRS");if(l){const p=l.find(f=>Array.isArray(f));t.source_crs=p?this.convert(p):null}const c=e.find(p=>Array.isArray(p)&&p[0]==="TARGETCRS");if(c){const p=c.find(f=>Array.isArray(f));t.target_crs=p?this.convert(p):null}const h=e.find(p=>Array.isArray(p)&&p[0]==="ABRIDGEDTRANSFORMATION");h?t.transformation=this.convert(h):t.transformation=null;break;case"ABRIDGEDTRANSFORMATION":if(t.type="Transformation",t.name=e[1],t.method=e.find(p=>Array.isArray(p)&&p[0]==="METHOD")?this.convert(e.find(p=>Array.isArray(p)&&p[0]==="METHOD")):null,t.parameters=e.filter(p=>Array.isArray(p)&&(p[0]==="PARAMETER"||p[0]==="PARAMETERFILE")).map(p=>{if(p[0]==="PARAMETER")return this.convert(p);if(p[0]==="PARAMETERFILE")return{name:p[1],value:p[2],id:{authority:"EPSG",code:8656}}}),t.parameters.length===7){const p=t.parameters[6];p.name==="Scale difference"&&(p.value=Math.round((p.value-1)*1e12)/1e6)}t.id=this.getId(e);break;case"AXIS":t.coordinate_system||(t.coordinate_system={type:"unspecified",axis:[]}),t.coordinate_system.axis.push(this.convertAxis(e));break;case"LENGTHUNIT":const u=this.convertUnit(e,"LinearUnit");t.coordinate_system&&t.coordinate_system.axis&&t.coordinate_system.axis.forEach(p=>{p.unit||(p.unit=u)}),u.conversion_factor&&u.conversion_factor!==1&&t.semi_major_axis&&(t.semi_major_axis={value:t.semi_major_axis,unit:u});break;default:t.keyword=e[0];break}return t}}class Pw extends ef{static convert(e,t={}){return super.convert(e,t),t.coordinate_system&&t.coordinate_system.subtype==="Cartesian"&&delete t.coordinate_system,t.usage&&delete t.usage,t}}class Dw extends ef{static convert(e,t={}){super.convert(e,t);const n=e.find(o=>Array.isArray(o)&&o[0]==="CS");n&&(t.coordinate_system={subtype:n[1],axis:this.extractAxes(e)});const s=e.find(o=>Array.isArray(o)&&o[0]==="USAGE");if(s){const o=s.find(l=>Array.isArray(l)&&l[0]==="SCOPE"),r=s.find(l=>Array.isArray(l)&&l[0]==="AREA"),a=s.find(l=>Array.isArray(l)&&l[0]==="BBOX");t.usage={},o&&(t.usage.scope=o[1]),r&&(t.usage.area=r[1]),a&&(t.usage.bbox=a.slice(1))}return t}}function Nw(i){return i.find(e=>Array.isArray(e)&&e[0]==="USAGE")?"2019":(i.find(e=>Array.isArray(e)&&e[0]==="CS")||i[0]==="BOUNDCRS"||i[0]==="PROJCRS"||i[0]==="GEOGCRS","2015")}function Lw(i){return(Nw(i)==="2019"?Dw:Pw).convert(i)}function Rw(i){const e=i.toUpperCase();return e.includes("PROJCRS")||e.includes("GEOGCRS")||e.includes("BOUNDCRS")||e.includes("VERTCRS")||e.includes("LENGTHUNIT")||e.includes("ANGLEUNIT")||e.includes("SCALEUNIT")?"WKT2":(e.includes("PROJCS")||e.includes("GEOGCS")||e.includes("LOCAL_CS")||e.includes("VERT_CS")||e.includes("UNIT"),"WKT1")}var Ns=1,tf=2,nf=3,sr=4,sf=5,Il=-1,Fw=/\s/,Ow=/[A-Za-z]/,Gw=/[A-Za-z84_]/,or=/[,\]]/,of=/[\d\.E\-\+]/;function hi(i){if(typeof i!="string")throw new Error("not a string");this.text=i.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Ns}hi.prototype.readCharicter=function(){var i=this.text[this.place++];if(this.state!==sr)for(;Fw.test(i);){if(this.place>=this.text.length)return;i=this.text[this.place++]}switch(this.state){case Ns:return this.neutral(i);case tf:return this.keyword(i);case sr:return this.quoted(i);case sf:return this.afterquote(i);case nf:return this.number(i);case Il:return}},hi.prototype.afterquote=function(i){if(i==='"'){this.word+='"',this.state=sr;return}if(or.test(i)){this.word=this.word.trim(),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in afterquote yet, index '+this.place)},hi.prototype.afterItem=function(i){if(i===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Ns;return}if(i==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Ns,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Il);return}},hi.prototype.number=function(i){if(of.test(i)){this.word+=i;return}if(or.test(i)){this.word=parseFloat(this.word),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in number yet, index '+this.place)},hi.prototype.quoted=function(i){if(i==='"'){this.state=sf;return}this.word+=i},hi.prototype.keyword=function(i){if(Gw.test(i)){this.word+=i;return}if(i==="["){var e=[];e.push(this.word),this.level++,this.root===null?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,this.state=Ns;return}if(or.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in keyword yet, index '+this.place)},hi.prototype.neutral=function(i){if(Ow.test(i)){this.word=i,this.state=tf;return}if(i==='"'){this.word="",this.state=sr;return}if(of.test(i)){this.word=i,this.state=nf;return}if(or.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in neutral yet, index '+this.place)},hi.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Il)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Uw(i){var e=new hi(i);return e.output()}function Sl(i,e,t){Array.isArray(e)&&(t.unshift(e),e=null);var n=e?{}:i,s=t.reduce(function(o,r){return Pn(r,o),o},n);e&&(i[e]=s)}function Pn(i,e){if(!Array.isArray(i)){e[i]=!0;return}var t=i.shift();if(t==="PARAMETER"&&(t=i.shift()),i.length===1){if(Array.isArray(i[0])){e[t]={},Pn(i[0],e[t]);return}e[t]=i[0];return}if(!i.length){e[t]=!0;return}if(t==="TOWGS84"){e[t]=i;return}if(t==="AXIS"){t in e||(e[t]=[]),e[t].push(i);return}Array.isArray(t)||(e[t]={});var n;switch(t){case"UNIT":case"PRIMEM":case"VERT_DATUM":e[t]={name:i[0].toLowerCase(),convert:i[1]},i.length===3&&Pn(i[2],e[t]);return;case"SPHEROID":case"ELLIPSOID":e[t]={name:i[0],a:i[1],rf:i[2]},i.length===4&&Pn(i[3],e[t]);return;case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":i[0]=["name",i[0]],Sl(e,t,i);return;case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":i[0]=["name",i[0]],Sl(e,t,i),e[t].type=t;return;default:for(n=-1;++n<i.length;)if(!Array.isArray(i[n]))return Pn(i,e[t]);return Sl(e,t,i)}}var Vw=.017453292519943295;function Ft(i){return i*Vw}function rf(i){const e=(i.projName||"").toLowerCase().replace(/_/g," ");!i.long0&&i.longc&&(e==="albers conic equal area"||e==="lambert azimuthal equal area")&&(i.long0=i.longc),!i.lat_ts&&i.lat1&&(e==="stereographic south pole"||e==="polar stereographic (variant b)")?(i.lat0=Ft(i.lat1>0?90:-90),i.lat_ts=i.lat1,delete i.lat1):!i.lat_ts&&i.lat0&&(e==="polar stereographic"||e==="polar stereographic (variant a)")&&(i.lat_ts=i.lat0,i.lat0=Ft(i.lat0>0?90:-90),delete i.lat1)}function af(i){let e={units:null,to_meter:void 0};return typeof i=="string"?(e.units=i.toLowerCase(),e.units==="metre"&&(e.units="meter"),e.units==="meter"&&(e.to_meter=1)):i&&i.name&&(e.units=i.name.toLowerCase(),e.units==="metre"&&(e.units="meter"),e.to_meter=i.conversion_factor),e}function lf(i){return typeof i=="object"?i.value*i.unit.conversion_factor:i}function cf(i,e){i.ellipsoid.radius?(e.a=i.ellipsoid.radius,e.rf=0):(e.a=lf(i.ellipsoid.semi_major_axis),i.ellipsoid.inverse_flattening!==void 0?e.rf=i.ellipsoid.inverse_flattening:i.ellipsoid.semi_major_axis!==void 0&&i.ellipsoid.semi_minor_axis!==void 0&&(e.rf=e.a/(e.a-lf(i.ellipsoid.semi_minor_axis))))}function rr(i,e={}){return!i||typeof i!="object"?i:i.type==="BoundCRS"?(rr(i.source_crs,e),i.transformation&&(i.transformation.method&&i.transformation.method.name==="NTv2"?e.nadgrids=i.transformation.parameters[0].value:e.datum_params=i.transformation.parameters.map(t=>t.value)),e):(Object.keys(i).forEach(t=>{const n=i[t];if(n!==null)switch(t){case"name":if(e.srsCode)break;e.name=n,e.srsCode=n;break;case"type":n==="GeographicCRS"?e.projName="longlat":n==="ProjectedCRS"&&i.conversion&&i.conversion.method&&(e.projName=i.conversion.method.name);break;case"datum":case"datum_ensemble":n.ellipsoid&&(e.ellps=n.ellipsoid.name,cf(n,e)),n.prime_meridian&&(e.from_greenwich=n.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=n.name,cf(n,e);break;case"prime_meridian":e.long0=(n.longitude||0)*Math.PI/180;break;case"coordinate_system":if(n.axis){if(e.axis=n.axis.map(s=>{const o=s.direction;if(o==="east")return"e";if(o==="north")return"n";if(o==="west")return"w";if(o==="south")return"s";throw new Error(`Unknown axis direction: ${o}`)}).join("")+"u",n.unit){const{units:s,to_meter:o}=af(n.unit);e.units=s,e.to_meter=o}else if(n.axis[0]&&n.axis[0].unit){const{units:s,to_meter:o}=af(n.axis[0].unit);e.units=s,e.to_meter=o}}break;case"id":n.authority&&n.code&&(e.title=n.authority+":"+n.code);break;case"conversion":n.method&&n.method.name&&(e.projName=n.method.name),n.parameters&&n.parameters.forEach(s=>{const o=s.name.toLowerCase().replace(/\s+/g,"_"),r=s.value;s.unit&&s.unit.conversion_factor?e[o]=r*s.unit.conversion_factor:s.unit==="degree"?e[o]=r*Math.PI/180:e[o]=r});break;case"unit":n.name&&(e.units=n.name.toLowerCase(),e.units==="metre"&&(e.units="meter")),n.conversion_factor&&(e.to_meter=n.conversion_factor);break;case"base_crs":rr(n,e),e.datumCode=n.id?n.id.authority+"_"+n.id.code:n.name;break}}),e.latitude_of_false_origin!==void 0&&(e.lat0=e.latitude_of_false_origin),e.longitude_of_false_origin!==void 0&&(e.long0=e.longitude_of_false_origin),e.latitude_of_standard_parallel!==void 0&&(e.lat0=e.latitude_of_standard_parallel,e.lat1=e.latitude_of_standard_parallel),e.latitude_of_1st_standard_parallel!==void 0&&(e.lat1=e.latitude_of_1st_standard_parallel),e.latitude_of_2nd_standard_parallel!==void 0&&(e.lat2=e.latitude_of_2nd_standard_parallel),e.latitude_of_projection_centre!==void 0&&(e.lat0=e.latitude_of_projection_centre),e.longitude_of_projection_centre!==void 0&&(e.longc=e.longitude_of_projection_centre),e.easting_at_false_origin!==void 0&&(e.x0=e.easting_at_false_origin),e.northing_at_false_origin!==void 0&&(e.y0=e.northing_at_false_origin),e.latitude_of_natural_origin!==void 0&&(e.lat0=e.latitude_of_natural_origin),e.longitude_of_natural_origin!==void 0&&(e.long0=e.longitude_of_natural_origin),e.longitude_of_origin!==void 0&&(e.long0=e.longitude_of_origin),e.false_easting!==void 0&&(e.x0=e.false_easting),e.easting_at_projection_centre&&(e.x0=e.easting_at_projection_centre),e.false_northing!==void 0&&(e.y0=e.false_northing),e.northing_at_projection_centre&&(e.y0=e.northing_at_projection_centre),e.standard_parallel_1!==void 0&&(e.lat1=e.standard_parallel_1),e.standard_parallel_2!==void 0&&(e.lat2=e.standard_parallel_2),e.scale_factor_at_natural_origin!==void 0&&(e.k0=e.scale_factor_at_natural_origin),e.scale_factor_at_projection_centre!==void 0&&(e.k0=e.scale_factor_at_projection_centre),e.scale_factor_on_pseudo_standard_parallel!==void 0&&(e.k0=e.scale_factor_on_pseudo_standard_parallel),e.azimuth!==void 0&&(e.alpha=e.azimuth),e.azimuth_at_projection_centre!==void 0&&(e.alpha=e.azimuth_at_projection_centre),e.angle_from_rectified_to_skew_grid&&(e.rectified_grid_angle=e.angle_from_rectified_to_skew_grid),rf(e),e)}var Qw=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function zw(i,e){var t=e[0],n=e[1];!(t in i)&&n in i&&(i[t]=i[n],e.length===3&&(i[t]=e[2](i[t])))}function df(i){for(var e=Object.keys(i),t=0,n=e.length;t<n;++t){var s=e[t];Qw.indexOf(s)!==-1&&Hw(i[s]),typeof i[s]=="object"&&df(i[s])}}function Hw(i){if(i.AUTHORITY){var e=Object.keys(i.AUTHORITY)[0];e&&e in i.AUTHORITY&&(i.title=e+":"+i.AUTHORITY[e])}if(i.type==="GEOGCS"?i.projName="longlat":i.type==="LOCAL_CS"?(i.projName="identity",i.local=!0):typeof i.PROJECTION=="object"?i.projName=Object.keys(i.PROJECTION)[0]:i.projName=i.PROJECTION,i.AXIS){for(var t="",n=0,s=i.AXIS.length;n<s;++n){var o=[i.AXIS[n][0].toLowerCase(),i.AXIS[n][1].toLowerCase()];o[0].indexOf("north")!==-1||(o[0]==="y"||o[0]==="lat")&&o[1]==="north"?t+="n":o[0].indexOf("south")!==-1||(o[0]==="y"||o[0]==="lat")&&o[1]==="south"?t+="s":o[0].indexOf("east")!==-1||(o[0]==="x"||o[0]==="lon")&&o[1]==="east"?t+="e":(o[0].indexOf("west")!==-1||(o[0]==="x"||o[0]==="lon")&&o[1]==="west")&&(t+="w")}t.length===2&&(t+="u"),t.length===3&&(i.axis=t)}i.UNIT&&(i.units=i.UNIT.name.toLowerCase(),i.units==="metre"&&(i.units="meter"),i.UNIT.convert&&(i.type==="GEOGCS"?i.DATUM&&i.DATUM.SPHEROID&&(i.to_meter=i.UNIT.convert*i.DATUM.SPHEROID.a):i.to_meter=i.UNIT.convert));var r=i.GEOGCS;i.type==="GEOGCS"&&(r=i),r&&(r.DATUM?i.datumCode=r.DATUM.name.toLowerCase():i.datumCode=r.name.toLowerCase(),i.datumCode.slice(0,2)==="d_"&&(i.datumCode=i.datumCode.slice(2)),i.datumCode==="new_zealand_1949"&&(i.datumCode="nzgd49"),(i.datumCode==="wgs_1984"||i.datumCode==="world_geodetic_system_1984")&&(i.PROJECTION==="Mercator_Auxiliary_Sphere"&&(i.sphere=!0),i.datumCode="wgs84"),i.datumCode==="belge_1972"&&(i.datumCode="rnb72"),r.DATUM&&r.DATUM.SPHEROID&&(i.ellps=r.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),i.ellps.toLowerCase().slice(0,13)==="international"&&(i.ellps="intl"),i.a=r.DATUM.SPHEROID.a,i.rf=parseFloat(r.DATUM.SPHEROID.rf,10)),r.DATUM&&r.DATUM.TOWGS84&&(i.datum_params=r.DATUM.TOWGS84),~i.datumCode.indexOf("osgb_1936")&&(i.datumCode="osgb36"),~i.datumCode.indexOf("osni_1952")&&(i.datumCode="osni52"),(~i.datumCode.indexOf("tm65")||~i.datumCode.indexOf("geodetic_datum_of_1965"))&&(i.datumCode="ire65"),i.datumCode==="ch1903+"&&(i.datumCode="ch1903"),~i.datumCode.indexOf("israel")&&(i.datumCode="isr93")),i.b&&!isFinite(i.b)&&(i.b=i.a),i.rectified_grid_angle&&(i.rectified_grid_angle=Ft(i.rectified_grid_angle));function a(h){var u=i.to_meter||1;return h*u}var l=function(h){return zw(i,h)},c=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Ft],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Ft],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Ft],["lat0","latitude_of_origin",Ft],["lat0","standard_parallel_1",Ft],["lat1","standard_parallel_1",Ft],["lat2","standard_parallel_2",Ft],["azimuth","Azimuth"],["alpha","azimuth",Ft],["srsCode","name"]];c.forEach(l),rf(i)}function ar(i){if(typeof i=="object")return rr(i);const e=Rw(i);var t=Uw(i);if(e==="WKT2"){const o=Lw(t);return rr(o)}var n=t[0],s={};return Pn(t,s),df(s),s[n]}function nt(i){var e=this;if(arguments.length===2){var t=arguments[1];typeof t=="string"?t.charAt(0)==="+"?nt[i]=xl(arguments[1]):nt[i]=ar(arguments[1]):t&&typeof t=="object"&&!("projName"in t)?nt[i]=ar(arguments[1]):(nt[i]=t,t||delete nt[i])}else if(arguments.length===1){if(Array.isArray(i))return i.map(function(n){return Array.isArray(n)?nt.apply(e,n):nt(n)});if(typeof i=="string"){if(i in nt)return nt[i]}else"EPSG"in i?nt["EPSG:"+i.EPSG]=i:"ESRI"in i?nt["ESRI:"+i.ESRI]=i:"IAU2000"in i?nt["IAU2000:"+i.IAU2000]=i:console.log(i);return}}Iw(nt);function Yw(i){return typeof i=="string"}function $w(i){return i in nt}function jw(i){return i.indexOf("+")!==0&&i.indexOf("[")!==-1||typeof i=="object"&&!("srsCode"in i)}var Ww=["3857","900913","3785","102113"];function qw(i){var e=Si(i,"authority");if(e){var t=Si(e,"epsg");return t&&Ww.indexOf(t)>-1}}function Kw(i){var e=Si(i,"extension");if(e)return Si(e,"proj4")}function Xw(i){return i[0]==="+"}function Jw(i){if(Yw(i)){if($w(i))return nt[i];if(jw(i)){var e=ar(i);if(qw(e))return nt["EPSG:3857"];var t=Kw(e);return t?xl(t):e}if(Xw(i))return xl(i)}else return"projName"in i?i:ar(i)}function hf(i,e){i=i||{};var t,n;if(!e)return i;for(n in e)t=e[n],t!==void 0&&(i[n]=t);return i}function Jt(i,e,t){var n=i*e;return t/Math.sqrt(1-n*n)}function Ls(i){return i<0?-1:1}function J(i,e){return e||Math.abs(i)<=Ge?i:i-Ls(i)*Ds}function Ot(i,e,t){var n=i*t,s=.5*i;return n=Math.pow((1-n)/(1+n),s),Math.tan(.5*($-e))/n}function Rs(i,e){for(var t=.5*i,n,s,o=$-2*Math.atan(e),r=0;r<=15;r++)if(n=i*Math.sin(o),s=$-2*Math.atan(e*Math.pow((1-n)/(1+n),t))-o,o+=s,Math.abs(s)<=1e-10)return o;return-9999}function Zw(){var i=this.b/this.a;this.es=1-i*i,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Jt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function eE(i){var e=i.x,t=i.y;if(t*bt>90&&t*bt<-90&&e*bt>180&&e*bt<-180)return null;var n,s;if(Math.abs(Math.abs(t)-$)<=K)return null;if(this.sphere)n=this.x0+this.a*this.k0*J(e-this.long0,this.over),s=this.y0+this.a*this.k0*Math.log(Math.tan(Ae+.5*t));else{var o=Math.sin(t),r=Ot(this.e,t,o);n=this.x0+this.a*this.k0*J(e-this.long0,this.over),s=this.y0-this.a*this.k0*Math.log(r)}return i.x=n,i.y=s,i}function tE(i){var e=i.x-this.x0,t=i.y-this.y0,n,s;if(this.sphere)s=$-2*Math.atan(Math.exp(-t/(this.a*this.k0)));else{var o=Math.exp(-t/(this.a*this.k0));if(s=Rs(this.e,o),s===-9999)return null}return n=J(this.long0+e/(this.a*this.k0),this.over),i.x=n,i.y=s,i}var iE=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"];const nE={init:Zw,forward:eE,inverse:tE,names:iE};function sE(){}function uf(i){return i}var ff=["longlat","identity"],oE=[nE,{init:sE,forward:uf,inverse:uf,names:ff}],tn={},Dn=[];function pf(i,e){var t=Dn.length;return i.names?(Dn[t]=i,i.names.forEach(function(n){tn[n.toLowerCase()]=t}),this):(console.log(e),!0)}function mf(i){return i.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}function rE(i){if(!i)return!1;var e=i.toLowerCase();if(typeof tn[e]<"u"&&Dn[tn[e]]||(e=mf(e),e in tn&&Dn[tn[e]]))return Dn[tn[e]]}function aE(){oE.forEach(pf)}const lE={start:aE,add:pf,get:rE};var gf={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},andrae:{a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},clrk80:{a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}};const cE=gf.WGS84;function dE(i,e,t,n){var s=i*i,o=e*e,r=(s-o)/s,a=0;n?(i*=1-r*(Tw+r*(Bw+r*_w)),s=i*i,r=0):a=Math.sqrt(r);var l=(s-o)/o;return{es:r,e:a,ep2:l}}function hE(i,e,t,n,s){if(!i){var o=Si(gf,n);o||(o=cE),i=o.a,e=o.b,t=o.rf}return t&&!e&&(e=(1-1/t)*i),(t===0||Math.abs(i-e)<K)&&(s=!0,e=i),{a:i,b:e,rf:t,sphere:s}}var lr={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.0276,-0.2167,0.2147,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-1.91514,1.60363,-9.09546,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243649,-1.158827,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,32.39344,-153.25684,-96.2266,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-8.393,0.749,-10.276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,1.25033e-7,4.6785e-8,5.6529e-8,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"61.55,-10.87,-40.19,39.4924,32.7221,32.8979,-9.994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.3092483,0.32482185,0.49729934,5.68906266"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"374,150,588"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"}};for(var uE in lr){var Ml=lr[uE];Ml.datumName&&(lr[Ml.datumName]=Ml)}function fE(i,e,t,n,s,o,r){var a={};return i===void 0||i==="none"?a.datum_type=El:a.datum_type=Sw,e&&(a.datum_params=e.map(parseFloat),(a.datum_params[0]!==0||a.datum_params[1]!==0||a.datum_params[2]!==0)&&(a.datum_type=Zi),a.datum_params.length>3&&(a.datum_params[3]!==0||a.datum_params[4]!==0||a.datum_params[5]!==0||a.datum_params[6]!==0)&&(a.datum_type=en,a.datum_params[3]*=Ps,a.datum_params[4]*=Ps,a.datum_params[5]*=Ps,a.datum_params[6]=a.datum_params[6]/1e6+1)),r&&(a.datum_type=kn,a.grids=r),a.a=t,a.b=n,a.es=s,a.ep2=o,a}var Tl={};function pE(i,e,t){return e instanceof ArrayBuffer?mE(i,e,t):{ready:gE(i,e)}}function mE(i,e,t){var n=!0;t!==void 0&&t.includeErrorFields===!1&&(n=!1);var s=new DataView(e),o=vE(s),r=bE(s,o),a=CE(s,r,o,n),l={header:r,subgrids:a};return Tl[i]=l,l}async function gE(i,e){for(var t=[],n=await e.getImageCount(),s=n-1;s>=0;s--){var o=await e.getImage(s),r=await o.readRasters(),a=r,l=[o.getWidth(),o.getHeight()],c=o.getBoundingBox().map(yf),h=[o.fileDirectory.ModelPixelScale[0],o.fileDirectory.ModelPixelScale[1]].map(yf),u=c[0]+(l[0]-1)*h[0],p=c[3]-(l[1]-1)*h[1],f=a[0],m=a[1],y=[];for(let v=l[1]-1;v>=0;v--)for(let C=l[0]-1;C>=0;C--){var g=v*l[0]+C;y.push([-Mi(m[g]),Mi(f[g])])}t.push({del:h,lim:l,ll:[-u,p],cvs:y})}var A={header:{nSubgrids:n},subgrids:t};return Tl[i]=A,A}function yE(i){if(i===void 0)return null;var e=i.split(",");return e.map(AE)}function AE(i){if(i.length===0)return null;var e=i[0]==="@";return e&&(i=i.slice(1)),i==="null"?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:i,mandatory:!e,grid:Tl[i]||null,isNull:!1}}function yf(i){return i*Math.PI/180}function Mi(i){return i/3600*Math.PI/180}function vE(i){var e=i.getInt32(8,!1);return e===11?!1:(e=i.getInt32(8,!0),e!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function bE(i,e){return{nFields:i.getInt32(8,e),nSubgridFields:i.getInt32(24,e),nSubgrids:i.getInt32(40,e),shiftType:Bl(i,56,64).trim(),fromSemiMajorAxis:i.getFloat64(120,e),fromSemiMinorAxis:i.getFloat64(136,e),toSemiMajorAxis:i.getFloat64(152,e),toSemiMinorAxis:i.getFloat64(168,e)}}function Bl(i,e,t){return String.fromCharCode.apply(null,new Uint8Array(i.buffer.slice(e,t)))}function CE(i,e,t,n){for(var s=176,o=[],r=0;r<e.nSubgrids;r++){var a=EE(i,s,t),l=xE(i,s,a,t,n),c=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),h=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);o.push({ll:[Mi(a.lowerLongitude),Mi(a.lowerLatitude)],del:[Mi(a.longitudeInterval),Mi(a.latitudeInterval)],lim:[c,h],count:a.gridNodeCount,cvs:wE(l)});var u=16;n===!1&&(u=8),s+=176+a.gridNodeCount*u}return o}function wE(i){return i.map(function(e){return[Mi(e.longitudeShift),Mi(e.latitudeShift)]})}function EE(i,e,t){return{name:Bl(i,e+8,e+16).trim(),parent:Bl(i,e+24,e+24+8).trim(),lowerLatitude:i.getFloat64(e+72,t),upperLatitude:i.getFloat64(e+88,t),lowerLongitude:i.getFloat64(e+104,t),upperLongitude:i.getFloat64(e+120,t),latitudeInterval:i.getFloat64(e+136,t),longitudeInterval:i.getFloat64(e+152,t),gridNodeCount:i.getInt32(e+168,t)}}function xE(i,e,t,n,s){var o=e+176,r=16;s===!1&&(r=8);for(var a=[],l=0;l<t.gridNodeCount;l++){var c={latitudeShift:i.getFloat32(o+l*r,n),longitudeShift:i.getFloat32(o+l*r+4,n)};s!==!1&&(c.latitudeAccuracy=i.getFloat32(o+l*r+8,n),c.longitudeAccuracy=i.getFloat32(o+l*r+12,n)),a.push(c)}return a}function Pt(i,e){if(!(this instanceof Pt))return new Pt(i);this.forward=null,this.inverse=null,this.init=null,this.name,this.names=null,this.title,e=e||function(c){if(c)throw c};var t=Jw(i);if(typeof t!="object"){e("Could not parse to valid json: "+i);return}var n=Pt.projections.get(t.projName);if(!n){e("Could not get projection name from: "+i);return}if(t.datumCode&&t.datumCode!=="none"){var s=Si(lr,t.datumCode);s&&(t.datum_params=t.datum_params||(s.towgs84?s.towgs84.split(","):null),t.ellps=s.ellipse,t.datumName=s.datumName?s.datumName:t.datumCode)}t.k0=t.k0||1,t.axis=t.axis||"enu",t.ellps=t.ellps||"wgs84",t.lat1=t.lat1||t.lat0;var o=hE(t.a,t.b,t.rf,t.ellps,t.sphere),r=dE(o.a,o.b,o.rf,t.R_A),a=yE(t.nadgrids),l=t.datum||fE(t.datumCode,t.datum_params,o.a,o.b,r.es,r.ep2,a);hf(this,t),hf(this,n),this.a=o.a,this.b=o.b,this.rf=o.rf,this.sphere=o.sphere,this.es=r.es,this.e=r.e,this.ep2=r.ep2,this.datum=l,"init"in this&&typeof this.init=="function"&&this.init(),e(null,this)}Pt.projections=lE,Pt.projections.start();function IE(i,e){return i.datum_type!==e.datum_type||i.a!==e.a||Math.abs(i.es-e.es)>5e-11?!1:i.datum_type===Zi?i.datum_params[0]===e.datum_params[0]&&i.datum_params[1]===e.datum_params[1]&&i.datum_params[2]===e.datum_params[2]:i.datum_type===en?i.datum_params[0]===e.datum_params[0]&&i.datum_params[1]===e.datum_params[1]&&i.datum_params[2]===e.datum_params[2]&&i.datum_params[3]===e.datum_params[3]&&i.datum_params[4]===e.datum_params[4]&&i.datum_params[5]===e.datum_params[5]&&i.datum_params[6]===e.datum_params[6]:!0}function Af(i,e,t){var n=i.x,s=i.y,o=i.z?i.z:0,r,a,l,c;if(s<-$&&s>-1.001*$)s=-$;else if(s>$&&s<1.001*$)s=$;else{if(s<-$)return{x:-1/0,y:-1/0,z:i.z};if(s>$)return{x:1/0,y:1/0,z:i.z}}return n>Math.PI&&(n-=2*Math.PI),a=Math.sin(s),c=Math.cos(s),l=a*a,r=t/Math.sqrt(1-e*l),{x:(r+o)*c*Math.cos(n),y:(r+o)*c*Math.sin(n),z:(r*(1-e)+o)*a}}function vf(i,e,t,n){var s=1e-12,o=s*s,r=30,a,l,c,h,u,p,f,m,y,g,A,v,C,w=i.x,M=i.y,x=i.z?i.z:0,I,S,R;if(a=Math.sqrt(w*w+M*M),l=Math.sqrt(w*w+M*M+x*x),a/t<s){if(I=0,l/t<s)return S=$,R=-n,{x:i.x,y:i.y,z:i.z}}else I=Math.atan2(M,w);c=x/l,h=a/l,u=1/Math.sqrt(1-e*(2-e)*h*h),m=h*(1-e)*u,y=c*u,C=0;do C++,f=t/Math.sqrt(1-e*y*y),R=a*m+x*y-f*(1-e*y*y),p=e*f/(f+R),u=1/Math.sqrt(1-p*(2-p)*h*h),g=h*(1-p)*u,A=c*u,v=A*m-g*y,m=g,y=A;while(v*v>o&&C<r);return S=Math.atan(A/Math.abs(g)),{x:I,y:S,z:R}}function SE(i,e,t){if(e===Zi)return{x:i.x+t[0],y:i.y+t[1],z:i.z+t[2]};if(e===en){var n=t[0],s=t[1],o=t[2],r=t[3],a=t[4],l=t[5],c=t[6];return{x:c*(i.x-l*i.y+a*i.z)+n,y:c*(l*i.x+i.y-r*i.z)+s,z:c*(-a*i.x+r*i.y+i.z)+o}}}function ME(i,e,t){if(e===Zi)return{x:i.x-t[0],y:i.y-t[1],z:i.z-t[2]};if(e===en){var n=t[0],s=t[1],o=t[2],r=t[3],a=t[4],l=t[5],c=t[6],h=(i.x-n)/c,u=(i.y-s)/c,p=(i.z-o)/c;return{x:h+l*u-a*p,y:-l*h+u+r*p,z:a*h-r*u+p}}}function cr(i){return i===Zi||i===en}function TE(i,e,t){if(IE(i,e)||i.datum_type===El||e.datum_type===El)return t;var n=i.a,s=i.es;if(i.datum_type===kn){var o=bf(i,!1,t);if(o!==0)return;n=Xu,s=Ju}var r=e.a,a=e.b,l=e.es;if(e.datum_type===kn&&(r=Xu,a=Mw,l=Ju),s===l&&n===r&&!cr(i.datum_type)&&!cr(e.datum_type))return t;if(t=Af(t,s,n),cr(i.datum_type)&&(t=SE(t,i.datum_type,i.datum_params)),cr(e.datum_type)&&(t=ME(t,e.datum_type,e.datum_params)),t=vf(t,l,r,a),e.datum_type===kn){var c=bf(e,!0,t);if(c!==0)return}return t}function bf(i,e,t){if(i.grids===null||i.grids.length===0)return console.log("Grid shift grids not found"),-1;var n={x:-t.x,y:t.y},s={x:Number.NaN,y:Number.NaN},o=[];e:for(var r=0;r<i.grids.length;r++){var a=i.grids[r];if(o.push(a.name),a.isNull){s=n;break}if(a.grid===null){if(a.mandatory)return console.log("Unable to find mandatory grid '"+a.name+"'"),-1;continue}for(var l=a.grid.subgrids,c=0,h=l.length;c<h;c++){var u=l[c],p=(Math.abs(u.del[1])+Math.abs(u.del[0]))/1e4,f=u.ll[0]-p,m=u.ll[1]-p,y=u.ll[0]+(u.lim[0]-1)*u.del[0]+p,g=u.ll[1]+(u.lim[1]-1)*u.del[1]+p;if(!(m>n.y||f>n.x||g<n.y||y<n.x)&&(s=BE(n,e,u),!isNaN(s.x)))break e}}return isNaN(s.x)?(console.log("Failed to find a grid shift table for location '"+-n.x*bt+" "+n.y*bt+" tried: '"+o+"'"),-1):(t.x=-s.x,t.y=s.y,0)}function BE(i,e,t){var n={x:Number.NaN,y:Number.NaN};if(isNaN(i.x))return n;var s={x:i.x,y:i.y};s.x-=t.ll[0],s.y-=t.ll[1],s.x=J(s.x-Math.PI)+Math.PI;var o=Cf(s,t);if(e){if(isNaN(o.x))return n;o.x=s.x-o.x,o.y=s.y-o.y;var r=9,a=1e-12,l,c;do{if(c=Cf(o,t),isNaN(c.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}l={x:s.x-(c.x+o.x),y:s.y-(c.y+o.y)},o.x+=l.x,o.y+=l.y}while(r--&&Math.abs(l.x)>a&&Math.abs(l.y)>a);if(r<0)return console.log("Inverse grid shift iterator failed to converge."),n;n.x=J(o.x+t.ll[0]),n.y=o.y+t.ll[1]}else isNaN(o.x)||(n.x=i.x+o.x,n.y=i.y+o.y);return n}function Cf(i,e){var t={x:i.x/e.del[0],y:i.y/e.del[1]},n={x:Math.floor(t.x),y:Math.floor(t.y)},s={x:t.x-1*n.x,y:t.y-1*n.y},o={x:Number.NaN,y:Number.NaN},r;if(n.x<0||n.x>=e.lim[0]||n.y<0||n.y>=e.lim[1])return o;r=n.y*e.lim[0]+n.x;var a={x:e.cvs[r][0],y:e.cvs[r][1]};r++;var l={x:e.cvs[r][0],y:e.cvs[r][1]};r+=e.lim[0];var c={x:e.cvs[r][0],y:e.cvs[r][1]};r--;var h={x:e.cvs[r][0],y:e.cvs[r][1]},u=s.x*s.y,p=s.x*(1-s.y),f=(1-s.x)*(1-s.y),m=(1-s.x)*s.y;return o.x=f*a.x+p*l.x+m*h.x+u*c.x,o.y=f*a.y+p*l.y+m*h.y+u*c.y,o}function wf(i,e,t){var n=t.x,s=t.y,o=t.z||0,r,a,l,c={};for(l=0;l<3;l++)if(!(e&&l===2&&t.z===void 0))switch(l===0?(r=n,"ew".indexOf(i.axis[l])!==-1?a="x":a="y"):l===1?(r=s,"ns".indexOf(i.axis[l])!==-1?a="y":a="x"):(r=o,a="z"),i.axis[l]){case"e":c[a]=r;break;case"w":c[a]=-r;break;case"n":c[a]=r;break;case"s":c[a]=-r;break;case"u":t[a]!==void 0&&(c.z=r);break;case"d":t[a]!==void 0&&(c.z=-r);break;default:return null}return c}function Ef(i){var e={x:i[0],y:i[1]};return i.length>2&&(e.z=i[2]),i.length>3&&(e.m=i[3]),e}function _E(i){xf(i.x),xf(i.y)}function xf(i){if(typeof Number.isFinite=="function"){if(Number.isFinite(i))return;throw new TypeError("coordinates must be finite numbers")}if(typeof i!="number"||i!==i||!isFinite(i))throw new TypeError("coordinates must be finite numbers")}function kE(i,e){return(i.datum.datum_type===Zi||i.datum.datum_type===en||i.datum.datum_type===kn)&&e.datumCode!=="WGS84"||(e.datum.datum_type===Zi||e.datum.datum_type===en||e.datum.datum_type===kn)&&i.datumCode!=="WGS84"}function dr(i,e,t,n){var s;Array.isArray(t)?t=Ef(t):t={x:t.x,y:t.y,z:t.z,m:t.m};var o=t.z!==void 0;if(_E(t),i.datum&&e.datum&&kE(i,e)&&(s=new Pt("WGS84"),t=dr(i,s,t,n),i=s),n&&i.axis!=="enu"&&(t=wf(i,!1,t)),i.projName==="longlat")t={x:t.x*Oe,y:t.y*Oe,z:t.z||0};else if(i.to_meter&&(t={x:t.x*i.to_meter,y:t.y*i.to_meter,z:t.z||0}),t=i.inverse(t),!t)return;if(i.from_greenwich&&(t.x+=i.from_greenwich),t=TE(i.datum,e.datum,t),!!t)return t=t,e.from_greenwich&&(t={x:t.x-e.from_greenwich,y:t.y,z:t.z||0}),e.projName==="longlat"?t={x:t.x*bt,y:t.y*bt,z:t.z||0}:(t=e.forward(t),e.to_meter&&(t={x:t.x/e.to_meter,y:t.y/e.to_meter,z:t.z||0})),n&&e.axis!=="enu"?wf(e,!0,t):(t&&!o&&delete t.z,t)}var If=Pt("WGS84");function _l(i,e,t,n){var s,o,r;return Array.isArray(t)?(s=dr(i,e,t,n)||{x:NaN,y:NaN},t.length>2?typeof i.name<"u"&&i.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"?typeof s.z=="number"?[s.x,s.y,s.z].concat(t.slice(3)):[s.x,s.y,t[2]].concat(t.slice(3)):[s.x,s.y].concat(t.slice(2)):[s.x,s.y]):(o=dr(i,e,t,n),r=Object.keys(t),r.length===2||r.forEach(function(a){if(typeof i.name<"u"&&i.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"){if(a==="x"||a==="y"||a==="z")return}else if(a==="x"||a==="y")return;o[a]=t[a]}),o)}function hr(i){return i instanceof Pt?i:typeof i=="object"&&"oProj"in i?i.oProj:Pt(i)}function PE(i,e,t){var n,s,o=!1,r;return typeof e>"u"?(s=hr(i),n=If,o=!0):(typeof e.x<"u"||Array.isArray(e))&&(t=e,s=hr(i),n=If,o=!0),n||(n=hr(i)),s||(s=hr(e)),t?_l(n,s,t):(r={forward:function(a,l){return _l(n,s,a,l)},inverse:function(a,l){return _l(s,n,a,l)}},o&&(r.oProj=s),r)}var Sf=6,Mf="AJSAJS",Tf="AFAFAF",Nn=65,wt=73,Dt=79,Fs=86,Os=90;const DE={forward:Bf,inverse:NE,toPoint:_f};function Bf(i,e){return e=e||5,FE(LE({lat:i[1],lon:i[0]}),e)}function NE(i){var e=Pl(Df(i.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function _f(i){var e=Pl(Df(i.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function kl(i){return i*(Math.PI/180)}function kf(i){return 180*(i/Math.PI)}function LE(i){var e=i.lat,t=i.lon,n=6378137,s=.00669438,o=.9996,r,a,l,c,h,u,p,f=kl(e),m=kl(t),y,g;g=Math.floor((t+180)/6)+1,t===180&&(g=60),e>=56&&e<64&&t>=3&&t<12&&(g=32),e>=72&&e<84&&(t>=0&&t<9?g=31:t>=9&&t<21?g=33:t>=21&&t<33?g=35:t>=33&&t<42&&(g=37)),r=(g-1)*6-180+3,y=kl(r),a=s/(1-s),l=n/Math.sqrt(1-s*Math.sin(f)*Math.sin(f)),c=Math.tan(f)*Math.tan(f),h=a*Math.cos(f)*Math.cos(f),u=Math.cos(f)*(m-y),p=n*((1-s/4-3*s*s/64-5*s*s*s/256)*f-(3*s/8+3*s*s/32+45*s*s*s/1024)*Math.sin(2*f)+(15*s*s/256+45*s*s*s/1024)*Math.sin(4*f)-35*s*s*s/3072*Math.sin(6*f));var A=o*l*(u+(1-c+h)*u*u*u/6+(5-18*c+c*c+72*h-58*a)*u*u*u*u*u/120)+5e5,v=o*(p+l*Math.tan(f)*(u*u/2+(5-c+9*h+4*h*h)*u*u*u*u/24+(61-58*c+c*c+600*h-330*a)*u*u*u*u*u*u/720));return e<0&&(v+=1e7),{northing:Math.round(v),easting:Math.round(A),zoneNumber:g,zoneLetter:RE(e)}}function Pl(i){var e=i.northing,t=i.easting,n=i.zoneLetter,s=i.zoneNumber;if(s<0||s>60)return null;var o=.9996,r=6378137,a=.00669438,l,c=(1-Math.sqrt(1-a))/(1+Math.sqrt(1-a)),h,u,p,f,m,y,g,A,v,C=t-5e5,w=e;n<"N"&&(w-=1e7),g=(s-1)*6-180+3,l=a/(1-a),y=w/o,A=y/(r*(1-a/4-3*a*a/64-5*a*a*a/256)),v=A+(3*c/2-27*c*c*c/32)*Math.sin(2*A)+(21*c*c/16-55*c*c*c*c/32)*Math.sin(4*A)+151*c*c*c/96*Math.sin(6*A),h=r/Math.sqrt(1-a*Math.sin(v)*Math.sin(v)),u=Math.tan(v)*Math.tan(v),p=l*Math.cos(v)*Math.cos(v),f=r*(1-a)/Math.pow(1-a*Math.sin(v)*Math.sin(v),1.5),m=C/(h*o);var M=v-h*Math.tan(v)/f*(m*m/2-(5+3*u+10*p-4*p*p-9*l)*m*m*m*m/24+(61+90*u+298*p+45*u*u-252*l-3*p*p)*m*m*m*m*m*m/720);M=kf(M);var x=(m-(1+2*u+p)*m*m*m/6+(5-2*p+28*u-3*p*p+8*l+24*u*u)*m*m*m*m*m/120)/Math.cos(v);x=g+kf(x);var I;if(i.accuracy){var S=Pl({northing:i.northing+i.accuracy,easting:i.easting+i.accuracy,zoneLetter:i.zoneLetter,zoneNumber:i.zoneNumber});I={top:S.lat,right:S.lon,bottom:M,left:x}}else I={lat:M,lon:x};return I}function RE(i){var e="Z";return 84>=i&&i>=72?e="X":72>i&&i>=64?e="W":64>i&&i>=56?e="V":56>i&&i>=48?e="U":48>i&&i>=40?e="T":40>i&&i>=32?e="S":32>i&&i>=24?e="R":24>i&&i>=16?e="Q":16>i&&i>=8?e="P":8>i&&i>=0?e="N":0>i&&i>=-8?e="M":-8>i&&i>=-16?e="L":-16>i&&i>=-24?e="K":-24>i&&i>=-32?e="J":-32>i&&i>=-40?e="H":-40>i&&i>=-48?e="G":-48>i&&i>=-56?e="F":-56>i&&i>=-64?e="E":-64>i&&i>=-72?e="D":-72>i&&i>=-80&&(e="C"),e}function FE(i,e){var t="00000"+i.easting,n="00000"+i.northing;return i.zoneNumber+i.zoneLetter+OE(i.easting,i.northing,i.zoneNumber)+t.substr(t.length-5,e)+n.substr(n.length-5,e)}function OE(i,e,t){var n=Pf(t),s=Math.floor(i/1e5),o=Math.floor(e/1e5)%20;return GE(s,o,n)}function Pf(i){var e=i%Sf;return e===0&&(e=Sf),e}function GE(i,e,t){var n=t-1,s=Mf.charCodeAt(n),o=Tf.charCodeAt(n),r=s+i-1,a=o+e,l=!1;r>Os&&(r=r-Os+Nn-1,l=!0),(r===wt||s<wt&&r>wt||(r>wt||s<wt)&&l)&&r++,(r===Dt||s<Dt&&r>Dt||(r>Dt||s<Dt)&&l)&&(r++,r===wt&&r++),r>Os&&(r=r-Os+Nn-1),a>Fs?(a=a-Fs+Nn-1,l=!0):l=!1,(a===wt||o<wt&&a>wt||(a>wt||o<wt)&&l)&&a++,(a===Dt||o<Dt&&a>Dt||(a>Dt||o<Dt)&&l)&&(a++,a===wt&&a++),a>Fs&&(a=a-Fs+Nn-1);var c=String.fromCharCode(r)+String.fromCharCode(a);return c}function Df(i){if(i&&i.length===0)throw"MGRSPoint coverting from nothing";for(var e=i.length,t=null,n="",s,o=0;!/[A-Z]/.test(s=i.charAt(o));){if(o>=2)throw"MGRSPoint bad conversion from: "+i;n+=s,o++}var r=parseInt(n,10);if(o===0||o+3>e)throw"MGRSPoint bad conversion from: "+i;var a=i.charAt(o++);if(a<="A"||a==="B"||a==="Y"||a>="Z"||a==="I"||a==="O")throw"MGRSPoint zone letter "+a+" not handled: "+i;t=i.substring(o,o+=2);for(var l=Pf(r),c=UE(t.charAt(0),l),h=VE(t.charAt(1),l);h<QE(a);)h+=2e6;var u=e-o;if(u%2!==0)throw`MGRSPoint has to have an even number
|
|
14
14
|
of digits after the zone letter and two 100km letters - front
|
|
15
15
|
half for easting meters, second half for
|
|
16
|
-
northing meters`+i;var p=u/2,f=0,m=0,y,g,A,v,C;return p>0&&(y=1e5/Math.pow(10,p),g=i.substring(o,o+p),f=parseFloat(g)*y,A=i.substring(o+p),m=parseFloat(A)*y),v=f+c,C=m+h,{easting:v,northing:C,zoneLetter:a,zoneNumber:r,accuracy:y}}function UE(i,e){for(var t=Mf.charCodeAt(e-1),n=1e5,s=!1;t!==i.charCodeAt(0);){if(t++,t===wt&&t++,t===Dt&&t++,t>Os){if(s)throw"Bad character: "+i;t=Nn,s=!0}n+=1e5}return n}function VE(i,e){if(i>"V")throw"MGRSPoint given invalid Northing "+i;for(var t=Tf.charCodeAt(e-1),n=0,s=!1;t!==i.charCodeAt(0);){if(t++,t===wt&&t++,t===Dt&&t++,t>Fs){if(s)throw"Bad character: "+i;t=Nn,s=!0}n+=1e5}return n}function QE(i){var e;switch(i){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+i}function Ln(i,e,t){if(!(this instanceof Ln))return new Ln(i,e,t);if(Array.isArray(i))this.x=i[0],this.y=i[1],this.z=i[2]||0;else if(typeof i=="object")this.x=i.x,this.y=i.y,this.z=i.z||0;else if(typeof i=="string"&&typeof e>"u"){var n=i.split(",");this.x=parseFloat(n[0]),this.y=parseFloat(n[1]),this.z=parseFloat(n[2])||0}else this.x=i,this.y=e,this.z=t||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Ln.fromMGRS=function(i){return new Ln(_f(i))},Ln.prototype.toMGRS=function(i){return Bf([this.x,this.y],i)};var zE=1,HE=.25,Nf=.046875,Lf=.01953125,Rf=.01068115234375,YE=.75,$E=.46875,jE=.013020833333333334,WE=.007120768229166667,qE=.3645833333333333,KE=.005696614583333333,XE=.3076171875;function Dl(i){var e=[];e[0]=zE-i*(HE+i*(Nf+i*(Lf+i*Rf))),e[1]=i*(YE-i*(Nf+i*(Lf+i*Rf)));var t=i*i;return e[2]=t*($E-i*(jE+i*WE)),t*=i,e[3]=t*(qE-i*KE),e[4]=t*i*XE,e}function Rn(i,e,t,n){return t*=e,e*=e,n[0]*i-t*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}var JE=20;function Nl(i,e,t){for(var n=1/(1-e),s=i,o=JE;o;--o){var r=Math.sin(s),a=1-e*r*r;if(a=(Rn(s,r,Math.cos(s),t)-i)*(a*Math.sqrt(a))*n,s-=a,Math.abs(a)<K)return s}return s}function ZE(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=Dl(this.es),this.ml0=Rn(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function ex(i){var e=i.x,t=i.y,n=J(e-this.long0,this.over),s,o,r,a=Math.sin(t),l=Math.cos(t);if(this.es){var h=l*n,u=Math.pow(h,2),p=this.ep2*Math.pow(l,2),f=Math.pow(p,2),m=Math.abs(l)>K?Math.tan(t):0,y=Math.pow(m,2),g=Math.pow(y,2);s=1-this.es*Math.pow(a,2),h=h/Math.sqrt(s);var A=Rn(t,a,l,this.en);o=this.a*(this.k0*h*(1+u/6*(1-y+p+u/20*(5-18*y+g+14*p-58*y*p+u/42*(61+179*g-g*y-479*y)))))+this.x0,r=this.a*(this.k0*(A-this.ml0+a*n*h/2*(1+u/12*(5-y+9*p+4*f+u/30*(61+g-58*y+270*p-330*y*p+u/56*(1385+543*g-g*y-3111*y))))))+this.y0}else{var c=l*Math.sin(n);if(Math.abs(Math.abs(c)-1)<K)return 93;if(o=.5*this.a*this.k0*Math.log((1+c)/(1-c))+this.x0,r=l*Math.cos(n)/Math.sqrt(1-Math.pow(c,2)),c=Math.abs(r),c>=1){if(c-1>K)return 93;r=0}else r=Math.acos(r);t<0&&(r=-r),r=this.a*this.k0*(r-this.lat0)+this.y0}return i.x=o,i.y=r,i}function tx(i){var e,t,n,s,o=(i.x-this.x0)*(1/this.a),r=(i.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+r/this.k0,t=Nl(e,this.es,this.en),Math.abs(t)<$){var u=Math.sin(t),p=Math.cos(t),f=Math.abs(p)>K?Math.tan(t):0,m=this.ep2*Math.pow(p,2),y=Math.pow(m,2),g=Math.pow(f,2),A=Math.pow(g,2);e=1-this.es*Math.pow(u,2);var v=o*Math.sqrt(e)/this.k0,C=Math.pow(v,2);e=e*f,n=t-e*C/(1-this.es)*.5*(1-C/12*(5+3*g-9*m*g+m-4*y-C/30*(61+90*g-252*m*g+45*A+46*m-C/56*(1385+3633*g+4095*A+1574*A*g)))),s=J(this.long0+v*(1-C/6*(1+2*g+m-C/20*(5+28*g+24*A+8*m*g+6*m-C/42*(61+662*g+1320*A+720*A*g))))/p,this.over)}else n=$*Ls(r),s=0;else{var a=Math.exp(o/this.k0),l=.5*(a-1/a),c=this.lat0+r/this.k0,h=Math.cos(c);e=Math.sqrt((1-Math.pow(h,2))/(1+Math.pow(l,2))),n=Math.asin(e),r<0&&(n=-n),l===0&&h===0?s=0:s=J(Math.atan2(l,h)+this.long0,this.over)}return i.x=s,i.y=n,i}var ix=["Fast_Transverse_Mercator","Fast Transverse Mercator"];const ur={init:ZE,forward:ex,inverse:tx,names:ix};function Ff(i){var e=Math.exp(i);return e=(e-1/e)/2,e}function Et(i,e){i=Math.abs(i),e=Math.abs(e);var t=Math.max(i,e),n=Math.min(i,e)/(t||1);return t*Math.sqrt(1+Math.pow(n,2))}function nx(i){var e=1+i,t=e-1;return t===0?i:i*Math.log(e)/t}function sx(i){var e=Math.abs(i);return e=nx(e*(1+e/(Et(1,e)+1))),i<0?-e:e}function Ll(i,e){for(var t=2*Math.cos(2*e),n=i.length-1,s=i[n],o=0,r;--n>=0;)r=-o+t*s+i[n],o=s,s=r;return e+r*Math.sin(2*e)}function ox(i,e){for(var t=2*Math.cos(e),n=i.length-1,s=i[n],o=0,r;--n>=0;)r=-o+t*s+i[n],o=s,s=r;return Math.sin(e)*r}function rx(i){var e=Math.exp(i);return e=(e+1/e)/2,e}function Of(i,e,t){for(var n=Math.sin(e),s=Math.cos(e),o=Ff(t),r=rx(t),a=2*s*r,l=-2*n*o,c=i.length-1,h=i[c],u=0,p=0,f=0,m,y;--c>=0;)m=p,y=u,p=h,u=f,h=-m+a*p-l*u+i[c],f=-y+l*p+a*u;return a=n*r,l=s*o,[a*h-l*f,a*f+l*h]}function ax(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(ur.init.apply(this),this.forward=ur.forward,this.inverse=ur.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var i=this.es/(1+Math.sqrt(1-this.es)),e=i/(2-i),t=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),t=t*e,this.cgb[1]=t*(7/3+e*(-8/5+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=t*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),t=t*e,this.cgb[2]=t*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=t*(-26/15+e*(34/21+e*(8/5+e*(-12686/2835)))),t=t*e,this.cgb[3]=t*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=t*(1237/630+e*(-12/5+e*(-24832/14175))),t=t*e,this.cgb[4]=t*(4174/315+e*(-144838/6237)),this.cbg[4]=t*(-734/315+e*(109598/31185)),t=t*e,this.cgb[5]=t*(601676/22275),this.cbg[5]=t*(444337/155925),t=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+t*(1/4+t*(1/64+t/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=t*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=t*(13/48+e*(-3/5+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),t=t*e,this.utg[2]=t*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=t*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),t=t*e,this.utg[3]=t*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=t*(49561/161280+e*(-179/168+e*(6601661/7257600))),t=t*e,this.utg[4]=t*(-4583/161280+e*(108847/3991680)),this.gtu[4]=t*(34729/80640+e*(-3418889/1995840)),t=t*e,this.utg[5]=t*(-20648693/638668800),this.gtu[5]=t*(212378941/319334400);var n=Ll(this.cbg,this.lat0);this.Zb=-this.Qn*(n+ox(this.gtu,2*n))}function lx(i){var e=J(i.x-this.long0,this.over),t=i.y;t=Ll(this.cbg,t);var n=Math.sin(t),s=Math.cos(t),o=Math.sin(e),r=Math.cos(e);t=Math.atan2(n,r*s),e=Math.atan2(o*s,Et(n,s*r)),e=sx(Math.tan(e));var a=Of(this.gtu,2*t,2*e);t=t+a[0],e=e+a[1];var l,c;return Math.abs(e)<=2.623395162778?(l=this.a*(this.Qn*e)+this.x0,c=this.a*(this.Qn*t+this.Zb)+this.y0):(l=1/0,c=1/0),i.x=l,i.y=c,i}function cx(i){var e=(i.x-this.x0)*(1/this.a),t=(i.y-this.y0)*(1/this.a);t=(t-this.Zb)/this.Qn,e=e/this.Qn;var n,s;if(Math.abs(e)<=2.623395162778){var o=Of(this.utg,2*t,2*e);t=t+o[0],e=e+o[1],e=Math.atan(Ff(e));var r=Math.sin(t),a=Math.cos(t),l=Math.sin(e),c=Math.cos(e);t=Math.atan2(r*c,Et(l,c*a)),e=Math.atan2(l,c*a),n=J(e+this.long0,this.over),s=Ll(this.cgb,t)}else n=1/0,s=1/0;return i.x=n,i.y=s,i}var dx=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"];const fr={init:ax,forward:lx,inverse:cx,names:dx};function hx(i,e){if(i===void 0){if(i=Math.floor((J(e)+Math.PI)*30/Math.PI)+1,i<0)return 0;if(i>60)return 60}return i}var ux="etmerc";function fx(){var i=hx(this.zone,this.long0);if(i===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(i)-183)*Oe,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,fr.init.apply(this),this.forward=fr.forward,this.inverse=fr.inverse}var px=["Universal Transverse Mercator System","utm"];const mx={init:fx,names:px,dependsOn:ux};function Rl(i,e){return Math.pow((1-i)/(1+i),e)}var gx=20;function yx(){var i=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*i*i),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(i/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+Ae)/(Math.pow(Math.tan(.5*this.lat0+Ae),this.C)*Rl(this.e*i,this.ratexp))}function Ax(i){var e=i.x,t=i.y;return i.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*t+Ae),this.C)*Rl(this.e*Math.sin(t),this.ratexp))-$,i.x=this.C*e,i}function vx(i){for(var e=1e-14,t=i.x/this.C,n=i.y,s=Math.pow(Math.tan(.5*n+Ae)/this.K,1/this.C),o=gx;o>0&&(n=2*Math.atan(s*Rl(this.e*Math.sin(i.y),-.5*this.e))-$,!(Math.abs(n-i.y)<e));--o)i.y=n;return o?(i.x=t,i.y=n,i):null}const Fl={init:yx,forward:Ax,inverse:vx};function bx(){Fl.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function Cx(i){var e,t,n,s;return i.x=J(i.x-this.long0,this.over),Fl.forward.apply(this,[i]),e=Math.sin(i.y),t=Math.cos(i.y),n=Math.cos(i.x),s=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*t*n),i.x=s*t*Math.sin(i.x),i.y=s*(this.cosc0*e-this.sinc0*t*n),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function wx(i){var e,t,n,s,o;if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,o=Et(i.x,i.y)){var r=2*Math.atan2(o,this.R2);e=Math.sin(r),t=Math.cos(r),s=Math.asin(t*this.sinc0+i.y*e*this.cosc0/o),n=Math.atan2(i.x*e,o*this.cosc0*t-i.y*this.sinc0*e)}else s=this.phic0,n=0;return i.x=n,i.y=s,Fl.inverse.apply(this,[i]),i.x=J(i.x+this.long0,this.over),i}var Ex=["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"];const xx={init:bx,forward:Cx,inverse:wx,names:Ex};function Ol(i,e,t){return e*=t,Math.tan(.5*($+i))*Math.pow((1-e)/(1+e),.5*t)}function Ix(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=K&&(this.k0=.5*(1+Ls(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=K&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=K&&Math.abs(Math.cos(this.lat_ts))>K&&(this.k0=.5*this.cons*Jt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Ot(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Jt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(Ol(this.lat0,this.sinlat0,this.e))-$,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Sx(i){var e=i.x,t=i.y,n=Math.sin(t),s=Math.cos(t),o,r,a,l,c,h,u=J(e-this.long0,this.over);return Math.abs(Math.abs(e-this.long0)-Math.PI)<=K&&Math.abs(t+this.lat0)<=K?(i.x=NaN,i.y=NaN,i):this.sphere?(o=2*this.k0/(1+this.sinlat0*n+this.coslat0*s*Math.cos(u)),i.x=this.a*o*s*Math.sin(u)+this.x0,i.y=this.a*o*(this.coslat0*n-this.sinlat0*s*Math.cos(u))+this.y0,i):(r=2*Math.atan(Ol(t,n,this.e))-$,l=Math.cos(r),a=Math.sin(r),Math.abs(this.coslat0)<=K?(c=Ot(this.e,t*this.con,this.con*n),h=2*this.a*this.k0*c/this.cons,i.x=this.x0+h*Math.sin(e-this.long0),i.y=this.y0-this.con*h*Math.cos(e-this.long0),i):(Math.abs(this.sinlat0)<K?(o=2*this.a*this.k0/(1+l*Math.cos(u)),i.y=o*a):(o=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*l*Math.cos(u))),i.y=o*(this.cosX0*a-this.sinX0*l*Math.cos(u))+this.y0),i.x=o*l*Math.sin(u)+this.x0,i))}function Mx(i){i.x-=this.x0,i.y-=this.y0;var e,t,n,s,o,r=Math.sqrt(i.x*i.x+i.y*i.y);if(this.sphere){var a=2*Math.atan(r/(2*this.a*this.k0));return e=this.long0,t=this.lat0,r<=K?(i.x=e,i.y=t,i):(t=Math.asin(Math.cos(a)*this.sinlat0+i.y*Math.sin(a)*this.coslat0/r),Math.abs(this.coslat0)<K?this.lat0>0?e=J(this.long0+Math.atan2(i.x,-1*i.y),this.over):e=J(this.long0+Math.atan2(i.x,i.y),this.over):e=J(this.long0+Math.atan2(i.x*Math.sin(a),r*this.coslat0*Math.cos(a)-i.y*this.sinlat0*Math.sin(a)),this.over),i.x=e,i.y=t,i)}else if(Math.abs(this.coslat0)<=K){if(r<=K)return t=this.lat0,e=this.long0,i.x=e,i.y=t,i;i.x*=this.con,i.y*=this.con,n=r*this.cons/(2*this.a*this.k0),t=this.con*Rs(this.e,n),e=this.con*J(this.con*this.long0+Math.atan2(i.x,-1*i.y),this.over)}else s=2*Math.atan(r*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,r<=K?o=this.X0:(o=Math.asin(Math.cos(s)*this.sinX0+i.y*Math.sin(s)*this.cosX0/r),e=J(this.long0+Math.atan2(i.x*Math.sin(s),r*this.cosX0*Math.cos(s)-i.y*this.sinX0*Math.sin(s)),this.over)),t=-1*Rs(this.e,Math.tan(.5*($+o)));return i.x=e,i.y=t,i}var Tx=["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"];const Bx={init:Ix,forward:Sx,inverse:Mx,names:Tx,ssfn_:Ol};function _x(){var i=this.lat0;this.lambda0=this.long0;var e=Math.sin(i),t=this.a,n=this.rf,s=1/n,o=2*s-Math.pow(s,2),r=this.e=Math.sqrt(o);this.R=this.k0*t*Math.sqrt(1-o)/(1-o*Math.pow(e,2)),this.alpha=Math.sqrt(1+o/(1-o)*Math.pow(Math.cos(i),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+i/2)),c=Math.log((1+r*e)/(1-r*e));this.K=a-this.alpha*l+this.alpha*r/2*c}function kx(i){var e=Math.log(Math.tan(Math.PI/4-i.y/2)),t=this.e/2*Math.log((1+this.e*Math.sin(i.y))/(1-this.e*Math.sin(i.y))),n=-this.alpha*(e+t)+this.K,s=2*(Math.atan(Math.exp(n))-Math.PI/4),o=this.alpha*(i.x-this.lambda0),r=Math.atan(Math.sin(o)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(o))),a=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(o));return i.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,i.x=this.R*r+this.x0,i}function Px(i){for(var e=i.x-this.x0,t=i.y-this.y0,n=e/this.R,s=2*(Math.atan(Math.exp(t/this.R))-Math.PI/4),o=Math.asin(Math.cos(this.b0)*Math.sin(s)+Math.sin(this.b0)*Math.cos(s)*Math.cos(n)),r=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(s))),a=this.lambda0+r/this.alpha,l=0,c=o,h=-1e3,u=0;Math.abs(c-h)>1e-7;){if(++u>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+o/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(c))/2)),h=c,c=2*Math.atan(Math.exp(l))-Math.PI/2}return i.x=a,i.y=c,i}var Dx=["somerc"];const Nx={init:_x,forward:kx,inverse:Px,names:Dx};var Fn=1e-7;function Lx(i){var e=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],t=typeof i.projName=="object"?Object.keys(i.projName)[0]:i.projName;return"no_uoff"in i||"no_off"in i||e.indexOf(t)!==-1||e.indexOf(mf(t))!==-1}function Rx(){var i,e,t,n,s,o,r,a,l,c,h=0,u,p=0,f=0,m=0,y=0,g=0,A=0;this.no_off=Lx(this),this.no_rot="no_rot"in this;var v=!1;"alpha"in this&&(v=!0);var C=!1;if("rectified_grid_angle"in this&&(C=!0),v&&(A=this.alpha),C&&(h=this.rectified_grid_angle),v||C)p=this.longc;else if(f=this.long1,y=this.lat1,m=this.long2,g=this.lat2,Math.abs(y-g)<=Fn||(i=Math.abs(y))<=Fn||Math.abs(i-$)<=Fn||Math.abs(Math.abs(this.lat0)-$)<=Fn||Math.abs(Math.abs(g)-$)<=Fn)throw new Error;var w=1-this.es;e=Math.sqrt(w),Math.abs(this.lat0)>K?(a=Math.sin(this.lat0),t=Math.cos(this.lat0),i=1-this.es*a*a,this.B=t*t,this.B=Math.sqrt(1+this.es*this.B*this.B/w),this.A=this.B*this.k0*e/i,n=this.B*e/(t*Math.sqrt(i)),s=n*n-1,s<=0?s=0:(s=Math.sqrt(s),this.lat0<0&&(s=-s)),this.E=s+=n,this.E*=Math.pow(Ot(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=s=1),v||C?(v?(u=Math.asin(Math.sin(A)/n),C||(h=A)):(u=h,A=Math.asin(n*Math.sin(u))),this.lam0=p-Math.asin(.5*(s-1/s)*Math.tan(u))/this.B):(o=Math.pow(Ot(this.e,y,Math.sin(y)),this.B),r=Math.pow(Ot(this.e,g,Math.sin(g)),this.B),s=this.E/o,l=(r-o)/(r+o),c=this.E*this.E,c=(c-r*o)/(c+r*o),i=f-m,i<-Math.PI?m-=Ds:i>Math.PI&&(m+=Ds),this.lam0=J(.5*(f+m)-Math.atan(c*Math.tan(.5*this.B*(f-m))/l)/this.B,this.over),u=Math.atan(2*Math.sin(this.B*J(f-this.lam0,this.over))/(s-1/s)),h=A=Math.asin(n*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(h),this.cosrot=Math.cos(h),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(A))),this.lat0<0&&(this.u_0=-this.u_0)),s=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(Ae-s)),this.v_pole_s=this.ArB*Math.log(Math.tan(Ae+s))}function Fx(i){var e={},t,n,s,o,r,a,l,c;if(i.x=i.x-this.lam0,Math.abs(Math.abs(i.y)-$)>K){if(r=this.E/Math.pow(Ot(this.e,i.y,Math.sin(i.y)),this.B),a=1/r,t=.5*(r-a),n=.5*(r+a),o=Math.sin(this.B*i.x),s=(t*this.singam-o*this.cosgam)/n,Math.abs(Math.abs(s)-1)<K)throw new Error;c=.5*this.ArB*Math.log((1-s)/(1+s)),a=Math.cos(this.B*i.x),Math.abs(a)<Fn?l=this.A*i.x:l=this.ArB*Math.atan2(t*this.cosgam+o*this.singam,a)}else c=i.y>0?this.v_pole_n:this.v_pole_s,l=this.ArB*i.y;return this.no_rot?(e.x=l,e.y=c):(l-=this.u_0,e.x=c*this.cosrot+l*this.sinrot,e.y=l*this.cosrot-c*this.sinrot),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function Ox(i){var e,t,n,s,o,r,a,l={};if(i.x=(i.x-this.x0)*(1/this.a),i.y=(i.y-this.y0)*(1/this.a),this.no_rot?(t=i.y,e=i.x):(t=i.x*this.cosrot-i.y*this.sinrot,e=i.y*this.cosrot+i.x*this.sinrot+this.u_0),n=Math.exp(-this.BrA*t),s=.5*(n-1/n),o=.5*(n+1/n),r=Math.sin(this.BrA*e),a=(r*this.cosgam+s*this.singam)/o,Math.abs(Math.abs(a)-1)<K)l.x=0,l.y=a<0?-$:$;else{if(l.y=this.E/Math.sqrt((1+a)/(1-a)),l.y=Rs(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(s*this.cosgam-r*this.singam,Math.cos(this.BrA*e))}return l.x+=this.lam0,l}var Gx=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"];const Ux={init:Rx,forward:Fx,inverse:Ox,names:Gx};function Vx(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<K)){var i=this.b/this.a;this.e=Math.sqrt(1-i*i);var e=Math.sin(this.lat1),t=Math.cos(this.lat1),n=Jt(this.e,e,t),s=Ot(this.e,this.lat1,e),o=Math.sin(this.lat2),r=Math.cos(this.lat2),a=Jt(this.e,o,r),l=Ot(this.e,this.lat2,o),c=Math.abs(Math.abs(this.lat0)-$)<K?0:Ot(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>K?this.ns=Math.log(n/a)/Math.log(s/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(s,this.ns)),this.rh=this.a*this.f0*Math.pow(c,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Qx(i){var e=i.x,t=i.y;Math.abs(2*Math.abs(t)-Math.PI)<=K&&(t=Ls(t)*($-2*K));var n=Math.abs(Math.abs(t)-$),s,o;if(n>K)s=Ot(this.e,t,Math.sin(t)),o=this.a*this.f0*Math.pow(s,this.ns);else{if(n=t*this.ns,n<=0)return null;o=0}var r=this.ns*J(e-this.long0,this.over);return i.x=this.k0*(o*Math.sin(r))+this.x0,i.y=this.k0*(this.rh-o*Math.cos(r))+this.y0,i}function zx(i){var e,t,n,s,o,r=(i.x-this.x0)/this.k0,a=this.rh-(i.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(r*r+a*a),t=1):(e=-Math.sqrt(r*r+a*a),t=-1);var l=0;if(e!==0&&(l=Math.atan2(t*r,t*a)),e!==0||this.ns>0){if(t=1/this.ns,n=Math.pow(e/(this.a*this.f0),t),s=Rs(this.e,n),s===-9999)return null}else s=-$;return o=J(l/this.ns+this.long0,this.over),i.x=o,i.y=s,i}var Hx=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"];const Yx={init:Vx,forward:Qx,inverse:zx,names:Hx};function $x(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function jx(i){var e,t,n,s,o,r,a,l=i.x,c=i.y,h=J(l-this.long0,this.over);return e=Math.pow((1+this.e*Math.sin(c))/(1-this.e*Math.sin(c)),this.alfa*this.e/2),t=2*(Math.atan(this.k*Math.pow(Math.tan(c/2+this.s45),this.alfa)/e)-this.s45),n=-h*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(t)+Math.sin(this.ad)*Math.cos(t)*Math.cos(n)),o=Math.asin(Math.cos(t)*Math.sin(n)/Math.cos(s)),r=this.n*o,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n),i.y=a*Math.cos(r)/1,i.x=a*Math.sin(r)/1,this.czech||(i.y*=-1,i.x*=-1),i}function Wx(i){var e,t,n,s,o,r,a,l,c=i.x;i.x=i.y,i.y=c,this.czech||(i.y*=-1,i.x*=-1),r=Math.sqrt(i.x*i.x+i.y*i.y),o=Math.atan2(i.y,i.x),s=o/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/r,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(s)),t=Math.asin(Math.cos(n)*Math.sin(s)/Math.cos(e)),i.x=this.long0-t/this.alfa,a=e,l=0;var h=0;do i.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-i.y)<1e-10&&(l=1),a=i.y,h+=1;while(l===0&&h<15);return h>=15?null:i}var qx=["Krovak","krovak"];const Kx={init:$x,forward:jx,inverse:Wx,names:qx};function mt(i,e,t,n,s){return i*s-e*Math.sin(2*s)+t*Math.sin(4*s)-n*Math.sin(6*s)}function Gs(i){return 1-.25*i*(1+i/16*(3+1.25*i))}function Us(i){return .375*i*(1+.25*i*(1+.46875*i))}function Vs(i){return .05859375*i*i*(1+.75*i)}function Qs(i){return i*i*i*(35/3072)}function Gl(i,e,t){var n=e*t;return i/Math.sqrt(1-n*n)}function Ti(i){return Math.abs(i)<$?i:i-Ls(i)*Math.PI}function pr(i,e,t,n,s){var o,r;o=i/e;for(var a=0;a<15;a++)if(r=(i-(e*o-t*Math.sin(2*o)+n*Math.sin(4*o)-s*Math.sin(6*o)))/(e-2*t*Math.cos(2*o)+4*n*Math.cos(4*o)-6*s*Math.cos(6*o)),o+=r,Math.abs(r)<=1e-10)return o;return NaN}function Xx(){this.sphere||(this.e0=Gs(this.es),this.e1=Us(this.es),this.e2=Vs(this.es),this.e3=Qs(this.es),this.ml0=this.a*mt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Jx(i){var e,t,n=i.x,s=i.y;if(n=J(n-this.long0,this.over),this.sphere)e=this.a*Math.asin(Math.cos(s)*Math.sin(n)),t=this.a*(Math.atan2(Math.tan(s),Math.cos(n))-this.lat0);else{var o=Math.sin(s),r=Math.cos(s),a=Gl(this.a,this.e,o),l=Math.tan(s)*Math.tan(s),c=n*Math.cos(s),h=c*c,u=this.es*r*r/(1-this.es),p=this.a*mt(this.e0,this.e1,this.e2,this.e3,s);e=a*c*(1-h*l*(1/6-(8-l+8*u)*h/120)),t=p-this.ml0+a*o/r*h*(.5+(5-l+6*u)*h/24)}return i.x=e+this.x0,i.y=t+this.y0,i}function Zx(i){i.x-=this.x0,i.y-=this.y0;var e=i.x/this.a,t=i.y/this.a,n,s;if(this.sphere){var o=t+this.lat0;n=Math.asin(Math.sin(o)*Math.cos(e)),s=Math.atan2(Math.tan(e),Math.cos(o))}else{var r=this.ml0/this.a+t,a=pr(r,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-$)<=K)return i.x=this.long0,i.y=$,t<0&&(i.y*=-1),i;var l=Gl(this.a,this.e,Math.sin(a)),c=l*l*l/this.a/this.a*(1-this.es),h=Math.pow(Math.tan(a),2),u=e*this.a/l,p=u*u;n=a-l*Math.tan(a)/c*u*u*(.5-(1+3*h)*u*u/24),s=u*(1-p*(h/3+(1+3*h)*h*p/15))/Math.cos(a)}return i.x=J(s+this.long0,this.over),i.y=Ti(n),i}var e2=["Cassini","Cassini_Soldner","cass"];const t2={init:Xx,forward:Jx,inverse:Zx,names:e2};function Bi(i,e){var t;return i>1e-7?(t=i*e,(1-i*i)*(e/(1-t*t)-.5/i*Math.log((1-t)/(1+t)))):2*e}var Ul=1,Vl=2,Ql=3,mr=4;function i2(){var i=Math.abs(this.lat0);if(Math.abs(i-$)<K?this.mode=this.lat0<0?Ul:Vl:Math.abs(i)<K?this.mode=Ql:this.mode=mr,this.es>0){var e;switch(this.qp=Bi(this.e,1),this.mmf=.5/(1-this.es),this.apa=h2(this.es),this.mode){case Vl:this.dd=1;break;case Ul:this.dd=1;break;case Ql:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case mr:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=Bi(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===mr&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function n2(i){var e,t,n,s,o,r,a,l,c,h,u=i.x,p=i.y;if(u=J(u-this.long0,this.over),this.sphere){if(o=Math.sin(p),h=Math.cos(p),n=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t=this.mode===this.EQUIT?1+h*n:1+this.sinph0*o+this.cosph0*h*n,t<=K)return null;t=Math.sqrt(2/t),e=t*h*Math.sin(u),t*=this.mode===this.EQUIT?o:this.cosph0*o-this.sinph0*h*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(p+this.lat0)<K)return null;t=Ae-p*.5,t=2*(this.mode===this.S_POLE?Math.cos(t):Math.sin(t)),e=t*Math.sin(u),t*=n}}else{switch(a=0,l=0,c=0,n=Math.cos(u),s=Math.sin(u),o=Math.sin(p),r=Bi(this.e,o),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(a=r/this.qp,l=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:c=1+this.sinb1*a+this.cosb1*l*n;break;case this.EQUIT:c=1+l*n;break;case this.N_POLE:c=$+p,r=this.qp-r;break;case this.S_POLE:c=p-$,r=this.qp+r;break}if(Math.abs(c)<K)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:c=Math.sqrt(2/c),this.mode===this.OBLIQ?t=this.ymf*c*(this.cosb1*a-this.sinb1*l*n):t=(c=Math.sqrt(2/(1+l*n)))*a*this.ymf,e=this.xmf*c*l*s;break;case this.N_POLE:case this.S_POLE:r>=0?(e=(c=Math.sqrt(r))*s,t=n*(this.mode===this.S_POLE?c:-c)):e=t=0;break}}return i.x=this.a*e+this.x0,i.y=this.a*t+this.y0,i}function s2(i){i.x-=this.x0,i.y-=this.y0;var e=i.x/this.a,t=i.y/this.a,n,s,o,r,a,l,c;if(this.sphere){var h=0,u,p=0;if(u=Math.sqrt(e*e+t*t),s=u*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(p=Math.sin(s),h=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(u)<=K?0:Math.asin(t*p/u),e*=p,t=h*u;break;case this.OBLIQ:s=Math.abs(u)<=K?this.lat0:Math.asin(h*this.sinph0+t*p*this.cosph0/u),e*=p*this.cosph0,t=(h-Math.sin(s)*this.sinph0)*u;break;case this.N_POLE:t=-t,s=$-s;break;case this.S_POLE:s-=$;break}n=t===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(e,t)}else{if(c=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e/=this.dd,t*=this.dd,l=Math.sqrt(e*e+t*t),l<K)return i.x=this.long0,i.y=this.lat0,i;r=2*Math.asin(.5*l/this.rq),o=Math.cos(r),e*=r=Math.sin(r),this.mode===this.OBLIQ?(c=o*this.sinb1+t*r*this.cosb1/l,a=this.qp*c,t=l*this.cosb1*o-t*this.sinb1*r):(c=t*r/l,a=this.qp*c,t=l*o)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(t=-t),a=e*e+t*t,!a)return i.x=this.long0,i.y=this.lat0,i;c=1-a/this.qp,this.mode===this.S_POLE&&(c=-c)}n=Math.atan2(e,t),s=u2(Math.asin(c),this.apa)}return i.x=J(this.long0+n,this.over),i.y=s,i}var o2=.3333333333333333,r2=.17222222222222222,a2=.10257936507936508,l2=.06388888888888888,c2=.0664021164021164,d2=.016415012942191543;function h2(i){var e,t=[];return t[0]=i*o2,e=i*i,t[0]+=e*r2,t[1]=e*l2,e*=i,t[0]+=e*a2,t[1]+=e*c2,t[2]=e*d2,t}function u2(i,e){var t=i+i;return i+e[0]*Math.sin(t)+e[1]*Math.sin(t+t)+e[2]*Math.sin(t+t+t)}var f2=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"];const p2={init:i2,forward:n2,inverse:s2,names:f2,S_POLE:Ul,N_POLE:Vl,EQUIT:Ql,OBLIQ:mr};function _i(i){return Math.abs(i)>1&&(i=i>1?1:-1),Math.asin(i)}function m2(){Math.abs(this.lat1+this.lat2)<K||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Jt(this.e3,this.sin_po,this.cos_po),this.qs1=Bi(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Jt(this.e3,this.sin_po,this.cos_po),this.qs2=Bi(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Bi(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>K?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function g2(i){var e=i.x,t=i.y;this.sin_phi=Math.sin(t),this.cos_phi=Math.cos(t);var n=Bi(this.e3,this.sin_phi),s=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,o=this.ns0*J(e-this.long0,this.over),r=s*Math.sin(o)+this.x0,a=this.rh-s*Math.cos(o)+this.y0;return i.x=r,i.y=a,i}function y2(i){var e,t,n,s,o,r;return i.x-=this.x0,i.y=this.rh-i.y+this.y0,this.ns0>=0?(e=Math.sqrt(i.x*i.x+i.y*i.y),n=1):(e=-Math.sqrt(i.x*i.x+i.y*i.y),n=-1),s=0,e!==0&&(s=Math.atan2(n*i.x,n*i.y)),n=e*this.ns0/this.a,this.sphere?r=Math.asin((this.c-n*n)/(2*this.ns0)):(t=(this.c-n*n)/this.ns0,r=this.phi1z(this.e3,t)),o=J(s/this.ns0+this.long0,this.over),i.x=o,i.y=r,i}function A2(i,e){var t,n,s,o,r,a=_i(.5*e);if(i<K)return a;for(var l=i*i,c=1;c<=25;c++)if(t=Math.sin(a),n=Math.cos(a),s=i*t,o=1-s*s,r=.5*o*o/n*(e/(1-l)-t/o+.5/i*Math.log((1-s)/(1+s))),a=a+r,Math.abs(r)<=1e-7)return a;return null}var v2=["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"];const b2={init:m2,forward:g2,inverse:y2,names:v2,phi1z:A2};function C2(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function w2(i){var e,t,n,s,o,r,a,l,c=i.x,h=i.y;return n=J(c-this.long0,this.over),e=Math.sin(h),t=Math.cos(h),s=Math.cos(n),r=this.sin_p14*e+this.cos_p14*t*s,o=1,r>0||Math.abs(r)<=K?(a=this.x0+this.a*o*t*Math.sin(n)/r,l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*t*s)/r):(a=this.x0+this.infinity_dist*t*Math.sin(n),l=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*t*s)),i.x=a,i.y=l,i}function E2(i){var e,t,n,s,o,r;return i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,(e=Math.sqrt(i.x*i.x+i.y*i.y))?(s=Math.atan2(e,this.rc),t=Math.sin(s),n=Math.cos(s),r=_i(n*this.sin_p14+i.y*t*this.cos_p14/e),o=Math.atan2(i.x*t,e*this.cos_p14*n-i.y*this.sin_p14*t),o=J(this.long0+o,this.over)):(r=this.phic0,o=0),i.x=o,i.y=r,i}var x2=["gnom"];const I2={init:C2,forward:w2,inverse:E2,names:x2};function S2(i,e){var t=1-(1-i*i)/(2*i)*Math.log((1-i)/(1+i));if(Math.abs(Math.abs(e)-t)<1e-6)return e<0?-1*$:$;for(var n=Math.asin(.5*e),s,o,r,a,l=0;l<30;l++)if(o=Math.sin(n),r=Math.cos(n),a=i*o,s=Math.pow(1-a*a,2)/(2*r)*(e/(1-i*i)-o/(1-a*a)+.5/i*Math.log((1-a)/(1+a))),n+=s,Math.abs(s)<=1e-10)return n;return NaN}function M2(){this.sphere||(this.k0=Jt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function T2(i){var e=i.x,t=i.y,n,s,o=J(e-this.long0,this.over);if(this.sphere)n=this.x0+this.a*o*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(t)/Math.cos(this.lat_ts);else{var r=Bi(this.e,Math.sin(t));n=this.x0+this.a*this.k0*o,s=this.y0+this.a*r*.5/this.k0}return i.x=n,i.y=s,i}function B2(i){i.x-=this.x0,i.y-=this.y0;var e,t;return this.sphere?(e=J(this.long0+i.x/this.a/Math.cos(this.lat_ts),this.over),t=Math.asin(i.y/this.a*Math.cos(this.lat_ts))):(t=S2(this.e,2*i.y*this.k0/this.a),e=J(this.long0+i.x/(this.a*this.k0),this.over)),i.x=e,i.y=t,i}var _2=["cea"];const k2={init:M2,forward:T2,inverse:B2,names:_2};function P2(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function D2(i){var e=i.x,t=i.y,n=J(e-this.long0,this.over),s=Ti(t-this.lat0);return i.x=this.x0+this.a*n*this.rc,i.y=this.y0+this.a*s,i}function N2(i){var e=i.x,t=i.y;return i.x=J(this.long0+(e-this.x0)/(this.a*this.rc),this.over),i.y=Ti(this.lat0+(t-this.y0)/this.a),i}var L2=["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"];const R2={init:P2,forward:D2,inverse:N2,names:L2};var Gf=20;function F2(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Gs(this.es),this.e1=Us(this.es),this.e2=Vs(this.es),this.e3=Qs(this.es),this.ml0=this.a*mt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function O2(i){var e=i.x,t=i.y,n,s,o,r=J(e-this.long0,this.over);if(o=r*Math.sin(t),this.sphere)Math.abs(t)<=K?(n=this.a*r,s=-1*this.a*this.lat0):(n=this.a*Math.sin(o)/Math.tan(t),s=this.a*(Ti(t-this.lat0)+(1-Math.cos(o))/Math.tan(t)));else if(Math.abs(t)<=K)n=this.a*r,s=-1*this.ml0;else{var a=Gl(this.a,this.e,Math.sin(t))/Math.tan(t);n=a*Math.sin(o),s=this.a*mt(this.e0,this.e1,this.e2,this.e3,t)-this.ml0+a*(1-Math.cos(o))}return i.x=n+this.x0,i.y=s+this.y0,i}function G2(i){var e,t,n,s,o,r,a,l,c;if(n=i.x-this.x0,s=i.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=K)e=J(n/this.a+this.long0,this.over),t=0;else{r=this.lat0+s/this.a,a=n*n/this.a/this.a+r*r,l=r;var h;for(o=Gf;o;--o)if(h=Math.tan(l),c=-1*(r*(l*h+1)-l-.5*(l*l+a)*h)/((l-r)/h-1),l+=c,Math.abs(c)<=K){t=l;break}e=J(this.long0+Math.asin(n*Math.tan(l)/this.a)/Math.sin(t),this.over)}else if(Math.abs(s+this.ml0)<=K)t=0,e=J(this.long0+n/this.a,this.over);else{r=(this.ml0+s)/this.a,a=n*n/this.a/this.a+r*r,l=r;var u,p,f,m,y;for(o=Gf;o;--o)if(y=this.e*Math.sin(l),u=Math.sqrt(1-y*y)*Math.tan(l),p=this.a*mt(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),m=p/this.a,c=(r*(u*m+1)-m-.5*u*(m*m+a))/(this.es*Math.sin(2*l)*(m*m+a-2*r*m)/(4*u)+(r-m)*(u*f-2/Math.sin(2*l))-f),l-=c,Math.abs(c)<=K){t=l;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(t),2))*Math.tan(t),e=J(this.long0+Math.asin(n*u/this.a)/Math.sin(t),this.over)}return i.x=e,i.y=t,i}var U2=["Polyconic","American_Polyconic","poly"];const V2={init:F2,forward:O2,inverse:G2,names:U2};function Q2(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function z2(i){var e,t=i.x,n=i.y,s=n-this.lat0,o=t-this.long0,r=s/Ps*1e-5,a=o,l=1,c=0;for(e=1;e<=10;e++)l=l*r,c=c+this.A[e]*l;var h=c,u=a,p=1,f=0,m,y,g=0,A=0;for(e=1;e<=6;e++)m=p*h-f*u,y=f*h+p*u,p=m,f=y,g=g+this.B_re[e]*p-this.B_im[e]*f,A=A+this.B_im[e]*p+this.B_re[e]*f;return i.x=A*this.a+this.x0,i.y=g*this.a+this.y0,i}function H2(i){var e,t=i.x,n=i.y,s=t-this.x0,o=n-this.y0,r=o/this.a,a=s/this.a,l=1,c=0,h,u,p=0,f=0;for(e=1;e<=6;e++)h=l*r-c*a,u=c*r+l*a,l=h,c=u,p=p+this.C_re[e]*l-this.C_im[e]*c,f=f+this.C_im[e]*l+this.C_re[e]*c;for(var m=0;m<this.iterations;m++){var y=p,g=f,A,v,C=r,w=a;for(e=2;e<=6;e++)A=y*p-g*f,v=g*p+y*f,y=A,g=v,C=C+(e-1)*(this.B_re[e]*y-this.B_im[e]*g),w=w+(e-1)*(this.B_im[e]*y+this.B_re[e]*g);y=1,g=0;var M=this.B_re[1],x=this.B_im[1];for(e=2;e<=6;e++)A=y*p-g*f,v=g*p+y*f,y=A,g=v,M=M+e*(this.B_re[e]*y-this.B_im[e]*g),x=x+e*(this.B_im[e]*y+this.B_re[e]*g);var I=M*M+x*x;p=(C*M+w*x)/I,f=(w*M-C*x)/I}var S=p,R=f,b=1,B=0;for(e=1;e<=9;e++)b=b*S,B=B+this.D[e]*b;var L=this.lat0+B*Ps*1e5,O=this.long0+R;return i.x=O,i.y=L,i}var Y2=["New_Zealand_Map_Grid","nzmg"];const $2={init:Q2,forward:z2,inverse:H2,names:Y2};function j2(){}function W2(i){var e=i.x,t=i.y,n=J(e-this.long0,this.over),s=this.x0+this.a*n,o=this.y0+this.a*Math.log(Math.tan(Math.PI/4+t/2.5))*1.25;return i.x=s,i.y=o,i}function q2(i){i.x-=this.x0,i.y-=this.y0;var e=J(this.long0+i.x/this.a,this.over),t=2.5*(Math.atan(Math.exp(.8*i.y/this.a))-Math.PI/4);return i.x=e,i.y=t,i}var K2=["Miller_Cylindrical","mill"];const X2={init:j2,forward:W2,inverse:q2,names:K2};var J2=20;function Z2(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Dl(this.es)}function eI(i){var e,t,n=i.x,s=i.y;if(n=J(n-this.long0,this.over),this.sphere){if(!this.m)s=this.n!==1?Math.asin(this.n*Math.sin(s)):s;else for(var o=this.n*Math.sin(s),r=J2;r;--r){var a=(this.m*s+Math.sin(s)-o)/(this.m+Math.cos(s));if(s-=a,Math.abs(a)<K)break}e=this.a*this.C_x*n*(this.m+Math.cos(s)),t=this.a*this.C_y*s}else{var l=Math.sin(s),c=Math.cos(s);t=this.a*Rn(s,l,c,this.en),e=this.a*n*c/Math.sqrt(1-this.es*l*l)}return i.x=e,i.y=t,i}function tI(i){var e,t,n,s;return i.x-=this.x0,n=i.x/this.a,i.y-=this.y0,e=i.y/this.a,this.sphere?(e/=this.C_y,n=n/(this.C_x*(this.m+Math.cos(e))),this.m?e=_i((this.m*e+Math.sin(e))/this.n):this.n!==1&&(e=_i(Math.sin(e)/this.n)),n=J(n+this.long0,this.over),e=Ti(e)):(e=Nl(i.y/this.a,this.es,this.en),s=Math.abs(e),s<$?(s=Math.sin(e),t=this.long0+i.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(e)),n=J(t,this.over)):s-K<$&&(n=this.long0)),i.x=n,i.y=e,i}var iI=["Sinusoidal","sinu"];const nI={init:Z2,forward:eI,inverse:tI,names:iI};function sI(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0}function oI(i){for(var e=i.x,t=i.y,n=J(e-this.long0,this.over),s=t,o=Math.PI*Math.sin(t);;){var r=-(s+Math.sin(s)-o)/(1+Math.cos(s));if(s+=r,Math.abs(r)<K)break}s/=2,Math.PI/2-Math.abs(t)<K&&(n=0);var a=.900316316158*this.a*n*Math.cos(s)+this.x0,l=1.4142135623731*this.a*Math.sin(s)+this.y0;return i.x=a,i.y=l,i}function rI(i){var e,t;i.x-=this.x0,i.y-=this.y0,t=i.y/(1.4142135623731*this.a),Math.abs(t)>.999999999999&&(t=.999999999999),e=Math.asin(t);var n=J(this.long0+i.x/(.900316316158*this.a*Math.cos(e)),this.over);n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),t=(2*e+Math.sin(2*e))/Math.PI,Math.abs(t)>1&&(t=1);var s=Math.asin(t);return i.x=n,i.y=s,i}var aI=["Mollweide","moll"];const lI={init:sI,forward:oI,inverse:rI,names:aI};function cI(){Math.abs(this.lat1+this.lat2)<K||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Gs(this.es),this.e1=Us(this.es),this.e2=Vs(this.es),this.e3=Qs(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Jt(this.e,this.sin_phi,this.cos_phi),this.ml1=mt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<K?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Jt(this.e,this.sin_phi,this.cos_phi),this.ml2=mt(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=mt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function dI(i){var e=i.x,t=i.y,n;if(this.sphere)n=this.a*(this.g-t);else{var s=mt(this.e0,this.e1,this.e2,this.e3,t);n=this.a*(this.g-s)}var o=this.ns*J(e-this.long0,this.over),r=this.x0+n*Math.sin(o),a=this.y0+this.rh-n*Math.cos(o);return i.x=r,i.y=a,i}function hI(i){i.x-=this.x0,i.y=this.rh-i.y+this.y0;var e,t,n,s;this.ns>=0?(t=Math.sqrt(i.x*i.x+i.y*i.y),e=1):(t=-Math.sqrt(i.x*i.x+i.y*i.y),e=-1);var o=0;if(t!==0&&(o=Math.atan2(e*i.x,e*i.y)),this.sphere)return s=J(this.long0+o/this.ns,this.over),n=Ti(this.g-t/this.a),i.x=s,i.y=n,i;var r=this.g-t/this.a;return n=pr(r,this.e0,this.e1,this.e2,this.e3),s=J(this.long0+o/this.ns,this.over),i.x=s,i.y=n,i}var uI=["Equidistant_Conic","eqdc"];const fI={init:cI,forward:dI,inverse:hI,names:uI};function pI(){this.R=this.a}function mI(i){var e=i.x,t=i.y,n=J(e-this.long0,this.over),s,o;Math.abs(t)<=K&&(s=this.x0+this.R*n,o=this.y0);var r=_i(2*Math.abs(t/Math.PI));(Math.abs(n)<=K||Math.abs(Math.abs(t)-$)<=K)&&(s=this.x0,t>=0?o=this.y0+Math.PI*this.R*Math.tan(.5*r):o=this.y0+Math.PI*this.R*-Math.tan(.5*r));var a=.5*Math.abs(Math.PI/n-n/Math.PI),l=a*a,c=Math.sin(r),h=Math.cos(r),u=h/(c+h-1),p=u*u,f=u*(2/c-1),m=f*f,y=Math.PI*this.R*(a*(u-m)+Math.sqrt(l*(u-m)*(u-m)-(m+l)*(p-m)))/(m+l);n<0&&(y=-y),s=this.x0+y;var g=l+u;return y=Math.PI*this.R*(f*g-a*Math.sqrt((m+l)*(l+1)-g*g))/(m+l),t>=0?o=this.y0+y:o=this.y0-y,i.x=s,i.y=o,i}function gI(i){var e,t,n,s,o,r,a,l,c,h,u,p,f;return i.x-=this.x0,i.y-=this.y0,u=Math.PI*this.R,n=i.x/u,s=i.y/u,o=n*n+s*s,r=-Math.abs(s)*(1+o),a=r-2*s*s+n*n,l=-2*r+1+2*s*s+o*o,f=s*s/l+(2*a*a*a/l/l/l-9*r*a/l/l)/27,c=(r-a*a/3/l)/l,h=2*Math.sqrt(-c/3),u=3*f/c/h,Math.abs(u)>1&&(u>=0?u=1:u=-1),p=Math.acos(u)/3,i.y>=0?t=(-h*Math.cos(p+Math.PI/3)-a/3/l)*Math.PI:t=-(-h*Math.cos(p+Math.PI/3)-a/3/l)*Math.PI,Math.abs(n)<K?e=this.long0:e=J(this.long0+Math.PI*(o-1+Math.sqrt(1+2*(n*n-s*s)+o*o))/2/n,this.over),i.x=e,i.y=t,i}var yI=["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"];const AI={init:pI,forward:mI,inverse:gI,names:yI};function vI(i,e,t,n,s,o){const r=n-e,a=Math.atan((1-o)*Math.tan(i)),l=Math.atan((1-o)*Math.tan(t)),c=Math.sin(a),h=Math.cos(a),u=Math.sin(l),p=Math.cos(l);let f=r,m,y=100,g,A,v,C,w,M,x,I,S,R,b,B,L,O;do{if(g=Math.sin(f),A=Math.cos(f),v=Math.sqrt(p*g*(p*g)+(h*u-c*p*A)*(h*u-c*p*A)),v===0)return{azi1:0,s12:0};C=c*u+h*p*A,w=Math.atan2(v,C),M=h*p*g/v,x=1-M*M,I=x!==0?C-2*c*u/x:0,S=o/16*x*(4+o*(4-3*x)),m=f,f=r+(1-S)*o*M*(w+S*v*(I+S*C*(-1+2*I*I)))}while(Math.abs(f-m)>1e-12&&--y>0);return y===0?{azi1:NaN,s12:NaN}:(R=x*(s*s-s*(1-o)*(s*(1-o)))/(s*(1-o)*(s*(1-o))),b=1+R/16384*(4096+R*(-768+R*(320-175*R))),B=R/1024*(256+R*(-128+R*(74-47*R))),L=B*v*(I+B/4*(C*(-1+2*I*I)-B/6*I*(-3+4*v*v)*(-3+4*I*I))),O=s*(1-o)*b*(w-L),{azi1:Math.atan2(p*g,h*u-c*p*A),s12:O})}function bI(i,e,t,n,s,o){const r=Math.atan((1-o)*Math.tan(i)),a=Math.sin(r),l=Math.cos(r),c=Math.sin(t),h=Math.cos(t),u=Math.atan2(a,l*h),p=l*c,f=1-p*p,m=f*(s*s-s*(1-o)*(s*(1-o)))/(s*(1-o)*(s*(1-o))),y=1+m/16384*(4096+m*(-768+m*(320-175*m))),g=m/1024*(256+m*(-128+m*(74-47*m)));let A=n/(s*(1-o)*y),v,C=100,w,M,x,I;do w=Math.cos(2*u+A),M=Math.sin(A),x=Math.cos(A),I=g*M*(w+g/4*(x*(-1+2*w*w)-g/6*w*(-3+4*M*M)*(-3+4*w*w))),v=A,A=n/(s*(1-o)*y)+I;while(Math.abs(A-v)>1e-12&&--C>0);if(C===0)return{lat2:NaN,lon2:NaN};const S=a*M-l*x*h,R=Math.atan2(a*x+l*M*h,(1-o)*Math.sqrt(p*p+S*S)),b=Math.atan2(M*c,l*x-a*M*h),B=o/16*f*(4+o*(4-3*f)),L=b-(1-B)*o*p*(A+B*M*(w+B*x*(-1+2*w*w))),O=e+L;return{lat2:R,lon2:O}}function CI(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es))}function wI(i){var e=i.x,t=i.y,n=Math.sin(i.y),s=Math.cos(i.y),o=J(e-this.long0,this.over),r,a,l,c,h,u,p,f,m,y,g;return this.sphere?Math.abs(this.sin_p12-1)<=K?(i.x=this.x0+this.a*($-t)*Math.sin(o),i.y=this.y0-this.a*($-t)*Math.cos(o),i):Math.abs(this.sin_p12+1)<=K?(i.x=this.x0+this.a*($+t)*Math.sin(o),i.y=this.y0+this.a*($+t)*Math.cos(o),i):(m=this.sin_p12*n+this.cos_p12*s*Math.cos(o),p=Math.acos(m),f=p?p/Math.sin(p):1,i.x=this.x0+this.a*f*s*Math.sin(o),i.y=this.y0+this.a*f*(this.cos_p12*n-this.sin_p12*s*Math.cos(o)),i):(r=Gs(this.es),a=Us(this.es),l=Vs(this.es),c=Qs(this.es),Math.abs(this.sin_p12-1)<=K?(h=this.a*mt(r,a,l,c,$),u=this.a*mt(r,a,l,c,t),i.x=this.x0+(h-u)*Math.sin(o),i.y=this.y0-(h-u)*Math.cos(o),i):Math.abs(this.sin_p12+1)<=K?(h=this.a*mt(r,a,l,c,$),u=this.a*mt(r,a,l,c,t),i.x=this.x0+(h+u)*Math.sin(o),i.y=this.y0+(h+u)*Math.cos(o),i):Math.abs(e)<K&&Math.abs(t-this.lat0)<K?(i.x=i.y=0,i):(y=vI(this.lat0,this.long0,t,e,this.a,this.f),g=y.azi1,i.x=y.s12*Math.sin(g),i.y=y.s12*Math.cos(g),i))}function EI(i){i.x-=this.x0,i.y-=this.y0;var e,t,n,s,o,r,a,l,c,h,u,p,f,m,y,g;return this.sphere?(e=Math.sqrt(i.x*i.x+i.y*i.y),e>2*$*this.a?void 0:(t=e/this.a,n=Math.sin(t),s=Math.cos(t),o=this.long0,Math.abs(e)<=K?r=this.lat0:(r=_i(s*this.sin_p12+i.y*n*this.cos_p12/e),a=Math.abs(this.lat0)-$,Math.abs(a)<=K?this.lat0>=0?o=J(this.long0+Math.atan2(i.x,-i.y),this.over):o=J(this.long0-Math.atan2(-i.x,i.y),this.over):o=J(this.long0+Math.atan2(i.x*n,e*this.cos_p12*s-i.y*this.sin_p12*n),this.over)),i.x=o,i.y=r,i)):(l=Gs(this.es),c=Us(this.es),h=Vs(this.es),u=Qs(this.es),Math.abs(this.sin_p12-1)<=K?(p=this.a*mt(l,c,h,u,$),e=Math.sqrt(i.x*i.x+i.y*i.y),f=p-e,r=pr(f/this.a,l,c,h,u),o=J(this.long0+Math.atan2(i.x,-1*i.y),this.over),i.x=o,i.y=r,i):Math.abs(this.sin_p12+1)<=K?(p=this.a*mt(l,c,h,u,$),e=Math.sqrt(i.x*i.x+i.y*i.y),f=e-p,r=pr(f/this.a,l,c,h,u),o=J(this.long0+Math.atan2(i.x,i.y),this.over),i.x=o,i.y=r,i):(m=Math.atan2(i.x,i.y),y=Math.sqrt(i.x*i.x+i.y*i.y),g=bI(this.lat0,this.long0,m,y,this.a,this.f),i.x=g.lon2,i.y=g.lat2,i))}var xI=["Azimuthal_Equidistant","aeqd"];const II={init:CI,forward:wI,inverse:EI,names:xI};function SI(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function MI(i){var e,t,n,s,o,r,a,l,c=i.x,h=i.y;return n=J(c-this.long0,this.over),e=Math.sin(h),t=Math.cos(h),s=Math.cos(n),r=this.sin_p14*e+this.cos_p14*t*s,o=1,(r>0||Math.abs(r)<=K)&&(a=this.a*o*t*Math.sin(n),l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*t*s)),i.x=a,i.y=l,i}function TI(i){var e,t,n,s,o,r,a;return i.x-=this.x0,i.y-=this.y0,e=Math.sqrt(i.x*i.x+i.y*i.y),t=_i(e/this.a),n=Math.sin(t),s=Math.cos(t),r=this.long0,Math.abs(e)<=K?(a=this.lat0,i.x=r,i.y=a,i):(a=_i(s*this.sin_p14+i.y*n*this.cos_p14/e),o=Math.abs(this.lat0)-$,Math.abs(o)<=K?(this.lat0>=0?r=J(this.long0+Math.atan2(i.x,-i.y),this.over):r=J(this.long0-Math.atan2(-i.x,i.y),this.over),i.x=r,i.y=a,i):(r=J(this.long0+Math.atan2(i.x*n,e*this.cos_p14*s-i.y*this.sin_p14*n),this.over),i.x=r,i.y=a,i))}var BI=["ortho"];const _I={init:SI,forward:MI,inverse:TI,names:BI};var De={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},ve={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function kI(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=$-Ae/2?this.face=De.TOP:this.lat0<=-($-Ae/2)?this.face=De.BOTTOM:Math.abs(this.long0)<=Ae?this.face=De.FRONT:Math.abs(this.long0)<=$+Ae?this.face=this.long0>0?De.RIGHT:De.LEFT:this.face=De.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function PI(i){var e={x:0,y:0},t,n,s,o,r,a,l={value:0};if(i.x-=this.long0,this.es!==0?t=Math.atan(this.one_minus_f_squared*Math.tan(i.y)):t=i.y,n=i.x,this.face===De.TOP)o=$-t,n>=Ae&&n<=$+Ae?(l.value=ve.AREA_0,s=n-$):n>$+Ae||n<=-($+Ae)?(l.value=ve.AREA_1,s=n>0?n-Ge:n+Ge):n>-($+Ae)&&n<=-Ae?(l.value=ve.AREA_2,s=n+$):(l.value=ve.AREA_3,s=n);else if(this.face===De.BOTTOM)o=$+t,n>=Ae&&n<=$+Ae?(l.value=ve.AREA_0,s=-n+$):n<Ae&&n>=-Ae?(l.value=ve.AREA_1,s=-n):n<-Ae&&n>=-($+Ae)?(l.value=ve.AREA_2,s=-n-$):(l.value=ve.AREA_3,s=n>0?-n+Ge:-n-Ge);else{var c,h,u,p,f,m,y;this.face===De.RIGHT?n=On(n,+$):this.face===De.BACK?n=On(n,+Ge):this.face===De.LEFT&&(n=On(n,-$)),p=Math.sin(t),f=Math.cos(t),m=Math.sin(n),y=Math.cos(n),c=f*y,h=f*m,u=p,this.face===De.FRONT?(o=Math.acos(c),s=gr(o,u,h,l)):this.face===De.RIGHT?(o=Math.acos(h),s=gr(o,u,-c,l)):this.face===De.BACK?(o=Math.acos(-c),s=gr(o,u,-h,l)):this.face===De.LEFT?(o=Math.acos(-h),s=gr(o,u,c,l)):(o=s=0,l.value=ve.AREA_0)}return a=Math.atan(12/Ge*(s+Math.acos(Math.sin(s)*Math.cos(Ae))-$)),r=Math.sqrt((1-Math.cos(o))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(s))))),l.value===ve.AREA_1?a+=$:l.value===ve.AREA_2?a+=Ge:l.value===ve.AREA_3&&(a+=1.5*Ge),e.x=r*Math.cos(a),e.y=r*Math.sin(a),e.x=e.x*this.a+this.x0,e.y=e.y*this.a+this.y0,i.x=e.x,i.y=e.y,i}function DI(i){var e={lam:0,phi:0},t,n,s,o,r,a,l,c,h,u={value:0};if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,n=Math.atan(Math.sqrt(i.x*i.x+i.y*i.y)),t=Math.atan2(i.y,i.x),i.x>=0&&i.x>=Math.abs(i.y)?u.value=ve.AREA_0:i.y>=0&&i.y>=Math.abs(i.x)?(u.value=ve.AREA_1,t-=$):i.x<0&&-i.x>=Math.abs(i.y)?(u.value=ve.AREA_2,t=t<0?t+Ge:t-Ge):(u.value=ve.AREA_3,t+=$),h=Ge/12*Math.tan(t),r=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),a=Math.atan(r),s=Math.cos(t),o=Math.tan(n),l=1-s*s*o*o*(1-Math.cos(Math.atan(1/Math.cos(a)))),l<-1?l=-1:l>1&&(l=1),this.face===De.TOP)c=Math.acos(l),e.phi=$-c,u.value===ve.AREA_0?e.lam=a+$:u.value===ve.AREA_1?e.lam=a<0?a+Ge:a-Ge:u.value===ve.AREA_2?e.lam=a-$:e.lam=a;else if(this.face===De.BOTTOM)c=Math.acos(l),e.phi=c-$,u.value===ve.AREA_0?e.lam=-a+$:u.value===ve.AREA_1?e.lam=-a:u.value===ve.AREA_2?e.lam=-a-$:e.lam=a<0?-a-Ge:-a+Ge;else{var p,f,m;p=l,h=p*p,h>=1?m=0:m=Math.sqrt(1-h)*Math.sin(a),h+=m*m,h>=1?f=0:f=Math.sqrt(1-h),u.value===ve.AREA_1?(h=f,f=-m,m=h):u.value===ve.AREA_2?(f=-f,m=-m):u.value===ve.AREA_3&&(h=f,f=m,m=-h),this.face===De.RIGHT?(h=p,p=-f,f=h):this.face===De.BACK?(p=-p,f=-f):this.face===De.LEFT&&(h=p,p=f,f=-h),e.phi=Math.acos(-m)-$,e.lam=Math.atan2(f,p),this.face===De.RIGHT?e.lam=On(e.lam,-$):this.face===De.BACK?e.lam=On(e.lam,-Ge):this.face===De.LEFT&&(e.lam=On(e.lam,+$))}if(this.es!==0){var y,g,A;y=e.phi<0?1:0,g=Math.tan(e.phi),A=this.b/Math.sqrt(g*g+this.one_minus_f_squared),e.phi=Math.atan(Math.sqrt(this.a*this.a-A*A)/(this.one_minus_f*A)),y&&(e.phi=-e.phi)}return e.lam+=this.long0,i.x=e.lam,i.y=e.phi,i}function gr(i,e,t,n){var s;return i<K?(n.value=ve.AREA_0,s=0):(s=Math.atan2(e,t),Math.abs(s)<=Ae?n.value=ve.AREA_0:s>Ae&&s<=$+Ae?(n.value=ve.AREA_1,s-=$):s>$+Ae||s<=-($+Ae)?(n.value=ve.AREA_2,s=s>=0?s-Ge:s+Ge):(n.value=ve.AREA_3,s+=$)),s}function On(i,e){var t=i+e;return t<-Ge?t+=Ds:t>+Ge&&(t-=Ds),t}var NI=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"];const LI={init:kI,forward:PI,inverse:DI,names:NI};var zl=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],zs=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Uf=.8487,Vf=1.3523,Qf=bt/5,RI=1/Qf,Gn=18,yr=function(i,e){return i[0]+e*(i[1]+e*(i[2]+e*i[3]))},FI=function(i,e){return i[1]+e*(2*i[2]+e*3*i[3])};function OI(i,e,t,n){for(var s=e;n;--n){var o=i(s);if(s-=o,Math.abs(o)<t)break}return s}function GI(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function UI(i){var e=J(i.x-this.long0,this.over),t=Math.abs(i.y),n=Math.floor(t*Qf);n<0?n=0:n>=Gn&&(n=Gn-1),t=bt*(t-RI*n);var s={x:yr(zl[n],t)*e,y:yr(zs[n],t)};return i.y<0&&(s.y=-s.y),s.x=s.x*this.a*Uf+this.x0,s.y=s.y*this.a*Vf+this.y0,s}function VI(i){var e={x:(i.x-this.x0)/(this.a*Uf),y:Math.abs(i.y-this.y0)/(this.a*Vf)};if(e.y>=1)e.x/=zl[Gn][0],e.y=i.y<0?-$:$;else{var t=Math.floor(e.y*Gn);for(t<0?t=0:t>=Gn&&(t=Gn-1);;)if(zs[t][0]>e.y)--t;else if(zs[t+1][0]<=e.y)++t;else break;var n=zs[t],s=5*(e.y-n[0])/(zs[t+1][0]-n[0]);s=OI(function(o){return(yr(n,o)-e.y)/FI(n,o)},s,K,100),e.x/=yr(zl[t],s),e.y=(5*t+s)*Oe,i.y<0&&(e.y=-e.y)}return e.x=J(e.x+this.long0,this.over),e}var QI=["Robinson","robin"];const zI={init:GI,forward:UI,inverse:VI,names:QI};function HI(){this.name="geocent"}function YI(i){var e=Af(i,this.es,this.a);return e}function $I(i){var e=vf(i,this.es,this.a,this.b);return e}var jI=["Geocentric","geocentric","geocent","Geocent"];const WI={init:HI,forward:YI,inverse:$I,names:jI};var dt={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Hs={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function qI(){if(Object.keys(Hs).forEach((function(t){if(typeof this[t]>"u")this[t]=Hs[t].def;else{if(Hs[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);Hs[t].num&&(this[t]=parseFloat(this[t]))}Hs[t].degrees&&(this[t]=this[t]*Oe)}).bind(this)),Math.abs(Math.abs(this.lat0)-$)<K?this.mode=this.lat0<0?dt.S_POLE:dt.N_POLE:Math.abs(this.lat0)<K?this.mode=dt.EQUIT:(this.mode=dt.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var i=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(i),this.sw=Math.sin(i)}function KI(i){i.x-=this.long0;var e=Math.sin(i.y),t=Math.cos(i.y),n=Math.cos(i.x),s,o;switch(this.mode){case dt.OBLIQ:o=this.sinph0*e+this.cosph0*t*n;break;case dt.EQUIT:o=t*n;break;case dt.S_POLE:o=-e;break;case dt.N_POLE:o=e;break}switch(o=this.pn1/(this.p-o),s=o*t*Math.sin(i.x),this.mode){case dt.OBLIQ:o*=this.cosph0*e-this.sinph0*t*n;break;case dt.EQUIT:o*=e;break;case dt.N_POLE:o*=-(t*n);break;case dt.S_POLE:o*=t*n;break}var r,a;return r=o*this.cg+s*this.sg,a=1/(r*this.sw*this.h1+this.cw),s=(s*this.cg-o*this.sg)*this.cw*a,o=r*a,i.x=s*this.a,i.y=o*this.a,i}function XI(i){i.x/=this.a,i.y/=this.a;var e={x:i.x,y:i.y},t,n,s;s=1/(this.pn1-i.y*this.sw),t=this.pn1*i.x*s,n=this.pn1*i.y*this.cw*s,i.x=t*this.cg+n*this.sg,i.y=n*this.cg-t*this.sg;var o=Et(i.x,i.y);if(Math.abs(o)<K)e.x=0,e.y=i.y;else{var r,a;switch(a=1-o*o*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/o+o/this.pn1),r=Math.sqrt(1-a*a),this.mode){case dt.OBLIQ:e.y=Math.asin(r*this.sinph0+i.y*a*this.cosph0/o),i.y=(r-this.sinph0*Math.sin(e.y))*o,i.x*=a*this.cosph0;break;case dt.EQUIT:e.y=Math.asin(i.y*a/o),i.y=r*o,i.x*=a;break;case dt.N_POLE:e.y=Math.asin(r),i.y=-i.y;break;case dt.S_POLE:e.y=-Math.asin(r);break}e.x=Math.atan2(i.x,i.y)}return i.x=e.x+this.long0,i.y=e.y,i}var JI=["Tilted_Perspective","tpers"];const ZI={init:qI,forward:KI,inverse:XI,names:JI};function eS(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var i=1-this.es,e=1/i;this.radius_p=Math.sqrt(i),this.radius_p2=i,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function tS(i){var e=i.x,t=i.y,n,s,o,r;if(e=e-this.long0,this.shape==="ellipse"){t=Math.atan(this.radius_p2*Math.tan(t));var a=this.radius_p/Et(this.radius_p*Math.cos(t),Math.sin(t));if(s=a*Math.cos(e)*Math.cos(t),o=a*Math.sin(e)*Math.cos(t),r=a*Math.sin(t),(this.radius_g-s)*s-o*o-r*r*this.radius_p_inv2<0)return i.x=Number.NaN,i.y=Number.NaN,i;n=this.radius_g-s,this.flip_axis?(i.x=this.radius_g_1*Math.atan(o/Et(r,n)),i.y=this.radius_g_1*Math.atan(r/n)):(i.x=this.radius_g_1*Math.atan(o/n),i.y=this.radius_g_1*Math.atan(r/Et(o,n)))}else this.shape==="sphere"&&(n=Math.cos(t),s=Math.cos(e)*n,o=Math.sin(e)*n,r=Math.sin(t),n=this.radius_g-s,this.flip_axis?(i.x=this.radius_g_1*Math.atan(o/Et(r,n)),i.y=this.radius_g_1*Math.atan(r/n)):(i.x=this.radius_g_1*Math.atan(o/n),i.y=this.radius_g_1*Math.atan(r/Et(o,n))));return i.x=i.x*this.a,i.y=i.y*this.a,i}function iS(i){var e=-1,t=0,n=0,s,o,r,a;if(i.x=i.x/this.a,i.y=i.y/this.a,this.shape==="ellipse"){this.flip_axis?(n=Math.tan(i.y/this.radius_g_1),t=Math.tan(i.x/this.radius_g_1)*Et(1,n)):(t=Math.tan(i.x/this.radius_g_1),n=Math.tan(i.y/this.radius_g_1)*Et(1,t));var l=n/this.radius_p;if(s=t*t+l*l+e*e,o=2*this.radius_g*e,r=o*o-4*s*this.C,r<0)return i.x=Number.NaN,i.y=Number.NaN,i;a=(-o-Math.sqrt(r))/(2*s),e=this.radius_g+a*e,t*=a,n*=a,i.x=Math.atan2(t,e),i.y=Math.atan(n*Math.cos(i.x)/e),i.y=Math.atan(this.radius_p_inv2*Math.tan(i.y))}else if(this.shape==="sphere"){if(this.flip_axis?(n=Math.tan(i.y/this.radius_g_1),t=Math.tan(i.x/this.radius_g_1)*Math.sqrt(1+n*n)):(t=Math.tan(i.x/this.radius_g_1),n=Math.tan(i.y/this.radius_g_1)*Math.sqrt(1+t*t)),s=t*t+n*n+e*e,o=2*this.radius_g*e,r=o*o-4*s*this.C,r<0)return i.x=Number.NaN,i.y=Number.NaN,i;a=(-o-Math.sqrt(r))/(2*s),e=this.radius_g+a*e,t*=a,n*=a,i.x=Math.atan2(t,e),i.y=Math.atan(n*Math.cos(i.x)/e)}return i.x=i.x+this.long0,i}var nS=["Geostationary Satellite View","Geostationary_Satellite","geos"];const sS={init:eS,forward:tS,inverse:iS,names:nS};var Ys=1.340264,$s=-.081106,js=893e-6,Ws=.003796,Ar=Math.sqrt(3)/2;function oS(){this.es=0,this.long0=this.long0!==void 0?this.long0:0,this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0}function rS(i){var e=J(i.x-this.long0,this.over),t=i.y,n=Math.asin(Ar*Math.sin(t)),s=n*n,o=s*s*s;return i.x=e*Math.cos(n)/(Ar*(Ys+3*$s*s+o*(7*js+9*Ws*s))),i.y=n*(Ys+$s*s+o*(js+Ws*s)),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function aS(i){i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a;var e=1e-9,t=12,n=i.y,s,o,r,a,l,c;for(c=0;c<t&&(s=n*n,o=s*s*s,r=n*(Ys+$s*s+o*(js+Ws*s))-i.y,a=Ys+3*$s*s+o*(7*js+9*Ws*s),n-=l=r/a,!(Math.abs(l)<e));++c);return s=n*n,o=s*s*s,i.x=Ar*i.x*(Ys+3*$s*s+o*(7*js+9*Ws*s))/Math.cos(n),i.y=Math.asin(Math.sin(n)/Ar),i.x=J(i.x+this.long0,this.over),i}var lS=["eqearth","Equal Earth","Equal_Earth"];const cS={init:oS,forward:rS,inverse:aS,names:lS};var qs=1e-10;function dS(){var i;if(this.phi1=this.lat1,Math.abs(this.phi1)<qs)throw new Error;this.es?(this.en=Dl(this.es),this.m1=Rn(this.phi1,this.am1=Math.sin(this.phi1),i=Math.cos(this.phi1),this.en),this.am1=i/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=uS,this.forward=hS):(Math.abs(this.phi1)+qs>=$?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=pS,this.forward=fS)}function hS(i){var e=J(i.x-(this.long0||0),this.over),t=i.y,n,s,o;return n=this.am1+this.m1-Rn(t,s=Math.sin(t),o=Math.cos(t),this.en),s=o*e/(n*Math.sqrt(1-this.es*s*s)),i.x=n*Math.sin(s),i.y=this.am1-n*Math.cos(s),i.x=this.a*i.x+(this.x0||0),i.y=this.a*i.y+(this.y0||0),i}function uS(i){i.x=(i.x-(this.x0||0))/this.a,i.y=(i.y-(this.y0||0))/this.a;var e,t,n,s;if(t=Et(i.x,i.y=this.am1-i.y),s=Nl(this.am1+this.m1-t,this.es,this.en),(e=Math.abs(s))<$)e=Math.sin(s),n=t*Math.atan2(i.x,i.y)*Math.sqrt(1-this.es*e*e)/Math.cos(s);else if(Math.abs(e-$)<=qs)n=0;else throw new Error;return i.x=J(n+(this.long0||0),this.over),i.y=Ti(s),i}function fS(i){var e=J(i.x-(this.long0||0),this.over),t=i.y,n,s;return s=this.cphi1+this.phi1-t,Math.abs(s)>qs?(i.x=s*Math.sin(n=e*Math.cos(t)/s),i.y=this.cphi1-s*Math.cos(n)):i.x=i.y=0,i.x=this.a*i.x+(this.x0||0),i.y=this.a*i.y+(this.y0||0),i}function pS(i){i.x=(i.x-(this.x0||0))/this.a,i.y=(i.y-(this.y0||0))/this.a;var e,t,n=Et(i.x,i.y=this.cphi1-i.y);if(t=this.cphi1+this.phi1-n,Math.abs(t)>$)throw new Error;return Math.abs(Math.abs(t)-$)<=qs?e=0:e=n*Math.atan2(i.x,i.y)/Math.cos(t),i.x=J(e+(this.long0||0),this.over),i.y=Ti(t),i}var mS=["bonne","Bonne (Werner lat_1=90)"];const gS={init:dS,names:mS},zf={OBLIQUE:{forward:CS,inverse:ES},TRANSVERSE:{forward:wS,inverse:xS}},vr={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}};function yS(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=ff.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if(this.o_proj==="ob_tran")throw new Error("Invalid value for o_proj: "+this.o_proj);const i=this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim(),e=Pt(i);if(!e)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);e.long0=0,this.obliqueProjection=e;let t;const n=Object.keys(vr),s=a=>{if(typeof this[a]>"u")return;const l=parseFloat(this[a])*Oe;if(isNaN(l))throw new Error("Invalid value for "+a+": "+this[a]);return l};for(let a=0;a<n.length;a++){const l=n[a],c=vr[l],h=Object.entries(c);if(h.some(([p])=>typeof this[p]<"u")){t=c;for(let p=0;p<h.length;p++){const[f,m]=h[p],y=s(f);if(typeof y>"u")throw new Error("Missing parameter: "+f+".");this[m]=y}break}}if(!t)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:o,phip:r}=bS(this,t);this.lamp=o,Math.abs(r)>K?(this.cphip=Math.cos(r),this.sphip=Math.sin(r),this.projectionType=zf.OBLIQUE):this.projectionType=zf.TRANSVERSE}function AS(i){return this.projectionType.forward(this,i)}function vS(i){return this.projectionType.inverse(this,i)}function bS(i,e){let t,n;if(e===vr.ROTATE){let s=i.oLongC,o=i.oLatC,r=i.oAlpha;if(Math.abs(Math.abs(o)-$)<=K)throw new Error("Invalid value for o_lat_c: "+i.o_lat_c+" should be < 90°");n=s+Math.atan2(-1*Math.cos(r),-1*Math.sin(r)*Math.sin(o)),t=Math.asin(Math.cos(o)*Math.sin(r))}else if(e===vr.NEW_POLE)n=i.oLongP,t=i.oLatP;else{let s=i.oLong1,o=i.oLat1,r=i.oLong2,a=i.oLat2,l=Math.abs(o);if(Math.abs(o)>$-K)throw new Error("Invalid value for o_lat_1: "+i.o_lat_1+" should be < 90°");if(Math.abs(a)>$-K)throw new Error("Invalid value for o_lat_2: "+i.o_lat_2+" should be < 90°");if(Math.abs(o-a)<K)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(l<K)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");n=Math.atan2(Math.cos(o)*Math.sin(a)*Math.cos(s)-Math.sin(o)*Math.cos(a)*Math.cos(r),Math.sin(o)*Math.cos(a)*Math.sin(r)-Math.cos(o)*Math.sin(a)*Math.sin(s)),t=Math.atan(-1*Math.cos(n-s)/Math.tan(o))}return{lamp:n,phip:t}}function CS(i,e){let{x:t,y:n}=e;t+=i.long0;const s=Math.cos(t),o=Math.sin(n),r=Math.cos(n);e.x=J(Math.atan2(r*Math.sin(t),i.sphip*r*s+i.cphip*o)+i.lamp),e.y=Math.asin(i.sphip*o-i.cphip*r*s);const a=i.obliqueProjection.forward(e);return i.isIdentity&&(a.x*=bt,a.y*=bt),a}function wS(i,e){let{x:t,y:n}=e;t+=i.long0;const s=Math.cos(n),o=Math.cos(t);e.x=J(Math.atan2(s*Math.sin(t),Math.sin(n))+i.lamp),e.y=Math.asin(-1*s*o);const r=i.obliqueProjection.forward(e);return i.isIdentity&&(r.x*=bt,r.y*=bt),r}function ES(i,e){i.isIdentity&&(e.x*=Oe,e.y*=Oe);const t=i.obliqueProjection.inverse(e);let{x:n,y:s}=t;if(n<Number.MAX_VALUE){n-=i.lamp;const o=Math.cos(n),r=Math.sin(s),a=Math.cos(s);e.x=Math.atan2(a*Math.sin(n),i.sphip*a*o-i.cphip*r),e.y=Math.asin(i.sphip*r+i.cphip*a*o)}return e.x=J(e.x+i.long0),e}function xS(i,e){i.isIdentity&&(e.x*=Oe,e.y*=Oe);const t=i.obliqueProjection.inverse(e);let{x:n,y:s}=t;if(n<Number.MAX_VALUE){const o=Math.cos(s);n-=i.lamp,e.x=Math.atan2(o*Math.sin(n),-1*Math.sin(s)),e.y=Math.asin(o*Math.cos(n))}return e.x=J(e.x+i.long0),e}var IS=["General Oblique Transformation","General_Oblique_Transformation","ob_tran"];const SS={init:yS,forward:AS,inverse:vS,names:IS};function MS(i){i.Proj.projections.add(ur),i.Proj.projections.add(fr),i.Proj.projections.add(mx),i.Proj.projections.add(xx),i.Proj.projections.add(Bx),i.Proj.projections.add(Nx),i.Proj.projections.add(Ux),i.Proj.projections.add(Yx),i.Proj.projections.add(Kx),i.Proj.projections.add(t2),i.Proj.projections.add(p2),i.Proj.projections.add(b2),i.Proj.projections.add(I2),i.Proj.projections.add(k2),i.Proj.projections.add(R2),i.Proj.projections.add(V2),i.Proj.projections.add($2),i.Proj.projections.add(X2),i.Proj.projections.add(nI),i.Proj.projections.add(lI),i.Proj.projections.add(fI),i.Proj.projections.add(AI),i.Proj.projections.add(II),i.Proj.projections.add(_I),i.Proj.projections.add(LI),i.Proj.projections.add(zI),i.Proj.projections.add(WI),i.Proj.projections.add(ZI),i.Proj.projections.add(sS),i.Proj.projections.add(cS),i.Proj.projections.add(gS),i.Proj.projections.add(SS)}const Ks=Object.assign(PE,{defaultDatum:"WGS84",Proj:Pt,WGS84:new Pt("WGS84"),Point:Ln,toPoint:Ef,defs:nt,nadgrid:pE,transform:dr,mgrs:DE,version:"__VERSION__"});MS(Ks);class TS{cesium;viewer;watermarkEnabled=!0;mapLayers={};modelId="default";options={flyTo:!0};gisCadModelsList=[];open=!1;events=new _s;heightLodThresholds={full:2e3,medium:8e3,far:3e4};heightLodEnabled=!1;heightLodHandler=null;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t}getMapLayers(e){const t=typeof e=="object"?e?.modelId:e;return t?this.mapLayers[t]||{}:this.mapLayers}setModelId(e){this.modelId=e}getModelId(){return this.modelId}setDxfOpen(e){this.open=e}getDxfOpen(){return this.open}getDxfModelsList(){return this.gisCadModelsList}async addVectorTileByUrlTemplate(e){let t=window?.VectorTileLayer||window?.CesiumVectorTileGL?.VectorTileLayer||this.cesium?.VectorTileLayer;if(!t)try{const s=await Promise.resolve().then(()=>Qd),o=s?.VectorTileLayer||s?.CesiumVectorTileGL?.VectorTileLayer||s?.default?.VectorTileLayer||s?.default;if(o)window.VectorTileLayer=o,s?.CesiumVectorTileGL&&(window.CesiumVectorTileGL=s.CesiumVectorTileGL),t=o;else{const r=s?.VectorTileset||s?.CesiumVectorTileGL?.VectorTileset||s?.default?.VectorTileset;r&&(window.VectorTileset=r)}}catch{}if(t){const s=new t(this.viewer,{urlTemplate:e.urlTemplate,minZoom:e.minZoom??0,maxZoom:e.maxZoom??24,style:e.style||{},terrain:!0,tms:e.tms??e.scheme==="tms"});try{const o=s;o?.readyEvent?.addEventListener&&o.readyEvent.addEventListener(()=>{try{console.log("VectorTileLayer ready")}catch{}}),o?.errorEvent?.addEventListener&&o.errorEvent.addEventListener(r=>{console.error("VectorTileLayer error:",r)})}catch{}return s}const n=window?.CesiumVectorTileGL?.VectorTileset||window?.VectorTileset;if(n){const s=[],o=Array.isArray(e.sourceLayer)?e.sourceLayer:e.sourceLayer?[e.sourceLayer]:["layer","lines","line","roads","road","default","vt","g"],r=c=>[{id:`vt-fill-${c}`,type:"fill",source:"vt","source-layer":c,paint:{"fill-color":e.style?.polygon?.fill??"#00ffff66","fill-opacity":e.style?.polygon?.opacity??.4}},{id:`vt-line-${c}`,type:"line",source:"vt","source-layer":c,paint:{"line-color":e.style?.line?.color??"#ff0000","line-width":e.style?.line?.width??3}}];o.forEach(c=>s.push(...r(c)));const a={version:8,sources:{vt:{type:"vector",tiles:[e.urlTemplate],minzoom:e.minZoom??0,maxzoom:e.maxZoom??24,scheme:e.scheme??(e.tms?"tms":"xyz")}},layers:s},l=new n({style:a,terrain:e.terrain??e.clampToGround??!0});return this.viewer.scene.primitives.add(l),l?.readyEvent?.addEventListener&&l.readyEvent.addEventListener(()=>{try{console.log("VectorTileset ready:",{sources:Object.keys(l?.sources||{}),layers:a?.layers?.map(c=>c?.["source-layer"]).filter((c,h,u)=>c&&u.indexOf(c)===h)})}catch{}}),l?.errorEvent?.addEventListener&&l.errorEvent.addEventListener(c=>{console.error("VectorTileset error:",c)}),l}return console.error("Vector tile renderer not found. Please include cesium-vectortile-gl (or compatible) and ensure VectorTileLayer/VectorTileset is available globally."),null}async addGeoJsonLayer(e){let t=window?.VectorTileLayer||window?.CesiumVectorTileGL?.VectorTileLayer||this.cesium?.VectorTileLayer;if(!t)try{const l=await Promise.resolve().then(()=>Qd),c=l?.VectorTileLayer||l?.CesiumVectorTileGL?.VectorTileLayer||l?.default?.VectorTileLayer||l?.default;c&&(window.VectorTileLayer=c,l?.CesiumVectorTileGL&&(window.CesiumVectorTileGL=l.CesiumVectorTileGL),t=c)}catch{}if(!(window?.CesiumVectorTileGL?.VectorTileset||window?.VectorTileset))try{const l=await Promise.resolve().then(()=>Qd),c=l?.VectorTileset||l?.CesiumVectorTileGL?.VectorTileset||l?.default?.VectorTileset;c&&(window.VectorTileset=c)}catch{}const s={type:"geojson"};if(e.dataUrl)s.data=e.dataUrl;else if(e.data)s.data=e.data;else return null;if(e.minZoom!==void 0&&(s.minzoom=e.minZoom),e.maxZoom!==void 0&&(s.maxzoom=e.maxZoom),e.vtOptions&&typeof e.vtOptions=="object"){const l=e.vtOptions;l.maxZoom!==void 0&&(s.maxzoom=l.maxZoom),l.indexMaxZoom!==void 0&&(s.indexMaxZoom=l.indexMaxZoom),l.indexMaxPoints!==void 0&&(s.indexMaxPoints=l.indexMaxPoints),l.tolerance!==void 0&&(s.tolerance=l.tolerance),l.extent!==void 0&&(s.extent=l.extent),l.buffer!==void 0&&(s.buffer=l.buffer),l.lineMetrics!==void 0&&(s.lineMetrics=l.lineMetrics),l.promoteId!==void 0&&(s.promoteId=l.promoteId),l.generateId!==void 0&&(s.generateId=l.generateId)}const o={version:8,sources:{g:s},layers:[{id:"g-fill",type:"fill",source:"g",paint:{"fill-color":e.style?.polygon?.fill??"#00ffff66","fill-opacity":e.style?.polygon?.opacity??.4}},{id:"g-line",type:"line",source:"g",paint:{"line-color":e.style?.line?.color??"#ff0000","line-width":e.style?.line?.width??1.5}},{id:"g-point",type:"symbol",source:"g",layout:{"icon-image":void 0,"text-field":""},paint:{}}]};if(t){const l=new t(this.viewer,{style:o,terrain:e.terrain??e.clampToGround??!0});try{const c=l;c?.readyEvent?.addEventListener&&c.readyEvent.addEventListener(()=>{try{console.log("VectorTileLayer ready (geojson)")}catch{}}),c?.errorEvent?.addEventListener&&c.errorEvent.addEventListener(h=>{console.error("VectorTileLayer error (geojson):",h)})}catch{}try{const h=await(async()=>{if(e.data&&e.data.type==="FeatureCollection")return e.data;if(e.dataUrl){const u=await fetch(e.dataUrl,{cache:"no-store"});if(u.ok){const p=await u.json();if(p&&p.type==="FeatureCollection")return p}}return null})();if(h&&Array.isArray(h.features)&&h.features.length){let u=180,p=90,f=-180,m=-90;const y=(A,v)=>{!Number.isFinite(A)||!Number.isFinite(v)||(A<u&&(u=A),A>f&&(f=A),v<p&&(p=v),v>m&&(m=v))},g=A=>{if(Array.isArray(A)&&typeof A[0]=="number")y(Number(A[0]),Number(A[1]));else if(Array.isArray(A))for(const v of A)g(v)};for(const A of h.features){const v=A?.geometry;v?.coordinates&&g(v.coordinates)}if(u<=f&&p<=m){const A=this.cesium.Rectangle.fromDegrees(u,p,f,m);this.viewer.camera.flyTo({destination:A,duration:.6})}}}catch{}return l}const r=window?.CesiumVectorTileGL?.VectorTileset||window?.VectorTileset;if(!r)return null;const a=new r({style:o,terrain:e.terrain??e.clampToGround??!0});this.viewer.scene.primitives.add(a);try{const c=await(async()=>{if(e.data&&e.data.type==="FeatureCollection")return e.data;if(e.dataUrl){const h=await fetch(e.dataUrl,{cache:"no-store"});if(h.ok){const u=await h.json();if(u&&u.type==="FeatureCollection")return u}}return null})();if(c&&Array.isArray(c.features)&&c.features.length){let h=180,u=90,p=-180,f=-90;const m=(g,A)=>{!Number.isFinite(g)||!Number.isFinite(A)||(g<h&&(h=g),g>p&&(p=g),A<u&&(u=A),A>f&&(f=A))},y=g=>{if(Array.isArray(g)&&typeof g[0]=="number")m(Number(g[0]),Number(g[1]));else if(Array.isArray(g))for(const A of g)y(A)};for(const g of c.features){const A=g?.geometry;A?.coordinates&&y(A.coordinates)}if(h<=p&&u<=f){const g=this.cesium.Rectangle.fromDegrees(h,u,p,f);this.viewer.camera.flyTo({destination:g,duration:.6})}}}catch{}return a}async addVectorTileByTilesManifest(e){try{const t=await fetch(e.manifestUrl,{cache:"no-store"});if(!t.ok)return null;const n=await t.json();let s=null;const o=Array.isArray(n?.items)?n.items[0]:null;if(o?.url&&typeof o.url=="string"&&(s=String(o.url).replace(/\\/g,"/").replace(/\/\d+\/\d+\/\d+\.pbf$/i,"")),!s){const h=new URL(e.manifestUrl,window.location.href).href.replace(/\\/g,"/");s=h.slice(0,h.lastIndexOf("/"))}let r=e.minZoom,a=e.maxZoom;if((r===void 0||a===void 0)&&Array.isArray(n?.items)&&n.items.length){const c=n.items.map(h=>Number(h?.z)).filter(h=>Number.isFinite(h));c.length&&(r===void 0&&(r=Math.min(...c)),a===void 0&&(a=Math.max(...c)))}try{const c=Array.isArray(n?.items)?n.items:[],h=r??c[0]?.z??0,u=c.filter(p=>Number(p?.z)===h);if(u.length){let p=1/0,f=-1/0,m=1/0,y=-1/0;for(const g of u){const A=Number(g.x),v=Number(g.y);!Number.isFinite(A)||!Number.isFinite(v)||(A<p&&(p=A),A>f&&(f=A),v<m&&(m=v),v>y&&(y=v))}if(Number.isFinite(p)&&Number.isFinite(f)&&Number.isFinite(m)&&Number.isFinite(y)){const g=Math.pow(2,h),A=S=>S/g*360-180,v=S=>{const R=Math.PI-2*Math.PI*S/g;return 180/Math.PI*Math.atan(Math.sinh(R))},C=A(p),w=A(f+1),M=v(m),x=v(y+1),I=this.cesium.Rectangle.fromDegrees(C,x,w,M);this.viewer.camera.flyTo({destination:I,duration:.6})}}}catch{}const l=`${s}/{z}/{x}/{y}.pbf`;return this.addVectorTileByUrlTemplate({modelId:e.modelId,urlTemplate:l,sourceLayer:e.sourceLayer,minZoom:r,maxZoom:a,style:e.style})}catch{return null}}enableHeightLod(e=!0){this.heightLodEnabled=e,e&&!this.heightLodHandler?(this.heightLodHandler=this.viewer.camera.changed.addEventListener(()=>{this.applyHeightLod()}),this.viewer.camera.percentageChanged=.05,this.applyHeightLod()):!e&&this.heightLodHandler&&(this.heightLodHandler(),this.heightLodHandler=null,this.gisCadModelsList.forEach(t=>{const n=this.mapLayers[t.modelId];n&&Object.values(n).forEach(s=>{s.forEach(o=>{o.primitive&&(o.primitive.show=t.show!==!1)})})}),this.viewer.scene.requestRender())}applyHeightLod(){if(!this.heightLodEnabled)return;const e=this.viewer.camera.positionCartographic?.height??0,{full:t,medium:n,far:s}=this.heightLodThresholds;this.gisCadModelsList.forEach(o=>{const r=this.mapLayers[o.modelId];!r||o.show===!1||Object.values(r).forEach(a=>{a.forEach(l=>{if(!l.primitive)return;let c=!0;e>s?c=l.type==="polygon":e>n?c=l.type!=="point":e>t&&(c=!0),l.primitive.show=c})})}),this.viewer.scene.requestRender()}getDxfModels(e){const t=typeof e=="object"?e?.modelId:e;return t?this.gisCadModelsList.find(n=>n.modelId===t):this.gisCadModelsList}getDefaultCoordinateTransformConfig(){return{centralMeridian:118.5,latOrigin:0,scaleFactor:1,falseEasting:5e5,falseNorthing:0,ellipsoid:"GRS80"}}buildLongLatProj4Def(e){return`+proj=longlat +ellps=${e?.ellipsoid||this.getDefaultCoordinateTransformConfig().ellipsoid} +no_defs`}buildProjectedProj4Def(e){const t={...this.getDefaultCoordinateTransformConfig(),...e};return["+proj=tmerc",`+lat_0=${t.latOrigin}`,`+lon_0=${t.centralMeridian}`,`+k=${t.scaleFactor}`,`+x_0=${t.falseEasting}`,`+y_0=${t.falseNorthing}`,`+ellps=${t.ellipsoid||"GRS80"}`,"+units=m","+no_defs"].join(" ")}transformCoordinate(e){const t={...this.getDefaultCoordinateTransformConfig(),...e.config},n=this.buildLongLatProj4Def(t),s=this.buildProjectedProj4Def(t);if(e.direction==="lonlatToProjected"){const c=Number(e.longitude),h=Number(e.latitude);if([c,h].some(f=>Number.isNaN(f)))throw new Error("经纬度参数无效");const[u,p]=Ks(n,s,[c,h]);return{direction:e.direction,x:u,y:p,config:t}}const o=Number(e.x),r=Number(e.y);if([o,r].some(c=>Number.isNaN(c)))throw new Error("投影坐标参数无效");const[a,l]=Ks(s,n,[o,r]);return{direction:e.direction,longitude:a,latitude:l,config:t}}showJson({modelId:e,show:t}){const n=this.getRuntimeModel(e);n?.root&&(n.show=t,n.root.show=t),this.mapLayers[e]&&Object.values(this.mapLayers[e]).forEach(s=>{s.forEach(o=>{o.primitive&&(o.primitive.show=t)})}),n&&(t?n._overviewLODCheck?.():(n.overviewL0Roots?.forEach(s=>{s.show=!1}),n.overviewL1Roots?.forEach(s=>{s.show=!1})))}showJsonByLayer({modelId:e,show:t,layers:n}){const s=this.mapLayers[e];!s||!Array.isArray(n)||n.forEach(o=>{const r=s[o];r&&r.forEach(a=>{a.primitive&&(a.primitive.show=t)})})}flyToCadModel(e={}){const t=e.modelId||this.modelId,n=this.gisCadModelsList.find(s=>s.modelId===t);if(n){const s=e.minHeight??n._rebuildContext?.overviewL1Height;this.flyToBounds(n,{duration:e.duration,minHeight:s})}}flyToBounds(e,t){if(!e)return;const n=t?.duration??0,s=t?.minHeight,o=this.cesium,r=(l,c,h,u)=>{let p=l,f=c,m=h,y=u;if(s){const A=(p+m)/2,v=(f+y)/2,C=s/111e3,w=Math.max((m-p)/2,C),M=Math.max((y-f)/2,C);p=A-w,m=A+w,f=v-M,y=v+M}const g=o.Rectangle.fromDegrees(p,f,m,y);this.viewer.camera.flyTo({destination:g,duration:n})};{const l=e.overviewL0Tiles;if(l?.length){let c=1/0,h=1/0,u=-1/0,p=-1/0,f=0;for(const m of l){if(!m.lonLatBounds)continue;const y=m.lonLatBounds;y.west<c&&(c=y.west),y.south<h&&(h=y.south),y.east>u&&(u=y.east),y.north>p&&(p=y.north),f++}if(f>0&&Number.isFinite(c)&&Number.isFinite(u)){r(c,h,u,p);return}}}const a=this.computeRealRectangleDegrees(e);if(a){r(a.west,a.south,a.east,a.north);return}e.root&&this.viewer.flyTo(e.root,{duration:n})}computeRealRectangleDegrees(e){const t=e?.formData||{},n=e?.bounds,s=n?.min,o=n?.max;if(t.transformConfig&&t.transformDirection==="projectedToLonlat"&&s&&o&&Number.isFinite(s.x)&&Number.isFinite(s.y)&&Number.isFinite(o.x)&&Number.isFinite(o.y))try{const r=this.buildLongLatProj4Def(t.transformConfig),a=this.buildProjectedProj4Def(t.transformConfig),l=Ks(a,r),[c,h]=l.forward([s.x,s.y]),[u,p]=l.forward([o.x,o.y]);return{west:Math.min(c,u),south:Math.min(h,p),east:Math.max(c,u),north:Math.max(h,p)}}catch(r){console.warn("Failed to compute projected rectangle",r)}if(t.longitude!==void 0&&t.latitude!==void 0){const r=Number(t.longitude),a=Number(t.latitude),l=Math.max(1e-6,Number(t.scale??1)),c=Math.max(.001,l*.001);return{west:r-c,south:a-c,east:r+c,north:a+c}}return null}parseColor(e,t=1){const n=this.cesium.Color.WHITE.withAlpha(t);if(!e||typeof e!="string")return n;const s=e.trim(),o=[s];if(s.startsWith("#")){const r=s.slice(1).replace(/[^0-9a-fA-F]/g,"");[3,4,6,8].includes(r.length)&&o.push(`#${r}`)}for(const r of Array.from(new Set(o)))try{const a=this.cesium.Color.fromCssColorString(r);if(a)return a.withAlpha(t)}catch(a){console.warn("Failed to parse CAD color candidate:",r,a)}return console.warn("Failed to parse CAD color, fallback to white:",e),n}getLineWidth(e){return typeof e!="number"||Number.isNaN(e)?1:Math.max(1,Math.min(4,Math.round(e*4)))}uniqueKey(e){return e.map(t=>`${t??""}`).join("::")}normalizePoint(e){if(!Array.isArray(e)||e.length<2)return null;const t=Number(e[0]),n=Number(e[1]),s=Number(e[2]||0);return[t,n,s].some(o=>Number.isNaN(o))?null:[t,n,s]}mergeLayerItemsMap(e,t){Object.entries(t).forEach(([n,s])=>{e[n]||(e[n]=[]),e[n].push(...s)})}buildDefaultFormData(e,t){return{modelId:e.modelId,longitude:t.originLongitude,latitude:t.originLatitude,height:t.originHeight,scaleToMeter:t.scaleToMeter,scale:t.scale,localOriginX:t.localOriginX,localOriginY:t.localOriginY,totalRotation:e.totalRotation||0,distance:1e-6,heightDistance:1,rotation:1,scaleStep:.1,clampToGround:!1}}normalizeFormData(e,t,n=!1){const s=e.formData||{},o=this.buildDefaultFormData(e,t);return{...o,...s,modelId:e.modelId,longitude:Number(s.longitude??o.longitude),latitude:Number(s.latitude??o.latitude),height:Number(s.height??o.height),scaleToMeter:Number(s.scaleToMeter??o.scaleToMeter),scale:Math.max(1e-6,Number(s.scale??o.scale)),localOriginX:Number(s.localOriginX??o.localOriginX),localOriginY:Number(s.localOriginY??o.localOriginY),totalRotation:Number(s.totalRotation??o.totalRotation),distance:Number(s.distance??o.distance),heightDistance:Number(s.heightDistance??o.heightDistance),rotation:Number(s.rotation??o.rotation),scaleStep:Number(s.scaleStep??o.scaleStep),transformConfig:s.transformConfig,transformDirection:s.transformDirection,clampToGround:s.clampToGround??n}}removeModelNode(e,t){!e||!t||(e.remove(t),t.destroy&&!t.isDestroyed?.()&&t.destroy())}buildTransform(e,t){const n=this.cesium,s=t.formData||{};let o=s.longitude??t.deltaLongitude??e.longitude??e.result?.origin?.longitude??0,r=s.latitude??t.deltaLatitude??e.latitude??e.result?.origin?.latitude??0,a=s.height??0;const l=e.result?.extMin?.x??0,c=e.result?.extMin?.y??0,h=e.result?.realUnits??e.unit??1,u=Math.max(1e-6,Number(s.scale??1)),p=h*u;let f=null,m=null,y=null;if(s.transformConfig&&s.transformDirection==="projectedToLonlat"){const w=this.buildLongLatProj4Def(s.transformConfig),M=this.buildProjectedProj4Def(s.transformConfig);f=Ks(M,w),console.log("[buildTransform] proj4 mode:",{projectedDef:M,localOriginX:l,localOriginY:c});try{const[x,I]=f.forward([l,c]);if(!Number.isFinite(x)||!Number.isFinite(I))console.warn("proj4 returned NaN for base point",{localOriginX:l,localOriginY:c,blon:x,blat:I}),f=null;else{o=x,r=I,console.log("[buildTransform] proj4 base:",{blon:x,blat:I}),a=0,m=n.Cartesian3.fromDegrees(x,I,0);const S=n.Transforms.eastNorthUpToFixedFrame(m);y=n.Matrix4.inverseTransformation(S,new n.Matrix4)}}catch(x){console.warn("Failed to calculate projection base",x),f=null}}const g=n.Cartesian3.fromDegrees(o,r,a),A=n.Transforms.eastNorthUpToFixedFrame(g),v=s.totalRotation??t.totalRotation??0;if(v){const w=n.Quaternion.fromAxisAngle(n.Cartesian3.UNIT_Z,n.Math.toRadians(v)),M=n.Matrix4.fromRotationTranslation(n.Matrix3.fromQuaternion(w),new n.Cartesian3(0,0,0));n.Matrix4.multiply(A,M,A)}return{originLongitude:o,originLatitude:r,originHeight:a,localOriginX:l,localOriginY:c,scaleToMeter:h,scale:u,totalScaleToMeter:p,toWorld:w=>{const M=this.normalizePoint(w);if(!M)return null;if(f&&m&&y)try{const[I,S]=f.forward([M[0],M[1]]);if(!(!Number.isFinite(I)||!Number.isFinite(S))){const R=n.Cartesian3.fromDegrees(I,S,M[2]),b=n.Matrix4.multiplyByPoint(y,R,new n.Cartesian3);return b.x*=u,b.y*=u,b.z*=u,n.Matrix4.multiplyByPoint(A,b,new n.Cartesian3)}}catch{}const x=new n.Cartesian3((M[0]-l)*p,(M[1]-c)*p,M[2]*p);return n.Matrix4.multiplyByPoint(A,x,new n.Cartesian3)}}}createLinePrimitive(e,t){return e.length?t.clampToGround?new this.cesium.GroundPolylinePrimitive({geometryInstances:e,appearance:new this.cesium.PolylineColorAppearance,asynchronous:!0,allowPicking:!1}):new this.cesium.Primitive({geometryInstances:e,appearance:new this.cesium.PolylineColorAppearance,asynchronous:!0,allowPicking:!1}):null}createPolygonPrimitive(e,t){return e.length?t.clampToGround?new this.cesium.GroundPrimitive({geometryInstances:e,appearance:new this.cesium.PerInstanceColorAppearance({flat:!0,translucent:!0,closed:!0}),asynchronous:!0,allowPicking:!1}):new this.cesium.Primitive({geometryInstances:e,appearance:new this.cesium.PerInstanceColorAppearance({flat:!0,translucent:!0,closed:!0}),asynchronous:!0,allowPicking:!1}):null}createPointPrimitive(e){if(!e.length)return null;const t=new this.cesium.PointPrimitiveCollection;return e.forEach(n=>{t.add(n)}),t}buildModelPrimitives(e,t,n){const s=this.cesium,o=new s.PrimitiveCollection,r={},a={},l=this.buildTransform(t,e),c=new Map,h=new Map,u=new Map,p=Array.isArray(t.result?.lines)?t.result?.lines||[]:[],f=Array.isArray(t.result?.polygons)?t.result?.polygons||[]:[],m=Array.isArray(t.result?.points)?t.result?.points||[]:[];p.forEach(g=>{const v=(Array.isArray(g?.positions)?g.positions:[]).map(I=>l.toWorld(I)).filter(Boolean);if(v.length<2)return;const C=g.layer||"default",w=g.color||"#ffffff",M=this.uniqueKey([C,"line",this.getLineWidth(g.lineWeight)]),x=c.get(M)||[];x.push(new s.GeometryInstance({geometry:n.clampToGround?new s.GroundPolylineGeometry({positions:v,width:this.getLineWidth(g.lineWeight)}):new s.PolylineGeometry({positions:v,width:this.getLineWidth(g.lineWeight),vertexFormat:s.PolylineColorAppearance.VERTEX_FORMAT}),attributes:{color:s.ColorGeometryInstanceAttribute.fromColor(this.parseColor(w,1))},id:{modelId:e.modelId,layer:C,batchId:g.batchId,type:"line"}})),c.set(M,x)}),f.forEach(g=>{const v=(Array.isArray(g?.outerPositions)?g.outerPositions:[]).map(S=>l.toWorld(S)).filter(Boolean);if(v.length<3)return;const C=Array.isArray(g?.holes)?g.holes.map(S=>{const R=Array.isArray(S)?S.map(b=>l.toWorld(b)).filter(Boolean):[];return R.length<3?null:new s.PolygonHierarchy(R)}).filter(Boolean):[],w=g.layer||"default",M=g.color||"#ffffff",x=this.uniqueKey([w,"polygon"]),I=h.get(x)||[];I.push(new s.GeometryInstance({geometry:new s.PolygonGeometry({polygonHierarchy:new s.PolygonHierarchy(v,C),vertexFormat:s.PerInstanceColorAppearance.VERTEX_FORMAT}),attributes:{color:s.ColorGeometryInstanceAttribute.fromColor(this.parseColor(M,.45))},id:{modelId:e.modelId,layer:w,batchId:g.batchId,type:"polygon"}})),h.set(x,I)}),m.forEach(g=>{const A=g?.position||g?.positions?.[0]||g,v=l.toWorld(A);if(!v)return;const C=g.layer||"default",w=g.color||"#ffffff",M=this.uniqueKey([C,"point"]),x=u.get(M)||[];x.push({position:v,color:this.parseColor(w,1),pixelSize:Math.max(4,Number(g.pixelSize||6)),id:{modelId:e.modelId,layer:C,batchId:g.batchId,type:"point"}}),u.set(M,x)});const y=(g,A,v)=>{A&&(o.add(A),n.recordLayers!==!1&&(a[g]||(a[g]=[]),a[g].push({primitive:A,color:v.color,batchId:v.batchId,type:v.type})),r[g]||(r[g]={}),r[g][v.type]=A)};return c.forEach((g,A)=>{const[v="default"]=A.split("::");y(v,this.createLinePrimitive(g,n),{color:void 0,batchId:g[0]?.id?.batchId,type:"line"})}),h.forEach((g,A)=>{const[v="default"]=A.split("::");y(v,this.createPolygonPrimitive(g,n),{color:void 0,batchId:g[0]?.id?.batchId,type:"polygon"})}),u.forEach((g,A)=>{const[v="default"]=A.split("::");y(v,this.createPointPrimitive(g),{color:void 0,batchId:g[0]?.id?.batchId,type:"point"})}),{root:o,layerPrimitiveMap:r,layerItemsMap:a,transform:l}}buildModelRoot(e,t,n){const s=new this.cesium.PrimitiveCollection,o={};let r=null;return t.forEach(a=>{const l=this.buildModelPrimitives(e,a,n);r||(r=l),s.add(l.root),this.mergeLayerItemsMap(o,l.layerItemsMap)}),{root:s,transform:r.transform,layerItemsMap:o}}getRuntimeModel(e){const t=e||this.modelId;return this.gisCadModelsList.find(n=>n.modelId===t)||null}rebuildPreviewRoot(e){if(!e.editingFormData)return;e.previewRoot&&(this.removeModelNode(e.root,e.previewRoot),e.previewRoot=null);const t=this.buildModelRoot({...e,formData:e.editingFormData},e.sourceDataList,{clampToGround:e.editingFormData.clampToGround??!1,recordLayers:!1});e.previewRoot=t.root,e.root.add(e.previewRoot),e.groundRoot&&(e.groundRoot.show=!1)}replaceGroundRoot(e,t){const n=this.cesium;t.clampToGround!==void 0&&(e.buildOptions.clampToGround=t.clampToGround),e.tileCameraListenerRemove?.(),e.overviewLODListenerRemove?.(),e.tileCameraListenerRemove=void 0,e.overviewLODListenerRemove=void 0,e._overviewLODCheck=void 0,e._tileLODCheck=void 0,e.root&&(this.viewer.scene.primitives.remove(e.root),e.root.destroy&&!e.root.isDestroyed?.()&&e.root.destroy()),e.root=null,e.groundRoot=null,e.previewRoot=null,e.tileRoots?.clear(),e.overviewL0Roots?.clear(),e.overviewL1Roots?.clear(),e.formData=t;const s=e.sourceDataList?.[0];if(!s)return;const o=this.buildModelRoot({...e,formData:t},[s],e.buildOptions),r=new n.PrimitiveCollection;r.add(o.root),e.root=r,e.groundRoot=o.root,e.groundRoot.show=e.show!==!1,e.transform=o.transform,e.sourceDataList=[s],e.loadedChunks=1,e.tileRoots=e.manifestTiles?new Map:void 0,e.overviewL0Roots=new Map,e.overviewL1Roots=new Map,this.mapLayers[e.modelId]=o.layerItemsMap,this.viewer.scene.primitives.add(e.root),e.manifestTiles&&this.computeManifestTileLonLatBounds(e.manifestTiles,e.transform),e.overviewL0Tiles&&this.computeManifestTileLonLatBounds(e.overviewL0Tiles,e.transform),e.overviewL1Tiles&&this.computeManifestTileLonLatBounds(e.overviewL1Tiles,e.transform);const a=e._rebuildContext;a&&((e.overviewL0Tiles?.length||e.overviewL1Tiles?.length)&&this.setupOverviewLOD(e,e,a.normalizedBase,e.overviewL0Tiles||[],e.overviewL1Tiles||[],a.overviewL1Height),e.manifestTiles&&this.setupManifestTileLoading(e,e,a.normalizedBase)),this.viewer.scene.requestRender()}async loadModelFile(e){try{if(!e||typeof e!="string")return!1;const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status} for ${e}`);if(e.endsWith(".json")||t.headers.get("content-type")?.includes("application/json"))return await t.json();const n=await t.blob(),s=new ml(new tr(n),{password:Yu,useWebWorkers:!1}),r=(await s.getEntries()).find(c=>!c.directory&&c.filename.endsWith(".json"));if(!r)return await s.close(),!1;const a=await r.arrayBuffer({useWebWorkers:!1});await s.close();const l=new TextDecoder().decode(a);return JSON.parse(l.trim())}catch(t){return console.error("Failed to load GIS CAD source:",e,t),!1}}getCandidateUrls(e){const t=e.outPutPath.endsWith("/")?e.outPutPath:`${e.outPutPath}/`,n=[e.sourceUrl,`${t}${e.dbName}/cad.zip`].filter(Boolean);return Array.from(new Set(n))}getChunkCandidateUrls(e,t,n){const o=[`${e.outPutPath.endsWith("/")?e.outPutPath:`${e.outPutPath}/`}${e.dbName}/cad_${n}.zip`];try{const r=new URL(t),a=r.pathname,l=a.lastIndexOf("/"),c=l>=0?a.slice(0,l+1):"/",h=a.lastIndexOf("."),u=h>=0?a.slice(h):".zip",p=l>=0?a.slice(l+1,h>=0?h:void 0):a.slice(0,h>=0?h:void 0),f=p===e.dbName?e.dbName:p;o.unshift(`${r.origin}${c}${f}_${n}${u}`,`${r.origin}${c}${f}${n}${u}`)}catch(r){console.warn("Failed to resolve chunk urls from primary source:",t,r)}return Array.from(new Set(o))}async loadSourceData(e){const t=this.getCandidateUrls(e);for(const n of t){const s=await this.loadModelFile(n);if(s)return{url:n,data:s}}return{url:t[0]||"",data:!1}}async addGISCadModel({fileNames:e,options:t}){if(!e?.length)return;const n={...this.options,...t},s={clampToGround:n.clampToGround??n.mode!=="2d"};for(const o of e){if(this.gisCadModelsList.find(v=>v.modelId===o.modelId))continue;/^(https?|atom):\/\//i.test(o.outPutPath)||(o.outPutPath=`${window.location.origin}${o.outPutPath}`);const a=o.outPutPath.endsWith("/")?o.outPutPath:`${o.outPutPath}/`,l=`${a}${o.dbName}/region.zip`;let c=!1;try{(await fetch(l,{method:"HEAD",cache:"no-store"})).ok&&(c=await this.loadModelFile(l))}catch{}c&&typeof c=="object"&&(["longitude","latitude","scale","totalRotation","height"].some(w=>c[w]!==void 0)&&(o.formData={longitude:c.longitude,latitude:c.latitude,scale:c.scale,totalRotation:c.totalRotation,height:c.height,...o.formData||{}}),c.centralMeridian!==void 0&&(o.formData={transformConfig:{centralMeridian:c.centralMeridian,latOrigin:c.latOrigin??0,scaleFactor:c.scaleFactor??1,falseEasting:c.falseEasting??5e5,falseNorthing:c.falseNorthing??0,ellipsoid:c.ellipsoid??"GRS80"},transformDirection:"projectedToLonlat",...o.formData||{}}));const h=`${a}${o.dbName}/manifest.zip`;let u=null,p=null,f=null,m=6e3;try{const v=await this.loadModelFile(h);v&&typeof v=="object"&&(v?.tiles&&Array.isArray(v.tiles)&&(u=v.tiles),Array.isArray(v?.overviewL0)&&(p=v.overviewL0),Array.isArray(v?.overviewL1)&&(f=v.overviewL1,m=Number(v.overviewL1Height)||6e3))}catch{}console.log("[addGISCadModel] formData:",JSON.stringify(o.formData)),console.log("[addGISCadModel] manifestTiles:",u?.length,"L0:",p?.length,"L1:",f?.length);const y=await this.loadSourceData(o);if(!y.data){console.error("Failed to resolve GIS CAD primary source for model:",o);continue}const g=y.data,A=Math.max(1,Number(g.numbersOfFile||1));try{const v=this.buildTransform(g,o),C=this.normalizeFormData(o,v,s.clampToGround),w=this.buildModelRoot({...o,formData:C},[g],s),M=new this.cesium.PrimitiveCollection;M.add(w.root);const x=g.bounds||null,I={...o,type:"gis-cad",sourceUrl:y.url,sourceData:g,sourceDataList:[g],root:M,groundRoot:w.root,previewRoot:null,bounds:x,transform:w.transform,show:!0,formData:C,editingFormData:null,isEditing:!1,buildOptions:s,totalChunks:u?u.length:A,loadedChunks:1,chunkLoadingComplete:!u&&A<=1,manifestTiles:u||void 0,tileRoots:u?new Map:void 0,pendingFontTiles:u?u.filter(S=>S.isFont&&S.file!=="cad.zip").map(S=>S.file):[],_rebuildContext:{normalizedBase:a,overviewL1Height:m}};this.mapLayers[o.modelId]=w.layerItemsMap,this.viewer.scene.primitives.add(I.root),this.gisCadModelsList.push(I),this.setModelId(o.modelId),p&&(this.computeManifestTileLonLatBounds(p,I.transform),I.overviewL0Tiles=p),n.flyTo&&this.flyToBounds(I),n.onSuccess&&n.onSuccess(I),(p||f)&&(f&&(this.computeManifestTileLonLatBounds(f,I.transform),I.overviewL1Tiles=f),this.setupOverviewLOD(o,I,a,p||[],f||[],m)),u?(this.computeManifestTileLonLatBounds(u,I.transform),this.setupManifestTileLoading(o,I,a)):A>1&&this.loadRemainingChunksAsync(o,y.url,A,I)}catch(v){console.error("Failed to build GIS CAD model:",o,v)}}this.events.emit("mountAllGISCad",this.gisCadModelsList)}async _addGISCadModel({fileNames:e,options:t}){if(!e?.length)return;const n={...this.options,...t},s={clampToGround:n.clampToGround??n.mode!=="2d"};for(const o of e){if(this.gisCadModelsList.find(f=>f.modelId===o.modelId))continue;/^(https?|atom):\/\//i.test(o.outPutPath)||(o.outPutPath=`${window.location.origin}${o.outPutPath}`);const a=o.outPutPath.endsWith("/")?o.outPutPath:`${o.outPutPath}/`,l=`${a}${o.dbName}/region.zip`;let c=!1;try{(await fetch(l,{method:"HEAD"})).ok&&(c=await this.loadModelFile(l))}catch{}c&&typeof c=="object"&&(["longitude","latitude","scale","totalRotation","height"].some(y=>c[y]!==void 0)&&(o.formData={longitude:c.longitude,latitude:c.latitude,scale:c.scale,totalRotation:c.totalRotation,height:c.height,...o.formData||{}}),c.centralMeridian!==void 0&&(o.formData={transformConfig:{centralMeridian:c.centralMeridian,latOrigin:c.latOrigin??0,scaleFactor:c.scaleFactor??1,falseEasting:c.falseEasting??5e5,falseNorthing:c.falseNorthing??0,ellipsoid:c.ellipsoid??"GRS80"},transformDirection:"projectedToLonlat",...o.formData||{}}));const h=await this.loadSourceData(o);if(!h.data){console.error("Failed to resolve GIS CAD primary source for model:",o);continue}const u=h.data,p=Math.max(1,Number(u.numbersOfFile||1));try{const f=this.buildTransform(u,o),m=this.normalizeFormData(o,f,s.clampToGround),y=this.buildModelRoot({...o,formData:m},[u],s),g=new this.cesium.PrimitiveCollection;g.add(y.root);const A=u.bounds||null,v={...o,type:"gis-cad",sourceUrl:h.url,sourceData:u,sourceDataList:[u],root:g,groundRoot:y.root,previewRoot:null,bounds:A,transform:y.transform,show:!0,formData:m,editingFormData:null,isEditing:!1,buildOptions:s,totalChunks:p,loadedChunks:1,chunkLoadingComplete:p<=1,_rebuildContext:{normalizedBase:a,overviewL1Height:6e3}};this.mapLayers[o.modelId]=y.layerItemsMap,this.viewer.scene.primitives.add(v.root),this.gisCadModelsList.push(v),this.setModelId(o.modelId),n.flyTo&&this.flyToBounds(v),n.onSuccess&&n.onSuccess(v),p>1&&this.loadRemainingChunksAsync(o,h.url,p,v)}catch(f){console.error("Failed to build GIS CAD model:",o,f)}}this.events.emit("mountAllGISCad",this.gisCadModelsList)}async loadRemainingChunksAsync(e,t,n,s){for(let o=1;o<n;o++){await new Promise(l=>setTimeout(l,0));const r=this.getChunkCandidateUrls(e,t,o);let a=!1;for(const l of r)try{const c=await this.loadModelFile(l);if(c?.watermark&&this.watermarkEnabled,c){const h=this.buildModelPrimitives({...s,formData:s.formData},c,s.buildOptions);s.groundRoot.add(h.root),s.sourceDataList.push(c),this.mapLayers[s.modelId]||(this.mapLayers[s.modelId]={}),this.mergeLayerItemsMap(this.mapLayers[s.modelId],h.layerItemsMap),s.loadedChunks=(s.loadedChunks||1)+1,this.events.emit("chunkProgress",{modelId:s.modelId,loaded:s.loadedChunks,total:n}),this.viewer.scene.requestRender(),a=!0;break}}catch(c){console.error("Failed to append GIS CAD chunk:",l,c)}a||console.warn(`Failed to load GIS CAD chunk ${o} for ${e.modelId}`)}s.chunkLoadingComplete=!0,this.events.emit("chunkLoadingComplete",s)}setupOverviewLOD(e,t,n,s,o,r=6e3){const a=this.cesium;t.overviewL0Roots=new Map,t.overviewL1Roots=new Map;const l=w=>{if(!w.lonLatBounds)return!1;let M=null;try{M=this.viewer?.camera?.computeViewRectangle?.()??null}catch{M=null}if(!M)return!0;const x=a.Rectangle.fromDegrees(w.lonLatBounds.west,w.lonLatBounds.south,w.lonLatBounds.east,w.lonLatBounds.north);return a.Rectangle.intersection(M,x)!==void 0},c=async(w,M)=>{if(M.has(w.file))return;const x=`${n}${e.dbName}/${w.file}`;try{const I=await this.loadModelFile(x);if(!I)return;const S=this.buildModelPrimitives({...t,formData:t.formData},I,t.buildOptions);t.groundRoot.add(S.root),M.set(w.file,S.root),this.viewer.scene.requestRender()}catch(I){console.warn(`Failed to load overview chunk ${w.file}:`,I)}},h=(w,M)=>{const x=M.get(w);if(x){try{t.groundRoot.remove(x),x.destroy&&x.destroy()}catch{}M.delete(w)}};let u=0;const p=3,f=[],m=()=>{for(;u<p&&f.length>0;){const{tile:w,rootMap:M}=f.shift();M.has(w.file)||(u++,c(w,M).finally(()=>{u--,m()}))}},y=(w,M)=>{M.has(w.file)||f.some(x=>x.tile.file===w.file)||f.push({tile:w,rootMap:M})},g=()=>{if(!t.overviewL0Roots||!t.overviewL1Roots)return;const w=this.viewer?.camera?.positionCartographic?.height??1/0;for(const S of s)l(S)?y(S,t.overviewL0Roots):h(S.file,t.overviewL0Roots);for(const S of o)l(S)&&w<r?y(S,t.overviewL1Roots):h(S.file,t.overviewL1Roots);const M=(t.tileRoots?.size||0)>1,x=!M&&(w>=r||w<r&&t.overviewL1Roots.size===0);t.overviewL0Roots.forEach(S=>{S.show=x});const I=!M&&t.overviewL1Roots.size>0&&w<r;t.overviewL1Roots.forEach(S=>{S.show=I}),m(),this.viewer.scene.requestRender()};t._overviewLODCheck=g;let A=null;const v=()=>{A&&clearTimeout(A),A=setTimeout(()=>{A=null,g()},200)},C=this.viewer?.camera?.moveEnd?.addEventListener?.(v);typeof C=="function"&&(t.overviewLODListenerRemove=()=>{A&&clearTimeout(A),C()}),g()}computeManifestTileLonLatBounds(e,t){if(!t?.toWorld){console.warn("[computeManifestTileLonLatBounds] modelTransform.toWorld 不存在,跳过");return}const n=this.cesium;console.log("[computeManifestTileLonLatBounds] transform 参数:",{originLongitude:t.originLongitude,originLatitude:t.originLatitude,localOriginX:t.localOriginX,localOriginY:t.localOriginY,scaleToMeter:t.scaleToMeter,scale:t.scale,totalScaleToMeter:t.totalScaleToMeter});let s=0,o=0;const r=(a,l)=>{try{const c=t.toWorld([a,l,0]);if(!c)return null;const h=n.Cartographic.fromCartesian(c);return[n.Math.toDegrees(h.longitude),n.Math.toDegrees(h.latitude)]}catch{return null}};for(const a of e){if(!a.bounds)continue;const{minX:l,minY:c,maxX:h,maxY:u}=a.bounds,p=r(l,c),f=r(h,u);p&&f?(a.lonLatBounds={west:Math.min(p[0],f[0]),south:Math.min(p[1],f[1]),east:Math.max(p[0],f[0]),north:Math.max(p[1],f[1])},s++):o++}if(console.log(`[computeManifestTileLonLatBounds] 成功=${s} 失败=${o} 总共=${e.length}`),s>0){const a=e.find(l=>l.lonLatBounds);console.log("[computeManifestTileLonLatBounds] 示例:",a?.file,a?.lonLatBounds)}}setupManifestTileLoading(e,t,n){const a=this.cesium,l=t.manifestTiles||[];if(l.length===0)return;const c=x=>{if(!x.lonLatBounds)return!1;let I=null;try{I=this.viewer?.camera?.computeViewRectangle?.()??null}catch{I=null}if(!I)return!0;const S=a.Rectangle.fromDegrees(x.lonLatBounds.west,x.lonLatBounds.south,x.lonLatBounds.east,x.lonLatBounds.north);return a.Rectangle.intersection(I,S)!==void 0},h=x=>{const I=t.tileRoots?.get(x);if(I){try{t.groundRoot.remove(I),I.destroy&&I.destroy()}catch{}t.tileRoots?.delete(x),t.loadedChunks=Math.max(1,(t.loadedChunks||1)-1),this.events.emit("chunkProgress",{modelId:t.modelId,loaded:t.loadedChunks,total:t.totalChunks}),t._overviewLODCheck?.(),this.viewer.scene.requestRender()}},u=new Map,p=3;let f=0;const m=[],y=x=>{const I=u.get(x);I&&(clearTimeout(I),u.delete(x));const S=m.indexOf(x);S>=0&&m.splice(S,1)},g=()=>{for(;f<p&&m.length>0;){const x=m.shift(),I=l.find(S=>S.file===x);!I||t.tileRoots?.has(x)||!c(I)||(f++,A(x).finally(()=>{f--,g()}))}},A=async x=>{if(t.tileRoots?.has(x))return;const I=`${n}${e.dbName}/${x}`;try{const S=await this.loadModelFile(I);if(S?.watermark&&this.watermarkEnabled,!S)return;const R=this.buildModelPrimitives({...t,formData:t.formData},S,t.buildOptions);t.groundRoot.add(R.root),t.tileRoots?.set(x,R.root),t.sourceDataList.push(S),this.mapLayers[t.modelId]||(this.mapLayers[t.modelId]={}),this.mergeLayerItemsMap(this.mapLayers[t.modelId],R.layerItemsMap),t.loadedChunks=(t.loadedChunks||1)+1,this.events.emit("chunkProgress",{modelId:t.modelId,loaded:t.loadedChunks,total:t.totalChunks}),t._overviewLODCheck?.(),this.viewer.scene.requestRender()}catch(S){console.error("Failed to load CAD tile:",I,S)}},v=()=>{if(!t.tileRoots)return;const x=this.viewer?.camera?.positionCartographic?.height??1/0,I=x<1e3;for(const S of l){if(S.file==="cad.zip"||!t.tileRoots.has(S.file))continue;let R=!1;S.isFont?I&&c(S)||(R=!0):c(S)?x>=1500&&(R=!0):R=!0,R&&(y(S.file),h(S.file),S.isFont&&!t.pendingFontTiles?.includes(S.file)&&t.pendingFontTiles?.push(S.file))}for(const S of l)if(S.file!=="cad.zip"&&!t.tileRoots.has(S.file)&&!u.has(S.file)&&!m.includes(S.file)&&!(S.isFont&&!I)&&!(!S.isFont&&x>=1500)&&c(S)){const R=S.file,b=setTimeout(()=>{u.delete(R),!t.tileRoots?.has(R)&&c(S)&&!m.includes(R)&&(m.push(R),g())},20);u.set(S.file,b)}};let C=null;const w=()=>{C&&clearTimeout(C),C=setTimeout(()=>{C=null,v()},20)},M=this.viewer?.camera?.moveEnd?.addEventListener?.(w);typeof M=="function"&&(t.tileCameraListenerRemove=()=>{C&&clearTimeout(C),M()}),t._tileLODCheck=v,v()}beginEditGISCad({modelId:e}){const t=this.getRuntimeModel(e);return t?(t.isEditing||(t.isEditing=!0,t.editingFormData={...t.formData},this.rebuildPreviewRoot(t)),t):null}adjustGISCadModel(e){const t=this.getRuntimeModel(e.modelId);return t?(t.formData={...t.formData,...e,modelId:t.modelId,scale:Math.max(1e-6,Number(e.scale??t.formData.scale))},e.clampToGround!==void 0&&(t.buildOptions.clampToGround=e.clampToGround),this.replaceGroundRoot(t,t.formData),this.flyToBounds(t,{duration:0,minHeight:t._rebuildContext?.overviewL1Height}),t.formData):null}commitEditGISCad({modelId:e}){const t=this.getRuntimeModel(e);return t&&(t.previewRoot&&(this.removeModelNode(t.root,t.previewRoot),t.previewRoot=null),t.isEditing=!1,t.editingFormData=null,t)}cancelEditGISCad({modelId:e}){const t=this.getRuntimeModel(e);return t?(t.previewRoot&&(this.removeModelNode(t.root,t.previewRoot),t.previewRoot=null),t.groundRoot&&(t.groundRoot.show=t.show!==!1),t.isEditing=!1,t.editingFormData=null,t):null}deleteCad({modelId:e}){this.mapLayers[e]&&delete this.mapLayers[e];const t=this.gisCadModelsList.findIndex(n=>n.modelId===e);if(t>-1){const n=this.gisCadModelsList[t];n.tileCameraListenerRemove?.(),n.overviewLODListenerRemove?.(),this.viewer.scene.primitives.remove(n.root),n.root?.destroy&&!n.root.isDestroyed?.()&&n.root.destroy(),this.gisCadModelsList.splice(t,1)}}deleteAllCad(){[...this.gisCadModelsList].forEach(e=>{e.modelId&&this.deleteCad({modelId:e.modelId})})}}class ki{constructor(e,t){if(this.viewer=e,!this.viewer)return;this.type="prompt",t=t||{};const n=t.type==null?1:t.type;let s={id:new Date().getTime()+""+Math.floor(Math.random()*1e4),type:n,anchor:n==2,closeBtn:n==2,offset:n==2?{x:0,y:-20}:{x:10,y:10},content:"",show:!0,style:{background:"rgba(0,0,0,0.5)",color:"white"}};this.opt=Object.assign(s,t),this.attr=this.opt;const o=this.viewer.container.id;this.isShow=this.opt.show==null?!0:this.opt.show;let r="",a="";const l=this.opt.style.background,c=this.opt.style.color;this.opt.anchor&&(r+=`
|
|
16
|
+
northing meters`+i;var p=u/2,f=0,m=0,y,g,A,v,C;return p>0&&(y=1e5/Math.pow(10,p),g=i.substring(o,o+p),f=parseFloat(g)*y,A=i.substring(o+p),m=parseFloat(A)*y),v=f+c,C=m+h,{easting:v,northing:C,zoneLetter:a,zoneNumber:r,accuracy:y}}function UE(i,e){for(var t=Mf.charCodeAt(e-1),n=1e5,s=!1;t!==i.charCodeAt(0);){if(t++,t===wt&&t++,t===Dt&&t++,t>Os){if(s)throw"Bad character: "+i;t=Nn,s=!0}n+=1e5}return n}function VE(i,e){if(i>"V")throw"MGRSPoint given invalid Northing "+i;for(var t=Tf.charCodeAt(e-1),n=0,s=!1;t!==i.charCodeAt(0);){if(t++,t===wt&&t++,t===Dt&&t++,t>Fs){if(s)throw"Bad character: "+i;t=Nn,s=!0}n+=1e5}return n}function QE(i){var e;switch(i){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+i}function Ln(i,e,t){if(!(this instanceof Ln))return new Ln(i,e,t);if(Array.isArray(i))this.x=i[0],this.y=i[1],this.z=i[2]||0;else if(typeof i=="object")this.x=i.x,this.y=i.y,this.z=i.z||0;else if(typeof i=="string"&&typeof e>"u"){var n=i.split(",");this.x=parseFloat(n[0]),this.y=parseFloat(n[1]),this.z=parseFloat(n[2])||0}else this.x=i,this.y=e,this.z=t||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Ln.fromMGRS=function(i){return new Ln(_f(i))},Ln.prototype.toMGRS=function(i){return Bf([this.x,this.y],i)};var zE=1,HE=.25,Nf=.046875,Lf=.01953125,Rf=.01068115234375,YE=.75,$E=.46875,jE=.013020833333333334,WE=.007120768229166667,qE=.3645833333333333,KE=.005696614583333333,XE=.3076171875;function Dl(i){var e=[];e[0]=zE-i*(HE+i*(Nf+i*(Lf+i*Rf))),e[1]=i*(YE-i*(Nf+i*(Lf+i*Rf)));var t=i*i;return e[2]=t*($E-i*(jE+i*WE)),t*=i,e[3]=t*(qE-i*KE),e[4]=t*i*XE,e}function Rn(i,e,t,n){return t*=e,e*=e,n[0]*i-t*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}var JE=20;function Nl(i,e,t){for(var n=1/(1-e),s=i,o=JE;o;--o){var r=Math.sin(s),a=1-e*r*r;if(a=(Rn(s,r,Math.cos(s),t)-i)*(a*Math.sqrt(a))*n,s-=a,Math.abs(a)<K)return s}return s}function ZE(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=Dl(this.es),this.ml0=Rn(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function ex(i){var e=i.x,t=i.y,n=J(e-this.long0,this.over),s,o,r,a=Math.sin(t),l=Math.cos(t);if(this.es){var h=l*n,u=Math.pow(h,2),p=this.ep2*Math.pow(l,2),f=Math.pow(p,2),m=Math.abs(l)>K?Math.tan(t):0,y=Math.pow(m,2),g=Math.pow(y,2);s=1-this.es*Math.pow(a,2),h=h/Math.sqrt(s);var A=Rn(t,a,l,this.en);o=this.a*(this.k0*h*(1+u/6*(1-y+p+u/20*(5-18*y+g+14*p-58*y*p+u/42*(61+179*g-g*y-479*y)))))+this.x0,r=this.a*(this.k0*(A-this.ml0+a*n*h/2*(1+u/12*(5-y+9*p+4*f+u/30*(61+g-58*y+270*p-330*y*p+u/56*(1385+543*g-g*y-3111*y))))))+this.y0}else{var c=l*Math.sin(n);if(Math.abs(Math.abs(c)-1)<K)return 93;if(o=.5*this.a*this.k0*Math.log((1+c)/(1-c))+this.x0,r=l*Math.cos(n)/Math.sqrt(1-Math.pow(c,2)),c=Math.abs(r),c>=1){if(c-1>K)return 93;r=0}else r=Math.acos(r);t<0&&(r=-r),r=this.a*this.k0*(r-this.lat0)+this.y0}return i.x=o,i.y=r,i}function tx(i){var e,t,n,s,o=(i.x-this.x0)*(1/this.a),r=(i.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+r/this.k0,t=Nl(e,this.es,this.en),Math.abs(t)<$){var u=Math.sin(t),p=Math.cos(t),f=Math.abs(p)>K?Math.tan(t):0,m=this.ep2*Math.pow(p,2),y=Math.pow(m,2),g=Math.pow(f,2),A=Math.pow(g,2);e=1-this.es*Math.pow(u,2);var v=o*Math.sqrt(e)/this.k0,C=Math.pow(v,2);e=e*f,n=t-e*C/(1-this.es)*.5*(1-C/12*(5+3*g-9*m*g+m-4*y-C/30*(61+90*g-252*m*g+45*A+46*m-C/56*(1385+3633*g+4095*A+1574*A*g)))),s=J(this.long0+v*(1-C/6*(1+2*g+m-C/20*(5+28*g+24*A+8*m*g+6*m-C/42*(61+662*g+1320*A+720*A*g))))/p,this.over)}else n=$*Ls(r),s=0;else{var a=Math.exp(o/this.k0),l=.5*(a-1/a),c=this.lat0+r/this.k0,h=Math.cos(c);e=Math.sqrt((1-Math.pow(h,2))/(1+Math.pow(l,2))),n=Math.asin(e),r<0&&(n=-n),l===0&&h===0?s=0:s=J(Math.atan2(l,h)+this.long0,this.over)}return i.x=s,i.y=n,i}var ix=["Fast_Transverse_Mercator","Fast Transverse Mercator"];const ur={init:ZE,forward:ex,inverse:tx,names:ix};function Ff(i){var e=Math.exp(i);return e=(e-1/e)/2,e}function Et(i,e){i=Math.abs(i),e=Math.abs(e);var t=Math.max(i,e),n=Math.min(i,e)/(t||1);return t*Math.sqrt(1+Math.pow(n,2))}function nx(i){var e=1+i,t=e-1;return t===0?i:i*Math.log(e)/t}function sx(i){var e=Math.abs(i);return e=nx(e*(1+e/(Et(1,e)+1))),i<0?-e:e}function Ll(i,e){for(var t=2*Math.cos(2*e),n=i.length-1,s=i[n],o=0,r;--n>=0;)r=-o+t*s+i[n],o=s,s=r;return e+r*Math.sin(2*e)}function ox(i,e){for(var t=2*Math.cos(e),n=i.length-1,s=i[n],o=0,r;--n>=0;)r=-o+t*s+i[n],o=s,s=r;return Math.sin(e)*r}function rx(i){var e=Math.exp(i);return e=(e+1/e)/2,e}function Of(i,e,t){for(var n=Math.sin(e),s=Math.cos(e),o=Ff(t),r=rx(t),a=2*s*r,l=-2*n*o,c=i.length-1,h=i[c],u=0,p=0,f=0,m,y;--c>=0;)m=p,y=u,p=h,u=f,h=-m+a*p-l*u+i[c],f=-y+l*p+a*u;return a=n*r,l=s*o,[a*h-l*f,a*f+l*h]}function ax(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(ur.init.apply(this),this.forward=ur.forward,this.inverse=ur.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var i=this.es/(1+Math.sqrt(1-this.es)),e=i/(2-i),t=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),t=t*e,this.cgb[1]=t*(7/3+e*(-8/5+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=t*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),t=t*e,this.cgb[2]=t*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=t*(-26/15+e*(34/21+e*(8/5+e*(-12686/2835)))),t=t*e,this.cgb[3]=t*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=t*(1237/630+e*(-12/5+e*(-24832/14175))),t=t*e,this.cgb[4]=t*(4174/315+e*(-144838/6237)),this.cbg[4]=t*(-734/315+e*(109598/31185)),t=t*e,this.cgb[5]=t*(601676/22275),this.cbg[5]=t*(444337/155925),t=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+t*(1/4+t*(1/64+t/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=t*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=t*(13/48+e*(-3/5+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),t=t*e,this.utg[2]=t*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=t*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),t=t*e,this.utg[3]=t*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=t*(49561/161280+e*(-179/168+e*(6601661/7257600))),t=t*e,this.utg[4]=t*(-4583/161280+e*(108847/3991680)),this.gtu[4]=t*(34729/80640+e*(-3418889/1995840)),t=t*e,this.utg[5]=t*(-20648693/638668800),this.gtu[5]=t*(212378941/319334400);var n=Ll(this.cbg,this.lat0);this.Zb=-this.Qn*(n+ox(this.gtu,2*n))}function lx(i){var e=J(i.x-this.long0,this.over),t=i.y;t=Ll(this.cbg,t);var n=Math.sin(t),s=Math.cos(t),o=Math.sin(e),r=Math.cos(e);t=Math.atan2(n,r*s),e=Math.atan2(o*s,Et(n,s*r)),e=sx(Math.tan(e));var a=Of(this.gtu,2*t,2*e);t=t+a[0],e=e+a[1];var l,c;return Math.abs(e)<=2.623395162778?(l=this.a*(this.Qn*e)+this.x0,c=this.a*(this.Qn*t+this.Zb)+this.y0):(l=1/0,c=1/0),i.x=l,i.y=c,i}function cx(i){var e=(i.x-this.x0)*(1/this.a),t=(i.y-this.y0)*(1/this.a);t=(t-this.Zb)/this.Qn,e=e/this.Qn;var n,s;if(Math.abs(e)<=2.623395162778){var o=Of(this.utg,2*t,2*e);t=t+o[0],e=e+o[1],e=Math.atan(Ff(e));var r=Math.sin(t),a=Math.cos(t),l=Math.sin(e),c=Math.cos(e);t=Math.atan2(r*c,Et(l,c*a)),e=Math.atan2(l,c*a),n=J(e+this.long0,this.over),s=Ll(this.cgb,t)}else n=1/0,s=1/0;return i.x=n,i.y=s,i}var dx=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"];const fr={init:ax,forward:lx,inverse:cx,names:dx};function hx(i,e){if(i===void 0){if(i=Math.floor((J(e)+Math.PI)*30/Math.PI)+1,i<0)return 0;if(i>60)return 60}return i}var ux="etmerc";function fx(){var i=hx(this.zone,this.long0);if(i===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(i)-183)*Oe,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,fr.init.apply(this),this.forward=fr.forward,this.inverse=fr.inverse}var px=["Universal Transverse Mercator System","utm"];const mx={init:fx,names:px,dependsOn:ux};function Rl(i,e){return Math.pow((1-i)/(1+i),e)}var gx=20;function yx(){var i=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*i*i),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(i/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+Ae)/(Math.pow(Math.tan(.5*this.lat0+Ae),this.C)*Rl(this.e*i,this.ratexp))}function Ax(i){var e=i.x,t=i.y;return i.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*t+Ae),this.C)*Rl(this.e*Math.sin(t),this.ratexp))-$,i.x=this.C*e,i}function vx(i){for(var e=1e-14,t=i.x/this.C,n=i.y,s=Math.pow(Math.tan(.5*n+Ae)/this.K,1/this.C),o=gx;o>0&&(n=2*Math.atan(s*Rl(this.e*Math.sin(i.y),-.5*this.e))-$,!(Math.abs(n-i.y)<e));--o)i.y=n;return o?(i.x=t,i.y=n,i):null}const Fl={init:yx,forward:Ax,inverse:vx};function bx(){Fl.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function Cx(i){var e,t,n,s;return i.x=J(i.x-this.long0,this.over),Fl.forward.apply(this,[i]),e=Math.sin(i.y),t=Math.cos(i.y),n=Math.cos(i.x),s=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*t*n),i.x=s*t*Math.sin(i.x),i.y=s*(this.cosc0*e-this.sinc0*t*n),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function wx(i){var e,t,n,s,o;if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,o=Et(i.x,i.y)){var r=2*Math.atan2(o,this.R2);e=Math.sin(r),t=Math.cos(r),s=Math.asin(t*this.sinc0+i.y*e*this.cosc0/o),n=Math.atan2(i.x*e,o*this.cosc0*t-i.y*this.sinc0*e)}else s=this.phic0,n=0;return i.x=n,i.y=s,Fl.inverse.apply(this,[i]),i.x=J(i.x+this.long0,this.over),i}var Ex=["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"];const xx={init:bx,forward:Cx,inverse:wx,names:Ex};function Ol(i,e,t){return e*=t,Math.tan(.5*($+i))*Math.pow((1-e)/(1+e),.5*t)}function Ix(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=K&&(this.k0=.5*(1+Ls(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=K&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=K&&Math.abs(Math.cos(this.lat_ts))>K&&(this.k0=.5*this.cons*Jt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Ot(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Jt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(Ol(this.lat0,this.sinlat0,this.e))-$,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Sx(i){var e=i.x,t=i.y,n=Math.sin(t),s=Math.cos(t),o,r,a,l,c,h,u=J(e-this.long0,this.over);return Math.abs(Math.abs(e-this.long0)-Math.PI)<=K&&Math.abs(t+this.lat0)<=K?(i.x=NaN,i.y=NaN,i):this.sphere?(o=2*this.k0/(1+this.sinlat0*n+this.coslat0*s*Math.cos(u)),i.x=this.a*o*s*Math.sin(u)+this.x0,i.y=this.a*o*(this.coslat0*n-this.sinlat0*s*Math.cos(u))+this.y0,i):(r=2*Math.atan(Ol(t,n,this.e))-$,l=Math.cos(r),a=Math.sin(r),Math.abs(this.coslat0)<=K?(c=Ot(this.e,t*this.con,this.con*n),h=2*this.a*this.k0*c/this.cons,i.x=this.x0+h*Math.sin(e-this.long0),i.y=this.y0-this.con*h*Math.cos(e-this.long0),i):(Math.abs(this.sinlat0)<K?(o=2*this.a*this.k0/(1+l*Math.cos(u)),i.y=o*a):(o=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*l*Math.cos(u))),i.y=o*(this.cosX0*a-this.sinX0*l*Math.cos(u))+this.y0),i.x=o*l*Math.sin(u)+this.x0,i))}function Mx(i){i.x-=this.x0,i.y-=this.y0;var e,t,n,s,o,r=Math.sqrt(i.x*i.x+i.y*i.y);if(this.sphere){var a=2*Math.atan(r/(2*this.a*this.k0));return e=this.long0,t=this.lat0,r<=K?(i.x=e,i.y=t,i):(t=Math.asin(Math.cos(a)*this.sinlat0+i.y*Math.sin(a)*this.coslat0/r),Math.abs(this.coslat0)<K?this.lat0>0?e=J(this.long0+Math.atan2(i.x,-1*i.y),this.over):e=J(this.long0+Math.atan2(i.x,i.y),this.over):e=J(this.long0+Math.atan2(i.x*Math.sin(a),r*this.coslat0*Math.cos(a)-i.y*this.sinlat0*Math.sin(a)),this.over),i.x=e,i.y=t,i)}else if(Math.abs(this.coslat0)<=K){if(r<=K)return t=this.lat0,e=this.long0,i.x=e,i.y=t,i;i.x*=this.con,i.y*=this.con,n=r*this.cons/(2*this.a*this.k0),t=this.con*Rs(this.e,n),e=this.con*J(this.con*this.long0+Math.atan2(i.x,-1*i.y),this.over)}else s=2*Math.atan(r*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,r<=K?o=this.X0:(o=Math.asin(Math.cos(s)*this.sinX0+i.y*Math.sin(s)*this.cosX0/r),e=J(this.long0+Math.atan2(i.x*Math.sin(s),r*this.cosX0*Math.cos(s)-i.y*this.sinX0*Math.sin(s)),this.over)),t=-1*Rs(this.e,Math.tan(.5*($+o)));return i.x=e,i.y=t,i}var Tx=["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"];const Bx={init:Ix,forward:Sx,inverse:Mx,names:Tx,ssfn_:Ol};function _x(){var i=this.lat0;this.lambda0=this.long0;var e=Math.sin(i),t=this.a,n=this.rf,s=1/n,o=2*s-Math.pow(s,2),r=this.e=Math.sqrt(o);this.R=this.k0*t*Math.sqrt(1-o)/(1-o*Math.pow(e,2)),this.alpha=Math.sqrt(1+o/(1-o)*Math.pow(Math.cos(i),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+i/2)),c=Math.log((1+r*e)/(1-r*e));this.K=a-this.alpha*l+this.alpha*r/2*c}function kx(i){var e=Math.log(Math.tan(Math.PI/4-i.y/2)),t=this.e/2*Math.log((1+this.e*Math.sin(i.y))/(1-this.e*Math.sin(i.y))),n=-this.alpha*(e+t)+this.K,s=2*(Math.atan(Math.exp(n))-Math.PI/4),o=this.alpha*(i.x-this.lambda0),r=Math.atan(Math.sin(o)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(o))),a=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(o));return i.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,i.x=this.R*r+this.x0,i}function Px(i){for(var e=i.x-this.x0,t=i.y-this.y0,n=e/this.R,s=2*(Math.atan(Math.exp(t/this.R))-Math.PI/4),o=Math.asin(Math.cos(this.b0)*Math.sin(s)+Math.sin(this.b0)*Math.cos(s)*Math.cos(n)),r=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(s))),a=this.lambda0+r/this.alpha,l=0,c=o,h=-1e3,u=0;Math.abs(c-h)>1e-7;){if(++u>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+o/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(c))/2)),h=c,c=2*Math.atan(Math.exp(l))-Math.PI/2}return i.x=a,i.y=c,i}var Dx=["somerc"];const Nx={init:_x,forward:kx,inverse:Px,names:Dx};var Fn=1e-7;function Lx(i){var e=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],t=typeof i.projName=="object"?Object.keys(i.projName)[0]:i.projName;return"no_uoff"in i||"no_off"in i||e.indexOf(t)!==-1||e.indexOf(mf(t))!==-1}function Rx(){var i,e,t,n,s,o,r,a,l,c,h=0,u,p=0,f=0,m=0,y=0,g=0,A=0;this.no_off=Lx(this),this.no_rot="no_rot"in this;var v=!1;"alpha"in this&&(v=!0);var C=!1;if("rectified_grid_angle"in this&&(C=!0),v&&(A=this.alpha),C&&(h=this.rectified_grid_angle),v||C)p=this.longc;else if(f=this.long1,y=this.lat1,m=this.long2,g=this.lat2,Math.abs(y-g)<=Fn||(i=Math.abs(y))<=Fn||Math.abs(i-$)<=Fn||Math.abs(Math.abs(this.lat0)-$)<=Fn||Math.abs(Math.abs(g)-$)<=Fn)throw new Error;var w=1-this.es;e=Math.sqrt(w),Math.abs(this.lat0)>K?(a=Math.sin(this.lat0),t=Math.cos(this.lat0),i=1-this.es*a*a,this.B=t*t,this.B=Math.sqrt(1+this.es*this.B*this.B/w),this.A=this.B*this.k0*e/i,n=this.B*e/(t*Math.sqrt(i)),s=n*n-1,s<=0?s=0:(s=Math.sqrt(s),this.lat0<0&&(s=-s)),this.E=s+=n,this.E*=Math.pow(Ot(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=s=1),v||C?(v?(u=Math.asin(Math.sin(A)/n),C||(h=A)):(u=h,A=Math.asin(n*Math.sin(u))),this.lam0=p-Math.asin(.5*(s-1/s)*Math.tan(u))/this.B):(o=Math.pow(Ot(this.e,y,Math.sin(y)),this.B),r=Math.pow(Ot(this.e,g,Math.sin(g)),this.B),s=this.E/o,l=(r-o)/(r+o),c=this.E*this.E,c=(c-r*o)/(c+r*o),i=f-m,i<-Math.PI?m-=Ds:i>Math.PI&&(m+=Ds),this.lam0=J(.5*(f+m)-Math.atan(c*Math.tan(.5*this.B*(f-m))/l)/this.B,this.over),u=Math.atan(2*Math.sin(this.B*J(f-this.lam0,this.over))/(s-1/s)),h=A=Math.asin(n*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(h),this.cosrot=Math.cos(h),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(A))),this.lat0<0&&(this.u_0=-this.u_0)),s=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(Ae-s)),this.v_pole_s=this.ArB*Math.log(Math.tan(Ae+s))}function Fx(i){var e={},t,n,s,o,r,a,l,c;if(i.x=i.x-this.lam0,Math.abs(Math.abs(i.y)-$)>K){if(r=this.E/Math.pow(Ot(this.e,i.y,Math.sin(i.y)),this.B),a=1/r,t=.5*(r-a),n=.5*(r+a),o=Math.sin(this.B*i.x),s=(t*this.singam-o*this.cosgam)/n,Math.abs(Math.abs(s)-1)<K)throw new Error;c=.5*this.ArB*Math.log((1-s)/(1+s)),a=Math.cos(this.B*i.x),Math.abs(a)<Fn?l=this.A*i.x:l=this.ArB*Math.atan2(t*this.cosgam+o*this.singam,a)}else c=i.y>0?this.v_pole_n:this.v_pole_s,l=this.ArB*i.y;return this.no_rot?(e.x=l,e.y=c):(l-=this.u_0,e.x=c*this.cosrot+l*this.sinrot,e.y=l*this.cosrot-c*this.sinrot),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function Ox(i){var e,t,n,s,o,r,a,l={};if(i.x=(i.x-this.x0)*(1/this.a),i.y=(i.y-this.y0)*(1/this.a),this.no_rot?(t=i.y,e=i.x):(t=i.x*this.cosrot-i.y*this.sinrot,e=i.y*this.cosrot+i.x*this.sinrot+this.u_0),n=Math.exp(-this.BrA*t),s=.5*(n-1/n),o=.5*(n+1/n),r=Math.sin(this.BrA*e),a=(r*this.cosgam+s*this.singam)/o,Math.abs(Math.abs(a)-1)<K)l.x=0,l.y=a<0?-$:$;else{if(l.y=this.E/Math.sqrt((1+a)/(1-a)),l.y=Rs(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(s*this.cosgam-r*this.singam,Math.cos(this.BrA*e))}return l.x+=this.lam0,l}var Gx=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"];const Ux={init:Rx,forward:Fx,inverse:Ox,names:Gx};function Vx(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<K)){var i=this.b/this.a;this.e=Math.sqrt(1-i*i);var e=Math.sin(this.lat1),t=Math.cos(this.lat1),n=Jt(this.e,e,t),s=Ot(this.e,this.lat1,e),o=Math.sin(this.lat2),r=Math.cos(this.lat2),a=Jt(this.e,o,r),l=Ot(this.e,this.lat2,o),c=Math.abs(Math.abs(this.lat0)-$)<K?0:Ot(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>K?this.ns=Math.log(n/a)/Math.log(s/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(s,this.ns)),this.rh=this.a*this.f0*Math.pow(c,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Qx(i){var e=i.x,t=i.y;Math.abs(2*Math.abs(t)-Math.PI)<=K&&(t=Ls(t)*($-2*K));var n=Math.abs(Math.abs(t)-$),s,o;if(n>K)s=Ot(this.e,t,Math.sin(t)),o=this.a*this.f0*Math.pow(s,this.ns);else{if(n=t*this.ns,n<=0)return null;o=0}var r=this.ns*J(e-this.long0,this.over);return i.x=this.k0*(o*Math.sin(r))+this.x0,i.y=this.k0*(this.rh-o*Math.cos(r))+this.y0,i}function zx(i){var e,t,n,s,o,r=(i.x-this.x0)/this.k0,a=this.rh-(i.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(r*r+a*a),t=1):(e=-Math.sqrt(r*r+a*a),t=-1);var l=0;if(e!==0&&(l=Math.atan2(t*r,t*a)),e!==0||this.ns>0){if(t=1/this.ns,n=Math.pow(e/(this.a*this.f0),t),s=Rs(this.e,n),s===-9999)return null}else s=-$;return o=J(l/this.ns+this.long0,this.over),i.x=o,i.y=s,i}var Hx=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"];const Yx={init:Vx,forward:Qx,inverse:zx,names:Hx};function $x(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function jx(i){var e,t,n,s,o,r,a,l=i.x,c=i.y,h=J(l-this.long0,this.over);return e=Math.pow((1+this.e*Math.sin(c))/(1-this.e*Math.sin(c)),this.alfa*this.e/2),t=2*(Math.atan(this.k*Math.pow(Math.tan(c/2+this.s45),this.alfa)/e)-this.s45),n=-h*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(t)+Math.sin(this.ad)*Math.cos(t)*Math.cos(n)),o=Math.asin(Math.cos(t)*Math.sin(n)/Math.cos(s)),r=this.n*o,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n),i.y=a*Math.cos(r)/1,i.x=a*Math.sin(r)/1,this.czech||(i.y*=-1,i.x*=-1),i}function Wx(i){var e,t,n,s,o,r,a,l,c=i.x;i.x=i.y,i.y=c,this.czech||(i.y*=-1,i.x*=-1),r=Math.sqrt(i.x*i.x+i.y*i.y),o=Math.atan2(i.y,i.x),s=o/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/r,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(s)),t=Math.asin(Math.cos(n)*Math.sin(s)/Math.cos(e)),i.x=this.long0-t/this.alfa,a=e,l=0;var h=0;do i.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-i.y)<1e-10&&(l=1),a=i.y,h+=1;while(l===0&&h<15);return h>=15?null:i}var qx=["Krovak","krovak"];const Kx={init:$x,forward:jx,inverse:Wx,names:qx};function mt(i,e,t,n,s){return i*s-e*Math.sin(2*s)+t*Math.sin(4*s)-n*Math.sin(6*s)}function Gs(i){return 1-.25*i*(1+i/16*(3+1.25*i))}function Us(i){return .375*i*(1+.25*i*(1+.46875*i))}function Vs(i){return .05859375*i*i*(1+.75*i)}function Qs(i){return i*i*i*(35/3072)}function Gl(i,e,t){var n=e*t;return i/Math.sqrt(1-n*n)}function Ti(i){return Math.abs(i)<$?i:i-Ls(i)*Math.PI}function pr(i,e,t,n,s){var o,r;o=i/e;for(var a=0;a<15;a++)if(r=(i-(e*o-t*Math.sin(2*o)+n*Math.sin(4*o)-s*Math.sin(6*o)))/(e-2*t*Math.cos(2*o)+4*n*Math.cos(4*o)-6*s*Math.cos(6*o)),o+=r,Math.abs(r)<=1e-10)return o;return NaN}function Xx(){this.sphere||(this.e0=Gs(this.es),this.e1=Us(this.es),this.e2=Vs(this.es),this.e3=Qs(this.es),this.ml0=this.a*mt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Jx(i){var e,t,n=i.x,s=i.y;if(n=J(n-this.long0,this.over),this.sphere)e=this.a*Math.asin(Math.cos(s)*Math.sin(n)),t=this.a*(Math.atan2(Math.tan(s),Math.cos(n))-this.lat0);else{var o=Math.sin(s),r=Math.cos(s),a=Gl(this.a,this.e,o),l=Math.tan(s)*Math.tan(s),c=n*Math.cos(s),h=c*c,u=this.es*r*r/(1-this.es),p=this.a*mt(this.e0,this.e1,this.e2,this.e3,s);e=a*c*(1-h*l*(1/6-(8-l+8*u)*h/120)),t=p-this.ml0+a*o/r*h*(.5+(5-l+6*u)*h/24)}return i.x=e+this.x0,i.y=t+this.y0,i}function Zx(i){i.x-=this.x0,i.y-=this.y0;var e=i.x/this.a,t=i.y/this.a,n,s;if(this.sphere){var o=t+this.lat0;n=Math.asin(Math.sin(o)*Math.cos(e)),s=Math.atan2(Math.tan(e),Math.cos(o))}else{var r=this.ml0/this.a+t,a=pr(r,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-$)<=K)return i.x=this.long0,i.y=$,t<0&&(i.y*=-1),i;var l=Gl(this.a,this.e,Math.sin(a)),c=l*l*l/this.a/this.a*(1-this.es),h=Math.pow(Math.tan(a),2),u=e*this.a/l,p=u*u;n=a-l*Math.tan(a)/c*u*u*(.5-(1+3*h)*u*u/24),s=u*(1-p*(h/3+(1+3*h)*h*p/15))/Math.cos(a)}return i.x=J(s+this.long0,this.over),i.y=Ti(n),i}var e2=["Cassini","Cassini_Soldner","cass"];const t2={init:Xx,forward:Jx,inverse:Zx,names:e2};function Bi(i,e){var t;return i>1e-7?(t=i*e,(1-i*i)*(e/(1-t*t)-.5/i*Math.log((1-t)/(1+t)))):2*e}var Ul=1,Vl=2,Ql=3,mr=4;function i2(){var i=Math.abs(this.lat0);if(Math.abs(i-$)<K?this.mode=this.lat0<0?Ul:Vl:Math.abs(i)<K?this.mode=Ql:this.mode=mr,this.es>0){var e;switch(this.qp=Bi(this.e,1),this.mmf=.5/(1-this.es),this.apa=h2(this.es),this.mode){case Vl:this.dd=1;break;case Ul:this.dd=1;break;case Ql:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case mr:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=Bi(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===mr&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function n2(i){var e,t,n,s,o,r,a,l,c,h,u=i.x,p=i.y;if(u=J(u-this.long0,this.over),this.sphere){if(o=Math.sin(p),h=Math.cos(p),n=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t=this.mode===this.EQUIT?1+h*n:1+this.sinph0*o+this.cosph0*h*n,t<=K)return null;t=Math.sqrt(2/t),e=t*h*Math.sin(u),t*=this.mode===this.EQUIT?o:this.cosph0*o-this.sinph0*h*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(p+this.lat0)<K)return null;t=Ae-p*.5,t=2*(this.mode===this.S_POLE?Math.cos(t):Math.sin(t)),e=t*Math.sin(u),t*=n}}else{switch(a=0,l=0,c=0,n=Math.cos(u),s=Math.sin(u),o=Math.sin(p),r=Bi(this.e,o),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(a=r/this.qp,l=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:c=1+this.sinb1*a+this.cosb1*l*n;break;case this.EQUIT:c=1+l*n;break;case this.N_POLE:c=$+p,r=this.qp-r;break;case this.S_POLE:c=p-$,r=this.qp+r;break}if(Math.abs(c)<K)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:c=Math.sqrt(2/c),this.mode===this.OBLIQ?t=this.ymf*c*(this.cosb1*a-this.sinb1*l*n):t=(c=Math.sqrt(2/(1+l*n)))*a*this.ymf,e=this.xmf*c*l*s;break;case this.N_POLE:case this.S_POLE:r>=0?(e=(c=Math.sqrt(r))*s,t=n*(this.mode===this.S_POLE?c:-c)):e=t=0;break}}return i.x=this.a*e+this.x0,i.y=this.a*t+this.y0,i}function s2(i){i.x-=this.x0,i.y-=this.y0;var e=i.x/this.a,t=i.y/this.a,n,s,o,r,a,l,c;if(this.sphere){var h=0,u,p=0;if(u=Math.sqrt(e*e+t*t),s=u*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(p=Math.sin(s),h=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(u)<=K?0:Math.asin(t*p/u),e*=p,t=h*u;break;case this.OBLIQ:s=Math.abs(u)<=K?this.lat0:Math.asin(h*this.sinph0+t*p*this.cosph0/u),e*=p*this.cosph0,t=(h-Math.sin(s)*this.sinph0)*u;break;case this.N_POLE:t=-t,s=$-s;break;case this.S_POLE:s-=$;break}n=t===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(e,t)}else{if(c=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e/=this.dd,t*=this.dd,l=Math.sqrt(e*e+t*t),l<K)return i.x=this.long0,i.y=this.lat0,i;r=2*Math.asin(.5*l/this.rq),o=Math.cos(r),e*=r=Math.sin(r),this.mode===this.OBLIQ?(c=o*this.sinb1+t*r*this.cosb1/l,a=this.qp*c,t=l*this.cosb1*o-t*this.sinb1*r):(c=t*r/l,a=this.qp*c,t=l*o)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(t=-t),a=e*e+t*t,!a)return i.x=this.long0,i.y=this.lat0,i;c=1-a/this.qp,this.mode===this.S_POLE&&(c=-c)}n=Math.atan2(e,t),s=u2(Math.asin(c),this.apa)}return i.x=J(this.long0+n,this.over),i.y=s,i}var o2=.3333333333333333,r2=.17222222222222222,a2=.10257936507936508,l2=.06388888888888888,c2=.0664021164021164,d2=.016415012942191543;function h2(i){var e,t=[];return t[0]=i*o2,e=i*i,t[0]+=e*r2,t[1]=e*l2,e*=i,t[0]+=e*a2,t[1]+=e*c2,t[2]=e*d2,t}function u2(i,e){var t=i+i;return i+e[0]*Math.sin(t)+e[1]*Math.sin(t+t)+e[2]*Math.sin(t+t+t)}var f2=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"];const p2={init:i2,forward:n2,inverse:s2,names:f2,S_POLE:Ul,N_POLE:Vl,EQUIT:Ql,OBLIQ:mr};function _i(i){return Math.abs(i)>1&&(i=i>1?1:-1),Math.asin(i)}function m2(){Math.abs(this.lat1+this.lat2)<K||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Jt(this.e3,this.sin_po,this.cos_po),this.qs1=Bi(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Jt(this.e3,this.sin_po,this.cos_po),this.qs2=Bi(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Bi(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>K?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function g2(i){var e=i.x,t=i.y;this.sin_phi=Math.sin(t),this.cos_phi=Math.cos(t);var n=Bi(this.e3,this.sin_phi),s=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,o=this.ns0*J(e-this.long0,this.over),r=s*Math.sin(o)+this.x0,a=this.rh-s*Math.cos(o)+this.y0;return i.x=r,i.y=a,i}function y2(i){var e,t,n,s,o,r;return i.x-=this.x0,i.y=this.rh-i.y+this.y0,this.ns0>=0?(e=Math.sqrt(i.x*i.x+i.y*i.y),n=1):(e=-Math.sqrt(i.x*i.x+i.y*i.y),n=-1),s=0,e!==0&&(s=Math.atan2(n*i.x,n*i.y)),n=e*this.ns0/this.a,this.sphere?r=Math.asin((this.c-n*n)/(2*this.ns0)):(t=(this.c-n*n)/this.ns0,r=this.phi1z(this.e3,t)),o=J(s/this.ns0+this.long0,this.over),i.x=o,i.y=r,i}function A2(i,e){var t,n,s,o,r,a=_i(.5*e);if(i<K)return a;for(var l=i*i,c=1;c<=25;c++)if(t=Math.sin(a),n=Math.cos(a),s=i*t,o=1-s*s,r=.5*o*o/n*(e/(1-l)-t/o+.5/i*Math.log((1-s)/(1+s))),a=a+r,Math.abs(r)<=1e-7)return a;return null}var v2=["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"];const b2={init:m2,forward:g2,inverse:y2,names:v2,phi1z:A2};function C2(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function w2(i){var e,t,n,s,o,r,a,l,c=i.x,h=i.y;return n=J(c-this.long0,this.over),e=Math.sin(h),t=Math.cos(h),s=Math.cos(n),r=this.sin_p14*e+this.cos_p14*t*s,o=1,r>0||Math.abs(r)<=K?(a=this.x0+this.a*o*t*Math.sin(n)/r,l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*t*s)/r):(a=this.x0+this.infinity_dist*t*Math.sin(n),l=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*t*s)),i.x=a,i.y=l,i}function E2(i){var e,t,n,s,o,r;return i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,(e=Math.sqrt(i.x*i.x+i.y*i.y))?(s=Math.atan2(e,this.rc),t=Math.sin(s),n=Math.cos(s),r=_i(n*this.sin_p14+i.y*t*this.cos_p14/e),o=Math.atan2(i.x*t,e*this.cos_p14*n-i.y*this.sin_p14*t),o=J(this.long0+o,this.over)):(r=this.phic0,o=0),i.x=o,i.y=r,i}var x2=["gnom"];const I2={init:C2,forward:w2,inverse:E2,names:x2};function S2(i,e){var t=1-(1-i*i)/(2*i)*Math.log((1-i)/(1+i));if(Math.abs(Math.abs(e)-t)<1e-6)return e<0?-1*$:$;for(var n=Math.asin(.5*e),s,o,r,a,l=0;l<30;l++)if(o=Math.sin(n),r=Math.cos(n),a=i*o,s=Math.pow(1-a*a,2)/(2*r)*(e/(1-i*i)-o/(1-a*a)+.5/i*Math.log((1-a)/(1+a))),n+=s,Math.abs(s)<=1e-10)return n;return NaN}function M2(){this.sphere||(this.k0=Jt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function T2(i){var e=i.x,t=i.y,n,s,o=J(e-this.long0,this.over);if(this.sphere)n=this.x0+this.a*o*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(t)/Math.cos(this.lat_ts);else{var r=Bi(this.e,Math.sin(t));n=this.x0+this.a*this.k0*o,s=this.y0+this.a*r*.5/this.k0}return i.x=n,i.y=s,i}function B2(i){i.x-=this.x0,i.y-=this.y0;var e,t;return this.sphere?(e=J(this.long0+i.x/this.a/Math.cos(this.lat_ts),this.over),t=Math.asin(i.y/this.a*Math.cos(this.lat_ts))):(t=S2(this.e,2*i.y*this.k0/this.a),e=J(this.long0+i.x/(this.a*this.k0),this.over)),i.x=e,i.y=t,i}var _2=["cea"];const k2={init:M2,forward:T2,inverse:B2,names:_2};function P2(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function D2(i){var e=i.x,t=i.y,n=J(e-this.long0,this.over),s=Ti(t-this.lat0);return i.x=this.x0+this.a*n*this.rc,i.y=this.y0+this.a*s,i}function N2(i){var e=i.x,t=i.y;return i.x=J(this.long0+(e-this.x0)/(this.a*this.rc),this.over),i.y=Ti(this.lat0+(t-this.y0)/this.a),i}var L2=["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"];const R2={init:P2,forward:D2,inverse:N2,names:L2};var Gf=20;function F2(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Gs(this.es),this.e1=Us(this.es),this.e2=Vs(this.es),this.e3=Qs(this.es),this.ml0=this.a*mt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function O2(i){var e=i.x,t=i.y,n,s,o,r=J(e-this.long0,this.over);if(o=r*Math.sin(t),this.sphere)Math.abs(t)<=K?(n=this.a*r,s=-1*this.a*this.lat0):(n=this.a*Math.sin(o)/Math.tan(t),s=this.a*(Ti(t-this.lat0)+(1-Math.cos(o))/Math.tan(t)));else if(Math.abs(t)<=K)n=this.a*r,s=-1*this.ml0;else{var a=Gl(this.a,this.e,Math.sin(t))/Math.tan(t);n=a*Math.sin(o),s=this.a*mt(this.e0,this.e1,this.e2,this.e3,t)-this.ml0+a*(1-Math.cos(o))}return i.x=n+this.x0,i.y=s+this.y0,i}function G2(i){var e,t,n,s,o,r,a,l,c;if(n=i.x-this.x0,s=i.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=K)e=J(n/this.a+this.long0,this.over),t=0;else{r=this.lat0+s/this.a,a=n*n/this.a/this.a+r*r,l=r;var h;for(o=Gf;o;--o)if(h=Math.tan(l),c=-1*(r*(l*h+1)-l-.5*(l*l+a)*h)/((l-r)/h-1),l+=c,Math.abs(c)<=K){t=l;break}e=J(this.long0+Math.asin(n*Math.tan(l)/this.a)/Math.sin(t),this.over)}else if(Math.abs(s+this.ml0)<=K)t=0,e=J(this.long0+n/this.a,this.over);else{r=(this.ml0+s)/this.a,a=n*n/this.a/this.a+r*r,l=r;var u,p,f,m,y;for(o=Gf;o;--o)if(y=this.e*Math.sin(l),u=Math.sqrt(1-y*y)*Math.tan(l),p=this.a*mt(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),m=p/this.a,c=(r*(u*m+1)-m-.5*u*(m*m+a))/(this.es*Math.sin(2*l)*(m*m+a-2*r*m)/(4*u)+(r-m)*(u*f-2/Math.sin(2*l))-f),l-=c,Math.abs(c)<=K){t=l;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(t),2))*Math.tan(t),e=J(this.long0+Math.asin(n*u/this.a)/Math.sin(t),this.over)}return i.x=e,i.y=t,i}var U2=["Polyconic","American_Polyconic","poly"];const V2={init:F2,forward:O2,inverse:G2,names:U2};function Q2(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function z2(i){var e,t=i.x,n=i.y,s=n-this.lat0,o=t-this.long0,r=s/Ps*1e-5,a=o,l=1,c=0;for(e=1;e<=10;e++)l=l*r,c=c+this.A[e]*l;var h=c,u=a,p=1,f=0,m,y,g=0,A=0;for(e=1;e<=6;e++)m=p*h-f*u,y=f*h+p*u,p=m,f=y,g=g+this.B_re[e]*p-this.B_im[e]*f,A=A+this.B_im[e]*p+this.B_re[e]*f;return i.x=A*this.a+this.x0,i.y=g*this.a+this.y0,i}function H2(i){var e,t=i.x,n=i.y,s=t-this.x0,o=n-this.y0,r=o/this.a,a=s/this.a,l=1,c=0,h,u,p=0,f=0;for(e=1;e<=6;e++)h=l*r-c*a,u=c*r+l*a,l=h,c=u,p=p+this.C_re[e]*l-this.C_im[e]*c,f=f+this.C_im[e]*l+this.C_re[e]*c;for(var m=0;m<this.iterations;m++){var y=p,g=f,A,v,C=r,w=a;for(e=2;e<=6;e++)A=y*p-g*f,v=g*p+y*f,y=A,g=v,C=C+(e-1)*(this.B_re[e]*y-this.B_im[e]*g),w=w+(e-1)*(this.B_im[e]*y+this.B_re[e]*g);y=1,g=0;var M=this.B_re[1],x=this.B_im[1];for(e=2;e<=6;e++)A=y*p-g*f,v=g*p+y*f,y=A,g=v,M=M+e*(this.B_re[e]*y-this.B_im[e]*g),x=x+e*(this.B_im[e]*y+this.B_re[e]*g);var I=M*M+x*x;p=(C*M+w*x)/I,f=(w*M-C*x)/I}var S=p,R=f,b=1,B=0;for(e=1;e<=9;e++)b=b*S,B=B+this.D[e]*b;var L=this.lat0+B*Ps*1e5,O=this.long0+R;return i.x=O,i.y=L,i}var Y2=["New_Zealand_Map_Grid","nzmg"];const $2={init:Q2,forward:z2,inverse:H2,names:Y2};function j2(){}function W2(i){var e=i.x,t=i.y,n=J(e-this.long0,this.over),s=this.x0+this.a*n,o=this.y0+this.a*Math.log(Math.tan(Math.PI/4+t/2.5))*1.25;return i.x=s,i.y=o,i}function q2(i){i.x-=this.x0,i.y-=this.y0;var e=J(this.long0+i.x/this.a,this.over),t=2.5*(Math.atan(Math.exp(.8*i.y/this.a))-Math.PI/4);return i.x=e,i.y=t,i}var K2=["Miller_Cylindrical","mill"];const X2={init:j2,forward:W2,inverse:q2,names:K2};var J2=20;function Z2(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Dl(this.es)}function eI(i){var e,t,n=i.x,s=i.y;if(n=J(n-this.long0,this.over),this.sphere){if(!this.m)s=this.n!==1?Math.asin(this.n*Math.sin(s)):s;else for(var o=this.n*Math.sin(s),r=J2;r;--r){var a=(this.m*s+Math.sin(s)-o)/(this.m+Math.cos(s));if(s-=a,Math.abs(a)<K)break}e=this.a*this.C_x*n*(this.m+Math.cos(s)),t=this.a*this.C_y*s}else{var l=Math.sin(s),c=Math.cos(s);t=this.a*Rn(s,l,c,this.en),e=this.a*n*c/Math.sqrt(1-this.es*l*l)}return i.x=e,i.y=t,i}function tI(i){var e,t,n,s;return i.x-=this.x0,n=i.x/this.a,i.y-=this.y0,e=i.y/this.a,this.sphere?(e/=this.C_y,n=n/(this.C_x*(this.m+Math.cos(e))),this.m?e=_i((this.m*e+Math.sin(e))/this.n):this.n!==1&&(e=_i(Math.sin(e)/this.n)),n=J(n+this.long0,this.over),e=Ti(e)):(e=Nl(i.y/this.a,this.es,this.en),s=Math.abs(e),s<$?(s=Math.sin(e),t=this.long0+i.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(e)),n=J(t,this.over)):s-K<$&&(n=this.long0)),i.x=n,i.y=e,i}var iI=["Sinusoidal","sinu"];const nI={init:Z2,forward:eI,inverse:tI,names:iI};function sI(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0}function oI(i){for(var e=i.x,t=i.y,n=J(e-this.long0,this.over),s=t,o=Math.PI*Math.sin(t);;){var r=-(s+Math.sin(s)-o)/(1+Math.cos(s));if(s+=r,Math.abs(r)<K)break}s/=2,Math.PI/2-Math.abs(t)<K&&(n=0);var a=.900316316158*this.a*n*Math.cos(s)+this.x0,l=1.4142135623731*this.a*Math.sin(s)+this.y0;return i.x=a,i.y=l,i}function rI(i){var e,t;i.x-=this.x0,i.y-=this.y0,t=i.y/(1.4142135623731*this.a),Math.abs(t)>.999999999999&&(t=.999999999999),e=Math.asin(t);var n=J(this.long0+i.x/(.900316316158*this.a*Math.cos(e)),this.over);n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),t=(2*e+Math.sin(2*e))/Math.PI,Math.abs(t)>1&&(t=1);var s=Math.asin(t);return i.x=n,i.y=s,i}var aI=["Mollweide","moll"];const lI={init:sI,forward:oI,inverse:rI,names:aI};function cI(){Math.abs(this.lat1+this.lat2)<K||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Gs(this.es),this.e1=Us(this.es),this.e2=Vs(this.es),this.e3=Qs(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Jt(this.e,this.sin_phi,this.cos_phi),this.ml1=mt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<K?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Jt(this.e,this.sin_phi,this.cos_phi),this.ml2=mt(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=mt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function dI(i){var e=i.x,t=i.y,n;if(this.sphere)n=this.a*(this.g-t);else{var s=mt(this.e0,this.e1,this.e2,this.e3,t);n=this.a*(this.g-s)}var o=this.ns*J(e-this.long0,this.over),r=this.x0+n*Math.sin(o),a=this.y0+this.rh-n*Math.cos(o);return i.x=r,i.y=a,i}function hI(i){i.x-=this.x0,i.y=this.rh-i.y+this.y0;var e,t,n,s;this.ns>=0?(t=Math.sqrt(i.x*i.x+i.y*i.y),e=1):(t=-Math.sqrt(i.x*i.x+i.y*i.y),e=-1);var o=0;if(t!==0&&(o=Math.atan2(e*i.x,e*i.y)),this.sphere)return s=J(this.long0+o/this.ns,this.over),n=Ti(this.g-t/this.a),i.x=s,i.y=n,i;var r=this.g-t/this.a;return n=pr(r,this.e0,this.e1,this.e2,this.e3),s=J(this.long0+o/this.ns,this.over),i.x=s,i.y=n,i}var uI=["Equidistant_Conic","eqdc"];const fI={init:cI,forward:dI,inverse:hI,names:uI};function pI(){this.R=this.a}function mI(i){var e=i.x,t=i.y,n=J(e-this.long0,this.over),s,o;Math.abs(t)<=K&&(s=this.x0+this.R*n,o=this.y0);var r=_i(2*Math.abs(t/Math.PI));(Math.abs(n)<=K||Math.abs(Math.abs(t)-$)<=K)&&(s=this.x0,t>=0?o=this.y0+Math.PI*this.R*Math.tan(.5*r):o=this.y0+Math.PI*this.R*-Math.tan(.5*r));var a=.5*Math.abs(Math.PI/n-n/Math.PI),l=a*a,c=Math.sin(r),h=Math.cos(r),u=h/(c+h-1),p=u*u,f=u*(2/c-1),m=f*f,y=Math.PI*this.R*(a*(u-m)+Math.sqrt(l*(u-m)*(u-m)-(m+l)*(p-m)))/(m+l);n<0&&(y=-y),s=this.x0+y;var g=l+u;return y=Math.PI*this.R*(f*g-a*Math.sqrt((m+l)*(l+1)-g*g))/(m+l),t>=0?o=this.y0+y:o=this.y0-y,i.x=s,i.y=o,i}function gI(i){var e,t,n,s,o,r,a,l,c,h,u,p,f;return i.x-=this.x0,i.y-=this.y0,u=Math.PI*this.R,n=i.x/u,s=i.y/u,o=n*n+s*s,r=-Math.abs(s)*(1+o),a=r-2*s*s+n*n,l=-2*r+1+2*s*s+o*o,f=s*s/l+(2*a*a*a/l/l/l-9*r*a/l/l)/27,c=(r-a*a/3/l)/l,h=2*Math.sqrt(-c/3),u=3*f/c/h,Math.abs(u)>1&&(u>=0?u=1:u=-1),p=Math.acos(u)/3,i.y>=0?t=(-h*Math.cos(p+Math.PI/3)-a/3/l)*Math.PI:t=-(-h*Math.cos(p+Math.PI/3)-a/3/l)*Math.PI,Math.abs(n)<K?e=this.long0:e=J(this.long0+Math.PI*(o-1+Math.sqrt(1+2*(n*n-s*s)+o*o))/2/n,this.over),i.x=e,i.y=t,i}var yI=["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"];const AI={init:pI,forward:mI,inverse:gI,names:yI};function vI(i,e,t,n,s,o){const r=n-e,a=Math.atan((1-o)*Math.tan(i)),l=Math.atan((1-o)*Math.tan(t)),c=Math.sin(a),h=Math.cos(a),u=Math.sin(l),p=Math.cos(l);let f=r,m,y=100,g,A,v,C,w,M,x,I,S,R,b,B,L,O;do{if(g=Math.sin(f),A=Math.cos(f),v=Math.sqrt(p*g*(p*g)+(h*u-c*p*A)*(h*u-c*p*A)),v===0)return{azi1:0,s12:0};C=c*u+h*p*A,w=Math.atan2(v,C),M=h*p*g/v,x=1-M*M,I=x!==0?C-2*c*u/x:0,S=o/16*x*(4+o*(4-3*x)),m=f,f=r+(1-S)*o*M*(w+S*v*(I+S*C*(-1+2*I*I)))}while(Math.abs(f-m)>1e-12&&--y>0);return y===0?{azi1:NaN,s12:NaN}:(R=x*(s*s-s*(1-o)*(s*(1-o)))/(s*(1-o)*(s*(1-o))),b=1+R/16384*(4096+R*(-768+R*(320-175*R))),B=R/1024*(256+R*(-128+R*(74-47*R))),L=B*v*(I+B/4*(C*(-1+2*I*I)-B/6*I*(-3+4*v*v)*(-3+4*I*I))),O=s*(1-o)*b*(w-L),{azi1:Math.atan2(p*g,h*u-c*p*A),s12:O})}function bI(i,e,t,n,s,o){const r=Math.atan((1-o)*Math.tan(i)),a=Math.sin(r),l=Math.cos(r),c=Math.sin(t),h=Math.cos(t),u=Math.atan2(a,l*h),p=l*c,f=1-p*p,m=f*(s*s-s*(1-o)*(s*(1-o)))/(s*(1-o)*(s*(1-o))),y=1+m/16384*(4096+m*(-768+m*(320-175*m))),g=m/1024*(256+m*(-128+m*(74-47*m)));let A=n/(s*(1-o)*y),v,C=100,w,M,x,I;do w=Math.cos(2*u+A),M=Math.sin(A),x=Math.cos(A),I=g*M*(w+g/4*(x*(-1+2*w*w)-g/6*w*(-3+4*M*M)*(-3+4*w*w))),v=A,A=n/(s*(1-o)*y)+I;while(Math.abs(A-v)>1e-12&&--C>0);if(C===0)return{lat2:NaN,lon2:NaN};const S=a*M-l*x*h,R=Math.atan2(a*x+l*M*h,(1-o)*Math.sqrt(p*p+S*S)),b=Math.atan2(M*c,l*x-a*M*h),B=o/16*f*(4+o*(4-3*f)),L=b-(1-B)*o*p*(A+B*M*(w+B*x*(-1+2*w*w))),O=e+L;return{lat2:R,lon2:O}}function CI(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es))}function wI(i){var e=i.x,t=i.y,n=Math.sin(i.y),s=Math.cos(i.y),o=J(e-this.long0,this.over),r,a,l,c,h,u,p,f,m,y,g;return this.sphere?Math.abs(this.sin_p12-1)<=K?(i.x=this.x0+this.a*($-t)*Math.sin(o),i.y=this.y0-this.a*($-t)*Math.cos(o),i):Math.abs(this.sin_p12+1)<=K?(i.x=this.x0+this.a*($+t)*Math.sin(o),i.y=this.y0+this.a*($+t)*Math.cos(o),i):(m=this.sin_p12*n+this.cos_p12*s*Math.cos(o),p=Math.acos(m),f=p?p/Math.sin(p):1,i.x=this.x0+this.a*f*s*Math.sin(o),i.y=this.y0+this.a*f*(this.cos_p12*n-this.sin_p12*s*Math.cos(o)),i):(r=Gs(this.es),a=Us(this.es),l=Vs(this.es),c=Qs(this.es),Math.abs(this.sin_p12-1)<=K?(h=this.a*mt(r,a,l,c,$),u=this.a*mt(r,a,l,c,t),i.x=this.x0+(h-u)*Math.sin(o),i.y=this.y0-(h-u)*Math.cos(o),i):Math.abs(this.sin_p12+1)<=K?(h=this.a*mt(r,a,l,c,$),u=this.a*mt(r,a,l,c,t),i.x=this.x0+(h+u)*Math.sin(o),i.y=this.y0+(h+u)*Math.cos(o),i):Math.abs(e)<K&&Math.abs(t-this.lat0)<K?(i.x=i.y=0,i):(y=vI(this.lat0,this.long0,t,e,this.a,this.f),g=y.azi1,i.x=y.s12*Math.sin(g),i.y=y.s12*Math.cos(g),i))}function EI(i){i.x-=this.x0,i.y-=this.y0;var e,t,n,s,o,r,a,l,c,h,u,p,f,m,y,g;return this.sphere?(e=Math.sqrt(i.x*i.x+i.y*i.y),e>2*$*this.a?void 0:(t=e/this.a,n=Math.sin(t),s=Math.cos(t),o=this.long0,Math.abs(e)<=K?r=this.lat0:(r=_i(s*this.sin_p12+i.y*n*this.cos_p12/e),a=Math.abs(this.lat0)-$,Math.abs(a)<=K?this.lat0>=0?o=J(this.long0+Math.atan2(i.x,-i.y),this.over):o=J(this.long0-Math.atan2(-i.x,i.y),this.over):o=J(this.long0+Math.atan2(i.x*n,e*this.cos_p12*s-i.y*this.sin_p12*n),this.over)),i.x=o,i.y=r,i)):(l=Gs(this.es),c=Us(this.es),h=Vs(this.es),u=Qs(this.es),Math.abs(this.sin_p12-1)<=K?(p=this.a*mt(l,c,h,u,$),e=Math.sqrt(i.x*i.x+i.y*i.y),f=p-e,r=pr(f/this.a,l,c,h,u),o=J(this.long0+Math.atan2(i.x,-1*i.y),this.over),i.x=o,i.y=r,i):Math.abs(this.sin_p12+1)<=K?(p=this.a*mt(l,c,h,u,$),e=Math.sqrt(i.x*i.x+i.y*i.y),f=e-p,r=pr(f/this.a,l,c,h,u),o=J(this.long0+Math.atan2(i.x,i.y),this.over),i.x=o,i.y=r,i):(m=Math.atan2(i.x,i.y),y=Math.sqrt(i.x*i.x+i.y*i.y),g=bI(this.lat0,this.long0,m,y,this.a,this.f),i.x=g.lon2,i.y=g.lat2,i))}var xI=["Azimuthal_Equidistant","aeqd"];const II={init:CI,forward:wI,inverse:EI,names:xI};function SI(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function MI(i){var e,t,n,s,o,r,a,l,c=i.x,h=i.y;return n=J(c-this.long0,this.over),e=Math.sin(h),t=Math.cos(h),s=Math.cos(n),r=this.sin_p14*e+this.cos_p14*t*s,o=1,(r>0||Math.abs(r)<=K)&&(a=this.a*o*t*Math.sin(n),l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*t*s)),i.x=a,i.y=l,i}function TI(i){var e,t,n,s,o,r,a;return i.x-=this.x0,i.y-=this.y0,e=Math.sqrt(i.x*i.x+i.y*i.y),t=_i(e/this.a),n=Math.sin(t),s=Math.cos(t),r=this.long0,Math.abs(e)<=K?(a=this.lat0,i.x=r,i.y=a,i):(a=_i(s*this.sin_p14+i.y*n*this.cos_p14/e),o=Math.abs(this.lat0)-$,Math.abs(o)<=K?(this.lat0>=0?r=J(this.long0+Math.atan2(i.x,-i.y),this.over):r=J(this.long0-Math.atan2(-i.x,i.y),this.over),i.x=r,i.y=a,i):(r=J(this.long0+Math.atan2(i.x*n,e*this.cos_p14*s-i.y*this.sin_p14*n),this.over),i.x=r,i.y=a,i))}var BI=["ortho"];const _I={init:SI,forward:MI,inverse:TI,names:BI};var De={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},ve={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function kI(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=$-Ae/2?this.face=De.TOP:this.lat0<=-($-Ae/2)?this.face=De.BOTTOM:Math.abs(this.long0)<=Ae?this.face=De.FRONT:Math.abs(this.long0)<=$+Ae?this.face=this.long0>0?De.RIGHT:De.LEFT:this.face=De.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function PI(i){var e={x:0,y:0},t,n,s,o,r,a,l={value:0};if(i.x-=this.long0,this.es!==0?t=Math.atan(this.one_minus_f_squared*Math.tan(i.y)):t=i.y,n=i.x,this.face===De.TOP)o=$-t,n>=Ae&&n<=$+Ae?(l.value=ve.AREA_0,s=n-$):n>$+Ae||n<=-($+Ae)?(l.value=ve.AREA_1,s=n>0?n-Ge:n+Ge):n>-($+Ae)&&n<=-Ae?(l.value=ve.AREA_2,s=n+$):(l.value=ve.AREA_3,s=n);else if(this.face===De.BOTTOM)o=$+t,n>=Ae&&n<=$+Ae?(l.value=ve.AREA_0,s=-n+$):n<Ae&&n>=-Ae?(l.value=ve.AREA_1,s=-n):n<-Ae&&n>=-($+Ae)?(l.value=ve.AREA_2,s=-n-$):(l.value=ve.AREA_3,s=n>0?-n+Ge:-n-Ge);else{var c,h,u,p,f,m,y;this.face===De.RIGHT?n=On(n,+$):this.face===De.BACK?n=On(n,+Ge):this.face===De.LEFT&&(n=On(n,-$)),p=Math.sin(t),f=Math.cos(t),m=Math.sin(n),y=Math.cos(n),c=f*y,h=f*m,u=p,this.face===De.FRONT?(o=Math.acos(c),s=gr(o,u,h,l)):this.face===De.RIGHT?(o=Math.acos(h),s=gr(o,u,-c,l)):this.face===De.BACK?(o=Math.acos(-c),s=gr(o,u,-h,l)):this.face===De.LEFT?(o=Math.acos(-h),s=gr(o,u,c,l)):(o=s=0,l.value=ve.AREA_0)}return a=Math.atan(12/Ge*(s+Math.acos(Math.sin(s)*Math.cos(Ae))-$)),r=Math.sqrt((1-Math.cos(o))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(s))))),l.value===ve.AREA_1?a+=$:l.value===ve.AREA_2?a+=Ge:l.value===ve.AREA_3&&(a+=1.5*Ge),e.x=r*Math.cos(a),e.y=r*Math.sin(a),e.x=e.x*this.a+this.x0,e.y=e.y*this.a+this.y0,i.x=e.x,i.y=e.y,i}function DI(i){var e={lam:0,phi:0},t,n,s,o,r,a,l,c,h,u={value:0};if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,n=Math.atan(Math.sqrt(i.x*i.x+i.y*i.y)),t=Math.atan2(i.y,i.x),i.x>=0&&i.x>=Math.abs(i.y)?u.value=ve.AREA_0:i.y>=0&&i.y>=Math.abs(i.x)?(u.value=ve.AREA_1,t-=$):i.x<0&&-i.x>=Math.abs(i.y)?(u.value=ve.AREA_2,t=t<0?t+Ge:t-Ge):(u.value=ve.AREA_3,t+=$),h=Ge/12*Math.tan(t),r=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),a=Math.atan(r),s=Math.cos(t),o=Math.tan(n),l=1-s*s*o*o*(1-Math.cos(Math.atan(1/Math.cos(a)))),l<-1?l=-1:l>1&&(l=1),this.face===De.TOP)c=Math.acos(l),e.phi=$-c,u.value===ve.AREA_0?e.lam=a+$:u.value===ve.AREA_1?e.lam=a<0?a+Ge:a-Ge:u.value===ve.AREA_2?e.lam=a-$:e.lam=a;else if(this.face===De.BOTTOM)c=Math.acos(l),e.phi=c-$,u.value===ve.AREA_0?e.lam=-a+$:u.value===ve.AREA_1?e.lam=-a:u.value===ve.AREA_2?e.lam=-a-$:e.lam=a<0?-a-Ge:-a+Ge;else{var p,f,m;p=l,h=p*p,h>=1?m=0:m=Math.sqrt(1-h)*Math.sin(a),h+=m*m,h>=1?f=0:f=Math.sqrt(1-h),u.value===ve.AREA_1?(h=f,f=-m,m=h):u.value===ve.AREA_2?(f=-f,m=-m):u.value===ve.AREA_3&&(h=f,f=m,m=-h),this.face===De.RIGHT?(h=p,p=-f,f=h):this.face===De.BACK?(p=-p,f=-f):this.face===De.LEFT&&(h=p,p=f,f=-h),e.phi=Math.acos(-m)-$,e.lam=Math.atan2(f,p),this.face===De.RIGHT?e.lam=On(e.lam,-$):this.face===De.BACK?e.lam=On(e.lam,-Ge):this.face===De.LEFT&&(e.lam=On(e.lam,+$))}if(this.es!==0){var y,g,A;y=e.phi<0?1:0,g=Math.tan(e.phi),A=this.b/Math.sqrt(g*g+this.one_minus_f_squared),e.phi=Math.atan(Math.sqrt(this.a*this.a-A*A)/(this.one_minus_f*A)),y&&(e.phi=-e.phi)}return e.lam+=this.long0,i.x=e.lam,i.y=e.phi,i}function gr(i,e,t,n){var s;return i<K?(n.value=ve.AREA_0,s=0):(s=Math.atan2(e,t),Math.abs(s)<=Ae?n.value=ve.AREA_0:s>Ae&&s<=$+Ae?(n.value=ve.AREA_1,s-=$):s>$+Ae||s<=-($+Ae)?(n.value=ve.AREA_2,s=s>=0?s-Ge:s+Ge):(n.value=ve.AREA_3,s+=$)),s}function On(i,e){var t=i+e;return t<-Ge?t+=Ds:t>+Ge&&(t-=Ds),t}var NI=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"];const LI={init:kI,forward:PI,inverse:DI,names:NI};var zl=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],zs=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Uf=.8487,Vf=1.3523,Qf=bt/5,RI=1/Qf,Gn=18,yr=function(i,e){return i[0]+e*(i[1]+e*(i[2]+e*i[3]))},FI=function(i,e){return i[1]+e*(2*i[2]+e*3*i[3])};function OI(i,e,t,n){for(var s=e;n;--n){var o=i(s);if(s-=o,Math.abs(o)<t)break}return s}function GI(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function UI(i){var e=J(i.x-this.long0,this.over),t=Math.abs(i.y),n=Math.floor(t*Qf);n<0?n=0:n>=Gn&&(n=Gn-1),t=bt*(t-RI*n);var s={x:yr(zl[n],t)*e,y:yr(zs[n],t)};return i.y<0&&(s.y=-s.y),s.x=s.x*this.a*Uf+this.x0,s.y=s.y*this.a*Vf+this.y0,s}function VI(i){var e={x:(i.x-this.x0)/(this.a*Uf),y:Math.abs(i.y-this.y0)/(this.a*Vf)};if(e.y>=1)e.x/=zl[Gn][0],e.y=i.y<0?-$:$;else{var t=Math.floor(e.y*Gn);for(t<0?t=0:t>=Gn&&(t=Gn-1);;)if(zs[t][0]>e.y)--t;else if(zs[t+1][0]<=e.y)++t;else break;var n=zs[t],s=5*(e.y-n[0])/(zs[t+1][0]-n[0]);s=OI(function(o){return(yr(n,o)-e.y)/FI(n,o)},s,K,100),e.x/=yr(zl[t],s),e.y=(5*t+s)*Oe,i.y<0&&(e.y=-e.y)}return e.x=J(e.x+this.long0,this.over),e}var QI=["Robinson","robin"];const zI={init:GI,forward:UI,inverse:VI,names:QI};function HI(){this.name="geocent"}function YI(i){var e=Af(i,this.es,this.a);return e}function $I(i){var e=vf(i,this.es,this.a,this.b);return e}var jI=["Geocentric","geocentric","geocent","Geocent"];const WI={init:HI,forward:YI,inverse:$I,names:jI};var dt={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Hs={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function qI(){if(Object.keys(Hs).forEach((function(t){if(typeof this[t]>"u")this[t]=Hs[t].def;else{if(Hs[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);Hs[t].num&&(this[t]=parseFloat(this[t]))}Hs[t].degrees&&(this[t]=this[t]*Oe)}).bind(this)),Math.abs(Math.abs(this.lat0)-$)<K?this.mode=this.lat0<0?dt.S_POLE:dt.N_POLE:Math.abs(this.lat0)<K?this.mode=dt.EQUIT:(this.mode=dt.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var i=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(i),this.sw=Math.sin(i)}function KI(i){i.x-=this.long0;var e=Math.sin(i.y),t=Math.cos(i.y),n=Math.cos(i.x),s,o;switch(this.mode){case dt.OBLIQ:o=this.sinph0*e+this.cosph0*t*n;break;case dt.EQUIT:o=t*n;break;case dt.S_POLE:o=-e;break;case dt.N_POLE:o=e;break}switch(o=this.pn1/(this.p-o),s=o*t*Math.sin(i.x),this.mode){case dt.OBLIQ:o*=this.cosph0*e-this.sinph0*t*n;break;case dt.EQUIT:o*=e;break;case dt.N_POLE:o*=-(t*n);break;case dt.S_POLE:o*=t*n;break}var r,a;return r=o*this.cg+s*this.sg,a=1/(r*this.sw*this.h1+this.cw),s=(s*this.cg-o*this.sg)*this.cw*a,o=r*a,i.x=s*this.a,i.y=o*this.a,i}function XI(i){i.x/=this.a,i.y/=this.a;var e={x:i.x,y:i.y},t,n,s;s=1/(this.pn1-i.y*this.sw),t=this.pn1*i.x*s,n=this.pn1*i.y*this.cw*s,i.x=t*this.cg+n*this.sg,i.y=n*this.cg-t*this.sg;var o=Et(i.x,i.y);if(Math.abs(o)<K)e.x=0,e.y=i.y;else{var r,a;switch(a=1-o*o*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/o+o/this.pn1),r=Math.sqrt(1-a*a),this.mode){case dt.OBLIQ:e.y=Math.asin(r*this.sinph0+i.y*a*this.cosph0/o),i.y=(r-this.sinph0*Math.sin(e.y))*o,i.x*=a*this.cosph0;break;case dt.EQUIT:e.y=Math.asin(i.y*a/o),i.y=r*o,i.x*=a;break;case dt.N_POLE:e.y=Math.asin(r),i.y=-i.y;break;case dt.S_POLE:e.y=-Math.asin(r);break}e.x=Math.atan2(i.x,i.y)}return i.x=e.x+this.long0,i.y=e.y,i}var JI=["Tilted_Perspective","tpers"];const ZI={init:qI,forward:KI,inverse:XI,names:JI};function eS(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var i=1-this.es,e=1/i;this.radius_p=Math.sqrt(i),this.radius_p2=i,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function tS(i){var e=i.x,t=i.y,n,s,o,r;if(e=e-this.long0,this.shape==="ellipse"){t=Math.atan(this.radius_p2*Math.tan(t));var a=this.radius_p/Et(this.radius_p*Math.cos(t),Math.sin(t));if(s=a*Math.cos(e)*Math.cos(t),o=a*Math.sin(e)*Math.cos(t),r=a*Math.sin(t),(this.radius_g-s)*s-o*o-r*r*this.radius_p_inv2<0)return i.x=Number.NaN,i.y=Number.NaN,i;n=this.radius_g-s,this.flip_axis?(i.x=this.radius_g_1*Math.atan(o/Et(r,n)),i.y=this.radius_g_1*Math.atan(r/n)):(i.x=this.radius_g_1*Math.atan(o/n),i.y=this.radius_g_1*Math.atan(r/Et(o,n)))}else this.shape==="sphere"&&(n=Math.cos(t),s=Math.cos(e)*n,o=Math.sin(e)*n,r=Math.sin(t),n=this.radius_g-s,this.flip_axis?(i.x=this.radius_g_1*Math.atan(o/Et(r,n)),i.y=this.radius_g_1*Math.atan(r/n)):(i.x=this.radius_g_1*Math.atan(o/n),i.y=this.radius_g_1*Math.atan(r/Et(o,n))));return i.x=i.x*this.a,i.y=i.y*this.a,i}function iS(i){var e=-1,t=0,n=0,s,o,r,a;if(i.x=i.x/this.a,i.y=i.y/this.a,this.shape==="ellipse"){this.flip_axis?(n=Math.tan(i.y/this.radius_g_1),t=Math.tan(i.x/this.radius_g_1)*Et(1,n)):(t=Math.tan(i.x/this.radius_g_1),n=Math.tan(i.y/this.radius_g_1)*Et(1,t));var l=n/this.radius_p;if(s=t*t+l*l+e*e,o=2*this.radius_g*e,r=o*o-4*s*this.C,r<0)return i.x=Number.NaN,i.y=Number.NaN,i;a=(-o-Math.sqrt(r))/(2*s),e=this.radius_g+a*e,t*=a,n*=a,i.x=Math.atan2(t,e),i.y=Math.atan(n*Math.cos(i.x)/e),i.y=Math.atan(this.radius_p_inv2*Math.tan(i.y))}else if(this.shape==="sphere"){if(this.flip_axis?(n=Math.tan(i.y/this.radius_g_1),t=Math.tan(i.x/this.radius_g_1)*Math.sqrt(1+n*n)):(t=Math.tan(i.x/this.radius_g_1),n=Math.tan(i.y/this.radius_g_1)*Math.sqrt(1+t*t)),s=t*t+n*n+e*e,o=2*this.radius_g*e,r=o*o-4*s*this.C,r<0)return i.x=Number.NaN,i.y=Number.NaN,i;a=(-o-Math.sqrt(r))/(2*s),e=this.radius_g+a*e,t*=a,n*=a,i.x=Math.atan2(t,e),i.y=Math.atan(n*Math.cos(i.x)/e)}return i.x=i.x+this.long0,i}var nS=["Geostationary Satellite View","Geostationary_Satellite","geos"];const sS={init:eS,forward:tS,inverse:iS,names:nS};var Ys=1.340264,$s=-.081106,js=893e-6,Ws=.003796,Ar=Math.sqrt(3)/2;function oS(){this.es=0,this.long0=this.long0!==void 0?this.long0:0,this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0}function rS(i){var e=J(i.x-this.long0,this.over),t=i.y,n=Math.asin(Ar*Math.sin(t)),s=n*n,o=s*s*s;return i.x=e*Math.cos(n)/(Ar*(Ys+3*$s*s+o*(7*js+9*Ws*s))),i.y=n*(Ys+$s*s+o*(js+Ws*s)),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function aS(i){i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a;var e=1e-9,t=12,n=i.y,s,o,r,a,l,c;for(c=0;c<t&&(s=n*n,o=s*s*s,r=n*(Ys+$s*s+o*(js+Ws*s))-i.y,a=Ys+3*$s*s+o*(7*js+9*Ws*s),n-=l=r/a,!(Math.abs(l)<e));++c);return s=n*n,o=s*s*s,i.x=Ar*i.x*(Ys+3*$s*s+o*(7*js+9*Ws*s))/Math.cos(n),i.y=Math.asin(Math.sin(n)/Ar),i.x=J(i.x+this.long0,this.over),i}var lS=["eqearth","Equal Earth","Equal_Earth"];const cS={init:oS,forward:rS,inverse:aS,names:lS};var qs=1e-10;function dS(){var i;if(this.phi1=this.lat1,Math.abs(this.phi1)<qs)throw new Error;this.es?(this.en=Dl(this.es),this.m1=Rn(this.phi1,this.am1=Math.sin(this.phi1),i=Math.cos(this.phi1),this.en),this.am1=i/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=uS,this.forward=hS):(Math.abs(this.phi1)+qs>=$?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=pS,this.forward=fS)}function hS(i){var e=J(i.x-(this.long0||0),this.over),t=i.y,n,s,o;return n=this.am1+this.m1-Rn(t,s=Math.sin(t),o=Math.cos(t),this.en),s=o*e/(n*Math.sqrt(1-this.es*s*s)),i.x=n*Math.sin(s),i.y=this.am1-n*Math.cos(s),i.x=this.a*i.x+(this.x0||0),i.y=this.a*i.y+(this.y0||0),i}function uS(i){i.x=(i.x-(this.x0||0))/this.a,i.y=(i.y-(this.y0||0))/this.a;var e,t,n,s;if(t=Et(i.x,i.y=this.am1-i.y),s=Nl(this.am1+this.m1-t,this.es,this.en),(e=Math.abs(s))<$)e=Math.sin(s),n=t*Math.atan2(i.x,i.y)*Math.sqrt(1-this.es*e*e)/Math.cos(s);else if(Math.abs(e-$)<=qs)n=0;else throw new Error;return i.x=J(n+(this.long0||0),this.over),i.y=Ti(s),i}function fS(i){var e=J(i.x-(this.long0||0),this.over),t=i.y,n,s;return s=this.cphi1+this.phi1-t,Math.abs(s)>qs?(i.x=s*Math.sin(n=e*Math.cos(t)/s),i.y=this.cphi1-s*Math.cos(n)):i.x=i.y=0,i.x=this.a*i.x+(this.x0||0),i.y=this.a*i.y+(this.y0||0),i}function pS(i){i.x=(i.x-(this.x0||0))/this.a,i.y=(i.y-(this.y0||0))/this.a;var e,t,n=Et(i.x,i.y=this.cphi1-i.y);if(t=this.cphi1+this.phi1-n,Math.abs(t)>$)throw new Error;return Math.abs(Math.abs(t)-$)<=qs?e=0:e=n*Math.atan2(i.x,i.y)/Math.cos(t),i.x=J(e+(this.long0||0),this.over),i.y=Ti(t),i}var mS=["bonne","Bonne (Werner lat_1=90)"];const gS={init:dS,names:mS},zf={OBLIQUE:{forward:CS,inverse:ES},TRANSVERSE:{forward:wS,inverse:xS}},vr={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}};function yS(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=ff.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if(this.o_proj==="ob_tran")throw new Error("Invalid value for o_proj: "+this.o_proj);const i=this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim(),e=Pt(i);if(!e)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);e.long0=0,this.obliqueProjection=e;let t;const n=Object.keys(vr),s=a=>{if(typeof this[a]>"u")return;const l=parseFloat(this[a])*Oe;if(isNaN(l))throw new Error("Invalid value for "+a+": "+this[a]);return l};for(let a=0;a<n.length;a++){const l=n[a],c=vr[l],h=Object.entries(c);if(h.some(([p])=>typeof this[p]<"u")){t=c;for(let p=0;p<h.length;p++){const[f,m]=h[p],y=s(f);if(typeof y>"u")throw new Error("Missing parameter: "+f+".");this[m]=y}break}}if(!t)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:o,phip:r}=bS(this,t);this.lamp=o,Math.abs(r)>K?(this.cphip=Math.cos(r),this.sphip=Math.sin(r),this.projectionType=zf.OBLIQUE):this.projectionType=zf.TRANSVERSE}function AS(i){return this.projectionType.forward(this,i)}function vS(i){return this.projectionType.inverse(this,i)}function bS(i,e){let t,n;if(e===vr.ROTATE){let s=i.oLongC,o=i.oLatC,r=i.oAlpha;if(Math.abs(Math.abs(o)-$)<=K)throw new Error("Invalid value for o_lat_c: "+i.o_lat_c+" should be < 90°");n=s+Math.atan2(-1*Math.cos(r),-1*Math.sin(r)*Math.sin(o)),t=Math.asin(Math.cos(o)*Math.sin(r))}else if(e===vr.NEW_POLE)n=i.oLongP,t=i.oLatP;else{let s=i.oLong1,o=i.oLat1,r=i.oLong2,a=i.oLat2,l=Math.abs(o);if(Math.abs(o)>$-K)throw new Error("Invalid value for o_lat_1: "+i.o_lat_1+" should be < 90°");if(Math.abs(a)>$-K)throw new Error("Invalid value for o_lat_2: "+i.o_lat_2+" should be < 90°");if(Math.abs(o-a)<K)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(l<K)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");n=Math.atan2(Math.cos(o)*Math.sin(a)*Math.cos(s)-Math.sin(o)*Math.cos(a)*Math.cos(r),Math.sin(o)*Math.cos(a)*Math.sin(r)-Math.cos(o)*Math.sin(a)*Math.sin(s)),t=Math.atan(-1*Math.cos(n-s)/Math.tan(o))}return{lamp:n,phip:t}}function CS(i,e){let{x:t,y:n}=e;t+=i.long0;const s=Math.cos(t),o=Math.sin(n),r=Math.cos(n);e.x=J(Math.atan2(r*Math.sin(t),i.sphip*r*s+i.cphip*o)+i.lamp),e.y=Math.asin(i.sphip*o-i.cphip*r*s);const a=i.obliqueProjection.forward(e);return i.isIdentity&&(a.x*=bt,a.y*=bt),a}function wS(i,e){let{x:t,y:n}=e;t+=i.long0;const s=Math.cos(n),o=Math.cos(t);e.x=J(Math.atan2(s*Math.sin(t),Math.sin(n))+i.lamp),e.y=Math.asin(-1*s*o);const r=i.obliqueProjection.forward(e);return i.isIdentity&&(r.x*=bt,r.y*=bt),r}function ES(i,e){i.isIdentity&&(e.x*=Oe,e.y*=Oe);const t=i.obliqueProjection.inverse(e);let{x:n,y:s}=t;if(n<Number.MAX_VALUE){n-=i.lamp;const o=Math.cos(n),r=Math.sin(s),a=Math.cos(s);e.x=Math.atan2(a*Math.sin(n),i.sphip*a*o-i.cphip*r),e.y=Math.asin(i.sphip*r+i.cphip*a*o)}return e.x=J(e.x+i.long0),e}function xS(i,e){i.isIdentity&&(e.x*=Oe,e.y*=Oe);const t=i.obliqueProjection.inverse(e);let{x:n,y:s}=t;if(n<Number.MAX_VALUE){const o=Math.cos(s);n-=i.lamp,e.x=Math.atan2(o*Math.sin(n),-1*Math.sin(s)),e.y=Math.asin(o*Math.cos(n))}return e.x=J(e.x+i.long0),e}var IS=["General Oblique Transformation","General_Oblique_Transformation","ob_tran"];const SS={init:yS,forward:AS,inverse:vS,names:IS};function MS(i){i.Proj.projections.add(ur),i.Proj.projections.add(fr),i.Proj.projections.add(mx),i.Proj.projections.add(xx),i.Proj.projections.add(Bx),i.Proj.projections.add(Nx),i.Proj.projections.add(Ux),i.Proj.projections.add(Yx),i.Proj.projections.add(Kx),i.Proj.projections.add(t2),i.Proj.projections.add(p2),i.Proj.projections.add(b2),i.Proj.projections.add(I2),i.Proj.projections.add(k2),i.Proj.projections.add(R2),i.Proj.projections.add(V2),i.Proj.projections.add($2),i.Proj.projections.add(X2),i.Proj.projections.add(nI),i.Proj.projections.add(lI),i.Proj.projections.add(fI),i.Proj.projections.add(AI),i.Proj.projections.add(II),i.Proj.projections.add(_I),i.Proj.projections.add(LI),i.Proj.projections.add(zI),i.Proj.projections.add(WI),i.Proj.projections.add(ZI),i.Proj.projections.add(sS),i.Proj.projections.add(cS),i.Proj.projections.add(gS),i.Proj.projections.add(SS)}const Ks=Object.assign(PE,{defaultDatum:"WGS84",Proj:Pt,WGS84:new Pt("WGS84"),Point:Ln,toPoint:Ef,defs:nt,nadgrid:pE,transform:dr,mgrs:DE,version:"__VERSION__"});MS(Ks);class TS{cesium;viewer;watermarkEnabled=!0;mapLayers={};modelId="default";options={flyTo:!0};gisCadModelsList=[];open=!1;events=new _s;heightLodThresholds={full:2e3,medium:8e3,far:3e4};heightLodEnabled=!1;heightLodHandler=null;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t}getMapLayers(e){const t=typeof e=="object"?e?.modelId:e;return t?this.mapLayers[t]||{}:this.mapLayers}setModelId(e){this.modelId=e}getModelId(){return this.modelId}setDxfOpen(e){this.open=e}getDxfOpen(){return this.open}getDxfModelsList(){return this.gisCadModelsList}async addVectorTileByUrlTemplate(e){let t=window?.VectorTileLayer||window?.CesiumVectorTileGL?.VectorTileLayer||this.cesium?.VectorTileLayer;if(!t)try{const s=await Promise.resolve().then(()=>Qd),o=s?.VectorTileLayer||s?.CesiumVectorTileGL?.VectorTileLayer||s?.default?.VectorTileLayer||s?.default;if(o)window.VectorTileLayer=o,s?.CesiumVectorTileGL&&(window.CesiumVectorTileGL=s.CesiumVectorTileGL),t=o;else{const r=s?.VectorTileset||s?.CesiumVectorTileGL?.VectorTileset||s?.default?.VectorTileset;r&&(window.VectorTileset=r)}}catch{}if(t){const s=new t(this.viewer,{urlTemplate:e.urlTemplate,minZoom:e.minZoom??0,maxZoom:e.maxZoom??24,style:e.style||{},terrain:!0,tms:e.tms??e.scheme==="tms"});try{const o=s;o?.readyEvent?.addEventListener&&o.readyEvent.addEventListener(()=>{try{console.log("VectorTileLayer ready")}catch{}}),o?.errorEvent?.addEventListener&&o.errorEvent.addEventListener(r=>{console.error("VectorTileLayer error:",r)})}catch{}return s}const n=window?.CesiumVectorTileGL?.VectorTileset||window?.VectorTileset;if(n){const s=[],o=Array.isArray(e.sourceLayer)?e.sourceLayer:e.sourceLayer?[e.sourceLayer]:["layer","lines","line","roads","road","default","vt","g"],r=c=>[{id:`vt-fill-${c}`,type:"fill",source:"vt","source-layer":c,paint:{"fill-color":e.style?.polygon?.fill??"#00ffff66","fill-opacity":e.style?.polygon?.opacity??.4}},{id:`vt-line-${c}`,type:"line",source:"vt","source-layer":c,paint:{"line-color":e.style?.line?.color??"#ff0000","line-width":e.style?.line?.width??3}}];o.forEach(c=>s.push(...r(c)));const a={version:8,sources:{vt:{type:"vector",tiles:[e.urlTemplate],minzoom:e.minZoom??0,maxzoom:e.maxZoom??24,scheme:e.scheme??(e.tms?"tms":"xyz")}},layers:s},l=new n({style:a,terrain:e.terrain??e.clampToGround??!0});return this.viewer.scene.primitives.add(l),l?.readyEvent?.addEventListener&&l.readyEvent.addEventListener(()=>{try{console.log("VectorTileset ready:",{sources:Object.keys(l?.sources||{}),layers:a?.layers?.map(c=>c?.["source-layer"]).filter((c,h,u)=>c&&u.indexOf(c)===h)})}catch{}}),l?.errorEvent?.addEventListener&&l.errorEvent.addEventListener(c=>{console.error("VectorTileset error:",c)}),l}return console.error("Vector tile renderer not found. Please include cesium-vectortile-gl (or compatible) and ensure VectorTileLayer/VectorTileset is available globally."),null}async addGeoJsonLayer(e){let t=window?.VectorTileLayer||window?.CesiumVectorTileGL?.VectorTileLayer||this.cesium?.VectorTileLayer;if(!t)try{const l=await Promise.resolve().then(()=>Qd),c=l?.VectorTileLayer||l?.CesiumVectorTileGL?.VectorTileLayer||l?.default?.VectorTileLayer||l?.default;c&&(window.VectorTileLayer=c,l?.CesiumVectorTileGL&&(window.CesiumVectorTileGL=l.CesiumVectorTileGL),t=c)}catch{}if(!(window?.CesiumVectorTileGL?.VectorTileset||window?.VectorTileset))try{const l=await Promise.resolve().then(()=>Qd),c=l?.VectorTileset||l?.CesiumVectorTileGL?.VectorTileset||l?.default?.VectorTileset;c&&(window.VectorTileset=c)}catch{}const s={type:"geojson"};if(e.dataUrl)s.data=e.dataUrl;else if(e.data)s.data=e.data;else return null;if(e.minZoom!==void 0&&(s.minzoom=e.minZoom),e.maxZoom!==void 0&&(s.maxzoom=e.maxZoom),e.vtOptions&&typeof e.vtOptions=="object"){const l=e.vtOptions;l.maxZoom!==void 0&&(s.maxzoom=l.maxZoom),l.indexMaxZoom!==void 0&&(s.indexMaxZoom=l.indexMaxZoom),l.indexMaxPoints!==void 0&&(s.indexMaxPoints=l.indexMaxPoints),l.tolerance!==void 0&&(s.tolerance=l.tolerance),l.extent!==void 0&&(s.extent=l.extent),l.buffer!==void 0&&(s.buffer=l.buffer),l.lineMetrics!==void 0&&(s.lineMetrics=l.lineMetrics),l.promoteId!==void 0&&(s.promoteId=l.promoteId),l.generateId!==void 0&&(s.generateId=l.generateId)}const o={version:8,sources:{g:s},layers:[{id:"g-fill",type:"fill",source:"g",paint:{"fill-color":e.style?.polygon?.fill??"#00ffff66","fill-opacity":e.style?.polygon?.opacity??.4}},{id:"g-line",type:"line",source:"g",paint:{"line-color":e.style?.line?.color??"#ff0000","line-width":e.style?.line?.width??1.5}},{id:"g-point",type:"symbol",source:"g",layout:{"icon-image":void 0,"text-field":""},paint:{}}]};if(t){const l=new t(this.viewer,{style:o,terrain:e.terrain??e.clampToGround??!0});try{const c=l;c?.readyEvent?.addEventListener&&c.readyEvent.addEventListener(()=>{try{console.log("VectorTileLayer ready (geojson)")}catch{}}),c?.errorEvent?.addEventListener&&c.errorEvent.addEventListener(h=>{console.error("VectorTileLayer error (geojson):",h)})}catch{}try{const h=await(async()=>{if(e.data&&e.data.type==="FeatureCollection")return e.data;if(e.dataUrl){const u=await fetch(e.dataUrl,{cache:"no-store"});if(u.ok){const p=await u.json();if(p&&p.type==="FeatureCollection")return p}}return null})();if(h&&Array.isArray(h.features)&&h.features.length){let u=180,p=90,f=-180,m=-90;const y=(A,v)=>{!Number.isFinite(A)||!Number.isFinite(v)||(A<u&&(u=A),A>f&&(f=A),v<p&&(p=v),v>m&&(m=v))},g=A=>{if(Array.isArray(A)&&typeof A[0]=="number")y(Number(A[0]),Number(A[1]));else if(Array.isArray(A))for(const v of A)g(v)};for(const A of h.features){const v=A?.geometry;v?.coordinates&&g(v.coordinates)}if(u<=f&&p<=m){const A=this.cesium.Rectangle.fromDegrees(u,p,f,m);this.viewer.camera.flyTo({destination:A,duration:.6})}}}catch{}return l}const r=window?.CesiumVectorTileGL?.VectorTileset||window?.VectorTileset;if(!r)return null;const a=new r({style:o,terrain:e.terrain??e.clampToGround??!0});this.viewer.scene.primitives.add(a);try{const c=await(async()=>{if(e.data&&e.data.type==="FeatureCollection")return e.data;if(e.dataUrl){const h=await fetch(e.dataUrl,{cache:"no-store"});if(h.ok){const u=await h.json();if(u&&u.type==="FeatureCollection")return u}}return null})();if(c&&Array.isArray(c.features)&&c.features.length){let h=180,u=90,p=-180,f=-90;const m=(g,A)=>{!Number.isFinite(g)||!Number.isFinite(A)||(g<h&&(h=g),g>p&&(p=g),A<u&&(u=A),A>f&&(f=A))},y=g=>{if(Array.isArray(g)&&typeof g[0]=="number")m(Number(g[0]),Number(g[1]));else if(Array.isArray(g))for(const A of g)y(A)};for(const g of c.features){const A=g?.geometry;A?.coordinates&&y(A.coordinates)}if(h<=p&&u<=f){const g=this.cesium.Rectangle.fromDegrees(h,u,p,f);this.viewer.camera.flyTo({destination:g,duration:.6})}}}catch{}return a}async addVectorTileByTilesManifest(e){try{const t=await fetch(e.manifestUrl,{cache:"no-store"});if(!t.ok)return null;const n=await t.json();let s=null;const o=Array.isArray(n?.items)?n.items[0]:null;if(o?.url&&typeof o.url=="string"&&(s=String(o.url).replace(/\\/g,"/").replace(/\/\d+\/\d+\/\d+\.pbf$/i,"")),!s){const h=new URL(e.manifestUrl,window.location.href).href.replace(/\\/g,"/");s=h.slice(0,h.lastIndexOf("/"))}let r=e.minZoom,a=e.maxZoom;if((r===void 0||a===void 0)&&Array.isArray(n?.items)&&n.items.length){const c=n.items.map(h=>Number(h?.z)).filter(h=>Number.isFinite(h));c.length&&(r===void 0&&(r=Math.min(...c)),a===void 0&&(a=Math.max(...c)))}try{const c=Array.isArray(n?.items)?n.items:[],h=r??c[0]?.z??0,u=c.filter(p=>Number(p?.z)===h);if(u.length){let p=1/0,f=-1/0,m=1/0,y=-1/0;for(const g of u){const A=Number(g.x),v=Number(g.y);!Number.isFinite(A)||!Number.isFinite(v)||(A<p&&(p=A),A>f&&(f=A),v<m&&(m=v),v>y&&(y=v))}if(Number.isFinite(p)&&Number.isFinite(f)&&Number.isFinite(m)&&Number.isFinite(y)){const g=Math.pow(2,h),A=S=>S/g*360-180,v=S=>{const R=Math.PI-2*Math.PI*S/g;return 180/Math.PI*Math.atan(Math.sinh(R))},C=A(p),w=A(f+1),M=v(m),x=v(y+1),I=this.cesium.Rectangle.fromDegrees(C,x,w,M);this.viewer.camera.flyTo({destination:I,duration:.6})}}}catch{}const l=`${s}/{z}/{x}/{y}.pbf`;return this.addVectorTileByUrlTemplate({modelId:e.modelId,urlTemplate:l,sourceLayer:e.sourceLayer,minZoom:r,maxZoom:a,style:e.style})}catch{return null}}enableHeightLod(e=!0){this.heightLodEnabled=e,e&&!this.heightLodHandler?(this.heightLodHandler=this.viewer.camera.changed.addEventListener(()=>{this.applyHeightLod()}),this.viewer.camera.percentageChanged=.05,this.applyHeightLod()):!e&&this.heightLodHandler&&(this.heightLodHandler(),this.heightLodHandler=null,this.gisCadModelsList.forEach(t=>{const n=this.mapLayers[t.modelId];n&&Object.values(n).forEach(s=>{s.forEach(o=>{o.primitive&&(o.primitive.show=t.show!==!1)})})}),this.viewer.scene.requestRender())}applyHeightLod(){if(!this.heightLodEnabled)return;const e=this.viewer.camera.positionCartographic?.height??0,{full:t,medium:n,far:s}=this.heightLodThresholds;this.gisCadModelsList.forEach(o=>{const r=this.mapLayers[o.modelId];!r||o.show===!1||Object.values(r).forEach(a=>{a.forEach(l=>{if(!l.primitive)return;let c=!0;e>s?c=l.type==="polygon":e>n?c=l.type!=="point":e>t&&(c=!0),l.primitive.show=c})})}),this.viewer.scene.requestRender()}getDxfModels(e){const t=typeof e=="object"?e?.modelId:e;return t?this.gisCadModelsList.find(n=>n.modelId===t):this.gisCadModelsList}getDefaultCoordinateTransformConfig(){return{centralMeridian:118.5,latOrigin:0,scaleFactor:1,falseEasting:5e5,falseNorthing:0,ellipsoid:"GRS80"}}buildLongLatProj4Def(e){return`+proj=longlat +ellps=${e?.ellipsoid||this.getDefaultCoordinateTransformConfig().ellipsoid} +no_defs`}buildProjectedProj4Def(e){const t={...this.getDefaultCoordinateTransformConfig(),...e};return["+proj=tmerc",`+lat_0=${t.latOrigin}`,`+lon_0=${t.centralMeridian}`,`+k=${t.scaleFactor}`,`+x_0=${t.falseEasting}`,`+y_0=${t.falseNorthing}`,`+ellps=${t.ellipsoid||"GRS80"}`,"+units=m","+no_defs"].join(" ")}transformCoordinate(e){const t={...this.getDefaultCoordinateTransformConfig(),...e.config},n=this.buildLongLatProj4Def(t),s=this.buildProjectedProj4Def(t);if(e.direction==="lonlatToProjected"){const c=Number(e.longitude),h=Number(e.latitude);if([c,h].some(f=>Number.isNaN(f)))throw new Error("经纬度参数无效");const[u,p]=Ks(n,s,[c,h]);return{direction:e.direction,x:u,y:p,config:t}}const o=Number(e.x),r=Number(e.y);if([o,r].some(c=>Number.isNaN(c)))throw new Error("投影坐标参数无效");const[a,l]=Ks(s,n,[o,r]);return{direction:e.direction,longitude:a,latitude:l,config:t}}showJson({modelId:e,show:t}){const n=this.getRuntimeModel(e);n?.root&&(n.show=t,n.root.show=t),this.mapLayers[e]&&Object.values(this.mapLayers[e]).forEach(s=>{s.forEach(o=>{o.primitive&&(o.primitive.show=t)})}),n&&(t?n._overviewLODCheck?.():(n.overviewL0Roots?.forEach(s=>{s.show=!1}),n.overviewL1Roots?.forEach(s=>{s.show=!1})))}showJsonByLayer({modelId:e,show:t,layers:n}){const s=this.mapLayers[e];!s||!Array.isArray(n)||n.forEach(o=>{const r=s[o];r&&r.forEach(a=>{a.primitive&&(a.primitive.show=t)})})}flyToCadModel(e={}){const t=e.modelId||this.modelId,n=this.gisCadModelsList.find(s=>s.modelId===t);if(n){const s=e.minHeight??n._rebuildContext?.overviewL1Height;this.flyToBounds(n,{duration:e.duration,minHeight:s})}}flyToBounds(e,t){if(!e)return;const n=t?.duration??0,s=t?.minHeight,o=this.cesium,r=(l,c,h,u)=>{let p=l,f=c,m=h,y=u;if(s){const A=(p+m)/2,v=(f+y)/2,C=s/111e3,w=Math.max((m-p)/2,C),M=Math.max((y-f)/2,C);p=A-w,m=A+w,f=v-M,y=v+M}const g=o.Rectangle.fromDegrees(p,f,m,y);this.viewer.camera.flyTo({destination:g,duration:n})};{const l=e.overviewL0Tiles;if(l?.length){let c=1/0,h=1/0,u=-1/0,p=-1/0,f=0;for(const m of l){if(!m.lonLatBounds)continue;const y=m.lonLatBounds;y.west<c&&(c=y.west),y.south<h&&(h=y.south),y.east>u&&(u=y.east),y.north>p&&(p=y.north),f++}if(f>0&&Number.isFinite(c)&&Number.isFinite(u)){r(c,h,u,p);return}}}const a=this.computeRealRectangleDegrees(e);if(a){r(a.west,a.south,a.east,a.north);return}e.root&&this.viewer.flyTo(e.root,{duration:n})}computeRealRectangleDegrees(e){const t=e?.formData||{},n=e?.bounds,s=n?.min,o=n?.max;if(t.transformConfig&&t.transformDirection==="projectedToLonlat"&&s&&o&&Number.isFinite(s.x)&&Number.isFinite(s.y)&&Number.isFinite(o.x)&&Number.isFinite(o.y))try{const r=this.buildLongLatProj4Def(t.transformConfig),a=this.buildProjectedProj4Def(t.transformConfig),l=Ks(a,r),[c,h]=l.forward([s.x,s.y]),[u,p]=l.forward([o.x,o.y]);return{west:Math.min(c,u),south:Math.min(h,p),east:Math.max(c,u),north:Math.max(h,p)}}catch(r){console.warn("Failed to compute projected rectangle",r)}if(t.longitude!==void 0&&t.latitude!==void 0){const r=Number(t.longitude),a=Number(t.latitude),l=Math.max(1e-6,Number(t.scale??1)),c=Math.max(.001,l*.001);return{west:r-c,south:a-c,east:r+c,north:a+c}}return null}parseColor(e,t=1){const n=this.cesium.Color.WHITE.withAlpha(t);if(!e||typeof e!="string")return n;const s=e.trim(),o=[s];if(s.startsWith("#")){const r=s.slice(1).replace(/[^0-9a-fA-F]/g,"");[3,4,6,8].includes(r.length)&&o.push(`#${r}`)}for(const r of Array.from(new Set(o)))try{const a=this.cesium.Color.fromCssColorString(r);if(a)return a.withAlpha(t)}catch(a){console.warn("Failed to parse CAD color candidate:",r,a)}return console.warn("Failed to parse CAD color, fallback to white:",e),n}getLineWidth(e){return typeof e!="number"||Number.isNaN(e)?1.25:Math.max(2.5,e*5)}uniqueKey(e){return e.map(t=>`${t??""}`).join("::")}normalizePoint(e){if(!Array.isArray(e)||e.length<2)return null;const t=Number(e[0]),n=Number(e[1]),s=Number(e[2]||0);return[t,n,s].some(o=>Number.isNaN(o))?null:[t,n,s]}mergeLayerItemsMap(e,t){Object.entries(t).forEach(([n,s])=>{e[n]||(e[n]=[]),e[n].push(...s)})}buildDefaultFormData(e,t){return{modelId:e.modelId,longitude:t.originLongitude,latitude:t.originLatitude,height:t.originHeight,scaleToMeter:t.scaleToMeter,scale:t.scale,localOriginX:t.localOriginX,localOriginY:t.localOriginY,totalRotation:e.totalRotation||0,distance:1e-6,heightDistance:1,rotation:1,scaleStep:.1,clampToGround:!1}}normalizeFormData(e,t,n=!1){const s=e.formData||{},o=this.buildDefaultFormData(e,t);return{...o,...s,modelId:e.modelId,longitude:Number(s.longitude??o.longitude),latitude:Number(s.latitude??o.latitude),height:Number(s.height??o.height),scaleToMeter:Number(s.scaleToMeter??o.scaleToMeter),scale:Math.max(1e-6,Number(s.scale??o.scale)),localOriginX:Number(s.localOriginX??o.localOriginX),localOriginY:Number(s.localOriginY??o.localOriginY),totalRotation:Number(s.totalRotation??o.totalRotation),distance:Number(s.distance??o.distance),heightDistance:Number(s.heightDistance??o.heightDistance),rotation:Number(s.rotation??o.rotation),scaleStep:Number(s.scaleStep??o.scaleStep),transformConfig:s.transformConfig,transformDirection:s.transformDirection,clampToGround:s.clampToGround??n}}removeModelNode(e,t){!e||!t||(e.remove(t),t.destroy&&!t.isDestroyed?.()&&t.destroy())}buildTransform(e,t){const n=this.cesium,s=t.formData||{};let o=s.longitude??t.deltaLongitude??e.longitude??e.result?.origin?.longitude??0,r=s.latitude??t.deltaLatitude??e.latitude??e.result?.origin?.latitude??0,a=s.height??0;const l=e.result?.extMin?.x??0,c=e.result?.extMin?.y??0,h=e.result?.realUnits??e.unit??1,u=Math.max(1e-6,Number(s.scale??1)),p=h*u;let f=null,m=null,y=null;if(s.transformConfig&&s.transformDirection==="projectedToLonlat"){const w=this.buildLongLatProj4Def(s.transformConfig),M=this.buildProjectedProj4Def(s.transformConfig);f=Ks(M,w),console.log("[buildTransform] proj4 mode:",{projectedDef:M,localOriginX:l,localOriginY:c});try{const[x,I]=f.forward([l,c]);if(!Number.isFinite(x)||!Number.isFinite(I))console.warn("proj4 returned NaN for base point",{localOriginX:l,localOriginY:c,blon:x,blat:I}),f=null;else{o=x,r=I,console.log("[buildTransform] proj4 base:",{blon:x,blat:I}),a=0,m=n.Cartesian3.fromDegrees(x,I,0);const S=n.Transforms.eastNorthUpToFixedFrame(m);y=n.Matrix4.inverseTransformation(S,new n.Matrix4)}}catch(x){console.warn("Failed to calculate projection base",x),f=null}}const g=n.Cartesian3.fromDegrees(o,r,a),A=n.Transforms.eastNorthUpToFixedFrame(g),v=s.totalRotation??t.totalRotation??0;if(v){const w=n.Quaternion.fromAxisAngle(n.Cartesian3.UNIT_Z,n.Math.toRadians(v)),M=n.Matrix4.fromRotationTranslation(n.Matrix3.fromQuaternion(w),new n.Cartesian3(0,0,0));n.Matrix4.multiply(A,M,A)}return{originLongitude:o,originLatitude:r,originHeight:a,localOriginX:l,localOriginY:c,scaleToMeter:h,scale:u,totalScaleToMeter:p,toWorld:w=>{const M=this.normalizePoint(w);if(!M)return null;if(f&&m&&y)try{const[I,S]=f.forward([M[0],M[1]]);if(!(!Number.isFinite(I)||!Number.isFinite(S))){const R=n.Cartesian3.fromDegrees(I,S,M[2]),b=n.Matrix4.multiplyByPoint(y,R,new n.Cartesian3);return b.x*=u,b.y*=u,b.z*=u,n.Matrix4.multiplyByPoint(A,b,new n.Cartesian3)}}catch{}const x=new n.Cartesian3((M[0]-l)*p,(M[1]-c)*p,M[2]*p);return n.Matrix4.multiplyByPoint(A,x,new n.Cartesian3)}}}createLinePrimitive(e,t){return e.length?t.clampToGround?new this.cesium.GroundPolylinePrimitive({geometryInstances:e,appearance:new this.cesium.PolylineColorAppearance,asynchronous:!0,allowPicking:!1}):new this.cesium.Primitive({geometryInstances:e,appearance:new this.cesium.PolylineColorAppearance,asynchronous:!0,allowPicking:!1}):null}createPolygonPrimitive(e,t){return e.length?t.clampToGround?new this.cesium.GroundPrimitive({geometryInstances:e,appearance:new this.cesium.PerInstanceColorAppearance({flat:!0,translucent:!0,closed:!0}),asynchronous:!0,allowPicking:!1}):new this.cesium.Primitive({geometryInstances:e,appearance:new this.cesium.PerInstanceColorAppearance({flat:!0,translucent:!0,closed:!0}),asynchronous:!0,allowPicking:!1}):null}createPointPrimitive(e){if(!e.length)return null;const t=new this.cesium.PointPrimitiveCollection;return e.forEach(n=>{t.add(n)}),t}buildModelPrimitives(e,t,n){const s=this.cesium,o=new s.PrimitiveCollection,r={},a={},l=this.buildTransform(t,e),c=new Map,h=new Map,u=new Map,p=Array.isArray(t.result?.lines)?t.result?.lines||[]:[],f=Array.isArray(t.result?.polygons)?t.result?.polygons||[]:[],m=Array.isArray(t.result?.points)?t.result?.points||[]:[];p.forEach(g=>{const v=(Array.isArray(g?.positions)?g.positions:[]).map(I=>l.toWorld(I)).filter(Boolean);if(v.length<2)return;const C=g.layer||"default",w=g.color||"#ffffff",M=this.uniqueKey([C,"line",this.getLineWidth(g.lineWeight)]),x=c.get(M)||[];x.push(new s.GeometryInstance({geometry:n.clampToGround?new s.GroundPolylineGeometry({positions:v,width:this.getLineWidth(g.lineWeight)}):new s.PolylineGeometry({positions:v,width:this.getLineWidth(g.lineWeight),vertexFormat:s.PolylineColorAppearance.VERTEX_FORMAT}),attributes:{color:s.ColorGeometryInstanceAttribute.fromColor(this.parseColor(w,1))},id:{modelId:e.modelId,layer:C,batchId:g.batchId,type:"line"}})),c.set(M,x)}),f.forEach(g=>{const v=(Array.isArray(g?.outerPositions)?g.outerPositions:[]).map(S=>l.toWorld(S)).filter(Boolean);if(v.length<3)return;const C=Array.isArray(g?.holes)?g.holes.map(S=>{const R=Array.isArray(S)?S.map(b=>l.toWorld(b)).filter(Boolean):[];return R.length<3?null:new s.PolygonHierarchy(R)}).filter(Boolean):[],w=g.layer||"default",M=g.color||"#ffffff",x=this.uniqueKey([w,"polygon"]),I=h.get(x)||[];I.push(new s.GeometryInstance({geometry:new s.PolygonGeometry({polygonHierarchy:new s.PolygonHierarchy(v,C),vertexFormat:s.PerInstanceColorAppearance.VERTEX_FORMAT}),attributes:{color:s.ColorGeometryInstanceAttribute.fromColor(this.parseColor(M,.45))},id:{modelId:e.modelId,layer:w,batchId:g.batchId,type:"polygon"}})),h.set(x,I)}),m.forEach(g=>{const A=g?.position||g?.positions?.[0]||g,v=l.toWorld(A);if(!v)return;const C=g.layer||"default",w=g.color||"#ffffff",M=this.uniqueKey([C,"point"]),x=u.get(M)||[];x.push({position:v,color:this.parseColor(w,1),pixelSize:Math.max(4,Number(g.pixelSize||6)),id:{modelId:e.modelId,layer:C,batchId:g.batchId,type:"point"}}),u.set(M,x)});const y=(g,A,v)=>{A&&(o.add(A),n.recordLayers!==!1&&(a[g]||(a[g]=[]),a[g].push({primitive:A,color:v.color,batchId:v.batchId,type:v.type})),r[g]||(r[g]={}),r[g][v.type]=A)};return c.forEach((g,A)=>{const[v="default"]=A.split("::");y(v,this.createLinePrimitive(g,n),{color:void 0,batchId:g[0]?.id?.batchId,type:"line"})}),h.forEach((g,A)=>{const[v="default"]=A.split("::");y(v,this.createPolygonPrimitive(g,n),{color:void 0,batchId:g[0]?.id?.batchId,type:"polygon"})}),u.forEach((g,A)=>{const[v="default"]=A.split("::");y(v,this.createPointPrimitive(g),{color:void 0,batchId:g[0]?.id?.batchId,type:"point"})}),{root:o,layerPrimitiveMap:r,layerItemsMap:a,transform:l}}buildModelRoot(e,t,n){const s=new this.cesium.PrimitiveCollection,o={};let r=null;return t.forEach(a=>{const l=this.buildModelPrimitives(e,a,n);r||(r=l),s.add(l.root),this.mergeLayerItemsMap(o,l.layerItemsMap)}),{root:s,transform:r.transform,layerItemsMap:o}}getRuntimeModel(e){const t=e||this.modelId;return this.gisCadModelsList.find(n=>n.modelId===t)||null}rebuildPreviewRoot(e){if(!e.editingFormData)return;e.previewRoot&&(this.removeModelNode(e.root,e.previewRoot),e.previewRoot=null);const t=this.buildModelRoot({...e,formData:e.editingFormData},e.sourceDataList,{clampToGround:e.editingFormData.clampToGround??!1,recordLayers:!1});e.previewRoot=t.root,e.root.add(e.previewRoot),e.groundRoot&&(e.groundRoot.show=!1)}replaceGroundRoot(e,t){const n=this.cesium;t.clampToGround!==void 0&&(e.buildOptions.clampToGround=t.clampToGround),e.tileCameraListenerRemove?.(),e.overviewLODListenerRemove?.(),e.tileCameraListenerRemove=void 0,e.overviewLODListenerRemove=void 0,e._overviewLODCheck=void 0,e._tileLODCheck=void 0,e.root&&(this.viewer.scene.primitives.remove(e.root),e.root.destroy&&!e.root.isDestroyed?.()&&e.root.destroy()),e.root=null,e.groundRoot=null,e.previewRoot=null,e.tileRoots?.clear(),e.overviewL0Roots?.clear(),e.overviewL1Roots?.clear(),e.formData=t;const s=e.sourceDataList?.[0];if(!s)return;const o=this.buildModelRoot({...e,formData:t},[s],e.buildOptions),r=new n.PrimitiveCollection;r.add(o.root),e.root=r,e.groundRoot=o.root,e.groundRoot.show=e.show!==!1,e.transform=o.transform,e.sourceDataList=[s],e.loadedChunks=1,e.tileRoots=e.manifestTiles?new Map:void 0,e.overviewL0Roots=new Map,e.overviewL1Roots=new Map,this.mapLayers[e.modelId]=o.layerItemsMap,this.viewer.scene.primitives.add(e.root),e.manifestTiles&&this.computeManifestTileLonLatBounds(e.manifestTiles,e.transform),e.overviewL0Tiles&&this.computeManifestTileLonLatBounds(e.overviewL0Tiles,e.transform),e.overviewL1Tiles&&this.computeManifestTileLonLatBounds(e.overviewL1Tiles,e.transform);const a=e._rebuildContext;a&&((e.overviewL0Tiles?.length||e.overviewL1Tiles?.length)&&this.setupOverviewLOD(e,e,a.normalizedBase,e.overviewL0Tiles||[],e.overviewL1Tiles||[],a.overviewL1Height),e.manifestTiles&&this.setupManifestTileLoading(e,e,a.normalizedBase)),this.viewer.scene.requestRender()}async loadModelFile(e){try{if(!e||typeof e!="string")return!1;const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status} for ${e}`);if(e.endsWith(".json")||t.headers.get("content-type")?.includes("application/json"))return await t.json();const n=await t.blob(),s=new ml(new tr(n),{password:Yu,useWebWorkers:!1}),r=(await s.getEntries()).find(c=>!c.directory&&c.filename.endsWith(".json"));if(!r)return await s.close(),!1;const a=await r.arrayBuffer({useWebWorkers:!1});await s.close();const l=new TextDecoder().decode(a);return JSON.parse(l.trim())}catch(t){return console.error("Failed to load GIS CAD source:",e,t),!1}}getCandidateUrls(e){const t=e.outPutPath.endsWith("/")?e.outPutPath:`${e.outPutPath}/`,n=[e.sourceUrl,`${t}${e.dbName}/cad.zip`].filter(Boolean);return Array.from(new Set(n))}getChunkCandidateUrls(e,t,n){const o=[`${e.outPutPath.endsWith("/")?e.outPutPath:`${e.outPutPath}/`}${e.dbName}/cad_${n}.zip`];try{const r=new URL(t),a=r.pathname,l=a.lastIndexOf("/"),c=l>=0?a.slice(0,l+1):"/",h=a.lastIndexOf("."),u=h>=0?a.slice(h):".zip",p=l>=0?a.slice(l+1,h>=0?h:void 0):a.slice(0,h>=0?h:void 0),f=p===e.dbName?e.dbName:p;o.unshift(`${r.origin}${c}${f}_${n}${u}`,`${r.origin}${c}${f}${n}${u}`)}catch(r){console.warn("Failed to resolve chunk urls from primary source:",t,r)}return Array.from(new Set(o))}async loadSourceData(e){const t=this.getCandidateUrls(e);for(const n of t){const s=await this.loadModelFile(n);if(s)return{url:n,data:s}}return{url:t[0]||"",data:!1}}async addGISCadModel({fileNames:e,options:t}){if(!e?.length)return;const n={...this.options,...t},s={clampToGround:n.clampToGround??n.mode!=="2d"};for(const o of e){if(this.gisCadModelsList.find(v=>v.modelId===o.modelId))continue;/^(https?|atom):\/\//i.test(o.outPutPath)||(o.outPutPath=`${window.location.origin}${o.outPutPath}`);const a=o.outPutPath.endsWith("/")?o.outPutPath:`${o.outPutPath}/`,l=`${a}${o.dbName}/region.zip`;let c=!1;try{(await fetch(l,{method:"HEAD",cache:"no-store"})).ok&&(c=await this.loadModelFile(l))}catch{}c&&typeof c=="object"&&(["longitude","latitude","scale","totalRotation","height"].some(w=>c[w]!==void 0)&&(o.formData={longitude:c.longitude,latitude:c.latitude,scale:c.scale,totalRotation:c.totalRotation,height:c.height,...o.formData||{}}),c.centralMeridian!==void 0&&(o.formData={transformConfig:{centralMeridian:c.centralMeridian,latOrigin:c.latOrigin??0,scaleFactor:c.scaleFactor??1,falseEasting:c.falseEasting??5e5,falseNorthing:c.falseNorthing??0,ellipsoid:c.ellipsoid??"GRS80"},transformDirection:"projectedToLonlat",...o.formData||{}}));const h=`${a}${o.dbName}/manifest.zip`;let u=null,p=null,f=null,m=6e3;try{const v=await this.loadModelFile(h);v&&typeof v=="object"&&(v?.tiles&&Array.isArray(v.tiles)&&(u=v.tiles),Array.isArray(v?.overviewL0)&&(p=v.overviewL0),Array.isArray(v?.overviewL1)&&(f=v.overviewL1,m=Number(v.overviewL1Height)||6e3))}catch{}console.log("[addGISCadModel] formData:",JSON.stringify(o.formData)),console.log("[addGISCadModel] manifestTiles:",u?.length,"L0:",p?.length,"L1:",f?.length);const y=await this.loadSourceData(o);if(!y.data){console.error("Failed to resolve GIS CAD primary source for model:",o);continue}const g=y.data,A=Math.max(1,Number(g.numbersOfFile||1));try{const v=this.buildTransform(g,o),C=this.normalizeFormData(o,v,s.clampToGround),w=this.buildModelRoot({...o,formData:C},[g],s),M=new this.cesium.PrimitiveCollection;M.add(w.root);const x=g.bounds||null,I={...o,type:"gis-cad",sourceUrl:y.url,sourceData:g,sourceDataList:[g],root:M,groundRoot:w.root,previewRoot:null,bounds:x,transform:w.transform,show:!0,formData:C,editingFormData:null,isEditing:!1,buildOptions:s,totalChunks:u?u.length:A,loadedChunks:1,chunkLoadingComplete:!u&&A<=1,manifestTiles:u||void 0,tileRoots:u?new Map:void 0,pendingFontTiles:u?u.filter(S=>S.isFont&&S.file!=="cad.zip").map(S=>S.file):[],_rebuildContext:{normalizedBase:a,overviewL1Height:m}};this.mapLayers[o.modelId]=w.layerItemsMap,this.viewer.scene.primitives.add(I.root),this.gisCadModelsList.push(I),this.setModelId(o.modelId),p&&(this.computeManifestTileLonLatBounds(p,I.transform),I.overviewL0Tiles=p),n.flyTo&&this.flyToBounds(I),n.onSuccess&&n.onSuccess(I),(p||f)&&(f&&(this.computeManifestTileLonLatBounds(f,I.transform),I.overviewL1Tiles=f),this.setupOverviewLOD(o,I,a,p||[],f||[],m)),u?(this.computeManifestTileLonLatBounds(u,I.transform),this.setupManifestTileLoading(o,I,a)):A>1&&this.loadRemainingChunksAsync(o,y.url,A,I)}catch(v){console.error("Failed to build GIS CAD model:",o,v)}}this.events.emit("mountAllGISCad",this.gisCadModelsList)}async _addGISCadModel({fileNames:e,options:t}){if(!e?.length)return;const n={...this.options,...t},s={clampToGround:n.clampToGround??n.mode!=="2d"};for(const o of e){if(this.gisCadModelsList.find(f=>f.modelId===o.modelId))continue;/^(https?|atom):\/\//i.test(o.outPutPath)||(o.outPutPath=`${window.location.origin}${o.outPutPath}`);const a=o.outPutPath.endsWith("/")?o.outPutPath:`${o.outPutPath}/`,l=`${a}${o.dbName}/region.zip`;let c=!1;try{(await fetch(l,{method:"HEAD"})).ok&&(c=await this.loadModelFile(l))}catch{}c&&typeof c=="object"&&(["longitude","latitude","scale","totalRotation","height"].some(y=>c[y]!==void 0)&&(o.formData={longitude:c.longitude,latitude:c.latitude,scale:c.scale,totalRotation:c.totalRotation,height:c.height,...o.formData||{}}),c.centralMeridian!==void 0&&(o.formData={transformConfig:{centralMeridian:c.centralMeridian,latOrigin:c.latOrigin??0,scaleFactor:c.scaleFactor??1,falseEasting:c.falseEasting??5e5,falseNorthing:c.falseNorthing??0,ellipsoid:c.ellipsoid??"GRS80"},transformDirection:"projectedToLonlat",...o.formData||{}}));const h=await this.loadSourceData(o);if(!h.data){console.error("Failed to resolve GIS CAD primary source for model:",o);continue}const u=h.data,p=Math.max(1,Number(u.numbersOfFile||1));try{const f=this.buildTransform(u,o),m=this.normalizeFormData(o,f,s.clampToGround),y=this.buildModelRoot({...o,formData:m},[u],s),g=new this.cesium.PrimitiveCollection;g.add(y.root);const A=u.bounds||null,v={...o,type:"gis-cad",sourceUrl:h.url,sourceData:u,sourceDataList:[u],root:g,groundRoot:y.root,previewRoot:null,bounds:A,transform:y.transform,show:!0,formData:m,editingFormData:null,isEditing:!1,buildOptions:s,totalChunks:p,loadedChunks:1,chunkLoadingComplete:p<=1,_rebuildContext:{normalizedBase:a,overviewL1Height:6e3}};this.mapLayers[o.modelId]=y.layerItemsMap,this.viewer.scene.primitives.add(v.root),this.gisCadModelsList.push(v),this.setModelId(o.modelId),n.flyTo&&this.flyToBounds(v),n.onSuccess&&n.onSuccess(v),p>1&&this.loadRemainingChunksAsync(o,h.url,p,v)}catch(f){console.error("Failed to build GIS CAD model:",o,f)}}this.events.emit("mountAllGISCad",this.gisCadModelsList)}async loadRemainingChunksAsync(e,t,n,s){for(let o=1;o<n;o++){await new Promise(l=>setTimeout(l,0));const r=this.getChunkCandidateUrls(e,t,o);let a=!1;for(const l of r)try{const c=await this.loadModelFile(l);if(c?.watermark&&this.watermarkEnabled,c){const h=this.buildModelPrimitives({...s,formData:s.formData},c,s.buildOptions);s.groundRoot.add(h.root),s.sourceDataList.push(c),this.mapLayers[s.modelId]||(this.mapLayers[s.modelId]={}),this.mergeLayerItemsMap(this.mapLayers[s.modelId],h.layerItemsMap),s.loadedChunks=(s.loadedChunks||1)+1,this.events.emit("chunkProgress",{modelId:s.modelId,loaded:s.loadedChunks,total:n}),this.viewer.scene.requestRender(),a=!0;break}}catch(c){console.error("Failed to append GIS CAD chunk:",l,c)}a||console.warn(`Failed to load GIS CAD chunk ${o} for ${e.modelId}`)}s.chunkLoadingComplete=!0,this.events.emit("chunkLoadingComplete",s)}setupOverviewLOD(e,t,n,s,o,r=6e3){const a=this.cesium;t.overviewL0Roots=new Map,t.overviewL1Roots=new Map;const l=w=>{if(!w.lonLatBounds)return!1;let M=null;try{M=this.viewer?.camera?.computeViewRectangle?.()??null}catch{M=null}if(!M)return!0;const x=a.Rectangle.fromDegrees(w.lonLatBounds.west,w.lonLatBounds.south,w.lonLatBounds.east,w.lonLatBounds.north);return a.Rectangle.intersection(M,x)!==void 0},c=async(w,M)=>{if(M.has(w.file))return;const x=`${n}${e.dbName}/${w.file}`;try{const I=await this.loadModelFile(x);if(!I)return;const S=this.buildModelPrimitives({...t,formData:t.formData},I,t.buildOptions);t.groundRoot.add(S.root),M.set(w.file,S.root),this.viewer.scene.requestRender()}catch(I){console.warn(`Failed to load overview chunk ${w.file}:`,I)}},h=(w,M)=>{const x=M.get(w);if(x){try{t.groundRoot.remove(x),x.destroy&&x.destroy()}catch{}M.delete(w)}};let u=0;const p=3,f=[],m=()=>{for(;u<p&&f.length>0;){const{tile:w,rootMap:M}=f.shift();M.has(w.file)||(u++,c(w,M).finally(()=>{u--,m()}))}},y=(w,M)=>{M.has(w.file)||f.some(x=>x.tile.file===w.file)||f.push({tile:w,rootMap:M})},g=()=>{if(!t.overviewL0Roots||!t.overviewL1Roots)return;const w=this.viewer?.camera?.positionCartographic?.height??1/0;for(const S of s)l(S)?y(S,t.overviewL0Roots):h(S.file,t.overviewL0Roots);for(const S of o)l(S)&&w<r?y(S,t.overviewL1Roots):h(S.file,t.overviewL1Roots);const M=(t.tileRoots?.size||0)>1,x=!M&&(w>=r||w<r&&t.overviewL1Roots.size===0);t.overviewL0Roots.forEach(S=>{S.show=x});const I=!M&&t.overviewL1Roots.size>0&&w<r;t.overviewL1Roots.forEach(S=>{S.show=I}),m(),this.viewer.scene.requestRender()};t._overviewLODCheck=g;let A=null;const v=()=>{A&&clearTimeout(A),A=setTimeout(()=>{A=null,g()},200)},C=this.viewer?.camera?.moveEnd?.addEventListener?.(v);typeof C=="function"&&(t.overviewLODListenerRemove=()=>{A&&clearTimeout(A),C()}),g()}computeManifestTileLonLatBounds(e,t){if(!t?.toWorld){console.warn("[computeManifestTileLonLatBounds] modelTransform.toWorld 不存在,跳过");return}const n=this.cesium;console.log("[computeManifestTileLonLatBounds] transform 参数:",{originLongitude:t.originLongitude,originLatitude:t.originLatitude,localOriginX:t.localOriginX,localOriginY:t.localOriginY,scaleToMeter:t.scaleToMeter,scale:t.scale,totalScaleToMeter:t.totalScaleToMeter});let s=0,o=0;const r=(a,l)=>{try{const c=t.toWorld([a,l,0]);if(!c)return null;const h=n.Cartographic.fromCartesian(c);return[n.Math.toDegrees(h.longitude),n.Math.toDegrees(h.latitude)]}catch{return null}};for(const a of e){if(!a.bounds)continue;const{minX:l,minY:c,maxX:h,maxY:u}=a.bounds,p=r(l,c),f=r(h,u);p&&f?(a.lonLatBounds={west:Math.min(p[0],f[0]),south:Math.min(p[1],f[1]),east:Math.max(p[0],f[0]),north:Math.max(p[1],f[1])},s++):o++}if(console.log(`[computeManifestTileLonLatBounds] 成功=${s} 失败=${o} 总共=${e.length}`),s>0){const a=e.find(l=>l.lonLatBounds);console.log("[computeManifestTileLonLatBounds] 示例:",a?.file,a?.lonLatBounds)}}setupManifestTileLoading(e,t,n){const a=this.cesium,l=t.manifestTiles||[];if(l.length===0)return;const c=x=>{if(!x.lonLatBounds)return!1;let I=null;try{I=this.viewer?.camera?.computeViewRectangle?.()??null}catch{I=null}if(!I)return!0;const S=a.Rectangle.fromDegrees(x.lonLatBounds.west,x.lonLatBounds.south,x.lonLatBounds.east,x.lonLatBounds.north);return a.Rectangle.intersection(I,S)!==void 0},h=x=>{const I=t.tileRoots?.get(x);if(I){try{t.groundRoot.remove(I),I.destroy&&I.destroy()}catch{}t.tileRoots?.delete(x),t.loadedChunks=Math.max(1,(t.loadedChunks||1)-1),this.events.emit("chunkProgress",{modelId:t.modelId,loaded:t.loadedChunks,total:t.totalChunks}),t._overviewLODCheck?.(),this.viewer.scene.requestRender()}},u=new Map,p=3;let f=0;const m=[],y=x=>{const I=u.get(x);I&&(clearTimeout(I),u.delete(x));const S=m.indexOf(x);S>=0&&m.splice(S,1)},g=()=>{for(;f<p&&m.length>0;){const x=m.shift(),I=l.find(S=>S.file===x);!I||t.tileRoots?.has(x)||!c(I)||(f++,A(x).finally(()=>{f--,g()}))}},A=async x=>{if(t.tileRoots?.has(x))return;const I=`${n}${e.dbName}/${x}`;try{const S=await this.loadModelFile(I);if(S?.watermark&&this.watermarkEnabled,!S)return;const R=this.buildModelPrimitives({...t,formData:t.formData},S,t.buildOptions);t.groundRoot.add(R.root),t.tileRoots?.set(x,R.root),t.sourceDataList.push(S),this.mapLayers[t.modelId]||(this.mapLayers[t.modelId]={}),this.mergeLayerItemsMap(this.mapLayers[t.modelId],R.layerItemsMap),t.loadedChunks=(t.loadedChunks||1)+1,this.events.emit("chunkProgress",{modelId:t.modelId,loaded:t.loadedChunks,total:t.totalChunks}),t._overviewLODCheck?.(),this.viewer.scene.requestRender()}catch(S){console.error("Failed to load CAD tile:",I,S)}},v=()=>{if(!t.tileRoots)return;const x=this.viewer?.camera?.positionCartographic?.height??1/0,I=x<1e3;for(const S of l){if(S.file==="cad.zip"||!t.tileRoots.has(S.file))continue;let R=!1;S.isFont?I&&c(S)||(R=!0):c(S)?x>=1500&&(R=!0):R=!0,R&&(y(S.file),h(S.file),S.isFont&&!t.pendingFontTiles?.includes(S.file)&&t.pendingFontTiles?.push(S.file))}for(const S of l)if(S.file!=="cad.zip"&&!t.tileRoots.has(S.file)&&!u.has(S.file)&&!m.includes(S.file)&&!(S.isFont&&!I)&&!(!S.isFont&&x>=1500)&&c(S)){const R=S.file,b=setTimeout(()=>{u.delete(R),!t.tileRoots?.has(R)&&c(S)&&!m.includes(R)&&(m.push(R),g())},20);u.set(S.file,b)}};let C=null;const w=()=>{C&&clearTimeout(C),C=setTimeout(()=>{C=null,v()},20)},M=this.viewer?.camera?.moveEnd?.addEventListener?.(w);typeof M=="function"&&(t.tileCameraListenerRemove=()=>{C&&clearTimeout(C),M()}),t._tileLODCheck=v,v()}beginEditGISCad({modelId:e}){const t=this.getRuntimeModel(e);return t?(t.isEditing||(t.isEditing=!0,t.editingFormData={...t.formData},this.rebuildPreviewRoot(t)),t):null}adjustGISCadModel(e){const t=this.getRuntimeModel(e.modelId);return t?(t.formData={...t.formData,...e,modelId:t.modelId,scale:Math.max(1e-6,Number(e.scale??t.formData.scale))},e.clampToGround!==void 0&&(t.buildOptions.clampToGround=e.clampToGround),this.replaceGroundRoot(t,t.formData),this.flyToBounds(t,{duration:0,minHeight:t._rebuildContext?.overviewL1Height}),t.formData):null}commitEditGISCad({modelId:e}){const t=this.getRuntimeModel(e);return t&&(t.previewRoot&&(this.removeModelNode(t.root,t.previewRoot),t.previewRoot=null),t.isEditing=!1,t.editingFormData=null,t)}cancelEditGISCad({modelId:e}){const t=this.getRuntimeModel(e);return t?(t.previewRoot&&(this.removeModelNode(t.root,t.previewRoot),t.previewRoot=null),t.groundRoot&&(t.groundRoot.show=t.show!==!1),t.isEditing=!1,t.editingFormData=null,t):null}deleteCad({modelId:e}){this.mapLayers[e]&&delete this.mapLayers[e];const t=this.gisCadModelsList.findIndex(n=>n.modelId===e);if(t>-1){const n=this.gisCadModelsList[t];n.tileCameraListenerRemove?.(),n.overviewLODListenerRemove?.(),this.viewer.scene.primitives.remove(n.root),n.root?.destroy&&!n.root.isDestroyed?.()&&n.root.destroy(),this.gisCadModelsList.splice(t,1)}}deleteAllCad(){[...this.gisCadModelsList].forEach(e=>{e.modelId&&this.deleteCad({modelId:e.modelId})})}}class ki{constructor(e,t){if(this.viewer=e,!this.viewer)return;this.type="prompt",t=t||{};const n=t.type==null?1:t.type;let s={id:new Date().getTime()+""+Math.floor(Math.random()*1e4),type:n,anchor:n==2,closeBtn:n==2,offset:n==2?{x:0,y:-20}:{x:10,y:10},content:"",show:!0,style:{background:"rgba(0,0,0,0.5)",color:"white"}};this.opt=Object.assign(s,t),this.attr=this.opt;const o=this.viewer.container.id;this.isShow=this.opt.show==null?!0:this.opt.show;let r="",a="";const l=this.opt.style.background,c=this.opt.style.color;this.opt.anchor&&(r+=`
|
|
17
17
|
<div class="prompt-anchor-container">
|
|
18
18
|
<div class="prompt-anchor" style="background:${l} !important;">
|
|
19
19
|
</div>
|
|
@@ -118,7 +118,7 @@ northing meters`+i;var p=u/2,f=0,m=0,y,g,A,v,C;return p>0&&(y=1e5/Math.pow(10,p)
|
|
|
118
118
|
// 通常不需要 clamp,除非开启 HDR 后期望超亮,但负值需要避免
|
|
119
119
|
material.diffuse = max(material.diffuse, vec3(0.0));
|
|
120
120
|
}
|
|
121
|
-
`});p.isModelAdjustment=!0,u.customShader=p}else e.brightness!==void 0&&e.brightness!==1&&!u.style&&(u.style=new n.Cesium3DTileStyle({color:`color('white') * ${e.brightness}`}))}}setModelBrightness(e){this.setModelColorAdjustment({brightness:e})}_defaultSkyBox=null;_updateLightDirection=e=>{e.light instanceof this.cesium.DirectionalLight&&(e.light.direction=e.camera.directionWC)};setEnvironmentMapEnable(e){this.is2d||(e?(this.viewer.scene.light=new this.cesium.DirectionalLight({direction:this.viewer.scene.camera.directionWC}),this.viewer.scene.preRender.addEventListener(this._updateLightDirection)):(this._defaultSkyBox&&(this.viewer.scene.skyBox=this._defaultSkyBox),this.viewer.scene.preRender.removeEventListener(this._updateLightDirection),this.viewer.scene.light=new this.cesium.SunLight),this.viewer.scene.imageBasedLighting&&(this.viewer.scene.imageBasedLighting.imageBasedLightingFactor=e?new this.cesium.Cartesian2(2,2):new this.cesium.Cartesian2(1,1)))}setAmbientOcclusion(e){if(this.is2d)return;const t=this.viewer.scene;if(!t||!t.postProcessStages||!t.postProcessStages.ambientOcclusion)return;const n=t.postProcessStages.ambientOcclusion;n.enabled=e,e&&(n.uniforms.ambientOcclusionOnly=!1,n.uniforms.intensity=3,n.uniforms.bias=.1,n.uniforms.lengthCap=.03,n.uniforms.stepSize=1,n.uniforms.blurStepSize=.86)}setCollisionDetection(e){if(this.is2d){this.viewer.scene.screenSpaceCameraController.enableCollisionDetection=!1;return}const t=this.viewer.scene.screenSpaceCameraController;t.enableCollisionDetection=e,e||t.minimumZoomDistance<1&&(t.minimumZoomDistance=1)}_customZoomHandler=null;setHeightBasedZoom(e){const t=this.viewer.scene.screenSpaceCameraController,n=this.cesium;if(this.viewer.camera.frustum.near=1e-4,this.viewer.camera.frustum.far=1e8,e||(this.viewer.camera.frustum.near=.1),this._customZoomHandler&&(this._customZoomHandler.destroy(),this._customZoomHandler=null),!e){t.zoomEventTypes.includes(n.CameraEventType.WHEEL)||t.zoomEventTypes.push(n.CameraEventType.WHEEL);return}t.zoomEventTypes=t.zoomEventTypes.filter(o=>o!==n.CameraEventType.WHEEL),this._customZoomHandler=new n.ScreenSpaceEventHandler(this.viewer.scene.canvas);let s=null;this._customZoomHandler.setInputAction(o=>{s=o.endPosition},n.ScreenSpaceEventType.MOUSE_MOVE),this._customZoomHandler.setInputAction(o=>{const r=this.viewer.camera,a=r.positionCartographic.height,l=Math.sign(o);if(a<.15&&l>0){pe.info("无法继续放大");return}const c=.3;let h=0;if(l>0){const m=a-1;h=m>0?m*c:0}else h=a*c;h=Math.max(.1,h),console.log(a);let u=null;if(!s)u=r.direction;else{const m=r.getPickRay(s);if(m){let y=this.viewer.scene.pickPosition(s);if(!y){const g=n.IntersectionTests.rayEllipsoid(m,this.viewer.scene.globe.ellipsoid);g&&(y=n.Ray.getPoint(m,g.start))}if(y){const g=n.Cartesian3.subtract(y,r.position,new n.Cartesian3);u=n.Cartesian3.normalize(g,new n.Cartesian3)}else u=r.direction}else u=r.direction}const p=l>0?h:-h*2,f=n.Cartesian3.multiplyByScalar(u,p,new n.Cartesian3);r.position=n.Cartesian3.add(r.position,f,new n.Cartesian3)},n.ScreenSpaceEventType.WHEEL)}setMouseHabit(e){if(this.is2d)return;const t=this.viewer.scene.screenSpaceCameraController;t.enableTranslate=!0,t.enableRotate=!0,t.enableZoom=!0,t.enableTilt=!0,t.enableLook=!1,t.lookEventTypes=[],e===1?(t.rotateEventTypes=[this.cesium.CameraEventType.RIGHT_DRAG],t.zoomEventTypes=[this.cesium.CameraEventType.MIDDLE_DRAG,this.cesium.CameraEventType.WHEEL,this.cesium.CameraEventType.PINCH],t.tiltEventTypes=[this.cesium.CameraEventType.PINCH,this.cesium.CameraEventType.LEFT_DRAG]):(t.rotateEventTypes=[this.cesium.CameraEventType.LEFT_DRAG],t.zoomEventTypes=[this.cesium.CameraEventType.RIGHT_DRAG,this.cesium.CameraEventType.WHEEL,this.cesium.CameraEventType.PINCH],t.tiltEventTypes=[this.cesium.CameraEventType.PINCH,this.cesium.CameraEventType.MIDDLE_DRAG])}}class bB{cesium;viewer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}getCameraView(){const e=this.viewer.camera;return{position:{x:e.position.x,y:e.position.y,z:e.position.z},destination:{x:e.position.x,y:e.position.y,z:e.position.z},orientation:{heading:e.heading,pitch:e.pitch,roll:e.roll},duration:1}}flyToCameraView(e){const{position:t,orientation:n,duration:s}=e,o=new this.cesium.Cartesian3(t.x,t.y,t.z),r=new this.cesium.HeadingPitchRoll(n.heading,n.pitch,n.roll);!s||s<=0?this.viewer.camera.setView({destination:o,orientation:r}):this.viewer.camera.flyTo({destination:o,orientation:r,duration:s})}getCurrentCameraPositionAndTarget(){const e=this.getCameraView();return{position:e.position,target:{heading:e.orientation.heading,pitch:e.orientation.pitch,roll:e.orientation.roll},duration:e.duration}}setCameraView(e){const t=e.target||e.orientation||{},n=e.destination||e.position||{};this.flyToCameraView({position:{x:Number(n.x),y:Number(n.y),z:Number(n.z)},destination:{x:Number(n.x),y:Number(n.y),z:Number(n.z)},orientation:{heading:Number(t.heading||0),pitch:Number(t.pitch||0),roll:Number(t.roll||0)},duration:e.duration})}flyToLonLatHeight(e,t,n,s=1){const o=this.cesium.Cartesian3.fromDegrees(e,t,n),r={heading:this.cesium.Math.toRadians(0),pitch:this.cesium.Math.toRadians(-90),roll:0};!s||s<=0?this.viewer.camera.setView({destination:o,orientation:r}):this.viewer.camera.flyTo({destination:o,orientation:r,duration:s})}}function CB(i){const{container:e,appContext:t,methods:n,viewerOptions:s,options:o,callbacks:r}=i,a=new _s,l=window.Cesium;if(!l)throw new Error("Cesium is not loaded");e.id=`cesium-container-${cw()}`;const c={animation:!1,timeline:!1,infoBox:!1,homeButton:!1,fullscreenButton:!1,sceneModePicker:!1,navigationHelpButton:!1,geocoder:!1,baseLayerPicker:!1,selectionIndicator:!1,heightBasedZoom:!0,creditContainer:document.createElement("div"),contextOptions:{webgl:{alpha:!0}}},h=t?.config?.globalProperties?.$leitingBimOptions,u={...c,...h?.viewerOptions??{},...s??{}},p=new l.Viewer(e,u);p.camera.setView({destination:l.Cartesian3.fromDegrees(108,32,1e7),orientation:{heading:l.Math.toRadians(0),pitch:l.Math.toRadians(-90),roll:0}});let f=n;if(!f&&h&&(h.methods||(h.methods={}),f=h.methods),f){const m=new Ew({cesium:l,viewer:p,options:o,callbacks:r}),y=new ju({cesium:l,viewer:p}),g=new vB({cesium:l,viewer:p}),A=new xw({cesium:l,viewer:p}),v=new TS({cesium:l,viewer:p}),C=o?.watermark!==!1;y.watermarkEnabled=C,v.watermarkEnabled=C;const w=new bB({cesium:l,viewer:p});let M;const x=new uc({cesium:l,viewer:p});o&&(o.globe!==void 0&&g.setGlobeEnvironmentVisible(o.globe),o.terrain!==void 0&&g.setTerrainEnable(o.terrain),o.depthTest!==void 0&&g.setDepthTestEnable(o.depthTest),o.mapProvider&&o.mode!=="2d"&&g.changeBaseMap(o.mapProvider,{token:o.tiandituToken,layerType:o.tiandituLayerType,showAnnotation:o.tiandituShowLabel,url:o.arcgisUrl}),o.shadows!==void 0&&g.setShadowsEnable(o.shadows),o.environmentMap!==void 0&&g.setEnvironmentMapEnable(o.environmentMap),o.ambientOcclusion!==void 0&&g.setAmbientOcclusion(o.ambientOcclusion),o.time!==void 0&&g.setTime(o.time),o.brightness!==void 0&&g.setModelBrightness(o.brightness),o.backgroundColor!==void 0&&g.setBackgroundColor(o.backgroundColor),o.collision!==void 0&&g.setCollisionDetection(o.collision),o.mouseHabit!==void 0&&g.setMouseHabit(o.mouseHabit),o.heightBasedZoom!==void 0&&g.setHeightBasedZoom(o.heightBasedZoom)),o&&o.mode==="2d"&&(console.log("InitMap: Setting CAD Mode 2D"),g.setCadMode("2d"),M=new dm({cesium:l,viewer:p})),y.events.on("tilesetLoaded",b=>{m.baseCompt.attachTileset(b,m.baseCompt.selectedColor),m.baseSection.attachTileset(b,b.leiting?.model?.modelId),f&&f.tilesLoad3dTiles&&f.tilesLoad3dTiles(b),o?.tilesLoad3dTiles&&o.tilesLoad3dTiles(b.leiting)}),y.events.on("loadingStatus",b=>{f&&f.onLoadingStatus&&f.onLoadingStatus(b)}),y.events.on("mountAll3Dtiles",({modelList:b})=>{o?.mountAll3Dtiles&&o.mountAll3Dtiles(b),f?.mountAll3Dtiles&&f.mountAll3Dtiles(b)}),y.events.on("configureLoaded",b=>{f.setConfigure(b)}),y.events.on("updateModels",({modelList:b})=>{o?.updateModels&&o.updateModels(b),f?.updateModels&&f.updateModels(b)}),A.events.on("mountAllCad",b=>{o?.mountAllCad&&o.mountAllCad(b),f?.mountAllCad&&f.mountAllCad(b)}),v.events.on("mountAllGISCad",b=>{o?.mountAllGISCad&&o.mountAllGISCad(b),f?.mountAllGISCad&&f.mountAllGISCad(b)}),m.baseCompt.loadNodeDetailsForModel=b=>y.loadNodeDetailsForModel(b),m.baseCompt.selectionChange(b=>{b.length!==0&&(o?.selectionChange&&o.selectionChange(b),f?.selectionChange&&f.selectionChange(b))}),f.onSearchComponent=b=>{o?.searchComponent&&o.searchComponent(b),f?.searchComponent&&f.searchComponent(b)};const I=f.saveRegion;f.saveRegion=b=>{o?.saveRegion&&o.saveRegion(b),I&&I!==o?.saveRegion&&I(b)};const S=f.saveCadCalibration;f.saveCadCalibration=b=>{o?.saveCadCalibration&&o.saveCadCalibration(b),S&&S!==o?.saveCadCalibration&&S(b)};const R=f.saveCadRegion;f.saveCadRegion=b=>{o?.saveCadRegion&&o.saveCadRegion(b),R&&R!==o?.saveCadRegion&&R(b)},f.getCesium=()=>l,f.getViewer=()=>p,f.getAnnotationInstance=()=>M,f.getMeasureInstance=()=>x,f.flyToCamera=b=>{w.setCameraView(b)},f.flyToLonLatHeight=(b,B,L,O=1)=>{w.flyToLonLatHeight(b,B,L,O)},f.flyTo=f.flyToCamera,f.getCameraState=()=>w.getCameraView(),f.getCameraInfo=f.getCameraState,f.restoreCameraState=b=>w.flyToCameraView(b),f.flyToCameraView=f.restoreCameraState,f.getCameraPositionTarget=()=>w.getCurrentCameraPositionAndTarget(),f.getCurrentCameraPositionAndTarget=f.getCameraPositionTarget,f.setCameraLookAt=b=>w.setCameraView(b),f.setCameraView=f.setCameraLookAt,f.setCanvasBackground=b=>g.setBackgroundColor(b),f.setBackgroundColor=f.setCanvasBackground,f.setAntiAliasing=b=>m.enableCesiumFXAA(b),f.enableCesiumFXAA=f.setAntiAliasing,f.setSceneVisibility=b=>m.setSceneOptions(b),f.setSceneOptions=f.setSceneVisibility,f.addDebugPoint=(b,B,L=0)=>{p.entities.add({position:l.Cartesian3.fromDegrees(b,B,L),point:{pixelSize:10,color:l.Color.RED}})},f.addPoint=f.addDebugPoint,f.toggleDebugLabels=()=>m.enableTestLabel(),f.enableTestLabel=f.toggleDebugLabels,f.captureScreenshot=()=>{const b=p.scene.canvas;return p.render(),b.toDataURL("image/png")},f.getImageBase64=f.captureScreenshot,f.captureDomScreenshot=(b,B)=>m.getSnapDomSImageBase64(b,B),f.getSnapDomSImageBase64=f.captureDomScreenshot,f.addModels=b=>y.addModels(b),f.add3DtilesModel=f.addModels,f.addObliquePhotography=b=>y.addOSGB(b),f.addOSGB=f.addObliquePhotography,f.adjustOSGBModelMatrix=b=>y.updateOSGBMatrix(b),f.updateOSGBMatrix=f.adjustOSGBModelMatrix,f.setModelVisibility=b=>y.showModels(b),f.showModels=f.setModelVisibility,f.showTileset=f.setModelVisibility,f.removeModels=b=>y.deleteModels(b),f.deleteModels=f.removeModels,f.clearAllModels=()=>{y.deleteAllModels(),a.emit("deleteAllModels")},f.deleteAllModelList=f.clearAllModels,f.deleteAllModels=f.clearAllModels,f.flyToModel=b=>y.flyToTileset(b),f.flyToTileset=f.flyToModel,f.flyToByModelId=f.flyToModel,f.setModelBrightness=b=>m.updateModelEffect(b),f.updateModelEffect=f.setModelBrightness,f.getAllTilesets=()=>y.getMapTileset(),f.getMapTileset=f.getAllTilesets,f.getCurrentModelId=()=>y.getBIMmodelId(),f.getBIMmodelId=f.getCurrentModelId,f.getLoadedModels=()=>y.getModelList(),f.getModelList=f.getLoadedModels,f.loadModelStructure=async b=>{const B=typeof b=="string"?b:b?.modelId;if(!B){console.warn("loadModelStructure: modelId is required");return}return await y.loadTreeForModel(B)},f.loadTreeForModel=f.loadModelStructure,f.loadModelDetails=async b=>{const B=typeof b=="string"?b:b?.modelId;if(!B){console.warn("loadModelDetails: modelId is required");return}return await y.loadNodeDetailsForModel(B)},f.loadNodeDetailsForModel=f.loadModelDetails,f._loadNodeDetailsForModel=async b=>{const B=typeof b=="string"?b:b?.modelId;if(!B){console.warn("loadModelDetails: modelId is required");return}return await y._loadNodeDetailsForModel(B)},f.setMapTileset=b=>y.setMapTileset(b),f.setCurrentModelId=b=>y.setBIMmodelId(b),f.setBIMmodelId=f.setCurrentModelId,f.setModelList=b=>y.setModelList(b),f.highlightComponents=(b,B={})=>m.baseCompt.setSelectColorUserModelCpt(b,B),f.setSelectColorUserModelCpt=f.highlightComponents,m.baseCompt.setLoadNodeDetailsCallback(b=>y.loadNodeDetailsForModel(b)),f.highlightAllComponents=(b,B)=>m.baseCompt.setAllSelectColorUserModelCpt(b,B),f.setAllSelectColorUserModelCpt=f.highlightAllComponents,f.setSelectColorUserModelCptByClear=(b,B)=>{m.baseCompt.clearAllHaveSelected(),m.baseCompt.setSelectColorUserModelCpt(b.selectCpts,B??{rank:0})},f.clearSelectColorUserModelCpt=()=>m.baseCompt.clearAllHaveSelected(),f.selectComponents=(b,B)=>{m.baseCompt.clearAllHaveSelected(),m.baseCompt.setSelectColorUserModelCpt(b,B??{rank:0})},f.setSelecteds=f.selectComponents,f.setSelectionColor=(b,B,L,O)=>m.baseCompt.setSelectedColorRgba(b,B,L,O),f.setSelectedColor=f.setSelectionColor,f.clearSelection=()=>m.baseCompt.clearAllHaveSelected(),f.clearAllHaveSelected=f.clearSelection,f.getSelectedComponents=b=>m.baseCompt.getSelected(b),f.getSelected=f.getSelectedComponents,f.setClickToHighlightEnabled=b=>{m.baseCompt.clickToHighlightEnabled=b},f.getClickToHighlightEnabled=()=>m.baseCompt.clickToHighlightEnabled,f.onSelectionChange=b=>{m.baseCompt.selectionChange(b)},f.selectionChange=f.onSelectionChange,f.flyToComponents=b=>m.baseCompt.flyToObjects(b),f.flyToObjects=f.flyToComponents,f.setConstructionData=async b=>{if(b&&Array.isArray(b)){const B=new Set;b.forEach(L=>{L.mergeCpts&&Array.isArray(L.mergeCpts)&&L.mergeCpts.forEach(O=>{O.modelId&&B.add(O.modelId)})}),B.size>0&&await Promise.all(Array.from(B).map(L=>f.loadNodeDetailsForModel(L)))}m.baseCompt.setAllConstructionProgressTracking(b)},f.setAllConstructionProgressTracking=f.setConstructionData,f.startConstructionSimulation=()=>m.baseCompt.enableConstructionProgressTracking(),f.enableAllConstructionProgressTracking=f.startConstructionSimulation,f.stopConstructionSimulation=()=>m.baseCompt.disableConstructionProgressTracking(),f.disableConstructionProgressTracking=f.stopConstructionSimulation,f.disableAllConstructionProgressTracking=f.stopConstructionSimulation,f.resetConstructionSimulation=()=>m.baseCompt.freshConstructionProgressTracking(),f.freshConstructionProgressTracking=f.resetConstructionSimulation,f.restartConstructionSimulation=()=>m.baseCompt.reStartAnimation(),f.reStartAnimation=f.restartConstructionSimulation,f.resumeFlyTo=()=>m.baseCompt.resumeFlyTo(),f.pauseConstructionSimulation=()=>m.baseCompt.pauseFlyTo(),f.pauseFlyTo=f.pauseConstructionSimulation,f.pauseAnimation=f.pauseConstructionSimulation,f.resumeConstructionSimulation=()=>m.baseCompt.resumeFlyTo(),f.resumeAnimation=f.resumeConstructionSimulation,f.setComponentsVisibility=async b=>await m.baseCompt.setComponentVisibility(b),f.setElementsListVisible=f.setComponentsVisibility,f.setAllComponentsVisibility=async b=>await m.baseCompt.setAllComponentsVisibility(b),f.setAllElementsVisible=f.setAllComponentsVisibility,f.isolateComponents=b=>m.baseCompt.isolateComponentVisibility(b),f.isolateComponentVisibility=f.isolateComponents,f.getComponentsByVisibility=b=>m.baseCompt._getComponentsByVisibility(b),f.getShowCpts=b=>m.baseCompt.getComponentsByVisibility(b),f.getElementsVisible=b=>m.baseCompt.getComponentsByVisibility(b),f.setComponentVisibility=f.setComponentsVisibility,f.enableSectioning=(b,B)=>m.baseSection.open(b,B),f.openSection=f.enableSectioning,f.disableSectioning=b=>m.baseSection.close(b),f.closeSection=f.disableSectioning,f.updateSectionBox=b=>m.baseSection.updateRange(b),f.updateSectionRange=f.updateSectionBox,f.getSectionBox=()=>m.baseSection.getRange(),f.getSectionRange=f.getSectionBox,f.fitSectionToModel=()=>m.baseSection.fitToModels(),f.fitToModels=f.fitSectionToModel,f.setSectionBoxVisibility=b=>m.baseSection.setBoxVisibility(b),f.startFirstPersonMode=()=>{m.baseCompt.disableSelection(),m.basePlayer.openPlayer()},f.openPlayer=f.startFirstPersonMode,f.startCameraRoam=()=>{m.baseCompt.disableSelection(),m.basePlayer.openCameraRoam()},f.stopFirstPersonMode=()=>{m.basePlayer.closePlayer(),m.baseCompt.enableSelection()},f.closePlayer=f.stopFirstPersonMode,f.setPlayerPosition=b=>m.basePlayer.setPersonPosition(b),f.setPersonPosition=f.setPlayerPosition,f.setPlayerDefaultPosition=()=>m.basePlayer.setDefaultPosition(),f.setWalkSpeed=b=>m.basePlayer.setSpeed({speed:b}),f.setPlayerSpeed=f.setWalkSpeed,f.setPlayerConfig=b=>m.basePlayer.setParams(b),f.setPlayerParams=f.setPlayerConfig,f.setPlayerAction=(b,B)=>m.basePlayer.setMoveState(b,B),f.setPlayerMoveState=f.setPlayerAction,f.bindPlayerControls=b=>m.basePlayer.bindUiKeys(b),f.bindPlayerUiKeys=f.bindPlayerControls,f.setGlobeVisibility=b=>g.setGlobeEnvironmentVisible(b),f.setGlobeEnvironmentVisible=f.setGlobeVisibility,f.setTerrainVisibility=b=>g.setTerrainEnable(b),f.setTerrainEnable=f.setTerrainVisibility,f.setDepthTest=b=>g.setDepthTestEnable(b),f.setDepthTestEnable=f.setDepthTest,f.setBaseMap=(b,B)=>g.changeBaseMap(b,B),f.changeBaseMap=f.setBaseMap,f.setWorldTime=b=>g.setTime(b),f.setTime=f.setWorldTime,f.setGisOptions=b=>{b.globe!==void 0&&g.setGlobeEnvironmentVisible(b.globe),b.elevation!==void 0&&g.setTerrainEnable(b.elevation),b.depthTestAgainstTerrain!==void 0&&g.setDepthTestEnable(b.depthTestAgainstTerrain),b.rendering!==void 0&&g.setAmbientOcclusion(b.rendering)},f.setShadowVisibility=b=>g.setShadowsEnable(b),f.setShadowsEnable=f.setShadowVisibility,f.setEnvironmentMapVisibility=b=>g.setEnvironmentMapEnable(b),f.setEnvironmentMapEnable=f.setEnvironmentMapVisibility,f.setAOVisibility=b=>g.setAmbientOcclusion(b),f.setAmbientOcclusion=f.setAOVisibility,f.setBackgroundColor=b=>g.setGlobeColor(b),f.setGlobeColor=f.setBackgroundColor,f.setModelBrightness=b=>g.setModelBrightness(b),f.adjustModelColor=b=>g.setModelColorAdjustment(b),f.setModelColorAdjustment=f.adjustModelColor,f.setShadowIntensity=b=>{g.setShadowDarkness?g.setShadowDarkness(b):console.warn("baseSetting.setShadowDarkness is not available. Please reload the page.")},f.setShadowDarkness=f.setShadowIntensity,f.switchSceneMode=async b=>{const B=b?"2d":"3d";await g.setCadMode(B),b&&!M&&(M=new dm({cesium:l,viewer:p}),f.setGlobeVisibility(!0)),a.emit("setMode",B)},f.setSceneMode=f.switchSceneMode,f.set2d=b=>f.switchSceneMode(b),f.is2dMode=()=>g.is2d,f.setMouseControlMode=b=>g.setMouseHabit(b),f.setMouseHabit=f.setMouseControlMode,f.setCollisionEnabled=b=>g.setCollisionDetection(b),f.setCollisionDetection=f.setCollisionEnabled,f.searchAndLocate=(b,B)=>g.searchLocation(b,B),f.searchLocation=f.searchAndLocate,f.getConfigure=()=>(console.warn("getConfigure is not initialized. Please ensure LeitingSetting component is mounted."),{}),f.setConfigure=b=>{console.warn("setConfigure is not initialized. Please ensure LeitingSetting component is mounted.",b)},f.addCadModel=b=>{const B={...b};return B.files&&!B.fileNames&&(B.fileNames=B.files),B.fileNames||(B.fileNames=[]),A.addDxfModel(B)},f.addDxfModel=f.addCadModel,f.addGISCadModel=b=>{const B={...b};return B.files&&!B.fileNames&&(B.fileNames=B.files),B.fileNames||(B.fileNames=[]),v.addGISCadModel(B)},f.addVectorTileByUrlTemplate=b=>v.addVectorTileByUrlTemplate(b),f.addVectorTileByTilesManifest=b=>v.addVectorTileByTilesManifest(b),f.showGISCadModel=b=>v.showJson(b),f.addGeoJsonLayer=b=>v.addGeoJsonLayer(b),f.showGISCadLayer=b=>v.showJsonByLayer(b),f.deleteGISCad=b=>v.deleteCad(b),f.deleteAllGISCad=()=>v.deleteAllCad(),f.flyToGISCadModel=(b={})=>v.flyToCadModel(b),f.flyGisCadModel=b=>v.flyToCadModel({modelId:b}),f.getGISCadModels=b=>v.getDxfModels(b),f.getGISCadModelsList=()=>v.getDxfModelsList(),f.getGISCadLayers=b=>v.getMapLayers(b),f.getGISCadModelId=()=>v.getModelId(),f.getDefaultGISCadTransformConfig=()=>v.getDefaultCoordinateTransformConfig(),f.transformGISCadCoordinate=b=>v.transformCoordinate(b),f.beginEditGISCad=b=>v.beginEditGISCad(b),f.adjustGISCadModel=b=>v.adjustGISCadModel(b),f.commitEditGISCad=b=>v.commitEditGISCad(b),f.cancelEditGISCad=b=>v.cancelEditGISCad(b),f.deleteCad=b=>A.deleteCad(b),f.deleteAllCad=()=>A.deleteAllCad(),f.showCadModel=b=>A.showJson(b),f.showGeoJson=b=>A.showJson(b),f.showDxfModel=f.showCadModel,f.showCadLayer=b=>A.showJsonByLayer(b),f.showDxfLayer=f.showCadLayer,f.flyToCadModel=(b={})=>A.flyToCadModel(b),f.getCadModels=b=>A.getDxfModels(b),f.getDxfModels=f.getCadModels,f.getCadLayers=b=>A.getMapLayers(b),f.getDxfLayers=f.getCadLayers,f.getCadModelId=()=>A.getModelId(),f.setCadOpen=b=>A.setDxfOpen(b),f.setDxfOpen=f.setCadOpen,f.getCadOpen=()=>A.getDxfOpen(),f.getDxfOpen=f.getCadOpen,f.adjustCadModel=b=>A.adjustingModelByCad(b),f.adjustingModelByCad=f.adjustCadModel,f.saveAnnotations=()=>{let b=null;return M&&(b=M.saveAnnotations()),o?.saveAnnotations&&o.saveAnnotations(b),b},f.loadAnnotations=b=>M?M.loadAnnotations(b):!1,f.flyToTopView=()=>{A.flyToCadModel()},f.menuEvents=a,f.addMenuItems=b=>{a.emit("insertMenu",b)},f.insertMenu=f.addMenuItems,f.filterMenuItems=b=>{a.emit("setMenuListFilter",b)},f.setMenuListFilter=f.filterMenuItems,f.setMenuVisibility=b=>{a.emit("showMenu",b)},f.showMenu=f.setMenuVisibility,f.setPanelVisibility=(b,B)=>{a.emit("setMenuActive",b,B)},f.setMenuActive=f.setPanelVisibility,f.addContextMenuItems=b=>{console.warn("addContextMenuItems is not initialized yet. Please wait for LeitingBIM component to mount.",b)},f.insertContextMenu=f.addContextMenuItems,f.removeContextMenuItems=b=>{console.warn("removeContextMenuItems is not initialized yet.",b)},f.deleteContextMenu=f.removeContextMenuItems,f.closeContextMenu=()=>{console.warn("closeContextMenu is not initialized yet.")},f.hideContextMenu=f.closeContextMenu,f.getModelTree=()=>{const b=[],B=y.getMapTileset();return Object.keys(B).forEach(L=>{const O=B[L];if(O&&O.leiting&&O.leiting.tree){const N=O.leiting.tree;Array.isArray(N)?b.push(...N):b.push(N)}}),b},f.getTree=f.getModelTree,f.getAllComponentDetails=()=>{const b=y.getMapTileset(),B={},L=[];try{Object.keys(b).forEach(O=>{const N=b[O];if(!N||!N.leiting)return;const D=N.leiting,E=D.node,T=D.model.formData,P=D.box;if(!E||!E.nodeExtras)return;const F=D.model.modelId;B[F]=E.nodeExtras;const V=E.nodeExtras.element;if(!V)return;const G=P?P.center:{x:0,y:0,z:0};Object.values(V).forEach(k=>{if(k.box3)try{const _=l.Quaternion.fromAxisAngle(l.Cartesian3.UNIT_Z,l.Math.toRadians(T.totalRotation||0)),U=l.Matrix4.fromRotationTranslation(l.Matrix3.fromQuaternion(_),new l.Cartesian3(0,0,0)),H=l.Cartesian3.fromDegrees(T.longitude,T.latitude,T.height),q=l.Transforms.eastNorthUpToFixedFrame(H);l.Matrix4.multiply(q,U,q);const X=new l.Cartesian3(G.x,G.y,0),de=new l.Cartesian3;l.Matrix4.multiplyByPoint(q,X,de);const fe=l.Cartographic.fromCartesian(de),me=k.box3?.Center?.x||0,be=k.box3?.Center?.y||0,_e=k.box3?.Center?.z||0,Je=new l.Cartesian3(-G.x+me,-G.y+be,0+_e),lt=l.Matrix4.fromTranslation(Je),ct=l.Matrix4.clone(lt);l.Matrix4.multiply(U,ct,ct);const Bt=l.Cartesian3.fromDegrees(fe.longitude/Math.PI*180,fe.latitude/Math.PI*180,T.height),vt=l.Transforms.eastNorthUpToFixedFrame(Bt);l.Matrix4.multiply(vt,ct,vt);const j=l.Cartographic.fromCartesian(new l.Cartesian3(vt[12],vt[13],vt[14]));k.box3.cartographic={longitude:j.longitude/Math.PI*180,latitude:j.latitude/Math.PI*180,height:j.height};const Y={id:k.uniqueId,billboard:[{theme:"Tag9999",position:[k.box3.cartographic.longitude,k.box3.cartographic.latitude,k.box3.cartographic.height],options:{text:k.name}}]};L.push(Y)}catch(_){console.warn("Error calculating component position:",_)}})})}catch(O){console.error("getAllComponents error:",O)}return B},f.getAllComponents=f.getAllComponentDetails,f.getComponentInfoList=async b=>{if(!Array.isArray(b))return[];const B=y.getMapTileset(),L=[],O=[],N={};b.forEach(E=>{const P=B[E.modelId]?.leiting?.model?.dbName;P&&E.elementId&&O.push({dbName:P,elementId:E.elementId,modelId:E.modelId})});const D=new Set;if(b.forEach(E=>{const T=B[E.modelId],P=`${E.modelId}_${E.elementId}`;N[P]||T&&T.leiting&&!T.leiting?.node?.nodeExtras&&T.leiting.model?.nodeUrl&&D.add(E.modelId)}),D.size>0&&y._loadNodeDetailsForModel)try{const E=Array.from(D).map(T=>y._loadNodeDetailsForModel(T));await Promise.all(E)}catch(E){console.error("Failed to load node details in getComponentInfoList",E)}try{b.forEach(E=>{const T=E.modelId,P=E.elementId,F=B[T];if(!F||!F.leiting)return;const V=`${T}_${P}`,G=N[V];let k=null;if(G)k=G;else{const _=F.leiting.node?.nodeExtras?.element||F.leiting.node?.nodeExtras;_&&_[P]&&(k=JSON.parse(JSON.stringify(_[P])))}if(k){if(k.elementId=P,k.modelId=T,k.box3&&!k.box3.cartographic)try{const _=F.leiting,U=_.model.formData,H=_.box,q=H?H.center:{x:0,y:0,z:0},X=l.Quaternion.fromAxisAngle(l.Cartesian3.UNIT_Z,l.Math.toRadians(U.totalRotation||0)),de=l.Matrix4.fromRotationTranslation(l.Matrix3.fromQuaternion(X),new l.Cartesian3(0,0,0)),fe=l.Cartesian3.fromDegrees(U.longitude,U.latitude,U.height),me=l.Transforms.eastNorthUpToFixedFrame(fe);l.Matrix4.multiply(me,de,me);const be=new l.Cartesian3(q.x,q.y,0),_e=new l.Cartesian3;l.Matrix4.multiplyByPoint(me,be,_e);const Je=l.Cartographic.fromCartesian(_e),lt=k.box3?.Center?.x||0,ct=k.box3?.Center?.y||0,Bt=k.box3?.Center?.z||0,vt=new l.Cartesian3(-q.x+lt,-q.y+ct,0+Bt),j=l.Matrix4.fromTranslation(vt),Y=l.Matrix4.clone(j);l.Matrix4.multiply(de,Y,Y);const te=l.Cartesian3.fromDegrees(Je.longitude/Math.PI*180,Je.latitude/Math.PI*180,U.height),ze=l.Transforms.eastNorthUpToFixedFrame(te);l.Matrix4.multiply(ze,Y,ze);const It=l.Cartographic.fromCartesian(new l.Cartesian3(ze[12],ze[13],ze[14]));k.box3.cartographic={longitude:It.longitude/Math.PI*180,latitude:It.latitude/Math.PI*180,height:It.height}}catch(_){console.warn("Error calculating component position:",_)}L.push(k)}})}catch(E){console.error("getComponentInfoList processing error:",E)}return L},f.getCptInfos=f.getComponentInfoList,f.baseCompt=m.baseCompt,f.setTeleportTarget=b=>{f.onSetTeleportTarget&&f.onSetTeleportTarget(b)},window.Methods=f}return console.log("methods",f),{Cesium:l,viewer:p,methods:f,menuEvents:a}}function mc(i){return d.getCurrentScope()?(d.onScopeDispose(i),!0):!1}function gc(i){return typeof i=="function"?i():d.unref(i)}const wB=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const EB=Object.prototype.toString,xB=i=>EB.call(i)==="[object Object]",IB=()=>{};function SB(i){return d.getCurrentInstance()}function fm(i,e=!0,t){SB()?d.onMounted(i,t):e?i():d.nextTick(i)}function ln(i){var e;const t=gc(i);return(e=t?.$el)!=null?e:t}const ro=wB?window:void 0;function MB(...i){let e,t,n,s;if(typeof i[0]=="string"||Array.isArray(i[0])?([t,n,s]=i,e=ro):[e,t,n,s]=i,!e)return IB;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const o=[],r=()=>{o.forEach(h=>h()),o.length=0},a=(h,u,p,f)=>(h.addEventListener(u,p,f),()=>h.removeEventListener(u,p,f)),l=d.watch(()=>[ln(e),gc(s)],([h,u])=>{if(r(),!h)return;const p=xB(u)?{...u}:u;o.push(...t.flatMap(f=>n.map(m=>a(h,f,m,p))))},{immediate:!0,flush:"post"}),c=()=>{l(),r()};return mc(c),c}function TB(){const i=d.ref(!1),e=d.getCurrentInstance();return e&&d.onMounted(()=>{i.value=!0},e),i}function pm(i){const e=TB();return d.computed(()=>(e.value,!!i()))}function mm(i,e={}){const{window:t=ro}=e,n=pm(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let s;const o=d.ref(!1),r=c=>{o.value=c.matches},a=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",r):s.removeListener(r))},l=d.watchEffect(()=>{n.value&&(a(),s=t.matchMedia(gc(i)),"addEventListener"in s?s.addEventListener("change",r):s.addListener(r),o.value=s.matches)});return mc(()=>{l(),a(),s=void 0}),o}function BB(i,e,t={}){const{window:n=ro,...s}=t;let o;const r=pm(()=>n&&"ResizeObserver"in n),a=()=>{o&&(o.disconnect(),o=void 0)},l=d.computed(()=>Array.isArray(i)?i.map(u=>ln(u)):[ln(i)]),c=d.watch(l,u=>{if(a(),r.value&&n){o=new ResizeObserver(e);for(const p of u)p&&o.observe(p,s)}},{immediate:!0,flush:"post"}),h=()=>{a(),c()};return mc(h),{isSupported:r,stop:h}}function _B(i,e={width:0,height:0},t={}){const{window:n=ro,box:s="content-box"}=t,o=d.computed(()=>{var u,p;return(p=(u=ln(i))==null?void 0:u.namespaceURI)==null?void 0:p.includes("svg")}),r=d.ref(e.width),a=d.ref(e.height),{stop:l}=BB(i,([u])=>{const p=s==="border-box"?u.borderBoxSize:s==="content-box"?u.contentBoxSize:u.devicePixelContentBoxSize;if(n&&o.value){const f=ln(i);if(f){const m=f.getBoundingClientRect();r.value=m.width,a.value=m.height}}else if(p){const f=Array.isArray(p)?p:[p];r.value=f.reduce((m,{inlineSize:y})=>m+y,0),a.value=f.reduce((m,{blockSize:y})=>m+y,0)}else r.value=u.contentRect.width,a.value=u.contentRect.height},t);fm(()=>{const u=ln(i);u&&(r.value="offsetWidth"in u?u.offsetWidth:e.width,a.value="offsetHeight"in u?u.offsetHeight:e.height)});const c=d.watch(()=>ln(i),u=>{r.value=u?e.width:0,a.value=u?e.height:0});function h(){l(),c()}return{width:r,height:a,stop:h}}function gm(i={}){const{window:e=ro,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:o=!0}=i,r=d.ref(t),a=d.ref(n),l=()=>{e&&(o?(r.value=e.innerWidth,a.value=e.innerHeight):(r.value=e.document.documentElement.clientWidth,a.value=e.document.documentElement.clientHeight))};if(l(),fm(l),MB("resize",l,{passive:!0}),s){const c=mm("(orientation: portrait)");d.watch(c,()=>l())}return{width:r,height:a}}function Fr(){const{width:i,height:e}=gm(),t=mm("(pointer: coarse)"),n=d.ref(!1),s=d.ref(!1),o=d.ref(!0),r=d.ref("other"),a=d.ref("other"),l=d.ref("medium"),c=d.ref("portrait"),h=()=>{const m=navigator.userAgent.toLowerCase(),y=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/i,g=navigator;if("userAgentData"in navigator&&g.userAgentData?.mobile!==void 0)return g.userAgentData.mobile||y.test(m);if(y.test(m))return!0;const A=/windows nt/i.test(m),v=/macintosh|mac os x/i.test(m)&&!/mobile/i.test(m),C=/linux/i.test(m)&&!/android/i.test(m);return!1},u=()=>{const m=navigator.userAgent.toLowerCase();n.value=h(),s.value=i.value>=768&&i.value<1024&&t.value,o.value=!n.value,/iphone|ipad|ipod/i.test(m)?r.value="ios":/android/i.test(m)?r.value="android":/win/i.test(m)?r.value="windows":/mac/i.test(m)?r.value="macos":/linux/i.test(m)&&(r.value="linux"),/safari/i.test(m)&&!/chrome/i.test(m)?a.value="safari":/chrome/i.test(m)?a.value="chrome":/firefox/i.test(m)?a.value="firefox":/edge/i.test(m)&&(a.value="edge"),i.value<576?l.value="small":i.value<1024?l.value="medium":l.value="large",c.value=i.value>e.value?"landscape":"portrait"},p=()=>{u()};d.onMounted(()=>{u(),window.addEventListener("resize",p),window.addEventListener("orientationchange",p)}),d.onUnmounted(()=>{window.removeEventListener("resize",p),window.removeEventListener("orientationchange",p)});const f=()=>({isMobile:n.value,isTablet:s.value,isDesktop:o.value,isTouchDevice:t.value,os:r.value,browser:a.value,screenSize:l.value,orientation:c.value});return{isMobile:d.readonly(n),isTablet:d.readonly(s),isDesktop:d.readonly(o),isTouchDevice:d.readonly(t),os:d.readonly(r),browser:d.readonly(a),screenSize:d.readonly(l),orientation:d.readonly(c),width:i,height:e,info:f}}const kB={class:"title"},PB={class:"actions"},DB={class:"card-body"},NB=d.defineComponent({__name:"LeitingDraggableCard",props:{visible:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},title:{type:String,default:"Title"},initialPosition:{type:Object,default:()=>({x:0,y:0})},width:{type:[Number,String],default:300},minWidth:{type:Number,default:200},fullHeight:{type:Boolean,default:!1},align:{type:String,default:""}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=d.inject("leiting-theme",d.ref("dark")),{isMobile:s}=Fr(),o=e,r=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:I=>{o("update:visible",I),o("update:open",I)}}),a=d.ref(null),l=d.ref(t.initialPosition?.x||0),c=d.ref(t.initialPosition?.y||0),h=d.ref(t.width),u=d.ref(t.fullHeight?"100%":"600px");d.watch(()=>t.fullHeight,I=>{I?u.value="100%":u.value==="100%"&&(u.value="600px")});const{height:p}=gm();d.watch(p,()=>{t.fullHeight&&(u.value="100%")});const f=d.ref(!1),m=I=>{f.value=!0,I.preventDefault(),I.stopPropagation();const S=I.clientX,R=I.clientY,b=typeof h.value=="number"?h.value:a.value?.offsetWidth||0,B=typeof u.value=="number"?u.value:a.value?.offsetHeight||0,L=N=>{if(!f.value)return;N.preventDefault();const D=N.clientX-S,E=N.clientY-R,T=b+D,P=B+E;T>100&&(h.value=T),P>100&&(u.value=P)},O=()=>{f.value=!1,document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",O)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",O)},y=d.computed(()=>({left:`${l.value}px`,top:`${c.value}px`,width:typeof h.value=="number"?`${h.value}px`:h.value,height:typeof u.value=="number"?`${u.value}px`:u.value,position:"absolute",zIndex:2e3})),g=()=>{d.nextTick(()=>{if(a.value){const I=a.value.offsetParent||document.body,S=I.clientWidth,R=I.clientHeight,b=typeof h.value=="number"?h.value:a.value.offsetWidth||350,B=typeof u.value=="number"?u.value:a.value.offsetHeight||600;l.value+b>S&&(l.value=Math.max(0,S-b-20)),c.value+B>R&&(c.value=Math.max(0,R-B-20)),l.value<0&&(l.value=0),c.value<0&&(c.value=0)}})},A=d.ref(!1),v=I=>{if(I.target.closest(".close-btn")||I.target.closest(".actions"))return;A.value=!0,I.preventDefault(),I.stopPropagation();const S=I.clientX,R=I.clientY,b=l.value,B=c.value,L=N=>{if(!A.value)return;N.preventDefault();const D=N.clientX-S,E=N.clientY-R;l.value=b+D,c.value=B+E},O=()=>{A.value=!1,document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",O),g()};document.addEventListener("mousemove",L),document.addEventListener("mouseup",O)},C=()=>{d.nextTick(()=>{if(t.align&&a.value){const I=a.value.offsetParent||document.body,S=typeof h.value=="number"?h.value:a.value.offsetWidth||350;t.align==="right"?l.value=Math.max(0,I.clientWidth-S-20):t.align==="center"&&(l.value=Math.max(0,(I.clientWidth-S)/2))}g()})};d.onMounted(()=>{t.align?C():g()}),d.watch(r,I=>{I&&(t.align?C():g())});const w=()=>{r.value=!1,o("close")},M=I=>{if(I.target.closest(".close-btn")||I.target.closest(".actions")||I.touches.length!==1)return;A.value=!0,I.preventDefault(),I.stopPropagation();const S=I.touches[0],R=S?.clientX??0,b=S?.clientY??0,B=l.value,L=c.value,O=D=>{if(!A.value||D.touches.length!==1)return;D.preventDefault();const E=D.touches[0],T=(E?.clientX??0)-R,P=(E?.clientY??0)-b;l.value=B+T,c.value=L+P},N=()=>{A.value=!1,document.removeEventListener("touchmove",O),document.removeEventListener("touchend",N),g()};document.addEventListener("touchmove",O,{passive:!1}),document.addEventListener("touchend",N)},x=I=>{if(I.touches.length!==1)return;f.value=!0,I.preventDefault(),I.stopPropagation();const S=I.touches[0],R=S?.clientX??0,b=S?.clientY??0,B=typeof h.value=="number"?h.value:a.value?.offsetWidth||0,L=typeof u.value=="number"?u.value:a.value?.offsetHeight||0,O=D=>{if(!f.value||D.touches.length!==1)return;D.preventDefault();const E=D.touches[0],T=(E?.clientX??0)-R,P=(E?.clientY??0)-b,F=B+T,V=L+P;F>100&&(h.value=F),V>100&&(u.value=V)},N=()=>{f.value=!1,document.removeEventListener("touchmove",O),document.removeEventListener("touchend",N)};document.addEventListener("touchmove",O,{passive:!1}),document.addEventListener("touchend",N)};return(I,S)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{ref_key:"cardRef",ref:a,class:d.normalizeClass(["draggable-card leiting-scroll",["leiting-theme-"+d.unref(n)]]),style:d.normalizeStyle(y.value)},[d.createElementVNode("div",{ref:"headerRef",class:"card-header",onMousedown:v,onTouchstart:M},[d.createElementVNode("span",kB,d.toDisplayString(i.title),1),d.createElementVNode("div",PB,[d.renderSlot(I.$slots,"header-extra",{},void 0,!0),d.createElementVNode("span",{class:"close-btn",onClick:w},"×")])],544),d.createElementVNode("div",DB,[d.renderSlot(I.$slots,"default",{},void 0,!0)]),d.unref(s)?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:0,class:"resize-handle",onMousedown:m,onTouchstart:x},[...S[0]||(S[0]=[d.createElementVNode("svg",{viewBox:"0 0 10 10",width:"10",height:"10",fill:"currentColor"},[d.createElementVNode("path",{d:"M10 10 L10 2 L2 10 Z"})],-1)])],32))],6)),[[d.vShow,r.value]])}}),Be=(i,e)=>{const t=i.__vccOpts||i;for(const[n,s]of e)t[n]=s;return t},gt=Be(NB,[["__scopeId","data-v-4d38393b"]]);function ym(i){const e=d.ref([]),t=d.ref([]),n=d.ref([]),s=d.ref(""),o=d.ref(!0);d.watch(()=>d.unref(i),u=>{if(!u||u.length===0)return;const p=[],f=(g,A)=>{g.forEach(v=>{const C=v.id||v.key||v.$id,w=v.modelId||A;w&&(v.modelId=w),C&&p.push(C),v.children&&v.children.length>0&&f(v.children,w)})};f(u);const m=new Set(n.value);let y=!1;p.forEach(g=>{m.has(g)||(m.add(g),y=!0)}),y&&(n.value=Array.from(m))},{immediate:!0,deep:!0});const r=d.computed(()=>{const u=d.unref(i);if(!u)return[];const p=[],f=(m,y)=>{m.forEach(g=>{const A=g.id||g.key||g.$id,v=g.name||g.title;p.push({key:A,title:v,parentKey:y}),g.children&&g.children.length>0&&f(g.children,A)})};return f(u),p}),a=u=>{e.value=u,o.value=!1},l=u=>{n.value=u},c=u=>{t.value=u},h=u=>r.value.find(f=>f.key===u)?.parentKey;return d.watch(s,u=>{if(!u)return;const f=r.value.filter(y=>y.title&&y.title.toLowerCase().includes(u.toLowerCase())).map(y=>y.parentKey),m=new Set;f.forEach(y=>{let g=y;for(;g;)m.add(g),g=h(g)}),e.value=[...m],o.value=!0}),{expandedKeys:e,selectedKeys:t,checkedKeys:n,searchValue:s,autoExpandParent:o,onExpand:a,onCheck:l,onSelect:c}}const LB={class:"search-box"},RB={key:0},FB={style:{color:"#f50"}},OB={key:1},GB={key:1,class:"empty-tip"},Or=Be(d.defineComponent({__name:"LeitingTree",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"构件树"},width:{type:[Number,String],default:320},treeData:{type:Array,default:()=>[]},initialPosition:{type:Object,default:()=>({x:0,y:0})},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close","select","check"],setup(i,{emit:e}){const t=oe.Input.Search,n=oe.Tree,s=i,o=e,r=d.inject("leiting-theme",d.ref("dark")),a=d.inject("leitingMethods"),l=b=>{a?.value?.onSearchComponent&&a.value.onSearchComponent(b)},c=d.computed({get:()=>s.open!==void 0?s.open:s.visible,set:b=>{o("update:visible",b),o("update:open",b)}}),h=d.ref(null),{height:u}=_B(h),p=d.computed(()=>u.value||300),f=d.ref({children:"children",title:"name",key:"id"}),m=d.ref([]),{expandedKeys:y,selectedKeys:g,checkedKeys:A,searchValue:v,autoExpandParent:C}=ym(d.toRef(s,"treeData")),w=(b,B)=>{if(!B)return b;const L=B.toLowerCase();return b.reduce((O,N)=>{const E=(N.name||N.title||"").toLowerCase().includes(L);if(N.children&&N.children.length>0){const T=w(N.children,B);(T.length>0||E)&&O.push({...N,children:T})}else E&&O.push({...N});return O},[])};d.watch([()=>s.treeData,v],([b,B])=>{b?m.value=w(b,B||""):m.value=[]},{immediate:!0,deep:!0});const M=b=>{y.value=b,C.value=!1},x=b=>{const B=[],L=O=>{if(!O.children||O.children.length===0){const D=O.element_Id;O.modelId&&D&&B.push({modelId:O.modelId,elementId:D})}else O.children.forEach(L)};return L(b),B},I=(b,B)=>{A.value=b,o("check",b,B);const L=[],O=new Set(b.map(D=>String(D))),N=D=>{for(let E=0;E<D.length;E++){const T=D[E];if(!T.children||T.children.length===0){if(!O.has(String(T.id))){const V=T.element_Id;T.modelId&&V&&L.push({modelId:T.modelId,elementId:V,show:!1})}}else T.children&&N(T.children)}};s.treeData&&N(s.treeData),a?.value?.setComponentVisibility&&a.value.setComponentVisibility(L),a?.value?.onTreeCheck&&a.value.onTreeCheck(b,B)},S=(b,B)=>{if(g.value=b,o("select",b,B),B.selected){const L=x(B.node);L.length>0&&a?.value?.flyToObjects&&a.value.flyToObjects({selectCpts:L})}a?.value?.onTreeSelect&&a.value.onTreeSelect(b,B)},R=()=>{o("update:visible",!1),o("close")};return(b,B)=>(d.openBlock(),d.createBlock(gt,{visible:c.value,"onUpdate:visible":B[1]||(B[1]=L=>c.value=L),title:i.title,"initial-position":i.initialPosition,"full-height":i.fullHeight,onClose:R},{default:d.withCtx(()=>[d.createElementVNode("div",{class:d.normalizeClass(["leiting-tree-container",[`theme-${d.unref(r)}`]])},[d.createElementVNode("div",LB,[d.createVNode(d.unref(t),{value:d.unref(v),"onUpdate:value":B[0]||(B[0]=L=>d.isRef(v)?v.value=L:null),placeholder:"搜索构件","allow-clear":"","enter-button":"",onSearch:l},null,8,["value"])]),d.createElementVNode("div",{class:"tree-wrapper",ref_key:"treeWrapperRef",ref:h},[m.value&&m.value.length?(d.openBlock(),d.createBlock(d.unref(n),{key:0,"tree-data":m.value,"field-names":f.value,height:p.value,"expanded-keys":d.unref(y),"auto-expand-parent":d.unref(C),"selected-keys":d.unref(g),"checked-keys":d.unref(A),checkable:"","block-node":"",onExpand:M,onSelect:S,onCheck:I},{title:d.withCtx(({name:L,title:O})=>[(L||O)&&d.unref(v)&&(L||O).toLowerCase().indexOf(d.unref(v).toLowerCase())>-1?(d.openBlock(),d.createElementBlock("span",RB,[d.createTextVNode(d.toDisplayString((L||O).substr(0,(L||O).toLowerCase().indexOf(d.unref(v).toLowerCase())))+" ",1),d.createElementVNode("span",FB,d.toDisplayString(d.unref(v)),1),d.createTextVNode(" "+d.toDisplayString((L||O).substr((L||O).toLowerCase().indexOf(d.unref(v).toLowerCase())+d.unref(v).length)),1)])):(d.openBlock(),d.createElementBlock("span",OB,d.toDisplayString(L||O),1))]),_:1},8,["tree-data","field-names","height","expanded-keys","auto-expand-parent","selected-keys","checked-keys"])):(d.openBlock(),d.createElementBlock("div",GB,"暂无数据"))],512)],2)]),_:1},8,["visible","title","initial-position","full-height"]))}}),[["__scopeId","data-v-3748c20d"]]),UB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoROakhe0HDeQmbQfFzTxJj+zTXYg1kWrarISRFKzLNAfGsbL9iDzq/0j+kQZ/k1wm7onoKW3Hq42F0jLVK//Tcebott2fJAbVK1lvKwBNd6rRIsFsfJka0G2qdpQPy7+EPC0AumexKAzoH5FbgvSbHuUW6EOYubbfwX0cLPfFJS4K6mPNrbdHb+uvP498dhVn4v9FWo9V3RZzFxAv8L9AAAAAElFTkSuQmCC",Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAERSURBVDhPvZTrEYIwEISTCrQD6EA7gA60AylBK1Aq0A7ECrQDoQPsADrACuLuTMJkIiHxjzezgyR7H3d5KJVSqRAigcaQUjYYX2JgZY/P/O4lEgYYFo7pgPcc2kSCBoIUzDeo0klPPEsNYlX7AKzA/M6ASrRzYoIGG5DAOCvzBvzMOxqQazSgLLI1QdAW5jWpUAPV0AVKIc7FRCuNy7RkWozJtj1BED7ANbpDXHhffFXUwUnZwRYp7qw7Rx8/lLkV9R4QD2w1A8pjW3sA4h5au+pXEBS76P8D6Ut9/nXXaiRQdnBXqBfEC+4GdzSxW5v6F7CTeHnbCVCBsWIE+RYVrdF4DSz6OwgiADDexbmT3X0A4fSDfDjUugcAAAAASUVORK5CYII=",VB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFESURBVDhPlZMNEcIwDIVXBQwFgAJAAcMBDgAFIGE4wAHgABSwOdgcIAEUjPd6aS/rfhi7y12bJl9f0sxEf3xVVV0RPoetjTFvnWqGcgSylfgihA0CKcgJgBfsAqMiKiM0+gkKlCyZCN8uhPWCFOSBxARWORU4W2CdeV9XjxSEJcwkjokTqBpzjxjCn7CyVRECzjg8wHLYCmabK7CplBcLhMr2DZCqP0dCovYZ9hYGXx1izLUGUkkfxI/sTQiCf4N1zLWAWCKV2nP6PEhB2Ngd7B4GC4SJnCcP8SAFoc/Ph/TqjVvTPogFKUiJ/VGU+GdmUAA5ObA7cyC+iPt/MjUfKRL4emyuK+cGH8tufFRUHywZ+RYlnRDdIwfzLzVUibtQv1oNhoAExtfpVdIAiQIOWiY9o2sQxJemOydTS1jR1di2Zn8B8f27apou9kMAAAAASUVORK5CYII=",QB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAHDSURBVDhPlZOxL0NRFIe9ECubhehoIIjJ1HYwCkIiJpUQEkN1YZBobU0kFKNI3iTGYrDRv0BIhLXCYpCwiO35fs25zWva98JNvpz37j33d8+551yvLWIEQXDG0izMe55XjvJz816MUJG1LVuvYJcQrEb5xwkV2JSHGfAhgBJiu63E4oSUzpRtusa+wBooKkWnKOujQYh7SbCShQx0m9cpds4iOseOw7BFmUPwU341IQT2MaOQgi9QND+wiqNnBxT4X7SIbrAqhNI9wiUvJ+W8A99wDEWdwrw25iVkkenAEb5LkIQPuIMJWJGQoriFd+iBCkhc8zUhfJSm7mva5l3aadubDgtpMgGKpB/eoBfuQZFoPNhBj9gTaC3kKkEEGXPswF7Y5rLro1AW8UI6GmelmAzfkUWlNaWt6/iT0DOOA5bqoSuzHfIvofATqSJQb8KoiJbtPi6x2dA9FPjXE1F/uZKrv3IwCFcNqVmoPlal7QJ9q/wZCbk7Ioo9/tehE9q1r0nIxNQbG4YEXdkVjQ5J2OZXbB88gVrgQIJNj9aaT4LboPK7J6O0Ktb1KYtc/aYxGff6h3AYY6Nvzk2GQ1WQTVj4BST70jYaqceXAAAAAElFTkSuQmCC",zB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADhSURBVHgBvVOBEYIwDEw9B2ADO4IjuIEjwAa6Aa7ABMAEuIIjOIFsUDao37vgxVZbBI+/+0tI0+fJBaIIrLUFaMAHmNNcsMAIE+vdJLQykQ+0wFHBrsyiT/sL2I1DDTac/+4Klzobov7WHxt29qGmaYaQnlhLCmUTa2l4C2ljvamFlEvY0xpCW/kA924GblfGWciZaJyXQvSmlOoDITSdXQBbcA8eKfy/nHDFeY470FIX8tzUIu84FmLWuTzz7yhRLPm54dKJ4+A5uoJ3HgHBUfUmxGIa4QDuKA4n3kLk9ZInw0qu5b1R1aYAAAAASUVORK5CYII=",HB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADFSURBVDhPxVPBDYMwDIwnKJu0G9ANYJMyQrsBbNIRGAE2gEnSO6mpIMJxkBC1lEds52zfOeK9b51zV5wte4lIr8RWbgGQh2fGmaIHJe4EetKPtDpRcA5AvwcB7FtgCcTOH0p3YzaQNd75QBiVXJG3LRtCRyQ6Jvsekd3gTsJVoDcihZLQQjXGTRMzIzPhOCCQyNYvSuEue7Qdm02yK0u1nM2m/FQyKb8JZHH+l81Ofdpdm82tvikjThyNlbSEBvIPFj+MfwA76qSYUG3g9QAAAABJRU5ErkJggg==",Am="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEcSURBVDhPrZSNDYIwEIXpBOIGjMAIOIE4AbgBGwAbOIJu4Aa4gW4gI+gE9b3mjjSmibSR5ALX3H33W4y1Ns+yrIe0EH7HPC8YnyGjAegkEB5cYyiwrdWXIEc1xnSREGcuiTQEWeg7gG4+CMcl9ALnLkvogwScv+wq6FMQJJCJDgBtBcSAI3QClwe2YZAHcY2Ho4kGAVLA6U5/CEvdp4KYhesFhBPpCZIAz6jStHhproJcHyAHbb5nF+6RZ8CsGslIQaHp/gSxRzlApU4GugPxNuDN/eNarAJxapUPgm8rQ9C1SAI9AOGiHhGApSdnRN8FshbEiLwiLI1rMUM6zSQ0tX9c2lp/Iw0iMIPU38iFIN1mTmOjKa98vyWB4QM5XQnvsbFsyAAAAABJRU5ErkJggg==",YB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGPSURBVDhPrZT9UQIxEMUvFSgViBUoFQgVABV4VqBW4FmBUIFQgZRwVqBU4HUAVHC+X2aXycQw/sPOvLncZvdlv5JQFaTv+1upp8IyhLDHRLpLfe6FrXRt7hZShYyH+n8RauGAv/AkQNYIHICshFcRdu6fE/kGRN/mQGTIpzAzMoh6EV2fIsJ5IwNOj2IpVZ6i6difSecRVnlELZHIgHROisgXRCa78Z+IrMBf2pjLYJNENGSd1kO2pPghjKQniyqY8lFr2NfaqC18wn7nZCMlWg7xLq70TxfRLyHqtABN2lbp40mSSCzBcSebif1TPyKjDBcQ0eJJRkIUpHkMPUlnkBU+pnlWItL6ERgw8o1iqRHtgzAUGNRD2qmkvgMvNnneUQcZ4ggR6VGXG+OOA1koNvrFcY7+af++VJe0hucfyKQu+RWJc+SDZ3aNvlPpRl7T0qXdafNZYPDehLEZt/rOBR9U8QSaEKX0jHAaE4tshVrgLeJ+Xdl6rS8D3BWJXKnCEwWXEuco9grQ3bb0sP0Cn8/nPm/SMRQAAAAASUVORK5CYII=",$B="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACDSURBVHgB1ZFhDYAgEIWfzgBGIIINpIEViGAkG2gEbWADjWADfMw/iDgUfji/7e3gxt3uHsDXZFrrlrFBHJNpsPAgEEmORArn3lFroEZQCjcTbAhzepPsgbuCgn8FBWvsUAMfFR5OIPGS5G80JkrG2sopHKbO1BCoHy8ZNhRUT5X4BTu6qyNSwwCiMAAAAABJRU5ErkJggg==",jB={class:"menu-container"},WB=["onClick","title"],qB={class:"menu-icon"},KB=["src","alt"],XB={key:3,style:{"font-size":"12px"}},JB={key:0,class:"sub-menu"},ZB=["onClick"],ao=d.defineComponent({__name:"LeitingMenu",props:{visible:{type:Boolean,default:!0},activeIds:{type:Array,default:()=>[]},is2d:{type:Boolean,default:!1},customItems:{type:Array,default:()=>[]}},emits:["action"],setup(i,{emit:e}){const t=i,n=d.inject("leiting-theme",d.ref("dark")),s=d.inject("leiting-menu-size",d.ref("medium")),o=d.inject("leitingMethods",d.ref({})),r=d.computed(()=>n.value||n),a=d.computed(()=>s.value||s),l=d.ref([{ID:"home",title:"主视角",src:UB,key:"homeView"},{ID:"tree",title:"目录树",src:Gr,key:"componentTree"},{ID:"cadLayer",title:"图层",src:Gr,key:"cadLayer"},{ID:"gisCadPosition",title:"GIS调整",src:Am,key:"gisCadPosition"},{ID:"measure",title:"量算",src:VB,key:"measurement"},{ID:"section",title:"剖切",src:QB,key:"section"},{ID:"roam",title:"人物漫游",src:zB,key:"roam"},{ID:"info",title:"构件信息",src:HB,key:"componentInfo"},{ID:"cadPosition",title:"调整位置",src:Am,key:"cadPosition"},{ID:"annotation",title:"标注",src:$B,key:"annotation"},{ID:"setting",title:"设置",src:YB,key:"setting"}]),c=d.ref([]),h=d.ref([...t.activeIds]);d.watch(()=>t.activeIds,w=>{h.value=[...w]},{deep:!0});const u=d.computed(()=>t.visible);o.value&&o.value.menuEvents&&(o.value.menuEvents.on("setMenuListFilter",w=>{c.value=w}),o.value.menuEvents.on("setMenuActive",(w,M)=>{M?h.value.includes(w)||h.value.push(w):h.value=h.value.filter(x=>x!==w)}));const p=d.computed(()=>{let w=l.value;if(t.is2d){const M=["homeView","measurement","cadLayer","gisCadPosition","annotation"];w=w.filter(x=>x.key&&M.includes(x.key))}else{const M=["cadLayer","cadPosition","gisCadPosition","annotation"];w=w.filter(x=>!x.key||!M.includes(x.key))}if(c.value.length>0&&(w=w.filter(M=>!M.key||!c.value.includes(M.key))),t.customItems&&t.customItems.length>0){const M=t.customItems.map(x=>({...x,key:x.ID,src:x.src||x.icon}));return[...w,...M]}return w}),f=e,m=w=>{const M=["homeView"];if(w.key&&M.includes(w.key))h.value.includes(w.ID)||(h.value.push(w.ID),setTimeout(()=>{const I=h.value.indexOf(w.ID);I>-1&&h.value.splice(I,1)},1e3));else{const I=h.value.indexOf(w.ID);I>-1?h.value.splice(I,1):h.value.push(w.ID)}const x=h.value.includes(w.ID);w.func&&w.func(w),w.key&&f("action",w.key,x)},y=w=>{c.value=w},g=w=>{console.log("LeitingMenu received showMenu event:",w)},A=(w,M)=>{const x=p.value.find(I=>I.ID===w||I.key===w);if(x){const I=h.value.indexOf(x.ID);M&&I===-1?h.value.push(x.ID):!M&&I>-1&&h.value.splice(I,1)}};let v=null;const C=()=>{o.value?.menuEvents&&(v&&(v.off("setMenuListFilter",y),v.off("showMenu",g),v.off("setMenuActive",A)),v=o.value.menuEvents,v.on("setMenuListFilter",y),v.on("showMenu",g),v.on("setMenuActive",A))};return d.onMounted(()=>{C()}),d.onUnmounted(()=>{v&&(v.off("setMenuListFilter",y),v.off("showMenu",g),v.off("setMenuActive",A))}),d.watch(o,()=>{C()},{deep:!0}),(w,M)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-menu-wrapper",["leiting-theme-"+r.value,"size-"+a.value]])},[d.createElementVNode("div",jB,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(p.value,x=>(d.openBlock(),d.createElementBlock("div",{key:x.ID,class:d.normalizeClass(["menu-item",{active:h.value.includes(x.ID)}]),onClick:I=>m(x),title:x.title},[d.createElementVNode("div",qB,[x.src?(d.openBlock(),d.createElementBlock("img",{key:0,src:x.src,alt:x.title},null,8,KB)):typeof x.icon=="object"?(d.openBlock(),d.createBlock(d.resolveDynamicComponent(x.icon),{key:1})):typeof x.icon=="string"?(d.openBlock(),d.createElementBlock("i",{key:2,class:d.normalizeClass(["iconfont",`icon-${x.icon}`])},null,2)):(d.openBlock(),d.createElementBlock("span",XB,d.toDisplayString(x.title.substring(0,2)),1))]),x.children&&x.children.length>0?(d.openBlock(),d.createElementBlock("div",JB,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(x.children,I=>(d.openBlock(),d.createElementBlock("div",{key:I.ID,class:d.normalizeClass(["sub-menu-item",{active:h.value.includes(I.ID)}]),onClick:d.withModifiers(S=>m(I),["stop"])},d.toDisplayString(I.title),11,ZB))),128))])):d.createCommentVNode("",!0)],10,WB))),128))])],2)),[[d.vShow,u.value]])}}),e3={class:"leiting-section-content"},t3={class:"section-form-item"},i3={class:"radio-group"},n3={class:"section-form-item"},s3={class:"switch-container"},o3={class:"switch"},r3={class:"status-text"},a3={class:"section-form-item slider-item"},l3={class:"slider-wrapper"},c3={class:"section-form-item slider-item"},d3={class:"slider-wrapper"},h3={class:"section-form-item slider-item"},u3={class:"slider-wrapper"},f3={class:"section-form-item table-item"},p3={class:"model-table-container"},m3={class:"model-table"},g3={width:"40"},y3=["checked"],A3=["onClick"],v3=["value"],b3={class:"model-name"},lo=Be(d.defineComponent({__name:"LeitingSection",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"剖切控制"},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:N=>{n("update:visible",N),n("update:open",N)}}),r=d.ref("Box"),a=d.ref(!1),l=d.ref([]),c=d.ref([]),h=d.computed(()=>c.value.length===0?!1:c.value.every(N=>l.value.includes(N.modelId))),u=N=>{N.target.checked?l.value=c.value.map(E=>E.modelId):l.value=[],R()},p=d.ref([-10,10]),f=d.ref([-10,10]),m=d.ref([-10,10]),y=d.ref([-100,100]),g=d.ref([-100,100]),A=d.ref([-100,100]);let v=!1;const C=N=>{v=!0;const{targetZPlus:D,targetZMinus:E,targetXPlus:T,targetXMinus:P,targetYPlus:F,targetYMinus:V}=N;m.value=[-E,D],p.value=[-P,T],f.value=[-V,F],setTimeout(()=>{v=!1},100)},w=()=>{v||l.value.length===0||!s?.value?.updateSectionRange||s.value.updateSectionRange({targetZPlus:m.value[1],targetZMinus:-m.value[0],targetXPlus:p.value[1],targetXMinus:-p.value[0],targetYPlus:f.value[1],targetYMinus:-f.value[0]})},M=()=>{s?.value?.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(a.value)},x=N=>{if(!s?.value?.getMapTileset||!s?.value?.openSection)return;const E=s.value.getMapTileset()[N];if(E&&E.leiting?.box){const{min:T,max:P}=E.leiting.box,F=(P.x-T.x)/2,V=(P.y-T.y)/2,G=(P.z-T.z)/2;l.value.length<=1&&(y.value=[-F*2,F*2],g.value=[-V*2,V*2],A.value=[-G*2,G*2],p.value=[-F,F],f.value=[-V,V],m.value=[-G,G],s.value.updateSectionRange&&s.value.updateSectionRange({targetZPlus:G,targetZMinus:G,targetXPlus:F,targetXMinus:F,targetYPlus:V,targetYMinus:V})),s.value.openSection(N,{moveCallBack:C}),s.value.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(a.value)}},I=N=>{const D=l.value.indexOf(N);D>-1?l.value.splice(D,1):l.value.push(N),R()};let S=[];const R=()=>{const N=l.value.filter(E=>!S.includes(E)),D=S.filter(E=>!l.value.includes(E));N.forEach(E=>x(E)),D.forEach(E=>{s?.value?.closeSection&&s.value.closeSection(E)}),S=[...l.value]},b=()=>{},B=()=>{o.value=!1,n("close")},L=()=>{a.value=!1,l.value=[],S=[],p.value=[-10,10],f.value=[-10,10],m.value=[-10,10],y.value=[-100,100],g.value=[-100,100],A.value=[-100,100]};d.watch(()=>t.visible,N=>{N?O():(s?.value?.closeSection&&s.value.closeSection(),L())});const O=()=>{s?.value&&typeof s.value.getModelList=="function"&&(c.value=s.value.getModelList()||[],c.value.length>0&&l.value.length===0&&(l.value=[c.value[0].modelId],S=[...l.value]),t.visible&&l.value.length>0&&(a.value=!0,l.value.forEach(N=>x(N))))};return d.watch(()=>s?.value,()=>{O()},{immediate:!0,deep:!0}),d.onMounted(()=>{O()}),(N,D)=>(d.openBlock(),d.createBlock(gt,{visible:o.value,title:"剖切分析","full-height":i.fullHeight,"onUpdate:visible":B},{default:d.withCtx(()=>[d.createElementVNode("div",e3,[d.createElementVNode("div",t3,[D[8]||(D[8]=d.createElementVNode("span",{class:"label"},"模式",-1)),d.createElementVNode("div",i3,[d.createElementVNode("label",{class:d.normalizeClass(["radio-item",{active:r.value==="Box"}])},[d.withDirectives(d.createElementVNode("input",{type:"radio",value:"Box","onUpdate:modelValue":D[0]||(D[0]=E=>r.value=E),onChange:b},null,544),[[d.vModelRadio,r.value]]),D[7]||(D[7]=d.createTextVNode(" 剖切盒 ",-1))],2)])]),d.createElementVNode("div",n3,[D[10]||(D[10]=d.createElementVNode("span",{class:"label"},"显示",-1)),d.createElementVNode("div",s3,[d.createElementVNode("label",o3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":D[1]||(D[1]=E=>a.value=E),onChange:M},null,544),[[d.vModelCheckbox,a.value]]),D[9]||(D[9]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",r3,d.toDisplayString(a.value?"显示":"隐藏"),1)])]),d.createElementVNode("div",a3,[D[11]||(D[11]=d.createElementVNode("span",{class:"label"},"X 轴",-1)),d.createElementVNode("div",l3,[d.createVNode(d.unref(oe.Slider),{value:p.value,"onUpdate:value":D[2]||(D[2]=E=>p.value=E),range:"",min:y.value[0],max:y.value[1],step:.1,onChange:w},null,8,["value","min","max"])])]),d.createElementVNode("div",c3,[D[12]||(D[12]=d.createElementVNode("span",{class:"label"},"Y 轴",-1)),d.createElementVNode("div",d3,[d.createVNode(d.unref(oe.Slider),{value:f.value,"onUpdate:value":D[3]||(D[3]=E=>f.value=E),range:"",min:g.value[0],max:g.value[1],step:.1,onChange:w},null,8,["value","min","max"])])]),d.createElementVNode("div",h3,[D[13]||(D[13]=d.createElementVNode("span",{class:"label"},"Z 轴",-1)),d.createElementVNode("div",u3,[d.createVNode(d.unref(oe.Slider),{value:m.value,"onUpdate:value":D[4]||(D[4]=E=>m.value=E),range:"",min:A.value[0],max:A.value[1],step:.1,onChange:w},null,8,["value","min","max"])])]),d.createElementVNode("div",f3,[D[15]||(D[15]=d.createElementVNode("span",{class:"label"},"模型",-1)),d.createElementVNode("div",p3,[d.createElementVNode("table",m3,[d.createElementVNode("thead",null,[d.createElementVNode("tr",null,[d.createElementVNode("th",g3,[d.createElementVNode("input",{type:"checkbox",checked:h.value,onChange:u},null,40,y3)]),D[14]||(D[14]=d.createElementVNode("th",null,"名称",-1))])]),d.createElementVNode("tbody",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(c.value,E=>(d.openBlock(),d.createElementBlock("tr",{key:E.modelId,class:d.normalizeClass({selected:l.value.includes(E.modelId)}),onClick:T=>I(E.modelId)},[d.createElementVNode("td",null,[d.withDirectives(d.createElementVNode("input",{type:"checkbox",value:E.modelId,"onUpdate:modelValue":D[5]||(D[5]=T=>l.value=T),onClick:D[6]||(D[6]=d.withModifiers(()=>{},["stop"])),onChange:R},null,40,v3),[[d.vModelCheckbox,l.value]])]),d.createElementVNode("td",b3,d.toDisplayString(E.modelName),1)],10,A3))),128))])])])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-ee4d9a12"]]),C3={class:"leiting-player-content"},w3={class:"player-form-item"},E3={class:"switch-container"},x3={class:"switch"},I3={class:"status-text"},S3={class:"player-form-item"},M3={class:"switch-container"},T3={class:"switch"},B3={class:"status-text"},_3={class:"player-form-item"},k3={class:"switch-container"},P3={class:"switch"},D3={class:"status-text"},N3={class:"player-form-item slider-item"},L3={class:"slider-wrapper"},R3={class:"value-text"},F3={class:"instructions"},O3={class:"key-map"},G3={class:"key-row"},U3={class:"key-row"},V3={class:"key-row"},Q3={class:"key-row"},z3={class:"key-row"},H3={class:"key-row"},co=Be(d.defineComponent({__name:"LeitingPlayer",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"漫游控制"},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(!1),r=d.ref(!1),a=d.ref(!0),l=d.ref(5),c=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:x=>{n("update:visible",x),n("update:open",x)}}),h=d.ref(null),u=d.ref(null),p=d.ref(null),f=d.ref(null),m=d.ref(null),y=d.ref(null),g=()=>{o.value?v():C()},A=()=>{s?.value?.setPlayerParams&&s.value.setPlayerParams({gravityTest:r.value,collisionTest:a.value})},v=async()=>{s?.value?.openPlayer&&(await s.value.openPlayer(),s.value.setPlayerSpeed&&s.value.setPlayerSpeed(l.value),A(),s.value.bindPlayerUiKeys&&(await d.nextTick(),s.value.bindPlayerUiKeys({moveFront:h.value,moveBack:u.value,moveLeft:p.value,moveRight:f.value,moveUp:m.value,moveDown:y.value})))},C=()=>{s?.value?.closePlayer&&s.value.closePlayer()},w=()=>{s?.value?.setPlayerSpeed&&s.value.setPlayerSpeed(l.value)},M=()=>{c.value=!1,n("close")};return d.watch(()=>t.visible,x=>{x?(o.value=!0,s?.value?v():setTimeout(()=>{s?.value&&v()},100)):o.value&&(o.value=!1,C())},{immediate:!0}),(x,I)=>(d.openBlock(),d.createBlock(gt,{title:i.title,visible:c.value,"full-height":i.fullHeight,"onUpdate:visible":M},{default:d.withCtx(()=>[d.createElementVNode("div",C3,[d.createElementVNode("div",w3,[I[5]||(I[5]=d.createElementVNode("span",{class:"label"},"启用",-1)),d.createElementVNode("div",E3,[d.createElementVNode("label",x3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":I[0]||(I[0]=S=>o.value=S),onChange:g},null,544),[[d.vModelCheckbox,o.value]]),I[4]||(I[4]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",I3,d.toDisplayString(o.value?"开启":"关闭"),1)])]),d.createElementVNode("div",S3,[I[7]||(I[7]=d.createElementVNode("span",{class:"label"},"重力",-1)),d.createElementVNode("div",M3,[d.createElementVNode("label",T3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":I[1]||(I[1]=S=>r.value=S),onChange:A},null,544),[[d.vModelCheckbox,r.value]]),I[6]||(I[6]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",B3,d.toDisplayString(r.value?"开启":"关闭"),1)])]),d.createElementVNode("div",_3,[I[9]||(I[9]=d.createElementVNode("span",{class:"label"},"碰撞",-1)),d.createElementVNode("div",k3,[d.createElementVNode("label",P3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":I[2]||(I[2]=S=>a.value=S),onChange:A},null,544),[[d.vModelCheckbox,a.value]]),I[8]||(I[8]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",D3,d.toDisplayString(a.value?"开启":"关闭"),1)])]),d.createElementVNode("div",N3,[I[10]||(I[10]=d.createElementVNode("span",{class:"label"},"速度",-1)),d.createElementVNode("div",L3,[d.createVNode(d.unref(oe.Slider),{value:l.value,"onUpdate:value":I[3]||(I[3]=S=>l.value=S),min:1,max:10,step:1,onChange:w},null,8,["value"])]),d.createElementVNode("span",R3,d.toDisplayString(l.value),1)]),I[19]||(I[19]=d.createElementVNode("div",{class:"divider"},null,-1)),d.createElementVNode("div",F3,[I[18]||(I[18]=d.createElementVNode("div",{class:"instruction-title"},"操作说明",-1)),d.createElementVNode("div",O3,[d.createElementVNode("div",G3,[d.createElementVNode("span",{class:"key",ref_key:"btnFront",ref:h},"W",512),I[11]||(I[11]=d.createTextVNode(" 前进 ",-1))]),d.createElementVNode("div",U3,[d.createElementVNode("span",{class:"key",ref_key:"btnBack",ref:u},"S",512),I[12]||(I[12]=d.createTextVNode(" 后退 ",-1))]),d.createElementVNode("div",V3,[d.createElementVNode("span",{class:"key",ref_key:"btnLeft",ref:p},"A",512),I[13]||(I[13]=d.createTextVNode(" 左移 ",-1))]),d.createElementVNode("div",Q3,[d.createElementVNode("span",{class:"key",ref_key:"btnRight",ref:f},"D",512),I[14]||(I[14]=d.createTextVNode(" 右移 ",-1))]),d.createElementVNode("div",z3,[d.createElementVNode("span",{class:"key",ref_key:"btnUp",ref:m},"Q",512),I[15]||(I[15]=d.createTextVNode(" 上升 ",-1))]),d.createElementVNode("div",H3,[d.createElementVNode("span",{class:"key",ref_key:"btnDown",ref:y},"E",512),I[16]||(I[16]=d.createTextVNode(" 下降 ",-1))]),I[17]||(I[17]=d.createElementVNode("div",{class:"key-row"},[d.createElementVNode("span",{class:"mouse-icon"},"🖱️"),d.createTextVNode(" 按住左键拖拽旋转视角 ")],-1))])])])]),_:1},8,["title","visible","full-height"]))}}),[["__scopeId","data-v-ff3f266e"]]),Y3={class:"info-content"},$3={key:0,class:"component-title"},ho=Be(d.defineComponent({__name:"LeitingInfo",props:{visible:{type:Boolean},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref([]),r=d.ref(!1),a=d.ref([]),l=d.ref([]),c=d.ref(0),h=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:A=>{n("update:visible",A),n("update:open",A)}}),u=()=>{h.value=!1},p=A=>({elementID:"构件ID",elementName:"构件名",categoryName:"类别",familySymbolName:"族类型",levelName:"标高",modelName:"文件名",length:"长",width:"宽",height:"高"})[A]||A,f=["elementName","elementID","modelName","length","width","height","levelName","categoryName","familySymbolName"],m=async A=>{const v=++c.value;if(l.value=A,!A||A.length===0){o.value=[];return}if(!h.value)return;let C=A;A.length>10&&(pe.warning(`选中构件数量过多(${A.length}个),仅显示前10个`),C=A.slice(0,10));const w=s?.value;let M=w?.getMapTileset?w.getMapTileset():{};r.value=!0;const x=[],I={};C.forEach(b=>{const L=M[b.modelId]?.leiting?.model?.dbName;L&&b.elementId&&x.push({dbName:L,elementId:b.elementId,modelId:b.modelId})});const S=new Set;if(C.forEach(b=>{const B=M[b.modelId],L=`${b.modelId}_${b.elementId}`;I[L]||B&&B.leiting&&!B.leiting?.node?.nodeExtras&&B.leiting.model?.nodeUrl&&S.add(b.modelId)}),S.size>0&&w?._loadNodeDetailsForModel)try{const b=Array.from(S).map(B=>w._loadNodeDetailsForModel(B));await Promise.all(b)}catch(b){console.error("Failed to load node details",b)}if(v!==c.value)return;M=w?.getMapTileset?w.getMapTileset():{};const R=[];C.forEach((b,B)=>{const O=M[b.modelId]?.leiting||{},N=I[`${b.modelId}_${b.elementId}`];let D={modelName:O.model?.modelId||b.modelId};D.elementID||(D.elementID=b.elementId);let E=null;if(N)E=N;else{const F=O.node?.nodeExtras?.element||O.node?.nodeExtras;if(F){const V=D.elementID;F[V]&&(E=F[V])}}E&&E.box3&&(D.length=`${E.box3.length?.toFixed(2)||0}米`,D.width=`${E.box3.width?.toFixed(2)||0}米`,D.height=`${E.box3.height?.toFixed(2)||0}米`);const T=[];E&&(E.name&&(D.elementName=E.name),E.categoryName&&(D.categoryName=E.categoryName),E.familySymbolName&&(D.familySymbolName=E.familySymbolName),E.levelName&&(D.levelName=E.levelName));const P={};if(f.forEach(F=>{D[F]!==void 0&&(P[F]=D[F])}),T.push({name:"基础信息",params:P}),E){const F=Array.isArray(E)?E:Array.isArray(E?.parameters)?E.parameters:null;if(F){if(F.flat().forEach(G=>{if(G&&G.GroupName&&Array.isArray(G.Parameters)){const k={};G.Parameters.forEach(_=>{_.name&&(k[_.name]=_.value??"")}),Object.keys(k).length>0&&T.push({name:G.GroupName,params:k})}}),!Array.isArray(E)){const{parameters:G,...k}=E,_={};Object.keys(k).forEach(U=>{!f.includes(U)&&U!=="uniqueId"&&typeof k[U]!="object"&&(_[U]=k[U])}),Object.keys(_).length>0&&T.push({name:"其他属性",params:_})}}else{let V=!1;if(Object.keys(E).forEach(G=>{E[G]&&typeof E[G]=="object"&&!Array.isArray(E[G])&&(V=!0,T.push({name:G,params:E[G]}))}),!V){const G={};Object.keys(E).forEach(k=>{if(!f.includes(k)&&k!=="batchId"){const _=E[k];typeof _=="string"&&_.length>500?G[k]=_.substring(0,500)+"...":G[k]=_}}),Object.keys(G).length>0&&T.push({name:"属性",params:G})}}}R.push({id:B,title:`${D.modelName}${D.elementName?` - ${D.elementName}`:""}`,groups:T})}),o.value=R,v===c.value&&(r.value=!1),R.length>0?a.value=[`${R[0].id}-基础信息`]:a.value=[]};let y=!1;const g=()=>{if(y)return;const A=s?.value;A&&A.selectionChange&&(A.selectionChange(m),y=!0)};return d.watch(()=>s?.value,()=>{g()},{deep:!0,immediate:!0}),d.watch(h,A=>{A&&l.value.length>0&&m(l.value)}),d.onMounted(()=>{g()}),(A,v)=>(d.openBlock(),d.createBlock(gt,{visible:h.value,title:"构件详情",width:350,align:"right","initial-position":{x:0,y:0},"full-height":i.fullHeight,onClose:u,"onUpdate:visible":v[1]||(v[1]=C=>h.value=C),class:"base-info-card"},{default:d.withCtx(()=>[d.createElementVNode("div",Y3,[d.createVNode(d.unref(oe.Spin),{spinning:r.value},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.value,C=>(d.openBlock(),d.createElementBlock("div",{key:C.id,class:"component-block"},[o.value.length>1?(d.openBlock(),d.createElementBlock("div",$3,d.toDisplayString(C.title),1)):d.createCommentVNode("",!0),d.createVNode(d.unref(oe.Collapse),{activeKey:a.value,"onUpdate:activeKey":v[0]||(v[0]=w=>a.value=w),ghost:"","expand-icon-position":"end"},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(C.groups,w=>(d.openBlock(),d.createBlock(d.unref(oe.CollapsePanel),{key:`${C.id}-${w.name}`,header:w.name},{default:d.withCtx(()=>[d.createVNode(d.unref(oe.Descriptions),{size:"small",bordered:"",column:1,labelStyle:{width:"100px",background:"rgba(255,255,255,0.05)",color:"#aaa"},contentStyle:{color:"#fff"}},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(w.params,(M,x)=>(d.openBlock(),d.createBlock(d.unref(oe.DescriptionsItem),{key:x,label:p(String(x))},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(M),1)]),_:2},1032,["label"]))),128))]),_:2},1024)]),_:2},1032,["header"]))),128))]),_:2},1032,["activeKey"])]))),128))]),_:1},8,["spinning"])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-375a1f55"]]);class yc{viewer;Cesium;pickHandler=null;bimEntityId="";mapEntityId="";constructor(e,t){this.viewer=e,this.Cesium=t}removeMarker(e){if(!this.viewer)return;const t=e==="BIM"?this.bimEntityId:this.mapEntityId;t&&(this.viewer.entities.removeById(t),e==="BIM"?this.bimEntityId="":this.mapEntityId="")}clearMarkers(){this.removeMarker("BIM"),this.removeMarker("MAP")}addMarker(e,t){if(!this.viewer||!this.Cesium)return;this.removeMarker(e);const n=`adjust-marker-${e}-${Date.now()}`;e==="BIM"?this.bimEntityId=n:this.mapEntityId=n,this.viewer.entities.add({id:n,position:this.Cesium.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),point:{pixelSize:10,color:e==="BIM"?this.Cesium.Color.RED:this.Cesium.Color.ORANGE,outlineColor:this.Cesium.Color.WHITE,outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY},label:{text:`${e==="BIM"?"BIM":"地图"}标记点`,font:"14pt sans-serif",style:this.Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:this.Cesium.VerticalOrigin.BOTTOM,pixelOffset:new this.Cesium.Cartesian2(0,-10),fillColor:this.Cesium.Color.WHITE,outlineColor:this.Cesium.Color.BLACK,backgroundColor:new this.Cesium.Color(.1,.1,.1,.8),showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY}})}registerPickHandler(e){this.destroyPickHandler(),!(!this.Cesium||!this.viewer)&&(this.pickHandler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.pickHandler.setInputAction(t=>{let n;try{n=this.viewer.scene.pickPosition(t.position)}catch(s){console.warn("pickPosition failed:",s)}if(!n){const s=this.viewer.camera.getPickRay(t.position);n=this.viewer.scene.globe.pick(s,this.viewer.scene)}if(n||(n=this.viewer.camera.pickEllipsoid(t.position,this.viewer.scene.globe.ellipsoid)),n){const s=this.Cesium.Cartographic.fromCartesian(n),o=this.Cesium.Math.toDegrees(s.longitude),r=this.Cesium.Math.toDegrees(s.latitude),a=s.height;e({longitude:o,latitude:r,height:a})}},this.Cesium.ScreenSpaceEventType.LEFT_CLICK,this.Cesium.KeyboardEventModifier.SHIFT))}destroyPickHandler(){this.pickHandler&&(this.pickHandler.destroy(),this.pickHandler=null)}calculateOffset(e,t){return{dLon:t.longitude-e.longitude,dLat:t.latitude-e.latitude,dHeight:t.height-e.height}}}const j3={class:"leitingbim-model-adjust-panel"},W3={class:"leitingbim-control-panel"},q3={class:"form-item"},K3={class:"radio-group"},X3={class:"form-item"},J3={class:"radio-group"},Z3={class:"form-item"},e_={class:"value"},t_={class:"param-row"},i_={class:"param-row"},n_={class:"param-row"},s_={class:"param-row"},o_={class:"param-row"},r_={class:"param-row"},a_={class:"param-row"},l_={class:"button-grid"},c_={key:1,class:"pick-mode-ui"},d_={class:"form-item",style:{display:"block","margin-bottom":"15px"}},h_={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},u_=["checked"],f_={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},p_={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},m_={class:"form-item",style:{display:"block","margin-bottom":"15px"}},g_={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},y_=["checked"],A_={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},v_={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},b_={class:"list-panel"},C_={class:"list-header"},w_={class:"col-check"},E_=["checked"],x_={class:"list-body"},I_={class:"col-check"},S_=["onUpdate:modelValue"],M_={class:"col-index"},T_=["title"],B_={class:"col-main"},__=["checked","onChange"],uo=Be(d.defineComponent({__name:"LeitingPosition",props:{visible:{type:Boolean},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean}},emits:["update:visible","update:open","close","save"],setup(i,{expose:e,emit:t}){const n=i,s=t,o=d.computed({get:()=>n.open!==void 0?n.open:n.visible,set:G=>{s("update:visible",G),s("update:open",G)}}),r=d.inject("leitingMethods"),a=d.ref("BIM"),l=d.ref("param"),c=d.ref(""),h=d.ref([]),u=d.ref("BIM"),p=d.ref(null),f=d.ref(null),m=d.ref(null),y=()=>(!m.value&&r?.value?.getViewer&&r?.value?.getCesium&&(m.value=new yc(r.value.getViewer(),r.value.getCesium())),m.value),g=()=>{y()?.clearMarkers(),p.value=null,f.value=null},A=(G,k)=>{G==="BIM"?p.value=k:f.value=k,y()?.addMarker(G,k),pe.success(`${G==="BIM"?"BIM":"地图"}标记点已添加`)},v=()=>{y()?.registerPickHandler(G=>{A(u.value,G)})},C=()=>{y()?.destroyPickHandler()},w=()=>{if(!p.value||!f.value){pe.warning("请先选择BIM标记点和地图标记点");return}if(!c.value){pe.warning("请先选择主模型");return}const G=y();let k=0,_=0,U=0;if(G){const{dLon:H,dLat:q,dHeight:X}=G.calculateOffset(p.value,f.value);k=H,_=q,U=X}else k=f.value.longitude-p.value.longitude,_=f.value.latitude-p.value.latitude,U=f.value.height-p.value.height;x.value.longitude+=k,x.value.latitude+=_,x.value.height+=U,E(c.value,{longitude:x.value.longitude,latitude:x.value.latitude,height:x.value.height}),pe.success("位置已调整")};d.watch(()=>l.value,G=>{G==="pick"?v():C()}),e({addMarker:A,setModelType:G=>{(G==="BIM"||G==="OSGB")&&(a.value=G)}});const x=d.ref({longitude:0,latitude:0,lonlat:1e-6,heightDistance:1,rotation:30,totalRotation:0,height:0,X:0,Y:0,Z:0}),I=d.computed(()=>{const G=h.value.find(k=>k.modelId===c.value);return G?G.modelName:""}),S=d.computed(()=>b.value.length>0&&b.value.every(G=>G.selected)),R=()=>{o.value=!1,s("close")},b=d.computed(()=>h.value.filter(G=>G.type===a.value)),B=G=>{const k=G.target.checked;b.value.forEach(_=>_.selected=k)},L=()=>{if(!r?.value)return;const G=r.value,k=G.getMapTileset?G.getMapTileset():{},_=[];if(Object.keys(k).forEach(U=>{const q=k[U].leiting||{};q.model&&_.push({modelId:q.model.modelId,modelName:q.model.modelName,selected:!1,formData:q.model.formData||{},dbName:q.model.dbName,url:q.model.url,type:q.model.type||"BIM"})}),h.value=_,_.length>0){const U=G.getBIMmodelId?G.getBIMmodelId():"";U&&_.find(H=>H.modelId===U)?N(U):N(_[0].modelId),_.forEach(H=>H.selected=!0)}},O=()=>{pe.info("拖动右下角标,可显示模型列表",void 0,2)},N=G=>{c.value=G;const k=h.value.find(_=>_.modelId===G);k&&k.formData&&Object.keys(x.value).forEach(_=>{k.formData[_]!==void 0&&(x.value[_]=k.formData[_])})},D=G=>r?.value?.getMapTileset?r.value.getMapTileset()[G]:null,E=(G,k)=>{const _=D(G),U=r.value.getCesium();if(_&&U){if(_.leiting?.model){_.leiting.model.formData={..._.leiting.model.formData,...k};const H=h.value.find(q=>q.modelId===G);H&&(H.formData=_.leiting.model.formData)}Xa({Cesium:U,tileset:_})}},T=G=>{if(!c.value)return;const _=h.value.find(q=>q.modelId===c.value)?.formData?.[G]??0,U=x.value[G],H=U-_;E(c.value,{[G]:U}),H!==0&&b.value.filter(X=>X.selected&&X.modelId!==c.value).forEach(X=>{const fe=(X.formData?.[G]??0)+H;E(X.modelId,{[G]:fe})})},P=G=>{const k=b.value.filter(q=>q.selected);if(k.length===0){pe.warning("请先选择要调整的模型");return}const{lonlat:_,heightDistance:U,rotation:H}=x.value;k.forEach(q=>{const X={...q.formData};switch(G){case"north":X.latitude+=_;break;case"south":X.latitude-=_;break;case"east":X.longitude+=_;break;case"west":X.longitude-=_;break;case"up":X.height+=U;break;case"down":X.height-=U;break;case"rotateLeft":X.totalRotation=(X.totalRotation||0)+H;break;case"rotateRight":X.totalRotation=(X.totalRotation||0)-H;break}q.modelId===c.value&&(X.lonlat=_,X.heightDistance=U,X.rotation=H,Object.assign(x.value,X)),E(q.modelId,X)})},F=()=>{if(!c.value){pe.warning("请先选择主模型");return}const G=D(c.value);if(!G||!r?.value?.getViewer)return;const k=r.value.getViewer(),_=r.value.getCesium(),U=G.boundingSphere;k.camera.flyToBoundingSphere(U,{offset:new _.HeadingPitchRange(0,_.Math.toRadians(-90),U.radius*2),duration:1.5})},V=()=>{r?.value?.saveRegion?(r.value.saveRegion(h.value),s("save",d.unref(h))):(console.log("Save models:",h.value),pe.warning("未找到保存接口,数据已打印控制台"))};return d.watch(()=>n.visible,G=>{G?(L(),O(),l.value==="pick"&&v()):(C(),g())}),d.onMounted(()=>{n.visible&&(L(),O(),l.value==="pick"&&v())}),(G,k)=>(d.openBlock(),d.createBlock(gt,{visible:o.value,title:"调整位置(调整前可选择正北俯视)","full-height":i.fullHeight,width:260,"onUpdate:visible":k[25]||(k[25]=_=>o.value=_),onClose:R,onSave:V,class:"base-position-card"},{default:d.withCtx(()=>[d.createElementVNode("div",j3,[d.createElementVNode("div",W3,[d.createElementVNode("div",q3,[k[26]||(k[26]=d.createElementVNode("label",null,"模型类型:",-1)),d.createElementVNode("div",K3,[d.createElementVNode("span",{class:d.normalizeClass({active:a.value==="BIM"}),onClick:k[0]||(k[0]=_=>a.value="BIM")},"BIM模型",2),d.createElementVNode("span",{class:d.normalizeClass({active:a.value==="OSGB"}),onClick:k[1]||(k[1]=_=>a.value="OSGB")},"倾斜摄影",2)])]),d.createElementVNode("div",X3,[k[27]||(k[27]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",J3,[d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="param"}),onClick:k[2]||(k[2]=_=>l.value="param")},"参数模式",2),d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="pick"}),onClick:k[3]||(k[3]=_=>l.value="pick")},"地图点选",2)])]),d.createElementVNode("div",Z3,[k[28]||(k[28]=d.createElementVNode("label",null,"当前主模型:",-1)),d.createElementVNode("span",e_,d.toDisplayString(I.value||"未选择"),1)]),k[42]||(k[42]=d.createElementVNode("div",{class:"separator"},null,-1)),l.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[k[36]||(k[36]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",t_,[k[29]||(k[29]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[4]||(k[4]=_=>x.value.longitude=_),onChange:k[5]||(k[5]=_=>T("longitude")),step:"0.000001"},null,544),[[d.vModelText,x.value.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",i_,[k[30]||(k[30]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[6]||(k[6]=_=>x.value.latitude=_),onChange:k[7]||(k[7]=_=>T("latitude")),step:"0.000001"},null,544),[[d.vModelText,x.value.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",n_,[k[31]||(k[31]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[8]||(k[8]=_=>x.value.height=_),onChange:k[9]||(k[9]=_=>T("height")),step:"0.1"},null,544),[[d.vModelText,x.value.height,void 0,{number:!0}]])]),d.createElementVNode("div",s_,[k[32]||(k[32]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[10]||(k[10]=_=>x.value.totalRotation=_),onChange:k[11]||(k[11]=_=>T("totalRotation")),step:"1"},null,544),[[d.vModelText,x.value.totalRotation,void 0,{number:!0}]])]),k[37]||(k[37]=d.createElementVNode("div",{class:"separator"},null,-1)),k[38]||(k[38]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",o_,[k[33]||(k[33]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[12]||(k[12]=_=>x.value.lonlat=_),step:"0.000001"},null,512),[[d.vModelText,x.value.lonlat,void 0,{number:!0}]])]),d.createElementVNode("div",r_,[k[34]||(k[34]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[13]||(k[13]=_=>x.value.heightDistance=_),step:"0.1"},null,512),[[d.vModelText,x.value.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",a_,[k[35]||(k[35]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[14]||(k[14]=_=>x.value.rotation=_),step:"1"},null,512),[[d.vModelText,x.value.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",l_,[d.createElementVNode("button",{onClick:k[15]||(k[15]=_=>P("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:k[16]||(k[16]=_=>P("north"))},"北移"),d.createElementVNode("button",{onClick:k[17]||(k[17]=_=>P("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:k[18]||(k[18]=_=>P("west"))},"西移"),d.createElementVNode("button",{onClick:k[19]||(k[19]=_=>P("south"))},"南移"),d.createElementVNode("button",{onClick:k[20]||(k[20]=_=>P("east"))},"东移"),d.createElementVNode("button",{onClick:k[21]||(k[21]=_=>P("up"))},"上移"),d.createElementVNode("button",{onClick:k[22]||(k[22]=_=>P("down"))},"下移"),d.createElementVNode("button",{onClick:F,class:"primary-btn"},"正北俯视"),d.createElementVNode("button",{onClick:V,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):l.value==="pick"?(d.openBlock(),d.createElementBlock("div",c_,[d.createElementVNode("div",d_,[d.createElementVNode("div",h_,[d.createElementVNode("div",{onClick:k[23]||(k[23]=_=>u.value="BIM"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[d.createElementVNode("input",{type:"radio",checked:u.value==="BIM",style:{"margin-right":"5px"}},null,8,u_),k[39]||(k[39]=d.createElementVNode("span",{style:{"font-weight":"bold"}},"BIM标记点:",-1))]),p.value?(d.openBlock(),d.createElementBlock("div",f_,[d.createElementVNode("div",null,"经度:"+d.toDisplayString(p.value.longitude.toFixed(10)),1),d.createElementVNode("div",null,"纬度:"+d.toDisplayString(p.value.latitude.toFixed(10)),1)])):(d.openBlock(),d.createElementBlock("div",p_,"未选择"))])]),d.createElementVNode("div",m_,[d.createElementVNode("div",g_,[d.createElementVNode("div",{onClick:k[24]||(k[24]=_=>u.value="MAP"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[d.createElementVNode("input",{type:"radio",checked:u.value==="MAP",style:{"margin-right":"5px"}},null,8,y_),k[40]||(k[40]=d.createElementVNode("span",{style:{"font-weight":"bold"}},"地图标记点:",-1))]),f.value?(d.openBlock(),d.createElementBlock("div",A_,[d.createElementVNode("div",null,"经度:"+d.toDisplayString(f.value.longitude.toFixed(10)),1),d.createElementVNode("div",null,"纬度:"+d.toDisplayString(f.value.latitude.toFixed(10)),1)])):(d.openBlock(),d.createElementBlock("div",v_,"未选择"))])]),d.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[d.createElementVNode("button",{onClick:w},"调整位置"),d.createElementVNode("button",{onClick:V},"保存")]),k[41]||(k[41]=d.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 勾选上方 BIM 或 地图 标记点选项。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“调整位置”进行校准。")],-1))])):d.createCommentVNode("",!0)]),d.createElementVNode("div",b_,[d.createElementVNode("div",C_,[d.createElementVNode("div",w_,[d.createElementVNode("input",{type:"checkbox",checked:S.value,onChange:B},null,40,E_)]),k[43]||(k[43]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),k[44]||(k[44]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),k[45]||(k[45]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",x_,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(b.value,(_,U)=>(d.openBlock(),d.createElementBlock("div",{key:_.modelId,class:d.normalizeClass(["list-item",{active:_.modelId===c.value}])},[d.createElementVNode("div",I_,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":H=>_.selected=H},null,8,S_),[[d.vModelCheckbox,_.selected]])]),d.createElementVNode("div",M_,d.toDisplayString(U+1),1),d.createElementVNode("div",{class:"col-name",title:_.modelName},d.toDisplayString(_.modelName),9,T_),d.createElementVNode("div",B_,[d.createElementVNode("input",{type:"radio",name:"mainModel",checked:_.modelId===c.value,onChange:H=>N(_.modelId)},null,40,__)])],2))),128))])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-fd4822ea"]]);function Ur(){return Ur=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},Ur.apply(null,arguments)}const k_={locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",yearFormat:"YYYY年",dayFormat:"D日",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH时mm分ss秒",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"},P_={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},vm={lang:Ur({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},k_),timePickerLocale:Ur({},P_)};vm.lang.ok="确定";var Vr={exports:{}},D_=Vr.exports,bm;function Cm(){return bm||(bm=1,(function(i,e){(function(t,n){i.exports=n()})(D_,(function(){var t=1e3,n=6e4,s=36e5,o="millisecond",r="second",a="minute",l="hour",c="day",h="week",u="month",p="quarter",f="year",m="date",y="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,A=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var D=["th","st","nd","rd"],E=N%100;return"["+N+(D[(E-20)%10]||D[E]||D[0])+"]"}},C=function(N,D,E){var T=String(N);return!T||T.length>=D?N:""+Array(D+1-T.length).join(E)+N},w={s:C,z:function(N){var D=-N.utcOffset(),E=Math.abs(D),T=Math.floor(E/60),P=E%60;return(D<=0?"+":"-")+C(T,2,"0")+":"+C(P,2,"0")},m:function N(D,E){if(D.date()<E.date())return-N(E,D);var T=12*(E.year()-D.year())+(E.month()-D.month()),P=D.clone().add(T,u),F=E-P<0,V=D.clone().add(T+(F?-1:1),u);return+(-(T+(E-P)/(F?P-V:V-P))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:u,y:f,w:h,d:c,D:m,h:l,m:a,s:r,ms:o,Q:p}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},M="en",x={};x[M]=v;var I="$isDayjsObject",S=function(N){return N instanceof L||!(!N||!N[I])},R=function N(D,E,T){var P;if(!D)return M;if(typeof D=="string"){var F=D.toLowerCase();x[F]&&(P=F),E&&(x[F]=E,P=F);var V=D.split("-");if(!P&&V.length>1)return N(V[0])}else{var G=D.name;x[G]=D,P=G}return!T&&P&&(M=P),P||!T&&M},b=function(N,D){if(S(N))return N.clone();var E=typeof D=="object"?D:{};return E.date=N,E.args=arguments,new L(E)},B=w;B.l=R,B.i=S,B.w=function(N,D){return b(N,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var L=(function(){function N(E){this.$L=R(E.locale,null,!0),this.parse(E),this.$x=this.$x||E.x||{},this[I]=!0}var D=N.prototype;return D.parse=function(E){this.$d=(function(T){var P=T.date,F=T.utc;if(P===null)return new Date(NaN);if(B.u(P))return new Date;if(P instanceof Date)return new Date(P);if(typeof P=="string"&&!/Z$/i.test(P)){var V=P.match(g);if(V){var G=V[2]-1||0,k=(V[7]||"0").substring(0,3);return F?new Date(Date.UTC(V[1],G,V[3]||1,V[4]||0,V[5]||0,V[6]||0,k)):new Date(V[1],G,V[3]||1,V[4]||0,V[5]||0,V[6]||0,k)}}return new Date(P)})(E),this.init()},D.init=function(){var E=this.$d;this.$y=E.getFullYear(),this.$M=E.getMonth(),this.$D=E.getDate(),this.$W=E.getDay(),this.$H=E.getHours(),this.$m=E.getMinutes(),this.$s=E.getSeconds(),this.$ms=E.getMilliseconds()},D.$utils=function(){return B},D.isValid=function(){return this.$d.toString()!==y},D.isSame=function(E,T){var P=b(E);return this.startOf(T)<=P&&P<=this.endOf(T)},D.isAfter=function(E,T){return b(E)<this.startOf(T)},D.isBefore=function(E,T){return this.endOf(T)<b(E)},D.$g=function(E,T,P){return B.u(E)?this[T]:this.set(P,E)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(E,T){var P=this,F=!!B.u(T)||T,V=B.p(E),G=function(fe,me){var be=B.w(P.$u?Date.UTC(P.$y,me,fe):new Date(P.$y,me,fe),P);return F?be:be.endOf(c)},k=function(fe,me){return B.w(P.toDate()[fe].apply(P.toDate("s"),(F?[0,0,0,0]:[23,59,59,999]).slice(me)),P)},_=this.$W,U=this.$M,H=this.$D,q="set"+(this.$u?"UTC":"");switch(V){case f:return F?G(1,0):G(31,11);case u:return F?G(1,U):G(0,U+1);case h:var X=this.$locale().weekStart||0,de=(_<X?_+7:_)-X;return G(F?H-de:H+(6-de),U);case c:case m:return k(q+"Hours",0);case l:return k(q+"Minutes",1);case a:return k(q+"Seconds",2);case r:return k(q+"Milliseconds",3);default:return this.clone()}},D.endOf=function(E){return this.startOf(E,!1)},D.$set=function(E,T){var P,F=B.p(E),V="set"+(this.$u?"UTC":""),G=(P={},P[c]=V+"Date",P[m]=V+"Date",P[u]=V+"Month",P[f]=V+"FullYear",P[l]=V+"Hours",P[a]=V+"Minutes",P[r]=V+"Seconds",P[o]=V+"Milliseconds",P)[F],k=F===c?this.$D+(T-this.$W):T;if(F===u||F===f){var _=this.clone().set(m,1);_.$d[G](k),_.init(),this.$d=_.set(m,Math.min(this.$D,_.daysInMonth())).$d}else G&&this.$d[G](k);return this.init(),this},D.set=function(E,T){return this.clone().$set(E,T)},D.get=function(E){return this[B.p(E)]()},D.add=function(E,T){var P,F=this;E=Number(E);var V=B.p(T),G=function(U){var H=b(F);return B.w(H.date(H.date()+Math.round(U*E)),F)};if(V===u)return this.set(u,this.$M+E);if(V===f)return this.set(f,this.$y+E);if(V===c)return G(1);if(V===h)return G(7);var k=(P={},P[a]=n,P[l]=s,P[r]=t,P)[V]||1,_=this.$d.getTime()+E*k;return B.w(_,this)},D.subtract=function(E,T){return this.add(-1*E,T)},D.format=function(E){var T=this,P=this.$locale();if(!this.isValid())return P.invalidDate||y;var F=E||"YYYY-MM-DDTHH:mm:ssZ",V=B.z(this),G=this.$H,k=this.$m,_=this.$M,U=P.weekdays,H=P.months,q=P.meridiem,X=function(me,be,_e,Je){return me&&(me[be]||me(T,F))||_e[be].slice(0,Je)},de=function(me){return B.s(G%12||12,me,"0")},fe=q||function(me,be,_e){var Je=me<12?"AM":"PM";return _e?Je.toLowerCase():Je};return F.replace(A,(function(me,be){return be||(function(_e){switch(_e){case"YY":return String(T.$y).slice(-2);case"YYYY":return B.s(T.$y,4,"0");case"M":return _+1;case"MM":return B.s(_+1,2,"0");case"MMM":return X(P.monthsShort,_,H,3);case"MMMM":return X(H,_);case"D":return T.$D;case"DD":return B.s(T.$D,2,"0");case"d":return String(T.$W);case"dd":return X(P.weekdaysMin,T.$W,U,2);case"ddd":return X(P.weekdaysShort,T.$W,U,3);case"dddd":return U[T.$W];case"H":return String(G);case"HH":return B.s(G,2,"0");case"h":return de(1);case"hh":return de(2);case"a":return fe(G,k,!0);case"A":return fe(G,k,!1);case"m":return String(k);case"mm":return B.s(k,2,"0");case"s":return String(T.$s);case"ss":return B.s(T.$s,2,"0");case"SSS":return B.s(T.$ms,3,"0");case"Z":return V}return null})(me)||V.replace(":","")}))},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(E,T,P){var F,V=this,G=B.p(T),k=b(E),_=(k.utcOffset()-this.utcOffset())*n,U=this-k,H=function(){return B.m(V,k)};switch(G){case f:F=H()/12;break;case u:F=H();break;case p:F=H()/3;break;case h:F=(U-_)/6048e5;break;case c:F=(U-_)/864e5;break;case l:F=U/s;break;case a:F=U/n;break;case r:F=U/t;break;default:F=U}return P?F:B.a(F)},D.daysInMonth=function(){return this.endOf(u).$D},D.$locale=function(){return x[this.$L]},D.locale=function(E,T){if(!E)return this.$L;var P=this.clone(),F=R(E,T,!0);return F&&(P.$L=F),P},D.clone=function(){return B.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},N})(),O=L.prototype;return b.prototype=O,[["$ms",o],["$s",r],["$m",a],["$H",l],["$W",c],["$M",u],["$y",f],["$D",m]].forEach((function(N){O[N[1]]=function(D){return this.$g(D,N[0],N[1])}})),b.extend=function(N,D){return N.$i||(N(D,L,b),N.$i=!0),b},b.locale=R,b.isDayjs=S,b.unix=function(N){return b(1e3*N)},b.en=x[M],b.Ls=x,b.p={},b}))})(Vr)),Vr.exports}var N_=Cm();const zt=nn(N_);var Qr={exports:{}},L_=Qr.exports,wm;function R_(){return wm||(wm=1,(function(i,e){(function(t,n){i.exports=n(Cm())})(L_,(function(t){function n(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var s=n(t),o={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(r,a){return a==="W"?r+"周":r+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(r,a){var l=100*r+a;return l<600?"凌晨":l<900?"早上":l<1100?"上午":l<1300?"中午":l<1800?"下午":"晚上"}};return s.default.locale(o,null,!0),o}))})(Qr)),Qr.exports}R_();var zr={exports:{}},F_=zr.exports,Em;function O_(){return Em||(Em=1,(function(i,e){(function(t,n){i.exports=n()})(F_,(function(){return function(t,n,s){var o=n.prototype,r=function(u){return u&&(u.indexOf?u:u.s)},a=function(u,p,f,m,y){var g=u.name?u:u.$locale(),A=r(g[p]),v=r(g[f]),C=A||v.map((function(M){return M.slice(0,m)}));if(!y)return C;var w=g.weekStart;return C.map((function(M,x){return C[(x+(w||0))%7]}))},l=function(){return s.Ls[s.locale()]},c=function(u,p){return u.formats[p]||(function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(m,y,g){return y||g.slice(1)}))})(u.formats[p.toUpperCase()])},h=function(){var u=this;return{months:function(p){return p?p.format("MMMM"):a(u,"months")},monthsShort:function(p){return p?p.format("MMM"):a(u,"monthsShort","months",3)},firstDayOfWeek:function(){return u.$locale().weekStart||0},weekdays:function(p){return p?p.format("dddd"):a(u,"weekdays")},weekdaysMin:function(p){return p?p.format("dd"):a(u,"weekdaysMin","weekdays",2)},weekdaysShort:function(p){return p?p.format("ddd"):a(u,"weekdaysShort","weekdays",3)},longDateFormat:function(p){return c(u.$locale(),p)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return h.bind(this)()},s.localeData=function(){var u=l();return{firstDayOfWeek:function(){return u.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(p){return c(u,p)},meridiem:u.meridiem,ordinal:u.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(u){return a(l(),"weekdays",null,null,u)},s.weekdaysShort=function(u){return a(l(),"weekdaysShort","weekdays",3,u)},s.weekdaysMin=function(u){return a(l(),"weekdaysMin","weekdays",2,u)}}}))})(zr)),zr.exports}var G_=O_();const U_=nn(G_);var Hr={exports:{}},V_=Hr.exports,xm;function Q_(){return xm||(xm=1,(function(i,e){(function(t,n){i.exports=n()})(V_,(function(){return function(t,n){n.prototype.weekday=function(s){var o=this.$locale().weekStart||0,r=this.$W,a=(r<o?r+7:r)-o;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}}))})(Hr)),Hr.exports}var z_=Q_();const H_=nn(z_);var Yr={exports:{}},Y_=Yr.exports,Im;function $_(){return Im||(Im=1,(function(i,e){(function(t,n){i.exports=n()})(Y_,(function(){var t="week",n="year";return function(s,o,r){var a=o.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var h=r(this).startOf(n).add(1,n).date(c),u=r(this).endOf(t);if(h.isBefore(u))return 1}var p=r(this).startOf(n).date(c).startOf(t).subtract(1,"millisecond"),f=this.diff(p,t,!0);return f<0?r(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(Yr)),Yr.exports}var j_=$_();const W_=nn(j_);var $r={exports:{}},q_=$r.exports,Sm;function K_(){return Sm||(Sm=1,(function(i,e){(function(t,n){i.exports=n()})(q_,(function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},n=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,o=/\d\d/,r=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},c=function(g){return(g=+g)+(g>68?1900:2e3)},h=function(g){return function(A){this[g]=+A}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(g){(this.zone||(this.zone={})).offset=(function(A){if(!A||A==="Z")return 0;var v=A.match(/([+-]|\d\d)/g),C=60*v[1]+(+v[2]||0);return C===0?0:v[0]==="+"?-C:C})(g)}],p=function(g){var A=l[g];return A&&(A.indexOf?A:A.s.concat(A.f))},f=function(g,A){var v,C=l.meridiem;if(C){for(var w=1;w<=24;w+=1)if(g.indexOf(C(w,0,A))>-1){v=w>12;break}}else v=g===(A?"pm":"PM");return v},m={A:[a,function(g){this.afternoon=f(g,!1)}],a:[a,function(g){this.afternoon=f(g,!0)}],Q:[s,function(g){this.month=3*(g-1)+1}],S:[s,function(g){this.milliseconds=100*+g}],SS:[o,function(g){this.milliseconds=10*+g}],SSS:[/\d{3}/,function(g){this.milliseconds=+g}],s:[r,h("seconds")],ss:[r,h("seconds")],m:[r,h("minutes")],mm:[r,h("minutes")],H:[r,h("hours")],h:[r,h("hours")],HH:[r,h("hours")],hh:[r,h("hours")],D:[r,h("day")],DD:[o,h("day")],Do:[a,function(g){var A=l.ordinal,v=g.match(/\d+/);if(this.day=v[0],A)for(var C=1;C<=31;C+=1)A(C).replace(/\[|\]/g,"")===g&&(this.day=C)}],w:[r,h("week")],ww:[o,h("week")],M:[r,h("month")],MM:[o,h("month")],MMM:[a,function(g){var A=p("months"),v=(p("monthsShort")||A.map((function(C){return C.slice(0,3)}))).indexOf(g)+1;if(v<1)throw new Error;this.month=v%12||v}],MMMM:[a,function(g){var A=p("months").indexOf(g)+1;if(A<1)throw new Error;this.month=A%12||A}],Y:[/[+-]?\d+/,h("year")],YY:[o,function(g){this.year=c(g)}],YYYY:[/\d{4}/,h("year")],Z:u,ZZ:u};function y(g){var A,v;A=g,v=l&&l.formats;for(var C=(g=A.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(b,B,L){var O=L&&L.toUpperCase();return B||v[L]||t[L]||v[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(N,D,E){return D||E.slice(1)}))}))).match(n),w=C.length,M=0;M<w;M+=1){var x=C[M],I=m[x],S=I&&I[0],R=I&&I[1];C[M]=R?{regex:S,parser:R}:x.replace(/^\[|\]$/g,"")}return function(b){for(var B={},L=0,O=0;L<w;L+=1){var N=C[L];if(typeof N=="string")O+=N.length;else{var D=N.regex,E=N.parser,T=b.slice(O),P=D.exec(T)[0];E.call(B,P),b=b.replace(P,"")}}return(function(F){var V=F.afternoon;if(V!==void 0){var G=F.hours;V?G<12&&(F.hours+=12):G===12&&(F.hours=0),delete F.afternoon}})(B),B}}return function(g,A,v){v.p.customParseFormat=!0,g&&g.parseTwoDigitYear&&(c=g.parseTwoDigitYear);var C=A.prototype,w=C.parse;C.parse=function(M){var x=M.date,I=M.utc,S=M.args;this.$u=I;var R=S[1];if(typeof R=="string"){var b=S[2]===!0,B=S[3]===!0,L=b||B,O=S[2];B&&(O=S[2]),l=this.$locale(),!b&&O&&(l=v.Ls[O]),this.$d=(function(T,P,F,V){try{if(["x","X"].indexOf(P)>-1)return new Date((P==="X"?1e3:1)*T);var G=y(P)(T),k=G.year,_=G.month,U=G.day,H=G.hours,q=G.minutes,X=G.seconds,de=G.milliseconds,fe=G.zone,me=G.week,be=new Date,_e=U||(k||_?1:be.getDate()),Je=k||be.getFullYear(),lt=0;k&&!_||(lt=_>0?_-1:be.getMonth());var ct,Bt=H||0,vt=q||0,j=X||0,Y=de||0;return fe?new Date(Date.UTC(Je,lt,_e,Bt,vt,j,Y+60*fe.offset*1e3)):F?new Date(Date.UTC(Je,lt,_e,Bt,vt,j,Y)):(ct=new Date(Je,lt,_e,Bt,vt,j,Y),me&&(ct=V(ct).week(me).toDate()),ct)}catch{return new Date("")}})(x,R,I,v),this.init(),O&&O!==!0&&(this.$L=this.locale(O).$L),L&&x!=this.format(R)&&(this.$d=new Date("")),l={}}else if(R instanceof Array)for(var N=R.length,D=1;D<=N;D+=1){S[1]=R[D-1];var E=v.apply(this,S);if(E.isValid()){this.$d=E.$d,this.$L=E.$L,this.init();break}D===N&&(this.$d=new Date(""))}else w.call(this,M)}}}))})($r)),$r.exports}var X_=K_();const J_=nn(X_),Z_={class:"setting-panel"},ek={class:"tabs-header"},tk={class:"tab-content"},ik={key:0,class:"section"},nk={class:"setting-item"},sk={class:"setting-item"},ok={class:"setting-item"},rk={key:1,class:"section"},ak={class:"tabs-header",style:{"margin-bottom":"8px"}},lk={key:0},ck={class:"setting-item column"},dk={class:"setting-item"},hk={key:1},uk={class:"setting-item column"},fk={class:"setting-item column",style:{"margin-top":"12px","border-top":"1px solid rgba(255,255,255,0.1)","padding-top":"8px"}},pk={class:"search-box",style:{position:"relative"}},mk={key:0,class:"search-dropdown"},gk=["onClick"],yk={class:"result-name"},Ak={class:"result-coord"},vk={key:2,class:"section"},bk={class:"setting-item"},Ck={key:0,class:"setting-item column"},wk={class:"sub-label"},Ek={class:"setting-item"},xk={class:"setting-item"},Ik={class:"setting-item column"},Sk={class:"setting-item column"},Mk={class:"sub-label"},Tk={class:"setting-item column"},Bk={class:"sub-label"},_k={class:"setting-item column"},kk={class:"sub-label"},Pk={class:"setting-item column"},Dk={style:{display:"flex",gap:"8px","margin-bottom":"8px"}},Nk=["onClick","title"],Lk={style:{display:"flex",gap:"8px","align-items":"center"}},Rk={key:3,class:"section"},Fk={class:"setting-item"},Ok={class:"setting-item column"},fo=Be(d.defineComponent({__name:"LeitingSetting",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean,default:!1},tiandituToken:{type:String,default:""},initialConfig:{type:Object,default:()=>({})}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){zt.locale("zh-cn"),zt.extend(U_),zt.extend(H_),zt.extend(W_),zt.extend(J_);const t=oe.Switch,n=oe.Radio.Group,s=oe.Radio,o=oe.Input,r=oe.Slider,a=oe.Select,l=oe.Select.Option,c=oe.DatePicker,h=i,u=e,p=d.inject("leitingMethods"),f=d.computed({get:()=>h.open!==void 0?h.open:h.visible,set:E=>{u("update:visible",E),u("update:open",E)}}),m=d.ref("GIS"),y=d.reactive({globe:!1,terrain:!1,depthTest:!1}),g=d.reactive({provider:"tianditu",tianditu:{token:"c25f14fb6bd4397cf8fe45144ff768d6",layerType:"img_w",showLabel:!1},arcgis:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"},baseMap:"tianditu"}),A=d.reactive({shadows:!1,shadowDarkness:.7,environmentMap:!1,ambientOcclusion:!1,time:zt("2025-06-22 10:00"),brightness:1,contrast:1,saturation:1,backgroundColor:"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)"}),v=d.reactive({collision:!1,habit:0}),C=E=>{E&&(E.globe!==void 0&&(y.globe=E.globe),E.terrain!==void 0&&(y.terrain=E.terrain),E.depthTest!==void 0&&(y.depthTest=E.depthTest),E.mapProvider!==void 0&&(g.provider=E.mapProvider),E.tiandituLayerType!==void 0&&(g.tianditu.layerType=E.tiandituLayerType),E.tiandituShowLabel!==void 0&&(g.tianditu.showLabel=E.tiandituShowLabel),E.arcgisUrl!==void 0&&(g.arcgis.url=E.arcgisUrl),E.shadows!==void 0&&(A.shadows=E.shadows),E.shadowDarkness!==void 0&&(A.shadowDarkness=E.shadowDarkness),E.environmentMap!==void 0&&(A.environmentMap=E.environmentMap),E.ambientOcclusion!==void 0&&(A.ambientOcclusion=E.ambientOcclusion),E.time!==void 0&&(typeof E.time=="number"?A.time=zt().startOf("day").add(E.time,"hour"):A.time=zt(E.time)),E.brightness!==void 0&&(A.brightness=E.brightness),E.contrast!==void 0&&(A.contrast=E.contrast),E.saturation!==void 0&&(A.saturation=E.saturation),E.backgroundColor!==void 0&&(A.backgroundColor=E.backgroundColor),E.collision!==void 0&&(v.collision=E.collision),E.mouseHabit!==void 0&&(v.habit=E.mouseHabit))};d.watch(()=>h.initialConfig,E=>{C(E)},{deep:!0,immediate:!0});const w=["linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)","linear-gradient(0deg, #0f2027 0%, #203a43 50%, #2c5364 100%)","linear-gradient(0deg, #cfd9df 0%, #e2ebf0 100%)"],M=[{label:"全球影像地图服务(墨卡托)",value:"img_w"},{label:"全球影像地图服务(经纬度)",value:"img_c"},{label:"全球矢量地图服务(墨卡托)",value:"vec_w"},{label:"全球矢量地图服务(经纬度)",value:"vec_c"},{label:"全球地形晕渲服务(墨卡托)",value:"ter_w"},{label:"全球地形晕渲服务(经纬度)",value:"ter_c"}],x=()=>{const E=g.provider,T={};E==="tianditu"?(T.token=g.tianditu.token,T.layerType=g.tianditu.layerType,T.showAnnotation=g.tianditu.showLabel):E==="arcgis"&&(T.url=g.arcgis.url),p.value?.changeBaseMap?.(E,T)};d.watch(()=>g.provider,x),d.watch(()=>g.tianditu.layerType,x),d.watch(()=>g.tianditu.showLabel,x),d.watch(()=>g.tianditu.token,qo(x,1e3)),d.watch(()=>g.arcgis.url,qo(x,1e3)),d.onMounted(()=>{h.tiandituToken&&(g.tianditu.token=h.tiandituToken)}),d.watch(()=>y.globe,E=>p.value?.setGlobeEnvironmentVisible?.(E)),d.watch(()=>y.terrain,E=>p.value?.setTerrainEnable?.(E)),d.watch(()=>y.depthTest,E=>p.value?.setDepthTestEnable?.(E)),d.watch(()=>p?.value,E=>{if(E){if(E.getConfigure=()=>({globe:y.globe,terrain:y.terrain,depthTest:y.depthTest,mapProvider:g.provider,tiandituLayerType:g.tianditu.layerType,tiandituShowLabel:g.tianditu.showLabel,arcgisUrl:g.arcgis.url,shadows:A.shadows,shadowDarkness:A.shadowDarkness,environmentMap:A.environmentMap,ambientOcclusion:A.ambientOcclusion,time:zt.isDayjs(A.time)?A.time.format("YYYY-MM-DD HH:mm"):A.time,brightness:A.brightness,contrast:A.contrast,saturation:A.saturation,backgroundColor:A.backgroundColor,collision:v.collision,mouseHabit:v.habit}),E.setConfigure=T=>{C(T)},E.setBackgroundColor&&A.backgroundColor&&E.setBackgroundColor(A.backgroundColor),E.setGlobeEnvironmentVisible&&E.setGlobeEnvironmentVisible(y.globe),E.setShadowsEnable&&E.setShadowsEnable(A.shadows),E.setShadowDarkness&&E.setShadowDarkness(A.shadowDarkness),E.setEnvironmentMapEnable&&E.setEnvironmentMapEnable(A.environmentMap),E.setAmbientOcclusion&&E.setAmbientOcclusion(A.ambientOcclusion),E.setTime){const T=zt.isDayjs(A.time)?A.time.toDate():new Date;E.setTime(T)}E.setModelBrightness&&E.setModelBrightness(A.brightness),E.setCollisionDetection&&E.setCollisionDetection(v.collision),E.setMouseHabit&&E.setMouseHabit(v.habit),E.changeBaseMap&&g.baseMap&&E.changeBaseMap(g.baseMap,{token:g.tianditu.token,layerType:g.tianditu.layerType,showAnnotation:g.tianditu.showLabel,url:g.arcgis.url})}},{immediate:!0});const I=d.computed({get:()=>{const E=A.backgroundColor;return/^#[0-9A-Fa-f]{6}$/.test(E)?E:"#ffffff"},set:E=>{A.backgroundColor=E}}),S=d.ref(""),R=d.ref(!1),b=d.ref([]);d.watch(()=>y.globe,E=>p.value?.setGlobeEnvironmentVisible?.(E)),d.watch(()=>y.terrain,E=>p.value?.setTerrainEnable?.(E)),d.watch(()=>g.baseMap,E=>{p.value?.changeBaseMap?.(E,{token:h.tiandituToken})}),d.watch(()=>A.shadows,E=>p.value?.setShadowsEnable?.(E)),d.watch(()=>A.shadowDarkness,E=>p.value?.setShadowDarkness?.(E)),d.watch(()=>A.environmentMap,E=>p.value?.setEnvironmentMapEnable?.(E)),d.watch(()=>A.ambientOcclusion,E=>p.value?.setAmbientOcclusion?.(E)),d.watch(()=>A.time,E=>{const T=zt.isDayjs(E)?E.toDate():new Date;p.value?.setTime?.(T)}),d.watch(()=>[A.brightness,A.contrast,A.saturation],([E,T,P])=>{const F=p.value;F?.setModelColorAdjustment?F.setModelColorAdjustment({brightness:E,contrast:T,saturation:P}):F?.setModelBrightness?.(E)}),d.watch(()=>A.backgroundColor,E=>{if(p.value?.setBackgroundColor)p.value.setBackgroundColor(E);else{const T=document.querySelector(".cesium-viewer");T&&(T.style.background=E)}}),d.watch(()=>v.collision,E=>p.value?.setCollisionDetection?.(E)),d.watch(()=>v.habit,E=>p.value?.setMouseHabit?.(E));const B=E=>{const T=[];if(E?.pois&&Array.isArray(E.pois)){for(const P of E.pois)if(P.lonlat){const F=P.lonlat.split(/[, ]/).map(Number);F.length>=2&&!isNaN(F[0])&&!isNaN(F[1])&&T.push({name:P.name||"未命名",lon:F[0],lat:F[1],raw:P})}}if(E?.area&&E.area.lonlat){const P=E.area,F=P.lonlat.split(/[, ]/).map(Number);F.length>=2&&!isNaN(F[0])&&!isNaN(F[1])&&T.push({name:P.name||"未命名",lon:F[0],lat:F[1],raw:P})}if(E?.prompt&&Array.isArray(E.prompt)){for(const P of E.prompt)if(P.admins&&Array.isArray(P.admins)){for(const F of P.admins)if(F.lonlat){const V=F.lonlat.split(/[, ]/).map(Number);V.length>=2&&!isNaN(V[0])&&!isNaN(V[1])&&T.push({name:F.adminName||F.name||"未命名",lon:V[0],lat:V[1],raw:F})}}}return T},O=qo(async()=>{const E=(S.value||"").trim();if(!E){b.value=[];return}const T=h.tiandituToken||"c25f14fb6bd4397cf8fe45144ff768d6";R.value=!0,b.value=[];try{const F=`https://api.tianditu.gov.cn/v2/search?postStr=${encodeURIComponent(JSON.stringify({keyWord:E,level:12,mapBound:"-180,-90,180,90",queryType:1,start:0,count:10}))}&type=query&tk=${encodeURIComponent(T)}`,V=await fetch(F);if(!V.ok)throw new Error(`HTTP ${V.status}`);const G=await V.json();b.value=B(G)}catch(P){console.error("tianditu search error",P)}finally{R.value=!1}},800);d.watch(S,()=>{O()});const N=E=>{p.value?.flyToLonLatHeight?.(E.lon,E.lat,5e3),S.value=E.name,b.value=[]},D=()=>{f.value=!1,u("close")};return d.onMounted(()=>{}),(E,T)=>(d.openBlock(),d.createBlock(gt,{visible:f.value,title:"设置","full-height":i.fullHeight,onClose:D,"onUpdate:visible":T[25]||(T[25]=P=>f.value=P)},{default:d.withCtx(()=>[d.createElementVNode("div",Z_,[d.createElementVNode("div",ek,[d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="GIS"}]),onClick:T[0]||(T[0]=P=>m.value="GIS")},"GIS",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="MAP"}]),onClick:T[1]||(T[1]=P=>m.value="MAP")},"地图",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="RENDER"}]),onClick:T[2]||(T[2]=P=>m.value="RENDER")},"渲染",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="MOUSE"}]),onClick:T[3]||(T[3]=P=>m.value="MOUSE")},"鼠标",2)]),d.createElementVNode("div",tk,[m.value==="GIS"?(d.openBlock(),d.createElementBlock("div",ik,[d.createElementVNode("div",nk,[T[26]||(T[26]=d.createElementVNode("span",null,"地球 (含大气/日月/星空)",-1)),d.createVNode(d.unref(t),{checked:y.globe,"onUpdate:checked":T[4]||(T[4]=P=>y.globe=P),size:"small"},null,8,["checked"])]),d.createElementVNode("div",sk,[T[27]||(T[27]=d.createElementVNode("span",null,"地形 (高程)",-1)),d.createVNode(d.unref(t),{checked:y.terrain,"onUpdate:checked":T[5]||(T[5]=P=>y.terrain=P),size:"small"},null,8,["checked"])]),d.createElementVNode("div",ok,[T[28]||(T[28]=d.createElementVNode("span",null,"地形遮挡",-1)),d.createVNode(d.unref(t),{checked:y.depthTest,"onUpdate:checked":T[6]||(T[6]=P=>y.depthTest=P),size:"small"},null,8,["checked"])])])):d.createCommentVNode("",!0),m.value==="MAP"?(d.openBlock(),d.createElementBlock("div",rk,[d.createElementVNode("div",ak,[d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:g.provider==="tianditu"}]),onClick:T[7]||(T[7]=P=>g.provider="tianditu")},"天地图",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:g.provider==="arcgis"}]),onClick:T[8]||(T[8]=P=>g.provider="arcgis")},"ArcGIS",2)]),g.provider==="tianditu"?(d.openBlock(),d.createElementBlock("div",lk,[d.createElementVNode("div",ck,[T[29]||(T[29]=d.createElementVNode("div",{class:"sub-label"},"地图风格",-1)),d.createVNode(d.unref(a),{value:g.tianditu.layerType,"onUpdate:value":T[9]||(T[9]=P=>g.tianditu.layerType=P),size:"small",style:{width:"100%"}},{default:d.withCtx(()=>[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(M,P=>d.createVNode(d.unref(l),{key:P.value,value:P.value},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(P.label),1)]),_:2},1032,["value"])),64))]),_:1},8,["value"])]),d.createElementVNode("div",dk,[T[30]||(T[30]=d.createElementVNode("span",null,"路网注记",-1)),d.createVNode(d.unref(t),{checked:g.tianditu.showLabel,"onUpdate:checked":T[10]||(T[10]=P=>g.tianditu.showLabel=P),size:"small"},null,8,["checked"])])])):d.createCommentVNode("",!0),g.provider==="arcgis"?(d.openBlock(),d.createElementBlock("div",hk,[d.createElementVNode("div",uk,[T[31]||(T[31]=d.createElementVNode("div",{class:"sub-label"},"服务地址",-1)),d.createVNode(d.unref(o),{value:g.arcgis.url,"onUpdate:value":T[11]||(T[11]=P=>g.arcgis.url=P),size:"small",placeholder:"输入ArcGIS MapServer地址"},null,8,["value"])])])):d.createCommentVNode("",!0),d.createElementVNode("div",fk,[T[32]||(T[32]=d.createElementVNode("div",{class:"sub-label"},"位置搜索 (天地图)",-1)),d.createElementVNode("div",pk,[d.createVNode(d.unref(o),{value:S.value,"onUpdate:value":T[12]||(T[12]=P=>S.value=P),placeholder:"输入地名搜索",size:"small","allow-clear":"",loading:R.value},null,8,["value","loading"]),b.value.length>0?(d.openBlock(),d.createElementBlock("div",mk,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(b.value,(P,F)=>(d.openBlock(),d.createElementBlock("div",{key:F,class:"search-result-item",onClick:V=>N(P)},[d.createElementVNode("span",yk,d.toDisplayString(P.name),1),d.createElementVNode("span",Ak,d.toDisplayString(P.lon.toFixed(4))+", "+d.toDisplayString(P.lat.toFixed(4)),1)],8,gk))),128))])):d.createCommentVNode("",!0)])])])):d.createCommentVNode("",!0),m.value==="RENDER"?(d.openBlock(),d.createElementBlock("div",vk,[d.createElementVNode("div",bk,[T[33]||(T[33]=d.createElementVNode("span",null,"阴影",-1)),d.createVNode(d.unref(t),{checked:A.shadows,"onUpdate:checked":T[13]||(T[13]=P=>A.shadows=P),size:"small"},null,8,["checked"])]),A.shadows?(d.openBlock(),d.createElementBlock("div",Ck,[d.createElementVNode("div",wk,"阴影暗度 ("+d.toDisplayString(A.shadowDarkness.toFixed(2))+")",1),d.createVNode(d.unref(r),{value:A.shadowDarkness,"onUpdate:value":T[14]||(T[14]=P=>A.shadowDarkness=P),min:0,max:1,step:.05,size:"small"},null,8,["value"])])):d.createCommentVNode("",!0),d.createElementVNode("div",Ek,[T[34]||(T[34]=d.createElementVNode("span",null,"环境贴图 (HDR)",-1)),d.createVNode(d.unref(t),{checked:A.environmentMap,"onUpdate:checked":T[15]||(T[15]=P=>A.environmentMap=P),size:"small"},null,8,["checked"])]),d.createElementVNode("div",xk,[T[35]||(T[35]=d.createElementVNode("span",null,"环境光遮蔽 (AO)",-1)),d.createVNode(d.unref(t),{checked:A.ambientOcclusion,"onUpdate:checked":T[16]||(T[16]=P=>A.ambientOcclusion=P),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Ik,[T[36]||(T[36]=d.createElementVNode("div",{class:"sub-label"},"日期时间",-1)),d.createVNode(d.unref(c),{value:A.time,"onUpdate:value":T[17]||(T[17]=P=>A.time=P),"show-time":"",locale:d.unref(vm),format:"YYYY-MM-DD HH:mm",size:"small",style:{width:"100%"}},null,8,["value","locale"])]),d.createElementVNode("div",Sk,[d.createElementVNode("div",Mk,"模型亮度 ("+d.toDisplayString(A.brightness.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:A.brightness,"onUpdate:value":T[18]||(T[18]=P=>A.brightness=P),min:0,max:5,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",Tk,[d.createElementVNode("div",Bk,"模型对比度 ("+d.toDisplayString(A.contrast.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:A.contrast,"onUpdate:value":T[19]||(T[19]=P=>A.contrast=P),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",_k,[d.createElementVNode("div",kk,"模型饱和度 ("+d.toDisplayString(A.saturation.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:A.saturation,"onUpdate:value":T[20]||(T[20]=P=>A.saturation=P),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",Pk,[T[37]||(T[37]=d.createElementVNode("div",{class:"sub-label"},"背景颜色",-1)),d.createElementVNode("div",Dk,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(w,(P,F)=>d.createElementVNode("div",{key:F,style:d.normalizeStyle({background:P,width:"32px",height:"24px",borderRadius:"2px",cursor:"pointer",border:"1px solid #d9d9d9",flexShrink:0}),onClick:V=>A.backgroundColor=P,title:"预设 "+(F+1)},null,12,Nk)),64))]),d.createElementVNode("div",Lk,[d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":T[21]||(T[21]=P=>I.value=P),style:{width:"40px",height:"24px",padding:"0",border:"1px solid #d9d9d9"}},null,512),[[d.vModelText,I.value]]),d.createVNode(d.unref(o),{value:A.backgroundColor,"onUpdate:value":T[22]||(T[22]=P=>A.backgroundColor=P),size:"small",style:{flex:"1"},placeholder:"CSS 颜色值"},null,8,["value"])])])])):d.createCommentVNode("",!0),m.value==="MOUSE"?(d.openBlock(),d.createElementBlock("div",Rk,[d.createElementVNode("div",Fk,[T[38]||(T[38]=d.createElementVNode("span",null,"碰撞检测",-1)),d.createVNode(d.unref(t),{checked:v.collision,"onUpdate:checked":T[23]||(T[23]=P=>v.collision=P),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Ok,[T[41]||(T[41]=d.createElementVNode("div",{class:"sub-label"},"操作习惯",-1)),d.createVNode(d.unref(n),{value:v.habit,"onUpdate:value":T[24]||(T[24]=P=>v.habit=P),size:"small"},{default:d.withCtx(()=>[d.createVNode(d.unref(s),{value:0},{default:d.withCtx(()=>[...T[39]||(T[39]=[d.createTextVNode("默认 (中键旋转)",-1)])]),_:1}),d.createVNode(d.unref(s),{value:1},{default:d.withCtx(()=>[...T[40]||(T[40]=[d.createTextVNode("习惯1 (左键旋转)",-1)])]),_:1})]),_:1},8,["value"])])])):d.createCommentVNode("",!0)])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-5a41e5bb"]]),Gk={class:"cad-layer-panel"},Uk={class:"layer-list-container"},Vk={class:"list-header"},Qk={class:"col-check"},zk=["checked"],Hk={class:"list-body"},Yk={class:"col-check"},$k=["checked","onChange"],jk={class:"col-index"},Wk=["title"],qk={class:"col-color"},Kk=["value"],Xk={key:0,class:"empty-text"},Jk=Be(d.defineComponent({__name:"LeitingCadLayer",props:{visible:{type:Boolean,default:!1},currentModelId:{type:String,default:""}},emits:["update:visible","handleCloseCardByCadCard"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(""),r=d.ref([]),a=()=>{s.value&&s.value.getDxfModels&&(r.value=s.value.getDxfModels().map(v=>({modelId:v.modelId,modelName:v.modelName}))||[])},l=d.computed(()=>r.value.map(v=>({value:v.modelId,label:v.modelName}))),c=d.ref([]),h=d.ref([]),u=d.computed(()=>c.value.length>0&&h.value.length===c.value.length),p=({modelId:v})=>{if(c.value=[],h.value=[],s.value&&s.value.getDxfLayers){const C=s.value.getDxfLayers({modelId:v});C&&Object.keys(C).forEach((w,M)=>{C[w].length&&(c.value.push({index:M+1,layerName:w,layerColor:C[w][0].color||"#ffffff",key:w}),h.value.push(w))})}},f=v=>{o.value=v,p({modelId:v})},m=v=>{v.target.checked?h.value=c.value.map(w=>w.key):h.value=[],g()},y=(v,C)=>{C.target.checked?h.value.includes(v)||h.value.push(v):h.value=h.value.filter(M=>M!==v),g()},g=()=>{if(s.value&&s.value.showDxfLayer&&(s.value.showDxfLayer({modelId:o.value,show:!0,layers:h.value}),s.value.getDxfLayers)){const v=s.value.getDxfLayers({modelId:o.value});if(v){const C=Object.keys(v).filter(w=>!h.value.includes(w));s.value.showDxfLayer({modelId:o.value,show:!1,layers:C})}}},A=()=>{n("update:visible",!1),n("handleCloseCardByCadCard")};return d.watch(()=>t.visible,v=>{v&&(a(),t.currentModelId?(o.value=t.currentModelId,p({modelId:t.currentModelId})):l.value.length>0&&(o.value=l.value[0]?.value,p({modelId:o.value})))}),d.watch(()=>t.currentModelId,v=>{v&&t.visible&&(o.value=v,p({modelId:v}))}),(v,C)=>(d.openBlock(),d.createBlock(gt,{visible:i.visible,title:"CAD图层","onUpdate:visible":C[3]||(C[3]=w=>v.$emit("update:visible",w)),onClose:A,width:360,align:"right","initial-position":{x:0,y:60}},{"header-extra":d.withCtx(()=>[d.createElementVNode("div",{class:"header-select-container",onMousedown:C[2]||(C[2]=d.withModifiers(()=>{},["stop"]))},[C[4]||(C[4]=d.createElementVNode("span",{class:"header-label"},"图纸:",-1)),d.createVNode(d.unref(oe.Select),{value:o.value,"onUpdate:value":C[0]||(C[0]=w=>o.value=w),options:l.value,onChange:C[1]||(C[1]=w=>f(w)),placeholder:"选择模型",style:{width:"140px"},bordered:!1,class:"custom-header-select",popupClassName:"leiting-select-dropdown",size:"small"},null,8,["value","options"])],32)]),default:d.withCtx(()=>[d.createElementVNode("div",Gk,[d.createElementVNode("div",Uk,[d.createElementVNode("div",Vk,[d.createElementVNode("div",Qk,[d.createElementVNode("input",{type:"checkbox",checked:u.value,onChange:m},null,40,zk)]),C[5]||(C[5]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),C[6]||(C[6]=d.createElementVNode("div",{class:"col-name"},"图层名称",-1)),C[7]||(C[7]=d.createElementVNode("div",{class:"col-color"},"颜色",-1))]),d.createElementVNode("div",Hk,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(c.value,w=>(d.openBlock(),d.createElementBlock("div",{key:w.key,class:"list-item"},[d.createElementVNode("div",Yk,[d.createElementVNode("input",{type:"checkbox",checked:h.value.includes(w.key),onChange:M=>y(w.key,M)},null,40,$k)]),d.createElementVNode("div",jk,d.toDisplayString(w.index),1),d.createElementVNode("div",{class:"col-name",title:w.layerName},d.toDisplayString(w.layerName),9,Wk),d.createElementVNode("div",qk,[d.createElementVNode("input",{type:"color",value:w.layerColor,disabled:""},null,8,Kk)])]))),128)),c.value.length===0?(d.openBlock(),d.createElementBlock("div",Xk,"暂无数据")):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-a4db4977"]]),Zk={class:"leiting-cad-adjust-panel"},eP={class:"leitingbim-control-panel"},tP={class:"form-item"},iP={class:"radio-group"},nP={class:"form-item"},sP=["title"],oP={class:"param-row"},rP=["step"],aP={class:"param-row"},lP=["step"],cP={class:"param-row"},dP=["step"],hP={class:"param-row"},uP=["step"],fP={class:"param-row"},pP=["step"],mP={class:"param-row"},gP=["step"],yP={class:"param-row"},AP=["step"],vP={class:"button-grid"},bP={key:1,class:"pick-mode-ui"},CP=["onClick"],wP=["checked"],EP={style:{"font-size":"12px",color:"#aaa","padding-left":"10px"}},xP={class:"param-row"},IP={style:{width:"40px"}},SP=["onUpdate:modelValue"],MP={class:"param-row"},TP={style:{width:"40px"}},BP=["onUpdate:modelValue"],_P={class:"param-row"},kP={style:{width:"40px"}},PP=["onUpdate:modelValue"],DP={class:"list-panel"},NP={class:"list-header"},LP={class:"col-check"},RP=["checked"],FP={class:"list-body"},OP={class:"col-check"},GP=["onUpdate:modelValue"],UP={class:"col-index"},VP=["title"],QP={class:"col-main"},zP=["checked","onChange"],HP={key:0,style:{padding:"10px","text-align":"center",color:"#999"}},YP=Be(d.defineComponent({__name:"LeitingCadPosition",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","handleSavingByCadCard","clearBimPointList","save"],setup(i,{expose:e,emit:t}){const n=i,s=t,o=d.inject("leitingMethods"),r=d.ref([]),a=d.ref(""),l=d.computed(()=>r.value.length>0&&r.value.every(E=>E.selected)),c=d.ref("param"),h=d.ref("bimPoint1"),u=d.ref(null),p=d.ref("bimPoint1"),f=d.reactive({bimPoint1:{longitude:void 0,latitude:void 0,type:"CAD标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程",height:void 0},bimPoint2:{longitude:void 0,latitude:void 0,type:"地图标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程",height:void 0}}),m=d.ref(1e-6),y=d.reactive({modelId:"",longitude:0,latitude:0,distance:1e-6,rotation:1,totalRotation:0,heightDistance:1,height:0,lonlat:1e-6,modelOptions:[],selectPoint:{longitude:0,latitude:0,height:0},selectedMode:!1,X:0,Y:0,Z:0}),g=d.computed(()=>{const E=r.value.find(T=>T.modelId===a.value);return E?E.modelName:""}),A=()=>{s("update:visible",!1)},v=()=>(!u.value&&o?.value?.getViewer&&o?.value?.getCesium&&(u.value=new yc(o.value.getViewer(),o.value.getCesium())),u.value),C=()=>{v()?.clearMarkers(),f.bimPoint1.longitude=void 0,f.bimPoint1.latitude=void 0,f.bimPoint1.height=void 0,f.bimPoint2.longitude=void 0,f.bimPoint2.latitude=void 0,f.bimPoint2.height=void 0},w=E=>{const T=h.value,P=f[T];if(P){P.longitude=E.longitude,P.latitude=E.latitude,P.height=E.height;const F=T==="bimPoint1"?"BIM":"MAP";v()?.addMarker(F,E),pe.success(`${P.type}已添加`)}},M=()=>{v()?.registerPickHandler(E=>{w(E)})},x=()=>{v()?.destroyPickHandler()},I=E=>{c.value=E,E!=="pick"&&s("clearBimPointList")};d.watch(()=>c.value,E=>{E==="pick"?M():x()}),d.onUnmounted(()=>{x()});const S=()=>{if(!o?.value?.getDxfModels)return;const E=o.value.getDxfModels();if(Array.isArray(E)?r.value=E.map(T=>({modelId:T.modelId,modelName:T.modelName,formData:T.formData||{},selected:!1,tileset:T})):r.value=[],r.value.length>0){const T=o.value.getCadModelId?o.value.getCadModelId():"";T&&r.value.find(P=>P.modelId===T)?R(T):R(r.value[0].modelId),r.value.forEach(P=>P.selected=!0)}},R=E=>{a.value=E;const T=r.value.find(P=>P.modelId===E);T&&T.formData&&Object.keys(y).forEach(P=>{T.formData[P]!==void 0&&(y[P]=T.formData[P])})},b=(E,T)=>{if(!o?.value?.adjustingModelByCad)return;const P=r.value.find(F=>F.modelId===E);P&&P.tileset&&(P.formData={...P.formData,...T},P.tileset.formData=P.formData,o.value.adjustingModelByCad({...P.formData,tileset:P.tileset}))},B=E=>{if(!a.value)return;const T=y[E];b(a.value,{[E]:T})},L=E=>{const T=r.value.filter(G=>G.selected);if(T.length===0){pe.warning("请先选择要调整的模型");return}const{distance:P,heightDistance:F,rotation:V}=y;T.forEach(G=>{const k={...G.formData};switch(E){case"north":k.latitude+=P;break;case"south":k.latitude-=P;break;case"east":k.longitude+=P;break;case"west":k.longitude-=P;break;case"up":k.height+=F;break;case"down":k.height-=F;break;case"rotateLeft":k.totalRotation=(k.totalRotation||0)-V;break;case"rotateRight":k.totalRotation=(k.totalRotation||0)+V;break}G.modelId===a.value&&Object.assign(y,k),b(G.modelId,k)})},O=E=>{const T=E.target.checked;r.value.forEach(P=>P.selected=T)},N=()=>{s("handleSavingByCadCard",r.value),s("save",r.value)},D=()=>{const E=f.bimPoint1,T=f.bimPoint2;if(E.longitude===void 0||T.longitude===void 0){pe.warning("请先完成点选操作");return}const P=r.value.filter(_=>_.selected);if(P.length===0){pe.warning("请先选择要调整的模型");return}let F=0,V=0,G=0;const k=v();if(k){const{dLon:_,dLat:U,dHeight:H}=k.calculateOffset(E,T);F=_,V=U,G=H}else F=T.longitude-E.longitude,V=T.latitude-E.latitude,G=T.height-E.height;P.forEach(_=>{const U={..._.formData};U.longitude+=F,U.latitude+=V,U.height+=G,_.modelId===a.value&&Object.assign(y,U),b(_.modelId,U)}),pe.success("位置已调整")};return d.watch(()=>n.visible,E=>{E?S():(x(),C())}),d.onMounted(()=>{n.visible&&S()}),e({setBIMPointsList:({longitude:E,latitude:T,height:P})=>{f[p.value].longitude=E,f[p.value].latitude=T,f[p.value].height=P},addGltfOr3dTilesModelList:E=>{console.warn("addGltfOr3dTilesModelList is deprecated, use internal loading")}}),(E,T)=>(d.openBlock(),d.createBlock(gt,{visible:n.visible,title:"Cad校准",width:282,height:600,"onUpdate:visible":T[21]||(T[21]=P=>s("update:visible",P)),onClose:A},{default:d.withCtx(()=>[d.createElementVNode("div",Zk,[d.createElementVNode("div",eP,[d.createElementVNode("div",tP,[T[22]||(T[22]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",iP,[d.createElementVNode("span",{class:d.normalizeClass({active:c.value==="param"}),onClick:T[0]||(T[0]=P=>I("param"))},"参数模式",2),d.createElementVNode("span",{class:d.normalizeClass({active:c.value==="pick"}),onClick:T[1]||(T[1]=P=>I("pick"))},"地图点选",2)])]),d.createElementVNode("div",nP,[T[23]||(T[23]=d.createElementVNode("label",null,"当前主模型:",-1)),d.createElementVNode("span",{class:"value",title:g.value},d.toDisplayString(g.value||"未选择"),9,sP)]),T[35]||(T[35]=d.createElementVNode("div",{class:"separator"},null,-1)),c.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[T[31]||(T[31]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",oP,[T[24]||(T[24]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[2]||(T[2]=P=>y.longitude=P),onChange:T[3]||(T[3]=P=>B("longitude")),step:m.value},null,40,rP),[[d.vModelText,y.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",aP,[T[25]||(T[25]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[4]||(T[4]=P=>y.latitude=P),onChange:T[5]||(T[5]=P=>B("latitude")),step:m.value},null,40,lP),[[d.vModelText,y.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",cP,[T[26]||(T[26]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[6]||(T[6]=P=>y.height=P),onChange:T[7]||(T[7]=P=>B("height")),step:m.value},null,40,dP),[[d.vModelText,y.height,void 0,{number:!0}]])]),d.createElementVNode("div",hP,[T[27]||(T[27]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[8]||(T[8]=P=>y.totalRotation=P),onChange:T[9]||(T[9]=P=>B("totalRotation")),step:m.value},null,40,uP),[[d.vModelText,y.totalRotation,void 0,{number:!0}]])]),T[32]||(T[32]=d.createElementVNode("div",{class:"separator"},null,-1)),T[33]||(T[33]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",fP,[T[28]||(T[28]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[10]||(T[10]=P=>y.distance=P),step:m.value},null,8,pP),[[d.vModelText,y.distance,void 0,{number:!0}]])]),d.createElementVNode("div",mP,[T[29]||(T[29]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[11]||(T[11]=P=>y.heightDistance=P),step:m.value},null,8,gP),[[d.vModelText,y.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",yP,[T[30]||(T[30]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[12]||(T[12]=P=>y.rotation=P),step:m.value},null,8,AP),[[d.vModelText,y.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",vP,[d.createElementVNode("button",{onClick:T[13]||(T[13]=P=>L("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:T[14]||(T[14]=P=>L("north"))},"北移"),d.createElementVNode("button",{onClick:T[15]||(T[15]=P=>L("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:T[16]||(T[16]=P=>L("west"))},"西移"),d.createElementVNode("button",{onClick:T[17]||(T[17]=P=>L("south"))},"南移"),d.createElementVNode("button",{onClick:T[18]||(T[18]=P=>L("east"))},"东移"),d.createElementVNode("button",{onClick:T[19]||(T[19]=P=>L("up"))},"上移"),d.createElementVNode("button",{onClick:T[20]||(T[20]=P=>L("down"))},"下移"),d.createElementVNode("button",{onClick:N,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):(d.openBlock(),d.createElementBlock("div",bP,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(f,(P,F)=>(d.openBlock(),d.createElementBlock("div",{key:F,class:"form-item",style:{display:"block","margin-bottom":"15px"}},[d.createElementVNode("div",{style:{"font-weight":"bold","margin-bottom":"5px",cursor:"pointer",display:"flex","align-items":"center"},onClick:V=>h.value=F},[d.createElementVNode("input",{type:"radio",checked:h.value===F,style:{"margin-right":"5px"}},null,8,wP),d.createTextVNode(" "+d.toDisplayString(P.type)+": ",1)],8,CP),d.createElementVNode("div",EP,[d.createElementVNode("div",xP,[d.createElementVNode("label",IP,d.toDisplayString(P.longitudeText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":V=>P.longitude=V,readonly:"",style:{width:"100px"}},null,8,SP),[[d.vModelText,P.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",MP,[d.createElementVNode("label",TP,d.toDisplayString(P.latitudeText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":V=>P.latitude=V,readonly:"",style:{width:"100px"}},null,8,BP),[[d.vModelText,P.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",_P,[d.createElementVNode("label",kP,d.toDisplayString(P.heightText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":V=>P.height=V,readonly:"",style:{width:"100px"}},null,8,PP),[[d.vModelText,P.height,void 0,{number:!0}]])])])]))),128)),d.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[d.createElementVNode("button",{onClick:D,class:"primary-btn"},"应用校准"),d.createElementVNode("button",{onClick:N},"保存")]),T[34]||(T[34]=d.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 勾选上方 CAD 或 地图 标记点选项。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“应用校准”进行校准。")],-1))]))]),d.createElementVNode("div",DP,[d.createElementVNode("div",NP,[d.createElementVNode("div",LP,[d.createElementVNode("input",{type:"checkbox",checked:l.value,onChange:O},null,40,RP)]),T[36]||(T[36]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),T[37]||(T[37]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),T[38]||(T[38]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",FP,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.value,(P,F)=>(d.openBlock(),d.createElementBlock("div",{key:P.modelId,class:d.normalizeClass(["list-item",{active:P.modelId===a.value}])},[d.createElementVNode("div",OP,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":V=>P.selected=V},null,8,GP),[[d.vModelCheckbox,P.selected]])]),d.createElementVNode("div",UP,d.toDisplayString(F+1),1),d.createElementVNode("div",{class:"col-name",title:P.modelName},d.toDisplayString(P.modelName),9,VP),d.createElementVNode("div",QP,[d.createElementVNode("input",{type:"radio",name:"mainModel",checked:P.modelId===a.value,onChange:V=>R(P.modelId)},null,40,zP)])],2))),128)),r.value.length===0?(d.openBlock(),d.createElementBlock("div",HP,"暂无数据")):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-4dfe6448"]]),$P={class:"coord-transform-card"},jP={class:"param-row"},WP={class:"param-row"},qP={class:"param-row"},KP={class:"param-row"},XP={class:"param-row"},JP={class:"param-row"},ZP={class:"param-row"},eD={class:"button-grid transform-actions"},tD=Be(d.defineComponent({__name:"LeitingGISCadCoordTransform",emits:["apply-transform","save-position"],setup(i,{emit:e}){const t=e,n=d.inject("leitingMethods"),s=d.ref("projectedToLonlat"),o=d.reactive({centralMeridian:117,latOrigin:0,scaleFactor:1,falseEasting:5e5,falseNorthing:0,ellipsoid:"GRS80"}),r=()=>{const l=n?.value?.getDefaultGISCadTransformConfig?.()||{centralMeridian:117,latOrigin:0,scaleFactor:1,falseEasting:5e5,falseNorthing:0,ellipsoid:"GRS80"};Object.assign(o,l)},a=()=>{t("apply-transform",{direction:s.value,config:{...o}})};return r(),(l,c)=>(d.openBlock(),d.createElementBlock("div",$P,[d.createElementVNode("div",jP,[c[10]||(c[10]=d.createElementVNode("label",null,"转换方向:",-1)),d.createVNode(d.unref(oe.Select),{value:s.value,"onUpdate:value":c[0]||(c[0]=h=>s.value=h),class:"custom-select",popupClassName:"leiting-select-dropdown",size:"small"},{default:d.withCtx(()=>[d.createVNode(d.unref(oe.SelectOption),{value:"projectedToLonlat"},{default:d.withCtx(()=>[...c[8]||(c[8]=[d.createTextVNode("投影转经纬 (根据模型局部坐标)",-1)])]),_:1}),d.createVNode(d.unref(oe.SelectOption),{value:"lonlatToProjected"},{default:d.withCtx(()=>[...c[9]||(c[9]=[d.createTextVNode("经纬转投影 (根据模型经纬度)",-1)])]),_:1})]),_:1},8,["value"])]),d.createElementVNode("div",WP,[c[11]||(c[11]=d.createElementVNode("label",null,"中央经线:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[1]||(c[1]=h=>o.centralMeridian=h),type:"number"},null,512),[[d.vModelText,o.centralMeridian,void 0,{number:!0}]])]),d.createElementVNode("div",qP,[c[12]||(c[12]=d.createElementVNode("label",null,"纬度基线:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[2]||(c[2]=h=>o.latOrigin=h),type:"number"},null,512),[[d.vModelText,o.latOrigin,void 0,{number:!0}]])]),d.createElementVNode("div",KP,[c[13]||(c[13]=d.createElementVNode("label",null,"投影比例:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[3]||(c[3]=h=>o.scaleFactor=h),type:"number",step:"0.000001"},null,512),[[d.vModelText,o.scaleFactor,void 0,{number:!0}]])]),d.createElementVNode("div",XP,[c[14]||(c[14]=d.createElementVNode("label",null,"东偏移:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[4]||(c[4]=h=>o.falseEasting=h),type:"number"},null,512),[[d.vModelText,o.falseEasting,void 0,{number:!0}]])]),d.createElementVNode("div",JP,[c[15]||(c[15]=d.createElementVNode("label",null,"北偏移:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[5]||(c[5]=h=>o.falseNorthing=h),type:"number"},null,512),[[d.vModelText,o.falseNorthing,void 0,{number:!0}]])]),d.createElementVNode("div",ZP,[c[20]||(c[20]=d.createElementVNode("label",null,"椭球体:",-1)),d.createVNode(d.unref(oe.Select),{value:o.ellipsoid,"onUpdate:value":c[6]||(c[6]=h=>o.ellipsoid=h),class:"custom-select",popupClassName:"leiting-select-dropdown",size:"small"},{default:d.withCtx(()=>[d.createVNode(d.unref(oe.SelectOption),{value:"GRS80"},{default:d.withCtx(()=>[...c[16]||(c[16]=[d.createTextVNode("CGCS2000 (GRS80)",-1)])]),_:1}),d.createVNode(d.unref(oe.SelectOption),{value:"WGS84"},{default:d.withCtx(()=>[...c[17]||(c[17]=[d.createTextVNode("WGS84",-1)])]),_:1}),d.createVNode(d.unref(oe.SelectOption),{value:"krass"},{default:d.withCtx(()=>[...c[18]||(c[18]=[d.createTextVNode("北京54 (Krassovsky)",-1)])]),_:1}),d.createVNode(d.unref(oe.SelectOption),{value:"IAU76"},{default:d.withCtx(()=>[...c[19]||(c[19]=[d.createTextVNode("西安80 (IAU76)",-1)])]),_:1})]),_:1},8,["value"])]),d.createElementVNode("div",eD,[d.createElementVNode("button",{class:"primary-btn",onClick:a,style:{"grid-column":"span 2"}},"应用到选中模型"),d.createElementVNode("button",{onClick:c[7]||(c[7]=h=>t("save-position"))},"保存位置")]),c[21]||(c[21]=d.createElementVNode("div",{class:"instructions"},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 在列表中勾选需要转换的模型。"),d.createElementVNode("div",null,"2. 配置对应坐标系的转换参数。"),d.createElementVNode("div",null,"3. 点击“应用到选中模型”进行批量转换预览。")],-1))]))}}),[["__scopeId","data-v-f069993f"]]),iD={class:"adjust-panel"},nD={class:"leitingbim-control-panel"},sD={class:"form-item"},oD={class:"radio-group"},rD={class:"form-item"},aD=["title"],lD={class:"param-row"},cD=["step"],dD={class:"param-row"},hD=["step"],uD={class:"param-row"},fD=["step"],pD={class:"param-row"},mD=["step"],gD={class:"param-row"},yD=["step"],AD={class:"param-row"},vD=["step"],bD={class:"param-row"},CD=["step"],wD={class:"param-row"},ED=["step"],xD={class:"param-row"},ID=["step"],SD={class:"button-grid"},MD={class:"action-buttons"},TD={key:1,class:"pick-mode-ui"},BD=["onClick"],_D=["checked","onChange"],kD={class:"pick-point-body"},PD={class:"param-row"},DD={class:"pick-label"},ND=["onUpdate:modelValue"],LD={class:"param-row"},RD={class:"pick-label"},FD=["onUpdate:modelValue"],OD={class:"param-row"},GD={class:"pick-label"},UD=["onUpdate:modelValue"],VD={class:"button-grid pick-button-grid"},QD={class:"list-panel"},zD={class:"list-header"},HD={class:"col-check"},YD=["checked"],$D={class:"list-body"},jD={class:"col-check"},WD=["onUpdate:modelValue"],qD={class:"col-index"},KD=["title"],XD={class:"col-main"},JD=["checked","onChange"],ZD={key:0,class:"empty-text"},eN=Be(d.defineComponent({__name:"LeitingGISCadPosition",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(1e-6),r=d.ref([]),a=d.ref(""),l=d.ref("param"),c=d.ref("cadPoint"),h=d.ref(null),u=d.reactive({cadPoint:{longitude:void 0,latitude:void 0,height:void 0,type:"CAD标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程"},mapPoint:{longitude:void 0,latitude:void 0,height:void 0,type:"地图标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程"}}),p=d.reactive({modelId:"",longitude:0,latitude:0,height:0,totalRotation:0,scale:1,distance:1e-4,heightDistance:1,rotation:1,scaleStep:.1,localOriginX:0,localOriginY:0,clampToGround:!1}),f=d.computed(()=>r.value.length>0&&r.value.every(k=>k.selected)),m=d.computed(()=>r.value.find(k=>k.modelId===a.value)?.modelName||""),y=()=>(!h.value&&s?.value?.getViewer&&s?.value?.getCesium&&(h.value=new yc(s.value.getViewer(),s.value.getCesium())),h.value),g=()=>{u.cadPoint.longitude=void 0,u.cadPoint.latitude=void 0,u.cadPoint.height=void 0,u.mapPoint.longitude=void 0,u.mapPoint.latitude=void 0,u.mapPoint.height=void 0},A=()=>{h.value?.clearMarkers(),g()},v=k=>{const _=c.value,U=u[_];U&&(U.longitude=k.longitude,U.latitude=k.latitude,U.height=k.height,y()?.addMarker(_==="cadPoint"?"BIM":"MAP",k),pe.success(`${U.type}已添加`))},C=()=>{y()?.registerPickHandler(_=>{v(_)})},w=()=>{h.value?.destroyPickHandler()},M=k=>{l.value=k},x=k=>{(k==="cadPoint"||k==="mapPoint")&&(c.value=k)},I=k=>{const _=k?.editingFormData||k?.formData||{};return{modelId:k?.modelId||"",longitude:Number(_.longitude??0),latitude:Number(_.latitude??0),height:Number(_.height??0),totalRotation:Number(_.totalRotation??0),scale:Math.max(1e-6,Number(_.scale??1)),distance:Number(_.distance??1e-6),heightDistance:Number(_.heightDistance??1),rotation:Number(_.rotation??1),scaleStep:Number(_.scaleStep??.1),localOriginX:Number(_.localOriginX??0),localOriginY:Number(_.localOriginY??0),transformConfig:_.transformConfig||void 0,transformDirection:_.transformDirection||void 0,clampToGround:_.clampToGround??!1}},S=()=>{const k=r.value.find(_=>_.modelId===a.value);k&&Object.assign(p,k.formData,{modelId:k.modelId})},R=()=>{if(!s?.value?.getGISCadModels){r.value=[];return}const k=new Map(r.value.map(X=>[X.modelId,X.selected])),_=s.value.getGISCadModels()||[];if(r.value=Array.isArray(_)?_.map(X=>({modelId:X.modelId,modelName:X.modelName,selected:k.get(X.modelId)??!0,runtimeModel:X,formData:I(X)})):[],!r.value.length){a.value="";return}const U=r.value[0];if(!U)return;const H=s.value.getGISCadModelId?.()||a.value||U.modelId,q=r.value.find(X=>X.modelId===H);a.value=q?.modelId||U.modelId,S()},b=k=>{a.value=k,S()},B=(k,_)=>{if(!s?.value?.adjustGISCadModel)return null;s.value.beginEditGISCad?.({modelId:k});const U=s.value.adjustGISCadModel({modelId:k,..._}),H=r.value.find(q=>q.modelId===k);return H&&U&&(H.formData={...H.formData,...U,modelId:k},H.runtimeModel={...H.runtimeModel,editingFormData:U,isEditing:!0}),k===a.value&&Object.assign(p,H?.formData||p,{modelId:k}),U},L=k=>{if(!a.value)return;const _=r.value.find(X=>X.modelId===a.value);if(!_)return;if(k==="clampToGround"){const X=!!p[k];B(a.value,{[k]:X}),r.value.filter(de=>de.selected&&de.modelId!==a.value).forEach(de=>{B(de.modelId,{[k]:X})});return}const U=Number(p[k]),H=Number(_.formData[k]),q=U-H;B(a.value,{[k]:k==="scale"?Math.max(1e-6,U):U}),!(q===0||k==="scale")&&r.value.filter(X=>X.selected&&X.modelId!==a.value).forEach(X=>{B(X.modelId,{[k]:Number(X.formData[k])+q})})},O=k=>{const _=r.value.filter(U=>U.selected);if(!_.length){pe.warning("请先选择要调整的模型");return}_.forEach(U=>{const H={...U.formData};switch(k){case"north":H.latitude+=p.distance;break;case"south":H.latitude-=p.distance;break;case"east":H.longitude+=p.distance;break;case"west":H.longitude-=p.distance;break;case"up":H.height+=p.heightDistance;break;case"down":H.height-=p.heightDistance;break;case"rotateLeft":H.totalRotation-=p.rotation;break;case"rotateRight":H.totalRotation+=p.rotation;break;case"scaleUp":H.scale=Math.max(1e-6,H.scale+p.scaleStep);break;case"scaleDown":H.scale=Math.max(1e-6,H.scale-p.scaleStep);break;default:return}H.distance=p.distance,H.heightDistance=p.heightDistance,H.rotation=p.rotation,H.scaleStep=p.scaleStep,B(U.modelId,H)})},N=({direction:k,config:_})=>{const U=r.value.filter(X=>X.selected);if(!U.length){pe.warning("请先选择要转换的模型");return}if(!s?.value?.transformGISCadCoordinate){pe.warning("未找到 GIS CAD 坐标转换方法");return}let q=0;U.forEach(X=>{try{const de=Number(X.formData.localOriginX),fe=Number(X.formData.localOriginY);let me={longitude:X.formData.longitude,latitude:X.formData.latitude};const be=s?.value?.transformGISCadCoordinate;if(be){const _e=be({direction:k,...k==="projectedToLonlat"?{x:de,y:fe}:{longitude:X.formData.longitude,latitude:X.formData.latitude},config:{..._}});k==="projectedToLonlat"&&_e.longitude&&(me.longitude=_e.longitude,me.latitude=_e.latitude)}B(X.modelId,{transformConfig:{..._},transformDirection:k,longitude:me.longitude,latitude:me.latitude}),q++}catch(de){console.warn("Transform failed for model",X.modelId,de)}}),q>0?pe.success(`已成功转换 ${q} 个模型的坐标并重新加载,请预览后提交贴地`):pe.error("坐标转换失败,请检查参数或模型状态")},D=()=>{p.clampToGround=!p.clampToGround,L("clampToGround")},E=()=>{const k=u.cadPoint,_=u.mapPoint;if(k.longitude===void 0||k.latitude===void 0||k.height===void 0||_.longitude===void 0||_.latitude===void 0||_.height===void 0){pe.warning("请先完成 CAD 和地图点位采集");return}const H=r.value.filter(fe=>fe.selected);if(!H.length){pe.warning("请先选择要调整的模型");return}const{dLon:q,dLat:X,dHeight:de}=y()?.calculateOffset(k,_)||{dLon:_.longitude-k.longitude,dLat:_.latitude-k.latitude,dHeight:_.height-k.height};H.forEach(fe=>{B(fe.modelId,{longitude:Number(fe.formData.longitude)+q,latitude:Number(fe.formData.latitude)+X,height:Number(fe.formData.height)+de})}),pe.success("点选校准预览已更新")},T=()=>{const k=r.value.filter(U=>U.selected);if(!k.length){pe.warning("请先选择要提交的模型");return}const _=[];k.forEach(U=>{const H=s?.value?.commitEditGISCad?.({modelId:U.modelId});H&&H.formData&&_.push({modelId:H.modelId,formData:H.formData})}),R(),_.length>0&&s?.value?.onGISCadPositionChange&&s.value.onGISCadPositionChange(_),pe.success("GIS CAD 已提交为贴地结果")},P=()=>{r.value.forEach(k=>{s?.value?.cancelEditGISCad?.({modelId:k.modelId})})},F=()=>{if(!a.value){pe.warning("请先选择主模型");return}if(!s?.value?.flyToGISCadModel){pe.warning("飞转方法不可用");return}s.value.flyToGISCadModel({modelId:a.value,duration:1.5})},V=k=>{const _=k.target.checked;r.value.forEach(U=>{U.selected=_})},G=()=>{P(),w(),A(),n("update:visible",!1)};return d.watch(l,k=>{t.visible&&(k==="pick"?C():w())}),d.watch(()=>t.visible,k=>{k?(R(),l.value==="pick"&&C()):(w(),A(),P(),R())}),d.onMounted(()=>{t.visible&&(R(),l.value==="pick"&&C())}),d.onUnmounted(()=>{w(),A(),P()}),(k,_)=>(d.openBlock(),d.createBlock(gt,{visible:t.visible,title:"GIS CAD调整",width:340,"onUpdate:visible":_[27]||(_[27]=U=>n("update:visible",U)),onClose:G},{default:d.withCtx(()=>[d.createElementVNode("div",iD,[d.createElementVNode("div",nD,[d.createElementVNode("div",sD,[_[28]||(_[28]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",oD,[d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="param"}),onClick:_[0]||(_[0]=U=>M("param"))}," 参数模式 ",2),d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="pick"}),onClick:_[1]||(_[1]=U=>M("pick"))}," 地图点选 ",2),d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="transform"}),onClick:_[2]||(_[2]=U=>M("transform"))}," 坐标转换 ",2)])]),d.createElementVNode("div",rD,[_[29]||(_[29]=d.createElementVNode("label",null,"当前主模型:",-1)),d.createElementVNode("span",{class:"value",title:m.value},d.toDisplayString(m.value||"未选择"),9,aD)]),_[43]||(_[43]=d.createElementVNode("div",{class:"separator"},null,-1)),l.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[_[39]||(_[39]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",lD,[_[30]||(_[30]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[3]||(_[3]=U=>p.longitude=U),type:"number",step:o.value,onChange:_[4]||(_[4]=U=>L("longitude"))},null,40,cD),[[d.vModelText,p.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",dD,[_[31]||(_[31]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[5]||(_[5]=U=>p.latitude=U),type:"number",step:o.value,onChange:_[6]||(_[6]=U=>L("latitude"))},null,40,hD),[[d.vModelText,p.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",uD,[_[32]||(_[32]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[7]||(_[7]=U=>p.height=U),type:"number",step:o.value,onChange:_[8]||(_[8]=U=>L("height"))},null,40,fD),[[d.vModelText,p.height,void 0,{number:!0}]])]),d.createElementVNode("div",pD,[_[33]||(_[33]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[9]||(_[9]=U=>p.totalRotation=U),type:"number",step:o.value,onChange:_[10]||(_[10]=U=>L("totalRotation"))},null,40,mD),[[d.vModelText,p.totalRotation,void 0,{number:!0}]])]),d.createElementVNode("div",gD,[_[34]||(_[34]=d.createElementVNode("label",null,"缩放比例:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[11]||(_[11]=U=>p.scale=U),type:"number",min:"0.000001",step:o.value,onChange:_[12]||(_[12]=U=>L("scale"))},null,40,yD),[[d.vModelText,p.scale,void 0,{number:!0}]])]),_[40]||(_[40]=d.createElementVNode("div",{class:"separator"},null,-1)),_[41]||(_[41]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",AD,[_[35]||(_[35]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[13]||(_[13]=U=>p.distance=U),type:"number",step:o.value},null,8,vD),[[d.vModelText,p.distance,void 0,{number:!0}]])]),d.createElementVNode("div",bD,[_[36]||(_[36]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[14]||(_[14]=U=>p.heightDistance=U),type:"number",step:o.value},null,8,CD),[[d.vModelText,p.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",wD,[_[37]||(_[37]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[15]||(_[15]=U=>p.rotation=U),type:"number",step:o.value},null,8,ED),[[d.vModelText,p.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",xD,[_[38]||(_[38]=d.createElementVNode("label",null,"缩放步长:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[16]||(_[16]=U=>p.scaleStep=U),type:"number",step:o.value},null,8,ID),[[d.vModelText,p.scaleStep,void 0,{number:!0}]])]),d.createElementVNode("div",SD,[d.createElementVNode("button",{onClick:_[17]||(_[17]=U=>O("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:_[18]||(_[18]=U=>O("north"))},"北移"),d.createElementVNode("button",{onClick:_[19]||(_[19]=U=>O("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:_[20]||(_[20]=U=>O("west"))},"西移"),d.createElementVNode("button",{onClick:_[21]||(_[21]=U=>O("south"))},"南移"),d.createElementVNode("button",{onClick:_[22]||(_[22]=U=>O("east"))},"东移"),d.createElementVNode("button",{onClick:_[23]||(_[23]=U=>O("up"))},"上移"),d.createElementVNode("button",{onClick:_[24]||(_[24]=U=>O("scaleDown"))},"缩小"),d.createElementVNode("button",{onClick:_[25]||(_[25]=U=>O("scaleUp"))},"放大"),d.createElementVNode("button",{onClick:_[26]||(_[26]=U=>O("down"))},"下移")]),d.createElementVNode("div",MD,[d.createElementVNode("button",{class:d.normalizeClass({"primary-btn":p.clampToGround}),onClick:D}," 贴地 ",2),d.createElementVNode("button",{onClick:T},"保存位置"),d.createElementVNode("button",{onClick:F},"正北俯视")])],64)):l.value==="pick"?(d.openBlock(),d.createElementBlock("div",TD,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(u,(U,H)=>(d.openBlock(),d.createElementBlock("div",{key:H,class:"pick-point-item"},[d.createElementVNode("div",{class:"pick-point-title",onClick:q=>x(H)},[d.createElementVNode("input",{type:"radio",name:"gisCadPickPoint",checked:c.value===H,onChange:q=>x(H)},null,40,_D),d.createElementVNode("span",null,d.toDisplayString(U.type)+":",1)],8,BD),d.createElementVNode("div",kD,[d.createElementVNode("div",PD,[d.createElementVNode("label",DD,d.toDisplayString(U.longitudeText),1),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":q=>U.longitude=q,type:"number",readonly:""},null,8,ND),[[d.vModelText,U.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",LD,[d.createElementVNode("label",RD,d.toDisplayString(U.latitudeText),1),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":q=>U.latitude=q,type:"number",readonly:""},null,8,FD),[[d.vModelText,U.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",OD,[d.createElementVNode("label",GD,d.toDisplayString(U.heightText),1),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":q=>U.height=q,type:"number",readonly:""},null,8,UD),[[d.vModelText,U.height,void 0,{number:!0}]])])])]))),128)),d.createElementVNode("div",VD,[d.createElementVNode("button",{class:"primary-btn",onClick:E},"应用校准"),d.createElementVNode("button",{class:d.normalizeClass({"primary-btn":p.clampToGround}),onClick:D}," 贴地 ",2),d.createElementVNode("button",{onClick:T},"保存位置"),d.createElementVNode("button",{onClick:F},"正北俯视")]),_[42]||(_[42]=d.createElementVNode("div",{class:"instructions"},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 先选择上方 CAD 标记点或地图标记点。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“应用校准”进行预览。"),d.createElementVNode("div",null,"4. 确认结果后,点击“提交贴地”生效。")],-1))])):l.value==="transform"?(d.openBlock(),d.createBlock(tD,{key:2,onApplyTransform:N,onSavePosition:T})):d.createCommentVNode("",!0)]),d.createElementVNode("div",QD,[d.createElementVNode("div",zD,[d.createElementVNode("div",HD,[d.createElementVNode("input",{type:"checkbox",checked:f.value,onChange:V},null,40,YD)]),_[44]||(_[44]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),_[45]||(_[45]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),_[46]||(_[46]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",$D,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.value,(U,H)=>(d.openBlock(),d.createElementBlock("div",{key:U.modelId,class:d.normalizeClass(["list-item",{active:U.modelId===a.value}])},[d.createElementVNode("div",jD,[d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":q=>U.selected=q,type:"checkbox"},null,8,WD),[[d.vModelCheckbox,U.selected]])]),d.createElementVNode("div",qD,d.toDisplayString(H+1),1),d.createElementVNode("div",{class:"col-name",title:U.modelName},d.toDisplayString(U.modelName),9,KD),d.createElementVNode("div",XD,[d.createElementVNode("input",{checked:U.modelId===a.value,type:"radio",name:"gisCadMainModel",onChange:q=>b(U.modelId)},null,40,JD)])],2))),128)),r.value.length===0?(d.openBlock(),d.createElementBlock("div",ZD,"暂无 GIS CAD 数据")):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-25694d77"]]),tN={class:"annotation-content"},iN={class:"annotation-tools"},nN={class:"annotation-controls"},sN={class:"control-group",title:"颜色"},oN={class:"tool-item color-tool"},rN={class:"control-group line-width-container",title:"线宽"},aN=["onClick"],lN={class:"option-label"},cN=Be(d.defineComponent({__name:"LeitingAnnotationCard",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(""),r=d.ref("#ff0000"),a=d.ref(1),l=d.ref(!1),c=d.ref(null),h=d.ref(null),u=d.ref({top:"0px",left:"0px"}),p=[{value:6,label:"粗"},{value:3,label:"中"},{value:1,label:"细"}],f=()=>s?.value?.getAnnotationInstance?s.value.getAnnotationInstance():null,m=()=>{n("update:visible",!1)},y=I=>{o.value=I;const S=f();if(S)switch(I){case"freehandLine":S.startFreehandLine();break;case"arrow":S.startArrow();break;case"straightLine":S.startStraightLine();break;case"rectangle":S.startRectangle();break;case"ellipse":S.startEllipse();break}},g=()=>{const I=f();I&&(I.setCurrentColor(r.value),I.changeColor(r.value))},A=()=>{if(!l.value&&c.value){const I=c.value.getBoundingClientRect();u.value={top:`${I.top}px`,left:`${I.right+8}px`}}l.value=!l.value},v=I=>{a.value=I,l.value=!1;const S=f();S&&(S.setCurrentWidth(I),S.changeWidth(I))},C=()=>{const I=f();I&&I.deleteSelectedEntity()},w=()=>{const I=f();I&&I.clearAll()},M=()=>{if(s?.value?.saveAnnotations){s.value.saveAnnotations();return}const I=f();I&&I.saveAnnotations()},x=I=>{const S=I.target,R=c.value&&c.value.contains(S),b=h.value&&h.value.contains(S);!R&&!b&&(l.value=!1)};return d.onMounted(()=>{document.addEventListener("click",x)}),d.onUnmounted(()=>{document.removeEventListener("click",x)}),(I,S)=>(d.openBlock(),d.createBlock(gt,{visible:t.visible,title:"标注",width:70,"min-width":70,height:480,"onUpdate:visible":S[6]||(S[6]=R=>n("update:visible",R)),onClose:m},{default:d.withCtx(()=>[d.createElementVNode("div",tN,[d.createElementVNode("div",iN,[d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="freehandLine"}]),onClick:S[0]||(S[0]=R=>y("freehandLine")),title:"手绘线"},[...S[7]||(S[7]=[d.createElementVNode("div",{class:"tool-icon"},"✏️",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="arrow"}]),onClick:S[1]||(S[1]=R=>y("arrow")),title:"箭头"},[...S[8]||(S[8]=[d.createElementVNode("div",{class:"tool-icon"},"↗️",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="straightLine"}]),onClick:S[2]||(S[2]=R=>y("straightLine")),title:"直线"},[...S[9]||(S[9]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="rectangle"}]),onClick:S[3]||(S[3]=R=>y("rectangle")),title:"矩形"},[...S[10]||(S[10]=[d.createElementVNode("div",{class:"tool-icon"},"▭",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="ellipse"}]),onClick:S[4]||(S[4]=R=>y("ellipse")),title:"椭圆"},[...S[11]||(S[11]=[d.createElementVNode("div",{class:"tool-icon"},"⭕",-1)])],2)]),S[13]||(S[13]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",nN,[d.createElementVNode("div",sN,[d.createElementVNode("div",oN,[d.createElementVNode("div",{class:"color-swatch",style:d.normalizeStyle({backgroundColor:r.value})},null,4),d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":S[5]||(S[5]=R=>r.value=R),onChange:g,class:"color-input-overlay"},null,544),[[d.vModelText,r.value]])])]),d.createElementVNode("div",rN,[d.createElementVNode("div",{ref_key:"lineWidthBtnRef",ref:c,class:"tool-item",onClick:d.withModifiers(A,["stop"])},[d.createElementVNode("div",{class:"current-width-preview",style:d.normalizeStyle({height:a.value+"px",backgroundColor:"#fff"})},null,4)],512),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[l.value?(d.openBlock(),d.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"line-width-dropdown",style:d.normalizeStyle(u.value)},[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(p,R=>d.createElementVNode("div",{key:R.value,class:d.normalizeClass(["line-width-option",{selected:a.value===R.value}]),onClick:d.withModifiers(b=>v(R.value),["stop"])},[d.createElementVNode("span",lN,d.toDisplayString(R.label),1),d.createElementVNode("div",{class:"line-preview",style:d.normalizeStyle({height:R.value+"px",backgroundColor:a.value===R.value?"#1890ff":"#ddd"})},null,4)],10,aN)),64))],4)):d.createCommentVNode("",!0)]))]),S[12]||(S[12]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",{class:"action-buttons"},[d.createElementVNode("button",{class:"control-btn",onClick:C,title:"删除选中"}," 🗑️ "),d.createElementVNode("button",{class:"control-btn",onClick:w,title:"清空"}," ❌ "),d.createElementVNode("button",{class:"control-btn",onClick:M,title:"保存"}," 💾 ")])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-3cfc8415"]]),dN={class:"measure-content"},hN={class:"measure-tools"},uN={key:0,class:"measure-results"},fN={class:"result-row"},pN={class:"result-value"},mN={class:"result-row"},gN={class:"result-value"},yN={class:"result-row"},AN={class:"result-value"},vN={class:"result-row"},bN={class:"result-value"},CN={key:1,class:"result-row"},wN={class:"result-value"},EN={key:2,class:"result-row"},xN={class:"result-value"},IN={class:"measure-controls"},SN={class:"control-group",title:"单位"},MN={class:"unit-display"},TN=["onClick"],BN=Be(d.defineComponent({__name:"LeitingMeasurement",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(null),r=d.ref(null),a=d.ref("m"),l=d.ref(!1),c=d.ref(null),h=d.ref(!1),u=d.ref({}),p=d.ref(null),f=[{label:"米 (m)",value:"m"},{label:"厘米 (cm)",value:"cm"},{label:"毫米 (mm)",value:"mm"}],m=I=>{const S=a.value;return S==="mm"?`${(I*1e3).toFixed(0)}mm`:S==="cm"?`${(I*100).toFixed(1)}cm`:`${I.toFixed(2)}m`},y=I=>I>1e6?`${(I/1e6).toFixed(2)} km²`:`${I.toFixed(2)} m²`,g=()=>{if(!o.value&&s.value?.getViewer){const I=s.value.getViewer(),S=s.value.getCesium();I&&S&&(o.value=new uc({viewer:I,cesium:S}),o.value.setUnit(a.value),o.value.setSnapping(l.value),o.value.onMeasure=R=>{c.value=R})}},A=I=>{o.value||g(),r.value===I?(r.value=null,o.value?.stop(),s.value?.baseCompt?.enableSelection()):(r.value=I,o.value?.start(I),s.value?.baseCompt?.disableSelection())},v=I=>{a.value=I,h.value=!1},C=()=>{o.value&&(o.value.clearAll(),r.value=null,o.value.stop()),s.value?.baseCompt?.enableSelection()},w=()=>{n("update:visible",!1)},M=I=>{if(h.value){h.value=!1;return}const R=I.currentTarget.getBoundingClientRect();u.value={position:"fixed",top:`${R.top}px`,left:`${R.right+5}px`,zIndex:3e3},h.value=!0},x=I=>{h.value&&p.value&&!p.value.contains(I.target)&&(h.value=!1)};return d.onMounted(()=>{document.addEventListener("click",x),t.visible&&d.nextTick(()=>g())}),d.onUnmounted(()=>{document.removeEventListener("click",x),o.value&&o.value.destroy()}),d.watch(()=>t.visible,I=>{I?d.nextTick(()=>g()):o.value&&(o.value.stop(),r.value=null)}),d.watch(s,I=>{I&&I.getViewer&&!o.value&&t.visible&&g()}),d.watch(a,I=>{o.value&&o.value.setUnit(I)}),(I,S)=>(d.openBlock(),d.createBlock(gt,{visible:t.visible,title:"量算",width:70,"min-width":70,height:480,"onUpdate:visible":S[3]||(S[3]=R=>n("update:visible",R)),onClose:w},{default:d.withCtx(()=>[d.createElementVNode("div",dN,[d.createElementVNode("div",hN,[d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="distance"}]),onClick:S[0]||(S[0]=R=>A("distance")),title:"距离测量"},[...S[4]||(S[4]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="angle"}]),onClick:S[1]||(S[1]=R=>A("angle")),title:"角度测量"},[...S[5]||(S[5]=[d.createElementVNode("div",{class:"tool-icon"},"📐",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="area"}]),onClick:S[2]||(S[2]=R=>A("area")),title:"面积测量"},[...S[6]||(S[6]=[d.createElementVNode("div",{class:"tool-icon"},"🔳",-1)])],2)]),S[15]||(S[15]=d.createElementVNode("div",{class:"separator"},null,-1)),c.value?(d.openBlock(),d.createElementBlock("div",uN,[c.value.type==="distance"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[d.createElementVNode("div",fN,[S[7]||(S[7]=d.createElementVNode("span",{class:"result-label"},"总长:",-1)),d.createElementVNode("span",pN,d.toDisplayString(m(c.value.dist)),1)]),d.createElementVNode("div",mN,[S[8]||(S[8]=d.createElementVNode("span",{class:"result-label",style:{color:"#ff4d4f"}},"ΔX:",-1)),d.createElementVNode("span",gN,d.toDisplayString(m(c.value.dx)),1)]),d.createElementVNode("div",yN,[S[9]||(S[9]=d.createElementVNode("span",{class:"result-label",style:{color:"#52c41a"}},"ΔY:",-1)),d.createElementVNode("span",AN,d.toDisplayString(m(c.value.dy)),1)]),d.createElementVNode("div",vN,[S[10]||(S[10]=d.createElementVNode("span",{class:"result-label",style:{color:"#1890ff"}},"ΔZ:",-1)),d.createElementVNode("span",bN,d.toDisplayString(m(c.value.dz)),1)])],64)):d.createCommentVNode("",!0),c.value.type==="angle"?(d.openBlock(),d.createElementBlock("div",CN,[S[11]||(S[11]=d.createElementVNode("span",{class:"result-label"},"角度:",-1)),d.createElementVNode("span",wN,d.toDisplayString(c.value.angle.toFixed(1))+"°",1)])):d.createCommentVNode("",!0),c.value.type==="area"?(d.openBlock(),d.createElementBlock("div",EN,[S[12]||(S[12]=d.createElementVNode("span",{class:"result-label"},"面积:",-1)),d.createElementVNode("span",xN,d.toDisplayString(y(c.value.area)),1)])):d.createCommentVNode("",!0)])):d.createCommentVNode("",!0),d.createElementVNode("div",IN,[d.createElementVNode("div",SN,[d.createElementVNode("div",{class:"tool-item",onClick:d.withModifiers(M,["stop"])},[d.createElementVNode("div",MN,d.toDisplayString(a.value),1)]),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[h.value?(d.openBlock(),d.createElementBlock("div",{key:0,ref_key:"unitDropdownRef",ref:p,class:"unit-dropdown",style:d.normalizeStyle(u.value)},[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(f,R=>d.createElementVNode("div",{key:R.value,class:d.normalizeClass(["unit-option",{selected:a.value===R.value}]),onClick:d.withModifiers(b=>v(R.value),["stop"])},d.toDisplayString(R.label),11,TN)),64))],4)):d.createCommentVNode("",!0)]))]),S[14]||(S[14]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",{class:"action-buttons"},[d.createElementVNode("div",{class:"tool-item control-btn",onClick:C,title:"清空"},[...S[13]||(S[13]=[d.createElementVNode("div",{class:"tool-icon"},"🗑️",-1)])])])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-8b1e070f"]]);function Mm(){const i=d.ref(!1),e=d.reactive({x:0,y:0}),t=d.ref([]),n=d.ref(null);return{visible:i,position:e,items:t,contextData:n,show:(l,c,h)=>{l instanceof MouseEvent?(l.preventDefault(),e.x=l.clientX,e.y=l.clientY):(e.x=l.x,e.y=l.y),t.value=c,n.value=h,i.value=!0},hide:()=>{i.value=!1},addItem:l=>{t.value.push(l)},removeItem:l=>{t.value=t.value.filter(c=>c.id!==l)}}}const _N=["onClick","onTouchend"],kN={class:"menu-label"},PN={key:0,class:"menu-arrow"},DN=Be(d.defineComponent({__name:"LeitingContextMenu",props:{visible:{type:Boolean},position:{},items:{}},emits:["update:visible","action"],setup(i,{emit:e}){const t=i,n=e,{isMobile:s}=Fr(),o=d.computed(()=>{let l=t.position.x,c=t.position.y;if(s.value){const u=t.items.length*48;l+200>window.innerWidth-16&&(l=window.innerWidth-200-16),c+u>window.innerHeight-16&&(c=window.innerHeight-u-16),c<16&&(c=16)}return{left:l+"px",top:c+"px"}}),r=l=>{l.disabled||(l.action&&l.action(),n("action",l),n("update:visible",!1))},a=()=>{t.visible&&n("update:visible",!1)};return d.onMounted(()=>{document.addEventListener("click",a),document.addEventListener("contextmenu",l=>{l.target.closest(".leiting-context-menu")||a()})}),d.onUnmounted(()=>{document.removeEventListener("click",a)}),(l,c)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-context-menu",{"mobile-style":d.unref(s)}]),style:d.normalizeStyle(o.value),onContextmenu:c[0]||(c[0]=d.withModifiers(()=>{},["prevent"]))},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(i.items,h=>(d.openBlock(),d.createElementBlock("div",{key:h.id,class:d.normalizeClass(["menu-item",{"menu-divided":h.divided,"menu-disabled":h.disabled}]),onClick:u=>r(h),onTouchend:d.withModifiers(u=>r(h),["prevent"])},[d.createElementVNode("span",kN,d.toDisplayString(h.label),1),h.children?(d.openBlock(),d.createElementBlock("span",PN,"▶")):d.createCommentVNode("",!0)],42,_N))),128))],38)),[[d.vShow,i.visible]])}}),[["__scopeId","data-v-62c220a6"]]),NN={class:"mobile-nav-root"},LN={class:"nav-bar-container"},RN={key:"sub-mode",class:"nav-inner sub-menu-wrapper"},FN={class:"sub-icons-list"},ON=["onClick"],GN=["innerHTML"],UN={key:"main-mode",class:"nav-inner main-menu-wrapper"},VN=["onClick"],QN=["src","alt"],Tm=Be(d.defineComponent({__name:"MobileBottomNav",props:{activeIds:{},is2d:{type:Boolean},customItems:{}},emits:["item-click","sub-item-click","clear-measure"],setup(i,{emit:e}){const t=i,n=e,s=d.ref(null),o=d.ref(null),r={measure:[{id:"distance",label:"距离",parentId:"measure",parentKey:"measurement"},{id:"angle",label:"角度",parentId:"measure",parentKey:"measurement"},{id:"area",label:"面积",parentId:"measure",parentKey:"measurement"},{id:"coordinate",label:"坐标",parentId:"measure",parentKey:"measurement"}],section:[{id:"box",label:"剖切盒",parentId:"section",parentKey:"section"},{id:"plane-x",label:"X轴",parentId:"section",parentKey:"section"},{id:"plane-y",label:"Y轴",parentId:"section",parentKey:"section"}]},a={distance:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 17l6-6 4 4 8-8"/><path d="M17 7h4v4"/></svg>',angle:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 20H4L14 4"/></svg>',area:'<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/></svg>',coordinate:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v20M2 12h20"/></svg>',box:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/></svg>'},l=g=>a[g]||a.box,c=d.ref([{ID:"home",title:"主视角",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoROakhe0HDeQmbQfFzTxJj+zTXYg1kWrarISRFKzLNAfGsbL9iDzq/0j+kQZ/k1wm7onoKW3Hq42F0jLVK//Tcebott2fJAbVK1lvKwBNd6rRIsFsfJka0G2qdpQPy7+EPC0AumexKAzoH5FbgvSbHuUW6EOYubbfwX0cLPfFJS4K6mPNrbdHb+uvP498dhVn4v9FWo9V3RZzFxAv8L9AAAAAElFTkSuQmCC",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"homeView"},{ID:"measure",title:"量算",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFESURBVDhPlZMNEcIwDIVXBQwFgAJAAcMBDgAFIGE4wAHgABSwOdgcIAEUjPd6aS/rfhi7y12bJl9f0sxEf3xVVV0RPoetjTFvnWqGcgSylfgihA0CKcgJgBfsAqMiKiM0+gkKlCyZCN8uhPWCFOSBxARWORU4W2CdeV9XjxSEJcwkjokTqBpzjxjCn7CyVRECzjg8wHLYCmabK7CplBcLhMr2DZCqP0dCovYZ9hYGXx1izLUGUkkfxI/sTQiCf4N1zLWAWCKV2nP6PEhB2Ngd7B4GC4SJnCcP8SAFoc/Ph/TqjVvTPogFKUiJ/VGU+GdmUAA5ObA7cyC+iPt/MjUfKRL4emyuK+cGH8tufFRUHywZ+RYlnRDdIwfzLzVUibtQv1oNhoAExtfpVdIAiQIOWiY9o2sQxJemOydTS1jR1di2Zn8B8f27apou9kMAAAAASUVORK5CYII=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"measurement"},{ID:"roam",title:"漫游",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADhSURBVHgBvVOBEYIwDEw9B2ADO4IjuIEjwAa6Aa7ABMAEuIIjOIFsUDao37vgxVZbBI+/+0tI0+fJBaIIrLUFaMAHmNNcsMAIE+vdJLQykQ+0wFHBrsyiT/sL2I1DDTac/+4Klzobov7WHxt29qGmaYaQnlhLCmUTa2l4C2ljvamFlEvY0xpCW/kA924GblfGWciZaJyXQvSmlOoDITSdXQBbcA8eKfy/nHDFeY470FIX8tzUIu84FmLWuTzz7yhRLPm54dKJ4+A5uoJ3HgHBUfUmxGIa4QDuKA4n3kLk9ZInw0qu5b1R1aYAAAAASUVORK5CYII=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"roam"},{ID:"info",title:"信息",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADFSURBVDhPxVPBDYMwDIwnKJu0G9ANYJMyQrsBbNIRGAE2gEnSO6mpIMJxkBC1lEds52zfOeK9b51zV5wte4lIr8RWbgGQh2fGmaIHJe4EetKPtDpRcA5AvwcB7FtgCcTOH0p3YzaQNd75QBiVXJG3LRtCRyQ6Jvsekd3gTsJVoDcihZLQQjXGTRMzIzPhOCCQyNYvSuEue7Qdm02yK0u1nM2m/FQyKb8JZHH+l81Ofdpdm82tvikjThyNlbSEBvIPFj+MfwA76qSYUG3g9QAAAABJRU5ErkJggg==",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"componentInfo"},{ID:"setting",title:"设置",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGPSURBVDhPrZT9UQIxEMUvFSgViBUoFQgVABV4VqBW4FmBUIFQgZRwVqBU4HUAVHC+X2aXycQw/sPOvLncZvdlv5JQFaTv+1upp8IyhLDHRLpLfe6FrXRt7hZShYyH+n8RauGAv/AkQNYIHICshFcRdu6fE/kGRN/mQGTIpzAzMoh6EV2fIsJ5IwNOj2IpVZ6i6difSecRVnlELZHIgHROisgXRCa78Z+IrMBf2pjLYJNENGSd1kO2pPghjKQniyqY8lFr2NfaqC18wn7nZCMlWg7xLq70TxfRLyHqtABN2lbp40mSSCzBcSebif1TPyKjDBcQ0eJJRkIUpHkMPUlnkBU+pnlWItL6ERgw8o1iqRHtgzAUGNRD2qmkvgMvNnneUQcZ4ggR6VGXG+OOA1koNvrFcY7+af++VJe0hucfyKQu+RWJc+SDZ3aNvlPpRl7T0qXdafNZYPDehLEZt/rOBR9U8QSaEKX0jHAaE4tshVrgLeJ+Xdl6rS8D3BWJXKnCEwWXEuco9grQ3bb0sP0Cn8/nPm/SMRQAAAAASUVORK5CYII=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"setting"}]),h=d.ref([{ID:"home",title:"主视角",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoROakhe0HDeQmbQfFzTxJj+zTXYg1kWrarISRFKzLNAfGsbL9iDzq/0j+kQZ/k1wm7onoKW3Hq42F0jLVK//Tcebott2fJAbVK1lvKwBNd6rRIsFsfJka0G2qdpQPy7+EPC0AumexKAzoH5FbgvSbHuUW6EOYubbfwX0cLPfFJS4K6mPNrbdHb+uvP498dhVn4v9FWo9V3RZzFxAv8L9AAAAAElFTkSuQmCC",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"homeView"},{ID:"cadLayer",title:"CAD图层",src:Gr,key:"cadLayer"},{ID:"annotation",title:"标注",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACDSURBVHgB1ZFhDYAgEIWfzgBGIIINpIEViGAkG2gEbWADjWADfMw/iDgUfji/7e3gxt3uHsDXZFrrlrFBHJNpsPAgEEmORArn3lFroEZQCjcTbAhzepPsgbuCgn8FBWvsUAMfFR5OIPGS5G80JkrG2sopHKbO1BCoHy8ZNhRUT5X4BTu6qyNSwwCiMAAAAABJRU5ErkJggg==",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"annotation"}]),u=d.computed(()=>{let A=[...t.is2d?h.value:c.value];return t.customItems&&(A=[...A,...t.customItems]),A}),p=d.computed(()=>s.value?r[s.value.ID]||[]:[]),f=g=>{if(r[g.ID]){if(g.ID==="measure"){n("item-click",g);return}if(s.value?.ID===g.ID)y();else{s.value=g,o.value=null;const A=r[g.ID];A&&A.length>0&&(o.value=A[0]?.id??null,setTimeout(()=>{n("sub-item-click",{parent:g,sub:A[0]})},50))}}else n("item-click",g)},m=g=>{o.value=g.id,n("sub-item-click",{parent:s.value,sub:g})},y=()=>{s.value=null,o.value=null};return(g,A)=>(d.openBlock(),d.createElementBlock("div",NN,[d.createElementVNode("nav",LN,[d.createVNode(d.Transition,{name:"nav-mode-switch",mode:"out-in"},{default:d.withCtx(()=>[s.value?(d.openBlock(),d.createElementBlock("div",RN,[d.createElementVNode("button",{class:"nav-back-icon",onClick:y},[...A[0]||(A[0]=[d.createElementVNode("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3"},[d.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)])]),d.createElementVNode("div",FN,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(p.value,v=>(d.openBlock(),d.createElementBlock("button",{key:v.id,class:d.normalizeClass(["sub-icon-box",{active:o.value===v.id}]),onClick:C=>m(v)},[d.createElementVNode("div",{class:"icon-svg",innerHTML:l(v.id)},null,8,GN)],10,ON))),128))])])):(d.openBlock(),d.createElementBlock("div",UN,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(u.value,v=>(d.openBlock(),d.createElementBlock("div",{key:v.ID,class:d.normalizeClass(["main-tab-item",{active:i.activeIds?.includes(v.ID)}]),onClick:C=>f(v)},[d.createElementVNode("img",{src:v.src,class:"tab-img",alt:v.title},null,8,QN)],10,VN))),128))]))]),_:1})])]))}}),[["__scopeId","data-v-2e30753b"]]),zN={key:1,class:"drawer-header"},HN={class:"drawer-title"},YN={class:"drawer-content"},$N={key:2,class:"drawer-footer"},jr=Be(d.defineComponent({__name:"MobileDrawer",props:{visible:{type:Boolean},title:{},direction:{default:"bottom"},width:{default:"100%"},height:{default:"50vh"},showHandle:{type:Boolean,default:!1},closeOnOverlay:{type:Boolean,default:!0},maxHeight:{default:"60vh"}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.ref(null);let o=0,r=0;const a=d.computed(()=>{const f={};return t.direction==="right"||t.direction==="left"?(f.width=t.width,f.height="100%"):(f.width=t.width,f.height=t.height,f.maxHeight=t.maxHeight),f}),l=f=>{o=f.touches[0]?.clientY??0,s.value&&(s.value.style.transition="none")},c=f=>{if(!s.value)return;r=(f.touches[0]?.clientY??0)-o,r>0&&(s.value.style.transform=`translateY(${r}px)`)},h=()=>{s.value&&(s.value.style.transition="transform 300ms cubic-bezier(0.4, 0, 0.2, 1)",r>100?u():s.value.style.transform="",r=0)},u=()=>{n("update:visible",!1),n("close")},p=()=>{t.closeOnOverlay&&u()};return d.watch(()=>t.visible,f=>{f?document.body.style.overflow="hidden":document.body.style.overflow=""}),(f,m)=>(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[d.createVNode(d.Transition,{name:"drawer-fade"},{default:d.withCtx(()=>[i.visible?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-drawer-overlay",onClick:d.withModifiers(p,["self"])},[d.createElementVNode("div",{class:d.normalizeClass(["mobile-drawer-panel",[`direction-${i.direction}`]]),style:d.normalizeStyle(a.value),onClick:m[0]||(m[0]=d.withModifiers(()=>{},["stop"])),ref_key:"panelRef",ref:s},[i.direction==="bottom"&&i.showHandle?(d.openBlock(),d.createElementBlock("div",{key:0,class:"drawer-handle",onTouchstart:l,onTouchmove:c,onTouchend:h},[...m[1]||(m[1]=[d.createElementVNode("div",{class:"handle-bar"},null,-1)])],32)):d.createCommentVNode("",!0),i.title||f.$slots.title?(d.openBlock(),d.createElementBlock("div",zN,[d.renderSlot(f.$slots,"title",{},()=>[d.createElementVNode("span",HN,d.toDisplayString(i.title),1)],!0),d.createElementVNode("button",{class:"drawer-close-btn",onClick:u},[...m[2]||(m[2]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])):d.createCommentVNode("",!0),d.createElementVNode("div",YN,[d.renderSlot(f.$slots,"default",{},void 0,!0)]),f.$slots.footer?(d.openBlock(),d.createElementBlock("div",$N,[d.renderSlot(f.$slots,"footer",{},void 0,!0)])):d.createCommentVNode("",!0)],6)])):d.createCommentVNode("",!0)]),_:3})]))}}),[["__scopeId","data-v-66d9d696"]]),jN={class:"mobile-tree-container"},WN={class:"search-section"},qN={class:"search-inner"},KN=["innerHTML"],Bm=Be(d.defineComponent({__name:"MobileTree",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},treeData:{default:()=>[]},initialCheckedKeys:{default:()=>[]}},emits:["update:visible","update:open","close","select","check","search"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:B=>{n("update:visible",B),n("update:open",B)}}),r={key:"id",title:"name",children:"children"},a=d.ref(""),l=d.ref([]),c=d.ref([]),h=d.ref(null),u=d.ref(300),p=d.ref(!1);let f=null;d.watch(()=>t.initialCheckedKeys,B=>{B&&B.length>0&&(c.value=[...B])},{immediate:!0}),d.watch(()=>t.treeData,B=>{if(!B||B.length===0)return;const L=[],O=(E,T)=>{for(let P=0;P<E.length;P++){const F=E[P],V=F.id||F.key||F.$id,G=F.modelId||T;G&&(F.modelId=G),V&&L.push(String(V)),F.children&&F.children.length>0&&O(F.children,G)}};O(B);const N=new Set(c.value);let D=!1;L.forEach(E=>{N.has(E)||(N.add(E),D=!0)}),D&&(c.value=Array.from(N),n("check",c.value))},{immediate:!0,deep:!0});const m=(B,L)=>{const O=[],N=D=>{for(let E=0;E<D.length;E++){const T=D[E],P=T.id||T.key;!T.children||T.children.length===0?!(P&&L.has(String(P)))&&T.modelId&&T.element_Id&&O.push({modelId:T.modelId,elementId:T.element_Id,show:!1}):T.children&&N(T.children)}};return N(B),O},y=d.computed(()=>{if(!a.value)return t.treeData;p.value=!0;const B=a.value.toLowerCase(),L=O=>{const N=[];for(let D=0;D<O.length;D++){const E=O[D],T=E.name||E.title||"",P=E.id||E.key,F=T.toLowerCase().includes(B);let V;E.children&&E.children.length>0&&(V=L(E.children)),(F||V&&V.length>0)&&N.push({key:String(P),title:T,children:V&&V.length>0?V:E.children?E.children:void 0,_raw:E,_searchMatched:F})}return N};return L(t.treeData)}),g=d.computed(()=>{if(!a.value)return[];const B=[],L=O=>{for(let N=0;N<O.length;N++){const D=O[N]?.children;D&&D.length>0&&(B.push(O[N]?.key),L(D))}};return L(y.value),B}),A=(B,L)=>a.value?(B||L||"").toLowerCase().includes(a.value.toLowerCase()):!1,v=B=>{if(!a.value)return B;const L=new RegExp(`(${a.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return B.replace(L,'<mark class="search-highlight">$1</mark>')},C=qo(B=>{const L=typeof B=="object"?B.target?.value??"":B;M(L)},200),w=B=>{M(B)},M=B=>{a.value=B||"",n("search",a.value),B&&d.nextTick(()=>{l.value=[...g.value]})},x=B=>{l.value=B},I=(B,L)=>{c.value=B,n("check",c.value);const O=new Set(B.map(D=>String(D))),N=m(t.treeData,O);s?.value?.setComponentVisibility&&s.value.setComponentVisibility(N),s?.value?.onTreeCheck&&s.value.onTreeCheck(B,L)},S=B=>{o.value=B},R=()=>{n("close")},b=()=>{h.value&&(u.value=h.value.clientHeight)};return d.onMounted(()=>{h.value&&(b(),f=new ResizeObserver(()=>{b()}),f.observe(h.value))}),d.onUnmounted(()=>{f&&(f.disconnect(),f=null)}),(B,L)=>(d.openBlock(),d.createBlock(jr,{visible:o.value,title:"目录树",direction:"bottom","show-handle":!1,class:"mobile-bim-drawer","onUpdate:visible":S,onClose:R},{title:d.withCtx(()=>[...L[1]||(L[1]=[d.createElementVNode("div",{class:"custom-drawer-header"},[d.createElementVNode("span",null,"目录树")],-1)])]),default:d.withCtx(()=>[d.createElementVNode("div",jN,[L[3]||(L[3]=d.createElementVNode("div",{class:"nav-tabs"},[d.createElementVNode("div",{class:"nav-tab-item active"},"构件")],-1)),d.createElementVNode("div",WN,[d.createElementVNode("div",qN,[d.createVNode(d.unref(oe.Input),{value:a.value,"onUpdate:value":L[0]||(L[0]=O=>a.value=O),placeholder:"搜索构件","allow-clear":"",class:"custom-search",onSearch:w,onChange:d.unref(C)},null,8,["value","onChange"])])]),d.createElementVNode("div",{class:"tree-content-wrapper",ref_key:"treeContentRef",ref:h},[y.value.length>0?(d.openBlock(),d.createBlock(d.unref(oe.Tree),{key:0,"tree-data":y.value,"field-names":r,"expanded-keys":l.value,"checked-keys":c.value,checkable:"","block-node":"",class:"bim-dark-tree",onExpand:x,onCheck:I},{switcherIcon:d.withCtx(({expanded:O})=>[d.createElementVNode("span",{class:d.normalizeClass(["switcher-icon",{"is-open":O}])},[...L[2]||(L[2]=[d.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"12",height:"12"},[d.createElementVNode("path",{d:"M340.864 149.312l405.376 362.688-405.376 362.688z",fill:"currentColor"})],-1)])],2)]),title:d.withCtx(({name:O,title:N})=>[d.createElementVNode("span",{class:d.normalizeClass(["node-title",{"is-matched":A(O,N)}])},[d.createElementVNode("span",{innerHTML:v(O||N)},null,8,KN)],2)]),_:1},8,["tree-data","expanded-keys","checked-keys","onExpand","onCheck"])):d.createCommentVNode("",!0)],512)])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-c2e8ecbe"]]),XN={class:"tabs-header"},JN=["onClick"],ZN={class:"modal-content"},eL={key:0,class:"setting-section"},tL={class:"setting-item"},iL={class:"mobile-switch"},nL={class:"setting-item"},sL={class:"mobile-switch"},oL={class:"setting-item"},rL={class:"mobile-switch"},aL={key:1,class:"setting-section"},lL={class:"setting-item"},cL={class:"mobile-switch"},dL={key:0,class:"setting-item column"},hL={class:"setting-label-row"},uL={class:"setting-value"},fL={class:"setting-item"},pL={class:"mobile-switch"},mL={class:"setting-item"},gL={class:"mobile-switch"},yL={class:"setting-item column"},AL={class:"setting-label-row"},vL={class:"setting-value"},bL={class:"setting-item column"},CL={class:"setting-label-row"},wL={class:"setting-value"},EL={class:"setting-item column"},xL={class:"setting-label-row"},IL={class:"setting-value"},SL={class:"setting-item column"},ML={style:{display:"flex",gap:"8px","margin-bottom":"8px","flex-wrap":"wrap"}},TL=["onClick","title"],BL={style:{display:"flex",gap:"8px","align-items":"center"}},_m=Be(d.defineComponent({__name:"MobileSetting",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0}},emits:["update:visible","update:open","close","change"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:f=>{n("update:visible",f),n("update:open",f)}}),r=[{id:"GIS",label:"GIS"},{id:"RENDER",label:"渲染"}],a=d.ref("GIS"),l=d.ref({globe:!1,terrain:!1,depthTest:!1}),c=d.ref({shadows:!1,shadowDarkness:.5,environmentMap:!0,ambientOcclusion:!1,brightness:1,contrast:1,saturation:1,backgroundColor:"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)"}),h=["linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)","linear-gradient(0deg, #0f2027 0%, #203a43 50%, #2c5364 100%)","linear-gradient(0deg, #cfd9df 0%, #e2ebf0 100%)"],u=()=>{p()},p=()=>{n("close"),n("change",{gis:l.value,render:c.value})};return d.watch(()=>l.value.globe,f=>{s?.value&&s.value.setGlobeEnvironmentVisible?.(f)}),d.watch(()=>l.value.terrain,f=>{s?.value&&s.value.setTerrainEnable?.(f)}),d.watch(()=>l.value.depthTest,f=>{s?.value&&s.value.setDepthTestEnable?.(f)}),d.watch(()=>c.value.shadows,f=>{s?.value&&s.value.setShadowsEnable?.(f)}),d.watch(()=>c.value.shadowDarkness,f=>{s?.value&&s.value.setShadowDarkness?.(f)}),d.watch(()=>c.value.environmentMap,f=>{s?.value&&s.value.setEnvironmentMapEnable?.(f)}),d.watch(()=>c.value.ambientOcclusion,f=>{s?.value&&s.value.setAmbientOcclusion?.(f)}),d.watch(()=>[c.value.brightness,c.value.contrast,c.value.saturation],([f,m,y])=>{const g=s?.value;g&&(g.setModelColorAdjustment?g.setModelColorAdjustment({brightness:f,contrast:m,saturation:y}):g.setModelBrightness?.(f))}),d.watch(()=>c.value.backgroundColor,f=>{s?.value&&s.value.setBackgroundColor?.(f)}),d.watch(()=>o.value,f=>{f?document.body.style.overflow="hidden":document.body.style.overflow=""}),(f,m)=>(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[d.createVNode(d.Transition,{name:"setting-modal"},{default:d.withCtx(()=>[o.value?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-setting-overlay",onClick:u,onTouchmove:m[13]||(m[13]=d.withModifiers(()=>{},["prevent"]))},[d.createElementVNode("div",{class:"mobile-setting-modal",onClick:m[12]||(m[12]=d.withModifiers(()=>{},["stop"]))},[d.createElementVNode("div",{class:"modal-header"},[m[15]||(m[15]=d.createElementVNode("span",{class:"modal-title"},"设置",-1)),d.createElementVNode("button",{class:"modal-close-btn",onClick:p},[...m[14]||(m[14]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),d.createElementVNode("div",XN,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(r,y=>d.createElementVNode("button",{key:y.id,class:d.normalizeClass(["tab-btn",{active:a.value===y.id}]),onClick:g=>a.value=y.id},d.toDisplayString(y.label),11,JN)),64))]),d.createElementVNode("div",ZN,[a.value==="GIS"?(d.openBlock(),d.createElementBlock("div",eL,[d.createElementVNode("div",tL,[m[17]||(m[17]=d.createElementVNode("span",{class:"setting-label"},"地球(含大气/日月/星空)",-1)),d.createElementVNode("label",iL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[0]||(m[0]=y=>l.value.globe=y)},null,512),[[d.vModelCheckbox,l.value.globe]]),m[16]||(m[16]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",nL,[m[19]||(m[19]=d.createElementVNode("span",{class:"setting-label"},"地形",-1)),d.createElementVNode("label",sL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[1]||(m[1]=y=>l.value.terrain=y)},null,512),[[d.vModelCheckbox,l.value.terrain]]),m[18]||(m[18]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",oL,[m[21]||(m[21]=d.createElementVNode("span",{class:"setting-label"},"地形遮挡",-1)),d.createElementVNode("label",rL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[2]||(m[2]=y=>l.value.depthTest=y)},null,512),[[d.vModelCheckbox,l.value.depthTest]]),m[20]||(m[20]=d.createElementVNode("span",{class:"slider"},null,-1))])])])):d.createCommentVNode("",!0),a.value==="RENDER"?(d.openBlock(),d.createElementBlock("div",aL,[d.createElementVNode("div",lL,[m[23]||(m[23]=d.createElementVNode("span",{class:"setting-label"},"阴影",-1)),d.createElementVNode("label",cL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[3]||(m[3]=y=>c.value.shadows=y)},null,512),[[d.vModelCheckbox,c.value.shadows]]),m[22]||(m[22]=d.createElementVNode("span",{class:"slider"},null,-1))])]),c.value.shadows?(d.openBlock(),d.createElementBlock("div",dL,[d.createElementVNode("div",hL,[m[24]||(m[24]=d.createElementVNode("span",{class:"setting-label"},"阴影暗度",-1)),d.createElementVNode("span",uL,d.toDisplayString(c.value.shadowDarkness.toFixed(2)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[4]||(m[4]=y=>c.value.shadowDarkness=y),min:"0",max:"1",step:"0.05",class:"mobile-slider"},null,512),[[d.vModelText,c.value.shadowDarkness,void 0,{number:!0}]])])):d.createCommentVNode("",!0),d.createElementVNode("div",fL,[m[26]||(m[26]=d.createElementVNode("span",{class:"setting-label"},"环境贴图",-1)),d.createElementVNode("label",pL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[5]||(m[5]=y=>c.value.environmentMap=y)},null,512),[[d.vModelCheckbox,c.value.environmentMap]]),m[25]||(m[25]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",mL,[m[28]||(m[28]=d.createElementVNode("span",{class:"setting-label"},"环境光遮蔽",-1)),d.createElementVNode("label",gL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[6]||(m[6]=y=>c.value.ambientOcclusion=y)},null,512),[[d.vModelCheckbox,c.value.ambientOcclusion]]),m[27]||(m[27]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",yL,[d.createElementVNode("div",AL,[m[29]||(m[29]=d.createElementVNode("span",{class:"setting-label"},"模型亮度",-1)),d.createElementVNode("span",vL,d.toDisplayString(c.value.brightness.toFixed(1)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[7]||(m[7]=y=>c.value.brightness=y),min:"0",max:"5",step:"0.1",class:"mobile-slider"},null,512),[[d.vModelText,c.value.brightness,void 0,{number:!0}]])]),d.createElementVNode("div",bL,[d.createElementVNode("div",CL,[m[30]||(m[30]=d.createElementVNode("span",{class:"setting-label"},"模型对比度",-1)),d.createElementVNode("span",wL,d.toDisplayString(c.value.contrast.toFixed(1)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[8]||(m[8]=y=>c.value.contrast=y),min:"0.5",max:"2",step:"0.1",class:"mobile-slider"},null,512),[[d.vModelText,c.value.contrast,void 0,{number:!0}]])]),d.createElementVNode("div",EL,[d.createElementVNode("div",xL,[m[31]||(m[31]=d.createElementVNode("span",{class:"setting-label"},"模型饱和度",-1)),d.createElementVNode("span",IL,d.toDisplayString(c.value.saturation.toFixed(1)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[9]||(m[9]=y=>c.value.saturation=y),min:"0",max:"3",step:"0.1",class:"mobile-slider"},null,512),[[d.vModelText,c.value.saturation,void 0,{number:!0}]])]),d.createElementVNode("div",SL,[m[32]||(m[32]=d.createElementVNode("span",{class:"setting-label"},"背景颜色",-1)),d.createElementVNode("div",ML,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(h,(y,g)=>d.createElementVNode("div",{key:g,style:d.normalizeStyle({background:y,width:"60px",height:"40px",borderRadius:"6px",cursor:"pointer",border:"2px solid rgba(255,255,255,0.2)",flexShrink:0}),onClick:A=>c.value.backgroundColor=y,title:"预设 "+(g+1)},null,12,TL)),64))]),d.createElementVNode("div",BL,[d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":m[10]||(m[10]=y=>c.value.backgroundColor=y),style:{width:"50px",height:"36px",padding:"0",border:"1px solid rgba(255,255,255,0.3)","border-radius":"6px",cursor:"pointer"}},null,512),[[d.vModelText,c.value.backgroundColor]]),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":m[11]||(m[11]=y=>c.value.backgroundColor=y),type:"text",class:"mobile-input",placeholder:"CSS 颜色值",style:{flex:"1"}},null,512),[[d.vModelText,c.value.backgroundColor]])])])])):d.createCommentVNode("",!0)])])],32)):d.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-dcec8ca4"]]),_L={class:"mobile-section-container"},kL={class:"section-main"},PL={class:"toggle-row"},DL={class:"slider-section"},NL={class:"slider-header"},LL={class:"slider-label"},RL={class:"slider-value"},FL={class:"quick-btns"},OL={class:"section-models"},GL={class:"models-header"},UL={class:"models-count"},km=Be(d.defineComponent({__name:"MobileSection",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},modelList:{default:()=>[]}},emits:["update:visible","update:open","close","visibility-change","mode-change","axis-change","model-change"],setup(i,{emit:e}){const t=i,n=e,s=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:b=>{n("update:visible",b),n("update:open",b)}}),o=d.ref(!0),r=d.ref("Box"),a=d.ref("X"),l=d.ref([]),c=d.ref([0,100]),h=d.ref([0,100]),u=d.ref([0,100]),p=[{key:"X",label:"X轴"},{key:"Y",label:"Y轴"},{key:"Z",label:"Z轴"}],f=d.computed(()=>p.find(B=>B.key===a.value)?.label||""),m=d.computed({get:()=>{switch(a.value){case"X":return c.value[1];case"Y":return h.value[1];case"Z":return u.value[1];default:return 50}},set:b=>{switch(a.value){case"X":c.value[1]=b??0;break;case"Y":h.value[1]=b??0;break;case"Z":u.value[1]=b??0;break}}}),y=d.computed(()=>{switch(a.value){case"X":return[-50,50];case"Y":return[-50,50];case"Z":return[0,100];default:return[0,100]}}),g=d.computed(()=>m.value?.toFixed(1)??"0.0"),A=d.computed(()=>l.value.length===t.modelList.length),v=b=>{s.value=b},C=()=>{n("close")},w=()=>{n("visibility-change",o.value)},M=b=>{r.value=b,n("mode-change",b)},x=()=>{m.value=50,n("axis-change",a.value,50)},I=()=>{const b=y.value;m.value=b&&b.length>=2?(b[0]+b[1])/2:50,n("axis-change",a.value,m.value)},S=()=>{n("model-change",l.value)},R=()=>{A.value?l.value=[]:l.value=t.modelList.map(b=>b.modelId),n("model-change",l.value)};return(b,B)=>(d.openBlock(),d.createBlock(jr,{visible:s.value,title:"剖切分析",direction:"bottom","show-handle":!0,"onUpdate:visible":v,onClose:C},{default:d.withCtx(()=>[d.createElementVNode("div",_L,[d.createElementVNode("div",kL,[d.createElementVNode("div",PL,[B[6]||(B[6]=d.createElementVNode("span",{class:"toggle-label"},"显示剖切盒",-1)),d.createVNode(d.unref(oe.Switch),{checked:o.value,"onUpdate:checked":B[0]||(B[0]=L=>o.value=L),onChange:w},null,8,["checked"])]),d.createVNode(d.unref(oe.RadioGroup),{value:r.value,"onUpdate:value":B[1]||(B[1]=L=>r.value=L),"button-style":"solid",class:"mode-selector",onChange:B[2]||(B[2]=L=>M(L.target.value))},{default:d.withCtx(()=>[d.createVNode(d.unref(oe.RadioButton),{value:"Box"},{default:d.withCtx(()=>[...B[7]||(B[7]=[d.createTextVNode("剖切盒",-1)])]),_:1})]),_:1},8,["value"]),d.createVNode(d.unref(oe.RadioGroup),{value:a.value,"onUpdate:value":B[3]||(B[3]=L=>a.value=L),"button-style":"solid",class:"axis-selector"},{default:d.withCtx(()=>[d.createVNode(d.unref(oe.RadioButton),{value:"X"},{default:d.withCtx(()=>[...B[8]||(B[8]=[d.createTextVNode("X轴",-1)])]),_:1}),d.createVNode(d.unref(oe.RadioButton),{value:"Y"},{default:d.withCtx(()=>[...B[9]||(B[9]=[d.createTextVNode("Y轴",-1)])]),_:1}),d.createVNode(d.unref(oe.RadioButton),{value:"Z"},{default:d.withCtx(()=>[...B[10]||(B[10]=[d.createTextVNode("Z轴",-1)])]),_:1})]),_:1},8,["value"]),d.createElementVNode("div",DL,[d.createElementVNode("div",NL,[d.createElementVNode("span",LL,d.toDisplayString(f.value)+" 轴范围",1),d.createElementVNode("span",RL,d.toDisplayString(g.value),1)]),d.createVNode(d.unref(oe.Slider),{Value:m.value,"onUpdate:Value":B[4]||(B[4]=L=>m.value=L),min:y.value[0],max:y.value[1],step:.5,class:"section-slider"},null,8,["Value","min","max"]),d.createElementVNode("div",FL,[d.createVNode(d.unref(oe.Button),{size:"small",onClick:x},{default:d.withCtx(()=>[...B[11]||(B[11]=[d.createTextVNode("重置",-1)])]),_:1}),d.createVNode(d.unref(oe.Button),{size:"small",onClick:I},{default:d.withCtx(()=>[...B[12]||(B[12]=[d.createTextVNode("居中",-1)])]),_:1})])])]),d.createElementVNode("div",OL,[d.createElementVNode("div",GL,[B[13]||(B[13]=d.createElementVNode("span",{class:"models-title"},"选择模型",-1)),d.createElementVNode("span",UL,d.toDisplayString(l.value.length)+"/"+d.toDisplayString(i.modelList.length),1)]),d.createVNode(d.unref(oe.CheckboxGroup),{value:l.value,"onUpdate:value":B[5]||(B[5]=L=>l.value=L),class:"models-list",onChange:S},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(i.modelList,L=>(d.openBlock(),d.createBlock(d.unref(oe.Checkbox),{key:L.modelId,value:L.modelId,class:"model-item"},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(L.modelName),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"]),i.modelList.length>1?(d.openBlock(),d.createBlock(d.unref(oe.Button),{key:0,size:"small",type:"link",onClick:R},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(A.value?"取消全选":"全选"),1)]),_:1})):d.createCommentVNode("",!0)])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-cdacec58"]]),VL={key:0,class:"mobile-measure-root"},QL={key:0,class:"result-card"},zL={class:"card-header-row"},HL={class:"result-main"},YL={class:"type-label"},$L={class:"value-highlight"},jL={key:0,class:"coords-grid"},WL={class:"coord-item"},qL={class:"coord-item"},KL={class:"coord-item"},XL={class:"measure-toolbar-container"},JL={class:"tools-inner-row"},ZL=["onClick"],e8=["innerHTML"],Pm=Be(d.defineComponent({__name:"MobileMeasurement",props:{visible:{type:Boolean},defaultTool:{}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods");let o=null,r=!1;const a=d.ref(null),l=d.ref(null),c=d.computed(()=>t.visible&&a.value!==null),h=[{id:"distance",svg:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 17l6-6 4 4 8-8"/></svg>'},{id:"angle",svg:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 20H4L14 4"/></svg>'},{id:"area",svg:'<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/></svg>'}],u={distance:"距离",angle:"角度",area:"面积"},p=d.computed(()=>a.value?u[a.value]||"":l.value&&u[l.value.type]||""),f=d.computed(()=>{if(!l.value)return a.value==="distance"?"-- m":a.value==="angle"?"--°":a.value==="area"?"-- m²":"";const w=l.value;return w.type==="distance"?`${(w.dist??0).toFixed(3)} m`:w.type==="angle"?`${(w.angle??0).toFixed(2)}°`:w.type==="area"?`${(w.area??0).toFixed(2)} m²`:""}),m=d.computed(()=>l.value?.type||a.value),y=w=>w===void 0?"--":w.toFixed(3),g=()=>{if(o)return;const w=s?.value;w?.getViewer&&(o=new uc({viewer:w.getViewer(),cesium:w.getCesium()}),o.onMeasure=M=>{r||(l.value=M)})},A=w=>{g(),a.value===w?(a.value=null,o?.stop(),s?.value?.baseCompt?.enableSelection()):(a.value=w,l.value=null,o?.start(w),s?.value?.baseCompt?.disableSelection())},v=()=>{o?.clearAll(),o?.stop(),a.value=null,l.value=null,s?.value?.baseCompt?.enableSelection()},C=()=>{v(),n("update:visible",!1),n("close")};return d.watch(()=>t.visible,w=>{w?(g(),t.defaultTool&&A(t.defaultTool)):v()}),d.onUnmounted(()=>{r=!0,o?.destroy()}),(w,M)=>(d.openBlock(),d.createBlock(d.Transition,{name:"measure-fade"},{default:d.withCtx(()=>[i.visible?(d.openBlock(),d.createElementBlock("div",VL,[d.createVNode(d.Transition,{name:"card-slide"},{default:d.withCtx(()=>[c.value?(d.openBlock(),d.createElementBlock("div",QL,[d.createElementVNode("div",zL,[d.createElementVNode("div",HL,[d.createElementVNode("span",YL,d.toDisplayString(p.value)+":",1),d.createElementVNode("span",$L,d.toDisplayString(f.value),1)]),d.createElementVNode("button",{class:"clear-action-btn",onClick:v,title:"清空"},[...M[0]||(M[0]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2"},[d.createElementVNode("polyline",{points:"3 6 5 6 21 6"}),d.createElementVNode("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])])]),m.value==="distance"?(d.openBlock(),d.createElementBlock("div",jL,[d.createElementVNode("div",WL,[M[1]||(M[1]=d.createElementVNode("span",{class:"label-x"},"X:",-1)),d.createTextVNode(" "+d.toDisplayString(y(l.value?.dx)),1)]),d.createElementVNode("div",qL,[M[2]||(M[2]=d.createElementVNode("span",{class:"label-y"},"Y:",-1)),d.createTextVNode(" "+d.toDisplayString(y(l.value?.dy)),1)]),d.createElementVNode("div",KL,[M[3]||(M[3]=d.createElementVNode("span",{class:"label-z"},"Z:",-1)),d.createTextVNode(" "+d.toDisplayString(y(l.value?.dz)),1)])])):d.createCommentVNode("",!0)])):d.createCommentVNode("",!0)]),_:1}),d.createElementVNode("div",XL,[d.createElementVNode("button",{class:"nav-back-icon",onClick:C},[...M[4]||(M[4]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"currentColor","stroke-width":"3"},[d.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)])]),d.createElementVNode("div",JL,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(h,x=>d.createElementVNode("button",{key:x.id,class:d.normalizeClass(["sub-icon-box",{active:a.value===x.id}]),onClick:I=>A(x.id)},[d.createElementVNode("span",{class:"icon-svg",innerHTML:x.svg},null,8,e8)],10,ZL)),64))])])])):d.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-7ff442b7"]]),t8={class:"joystick-base"},i8={class:"leitingbim-control-panel"},n8={class:"ctrl-row zoom-row"},s8={class:"zoom-label"},o8={class:"ctrl-grid"},r8={class:"gravity-toggle"},a8={class:"arrow-col"},Ac=40,Dm=Be(d.defineComponent({__name:"MobilePlayer",props:{visible:{type:Boolean}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods");let o=!1;const r=d.ref(null),a=d.ref(0),l=d.ref(0),c=d.ref(!1),h=d.ref({x:0,y:0}),u=[.25,.5,1,2,4,8,16],p=d.ref(2),f=d.ref(!0);let m=null;const y=d.computed(()=>({transform:`translate(${a.value}px, ${l.value}px)`})),g=d.computed(()=>`${u[p.value]}X`),A=(G,k)=>{const _=[];return(Math.abs(G)>10||Math.abs(k)>10)&&(k<-10&&_.push("moveFront"),k>10&&_.push("moveBack"),G<-10&&_.push("moveLeft"),G>10&&_.push("moveRight")),_},v=()=>{o||["moveFront","moveBack","moveLeft","moveRight"].forEach(G=>{s?.value?.setPlayerAction?.(G,!1)})},C=G=>{if(o)return;["moveFront","moveBack","moveLeft","moveRight"].forEach(_=>{const U=G.includes(_);s?.value?.setPlayerAction?.(_,U)})},w=G=>{const k=G.touches[0],_=r.value.getBoundingClientRect();h.value={x:_.left+_.width/2,y:_.top+_.height/2},c.value=!0,k&&x(k.clientX,k.clientY)},M=G=>{if(!c.value)return;const k=G.touches[0];k&&x(k.clientX,k.clientY)},x=(G,k)=>{if(o)return;let _=G-h.value.x,U=k-h.value.y;const H=Math.sqrt(_*_+U*U);H>Ac&&(_=_/H*Ac,U=U/H*Ac),a.value=_,l.value=U;const q=A(_,U);C(q)},I=()=>{c.value=!1,a.value=0,l.value=0,v()},S=()=>{B(),m=setInterval(()=>{p.value<u.length-1&&(p.value++,L())},150)},R=()=>{B(),m=setInterval(()=>{p.value>0&&(p.value--,L())},150)},b=()=>{B()},B=()=>{m&&(clearInterval(m),m=null)},L=()=>{o||s?.value?.setPlayerSpeed?.(u[p.value])},O=()=>{s?.value?.setPlayerAction?.("moveUp",!0)},N=()=>{s?.value?.setPlayerAction?.("moveUp",!1)},D=()=>{s?.value?.setPlayerAction?.("moveDown",!0)},E=()=>{s?.value?.setPlayerAction?.("moveDown",!1)},T=()=>{s?.value?.setPlayerParams?.({gravityTest:f.value,collisionTest:!0})},P=()=>{V(),n("update:visible",!1),n("close")},F=async()=>{if(!o)try{if(!s?.value){setTimeout(()=>F(),150);return}s.value.startCameraRoam&&s.value.startCameraRoam(),s.value.setPlayerSpeed?.(u[p.value])}catch(G){console.error("MobilePlayer startPlayer error:",G)}},V=()=>{v(),o||s?.value?.closePlayer?.(),B()};return d.watch(()=>t.visible,G=>{o||(G?F():V())},{immediate:!0}),d.onUnmounted(()=>{o=!0,V()}),(G,k)=>i.visible?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-player-overlay",onTouchmove:k[1]||(k[1]=d.withModifiers(()=>{},["prevent"]))},[d.createElementVNode("button",{class:"player-exit-btn",onClick:P}," 退出 "),d.createElementVNode("div",{class:"joystick-zone",ref_key:"joystickRef",ref:r,onTouchstart:d.withModifiers(w,["prevent"]),onTouchmove:d.withModifiers(M,["prevent"]),onTouchend:d.withModifiers(I,["prevent"]),onTouchcancel:d.withModifiers(I,["prevent"])},[d.createElementVNode("div",t8,[d.createElementVNode("div",{class:"joystick-knob",style:d.normalizeStyle(y.value)},null,4)])],544),d.createElementVNode("div",i8,[d.createElementVNode("div",n8,[d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-sm",onTouchstart:d.withModifiers(R,["prevent"]),onTouchend:d.withModifiers(b,["prevent"])},"−",32),d.createElementVNode("span",s8,d.toDisplayString(g.value),1),d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-sm",onTouchstart:d.withModifiers(S,["prevent"]),onTouchend:d.withModifiers(b,["prevent"])},"+",32)]),d.createElementVNode("div",o8,[d.createElementVNode("label",r8,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":k[0]||(k[0]=_=>f.value=_),onChange:T},null,544),[[d.vModelCheckbox,f.value]]),k[2]||(k[2]=d.createElementVNode("span",{class:"toggle-checkbox"},null,-1)),k[3]||(k[3]=d.createElementVNode("span",{class:"toggle-label"},"重力",-1))]),d.createElementVNode("div",a8,[d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-arrow",onTouchstart:d.withModifiers(O,["prevent"]),onTouchend:d.withModifiers(N,["prevent"])},[...k[4]||(k[4]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("polyline",{points:"18 15 12 9 6 15"})],-1)])],32),d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-arrow",onTouchstart:d.withModifiers(D,["prevent"]),onTouchend:d.withModifiers(E,["prevent"])},[...k[5]||(k[5]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])],32)])])])],32)):d.createCommentVNode("",!0)}}),[["__scopeId","data-v-d80a8120"]]),l8={key:0,class:"mobile-info-sheet-wrapper"},c8={class:"info-body"},d8={key:0,class:"empty-hint"},h8={key:0,class:"component-title"},u8={class:"group-list"},f8=["onClick"],p8={class:"group-name"},m8={key:0,class:"group-content"},g8={class:"kv-key"},y8={class:"kv-value"},Nm=Be(d.defineComponent({__name:"MobileInfo",props:{visible:{type:Boolean}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref([]),r=d.ref(!1),a=d.ref(new Set),l=d.ref([]);let c=!1;const h=d.computed({get:()=>!!t.visible,set:M=>{n("update:visible",M)}}),u=M=>({elementID:"构件ID",elementName:"构件名",categoryName:"类别",familySymbolName:"族类型",levelName:"标高",modelName:"文件名",length:"长",width:"宽",height:"高"})[M]||M,p=["elementName","elementID","modelName","length","width","height","levelName","categoryName","familySymbolName"],f=(M,x)=>`${M}__${x}`,m=(M,x)=>a.value.has(f(M,x)),y=(M,x)=>{const I=f(M,x);a.value.has(I)?a.value.delete(I):a.value.add(I)},g=()=>{const M=new Set;o.value.forEach(x=>{x.groups.forEach(I=>{M.add(f(x.id,I.name))})}),a.value=M},A=()=>{h.value=!1,n("close")},v=async M=>{if(c)return;if(l.value=M||[],!M||M.length===0){o.value=[];return}let x=M;M.length>10&&(pe.warning(`选中构件数量过多(${M.length}个),仅显示前10个`),x=M.slice(0,10));const I=s?.value;let S=I?.getMapTileset?I.getMapTileset():{};r.value=!0;const R=new Set;if(x.forEach(B=>{const L=S[B.modelId];L&&L.leiting&&!L.leiting?.node?.nodeExtras&&L.leiting.model?.nodeUrl&&R.add(B.modelId)}),R.size>0&&I?._loadNodeDetailsForModel)try{await Promise.all(Array.from(R).map(B=>I._loadNodeDetailsForModel(B)))}catch(B){console.error("Failed to load node details",B)}if(c)return;S=I?.getMapTileset?I.getMapTileset():{};const b=[];x.forEach((B,L)=>{const N=S[B.modelId]?.leiting||{};let D={modelName:N.model?.modelId||B.modelId};D.elementID||(D.elementID=B.elementId);let E=null;const T=N.node?.nodeExtras?.element||N.node?.nodeExtras;if(T){const V=D.elementID;T[V]&&(E=T[V])}E&&E.box3&&(D.length=`${E.box3.length?.toFixed(2)||0}米`,D.width=`${E.box3.width?.toFixed(2)||0}米`,D.height=`${E.box3.height?.toFixed(2)||0}米`);const P=[];E&&(E.name&&(D.elementName=E.name),E.categoryName&&(D.categoryName=E.categoryName),E.familySymbolName&&(D.familySymbolName=E.familySymbolName),E.levelName&&(D.levelName=E.levelName));const F={};if(p.forEach(V=>{D[V]!==void 0&&(F[V]=D[V])}),P.push({name:"基本属性",params:F}),E){const V=Array.isArray(E)?E:Array.isArray(E?.parameters)?E.parameters:null;if(V)V.flat().forEach(k=>{if(k&&k.GroupName&&Array.isArray(k.Parameters)){const _={};k.Parameters.forEach(U=>{U.name&&(_[U.name]=U.value??"")}),Object.keys(_).length>0&&P.push({name:k.GroupName,params:_})}});else{let G=!1;if(Object.keys(E).forEach(k=>{E[k]&&typeof E[k]=="object"&&!Array.isArray(E[k])&&(G=!0,P.push({name:k,params:E[k]}))}),!G){const k={};Object.keys(E).forEach(_=>{if(!p.includes(_)&&_!=="batchId"){const U=E[_];k[_]=typeof U=="string"&&U.length>500?U.substring(0,500)+"...":U}}),Object.keys(k).length>0&&P.push({name:"其他属性",params:k})}}}b.push({id:L,title:`${D.modelName}${D.elementName?` - ${D.elementName}`:""}`,groups:P})}),o.value=b,r.value=!1,!c&&b.length>0&&g()};let C=!1;const w=()=>{if(C)return;const M=s?.value;M&&M.selectionChange&&(M.selectionChange(v),C=!0)};return d.watch(()=>s?.value,()=>w(),{deep:!0,immediate:!0}),d.watch(h,M=>{M&&(w(),l.value.length>0&&v(l.value))}),d.onUnmounted(()=>{c=!0}),(M,x)=>(d.openBlock(),d.createBlock(d.Transition,{name:"info-slide"},{default:d.withCtx(()=>[i.visible?(d.openBlock(),d.createElementBlock("div",l8,[d.createElementVNode("div",{class:"mobile-info-sheet",onTouchmove:x[0]||(x[0]=d.withModifiers(()=>{},["stop"])),onClick:x[1]||(x[1]=d.withModifiers(()=>{},["stop"]))},[d.createElementVNode("div",{class:"info-header"},[x[3]||(x[3]=d.createElementVNode("span",{class:"info-title"},"构件详情",-1)),d.createElementVNode("button",{class:"info-close-btn",onClick:A},[...x[2]||(x[2]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),x[5]||(x[5]=d.createElementVNode("div",{class:"info-tabs"},[d.createElementVNode("span",{class:"tab-item active"},"属性")],-1)),d.createElementVNode("div",c8,[d.createVNode(d.unref(oe.Spin),{spinning:r.value},{default:d.withCtx(()=>[o.value.length===0&&!r.value?(d.openBlock(),d.createElementBlock("div",d8," 暂无数据 ")):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.value,I=>(d.openBlock(),d.createElementBlock("div",{key:I.id,class:"component-block"},[o.value.length>1?(d.openBlock(),d.createElementBlock("div",h8,d.toDisplayString(I.title),1)):d.createCommentVNode("",!0),d.createElementVNode("div",u8,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(I.groups,(S,R)=>(d.openBlock(),d.createElementBlock("div",{key:`${I.id}-${R}`,class:"group-item"},[d.createElementVNode("button",{class:d.normalizeClass(["group-header",{expanded:m(I.id,S.name)}]),onClick:b=>y(I.id,S.name)},[x[4]||(x[4]=d.createElementVNode("svg",{class:"arrow-icon",viewBox:"0 0 16 16",width:"12",height:"12",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("polyline",{points:"4 6 8 10 12 6"})],-1)),d.createElementVNode("span",p8,d.toDisplayString(S.name),1)],10,f8),d.createVNode(d.Transition,{name:"group-expand"},{default:d.withCtx(()=>[m(I.id,S.name)?(d.openBlock(),d.createElementBlock("div",m8,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(S.params,(b,B)=>(d.openBlock(),d.createElementBlock("div",{key:B,class:"kv-row"},[d.createElementVNode("span",g8,d.toDisplayString(u(String(B))),1),d.createElementVNode("span",y8,d.toDisplayString(b),1)]))),128))])):d.createCommentVNode("",!0)]),_:2},1024)]))),128))])]))),128))]),_:1},8,["spinning"])])],32)])):d.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-c4855585"]]),A8={class:"mobile-cad-layer-container"},v8={class:"model-selector"},b8={class:"layer-list-container"},C8={class:"list-header"},w8={class:"col-check"},E8=["checked"],x8={class:"list-body"},I8=["onClick"],S8=["checked","onChange"],M8={class:"col-index"},T8=["title"],B8={class:"col-color"},_8={key:0,class:"empty-state"},k8=Be(d.defineComponent({__name:"MobileCadLayer",props:{visible:{type:Boolean,default:!1},currentModelId:{type:String,default:""}},emits:["update:visible","handleCloseCardByCadCard"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(""),r=d.ref([]),a=d.computed({get:()=>t.visible,set:w=>n("update:visible",w)}),l=()=>{s.value&&s.value.getDxfModels&&(r.value=s.value.getDxfModels().map(w=>({modelId:w.modelId,modelName:w.modelName}))||[])},c=d.computed(()=>r.value.map(w=>({value:w.modelId,label:w.modelName}))),h=d.ref([]),u=d.ref([]),p=d.computed(()=>h.value.length>0&&u.value.length===h.value.length),f=({modelId:w})=>{if(h.value=[],u.value=[],s.value&&s.value.getDxfLayers){const M=s.value.getDxfLayers({modelId:w});M&&Object.keys(M).forEach((x,I)=>{M[x].length&&(h.value.push({index:I+1,layerName:x,layerColor:M[x][0].color||"#ffffff",key:x}),u.value.push(x))})}},m=w=>{o.value=w,f({modelId:w})},y=w=>{w.target.checked?u.value=h.value.map(x=>x.key):u.value=[],A()},g=(w,M)=>{M.target.checked?u.value.includes(w)||u.value.push(w):u.value=u.value.filter(I=>I!==w),A()},A=()=>{if(s.value&&s.value.showDxfLayer&&(s.value.showDxfLayer({modelId:o.value,show:!0,layers:u.value}),s.value.getDxfLayers)){const w=s.value.getDxfLayers({modelId:o.value});if(w){const M=Object.keys(w).filter(x=>!u.value.includes(x));s.value.showDxfLayer({modelId:o.value,show:!1,layers:M})}}},v=w=>{a.value=w},C=()=>{n("update:visible",!1),n("handleCloseCardByCadCard")};return d.watch(()=>t.visible,w=>{w&&(l(),t.currentModelId?(o.value=t.currentModelId,f({modelId:t.currentModelId})):c.value.length>0&&(o.value=c.value[0]?.value,f({modelId:o.value})))}),d.watch(()=>t.currentModelId,w=>{w&&t.visible&&(o.value=w,f({modelId:w}))}),(w,M)=>(d.openBlock(),d.createBlock(jr,{visible:a.value,title:"CAD图层",direction:"bottom","show-handle":!0,height:"70vh",class:"mobile-cad-layer-drawer","onUpdate:visible":v,onClose:C},{default:d.withCtx(()=>[d.createElementVNode("div",A8,[d.createElementVNode("div",v8,[M[3]||(M[3]=d.createElementVNode("span",{class:"selector-label"},"图纸:",-1)),d.createVNode(d.unref(oe.Select),{value:o.value,"onUpdate:value":M[0]||(M[0]=x=>o.value=x),options:c.value,onChange:M[1]||(M[1]=x=>m(x)),placeholder:"选择模型",class:"mobile-model-select",popupClassName:"mobile-cad-select-dropdown",size:"large"},null,8,["value","options"])]),d.createElementVNode("div",b8,[d.createElementVNode("div",C8,[d.createElementVNode("div",w8,[d.createElementVNode("input",{type:"checkbox",checked:p.value,onChange:y,class:"mobile-checkbox"},null,40,E8)]),M[4]||(M[4]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),M[5]||(M[5]=d.createElementVNode("div",{class:"col-name"},"图层名称",-1)),M[6]||(M[6]=d.createElementVNode("div",{class:"col-color"},"颜色",-1))]),d.createElementVNode("div",x8,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(h.value,x=>(d.openBlock(),d.createElementBlock("div",{key:x.key,class:"list-item",onClick:I=>g(x.key,{target:{checked:!u.value.includes(x.key)}})},[d.createElementVNode("div",{class:"col-check",onClick:M[2]||(M[2]=d.withModifiers(()=>{},["stop"]))},[d.createElementVNode("input",{type:"checkbox",checked:u.value.includes(x.key),onChange:I=>g(x.key,I),class:"mobile-checkbox"},null,40,S8)]),d.createElementVNode("div",M8,d.toDisplayString(x.index),1),d.createElementVNode("div",{class:"col-name",title:x.layerName},d.toDisplayString(x.layerName),9,T8),d.createElementVNode("div",B8,[d.createElementVNode("div",{class:"color-swatch",style:d.normalizeStyle({backgroundColor:x.layerColor})},null,4)])],8,I8))),128)),h.value.length===0?(d.openBlock(),d.createElementBlock("div",_8,[...M[7]||(M[7]=[d.createElementVNode("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[d.createElementVNode("path",{d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1),d.createElementVNode("p",null,"暂无图层信息",-1)])])):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-63da9a15"]]),P8={class:"mobile-annotation-panel"},D8={class:"tools-section"},N8={class:"tools-grid"},L8={class:"style-section"},R8={class:"style-item"},F8={class:"color-picker-wrapper"},O8={class:"style-item"},G8={class:"line-width-options"},U8=["onClick"],V8={class:"width-label"},Q8=Be(d.defineComponent({__name:"MobileAnnotationCard",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(""),r=d.ref("#ff0000"),a=d.ref(3),l=d.computed({get:()=>t.visible,set:v=>n("update:visible",v)}),c=[{value:6,label:"粗"},{value:3,label:"中"},{value:1,label:"细"}],h=()=>s?.value?.getAnnotationInstance?s.value.getAnnotationInstance():null,u=()=>{const v=h();if(v&&(typeof v.hideEntityOutline=="function"&&v.hideEntityOutline(),v.selectedEntityObj=null,v.drawTool&&typeof v.drawTool.deactivate=="function"))try{v.drawTool.deactivate()}catch(C){console.warn("Failed to deactivate drawTool:",C)}o.value="",n("update:visible",!1)},p=v=>{if(o.value===v){o.value="";return}o.value=v;const C=h();if(C)switch(v){case"freehandLine":C.startFreehandLine();break;case"arrow":C.startArrow();break;case"straightLine":C.startStraightLine();break;case"rectangle":C.startRectangle();break;case"ellipse":C.startEllipse();break}},f=()=>{const v=h();v&&(v.setCurrentColor(r.value),v.changeColor(r.value))},m=v=>{a.value=v;const C=h();C&&(C.setCurrentWidth(v),C.changeWidth(v))},y=()=>{const v=h();v&&v.deleteSelectedEntity()},g=()=>{const v=h();v&&v.clearAll()},A=()=>{if(s?.value?.saveAnnotations){s.value.saveAnnotations();return}const v=h();v&&v.saveAnnotations()};return(v,C)=>(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[d.createVNode(d.Transition,{name:"annotation-slide"},{default:d.withCtx(()=>[l.value?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-annotation-overlay",onClick:d.withModifiers(u,["self"])},[d.createElementVNode("div",P8,[d.createElementVNode("div",{class:"panel-header"},[C[7]||(C[7]=d.createElementVNode("span",{class:"panel-title"},"标注",-1)),d.createElementVNode("button",{class:"panel-close-btn",onClick:u},[...C[6]||(C[6]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),d.createElementVNode("div",D8,[C[13]||(C[13]=d.createElementVNode("div",{class:"section-label"},"绘图工具",-1)),d.createElementVNode("div",N8,[d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="freehandLine"}]),onClick:C[0]||(C[0]=w=>p("freehandLine"))},[...C[8]||(C[8]=[d.createElementVNode("div",{class:"tool-icon"},"✏️",-1),d.createElementVNode("span",{class:"tool-label"},"手绘线",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="arrow"}]),onClick:C[1]||(C[1]=w=>p("arrow"))},[...C[9]||(C[9]=[d.createElementVNode("div",{class:"tool-icon"},"↗️",-1),d.createElementVNode("span",{class:"tool-label"},"箭头",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="straightLine"}]),onClick:C[2]||(C[2]=w=>p("straightLine"))},[...C[10]||(C[10]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1),d.createElementVNode("span",{class:"tool-label"},"直线",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="rectangle"}]),onClick:C[3]||(C[3]=w=>p("rectangle"))},[...C[11]||(C[11]=[d.createElementVNode("div",{class:"tool-icon"},"▭",-1),d.createElementVNode("span",{class:"tool-label"},"矩形",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="ellipse"}]),onClick:C[4]||(C[4]=w=>p("ellipse"))},[...C[12]||(C[12]=[d.createElementVNode("div",{class:"tool-icon"},"⭕",-1),d.createElementVNode("span",{class:"tool-label"},"椭圆",-1)])],2)])]),C[21]||(C[21]=d.createElementVNode("div",{class:"divider"},null,-1)),d.createElementVNode("div",L8,[C[16]||(C[16]=d.createElementVNode("div",{class:"section-label"},"样式设置",-1)),d.createElementVNode("div",R8,[C[14]||(C[14]=d.createElementVNode("span",{class:"style-label"},"颜色",-1)),d.createElementVNode("div",F8,[d.createElementVNode("div",{class:"color-preview",style:d.normalizeStyle({backgroundColor:r.value})},null,4),d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":C[5]||(C[5]=w=>r.value=w),onChange:f,class:"color-input"},null,544),[[d.vModelText,r.value]])])]),d.createElementVNode("div",O8,[C[15]||(C[15]=d.createElementVNode("span",{class:"style-label"},"线宽",-1)),d.createElementVNode("div",G8,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(c,w=>d.createElementVNode("button",{key:w.value,class:d.normalizeClass(["width-btn",{active:a.value===w.value}]),onClick:M=>m(w.value)},[d.createElementVNode("div",{class:"width-line",style:d.normalizeStyle({height:w.value+"px",backgroundColor:a.value===w.value?"#00e5d1":"#fff"})},null,4),d.createElementVNode("span",V8,d.toDisplayString(w.label),1)],10,U8)),64))])])]),C[22]||(C[22]=d.createElementVNode("div",{class:"divider"},null,-1)),d.createElementVNode("div",{class:"action-section"},[C[20]||(C[20]=d.createElementVNode("div",{class:"section-label"},"操作",-1)),d.createElementVNode("div",{class:"action-grid"},[d.createElementVNode("button",{class:"action-btn delete-btn",onClick:y},[...C[17]||(C[17]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("polyline",{points:"3 6 5 6 21 6"}),d.createElementVNode("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})],-1),d.createElementVNode("span",null,"删除",-1)])]),d.createElementVNode("button",{class:"action-btn clear-btn",onClick:g},[...C[18]||(C[18]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1),d.createElementVNode("span",null,"清空",-1)])]),d.createElementVNode("button",{class:"action-btn save-btn",onClick:A},[...C[19]||(C[19]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("path",{d:"M19 21H5a2 2 0 01-2-2V5a2 2 0 012-2h11l5 5v11a2 2 0 01-2 2z"}),d.createElementVNode("polyline",{points:"17 21 17 13 7 13 7 21"}),d.createElementVNode("polyline",{points:"7 3 7 8 15 8"})],-1),d.createElementVNode("span",null,"保存",-1)])])])])])])):d.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-9b4979c4"]]),z8=["src"],Wr=Be(d.defineComponent({__name:"LeitingBIM",props:{accessToken:{},cesiumUrl:{},cesiumCssUrl:{},methods:{},viewerOptions:{},treeProps:{},showTree:{type:Boolean,default:!0},showMenu:{type:Boolean,default:!1},playerUrl:{default:"https://leiting.chenxisoft.com/resource/person/person.glb"},playerModelName:{default:"Person"},playerModelId:{default:"player_111"},playerScale:{default:.0032},tiandituToken:{default:"c25f14fb6bd4397cf8fe45144ff768d6"},globe:{type:Boolean,default:void 0},terrain:{type:Boolean,default:void 0},depthTest:{type:Boolean,default:void 0},mapProvider:{},tiandituLayerType:{},tiandituShowLabel:{type:Boolean,default:void 0},arcgisUrl:{},teleportTarget:{},shadows:{type:Boolean,default:void 0},environmentMap:{type:Boolean,default:void 0},ambientOcclusion:{type:Boolean,default:void 0},time:{},brightness:{},backgroundColor:{},collision:{type:Boolean,default:void 0},mouseHabit:{},mode:{default:"3d"},mountAll3Dtiles:{},mountAllCad:{},saveRegion:{},saveCadRegion:{},saveCadCalibration:{},selectionChange:{},searchComponent:{}},emits:["register","init","ready"],setup(i,{expose:e,emit:t}){const n=d.ref(),s=d.ref(),o=d.getCurrentInstance(),r=d.ref(!1),a=d.ref(""),l=d.ref({}),c=d.ref("3d"),{isMobile:h}=Fr(),u=i,p={title:"构件树",treeData:[]},f=d.ref(!1),m=d.ref(!1),y=d.ref(!1),g=d.ref(!1),A=d.ref(!1),v=d.ref(!1),C=d.ref(!1),w=d.ref(!1),M=d.ref(!1),x=d.ref(!1),I=d.ref(!1),S=d.ref(null),{visible:R,position:b,items:B,show:L,hide:O}=Mm(),N=d.ref([]),D=j=>{N.value.push(j)},E=j=>{N.value=N.value.filter(Y=>Y.id!==j)},T=d.ref([]),P=d.ref(""),F=d.ref(null),V=d.ref([]),G=d.reactive({tree:!1,section:!1,roam:!1,info:!1,adjustModel:!1,setting:!1,cadLayer:!1,cadPosition:!1,gisCadPosition:!1,annotation:!1}),k=(j,Y)=>{j==="componentTree"&&(j="tree"),j==="componentInfo"&&(j="info"),j in G&&(G[j]=Y)},_=d.shallowRef({});d.provide("leitingMethods",_);const U=d.ref(u.showMenu),H=d.ref([]);d.watch(()=>u.showMenu,j=>{U.value=j},{immediate:!0}),d.watch(()=>u.mode,j=>{j&&_.value?.set2d&&_.value.set2d(j==="2d")});const q=d.ref("dark");d.provide("leiting-theme",q);const X=d.ref(u.teleportTarget);d.watch(()=>u.teleportTarget,j=>{X.value=j});const de=d.ref([]),fe=d.computed(()=>{const j=[];return f.value&&(j.push("tree"),j.push("componentTree")),m.value&&j.push("section"),y.value&&j.push("roam"),g.value&&(j.push("info"),j.push("componentInfo")),A.value&&j.push("adjust"),v.value&&j.push("setting"),C.value&&j.push("cadLayer"),w.value&&j.push("cadPosition"),M.value&&j.push("gisCadPosition"),x.value&&j.push("annotation"),I.value&&(j.push("measure"),j.push("measurement")),j.push(...de.value),j}),me=d.ref(null),be=(j,Y)=>{j==="componentTree"||j==="tree"?f.value=Y:j==="section"?m.value=Y:j==="roam"?y.value=Y:j==="componentInfo"||j==="info"?g.value=Y:j==="homeView"?_.value?.is2dMode?.()?_.value?.flyToTopView?.({}):_.value?.getBIMmodelId()?_.value?.flyToTileset?.({}):_.value?.getCadModelId()&&_.value?.flyToTopView?.({}):j==="adjustModel"?(A.value=Y,Y&&me.value&&me.value.setModelType("BIM")):j==="osgbAdjust"?(A.value=Y,Y&&me.value&&me.value.setModelType("OSGB")):j==="setting"?v.value=Y:j==="cadLayer"?C.value=Y:j==="cadPosition"?w.value=Y:j==="gisCadPosition"?M.value=Y:j==="annotation"?x.value=Y:j==="measurement"?I.value=Y:Y?de.value.includes(j)||de.value.push(j):de.value=de.value.filter(te=>te!==j)},_e=j=>{const Y=j.key||j.ID;if(!Y)return;if(Y==="homeView"||Y==="home"){be(Y,!0);return}if(Y==="measurement"){S.value="distance",I.value=!0;return}const te=!fe.value.includes(j.ID);be(Y,te)},Je=j=>{const Y=j.sub;if(!Y)return;const te=Y.parentKey||j.parent?.key;te==="measurement"?(S.value=Y.id.replace("measure-",""),I.value=!0):te==="section"&&(m.value=!0)};d.watch(f,async j=>{if(j&&_.value?.loadTreeForModel&&_.value?.getMapTileset){const Y=_.value.getMapTileset(),te=Object.values(Y).map(async ze=>{if(ze.leiting&&ze.leiting.model?.treeUrl){const It=ze.leiting.model.modelId;try{ze.leiting?.node?.batchIdEIDInfos||await _.value.loadNodeDetailsForModel(It);const $t=await _.value.loadTreeForModel(It);$t&&(Array.isArray($t)?$t:[$t]).forEach(Yi=>{Yi&&!V.value.find(zd=>zd.id===Yi.id)&&(Yi.modelId=It,V.value=[...V.value,Yi])})}catch($t){console.warn(`Failed to lazy load tree for ${It}`,$t)}}});await Promise.all(te)}});const lt=()=>{_.value&&(_.value.getDxfModels&&(T.value=_.value.getDxfModels()||[]),_.value.getCadModelId&&(P.value=_.value.getCadModelId()||""))};let ct;d.watch(C,j=>{j&<()}),d.watch(w,j=>{j&&(lt(),F.value&&T.value.length&&F.value.addGltfOr3dTilesModelList(T.value))});const Bt=t,vt=j=>{_.value&&_.value.saveCadCalibration&&_.value.saveCadCalibration(j),_.value&&_.value.saveCadRegion&&_.value.saveCadRegion(j)};return d.onMounted(async()=>{if(s.value&&pe.setContainer(s.value),!!n.value)try{const j={...bn,cesiumUrl:u.cesiumUrl||bn.cesiumUrl,cesiumCssUrl:u.cesiumCssUrl||bn.cesiumCssUrl,accessToken:u.accessToken||Kd()||bn.accessToken};await Ua(j),r.value=!0,ct=async(te={},ze)=>{if(n.value){const{showMenu:It,showTree:$t,globe:yn,terrain:Yi,depthTest:zd,mapProvider:nU,tiandituLayerType:sU,tiandituShowLabel:oU,arcgisUrl:rU,shadows:aU,environmentMap:lU,ambientOcclusion:cU,time:dU,brightness:hU,backgroundColor:uU,collision:fU,mouseHabit:pU,heightBasedZoom:mU,mode:sy,...ci}=te||{},gU=u.showMenu!==void 0?u.showMenu:It!==void 0?It:!0;U.value=gU;const ft=(ne,He,jt)=>ne!==void 0?ne:He!==void 0?He:jt,oy=ft(u.globe,yn,!1),ry=ft(u.terrain,Yi,!1),ay=ft(u.depthTest,zd,!1),ly=ft(u.mapProvider,nU,"tianditu"),cy=ft(u.tiandituLayerType,sU,"img_w"),dy=ft(u.tiandituShowLabel,oU,!1),hy=ft(u.arcgisUrl,rU,"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"),uy=ft(u.shadows,aU,!1),fy=ft(u.environmentMap,lU,!1),py=ft(u.ambientOcclusion,cU,!1),my=ft(u.time,dU,void 0),gy=ft(u.brightness,hU,1),Na=u.mode||sy||"3d";console.log("LeitingBIM Mode:",Na,"Props:",u.mode,"Options:",sy),c.value=Na;const yU=Na==="2d"?"#000000":"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)",yy=ft(u.backgroundColor,uU,yU),Ay=ft(u.collision,fU,!1),vy=ft(u.mouseHabit,pU,0),by=ft(u.heightBasedZoom,mU,!1);l.value={globe:oy,terrain:ry,depthTest:ay,mapProvider:ly,tiandituLayerType:cy,tiandituShowLabel:dy,arcgisUrl:hy,shadows:uy,environmentMap:fy,ambientOcclusion:py,time:my,brightness:gy,backgroundColor:yy,collision:Ay,mouseHabit:vy,heightBasedZoom:by,useBrowserRecommendedResolution:!0};const No=CB({container:n.value,appContext:o?.appContext,methods:{..._.value,handleMenuAction:be,setCardFullHeight:k,onLoadingStatus:ne=>{ne?pe.loading(ne,"",s.value):pe.close()},...ci,tilesLoad3dTiles:async ne=>{let He=ne.leiting?.tree;const jt=ne.leiting?.model?.modelId;if(!He&&f.value&&_.value?.loadTreeForModel)try{He=await _.value.loadTreeForModel(jt)}catch(Ro){console.warn("Failed to lazy load tree",Ro)}He&&(Array.isArray(He)?He:[He]).forEach(vn=>{vn&&!V.value.find(wy=>wy.id===vn.id)&&(vn.modelId=jt,V.value=[...V.value,vn])});const{brightness:Hd,contrast:Yd,saturation:Ci}=No.methods.getConfigure();No.methods.setModelColorAdjustment({brightness:Hd,contrast:Yd,saturation:Ci}),ci.tilesLoad3dTiles?.(ne)},mountAll3Dtiles:ne=>{u.mountAll3Dtiles&&u.mountAll3Dtiles(ne),ci.mountAll3Dtiles?.(ne)},updateModels:ne=>{if(Array.isArray(ne))if(ne.length===0)V.value=[];else{const He=ne.map(jt=>jt.modelId);V.value=V.value.filter(jt=>He.includes(jt.modelId))}},mountAllCad:ne=>{if(No.methods.setModelBrightness){const He=u.brightness!==void 0?u.brightness:l.value.brightness;He!==void 0&&No.methods.setModelBrightness(He)}u.mountAllCad&&u.mountAllCad(ne),ci.mountAllCad?.(ne)},saveRegion:ne=>{u.saveRegion&&u.saveRegion(ne),ci.saveRegion?.(ne)},saveCadRegion:ne=>{u.saveCadRegion&&u.saveCadRegion(ne),ci.saveCadRegion?.(ne)},saveCadCalibration:ne=>{u.saveCadCalibration&&u.saveCadCalibration(ne),ci.saveCadCalibration?.(ne)},selectionChange:ne=>{u.selectionChange&&u.selectionChange(ne),ci.selectionChange?.(ne)},onSearchComponent:ne=>{u.searchComponent&&u.searchComponent(ne),ci.searchComponent?.(ne)}},viewerOptions:u.viewerOptions,options:{...ci,mode:Na,playerUrl:u.playerUrl,playerModelName:u.playerModelName,playerModelId:u.playerModelId,playerScale:u.playerScale,globe:oy,terrain:ry,depthTest:ay,mapProvider:ly,tiandituLayerType:cy,tiandituShowLabel:dy,tiandituToken:u.tiandituToken,arcgisUrl:hy,shadows:uy,environmentMap:fy,ambientOcclusion:py,time:my,brightness:gy,backgroundColor:yy,collision:Ay,mouseHabit:vy,heightBasedZoom:by},callbacks:{onLoading:ne=>ne?pe.loading(ne,"",s.value):pe.close(),onSuccess:ne=>pe.success(ne,"",void 0,s.value),onError:ne=>pe.error(ne,"",void 0,s.value)}}),{Cesium:An,viewer:gs,methods:La,menuEvents:Lo}=No,xe=La;Lo.on("showMenu",ne=>{U.value=ne}),Lo.on("insertMenu",ne=>{H.value=[...H.value,...ne]}),Lo.on("setMenuActive",(ne,He)=>{be(ne,He)}),_.value=xe,ze&&(ze.value=xe),Lo.on("setMode",ne=>{c.value=ne}),Lo.on("deleteAllModels",()=>{V.value=[]}),new An.ScreenSpaceEventHandler(gs.scene.canvas).setInputAction(async ne=>{if(O(),c.value==="2d")return;const He=gs.scene.pick(ne.position),jt=gs.container.getBoundingClientRect(),Hd=jt.left+ne.position.x,Yd=jt.top+ne.position.y,Ci=[];if(An.defined(He)&&He instanceof An.Cesium3DTileFeature){const Ro=xe.baseCompt.getFeatureId(He),vn=ks(He.tileset);xe.baseCompt.hasSelectedFeaturesMap[vn]?.some(Fo=>Fo.batchId===Ro&&Fo.rank===0)||(await xe.baseCompt.clearSelection(),await xe.baseCompt.toggleMultiSelect(vn,Ro,xe.baseCompt.selectedColor)),Ci.push({id:"details",label:"构件详情",action:()=>{g.value=!0}}),Ci.push({id:"hide",label:"隐藏选中构件",action:async()=>{const Oo=(await xe.baseCompt.getSelected()).map(wi=>({elementId:wi.elementId,modelId:wi.modelId,show:!1}));xe.baseCompt.setComponentVisibility(Oo)}}),Ci.push({id:"translucent",label:"半透明选中构件",action:async()=>{const Oo=(await xe.baseCompt.getSelected()).map(wi=>({elementId:wi.elementId,modelId:wi.modelId,rgba:{...wi.rgba,a:.3}}));await xe.baseCompt.setSelectColorUserModelCpt(Oo,{rank:0})}}),Ci.push({id:"isolate",label:"隔离选中构件",divided:!0,action:async()=>{await xe.baseCompt.loadAllNodeDetailsForModel();const Oo=(await xe.baseCompt.getSelected()).map(wi=>({elementId:wi.elementId,modelId:wi.modelId,show:!0}));xe.isolateComponents(Oo)}})}Ci.push({id:"showAll",label:"显示所有",action:async()=>{xe.baseCompt.setAllComponentsVisibility(!0),await xe.baseCompt.clearSelection()}}),Ci.push(...N.value),L({x:Hd,y:Yd},Ci)},An.ScreenSpaceEventType.RIGHT_CLICK),xe.addContextMenuItems=D,xe.insertContextMenu=xe.addContextMenuItems,xe.removeContextMenuItems=E,xe.deleteContextMenu=xe.removeContextMenuItems,xe.closeContextMenu=O,xe.hideContextMenu=xe.closeContextMenu,xe.onSetTeleportTarget=ne=>{X.value=ne},await d.nextTick();const Cy=te?.onLoaded||te?.onloaded;Cy&&Cy({Cesium:An,viewer:gs,methods:La}),Bt("init",{Cesium:An,viewer:gs,methods:La}),Bt("ready",{Cesium:An,viewer:gs,methods:La})}};let Y=!1;Bt("register",(te,ze)=>{Y=!0,ct(te,ze)}),Y||setTimeout(()=>{_.value.getViewer||ct()},0)}catch(j){a.value="Failed to load Cesium: "+(j.message||j),console.error(j)}}),d.onUnmounted(()=>{pe.setContainer(null)}),e({initMap:()=>_.value,initializeViewer:(j,Y)=>ct(j,Y)}),(j,Y)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-bim-container",[`theme-${q.value}`]]),onContextmenu:Y[29]||(Y[29]=d.withModifiers(()=>{},["prevent","stop"]))},[!r.value&&!a.value?(d.openBlock(),d.createBlock(d.unref(oe.Spin),{key:0,class:"loading",size:"large",tip:"加载基础组件中..."})):d.createCommentVNode("",!0),a.value?(d.openBlock(),d.createBlock(d.unref(oe.Alert),{key:1,class:"error",type:"error",message:a.value,"show-icon":""},null,8,["message"])):d.createCommentVNode("",!0),d.createElementVNode("div",{ref_key:"containerRef",ref:n,class:"cesium-viewer"},[d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(ao,{key:0,visible:U.value,"active-ids":fe.value,"custom-items":H.value,onAction:be,"is-2d":c.value==="2d"},null,8,["visible","active-ids","custom-items","is-2d"])),d.unref(h)&&!y.value&&!I.value?(d.openBlock(),d.createBlock(Tm,{key:1,"active-ids":fe.value,"is-2d":c.value==="2d",onItemClick:_e,onSubItemClick:Je},null,8,["active-ids","is-2d"])):d.createCommentVNode("",!0),d.unref(h)&&i.showTree!==!1&&!y.value&&c.value!=="2d"?(d.openBlock(),d.createElementBlock("button",{key:2,class:d.normalizeClass(["mobile-float-tree-btn",{active:f.value}]),onClick:Y[0]||(Y[0]=te=>f.value=!f.value)},[d.createElementVNode("img",{src:d.unref(Gr),class:"mobile-float-tree-icon",alt:"目录树"},null,8,z8)],2)):d.createCommentVNode("",!0),(d.openBlock(),d.createBlock(d.Teleport,{to:X.value||"body",disabled:!X.value},[d.createElementVNode("div",{ref_key:"uiOverlayRef",ref:s,class:"leiting-ui-overlay"},[d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(ho,{key:0,visible:g.value,"full-height":G.info,"onUpdate:visible":Y[1]||(Y[1]=te=>g.value=te)},null,8,["visible","full-height"])),d.unref(h)?(d.openBlock(),d.createBlock(Nm,{key:1,visible:g.value,"onUpdate:visible":Y[2]||(Y[2]=te=>g.value=te),onClose:Y[3]||(Y[3]=()=>{g.value=!1})},null,8,["visible"])):d.createCommentVNode("",!0),d.createVNode(uo,{ref_key:"LeitingPositionRef",ref:me,visible:A.value,"full-height":G.adjustModel,"onUpdate:visible":Y[4]||(Y[4]=te=>A.value=te)},null,8,["visible","full-height"]),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(fo,{key:2,visible:v.value,"full-height":G.setting,"tianditu-token":u.tiandituToken,"initial-config":l.value,"onUpdate:visible":Y[5]||(Y[5]=te=>v.value=te)},null,8,["visible","full-height","tianditu-token","initial-config"])),d.unref(h)?(d.openBlock(),d.createBlock(_m,{key:3,visible:v.value,"onUpdate:visible":Y[6]||(Y[6]=te=>v.value=te),onClose:Y[7]||(Y[7]=()=>{v.value=!1,de.value=de.value.filter(te=>te!=="setting")})},null,8,["visible"])):d.createCommentVNode("",!0),i.showTree!==!1&&!d.unref(h)?(d.openBlock(),d.createBlock(Or,d.mergeProps({key:4},{...p,...i.treeProps},{visible:f.value,"full-height":G.tree,"tree-data":V.value.length>0?V.value:i.treeProps?.treeData||[],"onUpdate:visible":Y[8]||(Y[8]=te=>{f.value=te})}),null,16,["visible","full-height","tree-data"])):d.createCommentVNode("",!0),i.showTree!==!1&&d.unref(h)?(d.openBlock(),d.createBlock(Bm,{key:5,visible:f.value,"tree-data":V.value.length>0?V.value:i.treeProps?.treeData||[],"onUpdate:visible":Y[9]||(Y[9]=te=>{f.value=te}),onClose:Y[10]||(Y[10]=()=>{f.value=!1})},null,8,["visible","tree-data"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(cN,{key:6,visible:x.value,"onUpdate:visible":Y[11]||(Y[11]=te=>x.value=te)},null,8,["visible"])),d.unref(h)?(d.openBlock(),d.createBlock(Q8,{key:7,visible:x.value,"onUpdate:visible":Y[12]||(Y[12]=te=>x.value=te)},null,8,["visible"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(BN,{key:8,visible:I.value,"onUpdate:visible":Y[13]||(Y[13]=te=>I.value=te)},null,8,["visible"])),d.unref(h)?(d.openBlock(),d.createBlock(Pm,{key:9,visible:I.value,"default-tool":S.value,"onUpdate:visible":Y[14]||(Y[14]=te=>{I.value=te,te||(S.value=null)}),onClose:Y[15]||(Y[15]=()=>{I.value=!1,S.value=null})},null,8,["visible","default-tool"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(lo,{key:10,visible:m.value,"full-height":G.section,"onUpdate:visible":Y[16]||(Y[16]=te=>m.value=te)},null,8,["visible","full-height"])),d.unref(h)?(d.openBlock(),d.createBlock(km,{key:11,visible:m.value,"onUpdate:visible":Y[17]||(Y[17]=te=>m.value=te),onClose:Y[18]||(Y[18]=()=>{m.value=!1})},null,8,["visible"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(co,{key:12,visible:y.value,"full-height":G.roam,"onUpdate:visible":Y[19]||(Y[19]=te=>y.value=te)},null,8,["visible","full-height"])),d.unref(h)?(d.openBlock(),d.createBlock(Dm,{key:13,visible:y.value,"onUpdate:visible":Y[20]||(Y[20]=te=>y.value=te),onClose:Y[21]||(Y[21]=()=>{y.value=!1})},null,8,["visible"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(Jk,{key:14,visible:C.value,"current-model-id":P.value,"onUpdate:visible":Y[22]||(Y[22]=te=>C.value=te),onHandleCloseCardByCadCard:Y[23]||(Y[23]=()=>{C.value=!1})},null,8,["visible","current-model-id"])),d.unref(h)?(d.openBlock(),d.createBlock(k8,{key:15,visible:C.value,"current-model-id":P.value,"onUpdate:visible":Y[24]||(Y[24]=te=>C.value=te),onHandleCloseCardByCadCard:Y[25]||(Y[25]=()=>{C.value=!1})},null,8,["visible","current-model-id"])):d.createCommentVNode("",!0),d.createVNode(YP,{ref_key:"cadPositionRef",ref:F,visible:w.value,"onUpdate:visible":Y[26]||(Y[26]=te=>w.value=te),onSave:vt},null,8,["visible"]),d.createVNode(eN,{visible:M.value,"onUpdate:visible":Y[27]||(Y[27]=te=>M.value=te)},null,8,["visible"]),d.createVNode(DN,{visible:d.unref(R),position:d.unref(b),items:d.unref(B),"onUpdate:visible":Y[28]||(Y[28]=te=>R.value=te)},null,8,["visible","position","items"]),d.renderSlot(j.$slots,"default",d.normalizeProps(d.guardReactiveProps({methods:_.value,isReady:r.value})),void 0,!0)],512)],8,["to","disabled"]))],512)],34))}}),[["__scopeId","data-v-23352a4a"]]);function H8(i,e={}){const{tapDelay:t=300,doubleTapDelay:n=300,moveThreshold:s=10}=e;let o=0,r={x:0,y:0},a=0,l=0,c=null;const h=[],u=[],p=[],f={},m=b=>{const B=b.touches[0]||b.changedTouches[0];return{x:B?.clientX??0,y:B?.clientY??0}},y=b=>{const B=m(b);o=Date.now(),r=B,a=0,p.forEach(({handler:L,delay:O})=>{c=window.setTimeout(()=>{L(b),c=null},O)})},g=b=>{const B=m(b),L=B.x-r.x,O=B.y-r.y;a=Math.sqrt(L*L+O*O),c&&a>s&&(clearTimeout(c),c=null)},A=b=>{const B=Date.now()-o,L=m(b),O=L.x-r.x,N=L.y-r.y;c&&(clearTimeout(c),c=null);const D=B<t&&a<s;if(D&&Date.now()-l<n&&a<s?(u.forEach(P=>P(b)),l=0):D&&(h.forEach(P=>P(b)),l=Date.now()),a>50){const P=Math.abs(O),F=Math.abs(N);P>F?O>0&&f.right?f.right(b):O<0&&f.left&&f.left(b):N>0&&f.down?f.down(b):N<0&&f.up&&f.up(b)}},v=b=>{h.push(b)},C=b=>{u.push(b)},w=(b,B=500)=>{p.push({handler:b,delay:B})},M=b=>{f.left=b},x=b=>{f.right=b},I=b=>{f.up=b},S=b=>{f.down=b},R=()=>{c&&(clearTimeout(c),c=null),h.length=0,u.length=0,p.length=0,Object.keys(f).forEach(b=>{delete f[b]})};return d.onMounted(()=>{const b=i.value;b&&(b.addEventListener("touchstart",y,{passive:!1}),b.addEventListener("touchmove",g,{passive:!1}),b.addEventListener("touchend",A,{passive:!1}))}),d.onUnmounted(()=>{R();const b=i.value;b&&(b.removeEventListener("touchstart",y),b.removeEventListener("touchmove",g),b.removeEventListener("touchend",A))}),{onTap:v,onDoubleTap:C,onLongPress:w,onSwipeLeft:M,onSwipeRight:x,onSwipeUp:I,onSwipeDown:S,destroy:R}}function Y8(i){const e=t=>{t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLSelectElement||t.preventDefault()};return i.addEventListener("touchmove",e,{passive:!1}),()=>{i.removeEventListener("touchmove",e)}}function $8(){let i=0;const e=t=>{const n=Date.now();n-i<=300&&t.preventDefault(),i=n};return document.addEventListener("touchend",e,{passive:!1}),document.addEventListener("gesturestart",t=>t.preventDefault()),document.addEventListener("gesturechange",t=>t.preventDefault()),()=>{document.removeEventListener("touchend",e)}}function j8(i,e={}){const{delay:t=500,moveThreshold:n=10}=e,s=d.ref(!1);let o=null,r={x:0,y:0},a=!1;const l=f=>{if(f.touches.length!==1)return;f.preventDefault(),a=!0,s.value=!1;const m=f.touches[0];r={x:m?.clientX??0,y:m?.clientY??0},o=window.setTimeout(()=>{a&&(s.value=!0,i())},t)},c=f=>{if(!a||o===null)return;const m=f.touches[0],y=(m?.clientX??0)-r.x,g=(m?.clientY??0)-r.y;Math.sqrt(y*y+g*g)>n&&u()},h=()=>{a=!1,s.value=!1,o!==null&&(clearTimeout(o),o=null)},u=()=>{a=!1,s.value=!1,o!==null&&(clearTimeout(o),o=null)};return{isLongPressing:s,handlers:{onTouchStart:l,onTouchMove:c,onTouchEnd:h},start:l,end:h,cancel:u}}function W8(i,e,t={}){const{delay:n=500,moveThreshold:s=10}=t;let o=null,r={x:0,y:0};const a=h=>{if(h.touches.length!==1)return;h.preventDefault();const u=h.touches[0];r={x:u?.clientX??0,y:u?.clientY??0},o=window.setTimeout(()=>{e()},n)},l=h=>{if(o===null)return;const u=h.touches[0],p=(u?.clientX??0)-r.x,f=(u?.clientY??0)-r.y;Math.sqrt(p*p+f*f)>s&&(clearTimeout(o),o=null)},c=()=>{o!==null&&(clearTimeout(o),o=null)};return i.addEventListener("touchstart",a,{passive:!1}),i.addEventListener("touchmove",l,{passive:!1}),i.addEventListener("touchend",c),i.addEventListener("touchcancel",c),()=>{o!==null&&(clearTimeout(o),o=null),i.removeEventListener("touchstart",a),i.removeEventListener("touchmove",l),i.removeEventListener("touchend",c),i.removeEventListener("touchcancel",c)}}const q8={tapThreshold:10,doubleTapInterval:300,longPressDelay:500,panThreshold:20,pinchThreshold:.02};function K8(i={}){const e={...q8,...i},t=d.reactive({type:"none",startX:0,startY:0,currentX:0,currentY:0,deltaX:0,deltaY:0,scale:1,rotation:0,velocityX:0,velocityY:0,duration:0}),n=d.ref(!1),s=d.ref(!1),o=d.ref(!1);let r=0,a=0,l=null,c=0,h=1,u=0,p=null;const f={onTap:[],onDoubleTap:[],onLongPress:[],onPanStart:[],onPanMove:[],onPanEnd:[],onPinchStart:[],onPinchMove:[],onPinchEnd:[],onRotate:[]},m=N=>{if(N.length<2)return 0;const D=N[1].clientX-N[0].clientX,E=N[1].clientY-N[0].clientY;return Math.sqrt(D*D+E*E)},y=N=>N.length<2?0:Math.atan2(N[1].clientY-N[0].clientY,N[1].clientX-N[0].clientX)*(180/Math.PI);return{state:t,isActive:n,isPanning:s,isPinching:o,handlers:{onTouchStart:N=>{if(N.touches.length===1){const D=N.touches[0];p=D.identifier,r=Date.now(),t.startX=D.clientX,t.startY=D.clientY,t.currentX=D.clientX,t.currentY=D.clientY,t.deltaX=0,t.deltaY=0,n.value=!0,l=window.setTimeout(()=>{t.type="long-press",f.onLongPress.forEach(E=>E(N))},e.longPressDelay)}else N.touches.length===2&&(l&&(clearTimeout(l),l=null),o.value=!0,c=m(N.touches),h=1,u=y(N.touches),f.onPinchStart.forEach(D=>D(N)))},onTouchMove:N=>{if(N.touches.length===1&&p!==null){let D=null;for(let F=0;F<N.touches.length;F++)if(N.touches[F].identifier===p){D=N.touches[F];break}if(!D)return;const E=D.clientX-t.startX,T=D.clientY-t.startY;Math.sqrt(E*E+T*T)>e.panThreshold&&!s.value&&(s.value=!0,t.type="pan",l&&(clearTimeout(l),l=null),f.onPanStart.forEach(F=>F(N))),s.value&&(N.preventDefault(),t.deltaX=D.clientX-t.currentX,t.deltaY=D.clientY-t.currentY,t.currentX=D.clientX,t.currentY=D.clientY,t.velocityX=t.deltaX,t.velocityY=t.deltaY,f.onPanMove.forEach(F=>F(N)))}else if(N.touches.length===2&&o.value){N.preventDefault();const D=m(N.touches),E=y(N.touches),T=D/c;t.scale=h*T,t.rotation=E-u,f.onPinchMove.forEach(P=>P(N)),f.onRotate.forEach(P=>P(N))}},onTouchEnd:N=>{if(t.duration=Date.now()-r,l&&(clearTimeout(l),l=null),N.touches.length===0){if(s.value)t.type="pan",f.onPanEnd.forEach(D=>D(N));else if(o.value)f.onPinchEnd.forEach(D=>D(N));else if(t.type==="none"&&t.duration<300){const D=Date.now();D-a<e.doubleTapInterval?(t.type="double-tap",f.onDoubleTap.forEach(E=>E(N)),a=0):(t.type="tap",f.onTap.forEach(E=>E(N)),a=D)}s.value=!1,o.value=!1,n.value=!1,p=null,setTimeout(()=>{t.type="none",t.deltaX=0,t.deltaY=0,t.scale=1,t.rotation=0},50)}}},onTap:N=>{f.onTap.push(N)},onDoubleTap:N=>{f.onDoubleTap.push(N)},onLongPress:N=>{f.onLongPress.push(N)},onPanStart:N=>{f.onPanStart.push(N)},onPanMove:N=>{f.onPanMove.push(N)},onPanEnd:N=>{f.onPanEnd.push(N)},onPinchStart:N=>{f.onPinchStart.push(N)},onPinchMove:N=>{f.onPinchMove.push(N)},onPinchEnd:N=>{f.onPinchEnd.push(N)},onRotate:N=>{f.onRotate.push(N)}}}const qr={enableFpsLimit:!0,targetFps:30,enableResolutionScale:!0,resolutionScale:.75,enableLazyLoad:!0,lazyLoadDelay:200,enableModelLod:!0,modelQualityLevel:"medium",enablePostProcessing:!1,enableFxaa:!1,enableAmbientOcclusion:!1,enableShadows:!1,maxTextureSize:1024,enableDebounce:!0,debounceDelay:100};function X8(i={}){const e={...qr,...i};return{requestRenderMode:e.enableFpsLimit,maximumRenderTimeChange:e.enableFpsLimit?1e3/e.targetFps:void 0,scene3DOnly:!0,shouldAnimate:!0}}function J8(i={}){const e={...qr,...i};return{resolutionScale:e.enableResolutionScale?e.resolutionScale:1,targetFrameRate:e.enableFpsLimit?e.targetFps:void 0,sceneModePicker:!1,navigationHelpButton:!1,animation:!1,timeline:!1,fullscreenButton:!1,vrButton:!1,infoBox:!1,selectionIndicator:!1,shadows:e.enableShadows,skyAtmosphere:e.enablePostProcessing,fog:e.enablePostProcessing}}function Z8(i={}){const e={...qr,...i},n={low:{maximumScreenSpaceError:64,skipScreenSpaceErrorFactor:256,skipLevels:8,baseScreenSpaceError:2048},medium:{maximumScreenSpaceError:48,skipScreenSpaceErrorFactor:128,skipLevels:5,baseScreenSpaceError:1024},high:{maximumScreenSpaceError:32,skipScreenSpaceErrorFactor:64,skipLevels:3,baseScreenSpaceError:512}}[e.modelQualityLevel];return{cullWithChildrenBounds:!0,cullRequestsWhileMoving:!0,cullRequestsWhileMovingMultiplier:10,backFaceCulling:!0,colorBlendAmount:0,minimumPixelSize:128,maximumScreenSpaceError:n.maximumScreenSpaceError,skipLevelOfDetail:e.enableModelLod,baseScreenSpaceError:n.baseScreenSpaceError,skipScreenSpaceErrorFactor:n.skipScreenSpaceErrorFactor,skipLevels:n.skipLevels,immediatelyLoadDesiredLevelOfDetail:!1,loadSiblings:!1,maximumMemoryUsage:4096*5,preloadWhenHidden:!0,preferLeaves:e.enableModelLod,progressiveResolutionHeightFraction:.5,dynamicScreenSpaceErrorDensity:.002,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorHeightFalloff:.25,foveatedConeSize:0,foveatedTimeDelay:10,foveatedMinimumScreenSpaceErrorRelaxation:0}}function eR(i=30){const e=d.ref(60),t=d.ref(!1);let n=0,s=0,o=0;const r=1e3/i,a=()=>{t.value=!0,n=performance.now(),o=n,s=0},l=()=>{if(!t.value)return!0;const h=performance.now(),u=h-n;return s++,h-o>=1e3&&(e.value=Math.round(s*1e3/(h-o)),s=0,o=h),u>=r?(n=h-u%r,!0):!1},c=()=>{t.value=!1};return d.onUnmounted(()=>{c()}),{fps:e,isControlling:t,startControl:a,stopControl:c,tick:l}}function tR(i,e){let t=null;const n=((...s)=>{t!==null&&clearTimeout(t),t=window.setTimeout(()=>{i(...s),t=null},e)});return n.cancel=()=>{t!==null&&(clearTimeout(t),t=null)},n}function iR(i,e){let t=!1;return((...s)=>{t||(i(...s),t=!0,setTimeout(()=>{t=!1},e))})}function nR(i,e=200){let t=null;const n=()=>{t!==null&&clearTimeout(t),t=window.setTimeout(()=>{i(),t=null},e)},s=()=>{t!==null&&(clearTimeout(t),t=null)};return d.onUnmounted(()=>{s()}),{load:n,cancel:s}}function Lm(i){const e=d.ref(),t=d.ref(i.theme||"dark"),n=d.ref(i.menuSize||"medium");d.provide("leiting-theme",t),d.provide("leiting-menu-size",n);function s(a){d.onUnmounted(()=>{e.value=null}),a(i,e)}function o(){const a=d.unref(e);return a||console.error("未获取到leiting实例!"),a}const r=new Proxy({},{get(a,l){const c=o();if(!c)return;const h=c[l];return typeof h=="function"?h.bind(c):h},set(a,l,c){const h=o();return h?(h[l]=c,!0):!1}});return[s,r]}const sR=bn,oR={install:(i,e)=>{if(i.component("LeitingBIM",Wr),i.component("LeitingTree",Or),i.component("LeitingDraggableCard",gt),i.component("leiting-draggable-card",gt),i.component("LeitingMenu",ao),i.component("leiting-menu",ao),i.component("LeitingSection",lo),i.component("leiting-section",lo),i.component("LeitingPlayer",co),i.component("leiting-player",co),i.component("LeitingInfo",ho),i.component("leiting-info",ho),i.component("LeitingPosition",uo),i.component("leiting-position",uo),i.component("LeitingSetting",fo),i.component("leiting-setting",fo),!e)return;const t={...sR,...e};t.cesiumUrl&&Ua(t).catch(n=>{console.error("[LeitingBim] Failed to load Cesium resources:",n)}),i.config.globalProperties.$leitingBimOptions=t}};function rR(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=i:s.appendChild(document.createTextNode(i))}}var aR="@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:100% 0}75%{background-position:0 100%}to{background-position:0 0}}@keyframes watermark-horizontal{0%{background-position-x:0}to{background-position-x:100%}}@keyframes watermark-vertical{0%{background-position-y:0}to{background-position-y:100%}}";rR(aR);var vc=function(i,e){return vc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])},vc(i,e)};function lR(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");vc(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Fi=function(){return Fi=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Fi.apply(this,arguments)};function pi(i,e,t,n){function s(o){return o instanceof t?o:new t(function(r){r(o)})}return new(t||(t=Promise))(function(o,r){function a(h){try{c(n.next(h))}catch(u){r(u)}}function l(h){try{c(n.throw(h))}catch(u){r(u)}}function c(h){h.done?o(h.value):s(h.value).then(a,l)}c((n=n.apply(i,e||[])).next())})}function ti(i,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,r=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return r.next=a(0),r.throw=a(1),r.return=a(2),typeof Symbol=="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(c){return function(h){return l([c,h])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,c[0]&&(t=0)),t;)try{if(n=1,s&&(o=c[0]&2?s.return:c[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,c[1])).done)return o;switch(s=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,s=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1],o=c;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(c);break}o[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(i,t)}catch(h){c=[6,h],s=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var Rm=function(i){return i.toDataURL("image/png",1)},Fm=function(i){return typeof i=="function"},Ht=function(i){return i===void 0},cR=function(i){return typeof i=="string"},Om=function(i,e,t){e===void 0&&(e={}),t===void 0&&(t="http://www.w3.org/2000/svg");var n=document.createElementNS(t,i);for(var s in e)n.setAttribute(s,e[s]);return n},dR=function(i,e,t){for(var n=[],s="",o="",r=0,a=e.length;r<a;r++){if(o=e.charAt(r),o===`
|
|
121
|
+
`});p.isModelAdjustment=!0,u.customShader=p}else e.brightness!==void 0&&e.brightness!==1&&!u.style&&(u.style=new n.Cesium3DTileStyle({color:`color('white') * ${e.brightness}`}))}}setModelBrightness(e){this.setModelColorAdjustment({brightness:e})}_defaultSkyBox=null;_updateLightDirection=e=>{e.light instanceof this.cesium.DirectionalLight&&(e.light.direction=e.camera.directionWC)};setEnvironmentMapEnable(e){this.is2d||(e?(this.viewer.scene.light=new this.cesium.DirectionalLight({direction:this.viewer.scene.camera.directionWC}),this.viewer.scene.preRender.addEventListener(this._updateLightDirection)):(this._defaultSkyBox&&(this.viewer.scene.skyBox=this._defaultSkyBox),this.viewer.scene.preRender.removeEventListener(this._updateLightDirection),this.viewer.scene.light=new this.cesium.SunLight),this.viewer.scene.imageBasedLighting&&(this.viewer.scene.imageBasedLighting.imageBasedLightingFactor=e?new this.cesium.Cartesian2(2,2):new this.cesium.Cartesian2(1,1)))}setAmbientOcclusion(e){if(this.is2d)return;const t=this.viewer.scene;if(!t||!t.postProcessStages||!t.postProcessStages.ambientOcclusion)return;const n=t.postProcessStages.ambientOcclusion;n.enabled=e,e&&(n.uniforms.ambientOcclusionOnly=!1,n.uniforms.intensity=3,n.uniforms.bias=.1,n.uniforms.lengthCap=.03,n.uniforms.stepSize=1,n.uniforms.blurStepSize=.86)}setCollisionDetection(e){if(this.is2d){this.viewer.scene.screenSpaceCameraController.enableCollisionDetection=!1;return}const t=this.viewer.scene.screenSpaceCameraController;t.enableCollisionDetection=e,e||t.minimumZoomDistance<1&&(t.minimumZoomDistance=1)}_customZoomHandler=null;setHeightBasedZoom(e){const t=this.viewer.scene.screenSpaceCameraController,n=this.cesium;if(this.viewer.camera.frustum.near=1e-4,this.viewer.camera.frustum.far=1e8,e||(this.viewer.camera.frustum.near=.1),this._customZoomHandler&&(this._customZoomHandler.destroy(),this._customZoomHandler=null),!e){t.zoomEventTypes.includes(n.CameraEventType.WHEEL)||t.zoomEventTypes.push(n.CameraEventType.WHEEL);return}t.zoomEventTypes=t.zoomEventTypes.filter(o=>o!==n.CameraEventType.WHEEL),this._customZoomHandler=new n.ScreenSpaceEventHandler(this.viewer.scene.canvas);let s=null;this._customZoomHandler.setInputAction(o=>{s=o.endPosition},n.ScreenSpaceEventType.MOUSE_MOVE),this._customZoomHandler.setInputAction(o=>{const r=this.viewer.camera,a=r.positionCartographic.height,l=Math.sign(o);if(a<.15&&l>0){pe.info("无法继续放大");return}const c=.3;let h=0;if(l>0){const m=a-1;h=m>0?m*c:0}else h=a*c;h=Math.max(.1,h),console.log(a);let u=null;if(!s)u=r.direction;else{const m=r.getPickRay(s);if(m){let y=this.viewer.scene.pickPosition(s);if(!y){const g=n.IntersectionTests.rayEllipsoid(m,this.viewer.scene.globe.ellipsoid);g&&(y=n.Ray.getPoint(m,g.start))}if(y){const g=n.Cartesian3.subtract(y,r.position,new n.Cartesian3);u=n.Cartesian3.normalize(g,new n.Cartesian3)}else u=r.direction}else u=r.direction}const p=l>0?h:-h*2,f=n.Cartesian3.multiplyByScalar(u,p,new n.Cartesian3);r.position=n.Cartesian3.add(r.position,f,new n.Cartesian3)},n.ScreenSpaceEventType.WHEEL)}setMouseHabit(e){if(this.is2d)return;const t=this.viewer.scene.screenSpaceCameraController;t.enableTranslate=!0,t.enableRotate=!0,t.enableZoom=!0,t.enableTilt=!0,t.enableLook=!1,t.lookEventTypes=[],e===1?(t.rotateEventTypes=[this.cesium.CameraEventType.RIGHT_DRAG],t.zoomEventTypes=[this.cesium.CameraEventType.MIDDLE_DRAG,this.cesium.CameraEventType.WHEEL,this.cesium.CameraEventType.PINCH],t.tiltEventTypes=[this.cesium.CameraEventType.PINCH,this.cesium.CameraEventType.LEFT_DRAG]):(t.rotateEventTypes=[this.cesium.CameraEventType.LEFT_DRAG],t.zoomEventTypes=[this.cesium.CameraEventType.RIGHT_DRAG,this.cesium.CameraEventType.WHEEL,this.cesium.CameraEventType.PINCH],t.tiltEventTypes=[this.cesium.CameraEventType.PINCH,this.cesium.CameraEventType.MIDDLE_DRAG])}}class bB{cesium;viewer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}getCameraView(){const e=this.viewer.camera;return{position:{x:e.position.x,y:e.position.y,z:e.position.z},destination:{x:e.position.x,y:e.position.y,z:e.position.z},orientation:{heading:e.heading,pitch:e.pitch,roll:e.roll},duration:1}}flyToCameraView(e){const{position:t,orientation:n,duration:s}=e,o=new this.cesium.Cartesian3(t.x,t.y,t.z),r=new this.cesium.HeadingPitchRoll(n.heading,n.pitch,n.roll);!s||s<=0?this.viewer.camera.setView({destination:o,orientation:r}):this.viewer.camera.flyTo({destination:o,orientation:r,duration:s})}getCurrentCameraPositionAndTarget(){const e=this.getCameraView();return{position:e.position,target:{heading:e.orientation.heading,pitch:e.orientation.pitch,roll:e.orientation.roll},duration:e.duration}}setCameraView(e){const t=e.target||e.orientation||{},n=e.destination||e.position||{};this.flyToCameraView({position:{x:Number(n.x),y:Number(n.y),z:Number(n.z)},destination:{x:Number(n.x),y:Number(n.y),z:Number(n.z)},orientation:{heading:Number(t.heading||0),pitch:Number(t.pitch||0),roll:Number(t.roll||0)},duration:e.duration})}flyToLonLatHeight(e,t,n,s=1){const o=this.cesium.Cartesian3.fromDegrees(e,t,n),r={heading:this.cesium.Math.toRadians(0),pitch:this.cesium.Math.toRadians(-90),roll:0};!s||s<=0?this.viewer.camera.setView({destination:o,orientation:r}):this.viewer.camera.flyTo({destination:o,orientation:r,duration:s})}}function CB(i){const{container:e,appContext:t,methods:n,viewerOptions:s,options:o,callbacks:r}=i,a=new _s,l=window.Cesium;if(!l)throw new Error("Cesium is not loaded");e.id=`cesium-container-${cw()}`;const c={animation:!1,timeline:!1,infoBox:!1,homeButton:!1,fullscreenButton:!1,sceneModePicker:!1,navigationHelpButton:!1,geocoder:!1,baseLayerPicker:!1,selectionIndicator:!1,heightBasedZoom:!0,creditContainer:document.createElement("div"),contextOptions:{webgl:{alpha:!0,preserveDrawingBuffer:!0}}},h=t?.config?.globalProperties?.$leitingBimOptions,u={...c,...h?.viewerOptions??{},...s??{}},p=new l.Viewer(e,u);p.camera.setView({destination:l.Cartesian3.fromDegrees(108,32,1e7),orientation:{heading:l.Math.toRadians(0),pitch:l.Math.toRadians(-90),roll:0}});let f=n;if(!f&&h&&(h.methods||(h.methods={}),f=h.methods),f){const m=new Ew({cesium:l,viewer:p,options:o,callbacks:r}),y=new ju({cesium:l,viewer:p}),g=new vB({cesium:l,viewer:p}),A=new xw({cesium:l,viewer:p}),v=new TS({cesium:l,viewer:p}),C=o?.watermark!==!1;y.watermarkEnabled=C,v.watermarkEnabled=C;const w=new bB({cesium:l,viewer:p});let M;const x=new uc({cesium:l,viewer:p});o&&(o.globe!==void 0&&g.setGlobeEnvironmentVisible(o.globe),o.terrain!==void 0&&g.setTerrainEnable(o.terrain),o.depthTest!==void 0&&g.setDepthTestEnable(o.depthTest),o.mapProvider&&o.mode!=="2d"&&g.changeBaseMap(o.mapProvider,{token:o.tiandituToken,layerType:o.tiandituLayerType,showAnnotation:o.tiandituShowLabel,url:o.arcgisUrl}),o.shadows!==void 0&&g.setShadowsEnable(o.shadows),o.environmentMap!==void 0&&g.setEnvironmentMapEnable(o.environmentMap),o.ambientOcclusion!==void 0&&g.setAmbientOcclusion(o.ambientOcclusion),o.time!==void 0&&g.setTime(o.time),o.brightness!==void 0&&g.setModelBrightness(o.brightness),o.backgroundColor!==void 0&&g.setBackgroundColor(o.backgroundColor),o.collision!==void 0&&g.setCollisionDetection(o.collision),o.mouseHabit!==void 0&&g.setMouseHabit(o.mouseHabit),o.heightBasedZoom!==void 0&&g.setHeightBasedZoom(o.heightBasedZoom)),o&&o.mode==="2d"&&(console.log("InitMap: Setting CAD Mode 2D"),g.setCadMode("2d"),M=new dm({cesium:l,viewer:p})),y.events.on("tilesetLoaded",b=>{m.baseCompt.attachTileset(b,m.baseCompt.selectedColor),m.baseSection.attachTileset(b,b.leiting?.model?.modelId),f&&f.tilesLoad3dTiles&&f.tilesLoad3dTiles(b),o?.tilesLoad3dTiles&&o.tilesLoad3dTiles(b.leiting)}),y.events.on("loadingStatus",b=>{f&&f.onLoadingStatus&&f.onLoadingStatus(b)}),y.events.on("mountAll3Dtiles",({modelList:b})=>{o?.mountAll3Dtiles&&o.mountAll3Dtiles(b),f?.mountAll3Dtiles&&f.mountAll3Dtiles(b)}),y.events.on("configureLoaded",b=>{f.setConfigure(b)}),y.events.on("updateModels",({modelList:b})=>{o?.updateModels&&o.updateModels(b),f?.updateModels&&f.updateModels(b)}),A.events.on("mountAllCad",b=>{o?.mountAllCad&&o.mountAllCad(b),f?.mountAllCad&&f.mountAllCad(b)}),v.events.on("mountAllGISCad",b=>{o?.mountAllGISCad&&o.mountAllGISCad(b),f?.mountAllGISCad&&f.mountAllGISCad(b)}),m.baseCompt.loadNodeDetailsForModel=b=>y.loadNodeDetailsForModel(b),m.baseCompt.selectionChange(b=>{b.length!==0&&(o?.selectionChange&&o.selectionChange(b),f?.selectionChange&&f.selectionChange(b))}),f.onSearchComponent=b=>{o?.searchComponent&&o.searchComponent(b),f?.searchComponent&&f.searchComponent(b)};const I=f.saveRegion;f.saveRegion=b=>{o?.saveRegion&&o.saveRegion(b),I&&I!==o?.saveRegion&&I(b)};const S=f.saveCadCalibration;f.saveCadCalibration=b=>{o?.saveCadCalibration&&o.saveCadCalibration(b),S&&S!==o?.saveCadCalibration&&S(b)};const R=f.saveCadRegion;f.saveCadRegion=b=>{o?.saveCadRegion&&o.saveCadRegion(b),R&&R!==o?.saveCadRegion&&R(b)},f.getCesium=()=>l,f.getViewer=()=>p,f.getAnnotationInstance=()=>M,f.getMeasureInstance=()=>x,f.flyToCamera=b=>{w.setCameraView(b)},f.flyToLonLatHeight=(b,B,L,O=1)=>{w.flyToLonLatHeight(b,B,L,O)},f.flyTo=f.flyToCamera,f.getCameraState=()=>w.getCameraView(),f.getCameraInfo=f.getCameraState,f.restoreCameraState=b=>w.flyToCameraView(b),f.flyToCameraView=f.restoreCameraState,f.getCameraPositionTarget=()=>w.getCurrentCameraPositionAndTarget(),f.getCurrentCameraPositionAndTarget=f.getCameraPositionTarget,f.setCameraLookAt=b=>w.setCameraView(b),f.setCameraView=f.setCameraLookAt,f.setCanvasBackground=b=>g.setBackgroundColor(b),f.setBackgroundColor=f.setCanvasBackground,f.setAntiAliasing=b=>m.enableCesiumFXAA(b),f.enableCesiumFXAA=f.setAntiAliasing,f.setSceneVisibility=b=>m.setSceneOptions(b),f.setSceneOptions=f.setSceneVisibility,f.addDebugPoint=(b,B,L=0)=>{p.entities.add({position:l.Cartesian3.fromDegrees(b,B,L),point:{pixelSize:10,color:l.Color.RED}})},f.addPoint=f.addDebugPoint,f.toggleDebugLabels=()=>m.enableTestLabel(),f.enableTestLabel=f.toggleDebugLabels,f.captureScreenshot=()=>{const b=p.scene.canvas;return p.render(),b.toDataURL("image/png")},f.getImageBase64=f.captureScreenshot,f.captureDomScreenshot=(b,B)=>m.getSnapDomSImageBase64(b,B),f.getSnapDomSImageBase64=f.captureDomScreenshot,f.addModels=b=>y.addModels(b),f.add3DtilesModel=f.addModels,f.addObliquePhotography=b=>y.addOSGB(b),f.addOSGB=f.addObliquePhotography,f.adjustOSGBModelMatrix=b=>y.updateOSGBMatrix(b),f.updateOSGBMatrix=f.adjustOSGBModelMatrix,f.setModelVisibility=b=>y.showModels(b),f.showModels=f.setModelVisibility,f.showTileset=f.setModelVisibility,f.removeModels=b=>y.deleteModels(b),f.deleteModels=f.removeModels,f.clearAllModels=()=>{y.deleteAllModels(),a.emit("deleteAllModels")},f.deleteAllModelList=f.clearAllModels,f.deleteAllModels=f.clearAllModels,f.flyToModel=b=>y.flyToTileset(b),f.flyToTileset=f.flyToModel,f.flyToByModelId=f.flyToModel,f.setModelBrightness=b=>m.updateModelEffect(b),f.updateModelEffect=f.setModelBrightness,f.getAllTilesets=()=>y.getMapTileset(),f.getMapTileset=f.getAllTilesets,f.getCurrentModelId=()=>y.getBIMmodelId(),f.getBIMmodelId=f.getCurrentModelId,f.getLoadedModels=()=>y.getModelList(),f.getModelList=f.getLoadedModels,f.loadModelStructure=async b=>{const B=typeof b=="string"?b:b?.modelId;if(!B){console.warn("loadModelStructure: modelId is required");return}return await y.loadTreeForModel(B)},f.loadTreeForModel=f.loadModelStructure,f.loadModelDetails=async b=>{const B=typeof b=="string"?b:b?.modelId;if(!B){console.warn("loadModelDetails: modelId is required");return}return await y.loadNodeDetailsForModel(B)},f.loadNodeDetailsForModel=f.loadModelDetails,f._loadNodeDetailsForModel=async b=>{const B=typeof b=="string"?b:b?.modelId;if(!B){console.warn("loadModelDetails: modelId is required");return}return await y._loadNodeDetailsForModel(B)},f.setMapTileset=b=>y.setMapTileset(b),f.setCurrentModelId=b=>y.setBIMmodelId(b),f.setBIMmodelId=f.setCurrentModelId,f.setModelList=b=>y.setModelList(b),f.highlightComponents=(b,B={})=>m.baseCompt.setSelectColorUserModelCpt(b,B),f.setSelectColorUserModelCpt=f.highlightComponents,m.baseCompt.setLoadNodeDetailsCallback(b=>y.loadNodeDetailsForModel(b)),f.highlightAllComponents=(b,B)=>m.baseCompt.setAllSelectColorUserModelCpt(b,B),f.setAllSelectColorUserModelCpt=f.highlightAllComponents,f.setSelectColorUserModelCptByClear=(b,B)=>{m.baseCompt.clearAllHaveSelected(),m.baseCompt.setSelectColorUserModelCpt(b.selectCpts,B??{rank:0})},f.clearSelectColorUserModelCpt=()=>m.baseCompt.clearAllHaveSelected(),f.selectComponents=(b,B)=>{m.baseCompt.clearAllHaveSelected(),m.baseCompt.setSelectColorUserModelCpt(b,B??{rank:0})},f.setSelecteds=f.selectComponents,f.setSelectionColor=(b,B,L,O)=>m.baseCompt.setSelectedColorRgba(b,B,L,O),f.setSelectedColor=f.setSelectionColor,f.clearSelection=()=>m.baseCompt.clearAllHaveSelected(),f.clearAllHaveSelected=f.clearSelection,f.getSelectedComponents=b=>m.baseCompt.getSelected(b),f.getSelected=f.getSelectedComponents,f.setClickToHighlightEnabled=b=>{m.baseCompt.clickToHighlightEnabled=b},f.getClickToHighlightEnabled=()=>m.baseCompt.clickToHighlightEnabled,f.onSelectionChange=b=>{m.baseCompt.selectionChange(b)},f.selectionChange=f.onSelectionChange,f.flyToComponents=b=>m.baseCompt.flyToObjects(b),f.flyToObjects=f.flyToComponents,f.setConstructionData=async b=>{if(b&&Array.isArray(b)){const B=new Set;b.forEach(L=>{L.mergeCpts&&Array.isArray(L.mergeCpts)&&L.mergeCpts.forEach(O=>{O.modelId&&B.add(O.modelId)})}),B.size>0&&await Promise.all(Array.from(B).map(L=>f.loadNodeDetailsForModel(L)))}m.baseCompt.setAllConstructionProgressTracking(b)},f.setAllConstructionProgressTracking=f.setConstructionData,f.startConstructionSimulation=()=>m.baseCompt.enableConstructionProgressTracking(),f.enableAllConstructionProgressTracking=f.startConstructionSimulation,f.stopConstructionSimulation=()=>m.baseCompt.disableConstructionProgressTracking(),f.disableConstructionProgressTracking=f.stopConstructionSimulation,f.disableAllConstructionProgressTracking=f.stopConstructionSimulation,f.resetConstructionSimulation=()=>m.baseCompt.freshConstructionProgressTracking(),f.freshConstructionProgressTracking=f.resetConstructionSimulation,f.restartConstructionSimulation=()=>m.baseCompt.reStartAnimation(),f.reStartAnimation=f.restartConstructionSimulation,f.resumeFlyTo=()=>m.baseCompt.resumeFlyTo(),f.pauseConstructionSimulation=()=>m.baseCompt.pauseFlyTo(),f.pauseFlyTo=f.pauseConstructionSimulation,f.pauseAnimation=f.pauseConstructionSimulation,f.resumeConstructionSimulation=()=>m.baseCompt.resumeFlyTo(),f.resumeAnimation=f.resumeConstructionSimulation,f.setComponentsVisibility=async b=>await m.baseCompt.setComponentVisibility(b),f.setElementsListVisible=f.setComponentsVisibility,f.setAllComponentsVisibility=async b=>await m.baseCompt.setAllComponentsVisibility(b),f.setAllElementsVisible=f.setAllComponentsVisibility,f.isolateComponents=b=>m.baseCompt.isolateComponentVisibility(b),f.isolateComponentVisibility=f.isolateComponents,f.getComponentsByVisibility=b=>m.baseCompt._getComponentsByVisibility(b),f.getShowCpts=b=>m.baseCompt.getComponentsByVisibility(b),f.getElementsVisible=b=>m.baseCompt.getComponentsByVisibility(b),f.setComponentVisibility=f.setComponentsVisibility,f.enableSectioning=(b,B)=>m.baseSection.open(b,B),f.openSection=f.enableSectioning,f.disableSectioning=b=>m.baseSection.close(b),f.closeSection=f.disableSectioning,f.updateSectionBox=b=>m.baseSection.updateRange(b),f.updateSectionRange=f.updateSectionBox,f.getSectionBox=()=>m.baseSection.getRange(),f.getSectionRange=f.getSectionBox,f.fitSectionToModel=()=>m.baseSection.fitToModels(),f.fitToModels=f.fitSectionToModel,f.setSectionBoxVisibility=b=>m.baseSection.setBoxVisibility(b),f.startFirstPersonMode=()=>{m.baseCompt.disableSelection(),m.basePlayer.openPlayer()},f.openPlayer=f.startFirstPersonMode,f.startCameraRoam=()=>{m.baseCompt.disableSelection(),m.basePlayer.openCameraRoam()},f.stopFirstPersonMode=()=>{m.basePlayer.closePlayer(),m.baseCompt.enableSelection()},f.closePlayer=f.stopFirstPersonMode,f.setPlayerPosition=b=>m.basePlayer.setPersonPosition(b),f.setPersonPosition=f.setPlayerPosition,f.setPlayerDefaultPosition=()=>m.basePlayer.setDefaultPosition(),f.setWalkSpeed=b=>m.basePlayer.setSpeed({speed:b}),f.setPlayerSpeed=f.setWalkSpeed,f.setPlayerConfig=b=>m.basePlayer.setParams(b),f.setPlayerParams=f.setPlayerConfig,f.setPlayerAction=(b,B)=>m.basePlayer.setMoveState(b,B),f.setPlayerMoveState=f.setPlayerAction,f.bindPlayerControls=b=>m.basePlayer.bindUiKeys(b),f.bindPlayerUiKeys=f.bindPlayerControls,f.setGlobeVisibility=b=>g.setGlobeEnvironmentVisible(b),f.setGlobeEnvironmentVisible=f.setGlobeVisibility,f.setTerrainVisibility=b=>g.setTerrainEnable(b),f.setTerrainEnable=f.setTerrainVisibility,f.setDepthTest=b=>g.setDepthTestEnable(b),f.setDepthTestEnable=f.setDepthTest,f.setBaseMap=(b,B)=>g.changeBaseMap(b,B),f.changeBaseMap=f.setBaseMap,f.setWorldTime=b=>g.setTime(b),f.setTime=f.setWorldTime,f.setGisOptions=b=>{b.globe!==void 0&&g.setGlobeEnvironmentVisible(b.globe),b.elevation!==void 0&&g.setTerrainEnable(b.elevation),b.depthTestAgainstTerrain!==void 0&&g.setDepthTestEnable(b.depthTestAgainstTerrain),b.rendering!==void 0&&g.setAmbientOcclusion(b.rendering)},f.setShadowVisibility=b=>g.setShadowsEnable(b),f.setShadowsEnable=f.setShadowVisibility,f.setEnvironmentMapVisibility=b=>g.setEnvironmentMapEnable(b),f.setEnvironmentMapEnable=f.setEnvironmentMapVisibility,f.setAOVisibility=b=>g.setAmbientOcclusion(b),f.setAmbientOcclusion=f.setAOVisibility,f.setBackgroundColor=b=>g.setGlobeColor(b),f.setGlobeColor=f.setBackgroundColor,f.setModelBrightness=b=>g.setModelBrightness(b),f.adjustModelColor=b=>g.setModelColorAdjustment(b),f.setModelColorAdjustment=f.adjustModelColor,f.setShadowIntensity=b=>{g.setShadowDarkness?g.setShadowDarkness(b):console.warn("baseSetting.setShadowDarkness is not available. Please reload the page.")},f.setShadowDarkness=f.setShadowIntensity,f.switchSceneMode=async b=>{const B=b?"2d":"3d";await g.setCadMode(B),b&&!M&&(M=new dm({cesium:l,viewer:p}),f.setGlobeVisibility(!0)),a.emit("setMode",B)},f.setSceneMode=f.switchSceneMode,f.set2d=b=>f.switchSceneMode(b),f.is2dMode=()=>g.is2d,f.setMouseControlMode=b=>g.setMouseHabit(b),f.setMouseHabit=f.setMouseControlMode,f.setCollisionEnabled=b=>g.setCollisionDetection(b),f.setCollisionDetection=f.setCollisionEnabled,f.searchAndLocate=(b,B)=>g.searchLocation(b,B),f.searchLocation=f.searchAndLocate,f.getConfigure=()=>(console.warn("getConfigure is not initialized. Please ensure LeitingSetting component is mounted."),{}),f.setConfigure=b=>{console.warn("setConfigure is not initialized. Please ensure LeitingSetting component is mounted.",b)},f.addCadModel=b=>{const B={...b};return B.files&&!B.fileNames&&(B.fileNames=B.files),B.fileNames||(B.fileNames=[]),A.addDxfModel(B)},f.addDxfModel=f.addCadModel,f.addGISCadModel=b=>{const B={...b};return B.files&&!B.fileNames&&(B.fileNames=B.files),B.fileNames||(B.fileNames=[]),v.addGISCadModel(B)},f.addVectorTileByUrlTemplate=b=>v.addVectorTileByUrlTemplate(b),f.addVectorTileByTilesManifest=b=>v.addVectorTileByTilesManifest(b),f.showGISCadModel=b=>v.showJson(b),f.addGeoJsonLayer=b=>v.addGeoJsonLayer(b),f.showGISCadLayer=b=>v.showJsonByLayer(b),f.deleteGISCad=b=>v.deleteCad(b),f.deleteAllGISCad=()=>v.deleteAllCad(),f.flyToGISCadModel=(b={})=>v.flyToCadModel(b),f.flyGisCadModel=b=>v.flyToCadModel({modelId:b}),f.getGISCadModels=b=>v.getDxfModels(b),f.getGISCadModelsList=()=>v.getDxfModelsList(),f.getGISCadLayers=b=>v.getMapLayers(b),f.getGISCadModelId=()=>v.getModelId(),f.getDefaultGISCadTransformConfig=()=>v.getDefaultCoordinateTransformConfig(),f.transformGISCadCoordinate=b=>v.transformCoordinate(b),f.beginEditGISCad=b=>v.beginEditGISCad(b),f.adjustGISCadModel=b=>v.adjustGISCadModel(b),f.commitEditGISCad=b=>v.commitEditGISCad(b),f.cancelEditGISCad=b=>v.cancelEditGISCad(b),f.deleteCad=b=>A.deleteCad(b),f.deleteAllCad=()=>A.deleteAllCad(),f.showCadModel=b=>A.showJson(b),f.showGeoJson=b=>A.showJson(b),f.showDxfModel=f.showCadModel,f.showCadLayer=b=>A.showJsonByLayer(b),f.showDxfLayer=f.showCadLayer,f.flyToCadModel=(b={})=>A.flyToCadModel(b),f.getCadModels=b=>A.getDxfModels(b),f.getDxfModels=f.getCadModels,f.getCadLayers=b=>A.getMapLayers(b),f.getDxfLayers=f.getCadLayers,f.getCadModelId=()=>A.getModelId(),f.setCadOpen=b=>A.setDxfOpen(b),f.setDxfOpen=f.setCadOpen,f.getCadOpen=()=>A.getDxfOpen(),f.getDxfOpen=f.getCadOpen,f.adjustCadModel=b=>A.adjustingModelByCad(b),f.adjustingModelByCad=f.adjustCadModel,f.saveAnnotations=()=>{let b=null;return M&&(b=M.saveAnnotations()),o?.saveAnnotations&&o.saveAnnotations(b),b},f.loadAnnotations=b=>M?M.loadAnnotations(b):!1,f.flyToTopView=()=>{A.flyToCadModel()},f.menuEvents=a,f.addMenuItems=b=>{a.emit("insertMenu",b)},f.insertMenu=f.addMenuItems,f.filterMenuItems=b=>{a.emit("setMenuListFilter",b)},f.setMenuListFilter=f.filterMenuItems,f.setMenuVisibility=b=>{a.emit("showMenu",b)},f.showMenu=f.setMenuVisibility,f.setPanelVisibility=(b,B)=>{a.emit("setMenuActive",b,B)},f.setMenuActive=f.setPanelVisibility,f.addContextMenuItems=b=>{console.warn("addContextMenuItems is not initialized yet. Please wait for LeitingBIM component to mount.",b)},f.insertContextMenu=f.addContextMenuItems,f.removeContextMenuItems=b=>{console.warn("removeContextMenuItems is not initialized yet.",b)},f.deleteContextMenu=f.removeContextMenuItems,f.closeContextMenu=()=>{console.warn("closeContextMenu is not initialized yet.")},f.hideContextMenu=f.closeContextMenu,f.getModelTree=()=>{const b=[],B=y.getMapTileset();return Object.keys(B).forEach(L=>{const O=B[L];if(O&&O.leiting&&O.leiting.tree){const N=O.leiting.tree;Array.isArray(N)?b.push(...N):b.push(N)}}),b},f.getTree=f.getModelTree,f.getAllComponentDetails=()=>{const b=y.getMapTileset(),B={},L=[];try{Object.keys(b).forEach(O=>{const N=b[O];if(!N||!N.leiting)return;const D=N.leiting,E=D.node,T=D.model.formData,P=D.box;if(!E||!E.nodeExtras)return;const F=D.model.modelId;B[F]=E.nodeExtras;const V=E.nodeExtras.element;if(!V)return;const G=P?P.center:{x:0,y:0,z:0};Object.values(V).forEach(k=>{if(k.box3)try{const _=l.Quaternion.fromAxisAngle(l.Cartesian3.UNIT_Z,l.Math.toRadians(T.totalRotation||0)),U=l.Matrix4.fromRotationTranslation(l.Matrix3.fromQuaternion(_),new l.Cartesian3(0,0,0)),H=l.Cartesian3.fromDegrees(T.longitude,T.latitude,T.height),q=l.Transforms.eastNorthUpToFixedFrame(H);l.Matrix4.multiply(q,U,q);const X=new l.Cartesian3(G.x,G.y,0),de=new l.Cartesian3;l.Matrix4.multiplyByPoint(q,X,de);const fe=l.Cartographic.fromCartesian(de),me=k.box3?.Center?.x||0,be=k.box3?.Center?.y||0,_e=k.box3?.Center?.z||0,Je=new l.Cartesian3(-G.x+me,-G.y+be,0+_e),lt=l.Matrix4.fromTranslation(Je),ct=l.Matrix4.clone(lt);l.Matrix4.multiply(U,ct,ct);const Bt=l.Cartesian3.fromDegrees(fe.longitude/Math.PI*180,fe.latitude/Math.PI*180,T.height),vt=l.Transforms.eastNorthUpToFixedFrame(Bt);l.Matrix4.multiply(vt,ct,vt);const j=l.Cartographic.fromCartesian(new l.Cartesian3(vt[12],vt[13],vt[14]));k.box3.cartographic={longitude:j.longitude/Math.PI*180,latitude:j.latitude/Math.PI*180,height:j.height};const Y={id:k.uniqueId,billboard:[{theme:"Tag9999",position:[k.box3.cartographic.longitude,k.box3.cartographic.latitude,k.box3.cartographic.height],options:{text:k.name}}]};L.push(Y)}catch(_){console.warn("Error calculating component position:",_)}})})}catch(O){console.error("getAllComponents error:",O)}return B},f.getAllComponents=f.getAllComponentDetails,f.getComponentInfoList=async b=>{if(!Array.isArray(b))return[];const B=y.getMapTileset(),L=[],O=[],N={};b.forEach(E=>{const P=B[E.modelId]?.leiting?.model?.dbName;P&&E.elementId&&O.push({dbName:P,elementId:E.elementId,modelId:E.modelId})});const D=new Set;if(b.forEach(E=>{const T=B[E.modelId],P=`${E.modelId}_${E.elementId}`;N[P]||T&&T.leiting&&!T.leiting?.node?.nodeExtras&&T.leiting.model?.nodeUrl&&D.add(E.modelId)}),D.size>0&&y._loadNodeDetailsForModel)try{const E=Array.from(D).map(T=>y._loadNodeDetailsForModel(T));await Promise.all(E)}catch(E){console.error("Failed to load node details in getComponentInfoList",E)}try{b.forEach(E=>{const T=E.modelId,P=E.elementId,F=B[T];if(!F||!F.leiting)return;const V=`${T}_${P}`,G=N[V];let k=null;if(G)k=G;else{const _=F.leiting.node?.nodeExtras?.element||F.leiting.node?.nodeExtras;_&&_[P]&&(k=JSON.parse(JSON.stringify(_[P])))}if(k){if(k.elementId=P,k.modelId=T,k.box3&&!k.box3.cartographic)try{const _=F.leiting,U=_.model.formData,H=_.box,q=H?H.center:{x:0,y:0,z:0},X=l.Quaternion.fromAxisAngle(l.Cartesian3.UNIT_Z,l.Math.toRadians(U.totalRotation||0)),de=l.Matrix4.fromRotationTranslation(l.Matrix3.fromQuaternion(X),new l.Cartesian3(0,0,0)),fe=l.Cartesian3.fromDegrees(U.longitude,U.latitude,U.height),me=l.Transforms.eastNorthUpToFixedFrame(fe);l.Matrix4.multiply(me,de,me);const be=new l.Cartesian3(q.x,q.y,0),_e=new l.Cartesian3;l.Matrix4.multiplyByPoint(me,be,_e);const Je=l.Cartographic.fromCartesian(_e),lt=k.box3?.Center?.x||0,ct=k.box3?.Center?.y||0,Bt=k.box3?.Center?.z||0,vt=new l.Cartesian3(-q.x+lt,-q.y+ct,0+Bt),j=l.Matrix4.fromTranslation(vt),Y=l.Matrix4.clone(j);l.Matrix4.multiply(de,Y,Y);const te=l.Cartesian3.fromDegrees(Je.longitude/Math.PI*180,Je.latitude/Math.PI*180,U.height),ze=l.Transforms.eastNorthUpToFixedFrame(te);l.Matrix4.multiply(ze,Y,ze);const It=l.Cartographic.fromCartesian(new l.Cartesian3(ze[12],ze[13],ze[14]));k.box3.cartographic={longitude:It.longitude/Math.PI*180,latitude:It.latitude/Math.PI*180,height:It.height}}catch(_){console.warn("Error calculating component position:",_)}L.push(k)}})}catch(E){console.error("getComponentInfoList processing error:",E)}return L},f.getCptInfos=f.getComponentInfoList,f.baseCompt=m.baseCompt,f.setTeleportTarget=b=>{f.onSetTeleportTarget&&f.onSetTeleportTarget(b)},window.Methods=f}return console.log("methods",f),{Cesium:l,viewer:p,methods:f,menuEvents:a}}function mc(i){return d.getCurrentScope()?(d.onScopeDispose(i),!0):!1}function gc(i){return typeof i=="function"?i():d.unref(i)}const wB=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const EB=Object.prototype.toString,xB=i=>EB.call(i)==="[object Object]",IB=()=>{};function SB(i){return d.getCurrentInstance()}function fm(i,e=!0,t){SB()?d.onMounted(i,t):e?i():d.nextTick(i)}function ln(i){var e;const t=gc(i);return(e=t?.$el)!=null?e:t}const ro=wB?window:void 0;function MB(...i){let e,t,n,s;if(typeof i[0]=="string"||Array.isArray(i[0])?([t,n,s]=i,e=ro):[e,t,n,s]=i,!e)return IB;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const o=[],r=()=>{o.forEach(h=>h()),o.length=0},a=(h,u,p,f)=>(h.addEventListener(u,p,f),()=>h.removeEventListener(u,p,f)),l=d.watch(()=>[ln(e),gc(s)],([h,u])=>{if(r(),!h)return;const p=xB(u)?{...u}:u;o.push(...t.flatMap(f=>n.map(m=>a(h,f,m,p))))},{immediate:!0,flush:"post"}),c=()=>{l(),r()};return mc(c),c}function TB(){const i=d.ref(!1),e=d.getCurrentInstance();return e&&d.onMounted(()=>{i.value=!0},e),i}function pm(i){const e=TB();return d.computed(()=>(e.value,!!i()))}function mm(i,e={}){const{window:t=ro}=e,n=pm(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let s;const o=d.ref(!1),r=c=>{o.value=c.matches},a=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",r):s.removeListener(r))},l=d.watchEffect(()=>{n.value&&(a(),s=t.matchMedia(gc(i)),"addEventListener"in s?s.addEventListener("change",r):s.addListener(r),o.value=s.matches)});return mc(()=>{l(),a(),s=void 0}),o}function BB(i,e,t={}){const{window:n=ro,...s}=t;let o;const r=pm(()=>n&&"ResizeObserver"in n),a=()=>{o&&(o.disconnect(),o=void 0)},l=d.computed(()=>Array.isArray(i)?i.map(u=>ln(u)):[ln(i)]),c=d.watch(l,u=>{if(a(),r.value&&n){o=new ResizeObserver(e);for(const p of u)p&&o.observe(p,s)}},{immediate:!0,flush:"post"}),h=()=>{a(),c()};return mc(h),{isSupported:r,stop:h}}function _B(i,e={width:0,height:0},t={}){const{window:n=ro,box:s="content-box"}=t,o=d.computed(()=>{var u,p;return(p=(u=ln(i))==null?void 0:u.namespaceURI)==null?void 0:p.includes("svg")}),r=d.ref(e.width),a=d.ref(e.height),{stop:l}=BB(i,([u])=>{const p=s==="border-box"?u.borderBoxSize:s==="content-box"?u.contentBoxSize:u.devicePixelContentBoxSize;if(n&&o.value){const f=ln(i);if(f){const m=f.getBoundingClientRect();r.value=m.width,a.value=m.height}}else if(p){const f=Array.isArray(p)?p:[p];r.value=f.reduce((m,{inlineSize:y})=>m+y,0),a.value=f.reduce((m,{blockSize:y})=>m+y,0)}else r.value=u.contentRect.width,a.value=u.contentRect.height},t);fm(()=>{const u=ln(i);u&&(r.value="offsetWidth"in u?u.offsetWidth:e.width,a.value="offsetHeight"in u?u.offsetHeight:e.height)});const c=d.watch(()=>ln(i),u=>{r.value=u?e.width:0,a.value=u?e.height:0});function h(){l(),c()}return{width:r,height:a,stop:h}}function gm(i={}){const{window:e=ro,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:o=!0}=i,r=d.ref(t),a=d.ref(n),l=()=>{e&&(o?(r.value=e.innerWidth,a.value=e.innerHeight):(r.value=e.document.documentElement.clientWidth,a.value=e.document.documentElement.clientHeight))};if(l(),fm(l),MB("resize",l,{passive:!0}),s){const c=mm("(orientation: portrait)");d.watch(c,()=>l())}return{width:r,height:a}}function Fr(){const{width:i,height:e}=gm(),t=mm("(pointer: coarse)"),n=d.ref(!1),s=d.ref(!1),o=d.ref(!0),r=d.ref("other"),a=d.ref("other"),l=d.ref("medium"),c=d.ref("portrait"),h=()=>{const m=navigator.userAgent.toLowerCase(),y=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/i,g=navigator;if("userAgentData"in navigator&&g.userAgentData?.mobile!==void 0)return g.userAgentData.mobile||y.test(m);if(y.test(m))return!0;const A=/windows nt/i.test(m),v=/macintosh|mac os x/i.test(m)&&!/mobile/i.test(m),C=/linux/i.test(m)&&!/android/i.test(m);return!1},u=()=>{const m=navigator.userAgent.toLowerCase();n.value=h(),s.value=i.value>=768&&i.value<1024&&t.value,o.value=!n.value,/iphone|ipad|ipod/i.test(m)?r.value="ios":/android/i.test(m)?r.value="android":/win/i.test(m)?r.value="windows":/mac/i.test(m)?r.value="macos":/linux/i.test(m)&&(r.value="linux"),/safari/i.test(m)&&!/chrome/i.test(m)?a.value="safari":/chrome/i.test(m)?a.value="chrome":/firefox/i.test(m)?a.value="firefox":/edge/i.test(m)&&(a.value="edge"),i.value<576?l.value="small":i.value<1024?l.value="medium":l.value="large",c.value=i.value>e.value?"landscape":"portrait"},p=()=>{u()};d.onMounted(()=>{u(),window.addEventListener("resize",p),window.addEventListener("orientationchange",p)}),d.onUnmounted(()=>{window.removeEventListener("resize",p),window.removeEventListener("orientationchange",p)});const f=()=>({isMobile:n.value,isTablet:s.value,isDesktop:o.value,isTouchDevice:t.value,os:r.value,browser:a.value,screenSize:l.value,orientation:c.value});return{isMobile:d.readonly(n),isTablet:d.readonly(s),isDesktop:d.readonly(o),isTouchDevice:d.readonly(t),os:d.readonly(r),browser:d.readonly(a),screenSize:d.readonly(l),orientation:d.readonly(c),width:i,height:e,info:f}}const kB={class:"title"},PB={class:"actions"},DB={class:"card-body"},NB=d.defineComponent({__name:"LeitingDraggableCard",props:{visible:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},title:{type:String,default:"Title"},initialPosition:{type:Object,default:()=>({x:0,y:0})},width:{type:[Number,String],default:300},minWidth:{type:Number,default:200},fullHeight:{type:Boolean,default:!1},align:{type:String,default:""}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=d.inject("leiting-theme",d.ref("dark")),{isMobile:s}=Fr(),o=e,r=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:I=>{o("update:visible",I),o("update:open",I)}}),a=d.ref(null),l=d.ref(t.initialPosition?.x||0),c=d.ref(t.initialPosition?.y||0),h=d.ref(t.width),u=d.ref(t.fullHeight?"100%":"600px");d.watch(()=>t.fullHeight,I=>{I?u.value="100%":u.value==="100%"&&(u.value="600px")});const{height:p}=gm();d.watch(p,()=>{t.fullHeight&&(u.value="100%")});const f=d.ref(!1),m=I=>{f.value=!0,I.preventDefault(),I.stopPropagation();const S=I.clientX,R=I.clientY,b=typeof h.value=="number"?h.value:a.value?.offsetWidth||0,B=typeof u.value=="number"?u.value:a.value?.offsetHeight||0,L=N=>{if(!f.value)return;N.preventDefault();const D=N.clientX-S,E=N.clientY-R,T=b+D,P=B+E;T>100&&(h.value=T),P>100&&(u.value=P)},O=()=>{f.value=!1,document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",O)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",O)},y=d.computed(()=>({left:`${l.value}px`,top:`${c.value}px`,width:typeof h.value=="number"?`${h.value}px`:h.value,height:typeof u.value=="number"?`${u.value}px`:u.value,position:"absolute",zIndex:2e3})),g=()=>{d.nextTick(()=>{if(a.value){const I=a.value.offsetParent||document.body,S=I.clientWidth,R=I.clientHeight,b=typeof h.value=="number"?h.value:a.value.offsetWidth||350,B=typeof u.value=="number"?u.value:a.value.offsetHeight||600;l.value+b>S&&(l.value=Math.max(0,S-b-20)),c.value+B>R&&(c.value=Math.max(0,R-B-20)),l.value<0&&(l.value=0),c.value<0&&(c.value=0)}})},A=d.ref(!1),v=I=>{if(I.target.closest(".close-btn")||I.target.closest(".actions"))return;A.value=!0,I.preventDefault(),I.stopPropagation();const S=I.clientX,R=I.clientY,b=l.value,B=c.value,L=N=>{if(!A.value)return;N.preventDefault();const D=N.clientX-S,E=N.clientY-R;l.value=b+D,c.value=B+E},O=()=>{A.value=!1,document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",O),g()};document.addEventListener("mousemove",L),document.addEventListener("mouseup",O)},C=()=>{d.nextTick(()=>{if(t.align&&a.value){const I=a.value.offsetParent||document.body,S=typeof h.value=="number"?h.value:a.value.offsetWidth||350;t.align==="right"?l.value=Math.max(0,I.clientWidth-S-20):t.align==="center"&&(l.value=Math.max(0,(I.clientWidth-S)/2))}g()})};d.onMounted(()=>{t.align?C():g()}),d.watch(r,I=>{I&&(t.align?C():g())});const w=()=>{r.value=!1,o("close")},M=I=>{if(I.target.closest(".close-btn")||I.target.closest(".actions")||I.touches.length!==1)return;A.value=!0,I.preventDefault(),I.stopPropagation();const S=I.touches[0],R=S?.clientX??0,b=S?.clientY??0,B=l.value,L=c.value,O=D=>{if(!A.value||D.touches.length!==1)return;D.preventDefault();const E=D.touches[0],T=(E?.clientX??0)-R,P=(E?.clientY??0)-b;l.value=B+T,c.value=L+P},N=()=>{A.value=!1,document.removeEventListener("touchmove",O),document.removeEventListener("touchend",N),g()};document.addEventListener("touchmove",O,{passive:!1}),document.addEventListener("touchend",N)},x=I=>{if(I.touches.length!==1)return;f.value=!0,I.preventDefault(),I.stopPropagation();const S=I.touches[0],R=S?.clientX??0,b=S?.clientY??0,B=typeof h.value=="number"?h.value:a.value?.offsetWidth||0,L=typeof u.value=="number"?u.value:a.value?.offsetHeight||0,O=D=>{if(!f.value||D.touches.length!==1)return;D.preventDefault();const E=D.touches[0],T=(E?.clientX??0)-R,P=(E?.clientY??0)-b,F=B+T,V=L+P;F>100&&(h.value=F),V>100&&(u.value=V)},N=()=>{f.value=!1,document.removeEventListener("touchmove",O),document.removeEventListener("touchend",N)};document.addEventListener("touchmove",O,{passive:!1}),document.addEventListener("touchend",N)};return(I,S)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{ref_key:"cardRef",ref:a,class:d.normalizeClass(["draggable-card leiting-scroll",["leiting-theme-"+d.unref(n)]]),style:d.normalizeStyle(y.value)},[d.createElementVNode("div",{ref:"headerRef",class:"card-header",onMousedown:v,onTouchstart:M},[d.createElementVNode("span",kB,d.toDisplayString(i.title),1),d.createElementVNode("div",PB,[d.renderSlot(I.$slots,"header-extra",{},void 0,!0),d.createElementVNode("span",{class:"close-btn",onClick:w},"×")])],544),d.createElementVNode("div",DB,[d.renderSlot(I.$slots,"default",{},void 0,!0)]),d.unref(s)?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:0,class:"resize-handle",onMousedown:m,onTouchstart:x},[...S[0]||(S[0]=[d.createElementVNode("svg",{viewBox:"0 0 10 10",width:"10",height:"10",fill:"currentColor"},[d.createElementVNode("path",{d:"M10 10 L10 2 L2 10 Z"})],-1)])],32))],6)),[[d.vShow,r.value]])}}),Be=(i,e)=>{const t=i.__vccOpts||i;for(const[n,s]of e)t[n]=s;return t},gt=Be(NB,[["__scopeId","data-v-4d38393b"]]);function ym(i){const e=d.ref([]),t=d.ref([]),n=d.ref([]),s=d.ref(""),o=d.ref(!0);d.watch(()=>d.unref(i),u=>{if(!u||u.length===0)return;const p=[],f=(g,A)=>{g.forEach(v=>{const C=v.id||v.key||v.$id,w=v.modelId||A;w&&(v.modelId=w),C&&p.push(C),v.children&&v.children.length>0&&f(v.children,w)})};f(u);const m=new Set(n.value);let y=!1;p.forEach(g=>{m.has(g)||(m.add(g),y=!0)}),y&&(n.value=Array.from(m))},{immediate:!0,deep:!0});const r=d.computed(()=>{const u=d.unref(i);if(!u)return[];const p=[],f=(m,y)=>{m.forEach(g=>{const A=g.id||g.key||g.$id,v=g.name||g.title;p.push({key:A,title:v,parentKey:y}),g.children&&g.children.length>0&&f(g.children,A)})};return f(u),p}),a=u=>{e.value=u,o.value=!1},l=u=>{n.value=u},c=u=>{t.value=u},h=u=>r.value.find(f=>f.key===u)?.parentKey;return d.watch(s,u=>{if(!u)return;const f=r.value.filter(y=>y.title&&y.title.toLowerCase().includes(u.toLowerCase())).map(y=>y.parentKey),m=new Set;f.forEach(y=>{let g=y;for(;g;)m.add(g),g=h(g)}),e.value=[...m],o.value=!0}),{expandedKeys:e,selectedKeys:t,checkedKeys:n,searchValue:s,autoExpandParent:o,onExpand:a,onCheck:l,onSelect:c}}const LB={class:"search-box"},RB={key:0},FB={style:{color:"#f50"}},OB={key:1},GB={key:1,class:"empty-tip"},Or=Be(d.defineComponent({__name:"LeitingTree",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"构件树"},width:{type:[Number,String],default:320},treeData:{type:Array,default:()=>[]},initialPosition:{type:Object,default:()=>({x:0,y:0})},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close","select","check"],setup(i,{emit:e}){const t=oe.Input.Search,n=oe.Tree,s=i,o=e,r=d.inject("leiting-theme",d.ref("dark")),a=d.inject("leitingMethods"),l=b=>{a?.value?.onSearchComponent&&a.value.onSearchComponent(b)},c=d.computed({get:()=>s.open!==void 0?s.open:s.visible,set:b=>{o("update:visible",b),o("update:open",b)}}),h=d.ref(null),{height:u}=_B(h),p=d.computed(()=>u.value||300),f=d.ref({children:"children",title:"name",key:"id"}),m=d.ref([]),{expandedKeys:y,selectedKeys:g,checkedKeys:A,searchValue:v,autoExpandParent:C}=ym(d.toRef(s,"treeData")),w=(b,B)=>{if(!B)return b;const L=B.toLowerCase();return b.reduce((O,N)=>{const E=(N.name||N.title||"").toLowerCase().includes(L);if(N.children&&N.children.length>0){const T=w(N.children,B);(T.length>0||E)&&O.push({...N,children:T})}else E&&O.push({...N});return O},[])};d.watch([()=>s.treeData,v],([b,B])=>{b?m.value=w(b,B||""):m.value=[]},{immediate:!0,deep:!0});const M=b=>{y.value=b,C.value=!1},x=b=>{const B=[],L=O=>{if(!O.children||O.children.length===0){const D=O.element_Id;O.modelId&&D&&B.push({modelId:O.modelId,elementId:D})}else O.children.forEach(L)};return L(b),B},I=(b,B)=>{A.value=b,o("check",b,B);const L=[],O=new Set(b.map(D=>String(D))),N=D=>{for(let E=0;E<D.length;E++){const T=D[E];if(!T.children||T.children.length===0){if(!O.has(String(T.id))){const V=T.element_Id;T.modelId&&V&&L.push({modelId:T.modelId,elementId:V,show:!1})}}else T.children&&N(T.children)}};s.treeData&&N(s.treeData),a?.value?.setComponentVisibility&&a.value.setComponentVisibility(L),a?.value?.onTreeCheck&&a.value.onTreeCheck(b,B)},S=(b,B)=>{if(g.value=b,o("select",b,B),B.selected){const L=x(B.node);L.length>0&&a?.value?.flyToObjects&&a.value.flyToObjects({selectCpts:L})}a?.value?.onTreeSelect&&a.value.onTreeSelect(b,B)},R=()=>{o("update:visible",!1),o("close")};return(b,B)=>(d.openBlock(),d.createBlock(gt,{visible:c.value,"onUpdate:visible":B[1]||(B[1]=L=>c.value=L),title:i.title,"initial-position":i.initialPosition,"full-height":i.fullHeight,onClose:R},{default:d.withCtx(()=>[d.createElementVNode("div",{class:d.normalizeClass(["leiting-tree-container",[`theme-${d.unref(r)}`]])},[d.createElementVNode("div",LB,[d.createVNode(d.unref(t),{value:d.unref(v),"onUpdate:value":B[0]||(B[0]=L=>d.isRef(v)?v.value=L:null),placeholder:"搜索构件","allow-clear":"","enter-button":"",onSearch:l},null,8,["value"])]),d.createElementVNode("div",{class:"tree-wrapper",ref_key:"treeWrapperRef",ref:h},[m.value&&m.value.length?(d.openBlock(),d.createBlock(d.unref(n),{key:0,"tree-data":m.value,"field-names":f.value,height:p.value,"expanded-keys":d.unref(y),"auto-expand-parent":d.unref(C),"selected-keys":d.unref(g),"checked-keys":d.unref(A),checkable:"","block-node":"",onExpand:M,onSelect:S,onCheck:I},{title:d.withCtx(({name:L,title:O})=>[(L||O)&&d.unref(v)&&(L||O).toLowerCase().indexOf(d.unref(v).toLowerCase())>-1?(d.openBlock(),d.createElementBlock("span",RB,[d.createTextVNode(d.toDisplayString((L||O).substr(0,(L||O).toLowerCase().indexOf(d.unref(v).toLowerCase())))+" ",1),d.createElementVNode("span",FB,d.toDisplayString(d.unref(v)),1),d.createTextVNode(" "+d.toDisplayString((L||O).substr((L||O).toLowerCase().indexOf(d.unref(v).toLowerCase())+d.unref(v).length)),1)])):(d.openBlock(),d.createElementBlock("span",OB,d.toDisplayString(L||O),1))]),_:1},8,["tree-data","field-names","height","expanded-keys","auto-expand-parent","selected-keys","checked-keys"])):(d.openBlock(),d.createElementBlock("div",GB,"暂无数据"))],512)],2)]),_:1},8,["visible","title","initial-position","full-height"]))}}),[["__scopeId","data-v-3748c20d"]]),UB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoROakhe0HDeQmbQfFzTxJj+zTXYg1kWrarISRFKzLNAfGsbL9iDzq/0j+kQZ/k1wm7onoKW3Hq42F0jLVK//Tcebott2fJAbVK1lvKwBNd6rRIsFsfJka0G2qdpQPy7+EPC0AumexKAzoH5FbgvSbHuUW6EOYubbfwX0cLPfFJS4K6mPNrbdHb+uvP498dhVn4v9FWo9V3RZzFxAv8L9AAAAAElFTkSuQmCC",Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAERSURBVDhPvZTrEYIwEISTCrQD6EA7gA60AylBK1Aq0A7ECrQDoQPsADrACuLuTMJkIiHxjzezgyR7H3d5KJVSqRAigcaQUjYYX2JgZY/P/O4lEgYYFo7pgPcc2kSCBoIUzDeo0klPPEsNYlX7AKzA/M6ASrRzYoIGG5DAOCvzBvzMOxqQazSgLLI1QdAW5jWpUAPV0AVKIc7FRCuNy7RkWozJtj1BED7ANbpDXHhffFXUwUnZwRYp7qw7Rx8/lLkV9R4QD2w1A8pjW3sA4h5au+pXEBS76P8D6Ut9/nXXaiRQdnBXqBfEC+4GdzSxW5v6F7CTeHnbCVCBsWIE+RYVrdF4DSz6OwgiADDexbmT3X0A4fSDfDjUugcAAAAASUVORK5CYII=",VB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFESURBVDhPlZMNEcIwDIVXBQwFgAJAAcMBDgAFIGE4wAHgABSwOdgcIAEUjPd6aS/rfhi7y12bJl9f0sxEf3xVVV0RPoetjTFvnWqGcgSylfgihA0CKcgJgBfsAqMiKiM0+gkKlCyZCN8uhPWCFOSBxARWORU4W2CdeV9XjxSEJcwkjokTqBpzjxjCn7CyVRECzjg8wHLYCmabK7CplBcLhMr2DZCqP0dCovYZ9hYGXx1izLUGUkkfxI/sTQiCf4N1zLWAWCKV2nP6PEhB2Ngd7B4GC4SJnCcP8SAFoc/Ph/TqjVvTPogFKUiJ/VGU+GdmUAA5ObA7cyC+iPt/MjUfKRL4emyuK+cGH8tufFRUHywZ+RYlnRDdIwfzLzVUibtQv1oNhoAExtfpVdIAiQIOWiY9o2sQxJemOydTS1jR1di2Zn8B8f27apou9kMAAAAASUVORK5CYII=",QB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAHDSURBVDhPlZOxL0NRFIe9ECubhehoIIjJ1HYwCkIiJpUQEkN1YZBobU0kFKNI3iTGYrDRv0BIhLXCYpCwiO35fs25zWva98JNvpz37j33d8+551yvLWIEQXDG0izMe55XjvJz816MUJG1LVuvYJcQrEb5xwkV2JSHGfAhgBJiu63E4oSUzpRtusa+wBooKkWnKOujQYh7SbCShQx0m9cpds4iOseOw7BFmUPwU341IQT2MaOQgi9QND+wiqNnBxT4X7SIbrAqhNI9wiUvJ+W8A99wDEWdwrw25iVkkenAEb5LkIQPuIMJWJGQoriFd+iBCkhc8zUhfJSm7mva5l3aadubDgtpMgGKpB/eoBfuQZFoPNhBj9gTaC3kKkEEGXPswF7Y5rLro1AW8UI6GmelmAzfkUWlNaWt6/iT0DOOA5bqoSuzHfIvofATqSJQb8KoiJbtPi6x2dA9FPjXE1F/uZKrv3IwCFcNqVmoPlal7QJ9q/wZCbk7Ioo9/tehE9q1r0nIxNQbG4YEXdkVjQ5J2OZXbB88gVrgQIJNj9aaT4LboPK7J6O0Ktb1KYtc/aYxGff6h3AYY6Nvzk2GQ1WQTVj4BST70jYaqceXAAAAAElFTkSuQmCC",zB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADhSURBVHgBvVOBEYIwDEw9B2ADO4IjuIEjwAa6Aa7ABMAEuIIjOIFsUDao37vgxVZbBI+/+0tI0+fJBaIIrLUFaMAHmNNcsMAIE+vdJLQykQ+0wFHBrsyiT/sL2I1DDTac/+4Klzobov7WHxt29qGmaYaQnlhLCmUTa2l4C2ljvamFlEvY0xpCW/kA924GblfGWciZaJyXQvSmlOoDITSdXQBbcA8eKfy/nHDFeY470FIX8tzUIu84FmLWuTzz7yhRLPm54dKJ4+A5uoJ3HgHBUfUmxGIa4QDuKA4n3kLk9ZInw0qu5b1R1aYAAAAASUVORK5CYII=",HB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADFSURBVDhPxVPBDYMwDIwnKJu0G9ANYJMyQrsBbNIRGAE2gEnSO6mpIMJxkBC1lEds52zfOeK9b51zV5wte4lIr8RWbgGQh2fGmaIHJe4EetKPtDpRcA5AvwcB7FtgCcTOH0p3YzaQNd75QBiVXJG3LRtCRyQ6Jvsekd3gTsJVoDcihZLQQjXGTRMzIzPhOCCQyNYvSuEue7Qdm02yK0u1nM2m/FQyKb8JZHH+l81Ofdpdm82tvikjThyNlbSEBvIPFj+MfwA76qSYUG3g9QAAAABJRU5ErkJggg==",Am="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEcSURBVDhPrZSNDYIwEIXpBOIGjMAIOIE4AbgBGwAbOIJu4Aa4gW4gI+gE9b3mjjSmibSR5ALX3H33W4y1Ns+yrIe0EH7HPC8YnyGjAegkEB5cYyiwrdWXIEc1xnSREGcuiTQEWeg7gG4+CMcl9ALnLkvogwScv+wq6FMQJJCJDgBtBcSAI3QClwe2YZAHcY2Ho4kGAVLA6U5/CEvdp4KYhesFhBPpCZIAz6jStHhproJcHyAHbb5nF+6RZ8CsGslIQaHp/gSxRzlApU4GugPxNuDN/eNarAJxapUPgm8rQ9C1SAI9AOGiHhGApSdnRN8FshbEiLwiLI1rMUM6zSQ0tX9c2lp/Iw0iMIPU38iFIN1mTmOjKa98vyWB4QM5XQnvsbFsyAAAAABJRU5ErkJggg==",YB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGPSURBVDhPrZT9UQIxEMUvFSgViBUoFQgVABV4VqBW4FmBUIFQgZRwVqBU4HUAVHC+X2aXycQw/sPOvLncZvdlv5JQFaTv+1upp8IyhLDHRLpLfe6FrXRt7hZShYyH+n8RauGAv/AkQNYIHICshFcRdu6fE/kGRN/mQGTIpzAzMoh6EV2fIsJ5IwNOj2IpVZ6i6difSecRVnlELZHIgHROisgXRCa78Z+IrMBf2pjLYJNENGSd1kO2pPghjKQniyqY8lFr2NfaqC18wn7nZCMlWg7xLq70TxfRLyHqtABN2lbp40mSSCzBcSebif1TPyKjDBcQ0eJJRkIUpHkMPUlnkBU+pnlWItL6ERgw8o1iqRHtgzAUGNRD2qmkvgMvNnneUQcZ4ggR6VGXG+OOA1koNvrFcY7+af++VJe0hucfyKQu+RWJc+SDZ3aNvlPpRl7T0qXdafNZYPDehLEZt/rOBR9U8QSaEKX0jHAaE4tshVrgLeJ+Xdl6rS8D3BWJXKnCEwWXEuco9grQ3bb0sP0Cn8/nPm/SMRQAAAAASUVORK5CYII=",$B="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACDSURBVHgB1ZFhDYAgEIWfzgBGIIINpIEViGAkG2gEbWADjWADfMw/iDgUfji/7e3gxt3uHsDXZFrrlrFBHJNpsPAgEEmORArn3lFroEZQCjcTbAhzepPsgbuCgn8FBWvsUAMfFR5OIPGS5G80JkrG2sopHKbO1BCoHy8ZNhRUT5X4BTu6qyNSwwCiMAAAAABJRU5ErkJggg==",jB={class:"menu-container"},WB=["onClick","title"],qB={class:"menu-icon"},KB=["src","alt"],XB={key:3,style:{"font-size":"12px"}},JB={key:0,class:"sub-menu"},ZB=["onClick"],ao=d.defineComponent({__name:"LeitingMenu",props:{visible:{type:Boolean,default:!0},activeIds:{type:Array,default:()=>[]},is2d:{type:Boolean,default:!1},customItems:{type:Array,default:()=>[]}},emits:["action"],setup(i,{emit:e}){const t=i,n=d.inject("leiting-theme",d.ref("dark")),s=d.inject("leiting-menu-size",d.ref("medium")),o=d.inject("leitingMethods",d.ref({})),r=d.computed(()=>n.value||n),a=d.computed(()=>s.value||s),l=d.ref([{ID:"home",title:"主视角",src:UB,key:"homeView"},{ID:"tree",title:"目录树",src:Gr,key:"componentTree"},{ID:"cadLayer",title:"图层",src:Gr,key:"cadLayer"},{ID:"gisCadPosition",title:"GIS调整",src:Am,key:"gisCadPosition"},{ID:"measure",title:"量算",src:VB,key:"measurement"},{ID:"section",title:"剖切",src:QB,key:"section"},{ID:"roam",title:"人物漫游",src:zB,key:"roam"},{ID:"info",title:"构件信息",src:HB,key:"componentInfo"},{ID:"cadPosition",title:"调整位置",src:Am,key:"cadPosition"},{ID:"annotation",title:"标注",src:$B,key:"annotation"},{ID:"setting",title:"设置",src:YB,key:"setting"}]),c=d.ref([]),h=d.ref([...t.activeIds]);d.watch(()=>t.activeIds,w=>{h.value=[...w]},{deep:!0});const u=d.computed(()=>t.visible);o.value&&o.value.menuEvents&&(o.value.menuEvents.on("setMenuListFilter",w=>{c.value=w}),o.value.menuEvents.on("setMenuActive",(w,M)=>{M?h.value.includes(w)||h.value.push(w):h.value=h.value.filter(x=>x!==w)}));const p=d.computed(()=>{let w=l.value;if(t.is2d){const M=["homeView","measurement","cadLayer","gisCadPosition","annotation"];w=w.filter(x=>x.key&&M.includes(x.key))}else{const M=["cadLayer","cadPosition","gisCadPosition","annotation"];w=w.filter(x=>!x.key||!M.includes(x.key))}if(c.value.length>0&&(w=w.filter(M=>!M.key||!c.value.includes(M.key))),t.customItems&&t.customItems.length>0){const M=t.customItems.map(x=>({...x,key:x.ID,src:x.src||x.icon}));return[...w,...M]}return w}),f=e,m=w=>{const M=["homeView"];if(w.key&&M.includes(w.key))h.value.includes(w.ID)||(h.value.push(w.ID),setTimeout(()=>{const I=h.value.indexOf(w.ID);I>-1&&h.value.splice(I,1)},1e3));else{const I=h.value.indexOf(w.ID);I>-1?h.value.splice(I,1):h.value.push(w.ID)}const x=h.value.includes(w.ID);w.func&&w.func(w),w.key&&f("action",w.key,x)},y=w=>{c.value=w},g=w=>{console.log("LeitingMenu received showMenu event:",w)},A=(w,M)=>{const x=p.value.find(I=>I.ID===w||I.key===w);if(x){const I=h.value.indexOf(x.ID);M&&I===-1?h.value.push(x.ID):!M&&I>-1&&h.value.splice(I,1)}};let v=null;const C=()=>{o.value?.menuEvents&&(v&&(v.off("setMenuListFilter",y),v.off("showMenu",g),v.off("setMenuActive",A)),v=o.value.menuEvents,v.on("setMenuListFilter",y),v.on("showMenu",g),v.on("setMenuActive",A))};return d.onMounted(()=>{C()}),d.onUnmounted(()=>{v&&(v.off("setMenuListFilter",y),v.off("showMenu",g),v.off("setMenuActive",A))}),d.watch(o,()=>{C()},{deep:!0}),(w,M)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-menu-wrapper",["leiting-theme-"+r.value,"size-"+a.value]])},[d.createElementVNode("div",jB,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(p.value,x=>(d.openBlock(),d.createElementBlock("div",{key:x.ID,class:d.normalizeClass(["menu-item",{active:h.value.includes(x.ID)}]),onClick:I=>m(x),title:x.title},[d.createElementVNode("div",qB,[x.src?(d.openBlock(),d.createElementBlock("img",{key:0,src:x.src,alt:x.title},null,8,KB)):typeof x.icon=="object"?(d.openBlock(),d.createBlock(d.resolveDynamicComponent(x.icon),{key:1})):typeof x.icon=="string"?(d.openBlock(),d.createElementBlock("i",{key:2,class:d.normalizeClass(["iconfont",`icon-${x.icon}`])},null,2)):(d.openBlock(),d.createElementBlock("span",XB,d.toDisplayString(x.title.substring(0,2)),1))]),x.children&&x.children.length>0?(d.openBlock(),d.createElementBlock("div",JB,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(x.children,I=>(d.openBlock(),d.createElementBlock("div",{key:I.ID,class:d.normalizeClass(["sub-menu-item",{active:h.value.includes(I.ID)}]),onClick:d.withModifiers(S=>m(I),["stop"])},d.toDisplayString(I.title),11,ZB))),128))])):d.createCommentVNode("",!0)],10,WB))),128))])],2)),[[d.vShow,u.value]])}}),e3={class:"leiting-section-content"},t3={class:"section-form-item"},i3={class:"radio-group"},n3={class:"section-form-item"},s3={class:"switch-container"},o3={class:"switch"},r3={class:"status-text"},a3={class:"section-form-item slider-item"},l3={class:"slider-wrapper"},c3={class:"section-form-item slider-item"},d3={class:"slider-wrapper"},h3={class:"section-form-item slider-item"},u3={class:"slider-wrapper"},f3={class:"section-form-item table-item"},p3={class:"model-table-container"},m3={class:"model-table"},g3={width:"40"},y3=["checked"],A3=["onClick"],v3=["value"],b3={class:"model-name"},lo=Be(d.defineComponent({__name:"LeitingSection",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"剖切控制"},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:N=>{n("update:visible",N),n("update:open",N)}}),r=d.ref("Box"),a=d.ref(!1),l=d.ref([]),c=d.ref([]),h=d.computed(()=>c.value.length===0?!1:c.value.every(N=>l.value.includes(N.modelId))),u=N=>{N.target.checked?l.value=c.value.map(E=>E.modelId):l.value=[],R()},p=d.ref([-10,10]),f=d.ref([-10,10]),m=d.ref([-10,10]),y=d.ref([-100,100]),g=d.ref([-100,100]),A=d.ref([-100,100]);let v=!1;const C=N=>{v=!0;const{targetZPlus:D,targetZMinus:E,targetXPlus:T,targetXMinus:P,targetYPlus:F,targetYMinus:V}=N;m.value=[-E,D],p.value=[-P,T],f.value=[-V,F],setTimeout(()=>{v=!1},100)},w=()=>{v||l.value.length===0||!s?.value?.updateSectionRange||s.value.updateSectionRange({targetZPlus:m.value[1],targetZMinus:-m.value[0],targetXPlus:p.value[1],targetXMinus:-p.value[0],targetYPlus:f.value[1],targetYMinus:-f.value[0]})},M=()=>{s?.value?.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(a.value)},x=N=>{if(!s?.value?.getMapTileset||!s?.value?.openSection)return;const E=s.value.getMapTileset()[N];if(E&&E.leiting?.box){const{min:T,max:P}=E.leiting.box,F=(P.x-T.x)/2,V=(P.y-T.y)/2,G=(P.z-T.z)/2;l.value.length<=1&&(y.value=[-F*2,F*2],g.value=[-V*2,V*2],A.value=[-G*2,G*2],p.value=[-F,F],f.value=[-V,V],m.value=[-G,G],s.value.updateSectionRange&&s.value.updateSectionRange({targetZPlus:G,targetZMinus:G,targetXPlus:F,targetXMinus:F,targetYPlus:V,targetYMinus:V})),s.value.openSection(N,{moveCallBack:C}),s.value.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(a.value)}},I=N=>{const D=l.value.indexOf(N);D>-1?l.value.splice(D,1):l.value.push(N),R()};let S=[];const R=()=>{const N=l.value.filter(E=>!S.includes(E)),D=S.filter(E=>!l.value.includes(E));N.forEach(E=>x(E)),D.forEach(E=>{s?.value?.closeSection&&s.value.closeSection(E)}),S=[...l.value]},b=()=>{},B=()=>{o.value=!1,n("close")},L=()=>{a.value=!1,l.value=[],S=[],p.value=[-10,10],f.value=[-10,10],m.value=[-10,10],y.value=[-100,100],g.value=[-100,100],A.value=[-100,100]};d.watch(()=>t.visible,N=>{N?O():(s?.value?.closeSection&&s.value.closeSection(),L())});const O=()=>{s?.value&&typeof s.value.getModelList=="function"&&(c.value=s.value.getModelList()||[],c.value.length>0&&l.value.length===0&&(l.value=[c.value[0].modelId],S=[...l.value]),t.visible&&l.value.length>0&&(a.value=!0,l.value.forEach(N=>x(N))))};return d.watch(()=>s?.value,()=>{O()},{immediate:!0,deep:!0}),d.onMounted(()=>{O()}),(N,D)=>(d.openBlock(),d.createBlock(gt,{visible:o.value,title:"剖切分析","full-height":i.fullHeight,"onUpdate:visible":B},{default:d.withCtx(()=>[d.createElementVNode("div",e3,[d.createElementVNode("div",t3,[D[8]||(D[8]=d.createElementVNode("span",{class:"label"},"模式",-1)),d.createElementVNode("div",i3,[d.createElementVNode("label",{class:d.normalizeClass(["radio-item",{active:r.value==="Box"}])},[d.withDirectives(d.createElementVNode("input",{type:"radio",value:"Box","onUpdate:modelValue":D[0]||(D[0]=E=>r.value=E),onChange:b},null,544),[[d.vModelRadio,r.value]]),D[7]||(D[7]=d.createTextVNode(" 剖切盒 ",-1))],2)])]),d.createElementVNode("div",n3,[D[10]||(D[10]=d.createElementVNode("span",{class:"label"},"显示",-1)),d.createElementVNode("div",s3,[d.createElementVNode("label",o3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":D[1]||(D[1]=E=>a.value=E),onChange:M},null,544),[[d.vModelCheckbox,a.value]]),D[9]||(D[9]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",r3,d.toDisplayString(a.value?"显示":"隐藏"),1)])]),d.createElementVNode("div",a3,[D[11]||(D[11]=d.createElementVNode("span",{class:"label"},"X 轴",-1)),d.createElementVNode("div",l3,[d.createVNode(d.unref(oe.Slider),{value:p.value,"onUpdate:value":D[2]||(D[2]=E=>p.value=E),range:"",min:y.value[0],max:y.value[1],step:.1,onChange:w},null,8,["value","min","max"])])]),d.createElementVNode("div",c3,[D[12]||(D[12]=d.createElementVNode("span",{class:"label"},"Y 轴",-1)),d.createElementVNode("div",d3,[d.createVNode(d.unref(oe.Slider),{value:f.value,"onUpdate:value":D[3]||(D[3]=E=>f.value=E),range:"",min:g.value[0],max:g.value[1],step:.1,onChange:w},null,8,["value","min","max"])])]),d.createElementVNode("div",h3,[D[13]||(D[13]=d.createElementVNode("span",{class:"label"},"Z 轴",-1)),d.createElementVNode("div",u3,[d.createVNode(d.unref(oe.Slider),{value:m.value,"onUpdate:value":D[4]||(D[4]=E=>m.value=E),range:"",min:A.value[0],max:A.value[1],step:.1,onChange:w},null,8,["value","min","max"])])]),d.createElementVNode("div",f3,[D[15]||(D[15]=d.createElementVNode("span",{class:"label"},"模型",-1)),d.createElementVNode("div",p3,[d.createElementVNode("table",m3,[d.createElementVNode("thead",null,[d.createElementVNode("tr",null,[d.createElementVNode("th",g3,[d.createElementVNode("input",{type:"checkbox",checked:h.value,onChange:u},null,40,y3)]),D[14]||(D[14]=d.createElementVNode("th",null,"名称",-1))])]),d.createElementVNode("tbody",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(c.value,E=>(d.openBlock(),d.createElementBlock("tr",{key:E.modelId,class:d.normalizeClass({selected:l.value.includes(E.modelId)}),onClick:T=>I(E.modelId)},[d.createElementVNode("td",null,[d.withDirectives(d.createElementVNode("input",{type:"checkbox",value:E.modelId,"onUpdate:modelValue":D[5]||(D[5]=T=>l.value=T),onClick:D[6]||(D[6]=d.withModifiers(()=>{},["stop"])),onChange:R},null,40,v3),[[d.vModelCheckbox,l.value]])]),d.createElementVNode("td",b3,d.toDisplayString(E.modelName),1)],10,A3))),128))])])])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-ee4d9a12"]]),C3={class:"leiting-player-content"},w3={class:"player-form-item"},E3={class:"switch-container"},x3={class:"switch"},I3={class:"status-text"},S3={class:"player-form-item"},M3={class:"switch-container"},T3={class:"switch"},B3={class:"status-text"},_3={class:"player-form-item"},k3={class:"switch-container"},P3={class:"switch"},D3={class:"status-text"},N3={class:"player-form-item slider-item"},L3={class:"slider-wrapper"},R3={class:"value-text"},F3={class:"instructions"},O3={class:"key-map"},G3={class:"key-row"},U3={class:"key-row"},V3={class:"key-row"},Q3={class:"key-row"},z3={class:"key-row"},H3={class:"key-row"},co=Be(d.defineComponent({__name:"LeitingPlayer",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"漫游控制"},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(!1),r=d.ref(!1),a=d.ref(!0),l=d.ref(5),c=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:x=>{n("update:visible",x),n("update:open",x)}}),h=d.ref(null),u=d.ref(null),p=d.ref(null),f=d.ref(null),m=d.ref(null),y=d.ref(null),g=()=>{o.value?v():C()},A=()=>{s?.value?.setPlayerParams&&s.value.setPlayerParams({gravityTest:r.value,collisionTest:a.value})},v=async()=>{s?.value?.openPlayer&&(await s.value.openPlayer(),s.value.setPlayerSpeed&&s.value.setPlayerSpeed(l.value),A(),s.value.bindPlayerUiKeys&&(await d.nextTick(),s.value.bindPlayerUiKeys({moveFront:h.value,moveBack:u.value,moveLeft:p.value,moveRight:f.value,moveUp:m.value,moveDown:y.value})))},C=()=>{s?.value?.closePlayer&&s.value.closePlayer()},w=()=>{s?.value?.setPlayerSpeed&&s.value.setPlayerSpeed(l.value)},M=()=>{c.value=!1,n("close")};return d.watch(()=>t.visible,x=>{x?(o.value=!0,s?.value?v():setTimeout(()=>{s?.value&&v()},100)):o.value&&(o.value=!1,C())},{immediate:!0}),(x,I)=>(d.openBlock(),d.createBlock(gt,{title:i.title,visible:c.value,"full-height":i.fullHeight,"onUpdate:visible":M},{default:d.withCtx(()=>[d.createElementVNode("div",C3,[d.createElementVNode("div",w3,[I[5]||(I[5]=d.createElementVNode("span",{class:"label"},"启用",-1)),d.createElementVNode("div",E3,[d.createElementVNode("label",x3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":I[0]||(I[0]=S=>o.value=S),onChange:g},null,544),[[d.vModelCheckbox,o.value]]),I[4]||(I[4]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",I3,d.toDisplayString(o.value?"开启":"关闭"),1)])]),d.createElementVNode("div",S3,[I[7]||(I[7]=d.createElementVNode("span",{class:"label"},"重力",-1)),d.createElementVNode("div",M3,[d.createElementVNode("label",T3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":I[1]||(I[1]=S=>r.value=S),onChange:A},null,544),[[d.vModelCheckbox,r.value]]),I[6]||(I[6]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",B3,d.toDisplayString(r.value?"开启":"关闭"),1)])]),d.createElementVNode("div",_3,[I[9]||(I[9]=d.createElementVNode("span",{class:"label"},"碰撞",-1)),d.createElementVNode("div",k3,[d.createElementVNode("label",P3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":I[2]||(I[2]=S=>a.value=S),onChange:A},null,544),[[d.vModelCheckbox,a.value]]),I[8]||(I[8]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",D3,d.toDisplayString(a.value?"开启":"关闭"),1)])]),d.createElementVNode("div",N3,[I[10]||(I[10]=d.createElementVNode("span",{class:"label"},"速度",-1)),d.createElementVNode("div",L3,[d.createVNode(d.unref(oe.Slider),{value:l.value,"onUpdate:value":I[3]||(I[3]=S=>l.value=S),min:1,max:10,step:1,onChange:w},null,8,["value"])]),d.createElementVNode("span",R3,d.toDisplayString(l.value),1)]),I[19]||(I[19]=d.createElementVNode("div",{class:"divider"},null,-1)),d.createElementVNode("div",F3,[I[18]||(I[18]=d.createElementVNode("div",{class:"instruction-title"},"操作说明",-1)),d.createElementVNode("div",O3,[d.createElementVNode("div",G3,[d.createElementVNode("span",{class:"key",ref_key:"btnFront",ref:h},"W",512),I[11]||(I[11]=d.createTextVNode(" 前进 ",-1))]),d.createElementVNode("div",U3,[d.createElementVNode("span",{class:"key",ref_key:"btnBack",ref:u},"S",512),I[12]||(I[12]=d.createTextVNode(" 后退 ",-1))]),d.createElementVNode("div",V3,[d.createElementVNode("span",{class:"key",ref_key:"btnLeft",ref:p},"A",512),I[13]||(I[13]=d.createTextVNode(" 左移 ",-1))]),d.createElementVNode("div",Q3,[d.createElementVNode("span",{class:"key",ref_key:"btnRight",ref:f},"D",512),I[14]||(I[14]=d.createTextVNode(" 右移 ",-1))]),d.createElementVNode("div",z3,[d.createElementVNode("span",{class:"key",ref_key:"btnUp",ref:m},"Q",512),I[15]||(I[15]=d.createTextVNode(" 上升 ",-1))]),d.createElementVNode("div",H3,[d.createElementVNode("span",{class:"key",ref_key:"btnDown",ref:y},"E",512),I[16]||(I[16]=d.createTextVNode(" 下降 ",-1))]),I[17]||(I[17]=d.createElementVNode("div",{class:"key-row"},[d.createElementVNode("span",{class:"mouse-icon"},"🖱️"),d.createTextVNode(" 按住左键拖拽旋转视角 ")],-1))])])])]),_:1},8,["title","visible","full-height"]))}}),[["__scopeId","data-v-ff3f266e"]]),Y3={class:"info-content"},$3={key:0,class:"component-title"},ho=Be(d.defineComponent({__name:"LeitingInfo",props:{visible:{type:Boolean},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref([]),r=d.ref(!1),a=d.ref([]),l=d.ref([]),c=d.ref(0),h=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:A=>{n("update:visible",A),n("update:open",A)}}),u=()=>{h.value=!1},p=A=>({elementID:"构件ID",elementName:"构件名",categoryName:"类别",familySymbolName:"族类型",levelName:"标高",modelName:"文件名",length:"长",width:"宽",height:"高"})[A]||A,f=["elementName","elementID","modelName","length","width","height","levelName","categoryName","familySymbolName"],m=async A=>{const v=++c.value;if(l.value=A,!A||A.length===0){o.value=[];return}if(!h.value)return;let C=A;A.length>10&&(pe.warning(`选中构件数量过多(${A.length}个),仅显示前10个`),C=A.slice(0,10));const w=s?.value;let M=w?.getMapTileset?w.getMapTileset():{};r.value=!0;const x=[],I={};C.forEach(b=>{const L=M[b.modelId]?.leiting?.model?.dbName;L&&b.elementId&&x.push({dbName:L,elementId:b.elementId,modelId:b.modelId})});const S=new Set;if(C.forEach(b=>{const B=M[b.modelId],L=`${b.modelId}_${b.elementId}`;I[L]||B&&B.leiting&&!B.leiting?.node?.nodeExtras&&B.leiting.model?.nodeUrl&&S.add(b.modelId)}),S.size>0&&w?._loadNodeDetailsForModel)try{const b=Array.from(S).map(B=>w._loadNodeDetailsForModel(B));await Promise.all(b)}catch(b){console.error("Failed to load node details",b)}if(v!==c.value)return;M=w?.getMapTileset?w.getMapTileset():{};const R=[];C.forEach((b,B)=>{const O=M[b.modelId]?.leiting||{},N=I[`${b.modelId}_${b.elementId}`];let D={modelName:O.model?.modelId||b.modelId};D.elementID||(D.elementID=b.elementId);let E=null;if(N)E=N;else{const F=O.node?.nodeExtras?.element||O.node?.nodeExtras;if(F){const V=D.elementID;F[V]&&(E=F[V])}}E&&E.box3&&(D.length=`${E.box3.length?.toFixed(2)||0}米`,D.width=`${E.box3.width?.toFixed(2)||0}米`,D.height=`${E.box3.height?.toFixed(2)||0}米`);const T=[];E&&(E.name&&(D.elementName=E.name),E.categoryName&&(D.categoryName=E.categoryName),E.familySymbolName&&(D.familySymbolName=E.familySymbolName),E.levelName&&(D.levelName=E.levelName));const P={};if(f.forEach(F=>{D[F]!==void 0&&(P[F]=D[F])}),T.push({name:"基础信息",params:P}),E){const F=Array.isArray(E)?E:Array.isArray(E?.parameters)?E.parameters:null;if(F){if(F.flat().forEach(G=>{if(G&&G.GroupName&&Array.isArray(G.Parameters)){const k={};G.Parameters.forEach(_=>{_.name&&(k[_.name]=_.value??"")}),Object.keys(k).length>0&&T.push({name:G.GroupName,params:k})}}),!Array.isArray(E)){const{parameters:G,...k}=E,_={};Object.keys(k).forEach(U=>{!f.includes(U)&&U!=="uniqueId"&&typeof k[U]!="object"&&(_[U]=k[U])}),Object.keys(_).length>0&&T.push({name:"其他属性",params:_})}}else{let V=!1;if(Object.keys(E).forEach(G=>{E[G]&&typeof E[G]=="object"&&!Array.isArray(E[G])&&(V=!0,T.push({name:G,params:E[G]}))}),!V){const G={};Object.keys(E).forEach(k=>{if(!f.includes(k)&&k!=="batchId"){const _=E[k];typeof _=="string"&&_.length>500?G[k]=_.substring(0,500)+"...":G[k]=_}}),Object.keys(G).length>0&&T.push({name:"属性",params:G})}}}R.push({id:B,title:`${D.modelName}${D.elementName?` - ${D.elementName}`:""}`,groups:T})}),o.value=R,v===c.value&&(r.value=!1),R.length>0?a.value=[`${R[0].id}-基础信息`]:a.value=[]};let y=!1;const g=()=>{if(y)return;const A=s?.value;A&&A.selectionChange&&(A.selectionChange(m),y=!0)};return d.watch(()=>s?.value,()=>{g()},{deep:!0,immediate:!0}),d.watch(h,A=>{A&&l.value.length>0&&m(l.value)}),d.onMounted(()=>{g()}),(A,v)=>(d.openBlock(),d.createBlock(gt,{visible:h.value,title:"构件详情",width:350,align:"right","initial-position":{x:0,y:0},"full-height":i.fullHeight,onClose:u,"onUpdate:visible":v[1]||(v[1]=C=>h.value=C),class:"base-info-card"},{default:d.withCtx(()=>[d.createElementVNode("div",Y3,[d.createVNode(d.unref(oe.Spin),{spinning:r.value},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.value,C=>(d.openBlock(),d.createElementBlock("div",{key:C.id,class:"component-block"},[o.value.length>1?(d.openBlock(),d.createElementBlock("div",$3,d.toDisplayString(C.title),1)):d.createCommentVNode("",!0),d.createVNode(d.unref(oe.Collapse),{activeKey:a.value,"onUpdate:activeKey":v[0]||(v[0]=w=>a.value=w),ghost:"","expand-icon-position":"end"},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(C.groups,w=>(d.openBlock(),d.createBlock(d.unref(oe.CollapsePanel),{key:`${C.id}-${w.name}`,header:w.name},{default:d.withCtx(()=>[d.createVNode(d.unref(oe.Descriptions),{size:"small",bordered:"",column:1,labelStyle:{width:"100px",background:"rgba(255,255,255,0.05)",color:"#aaa"},contentStyle:{color:"#fff"}},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(w.params,(M,x)=>(d.openBlock(),d.createBlock(d.unref(oe.DescriptionsItem),{key:x,label:p(String(x))},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(M),1)]),_:2},1032,["label"]))),128))]),_:2},1024)]),_:2},1032,["header"]))),128))]),_:2},1032,["activeKey"])]))),128))]),_:1},8,["spinning"])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-375a1f55"]]);class yc{viewer;Cesium;pickHandler=null;bimEntityId="";mapEntityId="";constructor(e,t){this.viewer=e,this.Cesium=t}removeMarker(e){if(!this.viewer)return;const t=e==="BIM"?this.bimEntityId:this.mapEntityId;t&&(this.viewer.entities.removeById(t),e==="BIM"?this.bimEntityId="":this.mapEntityId="")}clearMarkers(){this.removeMarker("BIM"),this.removeMarker("MAP")}addMarker(e,t){if(!this.viewer||!this.Cesium)return;this.removeMarker(e);const n=`adjust-marker-${e}-${Date.now()}`;e==="BIM"?this.bimEntityId=n:this.mapEntityId=n,this.viewer.entities.add({id:n,position:this.Cesium.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),point:{pixelSize:10,color:e==="BIM"?this.Cesium.Color.RED:this.Cesium.Color.ORANGE,outlineColor:this.Cesium.Color.WHITE,outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY},label:{text:`${e==="BIM"?"BIM":"地图"}标记点`,font:"14pt sans-serif",style:this.Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:this.Cesium.VerticalOrigin.BOTTOM,pixelOffset:new this.Cesium.Cartesian2(0,-10),fillColor:this.Cesium.Color.WHITE,outlineColor:this.Cesium.Color.BLACK,backgroundColor:new this.Cesium.Color(.1,.1,.1,.8),showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY}})}registerPickHandler(e){this.destroyPickHandler(),!(!this.Cesium||!this.viewer)&&(this.pickHandler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.pickHandler.setInputAction(t=>{let n;try{n=this.viewer.scene.pickPosition(t.position)}catch(s){console.warn("pickPosition failed:",s)}if(!n){const s=this.viewer.camera.getPickRay(t.position);n=this.viewer.scene.globe.pick(s,this.viewer.scene)}if(n||(n=this.viewer.camera.pickEllipsoid(t.position,this.viewer.scene.globe.ellipsoid)),n){const s=this.Cesium.Cartographic.fromCartesian(n),o=this.Cesium.Math.toDegrees(s.longitude),r=this.Cesium.Math.toDegrees(s.latitude),a=s.height;e({longitude:o,latitude:r,height:a})}},this.Cesium.ScreenSpaceEventType.LEFT_CLICK,this.Cesium.KeyboardEventModifier.SHIFT))}destroyPickHandler(){this.pickHandler&&(this.pickHandler.destroy(),this.pickHandler=null)}calculateOffset(e,t){return{dLon:t.longitude-e.longitude,dLat:t.latitude-e.latitude,dHeight:t.height-e.height}}}const j3={class:"leitingbim-model-adjust-panel"},W3={class:"leitingbim-control-panel"},q3={class:"form-item"},K3={class:"radio-group"},X3={class:"form-item"},J3={class:"radio-group"},Z3={class:"form-item"},e_={class:"value"},t_={class:"param-row"},i_={class:"param-row"},n_={class:"param-row"},s_={class:"param-row"},o_={class:"param-row"},r_={class:"param-row"},a_={class:"param-row"},l_={class:"button-grid"},c_={key:1,class:"pick-mode-ui"},d_={class:"form-item",style:{display:"block","margin-bottom":"15px"}},h_={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},u_=["checked"],f_={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},p_={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},m_={class:"form-item",style:{display:"block","margin-bottom":"15px"}},g_={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},y_=["checked"],A_={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},v_={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},b_={class:"list-panel"},C_={class:"list-header"},w_={class:"col-check"},E_=["checked"],x_={class:"list-body"},I_={class:"col-check"},S_=["onUpdate:modelValue"],M_={class:"col-index"},T_=["title"],B_={class:"col-main"},__=["checked","onChange"],uo=Be(d.defineComponent({__name:"LeitingPosition",props:{visible:{type:Boolean},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean}},emits:["update:visible","update:open","close","save"],setup(i,{expose:e,emit:t}){const n=i,s=t,o=d.computed({get:()=>n.open!==void 0?n.open:n.visible,set:G=>{s("update:visible",G),s("update:open",G)}}),r=d.inject("leitingMethods"),a=d.ref("BIM"),l=d.ref("param"),c=d.ref(""),h=d.ref([]),u=d.ref("BIM"),p=d.ref(null),f=d.ref(null),m=d.ref(null),y=()=>(!m.value&&r?.value?.getViewer&&r?.value?.getCesium&&(m.value=new yc(r.value.getViewer(),r.value.getCesium())),m.value),g=()=>{y()?.clearMarkers(),p.value=null,f.value=null},A=(G,k)=>{G==="BIM"?p.value=k:f.value=k,y()?.addMarker(G,k),pe.success(`${G==="BIM"?"BIM":"地图"}标记点已添加`)},v=()=>{y()?.registerPickHandler(G=>{A(u.value,G)})},C=()=>{y()?.destroyPickHandler()},w=()=>{if(!p.value||!f.value){pe.warning("请先选择BIM标记点和地图标记点");return}if(!c.value){pe.warning("请先选择主模型");return}const G=y();let k=0,_=0,U=0;if(G){const{dLon:H,dLat:q,dHeight:X}=G.calculateOffset(p.value,f.value);k=H,_=q,U=X}else k=f.value.longitude-p.value.longitude,_=f.value.latitude-p.value.latitude,U=f.value.height-p.value.height;x.value.longitude+=k,x.value.latitude+=_,x.value.height+=U,E(c.value,{longitude:x.value.longitude,latitude:x.value.latitude,height:x.value.height}),pe.success("位置已调整")};d.watch(()=>l.value,G=>{G==="pick"?v():C()}),e({addMarker:A,setModelType:G=>{(G==="BIM"||G==="OSGB")&&(a.value=G)}});const x=d.ref({longitude:0,latitude:0,lonlat:1e-6,heightDistance:1,rotation:30,totalRotation:0,height:0,X:0,Y:0,Z:0}),I=d.computed(()=>{const G=h.value.find(k=>k.modelId===c.value);return G?G.modelName:""}),S=d.computed(()=>b.value.length>0&&b.value.every(G=>G.selected)),R=()=>{o.value=!1,s("close")},b=d.computed(()=>h.value.filter(G=>G.type===a.value)),B=G=>{const k=G.target.checked;b.value.forEach(_=>_.selected=k)},L=()=>{if(!r?.value)return;const G=r.value,k=G.getMapTileset?G.getMapTileset():{},_=[];if(Object.keys(k).forEach(U=>{const q=k[U].leiting||{};q.model&&_.push({modelId:q.model.modelId,modelName:q.model.modelName,selected:!1,formData:q.model.formData||{},dbName:q.model.dbName,url:q.model.url,type:q.model.type||"BIM"})}),h.value=_,_.length>0){const U=G.getBIMmodelId?G.getBIMmodelId():"";U&&_.find(H=>H.modelId===U)?N(U):N(_[0].modelId),_.forEach(H=>H.selected=!0)}},O=()=>{pe.info("拖动右下角标,可显示模型列表",void 0,2)},N=G=>{c.value=G;const k=h.value.find(_=>_.modelId===G);k&&k.formData&&Object.keys(x.value).forEach(_=>{k.formData[_]!==void 0&&(x.value[_]=k.formData[_])})},D=G=>r?.value?.getMapTileset?r.value.getMapTileset()[G]:null,E=(G,k)=>{const _=D(G),U=r.value.getCesium();if(_&&U){if(_.leiting?.model){_.leiting.model.formData={..._.leiting.model.formData,...k};const H=h.value.find(q=>q.modelId===G);H&&(H.formData=_.leiting.model.formData)}Xa({Cesium:U,tileset:_})}},T=G=>{if(!c.value)return;const _=h.value.find(q=>q.modelId===c.value)?.formData?.[G]??0,U=x.value[G],H=U-_;E(c.value,{[G]:U}),H!==0&&b.value.filter(X=>X.selected&&X.modelId!==c.value).forEach(X=>{const fe=(X.formData?.[G]??0)+H;E(X.modelId,{[G]:fe})})},P=G=>{const k=b.value.filter(q=>q.selected);if(k.length===0){pe.warning("请先选择要调整的模型");return}const{lonlat:_,heightDistance:U,rotation:H}=x.value;k.forEach(q=>{const X={...q.formData};switch(G){case"north":X.latitude+=_;break;case"south":X.latitude-=_;break;case"east":X.longitude+=_;break;case"west":X.longitude-=_;break;case"up":X.height+=U;break;case"down":X.height-=U;break;case"rotateLeft":X.totalRotation=(X.totalRotation||0)+H;break;case"rotateRight":X.totalRotation=(X.totalRotation||0)-H;break}q.modelId===c.value&&(X.lonlat=_,X.heightDistance=U,X.rotation=H,Object.assign(x.value,X)),E(q.modelId,X)})},F=()=>{if(!c.value){pe.warning("请先选择主模型");return}const G=D(c.value);if(!G||!r?.value?.getViewer)return;const k=r.value.getViewer(),_=r.value.getCesium(),U=G.boundingSphere;k.camera.flyToBoundingSphere(U,{offset:new _.HeadingPitchRange(0,_.Math.toRadians(-90),U.radius*2),duration:1.5})},V=()=>{r?.value?.saveRegion?(r.value.saveRegion(h.value),s("save",d.unref(h))):(console.log("Save models:",h.value),pe.warning("未找到保存接口,数据已打印控制台"))};return d.watch(()=>n.visible,G=>{G?(L(),O(),l.value==="pick"&&v()):(C(),g())}),d.onMounted(()=>{n.visible&&(L(),O(),l.value==="pick"&&v())}),(G,k)=>(d.openBlock(),d.createBlock(gt,{visible:o.value,title:"调整位置(调整前可选择正北俯视)","full-height":i.fullHeight,width:260,"onUpdate:visible":k[25]||(k[25]=_=>o.value=_),onClose:R,onSave:V,class:"base-position-card"},{default:d.withCtx(()=>[d.createElementVNode("div",j3,[d.createElementVNode("div",W3,[d.createElementVNode("div",q3,[k[26]||(k[26]=d.createElementVNode("label",null,"模型类型:",-1)),d.createElementVNode("div",K3,[d.createElementVNode("span",{class:d.normalizeClass({active:a.value==="BIM"}),onClick:k[0]||(k[0]=_=>a.value="BIM")},"BIM模型",2),d.createElementVNode("span",{class:d.normalizeClass({active:a.value==="OSGB"}),onClick:k[1]||(k[1]=_=>a.value="OSGB")},"倾斜摄影",2)])]),d.createElementVNode("div",X3,[k[27]||(k[27]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",J3,[d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="param"}),onClick:k[2]||(k[2]=_=>l.value="param")},"参数模式",2),d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="pick"}),onClick:k[3]||(k[3]=_=>l.value="pick")},"地图点选",2)])]),d.createElementVNode("div",Z3,[k[28]||(k[28]=d.createElementVNode("label",null,"当前主模型:",-1)),d.createElementVNode("span",e_,d.toDisplayString(I.value||"未选择"),1)]),k[42]||(k[42]=d.createElementVNode("div",{class:"separator"},null,-1)),l.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[k[36]||(k[36]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",t_,[k[29]||(k[29]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[4]||(k[4]=_=>x.value.longitude=_),onChange:k[5]||(k[5]=_=>T("longitude")),step:"0.000001"},null,544),[[d.vModelText,x.value.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",i_,[k[30]||(k[30]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[6]||(k[6]=_=>x.value.latitude=_),onChange:k[7]||(k[7]=_=>T("latitude")),step:"0.000001"},null,544),[[d.vModelText,x.value.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",n_,[k[31]||(k[31]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[8]||(k[8]=_=>x.value.height=_),onChange:k[9]||(k[9]=_=>T("height")),step:"0.1"},null,544),[[d.vModelText,x.value.height,void 0,{number:!0}]])]),d.createElementVNode("div",s_,[k[32]||(k[32]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[10]||(k[10]=_=>x.value.totalRotation=_),onChange:k[11]||(k[11]=_=>T("totalRotation")),step:"1"},null,544),[[d.vModelText,x.value.totalRotation,void 0,{number:!0}]])]),k[37]||(k[37]=d.createElementVNode("div",{class:"separator"},null,-1)),k[38]||(k[38]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",o_,[k[33]||(k[33]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[12]||(k[12]=_=>x.value.lonlat=_),step:"0.000001"},null,512),[[d.vModelText,x.value.lonlat,void 0,{number:!0}]])]),d.createElementVNode("div",r_,[k[34]||(k[34]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[13]||(k[13]=_=>x.value.heightDistance=_),step:"0.1"},null,512),[[d.vModelText,x.value.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",a_,[k[35]||(k[35]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":k[14]||(k[14]=_=>x.value.rotation=_),step:"1"},null,512),[[d.vModelText,x.value.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",l_,[d.createElementVNode("button",{onClick:k[15]||(k[15]=_=>P("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:k[16]||(k[16]=_=>P("north"))},"北移"),d.createElementVNode("button",{onClick:k[17]||(k[17]=_=>P("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:k[18]||(k[18]=_=>P("west"))},"西移"),d.createElementVNode("button",{onClick:k[19]||(k[19]=_=>P("south"))},"南移"),d.createElementVNode("button",{onClick:k[20]||(k[20]=_=>P("east"))},"东移"),d.createElementVNode("button",{onClick:k[21]||(k[21]=_=>P("up"))},"上移"),d.createElementVNode("button",{onClick:k[22]||(k[22]=_=>P("down"))},"下移"),d.createElementVNode("button",{onClick:F,class:"primary-btn"},"正北俯视"),d.createElementVNode("button",{onClick:V,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):l.value==="pick"?(d.openBlock(),d.createElementBlock("div",c_,[d.createElementVNode("div",d_,[d.createElementVNode("div",h_,[d.createElementVNode("div",{onClick:k[23]||(k[23]=_=>u.value="BIM"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[d.createElementVNode("input",{type:"radio",checked:u.value==="BIM",style:{"margin-right":"5px"}},null,8,u_),k[39]||(k[39]=d.createElementVNode("span",{style:{"font-weight":"bold"}},"BIM标记点:",-1))]),p.value?(d.openBlock(),d.createElementBlock("div",f_,[d.createElementVNode("div",null,"经度:"+d.toDisplayString(p.value.longitude.toFixed(10)),1),d.createElementVNode("div",null,"纬度:"+d.toDisplayString(p.value.latitude.toFixed(10)),1)])):(d.openBlock(),d.createElementBlock("div",p_,"未选择"))])]),d.createElementVNode("div",m_,[d.createElementVNode("div",g_,[d.createElementVNode("div",{onClick:k[24]||(k[24]=_=>u.value="MAP"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[d.createElementVNode("input",{type:"radio",checked:u.value==="MAP",style:{"margin-right":"5px"}},null,8,y_),k[40]||(k[40]=d.createElementVNode("span",{style:{"font-weight":"bold"}},"地图标记点:",-1))]),f.value?(d.openBlock(),d.createElementBlock("div",A_,[d.createElementVNode("div",null,"经度:"+d.toDisplayString(f.value.longitude.toFixed(10)),1),d.createElementVNode("div",null,"纬度:"+d.toDisplayString(f.value.latitude.toFixed(10)),1)])):(d.openBlock(),d.createElementBlock("div",v_,"未选择"))])]),d.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[d.createElementVNode("button",{onClick:w},"调整位置"),d.createElementVNode("button",{onClick:V},"保存")]),k[41]||(k[41]=d.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 勾选上方 BIM 或 地图 标记点选项。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“调整位置”进行校准。")],-1))])):d.createCommentVNode("",!0)]),d.createElementVNode("div",b_,[d.createElementVNode("div",C_,[d.createElementVNode("div",w_,[d.createElementVNode("input",{type:"checkbox",checked:S.value,onChange:B},null,40,E_)]),k[43]||(k[43]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),k[44]||(k[44]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),k[45]||(k[45]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",x_,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(b.value,(_,U)=>(d.openBlock(),d.createElementBlock("div",{key:_.modelId,class:d.normalizeClass(["list-item",{active:_.modelId===c.value}])},[d.createElementVNode("div",I_,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":H=>_.selected=H},null,8,S_),[[d.vModelCheckbox,_.selected]])]),d.createElementVNode("div",M_,d.toDisplayString(U+1),1),d.createElementVNode("div",{class:"col-name",title:_.modelName},d.toDisplayString(_.modelName),9,T_),d.createElementVNode("div",B_,[d.createElementVNode("input",{type:"radio",name:"mainModel",checked:_.modelId===c.value,onChange:H=>N(_.modelId)},null,40,__)])],2))),128))])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-fd4822ea"]]);function Ur(){return Ur=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},Ur.apply(null,arguments)}const k_={locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",yearFormat:"YYYY年",dayFormat:"D日",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH时mm分ss秒",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"},P_={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},vm={lang:Ur({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},k_),timePickerLocale:Ur({},P_)};vm.lang.ok="确定";var Vr={exports:{}},D_=Vr.exports,bm;function Cm(){return bm||(bm=1,(function(i,e){(function(t,n){i.exports=n()})(D_,(function(){var t=1e3,n=6e4,s=36e5,o="millisecond",r="second",a="minute",l="hour",c="day",h="week",u="month",p="quarter",f="year",m="date",y="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,A=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var D=["th","st","nd","rd"],E=N%100;return"["+N+(D[(E-20)%10]||D[E]||D[0])+"]"}},C=function(N,D,E){var T=String(N);return!T||T.length>=D?N:""+Array(D+1-T.length).join(E)+N},w={s:C,z:function(N){var D=-N.utcOffset(),E=Math.abs(D),T=Math.floor(E/60),P=E%60;return(D<=0?"+":"-")+C(T,2,"0")+":"+C(P,2,"0")},m:function N(D,E){if(D.date()<E.date())return-N(E,D);var T=12*(E.year()-D.year())+(E.month()-D.month()),P=D.clone().add(T,u),F=E-P<0,V=D.clone().add(T+(F?-1:1),u);return+(-(T+(E-P)/(F?P-V:V-P))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:u,y:f,w:h,d:c,D:m,h:l,m:a,s:r,ms:o,Q:p}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},M="en",x={};x[M]=v;var I="$isDayjsObject",S=function(N){return N instanceof L||!(!N||!N[I])},R=function N(D,E,T){var P;if(!D)return M;if(typeof D=="string"){var F=D.toLowerCase();x[F]&&(P=F),E&&(x[F]=E,P=F);var V=D.split("-");if(!P&&V.length>1)return N(V[0])}else{var G=D.name;x[G]=D,P=G}return!T&&P&&(M=P),P||!T&&M},b=function(N,D){if(S(N))return N.clone();var E=typeof D=="object"?D:{};return E.date=N,E.args=arguments,new L(E)},B=w;B.l=R,B.i=S,B.w=function(N,D){return b(N,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var L=(function(){function N(E){this.$L=R(E.locale,null,!0),this.parse(E),this.$x=this.$x||E.x||{},this[I]=!0}var D=N.prototype;return D.parse=function(E){this.$d=(function(T){var P=T.date,F=T.utc;if(P===null)return new Date(NaN);if(B.u(P))return new Date;if(P instanceof Date)return new Date(P);if(typeof P=="string"&&!/Z$/i.test(P)){var V=P.match(g);if(V){var G=V[2]-1||0,k=(V[7]||"0").substring(0,3);return F?new Date(Date.UTC(V[1],G,V[3]||1,V[4]||0,V[5]||0,V[6]||0,k)):new Date(V[1],G,V[3]||1,V[4]||0,V[5]||0,V[6]||0,k)}}return new Date(P)})(E),this.init()},D.init=function(){var E=this.$d;this.$y=E.getFullYear(),this.$M=E.getMonth(),this.$D=E.getDate(),this.$W=E.getDay(),this.$H=E.getHours(),this.$m=E.getMinutes(),this.$s=E.getSeconds(),this.$ms=E.getMilliseconds()},D.$utils=function(){return B},D.isValid=function(){return this.$d.toString()!==y},D.isSame=function(E,T){var P=b(E);return this.startOf(T)<=P&&P<=this.endOf(T)},D.isAfter=function(E,T){return b(E)<this.startOf(T)},D.isBefore=function(E,T){return this.endOf(T)<b(E)},D.$g=function(E,T,P){return B.u(E)?this[T]:this.set(P,E)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(E,T){var P=this,F=!!B.u(T)||T,V=B.p(E),G=function(fe,me){var be=B.w(P.$u?Date.UTC(P.$y,me,fe):new Date(P.$y,me,fe),P);return F?be:be.endOf(c)},k=function(fe,me){return B.w(P.toDate()[fe].apply(P.toDate("s"),(F?[0,0,0,0]:[23,59,59,999]).slice(me)),P)},_=this.$W,U=this.$M,H=this.$D,q="set"+(this.$u?"UTC":"");switch(V){case f:return F?G(1,0):G(31,11);case u:return F?G(1,U):G(0,U+1);case h:var X=this.$locale().weekStart||0,de=(_<X?_+7:_)-X;return G(F?H-de:H+(6-de),U);case c:case m:return k(q+"Hours",0);case l:return k(q+"Minutes",1);case a:return k(q+"Seconds",2);case r:return k(q+"Milliseconds",3);default:return this.clone()}},D.endOf=function(E){return this.startOf(E,!1)},D.$set=function(E,T){var P,F=B.p(E),V="set"+(this.$u?"UTC":""),G=(P={},P[c]=V+"Date",P[m]=V+"Date",P[u]=V+"Month",P[f]=V+"FullYear",P[l]=V+"Hours",P[a]=V+"Minutes",P[r]=V+"Seconds",P[o]=V+"Milliseconds",P)[F],k=F===c?this.$D+(T-this.$W):T;if(F===u||F===f){var _=this.clone().set(m,1);_.$d[G](k),_.init(),this.$d=_.set(m,Math.min(this.$D,_.daysInMonth())).$d}else G&&this.$d[G](k);return this.init(),this},D.set=function(E,T){return this.clone().$set(E,T)},D.get=function(E){return this[B.p(E)]()},D.add=function(E,T){var P,F=this;E=Number(E);var V=B.p(T),G=function(U){var H=b(F);return B.w(H.date(H.date()+Math.round(U*E)),F)};if(V===u)return this.set(u,this.$M+E);if(V===f)return this.set(f,this.$y+E);if(V===c)return G(1);if(V===h)return G(7);var k=(P={},P[a]=n,P[l]=s,P[r]=t,P)[V]||1,_=this.$d.getTime()+E*k;return B.w(_,this)},D.subtract=function(E,T){return this.add(-1*E,T)},D.format=function(E){var T=this,P=this.$locale();if(!this.isValid())return P.invalidDate||y;var F=E||"YYYY-MM-DDTHH:mm:ssZ",V=B.z(this),G=this.$H,k=this.$m,_=this.$M,U=P.weekdays,H=P.months,q=P.meridiem,X=function(me,be,_e,Je){return me&&(me[be]||me(T,F))||_e[be].slice(0,Je)},de=function(me){return B.s(G%12||12,me,"0")},fe=q||function(me,be,_e){var Je=me<12?"AM":"PM";return _e?Je.toLowerCase():Je};return F.replace(A,(function(me,be){return be||(function(_e){switch(_e){case"YY":return String(T.$y).slice(-2);case"YYYY":return B.s(T.$y,4,"0");case"M":return _+1;case"MM":return B.s(_+1,2,"0");case"MMM":return X(P.monthsShort,_,H,3);case"MMMM":return X(H,_);case"D":return T.$D;case"DD":return B.s(T.$D,2,"0");case"d":return String(T.$W);case"dd":return X(P.weekdaysMin,T.$W,U,2);case"ddd":return X(P.weekdaysShort,T.$W,U,3);case"dddd":return U[T.$W];case"H":return String(G);case"HH":return B.s(G,2,"0");case"h":return de(1);case"hh":return de(2);case"a":return fe(G,k,!0);case"A":return fe(G,k,!1);case"m":return String(k);case"mm":return B.s(k,2,"0");case"s":return String(T.$s);case"ss":return B.s(T.$s,2,"0");case"SSS":return B.s(T.$ms,3,"0");case"Z":return V}return null})(me)||V.replace(":","")}))},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(E,T,P){var F,V=this,G=B.p(T),k=b(E),_=(k.utcOffset()-this.utcOffset())*n,U=this-k,H=function(){return B.m(V,k)};switch(G){case f:F=H()/12;break;case u:F=H();break;case p:F=H()/3;break;case h:F=(U-_)/6048e5;break;case c:F=(U-_)/864e5;break;case l:F=U/s;break;case a:F=U/n;break;case r:F=U/t;break;default:F=U}return P?F:B.a(F)},D.daysInMonth=function(){return this.endOf(u).$D},D.$locale=function(){return x[this.$L]},D.locale=function(E,T){if(!E)return this.$L;var P=this.clone(),F=R(E,T,!0);return F&&(P.$L=F),P},D.clone=function(){return B.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},N})(),O=L.prototype;return b.prototype=O,[["$ms",o],["$s",r],["$m",a],["$H",l],["$W",c],["$M",u],["$y",f],["$D",m]].forEach((function(N){O[N[1]]=function(D){return this.$g(D,N[0],N[1])}})),b.extend=function(N,D){return N.$i||(N(D,L,b),N.$i=!0),b},b.locale=R,b.isDayjs=S,b.unix=function(N){return b(1e3*N)},b.en=x[M],b.Ls=x,b.p={},b}))})(Vr)),Vr.exports}var N_=Cm();const zt=nn(N_);var Qr={exports:{}},L_=Qr.exports,wm;function R_(){return wm||(wm=1,(function(i,e){(function(t,n){i.exports=n(Cm())})(L_,(function(t){function n(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var s=n(t),o={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(r,a){return a==="W"?r+"周":r+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(r,a){var l=100*r+a;return l<600?"凌晨":l<900?"早上":l<1100?"上午":l<1300?"中午":l<1800?"下午":"晚上"}};return s.default.locale(o,null,!0),o}))})(Qr)),Qr.exports}R_();var zr={exports:{}},F_=zr.exports,Em;function O_(){return Em||(Em=1,(function(i,e){(function(t,n){i.exports=n()})(F_,(function(){return function(t,n,s){var o=n.prototype,r=function(u){return u&&(u.indexOf?u:u.s)},a=function(u,p,f,m,y){var g=u.name?u:u.$locale(),A=r(g[p]),v=r(g[f]),C=A||v.map((function(M){return M.slice(0,m)}));if(!y)return C;var w=g.weekStart;return C.map((function(M,x){return C[(x+(w||0))%7]}))},l=function(){return s.Ls[s.locale()]},c=function(u,p){return u.formats[p]||(function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(m,y,g){return y||g.slice(1)}))})(u.formats[p.toUpperCase()])},h=function(){var u=this;return{months:function(p){return p?p.format("MMMM"):a(u,"months")},monthsShort:function(p){return p?p.format("MMM"):a(u,"monthsShort","months",3)},firstDayOfWeek:function(){return u.$locale().weekStart||0},weekdays:function(p){return p?p.format("dddd"):a(u,"weekdays")},weekdaysMin:function(p){return p?p.format("dd"):a(u,"weekdaysMin","weekdays",2)},weekdaysShort:function(p){return p?p.format("ddd"):a(u,"weekdaysShort","weekdays",3)},longDateFormat:function(p){return c(u.$locale(),p)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return h.bind(this)()},s.localeData=function(){var u=l();return{firstDayOfWeek:function(){return u.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(p){return c(u,p)},meridiem:u.meridiem,ordinal:u.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(u){return a(l(),"weekdays",null,null,u)},s.weekdaysShort=function(u){return a(l(),"weekdaysShort","weekdays",3,u)},s.weekdaysMin=function(u){return a(l(),"weekdaysMin","weekdays",2,u)}}}))})(zr)),zr.exports}var G_=O_();const U_=nn(G_);var Hr={exports:{}},V_=Hr.exports,xm;function Q_(){return xm||(xm=1,(function(i,e){(function(t,n){i.exports=n()})(V_,(function(){return function(t,n){n.prototype.weekday=function(s){var o=this.$locale().weekStart||0,r=this.$W,a=(r<o?r+7:r)-o;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}}))})(Hr)),Hr.exports}var z_=Q_();const H_=nn(z_);var Yr={exports:{}},Y_=Yr.exports,Im;function $_(){return Im||(Im=1,(function(i,e){(function(t,n){i.exports=n()})(Y_,(function(){var t="week",n="year";return function(s,o,r){var a=o.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var h=r(this).startOf(n).add(1,n).date(c),u=r(this).endOf(t);if(h.isBefore(u))return 1}var p=r(this).startOf(n).date(c).startOf(t).subtract(1,"millisecond"),f=this.diff(p,t,!0);return f<0?r(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(Yr)),Yr.exports}var j_=$_();const W_=nn(j_);var $r={exports:{}},q_=$r.exports,Sm;function K_(){return Sm||(Sm=1,(function(i,e){(function(t,n){i.exports=n()})(q_,(function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},n=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,o=/\d\d/,r=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},c=function(g){return(g=+g)+(g>68?1900:2e3)},h=function(g){return function(A){this[g]=+A}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(g){(this.zone||(this.zone={})).offset=(function(A){if(!A||A==="Z")return 0;var v=A.match(/([+-]|\d\d)/g),C=60*v[1]+(+v[2]||0);return C===0?0:v[0]==="+"?-C:C})(g)}],p=function(g){var A=l[g];return A&&(A.indexOf?A:A.s.concat(A.f))},f=function(g,A){var v,C=l.meridiem;if(C){for(var w=1;w<=24;w+=1)if(g.indexOf(C(w,0,A))>-1){v=w>12;break}}else v=g===(A?"pm":"PM");return v},m={A:[a,function(g){this.afternoon=f(g,!1)}],a:[a,function(g){this.afternoon=f(g,!0)}],Q:[s,function(g){this.month=3*(g-1)+1}],S:[s,function(g){this.milliseconds=100*+g}],SS:[o,function(g){this.milliseconds=10*+g}],SSS:[/\d{3}/,function(g){this.milliseconds=+g}],s:[r,h("seconds")],ss:[r,h("seconds")],m:[r,h("minutes")],mm:[r,h("minutes")],H:[r,h("hours")],h:[r,h("hours")],HH:[r,h("hours")],hh:[r,h("hours")],D:[r,h("day")],DD:[o,h("day")],Do:[a,function(g){var A=l.ordinal,v=g.match(/\d+/);if(this.day=v[0],A)for(var C=1;C<=31;C+=1)A(C).replace(/\[|\]/g,"")===g&&(this.day=C)}],w:[r,h("week")],ww:[o,h("week")],M:[r,h("month")],MM:[o,h("month")],MMM:[a,function(g){var A=p("months"),v=(p("monthsShort")||A.map((function(C){return C.slice(0,3)}))).indexOf(g)+1;if(v<1)throw new Error;this.month=v%12||v}],MMMM:[a,function(g){var A=p("months").indexOf(g)+1;if(A<1)throw new Error;this.month=A%12||A}],Y:[/[+-]?\d+/,h("year")],YY:[o,function(g){this.year=c(g)}],YYYY:[/\d{4}/,h("year")],Z:u,ZZ:u};function y(g){var A,v;A=g,v=l&&l.formats;for(var C=(g=A.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(b,B,L){var O=L&&L.toUpperCase();return B||v[L]||t[L]||v[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(N,D,E){return D||E.slice(1)}))}))).match(n),w=C.length,M=0;M<w;M+=1){var x=C[M],I=m[x],S=I&&I[0],R=I&&I[1];C[M]=R?{regex:S,parser:R}:x.replace(/^\[|\]$/g,"")}return function(b){for(var B={},L=0,O=0;L<w;L+=1){var N=C[L];if(typeof N=="string")O+=N.length;else{var D=N.regex,E=N.parser,T=b.slice(O),P=D.exec(T)[0];E.call(B,P),b=b.replace(P,"")}}return(function(F){var V=F.afternoon;if(V!==void 0){var G=F.hours;V?G<12&&(F.hours+=12):G===12&&(F.hours=0),delete F.afternoon}})(B),B}}return function(g,A,v){v.p.customParseFormat=!0,g&&g.parseTwoDigitYear&&(c=g.parseTwoDigitYear);var C=A.prototype,w=C.parse;C.parse=function(M){var x=M.date,I=M.utc,S=M.args;this.$u=I;var R=S[1];if(typeof R=="string"){var b=S[2]===!0,B=S[3]===!0,L=b||B,O=S[2];B&&(O=S[2]),l=this.$locale(),!b&&O&&(l=v.Ls[O]),this.$d=(function(T,P,F,V){try{if(["x","X"].indexOf(P)>-1)return new Date((P==="X"?1e3:1)*T);var G=y(P)(T),k=G.year,_=G.month,U=G.day,H=G.hours,q=G.minutes,X=G.seconds,de=G.milliseconds,fe=G.zone,me=G.week,be=new Date,_e=U||(k||_?1:be.getDate()),Je=k||be.getFullYear(),lt=0;k&&!_||(lt=_>0?_-1:be.getMonth());var ct,Bt=H||0,vt=q||0,j=X||0,Y=de||0;return fe?new Date(Date.UTC(Je,lt,_e,Bt,vt,j,Y+60*fe.offset*1e3)):F?new Date(Date.UTC(Je,lt,_e,Bt,vt,j,Y)):(ct=new Date(Je,lt,_e,Bt,vt,j,Y),me&&(ct=V(ct).week(me).toDate()),ct)}catch{return new Date("")}})(x,R,I,v),this.init(),O&&O!==!0&&(this.$L=this.locale(O).$L),L&&x!=this.format(R)&&(this.$d=new Date("")),l={}}else if(R instanceof Array)for(var N=R.length,D=1;D<=N;D+=1){S[1]=R[D-1];var E=v.apply(this,S);if(E.isValid()){this.$d=E.$d,this.$L=E.$L,this.init();break}D===N&&(this.$d=new Date(""))}else w.call(this,M)}}}))})($r)),$r.exports}var X_=K_();const J_=nn(X_),Z_={class:"setting-panel"},ek={class:"tabs-header"},tk={class:"tab-content"},ik={key:0,class:"section"},nk={class:"setting-item"},sk={class:"setting-item"},ok={class:"setting-item"},rk={key:1,class:"section"},ak={class:"tabs-header",style:{"margin-bottom":"8px"}},lk={key:0},ck={class:"setting-item column"},dk={class:"setting-item"},hk={key:1},uk={class:"setting-item column"},fk={class:"setting-item column",style:{"margin-top":"12px","border-top":"1px solid rgba(255,255,255,0.1)","padding-top":"8px"}},pk={class:"search-box",style:{position:"relative"}},mk={key:0,class:"search-dropdown"},gk=["onClick"],yk={class:"result-name"},Ak={class:"result-coord"},vk={key:2,class:"section"},bk={class:"setting-item"},Ck={key:0,class:"setting-item column"},wk={class:"sub-label"},Ek={class:"setting-item"},xk={class:"setting-item"},Ik={class:"setting-item column"},Sk={class:"setting-item column"},Mk={class:"sub-label"},Tk={class:"setting-item column"},Bk={class:"sub-label"},_k={class:"setting-item column"},kk={class:"sub-label"},Pk={class:"setting-item column"},Dk={style:{display:"flex",gap:"8px","margin-bottom":"8px"}},Nk=["onClick","title"],Lk={style:{display:"flex",gap:"8px","align-items":"center"}},Rk={key:3,class:"section"},Fk={class:"setting-item"},Ok={class:"setting-item column"},fo=Be(d.defineComponent({__name:"LeitingSetting",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean,default:!1},tiandituToken:{type:String,default:""},initialConfig:{type:Object,default:()=>({})}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){zt.locale("zh-cn"),zt.extend(U_),zt.extend(H_),zt.extend(W_),zt.extend(J_);const t=oe.Switch,n=oe.Radio.Group,s=oe.Radio,o=oe.Input,r=oe.Slider,a=oe.Select,l=oe.Select.Option,c=oe.DatePicker,h=i,u=e,p=d.inject("leitingMethods"),f=d.computed({get:()=>h.open!==void 0?h.open:h.visible,set:E=>{u("update:visible",E),u("update:open",E)}}),m=d.ref("GIS"),y=d.reactive({globe:!1,terrain:!1,depthTest:!1}),g=d.reactive({provider:"tianditu",tianditu:{token:"c25f14fb6bd4397cf8fe45144ff768d6",layerType:"img_w",showLabel:!1},arcgis:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"},baseMap:"tianditu"}),A=d.reactive({shadows:!1,shadowDarkness:.7,environmentMap:!1,ambientOcclusion:!1,time:zt("2025-06-22 10:00"),brightness:1,contrast:1,saturation:1,backgroundColor:"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)"}),v=d.reactive({collision:!1,habit:0}),C=E=>{E&&(E.globe!==void 0&&(y.globe=E.globe),E.terrain!==void 0&&(y.terrain=E.terrain),E.depthTest!==void 0&&(y.depthTest=E.depthTest),E.mapProvider!==void 0&&(g.provider=E.mapProvider),E.tiandituLayerType!==void 0&&(g.tianditu.layerType=E.tiandituLayerType),E.tiandituShowLabel!==void 0&&(g.tianditu.showLabel=E.tiandituShowLabel),E.arcgisUrl!==void 0&&(g.arcgis.url=E.arcgisUrl),E.shadows!==void 0&&(A.shadows=E.shadows),E.shadowDarkness!==void 0&&(A.shadowDarkness=E.shadowDarkness),E.environmentMap!==void 0&&(A.environmentMap=E.environmentMap),E.ambientOcclusion!==void 0&&(A.ambientOcclusion=E.ambientOcclusion),E.time!==void 0&&(typeof E.time=="number"?A.time=zt().startOf("day").add(E.time,"hour"):A.time=zt(E.time)),E.brightness!==void 0&&(A.brightness=E.brightness),E.contrast!==void 0&&(A.contrast=E.contrast),E.saturation!==void 0&&(A.saturation=E.saturation),E.backgroundColor!==void 0&&(A.backgroundColor=E.backgroundColor),E.collision!==void 0&&(v.collision=E.collision),E.mouseHabit!==void 0&&(v.habit=E.mouseHabit))};d.watch(()=>h.initialConfig,E=>{C(E)},{deep:!0,immediate:!0});const w=["linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)","linear-gradient(0deg, #0f2027 0%, #203a43 50%, #2c5364 100%)","linear-gradient(0deg, #cfd9df 0%, #e2ebf0 100%)"],M=[{label:"全球影像地图服务(墨卡托)",value:"img_w"},{label:"全球影像地图服务(经纬度)",value:"img_c"},{label:"全球矢量地图服务(墨卡托)",value:"vec_w"},{label:"全球矢量地图服务(经纬度)",value:"vec_c"},{label:"全球地形晕渲服务(墨卡托)",value:"ter_w"},{label:"全球地形晕渲服务(经纬度)",value:"ter_c"}],x=()=>{const E=g.provider,T={};E==="tianditu"?(T.token=g.tianditu.token,T.layerType=g.tianditu.layerType,T.showAnnotation=g.tianditu.showLabel):E==="arcgis"&&(T.url=g.arcgis.url),p.value?.changeBaseMap?.(E,T)};d.watch(()=>g.provider,x),d.watch(()=>g.tianditu.layerType,x),d.watch(()=>g.tianditu.showLabel,x),d.watch(()=>g.tianditu.token,qo(x,1e3)),d.watch(()=>g.arcgis.url,qo(x,1e3)),d.onMounted(()=>{h.tiandituToken&&(g.tianditu.token=h.tiandituToken)}),d.watch(()=>y.globe,E=>p.value?.setGlobeEnvironmentVisible?.(E)),d.watch(()=>y.terrain,E=>p.value?.setTerrainEnable?.(E)),d.watch(()=>y.depthTest,E=>p.value?.setDepthTestEnable?.(E)),d.watch(()=>p?.value,E=>{if(E){if(E.getConfigure=()=>({globe:y.globe,terrain:y.terrain,depthTest:y.depthTest,mapProvider:g.provider,tiandituLayerType:g.tianditu.layerType,tiandituShowLabel:g.tianditu.showLabel,arcgisUrl:g.arcgis.url,shadows:A.shadows,shadowDarkness:A.shadowDarkness,environmentMap:A.environmentMap,ambientOcclusion:A.ambientOcclusion,time:zt.isDayjs(A.time)?A.time.format("YYYY-MM-DD HH:mm"):A.time,brightness:A.brightness,contrast:A.contrast,saturation:A.saturation,backgroundColor:A.backgroundColor,collision:v.collision,mouseHabit:v.habit}),E.setConfigure=T=>{C(T)},E.setBackgroundColor&&A.backgroundColor&&E.setBackgroundColor(A.backgroundColor),E.setGlobeEnvironmentVisible&&E.setGlobeEnvironmentVisible(y.globe),E.setShadowsEnable&&E.setShadowsEnable(A.shadows),E.setShadowDarkness&&E.setShadowDarkness(A.shadowDarkness),E.setEnvironmentMapEnable&&E.setEnvironmentMapEnable(A.environmentMap),E.setAmbientOcclusion&&E.setAmbientOcclusion(A.ambientOcclusion),E.setTime){const T=zt.isDayjs(A.time)?A.time.toDate():new Date;E.setTime(T)}E.setModelBrightness&&E.setModelBrightness(A.brightness),E.setCollisionDetection&&E.setCollisionDetection(v.collision),E.setMouseHabit&&E.setMouseHabit(v.habit),E.changeBaseMap&&g.baseMap&&E.changeBaseMap(g.baseMap,{token:g.tianditu.token,layerType:g.tianditu.layerType,showAnnotation:g.tianditu.showLabel,url:g.arcgis.url})}},{immediate:!0});const I=d.computed({get:()=>{const E=A.backgroundColor;return/^#[0-9A-Fa-f]{6}$/.test(E)?E:"#ffffff"},set:E=>{A.backgroundColor=E}}),S=d.ref(""),R=d.ref(!1),b=d.ref([]);d.watch(()=>y.globe,E=>p.value?.setGlobeEnvironmentVisible?.(E)),d.watch(()=>y.terrain,E=>p.value?.setTerrainEnable?.(E)),d.watch(()=>g.baseMap,E=>{p.value?.changeBaseMap?.(E,{token:h.tiandituToken})}),d.watch(()=>A.shadows,E=>p.value?.setShadowsEnable?.(E)),d.watch(()=>A.shadowDarkness,E=>p.value?.setShadowDarkness?.(E)),d.watch(()=>A.environmentMap,E=>p.value?.setEnvironmentMapEnable?.(E)),d.watch(()=>A.ambientOcclusion,E=>p.value?.setAmbientOcclusion?.(E)),d.watch(()=>A.time,E=>{const T=zt.isDayjs(E)?E.toDate():new Date;p.value?.setTime?.(T)}),d.watch(()=>[A.brightness,A.contrast,A.saturation],([E,T,P])=>{const F=p.value;F?.setModelColorAdjustment?F.setModelColorAdjustment({brightness:E,contrast:T,saturation:P}):F?.setModelBrightness?.(E)}),d.watch(()=>A.backgroundColor,E=>{if(p.value?.setBackgroundColor)p.value.setBackgroundColor(E);else{const T=document.querySelector(".cesium-viewer");T&&(T.style.background=E)}}),d.watch(()=>v.collision,E=>p.value?.setCollisionDetection?.(E)),d.watch(()=>v.habit,E=>p.value?.setMouseHabit?.(E));const B=E=>{const T=[];if(E?.pois&&Array.isArray(E.pois)){for(const P of E.pois)if(P.lonlat){const F=P.lonlat.split(/[, ]/).map(Number);F.length>=2&&!isNaN(F[0])&&!isNaN(F[1])&&T.push({name:P.name||"未命名",lon:F[0],lat:F[1],raw:P})}}if(E?.area&&E.area.lonlat){const P=E.area,F=P.lonlat.split(/[, ]/).map(Number);F.length>=2&&!isNaN(F[0])&&!isNaN(F[1])&&T.push({name:P.name||"未命名",lon:F[0],lat:F[1],raw:P})}if(E?.prompt&&Array.isArray(E.prompt)){for(const P of E.prompt)if(P.admins&&Array.isArray(P.admins)){for(const F of P.admins)if(F.lonlat){const V=F.lonlat.split(/[, ]/).map(Number);V.length>=2&&!isNaN(V[0])&&!isNaN(V[1])&&T.push({name:F.adminName||F.name||"未命名",lon:V[0],lat:V[1],raw:F})}}}return T},O=qo(async()=>{const E=(S.value||"").trim();if(!E){b.value=[];return}const T=h.tiandituToken||"c25f14fb6bd4397cf8fe45144ff768d6";R.value=!0,b.value=[];try{const F=`https://api.tianditu.gov.cn/v2/search?postStr=${encodeURIComponent(JSON.stringify({keyWord:E,level:12,mapBound:"-180,-90,180,90",queryType:1,start:0,count:10}))}&type=query&tk=${encodeURIComponent(T)}`,V=await fetch(F);if(!V.ok)throw new Error(`HTTP ${V.status}`);const G=await V.json();b.value=B(G)}catch(P){console.error("tianditu search error",P)}finally{R.value=!1}},800);d.watch(S,()=>{O()});const N=E=>{p.value?.flyToLonLatHeight?.(E.lon,E.lat,5e3),S.value=E.name,b.value=[]},D=()=>{f.value=!1,u("close")};return d.onMounted(()=>{}),(E,T)=>(d.openBlock(),d.createBlock(gt,{visible:f.value,title:"设置","full-height":i.fullHeight,onClose:D,"onUpdate:visible":T[25]||(T[25]=P=>f.value=P)},{default:d.withCtx(()=>[d.createElementVNode("div",Z_,[d.createElementVNode("div",ek,[d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="GIS"}]),onClick:T[0]||(T[0]=P=>m.value="GIS")},"GIS",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="MAP"}]),onClick:T[1]||(T[1]=P=>m.value="MAP")},"地图",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="RENDER"}]),onClick:T[2]||(T[2]=P=>m.value="RENDER")},"渲染",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="MOUSE"}]),onClick:T[3]||(T[3]=P=>m.value="MOUSE")},"鼠标",2)]),d.createElementVNode("div",tk,[m.value==="GIS"?(d.openBlock(),d.createElementBlock("div",ik,[d.createElementVNode("div",nk,[T[26]||(T[26]=d.createElementVNode("span",null,"地球 (含大气/日月/星空)",-1)),d.createVNode(d.unref(t),{checked:y.globe,"onUpdate:checked":T[4]||(T[4]=P=>y.globe=P),size:"small"},null,8,["checked"])]),d.createElementVNode("div",sk,[T[27]||(T[27]=d.createElementVNode("span",null,"地形 (高程)",-1)),d.createVNode(d.unref(t),{checked:y.terrain,"onUpdate:checked":T[5]||(T[5]=P=>y.terrain=P),size:"small"},null,8,["checked"])]),d.createElementVNode("div",ok,[T[28]||(T[28]=d.createElementVNode("span",null,"地形遮挡",-1)),d.createVNode(d.unref(t),{checked:y.depthTest,"onUpdate:checked":T[6]||(T[6]=P=>y.depthTest=P),size:"small"},null,8,["checked"])])])):d.createCommentVNode("",!0),m.value==="MAP"?(d.openBlock(),d.createElementBlock("div",rk,[d.createElementVNode("div",ak,[d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:g.provider==="tianditu"}]),onClick:T[7]||(T[7]=P=>g.provider="tianditu")},"天地图",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:g.provider==="arcgis"}]),onClick:T[8]||(T[8]=P=>g.provider="arcgis")},"ArcGIS",2)]),g.provider==="tianditu"?(d.openBlock(),d.createElementBlock("div",lk,[d.createElementVNode("div",ck,[T[29]||(T[29]=d.createElementVNode("div",{class:"sub-label"},"地图风格",-1)),d.createVNode(d.unref(a),{value:g.tianditu.layerType,"onUpdate:value":T[9]||(T[9]=P=>g.tianditu.layerType=P),size:"small",style:{width:"100%"}},{default:d.withCtx(()=>[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(M,P=>d.createVNode(d.unref(l),{key:P.value,value:P.value},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(P.label),1)]),_:2},1032,["value"])),64))]),_:1},8,["value"])]),d.createElementVNode("div",dk,[T[30]||(T[30]=d.createElementVNode("span",null,"路网注记",-1)),d.createVNode(d.unref(t),{checked:g.tianditu.showLabel,"onUpdate:checked":T[10]||(T[10]=P=>g.tianditu.showLabel=P),size:"small"},null,8,["checked"])])])):d.createCommentVNode("",!0),g.provider==="arcgis"?(d.openBlock(),d.createElementBlock("div",hk,[d.createElementVNode("div",uk,[T[31]||(T[31]=d.createElementVNode("div",{class:"sub-label"},"服务地址",-1)),d.createVNode(d.unref(o),{value:g.arcgis.url,"onUpdate:value":T[11]||(T[11]=P=>g.arcgis.url=P),size:"small",placeholder:"输入ArcGIS MapServer地址"},null,8,["value"])])])):d.createCommentVNode("",!0),d.createElementVNode("div",fk,[T[32]||(T[32]=d.createElementVNode("div",{class:"sub-label"},"位置搜索 (天地图)",-1)),d.createElementVNode("div",pk,[d.createVNode(d.unref(o),{value:S.value,"onUpdate:value":T[12]||(T[12]=P=>S.value=P),placeholder:"输入地名搜索",size:"small","allow-clear":"",loading:R.value},null,8,["value","loading"]),b.value.length>0?(d.openBlock(),d.createElementBlock("div",mk,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(b.value,(P,F)=>(d.openBlock(),d.createElementBlock("div",{key:F,class:"search-result-item",onClick:V=>N(P)},[d.createElementVNode("span",yk,d.toDisplayString(P.name),1),d.createElementVNode("span",Ak,d.toDisplayString(P.lon.toFixed(4))+", "+d.toDisplayString(P.lat.toFixed(4)),1)],8,gk))),128))])):d.createCommentVNode("",!0)])])])):d.createCommentVNode("",!0),m.value==="RENDER"?(d.openBlock(),d.createElementBlock("div",vk,[d.createElementVNode("div",bk,[T[33]||(T[33]=d.createElementVNode("span",null,"阴影",-1)),d.createVNode(d.unref(t),{checked:A.shadows,"onUpdate:checked":T[13]||(T[13]=P=>A.shadows=P),size:"small"},null,8,["checked"])]),A.shadows?(d.openBlock(),d.createElementBlock("div",Ck,[d.createElementVNode("div",wk,"阴影暗度 ("+d.toDisplayString(A.shadowDarkness.toFixed(2))+")",1),d.createVNode(d.unref(r),{value:A.shadowDarkness,"onUpdate:value":T[14]||(T[14]=P=>A.shadowDarkness=P),min:0,max:1,step:.05,size:"small"},null,8,["value"])])):d.createCommentVNode("",!0),d.createElementVNode("div",Ek,[T[34]||(T[34]=d.createElementVNode("span",null,"环境贴图 (HDR)",-1)),d.createVNode(d.unref(t),{checked:A.environmentMap,"onUpdate:checked":T[15]||(T[15]=P=>A.environmentMap=P),size:"small"},null,8,["checked"])]),d.createElementVNode("div",xk,[T[35]||(T[35]=d.createElementVNode("span",null,"环境光遮蔽 (AO)",-1)),d.createVNode(d.unref(t),{checked:A.ambientOcclusion,"onUpdate:checked":T[16]||(T[16]=P=>A.ambientOcclusion=P),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Ik,[T[36]||(T[36]=d.createElementVNode("div",{class:"sub-label"},"日期时间",-1)),d.createVNode(d.unref(c),{value:A.time,"onUpdate:value":T[17]||(T[17]=P=>A.time=P),"show-time":"",locale:d.unref(vm),format:"YYYY-MM-DD HH:mm",size:"small",style:{width:"100%"}},null,8,["value","locale"])]),d.createElementVNode("div",Sk,[d.createElementVNode("div",Mk,"模型亮度 ("+d.toDisplayString(A.brightness.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:A.brightness,"onUpdate:value":T[18]||(T[18]=P=>A.brightness=P),min:0,max:5,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",Tk,[d.createElementVNode("div",Bk,"模型对比度 ("+d.toDisplayString(A.contrast.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:A.contrast,"onUpdate:value":T[19]||(T[19]=P=>A.contrast=P),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",_k,[d.createElementVNode("div",kk,"模型饱和度 ("+d.toDisplayString(A.saturation.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:A.saturation,"onUpdate:value":T[20]||(T[20]=P=>A.saturation=P),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",Pk,[T[37]||(T[37]=d.createElementVNode("div",{class:"sub-label"},"背景颜色",-1)),d.createElementVNode("div",Dk,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(w,(P,F)=>d.createElementVNode("div",{key:F,style:d.normalizeStyle({background:P,width:"32px",height:"24px",borderRadius:"2px",cursor:"pointer",border:"1px solid #d9d9d9",flexShrink:0}),onClick:V=>A.backgroundColor=P,title:"预设 "+(F+1)},null,12,Nk)),64))]),d.createElementVNode("div",Lk,[d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":T[21]||(T[21]=P=>I.value=P),style:{width:"40px",height:"24px",padding:"0",border:"1px solid #d9d9d9"}},null,512),[[d.vModelText,I.value]]),d.createVNode(d.unref(o),{value:A.backgroundColor,"onUpdate:value":T[22]||(T[22]=P=>A.backgroundColor=P),size:"small",style:{flex:"1"},placeholder:"CSS 颜色值"},null,8,["value"])])])])):d.createCommentVNode("",!0),m.value==="MOUSE"?(d.openBlock(),d.createElementBlock("div",Rk,[d.createElementVNode("div",Fk,[T[38]||(T[38]=d.createElementVNode("span",null,"碰撞检测",-1)),d.createVNode(d.unref(t),{checked:v.collision,"onUpdate:checked":T[23]||(T[23]=P=>v.collision=P),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Ok,[T[41]||(T[41]=d.createElementVNode("div",{class:"sub-label"},"操作习惯",-1)),d.createVNode(d.unref(n),{value:v.habit,"onUpdate:value":T[24]||(T[24]=P=>v.habit=P),size:"small"},{default:d.withCtx(()=>[d.createVNode(d.unref(s),{value:0},{default:d.withCtx(()=>[...T[39]||(T[39]=[d.createTextVNode("默认 (中键旋转)",-1)])]),_:1}),d.createVNode(d.unref(s),{value:1},{default:d.withCtx(()=>[...T[40]||(T[40]=[d.createTextVNode("习惯1 (左键旋转)",-1)])]),_:1})]),_:1},8,["value"])])])):d.createCommentVNode("",!0)])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-5a41e5bb"]]),Gk={class:"cad-layer-panel"},Uk={class:"layer-list-container"},Vk={class:"list-header"},Qk={class:"col-check"},zk=["checked"],Hk={class:"list-body"},Yk={class:"col-check"},$k=["checked","onChange"],jk={class:"col-index"},Wk=["title"],qk={class:"col-color"},Kk=["value"],Xk={key:0,class:"empty-text"},Jk=Be(d.defineComponent({__name:"LeitingCadLayer",props:{visible:{type:Boolean,default:!1},currentModelId:{type:String,default:""}},emits:["update:visible","handleCloseCardByCadCard"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(""),r=d.ref([]),a=()=>{s.value&&s.value.getDxfModels&&(r.value=s.value.getDxfModels().map(v=>({modelId:v.modelId,modelName:v.modelName}))||[])},l=d.computed(()=>r.value.map(v=>({value:v.modelId,label:v.modelName}))),c=d.ref([]),h=d.ref([]),u=d.computed(()=>c.value.length>0&&h.value.length===c.value.length),p=({modelId:v})=>{if(c.value=[],h.value=[],s.value&&s.value.getDxfLayers){const C=s.value.getDxfLayers({modelId:v});C&&Object.keys(C).forEach((w,M)=>{C[w].length&&(c.value.push({index:M+1,layerName:w,layerColor:C[w][0].color||"#ffffff",key:w}),h.value.push(w))})}},f=v=>{o.value=v,p({modelId:v})},m=v=>{v.target.checked?h.value=c.value.map(w=>w.key):h.value=[],g()},y=(v,C)=>{C.target.checked?h.value.includes(v)||h.value.push(v):h.value=h.value.filter(M=>M!==v),g()},g=()=>{if(s.value&&s.value.showDxfLayer&&(s.value.showDxfLayer({modelId:o.value,show:!0,layers:h.value}),s.value.getDxfLayers)){const v=s.value.getDxfLayers({modelId:o.value});if(v){const C=Object.keys(v).filter(w=>!h.value.includes(w));s.value.showDxfLayer({modelId:o.value,show:!1,layers:C})}}},A=()=>{n("update:visible",!1),n("handleCloseCardByCadCard")};return d.watch(()=>t.visible,v=>{v&&(a(),t.currentModelId?(o.value=t.currentModelId,p({modelId:t.currentModelId})):l.value.length>0&&(o.value=l.value[0]?.value,p({modelId:o.value})))}),d.watch(()=>t.currentModelId,v=>{v&&t.visible&&(o.value=v,p({modelId:v}))}),(v,C)=>(d.openBlock(),d.createBlock(gt,{visible:i.visible,title:"CAD图层","onUpdate:visible":C[3]||(C[3]=w=>v.$emit("update:visible",w)),onClose:A,width:360,align:"right","initial-position":{x:0,y:60}},{"header-extra":d.withCtx(()=>[d.createElementVNode("div",{class:"header-select-container",onMousedown:C[2]||(C[2]=d.withModifiers(()=>{},["stop"]))},[C[4]||(C[4]=d.createElementVNode("span",{class:"header-label"},"图纸:",-1)),d.createVNode(d.unref(oe.Select),{value:o.value,"onUpdate:value":C[0]||(C[0]=w=>o.value=w),options:l.value,onChange:C[1]||(C[1]=w=>f(w)),placeholder:"选择模型",style:{width:"140px"},bordered:!1,class:"custom-header-select",popupClassName:"leiting-select-dropdown",size:"small"},null,8,["value","options"])],32)]),default:d.withCtx(()=>[d.createElementVNode("div",Gk,[d.createElementVNode("div",Uk,[d.createElementVNode("div",Vk,[d.createElementVNode("div",Qk,[d.createElementVNode("input",{type:"checkbox",checked:u.value,onChange:m},null,40,zk)]),C[5]||(C[5]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),C[6]||(C[6]=d.createElementVNode("div",{class:"col-name"},"图层名称",-1)),C[7]||(C[7]=d.createElementVNode("div",{class:"col-color"},"颜色",-1))]),d.createElementVNode("div",Hk,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(c.value,w=>(d.openBlock(),d.createElementBlock("div",{key:w.key,class:"list-item"},[d.createElementVNode("div",Yk,[d.createElementVNode("input",{type:"checkbox",checked:h.value.includes(w.key),onChange:M=>y(w.key,M)},null,40,$k)]),d.createElementVNode("div",jk,d.toDisplayString(w.index),1),d.createElementVNode("div",{class:"col-name",title:w.layerName},d.toDisplayString(w.layerName),9,Wk),d.createElementVNode("div",qk,[d.createElementVNode("input",{type:"color",value:w.layerColor,disabled:""},null,8,Kk)])]))),128)),c.value.length===0?(d.openBlock(),d.createElementBlock("div",Xk,"暂无数据")):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-a4db4977"]]),Zk={class:"leiting-cad-adjust-panel"},eP={class:"leitingbim-control-panel"},tP={class:"form-item"},iP={class:"radio-group"},nP={class:"form-item"},sP=["title"],oP={class:"param-row"},rP=["step"],aP={class:"param-row"},lP=["step"],cP={class:"param-row"},dP=["step"],hP={class:"param-row"},uP=["step"],fP={class:"param-row"},pP=["step"],mP={class:"param-row"},gP=["step"],yP={class:"param-row"},AP=["step"],vP={class:"button-grid"},bP={key:1,class:"pick-mode-ui"},CP=["onClick"],wP=["checked"],EP={style:{"font-size":"12px",color:"#aaa","padding-left":"10px"}},xP={class:"param-row"},IP={style:{width:"40px"}},SP=["onUpdate:modelValue"],MP={class:"param-row"},TP={style:{width:"40px"}},BP=["onUpdate:modelValue"],_P={class:"param-row"},kP={style:{width:"40px"}},PP=["onUpdate:modelValue"],DP={class:"list-panel"},NP={class:"list-header"},LP={class:"col-check"},RP=["checked"],FP={class:"list-body"},OP={class:"col-check"},GP=["onUpdate:modelValue"],UP={class:"col-index"},VP=["title"],QP={class:"col-main"},zP=["checked","onChange"],HP={key:0,style:{padding:"10px","text-align":"center",color:"#999"}},YP=Be(d.defineComponent({__name:"LeitingCadPosition",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","handleSavingByCadCard","clearBimPointList","save"],setup(i,{expose:e,emit:t}){const n=i,s=t,o=d.inject("leitingMethods"),r=d.ref([]),a=d.ref(""),l=d.computed(()=>r.value.length>0&&r.value.every(E=>E.selected)),c=d.ref("param"),h=d.ref("bimPoint1"),u=d.ref(null),p=d.ref("bimPoint1"),f=d.reactive({bimPoint1:{longitude:void 0,latitude:void 0,type:"CAD标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程",height:void 0},bimPoint2:{longitude:void 0,latitude:void 0,type:"地图标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程",height:void 0}}),m=d.ref(1e-6),y=d.reactive({modelId:"",longitude:0,latitude:0,distance:1e-6,rotation:1,totalRotation:0,heightDistance:1,height:0,lonlat:1e-6,modelOptions:[],selectPoint:{longitude:0,latitude:0,height:0},selectedMode:!1,X:0,Y:0,Z:0}),g=d.computed(()=>{const E=r.value.find(T=>T.modelId===a.value);return E?E.modelName:""}),A=()=>{s("update:visible",!1)},v=()=>(!u.value&&o?.value?.getViewer&&o?.value?.getCesium&&(u.value=new yc(o.value.getViewer(),o.value.getCesium())),u.value),C=()=>{v()?.clearMarkers(),f.bimPoint1.longitude=void 0,f.bimPoint1.latitude=void 0,f.bimPoint1.height=void 0,f.bimPoint2.longitude=void 0,f.bimPoint2.latitude=void 0,f.bimPoint2.height=void 0},w=E=>{const T=h.value,P=f[T];if(P){P.longitude=E.longitude,P.latitude=E.latitude,P.height=E.height;const F=T==="bimPoint1"?"BIM":"MAP";v()?.addMarker(F,E),pe.success(`${P.type}已添加`)}},M=()=>{v()?.registerPickHandler(E=>{w(E)})},x=()=>{v()?.destroyPickHandler()},I=E=>{c.value=E,E!=="pick"&&s("clearBimPointList")};d.watch(()=>c.value,E=>{E==="pick"?M():x()}),d.onUnmounted(()=>{x()});const S=()=>{if(!o?.value?.getDxfModels)return;const E=o.value.getDxfModels();if(Array.isArray(E)?r.value=E.map(T=>({modelId:T.modelId,modelName:T.modelName,formData:T.formData||{},selected:!1,tileset:T})):r.value=[],r.value.length>0){const T=o.value.getCadModelId?o.value.getCadModelId():"";T&&r.value.find(P=>P.modelId===T)?R(T):R(r.value[0].modelId),r.value.forEach(P=>P.selected=!0)}},R=E=>{a.value=E;const T=r.value.find(P=>P.modelId===E);T&&T.formData&&Object.keys(y).forEach(P=>{T.formData[P]!==void 0&&(y[P]=T.formData[P])})},b=(E,T)=>{if(!o?.value?.adjustingModelByCad)return;const P=r.value.find(F=>F.modelId===E);P&&P.tileset&&(P.formData={...P.formData,...T},P.tileset.formData=P.formData,o.value.adjustingModelByCad({...P.formData,tileset:P.tileset}))},B=E=>{if(!a.value)return;const T=y[E];b(a.value,{[E]:T})},L=E=>{const T=r.value.filter(G=>G.selected);if(T.length===0){pe.warning("请先选择要调整的模型");return}const{distance:P,heightDistance:F,rotation:V}=y;T.forEach(G=>{const k={...G.formData};switch(E){case"north":k.latitude+=P;break;case"south":k.latitude-=P;break;case"east":k.longitude+=P;break;case"west":k.longitude-=P;break;case"up":k.height+=F;break;case"down":k.height-=F;break;case"rotateLeft":k.totalRotation=(k.totalRotation||0)-V;break;case"rotateRight":k.totalRotation=(k.totalRotation||0)+V;break}G.modelId===a.value&&Object.assign(y,k),b(G.modelId,k)})},O=E=>{const T=E.target.checked;r.value.forEach(P=>P.selected=T)},N=()=>{s("handleSavingByCadCard",r.value),s("save",r.value)},D=()=>{const E=f.bimPoint1,T=f.bimPoint2;if(E.longitude===void 0||T.longitude===void 0){pe.warning("请先完成点选操作");return}const P=r.value.filter(_=>_.selected);if(P.length===0){pe.warning("请先选择要调整的模型");return}let F=0,V=0,G=0;const k=v();if(k){const{dLon:_,dLat:U,dHeight:H}=k.calculateOffset(E,T);F=_,V=U,G=H}else F=T.longitude-E.longitude,V=T.latitude-E.latitude,G=T.height-E.height;P.forEach(_=>{const U={..._.formData};U.longitude+=F,U.latitude+=V,U.height+=G,_.modelId===a.value&&Object.assign(y,U),b(_.modelId,U)}),pe.success("位置已调整")};return d.watch(()=>n.visible,E=>{E?S():(x(),C())}),d.onMounted(()=>{n.visible&&S()}),e({setBIMPointsList:({longitude:E,latitude:T,height:P})=>{f[p.value].longitude=E,f[p.value].latitude=T,f[p.value].height=P},addGltfOr3dTilesModelList:E=>{console.warn("addGltfOr3dTilesModelList is deprecated, use internal loading")}}),(E,T)=>(d.openBlock(),d.createBlock(gt,{visible:n.visible,title:"Cad校准",width:282,height:600,"onUpdate:visible":T[21]||(T[21]=P=>s("update:visible",P)),onClose:A},{default:d.withCtx(()=>[d.createElementVNode("div",Zk,[d.createElementVNode("div",eP,[d.createElementVNode("div",tP,[T[22]||(T[22]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",iP,[d.createElementVNode("span",{class:d.normalizeClass({active:c.value==="param"}),onClick:T[0]||(T[0]=P=>I("param"))},"参数模式",2),d.createElementVNode("span",{class:d.normalizeClass({active:c.value==="pick"}),onClick:T[1]||(T[1]=P=>I("pick"))},"地图点选",2)])]),d.createElementVNode("div",nP,[T[23]||(T[23]=d.createElementVNode("label",null,"当前主模型:",-1)),d.createElementVNode("span",{class:"value",title:g.value},d.toDisplayString(g.value||"未选择"),9,sP)]),T[35]||(T[35]=d.createElementVNode("div",{class:"separator"},null,-1)),c.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[T[31]||(T[31]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",oP,[T[24]||(T[24]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[2]||(T[2]=P=>y.longitude=P),onChange:T[3]||(T[3]=P=>B("longitude")),step:m.value},null,40,rP),[[d.vModelText,y.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",aP,[T[25]||(T[25]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[4]||(T[4]=P=>y.latitude=P),onChange:T[5]||(T[5]=P=>B("latitude")),step:m.value},null,40,lP),[[d.vModelText,y.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",cP,[T[26]||(T[26]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[6]||(T[6]=P=>y.height=P),onChange:T[7]||(T[7]=P=>B("height")),step:m.value},null,40,dP),[[d.vModelText,y.height,void 0,{number:!0}]])]),d.createElementVNode("div",hP,[T[27]||(T[27]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[8]||(T[8]=P=>y.totalRotation=P),onChange:T[9]||(T[9]=P=>B("totalRotation")),step:m.value},null,40,uP),[[d.vModelText,y.totalRotation,void 0,{number:!0}]])]),T[32]||(T[32]=d.createElementVNode("div",{class:"separator"},null,-1)),T[33]||(T[33]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",fP,[T[28]||(T[28]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[10]||(T[10]=P=>y.distance=P),step:m.value},null,8,pP),[[d.vModelText,y.distance,void 0,{number:!0}]])]),d.createElementVNode("div",mP,[T[29]||(T[29]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[11]||(T[11]=P=>y.heightDistance=P),step:m.value},null,8,gP),[[d.vModelText,y.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",yP,[T[30]||(T[30]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":T[12]||(T[12]=P=>y.rotation=P),step:m.value},null,8,AP),[[d.vModelText,y.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",vP,[d.createElementVNode("button",{onClick:T[13]||(T[13]=P=>L("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:T[14]||(T[14]=P=>L("north"))},"北移"),d.createElementVNode("button",{onClick:T[15]||(T[15]=P=>L("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:T[16]||(T[16]=P=>L("west"))},"西移"),d.createElementVNode("button",{onClick:T[17]||(T[17]=P=>L("south"))},"南移"),d.createElementVNode("button",{onClick:T[18]||(T[18]=P=>L("east"))},"东移"),d.createElementVNode("button",{onClick:T[19]||(T[19]=P=>L("up"))},"上移"),d.createElementVNode("button",{onClick:T[20]||(T[20]=P=>L("down"))},"下移"),d.createElementVNode("button",{onClick:N,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):(d.openBlock(),d.createElementBlock("div",bP,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(f,(P,F)=>(d.openBlock(),d.createElementBlock("div",{key:F,class:"form-item",style:{display:"block","margin-bottom":"15px"}},[d.createElementVNode("div",{style:{"font-weight":"bold","margin-bottom":"5px",cursor:"pointer",display:"flex","align-items":"center"},onClick:V=>h.value=F},[d.createElementVNode("input",{type:"radio",checked:h.value===F,style:{"margin-right":"5px"}},null,8,wP),d.createTextVNode(" "+d.toDisplayString(P.type)+": ",1)],8,CP),d.createElementVNode("div",EP,[d.createElementVNode("div",xP,[d.createElementVNode("label",IP,d.toDisplayString(P.longitudeText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":V=>P.longitude=V,readonly:"",style:{width:"100px"}},null,8,SP),[[d.vModelText,P.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",MP,[d.createElementVNode("label",TP,d.toDisplayString(P.latitudeText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":V=>P.latitude=V,readonly:"",style:{width:"100px"}},null,8,BP),[[d.vModelText,P.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",_P,[d.createElementVNode("label",kP,d.toDisplayString(P.heightText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":V=>P.height=V,readonly:"",style:{width:"100px"}},null,8,PP),[[d.vModelText,P.height,void 0,{number:!0}]])])])]))),128)),d.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[d.createElementVNode("button",{onClick:D,class:"primary-btn"},"应用校准"),d.createElementVNode("button",{onClick:N},"保存")]),T[34]||(T[34]=d.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 勾选上方 CAD 或 地图 标记点选项。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“应用校准”进行校准。")],-1))]))]),d.createElementVNode("div",DP,[d.createElementVNode("div",NP,[d.createElementVNode("div",LP,[d.createElementVNode("input",{type:"checkbox",checked:l.value,onChange:O},null,40,RP)]),T[36]||(T[36]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),T[37]||(T[37]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),T[38]||(T[38]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",FP,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.value,(P,F)=>(d.openBlock(),d.createElementBlock("div",{key:P.modelId,class:d.normalizeClass(["list-item",{active:P.modelId===a.value}])},[d.createElementVNode("div",OP,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":V=>P.selected=V},null,8,GP),[[d.vModelCheckbox,P.selected]])]),d.createElementVNode("div",UP,d.toDisplayString(F+1),1),d.createElementVNode("div",{class:"col-name",title:P.modelName},d.toDisplayString(P.modelName),9,VP),d.createElementVNode("div",QP,[d.createElementVNode("input",{type:"radio",name:"mainModel",checked:P.modelId===a.value,onChange:V=>R(P.modelId)},null,40,zP)])],2))),128)),r.value.length===0?(d.openBlock(),d.createElementBlock("div",HP,"暂无数据")):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-4dfe6448"]]),$P={class:"coord-transform-card"},jP={class:"param-row"},WP={class:"param-row"},qP={class:"param-row"},KP={class:"param-row"},XP={class:"param-row"},JP={class:"param-row"},ZP={class:"param-row"},eD={class:"button-grid transform-actions"},tD=Be(d.defineComponent({__name:"LeitingGISCadCoordTransform",emits:["apply-transform","save-position"],setup(i,{emit:e}){const t=e,n=d.inject("leitingMethods"),s=d.ref("projectedToLonlat"),o=d.reactive({centralMeridian:117,latOrigin:0,scaleFactor:1,falseEasting:5e5,falseNorthing:0,ellipsoid:"GRS80"}),r=()=>{const l=n?.value?.getDefaultGISCadTransformConfig?.()||{centralMeridian:117,latOrigin:0,scaleFactor:1,falseEasting:5e5,falseNorthing:0,ellipsoid:"GRS80"};Object.assign(o,l)},a=()=>{t("apply-transform",{direction:s.value,config:{...o}})};return r(),(l,c)=>(d.openBlock(),d.createElementBlock("div",$P,[d.createElementVNode("div",jP,[c[10]||(c[10]=d.createElementVNode("label",null,"转换方向:",-1)),d.createVNode(d.unref(oe.Select),{value:s.value,"onUpdate:value":c[0]||(c[0]=h=>s.value=h),class:"custom-select",popupClassName:"leiting-select-dropdown",size:"small"},{default:d.withCtx(()=>[d.createVNode(d.unref(oe.SelectOption),{value:"projectedToLonlat"},{default:d.withCtx(()=>[...c[8]||(c[8]=[d.createTextVNode("投影转经纬 (根据模型局部坐标)",-1)])]),_:1}),d.createVNode(d.unref(oe.SelectOption),{value:"lonlatToProjected"},{default:d.withCtx(()=>[...c[9]||(c[9]=[d.createTextVNode("经纬转投影 (根据模型经纬度)",-1)])]),_:1})]),_:1},8,["value"])]),d.createElementVNode("div",WP,[c[11]||(c[11]=d.createElementVNode("label",null,"中央经线:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[1]||(c[1]=h=>o.centralMeridian=h),type:"number"},null,512),[[d.vModelText,o.centralMeridian,void 0,{number:!0}]])]),d.createElementVNode("div",qP,[c[12]||(c[12]=d.createElementVNode("label",null,"纬度基线:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[2]||(c[2]=h=>o.latOrigin=h),type:"number"},null,512),[[d.vModelText,o.latOrigin,void 0,{number:!0}]])]),d.createElementVNode("div",KP,[c[13]||(c[13]=d.createElementVNode("label",null,"投影比例:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[3]||(c[3]=h=>o.scaleFactor=h),type:"number",step:"0.000001"},null,512),[[d.vModelText,o.scaleFactor,void 0,{number:!0}]])]),d.createElementVNode("div",XP,[c[14]||(c[14]=d.createElementVNode("label",null,"东偏移:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[4]||(c[4]=h=>o.falseEasting=h),type:"number"},null,512),[[d.vModelText,o.falseEasting,void 0,{number:!0}]])]),d.createElementVNode("div",JP,[c[15]||(c[15]=d.createElementVNode("label",null,"北偏移:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[5]||(c[5]=h=>o.falseNorthing=h),type:"number"},null,512),[[d.vModelText,o.falseNorthing,void 0,{number:!0}]])]),d.createElementVNode("div",ZP,[c[20]||(c[20]=d.createElementVNode("label",null,"椭球体:",-1)),d.createVNode(d.unref(oe.Select),{value:o.ellipsoid,"onUpdate:value":c[6]||(c[6]=h=>o.ellipsoid=h),class:"custom-select",popupClassName:"leiting-select-dropdown",size:"small"},{default:d.withCtx(()=>[d.createVNode(d.unref(oe.SelectOption),{value:"GRS80"},{default:d.withCtx(()=>[...c[16]||(c[16]=[d.createTextVNode("CGCS2000 (GRS80)",-1)])]),_:1}),d.createVNode(d.unref(oe.SelectOption),{value:"WGS84"},{default:d.withCtx(()=>[...c[17]||(c[17]=[d.createTextVNode("WGS84",-1)])]),_:1}),d.createVNode(d.unref(oe.SelectOption),{value:"krass"},{default:d.withCtx(()=>[...c[18]||(c[18]=[d.createTextVNode("北京54 (Krassovsky)",-1)])]),_:1}),d.createVNode(d.unref(oe.SelectOption),{value:"IAU76"},{default:d.withCtx(()=>[...c[19]||(c[19]=[d.createTextVNode("西安80 (IAU76)",-1)])]),_:1})]),_:1},8,["value"])]),d.createElementVNode("div",eD,[d.createElementVNode("button",{class:"primary-btn",onClick:a,style:{"grid-column":"span 2"}},"应用到选中模型"),d.createElementVNode("button",{onClick:c[7]||(c[7]=h=>t("save-position"))},"保存位置")]),c[21]||(c[21]=d.createElementVNode("div",{class:"instructions"},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 在列表中勾选需要转换的模型。"),d.createElementVNode("div",null,"2. 配置对应坐标系的转换参数。"),d.createElementVNode("div",null,"3. 点击“应用到选中模型”进行批量转换预览。")],-1))]))}}),[["__scopeId","data-v-f069993f"]]),iD={class:"adjust-panel"},nD={class:"leitingbim-control-panel"},sD={class:"form-item"},oD={class:"radio-group"},rD={class:"form-item"},aD=["title"],lD={class:"param-row"},cD=["step"],dD={class:"param-row"},hD=["step"],uD={class:"param-row"},fD=["step"],pD={class:"param-row"},mD=["step"],gD={class:"param-row"},yD=["step"],AD={class:"param-row"},vD=["step"],bD={class:"param-row"},CD=["step"],wD={class:"param-row"},ED=["step"],xD={class:"param-row"},ID=["step"],SD={class:"button-grid"},MD={class:"action-buttons"},TD={key:1,class:"pick-mode-ui"},BD=["onClick"],_D=["checked","onChange"],kD={class:"pick-point-body"},PD={class:"param-row"},DD={class:"pick-label"},ND=["onUpdate:modelValue"],LD={class:"param-row"},RD={class:"pick-label"},FD=["onUpdate:modelValue"],OD={class:"param-row"},GD={class:"pick-label"},UD=["onUpdate:modelValue"],VD={class:"button-grid pick-button-grid"},QD={class:"list-panel"},zD={class:"list-header"},HD={class:"col-check"},YD=["checked"],$D={class:"list-body"},jD={class:"col-check"},WD=["onUpdate:modelValue"],qD={class:"col-index"},KD=["title"],XD={class:"col-main"},JD=["checked","onChange"],ZD={key:0,class:"empty-text"},eN=Be(d.defineComponent({__name:"LeitingGISCadPosition",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(1e-6),r=d.ref([]),a=d.ref(""),l=d.ref("param"),c=d.ref("cadPoint"),h=d.ref(null),u=d.reactive({cadPoint:{longitude:void 0,latitude:void 0,height:void 0,type:"CAD标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程"},mapPoint:{longitude:void 0,latitude:void 0,height:void 0,type:"地图标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程"}}),p=d.reactive({modelId:"",longitude:0,latitude:0,height:0,totalRotation:0,scale:1,distance:1e-4,heightDistance:1,rotation:1,scaleStep:.1,localOriginX:0,localOriginY:0,clampToGround:!1}),f=d.computed(()=>r.value.length>0&&r.value.every(k=>k.selected)),m=d.computed(()=>r.value.find(k=>k.modelId===a.value)?.modelName||""),y=()=>(!h.value&&s?.value?.getViewer&&s?.value?.getCesium&&(h.value=new yc(s.value.getViewer(),s.value.getCesium())),h.value),g=()=>{u.cadPoint.longitude=void 0,u.cadPoint.latitude=void 0,u.cadPoint.height=void 0,u.mapPoint.longitude=void 0,u.mapPoint.latitude=void 0,u.mapPoint.height=void 0},A=()=>{h.value?.clearMarkers(),g()},v=k=>{const _=c.value,U=u[_];U&&(U.longitude=k.longitude,U.latitude=k.latitude,U.height=k.height,y()?.addMarker(_==="cadPoint"?"BIM":"MAP",k),pe.success(`${U.type}已添加`))},C=()=>{y()?.registerPickHandler(_=>{v(_)})},w=()=>{h.value?.destroyPickHandler()},M=k=>{l.value=k},x=k=>{(k==="cadPoint"||k==="mapPoint")&&(c.value=k)},I=k=>{const _=k?.editingFormData||k?.formData||{};return{modelId:k?.modelId||"",longitude:Number(_.longitude??0),latitude:Number(_.latitude??0),height:Number(_.height??0),totalRotation:Number(_.totalRotation??0),scale:Math.max(1e-6,Number(_.scale??1)),distance:Number(_.distance??1e-6),heightDistance:Number(_.heightDistance??1),rotation:Number(_.rotation??1),scaleStep:Number(_.scaleStep??.1),localOriginX:Number(_.localOriginX??0),localOriginY:Number(_.localOriginY??0),transformConfig:_.transformConfig||void 0,transformDirection:_.transformDirection||void 0,clampToGround:_.clampToGround??!1}},S=()=>{const k=r.value.find(_=>_.modelId===a.value);k&&Object.assign(p,k.formData,{modelId:k.modelId})},R=()=>{if(!s?.value?.getGISCadModels){r.value=[];return}const k=new Map(r.value.map(X=>[X.modelId,X.selected])),_=s.value.getGISCadModels()||[];if(r.value=Array.isArray(_)?_.map(X=>({modelId:X.modelId,modelName:X.modelName,selected:k.get(X.modelId)??!0,runtimeModel:X,formData:I(X)})):[],!r.value.length){a.value="";return}const U=r.value[0];if(!U)return;const H=s.value.getGISCadModelId?.()||a.value||U.modelId,q=r.value.find(X=>X.modelId===H);a.value=q?.modelId||U.modelId,S()},b=k=>{a.value=k,S()},B=(k,_)=>{if(!s?.value?.adjustGISCadModel)return null;s.value.beginEditGISCad?.({modelId:k});const U=s.value.adjustGISCadModel({modelId:k,..._}),H=r.value.find(q=>q.modelId===k);return H&&U&&(H.formData={...H.formData,...U,modelId:k},H.runtimeModel={...H.runtimeModel,editingFormData:U,isEditing:!0}),k===a.value&&Object.assign(p,H?.formData||p,{modelId:k}),U},L=k=>{if(!a.value)return;const _=r.value.find(X=>X.modelId===a.value);if(!_)return;if(k==="clampToGround"){const X=!!p[k];B(a.value,{[k]:X}),r.value.filter(de=>de.selected&&de.modelId!==a.value).forEach(de=>{B(de.modelId,{[k]:X})});return}const U=Number(p[k]),H=Number(_.formData[k]),q=U-H;B(a.value,{[k]:k==="scale"?Math.max(1e-6,U):U}),!(q===0||k==="scale")&&r.value.filter(X=>X.selected&&X.modelId!==a.value).forEach(X=>{B(X.modelId,{[k]:Number(X.formData[k])+q})})},O=k=>{const _=r.value.filter(U=>U.selected);if(!_.length){pe.warning("请先选择要调整的模型");return}_.forEach(U=>{const H={...U.formData};switch(k){case"north":H.latitude+=p.distance;break;case"south":H.latitude-=p.distance;break;case"east":H.longitude+=p.distance;break;case"west":H.longitude-=p.distance;break;case"up":H.height+=p.heightDistance;break;case"down":H.height-=p.heightDistance;break;case"rotateLeft":H.totalRotation-=p.rotation;break;case"rotateRight":H.totalRotation+=p.rotation;break;case"scaleUp":H.scale=Math.max(1e-6,H.scale+p.scaleStep);break;case"scaleDown":H.scale=Math.max(1e-6,H.scale-p.scaleStep);break;default:return}H.distance=p.distance,H.heightDistance=p.heightDistance,H.rotation=p.rotation,H.scaleStep=p.scaleStep,B(U.modelId,H)})},N=({direction:k,config:_})=>{const U=r.value.filter(X=>X.selected);if(!U.length){pe.warning("请先选择要转换的模型");return}if(!s?.value?.transformGISCadCoordinate){pe.warning("未找到 GIS CAD 坐标转换方法");return}let q=0;U.forEach(X=>{try{const de=Number(X.formData.localOriginX),fe=Number(X.formData.localOriginY);let me={longitude:X.formData.longitude,latitude:X.formData.latitude};const be=s?.value?.transformGISCadCoordinate;if(be){const _e=be({direction:k,...k==="projectedToLonlat"?{x:de,y:fe}:{longitude:X.formData.longitude,latitude:X.formData.latitude},config:{..._}});k==="projectedToLonlat"&&_e.longitude&&(me.longitude=_e.longitude,me.latitude=_e.latitude)}B(X.modelId,{transformConfig:{..._},transformDirection:k,longitude:me.longitude,latitude:me.latitude}),q++}catch(de){console.warn("Transform failed for model",X.modelId,de)}}),q>0?pe.success(`已成功转换 ${q} 个模型的坐标并重新加载,请预览后提交贴地`):pe.error("坐标转换失败,请检查参数或模型状态")},D=()=>{p.clampToGround=!p.clampToGround,L("clampToGround")},E=()=>{const k=u.cadPoint,_=u.mapPoint;if(k.longitude===void 0||k.latitude===void 0||k.height===void 0||_.longitude===void 0||_.latitude===void 0||_.height===void 0){pe.warning("请先完成 CAD 和地图点位采集");return}const H=r.value.filter(fe=>fe.selected);if(!H.length){pe.warning("请先选择要调整的模型");return}const{dLon:q,dLat:X,dHeight:de}=y()?.calculateOffset(k,_)||{dLon:_.longitude-k.longitude,dLat:_.latitude-k.latitude,dHeight:_.height-k.height};H.forEach(fe=>{B(fe.modelId,{longitude:Number(fe.formData.longitude)+q,latitude:Number(fe.formData.latitude)+X,height:Number(fe.formData.height)+de})}),pe.success("点选校准预览已更新")},T=()=>{const k=r.value.filter(U=>U.selected);if(!k.length){pe.warning("请先选择要提交的模型");return}const _=[];k.forEach(U=>{const H=s?.value?.commitEditGISCad?.({modelId:U.modelId});H&&H.formData&&_.push({modelId:H.modelId,formData:H.formData})}),R(),_.length>0&&s?.value?.onGISCadPositionChange&&s.value.onGISCadPositionChange(_),pe.success("GIS CAD 已提交为贴地结果")},P=()=>{r.value.forEach(k=>{s?.value?.cancelEditGISCad?.({modelId:k.modelId})})},F=()=>{if(!a.value){pe.warning("请先选择主模型");return}if(!s?.value?.flyToGISCadModel){pe.warning("飞转方法不可用");return}s.value.flyToGISCadModel({modelId:a.value,duration:1.5})},V=k=>{const _=k.target.checked;r.value.forEach(U=>{U.selected=_})},G=()=>{P(),w(),A(),n("update:visible",!1)};return d.watch(l,k=>{t.visible&&(k==="pick"?C():w())}),d.watch(()=>t.visible,k=>{k?(R(),l.value==="pick"&&C()):(w(),A(),P(),R())}),d.onMounted(()=>{t.visible&&(R(),l.value==="pick"&&C())}),d.onUnmounted(()=>{w(),A(),P()}),(k,_)=>(d.openBlock(),d.createBlock(gt,{visible:t.visible,title:"GIS CAD调整",width:340,"onUpdate:visible":_[27]||(_[27]=U=>n("update:visible",U)),onClose:G},{default:d.withCtx(()=>[d.createElementVNode("div",iD,[d.createElementVNode("div",nD,[d.createElementVNode("div",sD,[_[28]||(_[28]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",oD,[d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="param"}),onClick:_[0]||(_[0]=U=>M("param"))}," 参数模式 ",2),d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="pick"}),onClick:_[1]||(_[1]=U=>M("pick"))}," 地图点选 ",2),d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="transform"}),onClick:_[2]||(_[2]=U=>M("transform"))}," 坐标转换 ",2)])]),d.createElementVNode("div",rD,[_[29]||(_[29]=d.createElementVNode("label",null,"当前主模型:",-1)),d.createElementVNode("span",{class:"value",title:m.value},d.toDisplayString(m.value||"未选择"),9,aD)]),_[43]||(_[43]=d.createElementVNode("div",{class:"separator"},null,-1)),l.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[_[39]||(_[39]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",lD,[_[30]||(_[30]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[3]||(_[3]=U=>p.longitude=U),type:"number",step:o.value,onChange:_[4]||(_[4]=U=>L("longitude"))},null,40,cD),[[d.vModelText,p.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",dD,[_[31]||(_[31]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[5]||(_[5]=U=>p.latitude=U),type:"number",step:o.value,onChange:_[6]||(_[6]=U=>L("latitude"))},null,40,hD),[[d.vModelText,p.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",uD,[_[32]||(_[32]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[7]||(_[7]=U=>p.height=U),type:"number",step:o.value,onChange:_[8]||(_[8]=U=>L("height"))},null,40,fD),[[d.vModelText,p.height,void 0,{number:!0}]])]),d.createElementVNode("div",pD,[_[33]||(_[33]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[9]||(_[9]=U=>p.totalRotation=U),type:"number",step:o.value,onChange:_[10]||(_[10]=U=>L("totalRotation"))},null,40,mD),[[d.vModelText,p.totalRotation,void 0,{number:!0}]])]),d.createElementVNode("div",gD,[_[34]||(_[34]=d.createElementVNode("label",null,"缩放比例:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[11]||(_[11]=U=>p.scale=U),type:"number",min:"0.000001",step:o.value,onChange:_[12]||(_[12]=U=>L("scale"))},null,40,yD),[[d.vModelText,p.scale,void 0,{number:!0}]])]),_[40]||(_[40]=d.createElementVNode("div",{class:"separator"},null,-1)),_[41]||(_[41]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",AD,[_[35]||(_[35]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[13]||(_[13]=U=>p.distance=U),type:"number",step:o.value},null,8,vD),[[d.vModelText,p.distance,void 0,{number:!0}]])]),d.createElementVNode("div",bD,[_[36]||(_[36]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[14]||(_[14]=U=>p.heightDistance=U),type:"number",step:o.value},null,8,CD),[[d.vModelText,p.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",wD,[_[37]||(_[37]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[15]||(_[15]=U=>p.rotation=U),type:"number",step:o.value},null,8,ED),[[d.vModelText,p.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",xD,[_[38]||(_[38]=d.createElementVNode("label",null,"缩放步长:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":_[16]||(_[16]=U=>p.scaleStep=U),type:"number",step:o.value},null,8,ID),[[d.vModelText,p.scaleStep,void 0,{number:!0}]])]),d.createElementVNode("div",SD,[d.createElementVNode("button",{onClick:_[17]||(_[17]=U=>O("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:_[18]||(_[18]=U=>O("north"))},"北移"),d.createElementVNode("button",{onClick:_[19]||(_[19]=U=>O("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:_[20]||(_[20]=U=>O("west"))},"西移"),d.createElementVNode("button",{onClick:_[21]||(_[21]=U=>O("south"))},"南移"),d.createElementVNode("button",{onClick:_[22]||(_[22]=U=>O("east"))},"东移"),d.createElementVNode("button",{onClick:_[23]||(_[23]=U=>O("up"))},"上移"),d.createElementVNode("button",{onClick:_[24]||(_[24]=U=>O("scaleDown"))},"缩小"),d.createElementVNode("button",{onClick:_[25]||(_[25]=U=>O("scaleUp"))},"放大"),d.createElementVNode("button",{onClick:_[26]||(_[26]=U=>O("down"))},"下移")]),d.createElementVNode("div",MD,[d.createElementVNode("button",{class:d.normalizeClass({"primary-btn":p.clampToGround}),onClick:D}," 贴地 ",2),d.createElementVNode("button",{onClick:T},"保存位置"),d.createElementVNode("button",{onClick:F},"正北俯视")])],64)):l.value==="pick"?(d.openBlock(),d.createElementBlock("div",TD,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(u,(U,H)=>(d.openBlock(),d.createElementBlock("div",{key:H,class:"pick-point-item"},[d.createElementVNode("div",{class:"pick-point-title",onClick:q=>x(H)},[d.createElementVNode("input",{type:"radio",name:"gisCadPickPoint",checked:c.value===H,onChange:q=>x(H)},null,40,_D),d.createElementVNode("span",null,d.toDisplayString(U.type)+":",1)],8,BD),d.createElementVNode("div",kD,[d.createElementVNode("div",PD,[d.createElementVNode("label",DD,d.toDisplayString(U.longitudeText),1),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":q=>U.longitude=q,type:"number",readonly:""},null,8,ND),[[d.vModelText,U.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",LD,[d.createElementVNode("label",RD,d.toDisplayString(U.latitudeText),1),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":q=>U.latitude=q,type:"number",readonly:""},null,8,FD),[[d.vModelText,U.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",OD,[d.createElementVNode("label",GD,d.toDisplayString(U.heightText),1),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":q=>U.height=q,type:"number",readonly:""},null,8,UD),[[d.vModelText,U.height,void 0,{number:!0}]])])])]))),128)),d.createElementVNode("div",VD,[d.createElementVNode("button",{class:"primary-btn",onClick:E},"应用校准"),d.createElementVNode("button",{class:d.normalizeClass({"primary-btn":p.clampToGround}),onClick:D}," 贴地 ",2),d.createElementVNode("button",{onClick:T},"保存位置"),d.createElementVNode("button",{onClick:F},"正北俯视")]),_[42]||(_[42]=d.createElementVNode("div",{class:"instructions"},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 先选择上方 CAD 标记点或地图标记点。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“应用校准”进行预览。"),d.createElementVNode("div",null,"4. 确认结果后,点击“提交贴地”生效。")],-1))])):l.value==="transform"?(d.openBlock(),d.createBlock(tD,{key:2,onApplyTransform:N,onSavePosition:T})):d.createCommentVNode("",!0)]),d.createElementVNode("div",QD,[d.createElementVNode("div",zD,[d.createElementVNode("div",HD,[d.createElementVNode("input",{type:"checkbox",checked:f.value,onChange:V},null,40,YD)]),_[44]||(_[44]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),_[45]||(_[45]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),_[46]||(_[46]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",$D,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.value,(U,H)=>(d.openBlock(),d.createElementBlock("div",{key:U.modelId,class:d.normalizeClass(["list-item",{active:U.modelId===a.value}])},[d.createElementVNode("div",jD,[d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":q=>U.selected=q,type:"checkbox"},null,8,WD),[[d.vModelCheckbox,U.selected]])]),d.createElementVNode("div",qD,d.toDisplayString(H+1),1),d.createElementVNode("div",{class:"col-name",title:U.modelName},d.toDisplayString(U.modelName),9,KD),d.createElementVNode("div",XD,[d.createElementVNode("input",{checked:U.modelId===a.value,type:"radio",name:"gisCadMainModel",onChange:q=>b(U.modelId)},null,40,JD)])],2))),128)),r.value.length===0?(d.openBlock(),d.createElementBlock("div",ZD,"暂无 GIS CAD 数据")):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-25694d77"]]),tN={class:"annotation-content"},iN={class:"annotation-tools"},nN={class:"annotation-controls"},sN={class:"control-group",title:"颜色"},oN={class:"tool-item color-tool"},rN={class:"control-group line-width-container",title:"线宽"},aN=["onClick"],lN={class:"option-label"},cN=Be(d.defineComponent({__name:"LeitingAnnotationCard",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(""),r=d.ref("#ff0000"),a=d.ref(1),l=d.ref(!1),c=d.ref(null),h=d.ref(null),u=d.ref({top:"0px",left:"0px"}),p=[{value:6,label:"粗"},{value:3,label:"中"},{value:1,label:"细"}],f=()=>s?.value?.getAnnotationInstance?s.value.getAnnotationInstance():null,m=()=>{n("update:visible",!1)},y=I=>{o.value=I;const S=f();if(S)switch(I){case"freehandLine":S.startFreehandLine();break;case"arrow":S.startArrow();break;case"straightLine":S.startStraightLine();break;case"rectangle":S.startRectangle();break;case"ellipse":S.startEllipse();break}},g=()=>{const I=f();I&&(I.setCurrentColor(r.value),I.changeColor(r.value))},A=()=>{if(!l.value&&c.value){const I=c.value.getBoundingClientRect();u.value={top:`${I.top}px`,left:`${I.right+8}px`}}l.value=!l.value},v=I=>{a.value=I,l.value=!1;const S=f();S&&(S.setCurrentWidth(I),S.changeWidth(I))},C=()=>{const I=f();I&&I.deleteSelectedEntity()},w=()=>{const I=f();I&&I.clearAll()},M=()=>{if(s?.value?.saveAnnotations){s.value.saveAnnotations();return}const I=f();I&&I.saveAnnotations()},x=I=>{const S=I.target,R=c.value&&c.value.contains(S),b=h.value&&h.value.contains(S);!R&&!b&&(l.value=!1)};return d.onMounted(()=>{document.addEventListener("click",x)}),d.onUnmounted(()=>{document.removeEventListener("click",x)}),(I,S)=>(d.openBlock(),d.createBlock(gt,{visible:t.visible,title:"标注",width:70,"min-width":70,height:480,"onUpdate:visible":S[6]||(S[6]=R=>n("update:visible",R)),onClose:m},{default:d.withCtx(()=>[d.createElementVNode("div",tN,[d.createElementVNode("div",iN,[d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="freehandLine"}]),onClick:S[0]||(S[0]=R=>y("freehandLine")),title:"手绘线"},[...S[7]||(S[7]=[d.createElementVNode("div",{class:"tool-icon"},"✏️",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="arrow"}]),onClick:S[1]||(S[1]=R=>y("arrow")),title:"箭头"},[...S[8]||(S[8]=[d.createElementVNode("div",{class:"tool-icon"},"↗️",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="straightLine"}]),onClick:S[2]||(S[2]=R=>y("straightLine")),title:"直线"},[...S[9]||(S[9]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="rectangle"}]),onClick:S[3]||(S[3]=R=>y("rectangle")),title:"矩形"},[...S[10]||(S[10]=[d.createElementVNode("div",{class:"tool-icon"},"▭",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="ellipse"}]),onClick:S[4]||(S[4]=R=>y("ellipse")),title:"椭圆"},[...S[11]||(S[11]=[d.createElementVNode("div",{class:"tool-icon"},"⭕",-1)])],2)]),S[13]||(S[13]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",nN,[d.createElementVNode("div",sN,[d.createElementVNode("div",oN,[d.createElementVNode("div",{class:"color-swatch",style:d.normalizeStyle({backgroundColor:r.value})},null,4),d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":S[5]||(S[5]=R=>r.value=R),onChange:g,class:"color-input-overlay"},null,544),[[d.vModelText,r.value]])])]),d.createElementVNode("div",rN,[d.createElementVNode("div",{ref_key:"lineWidthBtnRef",ref:c,class:"tool-item",onClick:d.withModifiers(A,["stop"])},[d.createElementVNode("div",{class:"current-width-preview",style:d.normalizeStyle({height:a.value+"px",backgroundColor:"#fff"})},null,4)],512),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[l.value?(d.openBlock(),d.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"line-width-dropdown",style:d.normalizeStyle(u.value)},[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(p,R=>d.createElementVNode("div",{key:R.value,class:d.normalizeClass(["line-width-option",{selected:a.value===R.value}]),onClick:d.withModifiers(b=>v(R.value),["stop"])},[d.createElementVNode("span",lN,d.toDisplayString(R.label),1),d.createElementVNode("div",{class:"line-preview",style:d.normalizeStyle({height:R.value+"px",backgroundColor:a.value===R.value?"#1890ff":"#ddd"})},null,4)],10,aN)),64))],4)):d.createCommentVNode("",!0)]))]),S[12]||(S[12]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",{class:"action-buttons"},[d.createElementVNode("button",{class:"control-btn",onClick:C,title:"删除选中"}," 🗑️ "),d.createElementVNode("button",{class:"control-btn",onClick:w,title:"清空"}," ❌ "),d.createElementVNode("button",{class:"control-btn",onClick:M,title:"保存"}," 💾 ")])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-3cfc8415"]]),dN={class:"measure-content"},hN={class:"measure-tools"},uN={key:0,class:"measure-results"},fN={class:"result-row"},pN={class:"result-value"},mN={class:"result-row"},gN={class:"result-value"},yN={class:"result-row"},AN={class:"result-value"},vN={class:"result-row"},bN={class:"result-value"},CN={key:1,class:"result-row"},wN={class:"result-value"},EN={key:2,class:"result-row"},xN={class:"result-value"},IN={class:"measure-controls"},SN={class:"control-group",title:"单位"},MN={class:"unit-display"},TN=["onClick"],BN=Be(d.defineComponent({__name:"LeitingMeasurement",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(null),r=d.ref(null),a=d.ref("m"),l=d.ref(!1),c=d.ref(null),h=d.ref(!1),u=d.ref({}),p=d.ref(null),f=[{label:"米 (m)",value:"m"},{label:"厘米 (cm)",value:"cm"},{label:"毫米 (mm)",value:"mm"}],m=I=>{const S=a.value;return S==="mm"?`${(I*1e3).toFixed(0)}mm`:S==="cm"?`${(I*100).toFixed(1)}cm`:`${I.toFixed(2)}m`},y=I=>I>1e6?`${(I/1e6).toFixed(2)} km²`:`${I.toFixed(2)} m²`,g=()=>{if(!o.value&&s.value?.getViewer){const I=s.value.getViewer(),S=s.value.getCesium();I&&S&&(o.value=new uc({viewer:I,cesium:S}),o.value.setUnit(a.value),o.value.setSnapping(l.value),o.value.onMeasure=R=>{c.value=R})}},A=I=>{o.value||g(),r.value===I?(r.value=null,o.value?.stop(),s.value?.baseCompt?.enableSelection()):(r.value=I,o.value?.start(I),s.value?.baseCompt?.disableSelection())},v=I=>{a.value=I,h.value=!1},C=()=>{o.value&&(o.value.clearAll(),r.value=null,o.value.stop()),s.value?.baseCompt?.enableSelection()},w=()=>{n("update:visible",!1)},M=I=>{if(h.value){h.value=!1;return}const R=I.currentTarget.getBoundingClientRect();u.value={position:"fixed",top:`${R.top}px`,left:`${R.right+5}px`,zIndex:3e3},h.value=!0},x=I=>{h.value&&p.value&&!p.value.contains(I.target)&&(h.value=!1)};return d.onMounted(()=>{document.addEventListener("click",x),t.visible&&d.nextTick(()=>g())}),d.onUnmounted(()=>{document.removeEventListener("click",x),o.value&&o.value.destroy()}),d.watch(()=>t.visible,I=>{I?d.nextTick(()=>g()):o.value&&(o.value.stop(),r.value=null)}),d.watch(s,I=>{I&&I.getViewer&&!o.value&&t.visible&&g()}),d.watch(a,I=>{o.value&&o.value.setUnit(I)}),(I,S)=>(d.openBlock(),d.createBlock(gt,{visible:t.visible,title:"量算",width:70,"min-width":70,height:480,"onUpdate:visible":S[3]||(S[3]=R=>n("update:visible",R)),onClose:w},{default:d.withCtx(()=>[d.createElementVNode("div",dN,[d.createElementVNode("div",hN,[d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="distance"}]),onClick:S[0]||(S[0]=R=>A("distance")),title:"距离测量"},[...S[4]||(S[4]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="angle"}]),onClick:S[1]||(S[1]=R=>A("angle")),title:"角度测量"},[...S[5]||(S[5]=[d.createElementVNode("div",{class:"tool-icon"},"📐",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="area"}]),onClick:S[2]||(S[2]=R=>A("area")),title:"面积测量"},[...S[6]||(S[6]=[d.createElementVNode("div",{class:"tool-icon"},"🔳",-1)])],2)]),S[15]||(S[15]=d.createElementVNode("div",{class:"separator"},null,-1)),c.value?(d.openBlock(),d.createElementBlock("div",uN,[c.value.type==="distance"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[d.createElementVNode("div",fN,[S[7]||(S[7]=d.createElementVNode("span",{class:"result-label"},"总长:",-1)),d.createElementVNode("span",pN,d.toDisplayString(m(c.value.dist)),1)]),d.createElementVNode("div",mN,[S[8]||(S[8]=d.createElementVNode("span",{class:"result-label",style:{color:"#ff4d4f"}},"ΔX:",-1)),d.createElementVNode("span",gN,d.toDisplayString(m(c.value.dx)),1)]),d.createElementVNode("div",yN,[S[9]||(S[9]=d.createElementVNode("span",{class:"result-label",style:{color:"#52c41a"}},"ΔY:",-1)),d.createElementVNode("span",AN,d.toDisplayString(m(c.value.dy)),1)]),d.createElementVNode("div",vN,[S[10]||(S[10]=d.createElementVNode("span",{class:"result-label",style:{color:"#1890ff"}},"ΔZ:",-1)),d.createElementVNode("span",bN,d.toDisplayString(m(c.value.dz)),1)])],64)):d.createCommentVNode("",!0),c.value.type==="angle"?(d.openBlock(),d.createElementBlock("div",CN,[S[11]||(S[11]=d.createElementVNode("span",{class:"result-label"},"角度:",-1)),d.createElementVNode("span",wN,d.toDisplayString(c.value.angle.toFixed(1))+"°",1)])):d.createCommentVNode("",!0),c.value.type==="area"?(d.openBlock(),d.createElementBlock("div",EN,[S[12]||(S[12]=d.createElementVNode("span",{class:"result-label"},"面积:",-1)),d.createElementVNode("span",xN,d.toDisplayString(y(c.value.area)),1)])):d.createCommentVNode("",!0)])):d.createCommentVNode("",!0),d.createElementVNode("div",IN,[d.createElementVNode("div",SN,[d.createElementVNode("div",{class:"tool-item",onClick:d.withModifiers(M,["stop"])},[d.createElementVNode("div",MN,d.toDisplayString(a.value),1)]),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[h.value?(d.openBlock(),d.createElementBlock("div",{key:0,ref_key:"unitDropdownRef",ref:p,class:"unit-dropdown",style:d.normalizeStyle(u.value)},[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(f,R=>d.createElementVNode("div",{key:R.value,class:d.normalizeClass(["unit-option",{selected:a.value===R.value}]),onClick:d.withModifiers(b=>v(R.value),["stop"])},d.toDisplayString(R.label),11,TN)),64))],4)):d.createCommentVNode("",!0)]))]),S[14]||(S[14]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",{class:"action-buttons"},[d.createElementVNode("div",{class:"tool-item control-btn",onClick:C,title:"清空"},[...S[13]||(S[13]=[d.createElementVNode("div",{class:"tool-icon"},"🗑️",-1)])])])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-8b1e070f"]]);function Mm(){const i=d.ref(!1),e=d.reactive({x:0,y:0}),t=d.ref([]),n=d.ref(null);return{visible:i,position:e,items:t,contextData:n,show:(l,c,h)=>{l instanceof MouseEvent?(l.preventDefault(),e.x=l.clientX,e.y=l.clientY):(e.x=l.x,e.y=l.y),t.value=c,n.value=h,i.value=!0},hide:()=>{i.value=!1},addItem:l=>{t.value.push(l)},removeItem:l=>{t.value=t.value.filter(c=>c.id!==l)}}}const _N=["onClick","onTouchend"],kN={class:"menu-label"},PN={key:0,class:"menu-arrow"},DN=Be(d.defineComponent({__name:"LeitingContextMenu",props:{visible:{type:Boolean},position:{},items:{}},emits:["update:visible","action"],setup(i,{emit:e}){const t=i,n=e,{isMobile:s}=Fr(),o=d.computed(()=>{let l=t.position.x,c=t.position.y;if(s.value){const u=t.items.length*48;l+200>window.innerWidth-16&&(l=window.innerWidth-200-16),c+u>window.innerHeight-16&&(c=window.innerHeight-u-16),c<16&&(c=16)}return{left:l+"px",top:c+"px"}}),r=l=>{l.disabled||(l.action&&l.action(),n("action",l),n("update:visible",!1))},a=()=>{t.visible&&n("update:visible",!1)};return d.onMounted(()=>{document.addEventListener("click",a),document.addEventListener("contextmenu",l=>{l.target.closest(".leiting-context-menu")||a()})}),d.onUnmounted(()=>{document.removeEventListener("click",a)}),(l,c)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-context-menu",{"mobile-style":d.unref(s)}]),style:d.normalizeStyle(o.value),onContextmenu:c[0]||(c[0]=d.withModifiers(()=>{},["prevent"]))},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(i.items,h=>(d.openBlock(),d.createElementBlock("div",{key:h.id,class:d.normalizeClass(["menu-item",{"menu-divided":h.divided,"menu-disabled":h.disabled}]),onClick:u=>r(h),onTouchend:d.withModifiers(u=>r(h),["prevent"])},[d.createElementVNode("span",kN,d.toDisplayString(h.label),1),h.children?(d.openBlock(),d.createElementBlock("span",PN,"▶")):d.createCommentVNode("",!0)],42,_N))),128))],38)),[[d.vShow,i.visible]])}}),[["__scopeId","data-v-62c220a6"]]),NN={class:"mobile-nav-root"},LN={class:"nav-bar-container"},RN={key:"sub-mode",class:"nav-inner sub-menu-wrapper"},FN={class:"sub-icons-list"},ON=["onClick"],GN=["innerHTML"],UN={key:"main-mode",class:"nav-inner main-menu-wrapper"},VN=["onClick"],QN=["src","alt"],Tm=Be(d.defineComponent({__name:"MobileBottomNav",props:{activeIds:{},is2d:{type:Boolean},customItems:{}},emits:["item-click","sub-item-click","clear-measure"],setup(i,{emit:e}){const t=i,n=e,s=d.ref(null),o=d.ref(null),r={measure:[{id:"distance",label:"距离",parentId:"measure",parentKey:"measurement"},{id:"angle",label:"角度",parentId:"measure",parentKey:"measurement"},{id:"area",label:"面积",parentId:"measure",parentKey:"measurement"},{id:"coordinate",label:"坐标",parentId:"measure",parentKey:"measurement"}],section:[{id:"box",label:"剖切盒",parentId:"section",parentKey:"section"},{id:"plane-x",label:"X轴",parentId:"section",parentKey:"section"},{id:"plane-y",label:"Y轴",parentId:"section",parentKey:"section"}]},a={distance:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 17l6-6 4 4 8-8"/><path d="M17 7h4v4"/></svg>',angle:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 20H4L14 4"/></svg>',area:'<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/></svg>',coordinate:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v20M2 12h20"/></svg>',box:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/></svg>'},l=g=>a[g]||a.box,c=d.ref([{ID:"home",title:"主视角",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoROakhe0HDeQmbQfFzTxJj+zTXYg1kWrarISRFKzLNAfGsbL9iDzq/0j+kQZ/k1wm7onoKW3Hq42F0jLVK//Tcebott2fJAbVK1lvKwBNd6rRIsFsfJka0G2qdpQPy7+EPC0AumexKAzoH5FbgvSbHuUW6EOYubbfwX0cLPfFJS4K6mPNrbdHb+uvP498dhVn4v9FWo9V3RZzFxAv8L9AAAAAElFTkSuQmCC",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"homeView"},{ID:"measure",title:"量算",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFESURBVDhPlZMNEcIwDIVXBQwFgAJAAcMBDgAFIGE4wAHgABSwOdgcIAEUjPd6aS/rfhi7y12bJl9f0sxEf3xVVV0RPoetjTFvnWqGcgSylfgihA0CKcgJgBfsAqMiKiM0+gkKlCyZCN8uhPWCFOSBxARWORU4W2CdeV9XjxSEJcwkjokTqBpzjxjCn7CyVRECzjg8wHLYCmabK7CplBcLhMr2DZCqP0dCovYZ9hYGXx1izLUGUkkfxI/sTQiCf4N1zLWAWCKV2nP6PEhB2Ngd7B4GC4SJnCcP8SAFoc/Ph/TqjVvTPogFKUiJ/VGU+GdmUAA5ObA7cyC+iPt/MjUfKRL4emyuK+cGH8tufFRUHywZ+RYlnRDdIwfzLzVUibtQv1oNhoAExtfpVdIAiQIOWiY9o2sQxJemOydTS1jR1di2Zn8B8f27apou9kMAAAAASUVORK5CYII=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"measurement"},{ID:"roam",title:"漫游",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADhSURBVHgBvVOBEYIwDEw9B2ADO4IjuIEjwAa6Aa7ABMAEuIIjOIFsUDao37vgxVZbBI+/+0tI0+fJBaIIrLUFaMAHmNNcsMAIE+vdJLQykQ+0wFHBrsyiT/sL2I1DDTac/+4Klzobov7WHxt29qGmaYaQnlhLCmUTa2l4C2ljvamFlEvY0xpCW/kA924GblfGWciZaJyXQvSmlOoDITSdXQBbcA8eKfy/nHDFeY470FIX8tzUIu84FmLWuTzz7yhRLPm54dKJ4+A5uoJ3HgHBUfUmxGIa4QDuKA4n3kLk9ZInw0qu5b1R1aYAAAAASUVORK5CYII=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"roam"},{ID:"info",title:"信息",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADFSURBVDhPxVPBDYMwDIwnKJu0G9ANYJMyQrsBbNIRGAE2gEnSO6mpIMJxkBC1lEds52zfOeK9b51zV5wte4lIr8RWbgGQh2fGmaIHJe4EetKPtDpRcA5AvwcB7FtgCcTOH0p3YzaQNd75QBiVXJG3LRtCRyQ6Jvsekd3gTsJVoDcihZLQQjXGTRMzIzPhOCCQyNYvSuEue7Qdm02yK0u1nM2m/FQyKb8JZHH+l81Ofdpdm82tvikjThyNlbSEBvIPFj+MfwA76qSYUG3g9QAAAABJRU5ErkJggg==",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"componentInfo"},{ID:"setting",title:"设置",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGPSURBVDhPrZT9UQIxEMUvFSgViBUoFQgVABV4VqBW4FmBUIFQgZRwVqBU4HUAVHC+X2aXycQw/sPOvLncZvdlv5JQFaTv+1upp8IyhLDHRLpLfe6FrXRt7hZShYyH+n8RauGAv/AkQNYIHICshFcRdu6fE/kGRN/mQGTIpzAzMoh6EV2fIsJ5IwNOj2IpVZ6i6difSecRVnlELZHIgHROisgXRCa78Z+IrMBf2pjLYJNENGSd1kO2pPghjKQniyqY8lFr2NfaqC18wn7nZCMlWg7xLq70TxfRLyHqtABN2lbp40mSSCzBcSebif1TPyKjDBcQ0eJJRkIUpHkMPUlnkBU+pnlWItL6ERgw8o1iqRHtgzAUGNRD2qmkvgMvNnneUQcZ4ggR6VGXG+OOA1koNvrFcY7+af++VJe0hucfyKQu+RWJc+SDZ3aNvlPpRl7T0qXdafNZYPDehLEZt/rOBR9U8QSaEKX0jHAaE4tshVrgLeJ+Xdl6rS8D3BWJXKnCEwWXEuco9grQ3bb0sP0Cn8/nPm/SMRQAAAAASUVORK5CYII=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"setting"}]),h=d.ref([{ID:"home",title:"主视角",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoROakhe0HDeQmbQfFzTxJj+zTXYg1kWrarISRFKzLNAfGsbL9iDzq/0j+kQZ/k1wm7onoKW3Hq42F0jLVK//Tcebott2fJAbVK1lvKwBNd6rRIsFsfJka0G2qdpQPy7+EPC0AumexKAzoH5FbgvSbHuUW6EOYubbfwX0cLPfFJS4K6mPNrbdHb+uvP498dhVn4v9FWo9V3RZzFxAv8L9AAAAAElFTkSuQmCC",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"homeView"},{ID:"cadLayer",title:"CAD图层",src:Gr,key:"cadLayer"},{ID:"annotation",title:"标注",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACDSURBVHgB1ZFhDYAgEIWfzgBGIIINpIEViGAkG2gEbWADjWADfMw/iDgUfji/7e3gxt3uHsDXZFrrlrFBHJNpsPAgEEmORArn3lFroEZQCjcTbAhzepPsgbuCgn8FBWvsUAMfFR5OIPGS5G80JkrG2sopHKbO1BCoHy8ZNhRUT5X4BTu6qyNSwwCiMAAAAABJRU5ErkJggg==",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ke&&ke.tagName.toUpperCase()==="SCRIPT"&&ke.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"annotation"}]),u=d.computed(()=>{let A=[...t.is2d?h.value:c.value];return t.customItems&&(A=[...A,...t.customItems]),A}),p=d.computed(()=>s.value?r[s.value.ID]||[]:[]),f=g=>{if(r[g.ID]){if(g.ID==="measure"){n("item-click",g);return}if(s.value?.ID===g.ID)y();else{s.value=g,o.value=null;const A=r[g.ID];A&&A.length>0&&(o.value=A[0]?.id??null,setTimeout(()=>{n("sub-item-click",{parent:g,sub:A[0]})},50))}}else n("item-click",g)},m=g=>{o.value=g.id,n("sub-item-click",{parent:s.value,sub:g})},y=()=>{s.value=null,o.value=null};return(g,A)=>(d.openBlock(),d.createElementBlock("div",NN,[d.createElementVNode("nav",LN,[d.createVNode(d.Transition,{name:"nav-mode-switch",mode:"out-in"},{default:d.withCtx(()=>[s.value?(d.openBlock(),d.createElementBlock("div",RN,[d.createElementVNode("button",{class:"nav-back-icon",onClick:y},[...A[0]||(A[0]=[d.createElementVNode("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3"},[d.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)])]),d.createElementVNode("div",FN,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(p.value,v=>(d.openBlock(),d.createElementBlock("button",{key:v.id,class:d.normalizeClass(["sub-icon-box",{active:o.value===v.id}]),onClick:C=>m(v)},[d.createElementVNode("div",{class:"icon-svg",innerHTML:l(v.id)},null,8,GN)],10,ON))),128))])])):(d.openBlock(),d.createElementBlock("div",UN,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(u.value,v=>(d.openBlock(),d.createElementBlock("div",{key:v.ID,class:d.normalizeClass(["main-tab-item",{active:i.activeIds?.includes(v.ID)}]),onClick:C=>f(v)},[d.createElementVNode("img",{src:v.src,class:"tab-img",alt:v.title},null,8,QN)],10,VN))),128))]))]),_:1})])]))}}),[["__scopeId","data-v-2e30753b"]]),zN={key:1,class:"drawer-header"},HN={class:"drawer-title"},YN={class:"drawer-content"},$N={key:2,class:"drawer-footer"},jr=Be(d.defineComponent({__name:"MobileDrawer",props:{visible:{type:Boolean},title:{},direction:{default:"bottom"},width:{default:"100%"},height:{default:"50vh"},showHandle:{type:Boolean,default:!1},closeOnOverlay:{type:Boolean,default:!0},maxHeight:{default:"60vh"}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.ref(null);let o=0,r=0;const a=d.computed(()=>{const f={};return t.direction==="right"||t.direction==="left"?(f.width=t.width,f.height="100%"):(f.width=t.width,f.height=t.height,f.maxHeight=t.maxHeight),f}),l=f=>{o=f.touches[0]?.clientY??0,s.value&&(s.value.style.transition="none")},c=f=>{if(!s.value)return;r=(f.touches[0]?.clientY??0)-o,r>0&&(s.value.style.transform=`translateY(${r}px)`)},h=()=>{s.value&&(s.value.style.transition="transform 300ms cubic-bezier(0.4, 0, 0.2, 1)",r>100?u():s.value.style.transform="",r=0)},u=()=>{n("update:visible",!1),n("close")},p=()=>{t.closeOnOverlay&&u()};return d.watch(()=>t.visible,f=>{f?document.body.style.overflow="hidden":document.body.style.overflow=""}),(f,m)=>(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[d.createVNode(d.Transition,{name:"drawer-fade"},{default:d.withCtx(()=>[i.visible?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-drawer-overlay",onClick:d.withModifiers(p,["self"])},[d.createElementVNode("div",{class:d.normalizeClass(["mobile-drawer-panel",[`direction-${i.direction}`]]),style:d.normalizeStyle(a.value),onClick:m[0]||(m[0]=d.withModifiers(()=>{},["stop"])),ref_key:"panelRef",ref:s},[i.direction==="bottom"&&i.showHandle?(d.openBlock(),d.createElementBlock("div",{key:0,class:"drawer-handle",onTouchstart:l,onTouchmove:c,onTouchend:h},[...m[1]||(m[1]=[d.createElementVNode("div",{class:"handle-bar"},null,-1)])],32)):d.createCommentVNode("",!0),i.title||f.$slots.title?(d.openBlock(),d.createElementBlock("div",zN,[d.renderSlot(f.$slots,"title",{},()=>[d.createElementVNode("span",HN,d.toDisplayString(i.title),1)],!0),d.createElementVNode("button",{class:"drawer-close-btn",onClick:u},[...m[2]||(m[2]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])):d.createCommentVNode("",!0),d.createElementVNode("div",YN,[d.renderSlot(f.$slots,"default",{},void 0,!0)]),f.$slots.footer?(d.openBlock(),d.createElementBlock("div",$N,[d.renderSlot(f.$slots,"footer",{},void 0,!0)])):d.createCommentVNode("",!0)],6)])):d.createCommentVNode("",!0)]),_:3})]))}}),[["__scopeId","data-v-66d9d696"]]),jN={class:"mobile-tree-container"},WN={class:"search-section"},qN={class:"search-inner"},KN=["innerHTML"],Bm=Be(d.defineComponent({__name:"MobileTree",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},treeData:{default:()=>[]},initialCheckedKeys:{default:()=>[]}},emits:["update:visible","update:open","close","select","check","search"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:B=>{n("update:visible",B),n("update:open",B)}}),r={key:"id",title:"name",children:"children"},a=d.ref(""),l=d.ref([]),c=d.ref([]),h=d.ref(null),u=d.ref(300),p=d.ref(!1);let f=null;d.watch(()=>t.initialCheckedKeys,B=>{B&&B.length>0&&(c.value=[...B])},{immediate:!0}),d.watch(()=>t.treeData,B=>{if(!B||B.length===0)return;const L=[],O=(E,T)=>{for(let P=0;P<E.length;P++){const F=E[P],V=F.id||F.key||F.$id,G=F.modelId||T;G&&(F.modelId=G),V&&L.push(String(V)),F.children&&F.children.length>0&&O(F.children,G)}};O(B);const N=new Set(c.value);let D=!1;L.forEach(E=>{N.has(E)||(N.add(E),D=!0)}),D&&(c.value=Array.from(N),n("check",c.value))},{immediate:!0,deep:!0});const m=(B,L)=>{const O=[],N=D=>{for(let E=0;E<D.length;E++){const T=D[E],P=T.id||T.key;!T.children||T.children.length===0?!(P&&L.has(String(P)))&&T.modelId&&T.element_Id&&O.push({modelId:T.modelId,elementId:T.element_Id,show:!1}):T.children&&N(T.children)}};return N(B),O},y=d.computed(()=>{if(!a.value)return t.treeData;p.value=!0;const B=a.value.toLowerCase(),L=O=>{const N=[];for(let D=0;D<O.length;D++){const E=O[D],T=E.name||E.title||"",P=E.id||E.key,F=T.toLowerCase().includes(B);let V;E.children&&E.children.length>0&&(V=L(E.children)),(F||V&&V.length>0)&&N.push({key:String(P),title:T,children:V&&V.length>0?V:E.children?E.children:void 0,_raw:E,_searchMatched:F})}return N};return L(t.treeData)}),g=d.computed(()=>{if(!a.value)return[];const B=[],L=O=>{for(let N=0;N<O.length;N++){const D=O[N]?.children;D&&D.length>0&&(B.push(O[N]?.key),L(D))}};return L(y.value),B}),A=(B,L)=>a.value?(B||L||"").toLowerCase().includes(a.value.toLowerCase()):!1,v=B=>{if(!a.value)return B;const L=new RegExp(`(${a.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return B.replace(L,'<mark class="search-highlight">$1</mark>')},C=qo(B=>{const L=typeof B=="object"?B.target?.value??"":B;M(L)},200),w=B=>{M(B)},M=B=>{a.value=B||"",n("search",a.value),B&&d.nextTick(()=>{l.value=[...g.value]})},x=B=>{l.value=B},I=(B,L)=>{c.value=B,n("check",c.value);const O=new Set(B.map(D=>String(D))),N=m(t.treeData,O);s?.value?.setComponentVisibility&&s.value.setComponentVisibility(N),s?.value?.onTreeCheck&&s.value.onTreeCheck(B,L)},S=B=>{o.value=B},R=()=>{n("close")},b=()=>{h.value&&(u.value=h.value.clientHeight)};return d.onMounted(()=>{h.value&&(b(),f=new ResizeObserver(()=>{b()}),f.observe(h.value))}),d.onUnmounted(()=>{f&&(f.disconnect(),f=null)}),(B,L)=>(d.openBlock(),d.createBlock(jr,{visible:o.value,title:"目录树",direction:"bottom","show-handle":!1,class:"mobile-bim-drawer","onUpdate:visible":S,onClose:R},{title:d.withCtx(()=>[...L[1]||(L[1]=[d.createElementVNode("div",{class:"custom-drawer-header"},[d.createElementVNode("span",null,"目录树")],-1)])]),default:d.withCtx(()=>[d.createElementVNode("div",jN,[L[3]||(L[3]=d.createElementVNode("div",{class:"nav-tabs"},[d.createElementVNode("div",{class:"nav-tab-item active"},"构件")],-1)),d.createElementVNode("div",WN,[d.createElementVNode("div",qN,[d.createVNode(d.unref(oe.Input),{value:a.value,"onUpdate:value":L[0]||(L[0]=O=>a.value=O),placeholder:"搜索构件","allow-clear":"",class:"custom-search",onSearch:w,onChange:d.unref(C)},null,8,["value","onChange"])])]),d.createElementVNode("div",{class:"tree-content-wrapper",ref_key:"treeContentRef",ref:h},[y.value.length>0?(d.openBlock(),d.createBlock(d.unref(oe.Tree),{key:0,"tree-data":y.value,"field-names":r,"expanded-keys":l.value,"checked-keys":c.value,checkable:"","block-node":"",class:"bim-dark-tree",onExpand:x,onCheck:I},{switcherIcon:d.withCtx(({expanded:O})=>[d.createElementVNode("span",{class:d.normalizeClass(["switcher-icon",{"is-open":O}])},[...L[2]||(L[2]=[d.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"12",height:"12"},[d.createElementVNode("path",{d:"M340.864 149.312l405.376 362.688-405.376 362.688z",fill:"currentColor"})],-1)])],2)]),title:d.withCtx(({name:O,title:N})=>[d.createElementVNode("span",{class:d.normalizeClass(["node-title",{"is-matched":A(O,N)}])},[d.createElementVNode("span",{innerHTML:v(O||N)},null,8,KN)],2)]),_:1},8,["tree-data","expanded-keys","checked-keys","onExpand","onCheck"])):d.createCommentVNode("",!0)],512)])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-c2e8ecbe"]]),XN={class:"tabs-header"},JN=["onClick"],ZN={class:"modal-content"},eL={key:0,class:"setting-section"},tL={class:"setting-item"},iL={class:"mobile-switch"},nL={class:"setting-item"},sL={class:"mobile-switch"},oL={class:"setting-item"},rL={class:"mobile-switch"},aL={key:1,class:"setting-section"},lL={class:"setting-item"},cL={class:"mobile-switch"},dL={key:0,class:"setting-item column"},hL={class:"setting-label-row"},uL={class:"setting-value"},fL={class:"setting-item"},pL={class:"mobile-switch"},mL={class:"setting-item"},gL={class:"mobile-switch"},yL={class:"setting-item column"},AL={class:"setting-label-row"},vL={class:"setting-value"},bL={class:"setting-item column"},CL={class:"setting-label-row"},wL={class:"setting-value"},EL={class:"setting-item column"},xL={class:"setting-label-row"},IL={class:"setting-value"},SL={class:"setting-item column"},ML={style:{display:"flex",gap:"8px","margin-bottom":"8px","flex-wrap":"wrap"}},TL=["onClick","title"],BL={style:{display:"flex",gap:"8px","align-items":"center"}},_m=Be(d.defineComponent({__name:"MobileSetting",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0}},emits:["update:visible","update:open","close","change"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:f=>{n("update:visible",f),n("update:open",f)}}),r=[{id:"GIS",label:"GIS"},{id:"RENDER",label:"渲染"}],a=d.ref("GIS"),l=d.ref({globe:!1,terrain:!1,depthTest:!1}),c=d.ref({shadows:!1,shadowDarkness:.5,environmentMap:!0,ambientOcclusion:!1,brightness:1,contrast:1,saturation:1,backgroundColor:"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)"}),h=["linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)","linear-gradient(0deg, #0f2027 0%, #203a43 50%, #2c5364 100%)","linear-gradient(0deg, #cfd9df 0%, #e2ebf0 100%)"],u=()=>{p()},p=()=>{n("close"),n("change",{gis:l.value,render:c.value})};return d.watch(()=>l.value.globe,f=>{s?.value&&s.value.setGlobeEnvironmentVisible?.(f)}),d.watch(()=>l.value.terrain,f=>{s?.value&&s.value.setTerrainEnable?.(f)}),d.watch(()=>l.value.depthTest,f=>{s?.value&&s.value.setDepthTestEnable?.(f)}),d.watch(()=>c.value.shadows,f=>{s?.value&&s.value.setShadowsEnable?.(f)}),d.watch(()=>c.value.shadowDarkness,f=>{s?.value&&s.value.setShadowDarkness?.(f)}),d.watch(()=>c.value.environmentMap,f=>{s?.value&&s.value.setEnvironmentMapEnable?.(f)}),d.watch(()=>c.value.ambientOcclusion,f=>{s?.value&&s.value.setAmbientOcclusion?.(f)}),d.watch(()=>[c.value.brightness,c.value.contrast,c.value.saturation],([f,m,y])=>{const g=s?.value;g&&(g.setModelColorAdjustment?g.setModelColorAdjustment({brightness:f,contrast:m,saturation:y}):g.setModelBrightness?.(f))}),d.watch(()=>c.value.backgroundColor,f=>{s?.value&&s.value.setBackgroundColor?.(f)}),d.watch(()=>o.value,f=>{f?document.body.style.overflow="hidden":document.body.style.overflow=""}),(f,m)=>(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[d.createVNode(d.Transition,{name:"setting-modal"},{default:d.withCtx(()=>[o.value?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-setting-overlay",onClick:u,onTouchmove:m[13]||(m[13]=d.withModifiers(()=>{},["prevent"]))},[d.createElementVNode("div",{class:"mobile-setting-modal",onClick:m[12]||(m[12]=d.withModifiers(()=>{},["stop"]))},[d.createElementVNode("div",{class:"modal-header"},[m[15]||(m[15]=d.createElementVNode("span",{class:"modal-title"},"设置",-1)),d.createElementVNode("button",{class:"modal-close-btn",onClick:p},[...m[14]||(m[14]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),d.createElementVNode("div",XN,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(r,y=>d.createElementVNode("button",{key:y.id,class:d.normalizeClass(["tab-btn",{active:a.value===y.id}]),onClick:g=>a.value=y.id},d.toDisplayString(y.label),11,JN)),64))]),d.createElementVNode("div",ZN,[a.value==="GIS"?(d.openBlock(),d.createElementBlock("div",eL,[d.createElementVNode("div",tL,[m[17]||(m[17]=d.createElementVNode("span",{class:"setting-label"},"地球(含大气/日月/星空)",-1)),d.createElementVNode("label",iL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[0]||(m[0]=y=>l.value.globe=y)},null,512),[[d.vModelCheckbox,l.value.globe]]),m[16]||(m[16]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",nL,[m[19]||(m[19]=d.createElementVNode("span",{class:"setting-label"},"地形",-1)),d.createElementVNode("label",sL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[1]||(m[1]=y=>l.value.terrain=y)},null,512),[[d.vModelCheckbox,l.value.terrain]]),m[18]||(m[18]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",oL,[m[21]||(m[21]=d.createElementVNode("span",{class:"setting-label"},"地形遮挡",-1)),d.createElementVNode("label",rL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[2]||(m[2]=y=>l.value.depthTest=y)},null,512),[[d.vModelCheckbox,l.value.depthTest]]),m[20]||(m[20]=d.createElementVNode("span",{class:"slider"},null,-1))])])])):d.createCommentVNode("",!0),a.value==="RENDER"?(d.openBlock(),d.createElementBlock("div",aL,[d.createElementVNode("div",lL,[m[23]||(m[23]=d.createElementVNode("span",{class:"setting-label"},"阴影",-1)),d.createElementVNode("label",cL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[3]||(m[3]=y=>c.value.shadows=y)},null,512),[[d.vModelCheckbox,c.value.shadows]]),m[22]||(m[22]=d.createElementVNode("span",{class:"slider"},null,-1))])]),c.value.shadows?(d.openBlock(),d.createElementBlock("div",dL,[d.createElementVNode("div",hL,[m[24]||(m[24]=d.createElementVNode("span",{class:"setting-label"},"阴影暗度",-1)),d.createElementVNode("span",uL,d.toDisplayString(c.value.shadowDarkness.toFixed(2)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[4]||(m[4]=y=>c.value.shadowDarkness=y),min:"0",max:"1",step:"0.05",class:"mobile-slider"},null,512),[[d.vModelText,c.value.shadowDarkness,void 0,{number:!0}]])])):d.createCommentVNode("",!0),d.createElementVNode("div",fL,[m[26]||(m[26]=d.createElementVNode("span",{class:"setting-label"},"环境贴图",-1)),d.createElementVNode("label",pL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[5]||(m[5]=y=>c.value.environmentMap=y)},null,512),[[d.vModelCheckbox,c.value.environmentMap]]),m[25]||(m[25]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",mL,[m[28]||(m[28]=d.createElementVNode("span",{class:"setting-label"},"环境光遮蔽",-1)),d.createElementVNode("label",gL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[6]||(m[6]=y=>c.value.ambientOcclusion=y)},null,512),[[d.vModelCheckbox,c.value.ambientOcclusion]]),m[27]||(m[27]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",yL,[d.createElementVNode("div",AL,[m[29]||(m[29]=d.createElementVNode("span",{class:"setting-label"},"模型亮度",-1)),d.createElementVNode("span",vL,d.toDisplayString(c.value.brightness.toFixed(1)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[7]||(m[7]=y=>c.value.brightness=y),min:"0",max:"5",step:"0.1",class:"mobile-slider"},null,512),[[d.vModelText,c.value.brightness,void 0,{number:!0}]])]),d.createElementVNode("div",bL,[d.createElementVNode("div",CL,[m[30]||(m[30]=d.createElementVNode("span",{class:"setting-label"},"模型对比度",-1)),d.createElementVNode("span",wL,d.toDisplayString(c.value.contrast.toFixed(1)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[8]||(m[8]=y=>c.value.contrast=y),min:"0.5",max:"2",step:"0.1",class:"mobile-slider"},null,512),[[d.vModelText,c.value.contrast,void 0,{number:!0}]])]),d.createElementVNode("div",EL,[d.createElementVNode("div",xL,[m[31]||(m[31]=d.createElementVNode("span",{class:"setting-label"},"模型饱和度",-1)),d.createElementVNode("span",IL,d.toDisplayString(c.value.saturation.toFixed(1)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[9]||(m[9]=y=>c.value.saturation=y),min:"0",max:"3",step:"0.1",class:"mobile-slider"},null,512),[[d.vModelText,c.value.saturation,void 0,{number:!0}]])]),d.createElementVNode("div",SL,[m[32]||(m[32]=d.createElementVNode("span",{class:"setting-label"},"背景颜色",-1)),d.createElementVNode("div",ML,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(h,(y,g)=>d.createElementVNode("div",{key:g,style:d.normalizeStyle({background:y,width:"60px",height:"40px",borderRadius:"6px",cursor:"pointer",border:"2px solid rgba(255,255,255,0.2)",flexShrink:0}),onClick:A=>c.value.backgroundColor=y,title:"预设 "+(g+1)},null,12,TL)),64))]),d.createElementVNode("div",BL,[d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":m[10]||(m[10]=y=>c.value.backgroundColor=y),style:{width:"50px",height:"36px",padding:"0",border:"1px solid rgba(255,255,255,0.3)","border-radius":"6px",cursor:"pointer"}},null,512),[[d.vModelText,c.value.backgroundColor]]),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":m[11]||(m[11]=y=>c.value.backgroundColor=y),type:"text",class:"mobile-input",placeholder:"CSS 颜色值",style:{flex:"1"}},null,512),[[d.vModelText,c.value.backgroundColor]])])])])):d.createCommentVNode("",!0)])])],32)):d.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-dcec8ca4"]]),_L={class:"mobile-section-container"},kL={class:"section-main"},PL={class:"toggle-row"},DL={class:"slider-section"},NL={class:"slider-header"},LL={class:"slider-label"},RL={class:"slider-value"},FL={class:"quick-btns"},OL={class:"section-models"},GL={class:"models-header"},UL={class:"models-count"},km=Be(d.defineComponent({__name:"MobileSection",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},modelList:{default:()=>[]}},emits:["update:visible","update:open","close","visibility-change","mode-change","axis-change","model-change"],setup(i,{emit:e}){const t=i,n=e,s=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:b=>{n("update:visible",b),n("update:open",b)}}),o=d.ref(!0),r=d.ref("Box"),a=d.ref("X"),l=d.ref([]),c=d.ref([0,100]),h=d.ref([0,100]),u=d.ref([0,100]),p=[{key:"X",label:"X轴"},{key:"Y",label:"Y轴"},{key:"Z",label:"Z轴"}],f=d.computed(()=>p.find(B=>B.key===a.value)?.label||""),m=d.computed({get:()=>{switch(a.value){case"X":return c.value[1];case"Y":return h.value[1];case"Z":return u.value[1];default:return 50}},set:b=>{switch(a.value){case"X":c.value[1]=b??0;break;case"Y":h.value[1]=b??0;break;case"Z":u.value[1]=b??0;break}}}),y=d.computed(()=>{switch(a.value){case"X":return[-50,50];case"Y":return[-50,50];case"Z":return[0,100];default:return[0,100]}}),g=d.computed(()=>m.value?.toFixed(1)??"0.0"),A=d.computed(()=>l.value.length===t.modelList.length),v=b=>{s.value=b},C=()=>{n("close")},w=()=>{n("visibility-change",o.value)},M=b=>{r.value=b,n("mode-change",b)},x=()=>{m.value=50,n("axis-change",a.value,50)},I=()=>{const b=y.value;m.value=b&&b.length>=2?(b[0]+b[1])/2:50,n("axis-change",a.value,m.value)},S=()=>{n("model-change",l.value)},R=()=>{A.value?l.value=[]:l.value=t.modelList.map(b=>b.modelId),n("model-change",l.value)};return(b,B)=>(d.openBlock(),d.createBlock(jr,{visible:s.value,title:"剖切分析",direction:"bottom","show-handle":!0,"onUpdate:visible":v,onClose:C},{default:d.withCtx(()=>[d.createElementVNode("div",_L,[d.createElementVNode("div",kL,[d.createElementVNode("div",PL,[B[6]||(B[6]=d.createElementVNode("span",{class:"toggle-label"},"显示剖切盒",-1)),d.createVNode(d.unref(oe.Switch),{checked:o.value,"onUpdate:checked":B[0]||(B[0]=L=>o.value=L),onChange:w},null,8,["checked"])]),d.createVNode(d.unref(oe.RadioGroup),{value:r.value,"onUpdate:value":B[1]||(B[1]=L=>r.value=L),"button-style":"solid",class:"mode-selector",onChange:B[2]||(B[2]=L=>M(L.target.value))},{default:d.withCtx(()=>[d.createVNode(d.unref(oe.RadioButton),{value:"Box"},{default:d.withCtx(()=>[...B[7]||(B[7]=[d.createTextVNode("剖切盒",-1)])]),_:1})]),_:1},8,["value"]),d.createVNode(d.unref(oe.RadioGroup),{value:a.value,"onUpdate:value":B[3]||(B[3]=L=>a.value=L),"button-style":"solid",class:"axis-selector"},{default:d.withCtx(()=>[d.createVNode(d.unref(oe.RadioButton),{value:"X"},{default:d.withCtx(()=>[...B[8]||(B[8]=[d.createTextVNode("X轴",-1)])]),_:1}),d.createVNode(d.unref(oe.RadioButton),{value:"Y"},{default:d.withCtx(()=>[...B[9]||(B[9]=[d.createTextVNode("Y轴",-1)])]),_:1}),d.createVNode(d.unref(oe.RadioButton),{value:"Z"},{default:d.withCtx(()=>[...B[10]||(B[10]=[d.createTextVNode("Z轴",-1)])]),_:1})]),_:1},8,["value"]),d.createElementVNode("div",DL,[d.createElementVNode("div",NL,[d.createElementVNode("span",LL,d.toDisplayString(f.value)+" 轴范围",1),d.createElementVNode("span",RL,d.toDisplayString(g.value),1)]),d.createVNode(d.unref(oe.Slider),{Value:m.value,"onUpdate:Value":B[4]||(B[4]=L=>m.value=L),min:y.value[0],max:y.value[1],step:.5,class:"section-slider"},null,8,["Value","min","max"]),d.createElementVNode("div",FL,[d.createVNode(d.unref(oe.Button),{size:"small",onClick:x},{default:d.withCtx(()=>[...B[11]||(B[11]=[d.createTextVNode("重置",-1)])]),_:1}),d.createVNode(d.unref(oe.Button),{size:"small",onClick:I},{default:d.withCtx(()=>[...B[12]||(B[12]=[d.createTextVNode("居中",-1)])]),_:1})])])]),d.createElementVNode("div",OL,[d.createElementVNode("div",GL,[B[13]||(B[13]=d.createElementVNode("span",{class:"models-title"},"选择模型",-1)),d.createElementVNode("span",UL,d.toDisplayString(l.value.length)+"/"+d.toDisplayString(i.modelList.length),1)]),d.createVNode(d.unref(oe.CheckboxGroup),{value:l.value,"onUpdate:value":B[5]||(B[5]=L=>l.value=L),class:"models-list",onChange:S},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(i.modelList,L=>(d.openBlock(),d.createBlock(d.unref(oe.Checkbox),{key:L.modelId,value:L.modelId,class:"model-item"},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(L.modelName),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"]),i.modelList.length>1?(d.openBlock(),d.createBlock(d.unref(oe.Button),{key:0,size:"small",type:"link",onClick:R},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(A.value?"取消全选":"全选"),1)]),_:1})):d.createCommentVNode("",!0)])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-cdacec58"]]),VL={key:0,class:"mobile-measure-root"},QL={key:0,class:"result-card"},zL={class:"card-header-row"},HL={class:"result-main"},YL={class:"type-label"},$L={class:"value-highlight"},jL={key:0,class:"coords-grid"},WL={class:"coord-item"},qL={class:"coord-item"},KL={class:"coord-item"},XL={class:"measure-toolbar-container"},JL={class:"tools-inner-row"},ZL=["onClick"],e8=["innerHTML"],Pm=Be(d.defineComponent({__name:"MobileMeasurement",props:{visible:{type:Boolean},defaultTool:{}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods");let o=null,r=!1;const a=d.ref(null),l=d.ref(null),c=d.computed(()=>t.visible&&a.value!==null),h=[{id:"distance",svg:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 17l6-6 4 4 8-8"/></svg>'},{id:"angle",svg:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 20H4L14 4"/></svg>'},{id:"area",svg:'<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/></svg>'}],u={distance:"距离",angle:"角度",area:"面积"},p=d.computed(()=>a.value?u[a.value]||"":l.value&&u[l.value.type]||""),f=d.computed(()=>{if(!l.value)return a.value==="distance"?"-- m":a.value==="angle"?"--°":a.value==="area"?"-- m²":"";const w=l.value;return w.type==="distance"?`${(w.dist??0).toFixed(3)} m`:w.type==="angle"?`${(w.angle??0).toFixed(2)}°`:w.type==="area"?`${(w.area??0).toFixed(2)} m²`:""}),m=d.computed(()=>l.value?.type||a.value),y=w=>w===void 0?"--":w.toFixed(3),g=()=>{if(o)return;const w=s?.value;w?.getViewer&&(o=new uc({viewer:w.getViewer(),cesium:w.getCesium()}),o.onMeasure=M=>{r||(l.value=M)})},A=w=>{g(),a.value===w?(a.value=null,o?.stop(),s?.value?.baseCompt?.enableSelection()):(a.value=w,l.value=null,o?.start(w),s?.value?.baseCompt?.disableSelection())},v=()=>{o?.clearAll(),o?.stop(),a.value=null,l.value=null,s?.value?.baseCompt?.enableSelection()},C=()=>{v(),n("update:visible",!1),n("close")};return d.watch(()=>t.visible,w=>{w?(g(),t.defaultTool&&A(t.defaultTool)):v()}),d.onUnmounted(()=>{r=!0,o?.destroy()}),(w,M)=>(d.openBlock(),d.createBlock(d.Transition,{name:"measure-fade"},{default:d.withCtx(()=>[i.visible?(d.openBlock(),d.createElementBlock("div",VL,[d.createVNode(d.Transition,{name:"card-slide"},{default:d.withCtx(()=>[c.value?(d.openBlock(),d.createElementBlock("div",QL,[d.createElementVNode("div",zL,[d.createElementVNode("div",HL,[d.createElementVNode("span",YL,d.toDisplayString(p.value)+":",1),d.createElementVNode("span",$L,d.toDisplayString(f.value),1)]),d.createElementVNode("button",{class:"clear-action-btn",onClick:v,title:"清空"},[...M[0]||(M[0]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2"},[d.createElementVNode("polyline",{points:"3 6 5 6 21 6"}),d.createElementVNode("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])])]),m.value==="distance"?(d.openBlock(),d.createElementBlock("div",jL,[d.createElementVNode("div",WL,[M[1]||(M[1]=d.createElementVNode("span",{class:"label-x"},"X:",-1)),d.createTextVNode(" "+d.toDisplayString(y(l.value?.dx)),1)]),d.createElementVNode("div",qL,[M[2]||(M[2]=d.createElementVNode("span",{class:"label-y"},"Y:",-1)),d.createTextVNode(" "+d.toDisplayString(y(l.value?.dy)),1)]),d.createElementVNode("div",KL,[M[3]||(M[3]=d.createElementVNode("span",{class:"label-z"},"Z:",-1)),d.createTextVNode(" "+d.toDisplayString(y(l.value?.dz)),1)])])):d.createCommentVNode("",!0)])):d.createCommentVNode("",!0)]),_:1}),d.createElementVNode("div",XL,[d.createElementVNode("button",{class:"nav-back-icon",onClick:C},[...M[4]||(M[4]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"currentColor","stroke-width":"3"},[d.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)])]),d.createElementVNode("div",JL,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(h,x=>d.createElementVNode("button",{key:x.id,class:d.normalizeClass(["sub-icon-box",{active:a.value===x.id}]),onClick:I=>A(x.id)},[d.createElementVNode("span",{class:"icon-svg",innerHTML:x.svg},null,8,e8)],10,ZL)),64))])])])):d.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-7ff442b7"]]),t8={class:"joystick-base"},i8={class:"leitingbim-control-panel"},n8={class:"ctrl-row zoom-row"},s8={class:"zoom-label"},o8={class:"ctrl-grid"},r8={class:"gravity-toggle"},a8={class:"arrow-col"},Ac=40,Dm=Be(d.defineComponent({__name:"MobilePlayer",props:{visible:{type:Boolean}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods");let o=!1;const r=d.ref(null),a=d.ref(0),l=d.ref(0),c=d.ref(!1),h=d.ref({x:0,y:0}),u=[.25,.5,1,2,4,8,16],p=d.ref(2),f=d.ref(!0);let m=null;const y=d.computed(()=>({transform:`translate(${a.value}px, ${l.value}px)`})),g=d.computed(()=>`${u[p.value]}X`),A=(G,k)=>{const _=[];return(Math.abs(G)>10||Math.abs(k)>10)&&(k<-10&&_.push("moveFront"),k>10&&_.push("moveBack"),G<-10&&_.push("moveLeft"),G>10&&_.push("moveRight")),_},v=()=>{o||["moveFront","moveBack","moveLeft","moveRight"].forEach(G=>{s?.value?.setPlayerAction?.(G,!1)})},C=G=>{if(o)return;["moveFront","moveBack","moveLeft","moveRight"].forEach(_=>{const U=G.includes(_);s?.value?.setPlayerAction?.(_,U)})},w=G=>{const k=G.touches[0],_=r.value.getBoundingClientRect();h.value={x:_.left+_.width/2,y:_.top+_.height/2},c.value=!0,k&&x(k.clientX,k.clientY)},M=G=>{if(!c.value)return;const k=G.touches[0];k&&x(k.clientX,k.clientY)},x=(G,k)=>{if(o)return;let _=G-h.value.x,U=k-h.value.y;const H=Math.sqrt(_*_+U*U);H>Ac&&(_=_/H*Ac,U=U/H*Ac),a.value=_,l.value=U;const q=A(_,U);C(q)},I=()=>{c.value=!1,a.value=0,l.value=0,v()},S=()=>{B(),m=setInterval(()=>{p.value<u.length-1&&(p.value++,L())},150)},R=()=>{B(),m=setInterval(()=>{p.value>0&&(p.value--,L())},150)},b=()=>{B()},B=()=>{m&&(clearInterval(m),m=null)},L=()=>{o||s?.value?.setPlayerSpeed?.(u[p.value])},O=()=>{s?.value?.setPlayerAction?.("moveUp",!0)},N=()=>{s?.value?.setPlayerAction?.("moveUp",!1)},D=()=>{s?.value?.setPlayerAction?.("moveDown",!0)},E=()=>{s?.value?.setPlayerAction?.("moveDown",!1)},T=()=>{s?.value?.setPlayerParams?.({gravityTest:f.value,collisionTest:!0})},P=()=>{V(),n("update:visible",!1),n("close")},F=async()=>{if(!o)try{if(!s?.value){setTimeout(()=>F(),150);return}s.value.startCameraRoam&&s.value.startCameraRoam(),s.value.setPlayerSpeed?.(u[p.value])}catch(G){console.error("MobilePlayer startPlayer error:",G)}},V=()=>{v(),o||s?.value?.closePlayer?.(),B()};return d.watch(()=>t.visible,G=>{o||(G?F():V())},{immediate:!0}),d.onUnmounted(()=>{o=!0,V()}),(G,k)=>i.visible?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-player-overlay",onTouchmove:k[1]||(k[1]=d.withModifiers(()=>{},["prevent"]))},[d.createElementVNode("button",{class:"player-exit-btn",onClick:P}," 退出 "),d.createElementVNode("div",{class:"joystick-zone",ref_key:"joystickRef",ref:r,onTouchstart:d.withModifiers(w,["prevent"]),onTouchmove:d.withModifiers(M,["prevent"]),onTouchend:d.withModifiers(I,["prevent"]),onTouchcancel:d.withModifiers(I,["prevent"])},[d.createElementVNode("div",t8,[d.createElementVNode("div",{class:"joystick-knob",style:d.normalizeStyle(y.value)},null,4)])],544),d.createElementVNode("div",i8,[d.createElementVNode("div",n8,[d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-sm",onTouchstart:d.withModifiers(R,["prevent"]),onTouchend:d.withModifiers(b,["prevent"])},"−",32),d.createElementVNode("span",s8,d.toDisplayString(g.value),1),d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-sm",onTouchstart:d.withModifiers(S,["prevent"]),onTouchend:d.withModifiers(b,["prevent"])},"+",32)]),d.createElementVNode("div",o8,[d.createElementVNode("label",r8,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":k[0]||(k[0]=_=>f.value=_),onChange:T},null,544),[[d.vModelCheckbox,f.value]]),k[2]||(k[2]=d.createElementVNode("span",{class:"toggle-checkbox"},null,-1)),k[3]||(k[3]=d.createElementVNode("span",{class:"toggle-label"},"重力",-1))]),d.createElementVNode("div",a8,[d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-arrow",onTouchstart:d.withModifiers(O,["prevent"]),onTouchend:d.withModifiers(N,["prevent"])},[...k[4]||(k[4]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("polyline",{points:"18 15 12 9 6 15"})],-1)])],32),d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-arrow",onTouchstart:d.withModifiers(D,["prevent"]),onTouchend:d.withModifiers(E,["prevent"])},[...k[5]||(k[5]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])],32)])])])],32)):d.createCommentVNode("",!0)}}),[["__scopeId","data-v-d80a8120"]]),l8={key:0,class:"mobile-info-sheet-wrapper"},c8={class:"info-body"},d8={key:0,class:"empty-hint"},h8={key:0,class:"component-title"},u8={class:"group-list"},f8=["onClick"],p8={class:"group-name"},m8={key:0,class:"group-content"},g8={class:"kv-key"},y8={class:"kv-value"},Nm=Be(d.defineComponent({__name:"MobileInfo",props:{visible:{type:Boolean}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref([]),r=d.ref(!1),a=d.ref(new Set),l=d.ref([]);let c=!1;const h=d.computed({get:()=>!!t.visible,set:M=>{n("update:visible",M)}}),u=M=>({elementID:"构件ID",elementName:"构件名",categoryName:"类别",familySymbolName:"族类型",levelName:"标高",modelName:"文件名",length:"长",width:"宽",height:"高"})[M]||M,p=["elementName","elementID","modelName","length","width","height","levelName","categoryName","familySymbolName"],f=(M,x)=>`${M}__${x}`,m=(M,x)=>a.value.has(f(M,x)),y=(M,x)=>{const I=f(M,x);a.value.has(I)?a.value.delete(I):a.value.add(I)},g=()=>{const M=new Set;o.value.forEach(x=>{x.groups.forEach(I=>{M.add(f(x.id,I.name))})}),a.value=M},A=()=>{h.value=!1,n("close")},v=async M=>{if(c)return;if(l.value=M||[],!M||M.length===0){o.value=[];return}let x=M;M.length>10&&(pe.warning(`选中构件数量过多(${M.length}个),仅显示前10个`),x=M.slice(0,10));const I=s?.value;let S=I?.getMapTileset?I.getMapTileset():{};r.value=!0;const R=new Set;if(x.forEach(B=>{const L=S[B.modelId];L&&L.leiting&&!L.leiting?.node?.nodeExtras&&L.leiting.model?.nodeUrl&&R.add(B.modelId)}),R.size>0&&I?._loadNodeDetailsForModel)try{await Promise.all(Array.from(R).map(B=>I._loadNodeDetailsForModel(B)))}catch(B){console.error("Failed to load node details",B)}if(c)return;S=I?.getMapTileset?I.getMapTileset():{};const b=[];x.forEach((B,L)=>{const N=S[B.modelId]?.leiting||{};let D={modelName:N.model?.modelId||B.modelId};D.elementID||(D.elementID=B.elementId);let E=null;const T=N.node?.nodeExtras?.element||N.node?.nodeExtras;if(T){const V=D.elementID;T[V]&&(E=T[V])}E&&E.box3&&(D.length=`${E.box3.length?.toFixed(2)||0}米`,D.width=`${E.box3.width?.toFixed(2)||0}米`,D.height=`${E.box3.height?.toFixed(2)||0}米`);const P=[];E&&(E.name&&(D.elementName=E.name),E.categoryName&&(D.categoryName=E.categoryName),E.familySymbolName&&(D.familySymbolName=E.familySymbolName),E.levelName&&(D.levelName=E.levelName));const F={};if(p.forEach(V=>{D[V]!==void 0&&(F[V]=D[V])}),P.push({name:"基本属性",params:F}),E){const V=Array.isArray(E)?E:Array.isArray(E?.parameters)?E.parameters:null;if(V)V.flat().forEach(k=>{if(k&&k.GroupName&&Array.isArray(k.Parameters)){const _={};k.Parameters.forEach(U=>{U.name&&(_[U.name]=U.value??"")}),Object.keys(_).length>0&&P.push({name:k.GroupName,params:_})}});else{let G=!1;if(Object.keys(E).forEach(k=>{E[k]&&typeof E[k]=="object"&&!Array.isArray(E[k])&&(G=!0,P.push({name:k,params:E[k]}))}),!G){const k={};Object.keys(E).forEach(_=>{if(!p.includes(_)&&_!=="batchId"){const U=E[_];k[_]=typeof U=="string"&&U.length>500?U.substring(0,500)+"...":U}}),Object.keys(k).length>0&&P.push({name:"其他属性",params:k})}}}b.push({id:L,title:`${D.modelName}${D.elementName?` - ${D.elementName}`:""}`,groups:P})}),o.value=b,r.value=!1,!c&&b.length>0&&g()};let C=!1;const w=()=>{if(C)return;const M=s?.value;M&&M.selectionChange&&(M.selectionChange(v),C=!0)};return d.watch(()=>s?.value,()=>w(),{deep:!0,immediate:!0}),d.watch(h,M=>{M&&(w(),l.value.length>0&&v(l.value))}),d.onUnmounted(()=>{c=!0}),(M,x)=>(d.openBlock(),d.createBlock(d.Transition,{name:"info-slide"},{default:d.withCtx(()=>[i.visible?(d.openBlock(),d.createElementBlock("div",l8,[d.createElementVNode("div",{class:"mobile-info-sheet",onTouchmove:x[0]||(x[0]=d.withModifiers(()=>{},["stop"])),onClick:x[1]||(x[1]=d.withModifiers(()=>{},["stop"]))},[d.createElementVNode("div",{class:"info-header"},[x[3]||(x[3]=d.createElementVNode("span",{class:"info-title"},"构件详情",-1)),d.createElementVNode("button",{class:"info-close-btn",onClick:A},[...x[2]||(x[2]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),x[5]||(x[5]=d.createElementVNode("div",{class:"info-tabs"},[d.createElementVNode("span",{class:"tab-item active"},"属性")],-1)),d.createElementVNode("div",c8,[d.createVNode(d.unref(oe.Spin),{spinning:r.value},{default:d.withCtx(()=>[o.value.length===0&&!r.value?(d.openBlock(),d.createElementBlock("div",d8," 暂无数据 ")):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.value,I=>(d.openBlock(),d.createElementBlock("div",{key:I.id,class:"component-block"},[o.value.length>1?(d.openBlock(),d.createElementBlock("div",h8,d.toDisplayString(I.title),1)):d.createCommentVNode("",!0),d.createElementVNode("div",u8,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(I.groups,(S,R)=>(d.openBlock(),d.createElementBlock("div",{key:`${I.id}-${R}`,class:"group-item"},[d.createElementVNode("button",{class:d.normalizeClass(["group-header",{expanded:m(I.id,S.name)}]),onClick:b=>y(I.id,S.name)},[x[4]||(x[4]=d.createElementVNode("svg",{class:"arrow-icon",viewBox:"0 0 16 16",width:"12",height:"12",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("polyline",{points:"4 6 8 10 12 6"})],-1)),d.createElementVNode("span",p8,d.toDisplayString(S.name),1)],10,f8),d.createVNode(d.Transition,{name:"group-expand"},{default:d.withCtx(()=>[m(I.id,S.name)?(d.openBlock(),d.createElementBlock("div",m8,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(S.params,(b,B)=>(d.openBlock(),d.createElementBlock("div",{key:B,class:"kv-row"},[d.createElementVNode("span",g8,d.toDisplayString(u(String(B))),1),d.createElementVNode("span",y8,d.toDisplayString(b),1)]))),128))])):d.createCommentVNode("",!0)]),_:2},1024)]))),128))])]))),128))]),_:1},8,["spinning"])])],32)])):d.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-c4855585"]]),A8={class:"mobile-cad-layer-container"},v8={class:"model-selector"},b8={class:"layer-list-container"},C8={class:"list-header"},w8={class:"col-check"},E8=["checked"],x8={class:"list-body"},I8=["onClick"],S8=["checked","onChange"],M8={class:"col-index"},T8=["title"],B8={class:"col-color"},_8={key:0,class:"empty-state"},k8=Be(d.defineComponent({__name:"MobileCadLayer",props:{visible:{type:Boolean,default:!1},currentModelId:{type:String,default:""}},emits:["update:visible","handleCloseCardByCadCard"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(""),r=d.ref([]),a=d.computed({get:()=>t.visible,set:w=>n("update:visible",w)}),l=()=>{s.value&&s.value.getDxfModels&&(r.value=s.value.getDxfModels().map(w=>({modelId:w.modelId,modelName:w.modelName}))||[])},c=d.computed(()=>r.value.map(w=>({value:w.modelId,label:w.modelName}))),h=d.ref([]),u=d.ref([]),p=d.computed(()=>h.value.length>0&&u.value.length===h.value.length),f=({modelId:w})=>{if(h.value=[],u.value=[],s.value&&s.value.getDxfLayers){const M=s.value.getDxfLayers({modelId:w});M&&Object.keys(M).forEach((x,I)=>{M[x].length&&(h.value.push({index:I+1,layerName:x,layerColor:M[x][0].color||"#ffffff",key:x}),u.value.push(x))})}},m=w=>{o.value=w,f({modelId:w})},y=w=>{w.target.checked?u.value=h.value.map(x=>x.key):u.value=[],A()},g=(w,M)=>{M.target.checked?u.value.includes(w)||u.value.push(w):u.value=u.value.filter(I=>I!==w),A()},A=()=>{if(s.value&&s.value.showDxfLayer&&(s.value.showDxfLayer({modelId:o.value,show:!0,layers:u.value}),s.value.getDxfLayers)){const w=s.value.getDxfLayers({modelId:o.value});if(w){const M=Object.keys(w).filter(x=>!u.value.includes(x));s.value.showDxfLayer({modelId:o.value,show:!1,layers:M})}}},v=w=>{a.value=w},C=()=>{n("update:visible",!1),n("handleCloseCardByCadCard")};return d.watch(()=>t.visible,w=>{w&&(l(),t.currentModelId?(o.value=t.currentModelId,f({modelId:t.currentModelId})):c.value.length>0&&(o.value=c.value[0]?.value,f({modelId:o.value})))}),d.watch(()=>t.currentModelId,w=>{w&&t.visible&&(o.value=w,f({modelId:w}))}),(w,M)=>(d.openBlock(),d.createBlock(jr,{visible:a.value,title:"CAD图层",direction:"bottom","show-handle":!0,height:"70vh",class:"mobile-cad-layer-drawer","onUpdate:visible":v,onClose:C},{default:d.withCtx(()=>[d.createElementVNode("div",A8,[d.createElementVNode("div",v8,[M[3]||(M[3]=d.createElementVNode("span",{class:"selector-label"},"图纸:",-1)),d.createVNode(d.unref(oe.Select),{value:o.value,"onUpdate:value":M[0]||(M[0]=x=>o.value=x),options:c.value,onChange:M[1]||(M[1]=x=>m(x)),placeholder:"选择模型",class:"mobile-model-select",popupClassName:"mobile-cad-select-dropdown",size:"large"},null,8,["value","options"])]),d.createElementVNode("div",b8,[d.createElementVNode("div",C8,[d.createElementVNode("div",w8,[d.createElementVNode("input",{type:"checkbox",checked:p.value,onChange:y,class:"mobile-checkbox"},null,40,E8)]),M[4]||(M[4]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),M[5]||(M[5]=d.createElementVNode("div",{class:"col-name"},"图层名称",-1)),M[6]||(M[6]=d.createElementVNode("div",{class:"col-color"},"颜色",-1))]),d.createElementVNode("div",x8,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(h.value,x=>(d.openBlock(),d.createElementBlock("div",{key:x.key,class:"list-item",onClick:I=>g(x.key,{target:{checked:!u.value.includes(x.key)}})},[d.createElementVNode("div",{class:"col-check",onClick:M[2]||(M[2]=d.withModifiers(()=>{},["stop"]))},[d.createElementVNode("input",{type:"checkbox",checked:u.value.includes(x.key),onChange:I=>g(x.key,I),class:"mobile-checkbox"},null,40,S8)]),d.createElementVNode("div",M8,d.toDisplayString(x.index),1),d.createElementVNode("div",{class:"col-name",title:x.layerName},d.toDisplayString(x.layerName),9,T8),d.createElementVNode("div",B8,[d.createElementVNode("div",{class:"color-swatch",style:d.normalizeStyle({backgroundColor:x.layerColor})},null,4)])],8,I8))),128)),h.value.length===0?(d.openBlock(),d.createElementBlock("div",_8,[...M[7]||(M[7]=[d.createElementVNode("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[d.createElementVNode("path",{d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1),d.createElementVNode("p",null,"暂无图层信息",-1)])])):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-63da9a15"]]),P8={class:"mobile-annotation-panel"},D8={class:"tools-section"},N8={class:"tools-grid"},L8={class:"style-section"},R8={class:"style-item"},F8={class:"color-picker-wrapper"},O8={class:"style-item"},G8={class:"line-width-options"},U8=["onClick"],V8={class:"width-label"},Q8=Be(d.defineComponent({__name:"MobileAnnotationCard",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(""),r=d.ref("#ff0000"),a=d.ref(3),l=d.computed({get:()=>t.visible,set:v=>n("update:visible",v)}),c=[{value:6,label:"粗"},{value:3,label:"中"},{value:1,label:"细"}],h=()=>s?.value?.getAnnotationInstance?s.value.getAnnotationInstance():null,u=()=>{const v=h();if(v&&(typeof v.hideEntityOutline=="function"&&v.hideEntityOutline(),v.selectedEntityObj=null,v.drawTool&&typeof v.drawTool.deactivate=="function"))try{v.drawTool.deactivate()}catch(C){console.warn("Failed to deactivate drawTool:",C)}o.value="",n("update:visible",!1)},p=v=>{if(o.value===v){o.value="";return}o.value=v;const C=h();if(C)switch(v){case"freehandLine":C.startFreehandLine();break;case"arrow":C.startArrow();break;case"straightLine":C.startStraightLine();break;case"rectangle":C.startRectangle();break;case"ellipse":C.startEllipse();break}},f=()=>{const v=h();v&&(v.setCurrentColor(r.value),v.changeColor(r.value))},m=v=>{a.value=v;const C=h();C&&(C.setCurrentWidth(v),C.changeWidth(v))},y=()=>{const v=h();v&&v.deleteSelectedEntity()},g=()=>{const v=h();v&&v.clearAll()},A=()=>{if(s?.value?.saveAnnotations){s.value.saveAnnotations();return}const v=h();v&&v.saveAnnotations()};return(v,C)=>(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[d.createVNode(d.Transition,{name:"annotation-slide"},{default:d.withCtx(()=>[l.value?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-annotation-overlay",onClick:d.withModifiers(u,["self"])},[d.createElementVNode("div",P8,[d.createElementVNode("div",{class:"panel-header"},[C[7]||(C[7]=d.createElementVNode("span",{class:"panel-title"},"标注",-1)),d.createElementVNode("button",{class:"panel-close-btn",onClick:u},[...C[6]||(C[6]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),d.createElementVNode("div",D8,[C[13]||(C[13]=d.createElementVNode("div",{class:"section-label"},"绘图工具",-1)),d.createElementVNode("div",N8,[d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="freehandLine"}]),onClick:C[0]||(C[0]=w=>p("freehandLine"))},[...C[8]||(C[8]=[d.createElementVNode("div",{class:"tool-icon"},"✏️",-1),d.createElementVNode("span",{class:"tool-label"},"手绘线",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="arrow"}]),onClick:C[1]||(C[1]=w=>p("arrow"))},[...C[9]||(C[9]=[d.createElementVNode("div",{class:"tool-icon"},"↗️",-1),d.createElementVNode("span",{class:"tool-label"},"箭头",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="straightLine"}]),onClick:C[2]||(C[2]=w=>p("straightLine"))},[...C[10]||(C[10]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1),d.createElementVNode("span",{class:"tool-label"},"直线",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="rectangle"}]),onClick:C[3]||(C[3]=w=>p("rectangle"))},[...C[11]||(C[11]=[d.createElementVNode("div",{class:"tool-icon"},"▭",-1),d.createElementVNode("span",{class:"tool-label"},"矩形",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="ellipse"}]),onClick:C[4]||(C[4]=w=>p("ellipse"))},[...C[12]||(C[12]=[d.createElementVNode("div",{class:"tool-icon"},"⭕",-1),d.createElementVNode("span",{class:"tool-label"},"椭圆",-1)])],2)])]),C[21]||(C[21]=d.createElementVNode("div",{class:"divider"},null,-1)),d.createElementVNode("div",L8,[C[16]||(C[16]=d.createElementVNode("div",{class:"section-label"},"样式设置",-1)),d.createElementVNode("div",R8,[C[14]||(C[14]=d.createElementVNode("span",{class:"style-label"},"颜色",-1)),d.createElementVNode("div",F8,[d.createElementVNode("div",{class:"color-preview",style:d.normalizeStyle({backgroundColor:r.value})},null,4),d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":C[5]||(C[5]=w=>r.value=w),onChange:f,class:"color-input"},null,544),[[d.vModelText,r.value]])])]),d.createElementVNode("div",O8,[C[15]||(C[15]=d.createElementVNode("span",{class:"style-label"},"线宽",-1)),d.createElementVNode("div",G8,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(c,w=>d.createElementVNode("button",{key:w.value,class:d.normalizeClass(["width-btn",{active:a.value===w.value}]),onClick:M=>m(w.value)},[d.createElementVNode("div",{class:"width-line",style:d.normalizeStyle({height:w.value+"px",backgroundColor:a.value===w.value?"#00e5d1":"#fff"})},null,4),d.createElementVNode("span",V8,d.toDisplayString(w.label),1)],10,U8)),64))])])]),C[22]||(C[22]=d.createElementVNode("div",{class:"divider"},null,-1)),d.createElementVNode("div",{class:"action-section"},[C[20]||(C[20]=d.createElementVNode("div",{class:"section-label"},"操作",-1)),d.createElementVNode("div",{class:"action-grid"},[d.createElementVNode("button",{class:"action-btn delete-btn",onClick:y},[...C[17]||(C[17]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("polyline",{points:"3 6 5 6 21 6"}),d.createElementVNode("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})],-1),d.createElementVNode("span",null,"删除",-1)])]),d.createElementVNode("button",{class:"action-btn clear-btn",onClick:g},[...C[18]||(C[18]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1),d.createElementVNode("span",null,"清空",-1)])]),d.createElementVNode("button",{class:"action-btn save-btn",onClick:A},[...C[19]||(C[19]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("path",{d:"M19 21H5a2 2 0 01-2-2V5a2 2 0 012-2h11l5 5v11a2 2 0 01-2 2z"}),d.createElementVNode("polyline",{points:"17 21 17 13 7 13 7 21"}),d.createElementVNode("polyline",{points:"7 3 7 8 15 8"})],-1),d.createElementVNode("span",null,"保存",-1)])])])])])])):d.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-9b4979c4"]]),z8=["src"],Wr=Be(d.defineComponent({__name:"LeitingBIM",props:{accessToken:{},cesiumUrl:{},cesiumCssUrl:{},methods:{},viewerOptions:{},treeProps:{},showTree:{type:Boolean,default:!0},showMenu:{type:Boolean,default:!1},playerUrl:{default:"https://leiting.chenxisoft.com/resource/person/person.glb"},playerModelName:{default:"Person"},playerModelId:{default:"player_111"},playerScale:{default:.0032},tiandituToken:{default:"c25f14fb6bd4397cf8fe45144ff768d6"},globe:{type:Boolean,default:void 0},terrain:{type:Boolean,default:void 0},depthTest:{type:Boolean,default:void 0},mapProvider:{},tiandituLayerType:{},tiandituShowLabel:{type:Boolean,default:void 0},arcgisUrl:{},teleportTarget:{},shadows:{type:Boolean,default:void 0},environmentMap:{type:Boolean,default:void 0},ambientOcclusion:{type:Boolean,default:void 0},time:{},brightness:{},backgroundColor:{},collision:{type:Boolean,default:void 0},mouseHabit:{},mode:{default:"3d"},mountAll3Dtiles:{},mountAllCad:{},saveRegion:{},saveCadRegion:{},saveCadCalibration:{},selectionChange:{},searchComponent:{}},emits:["register","init","ready"],setup(i,{expose:e,emit:t}){const n=d.ref(),s=d.ref(),o=d.getCurrentInstance(),r=d.ref(!1),a=d.ref(""),l=d.ref({}),c=d.ref("3d"),{isMobile:h}=Fr(),u=i,p={title:"构件树",treeData:[]},f=d.ref(!1),m=d.ref(!1),y=d.ref(!1),g=d.ref(!1),A=d.ref(!1),v=d.ref(!1),C=d.ref(!1),w=d.ref(!1),M=d.ref(!1),x=d.ref(!1),I=d.ref(!1),S=d.ref(null),{visible:R,position:b,items:B,show:L,hide:O}=Mm(),N=d.ref([]),D=j=>{N.value.push(j)},E=j=>{N.value=N.value.filter(Y=>Y.id!==j)},T=d.ref([]),P=d.ref(""),F=d.ref(null),V=d.ref([]),G=d.reactive({tree:!1,section:!1,roam:!1,info:!1,adjustModel:!1,setting:!1,cadLayer:!1,cadPosition:!1,gisCadPosition:!1,annotation:!1}),k=(j,Y)=>{j==="componentTree"&&(j="tree"),j==="componentInfo"&&(j="info"),j in G&&(G[j]=Y)},_=d.shallowRef({});d.provide("leitingMethods",_);const U=d.ref(u.showMenu),H=d.ref([]);d.watch(()=>u.showMenu,j=>{U.value=j},{immediate:!0}),d.watch(()=>u.mode,j=>{j&&_.value?.set2d&&_.value.set2d(j==="2d")});const q=d.ref("dark");d.provide("leiting-theme",q);const X=d.ref(u.teleportTarget);d.watch(()=>u.teleportTarget,j=>{X.value=j});const de=d.ref([]),fe=d.computed(()=>{const j=[];return f.value&&(j.push("tree"),j.push("componentTree")),m.value&&j.push("section"),y.value&&j.push("roam"),g.value&&(j.push("info"),j.push("componentInfo")),A.value&&j.push("adjust"),v.value&&j.push("setting"),C.value&&j.push("cadLayer"),w.value&&j.push("cadPosition"),M.value&&j.push("gisCadPosition"),x.value&&j.push("annotation"),I.value&&(j.push("measure"),j.push("measurement")),j.push(...de.value),j}),me=d.ref(null),be=(j,Y)=>{j==="componentTree"||j==="tree"?f.value=Y:j==="section"?m.value=Y:j==="roam"?y.value=Y:j==="componentInfo"||j==="info"?g.value=Y:j==="homeView"?_.value?.is2dMode?.()?_.value?.flyToTopView?.({}):_.value?.getBIMmodelId()?_.value?.flyToTileset?.({}):_.value?.getCadModelId()&&_.value?.flyToTopView?.({}):j==="adjustModel"?(A.value=Y,Y&&me.value&&me.value.setModelType("BIM")):j==="osgbAdjust"?(A.value=Y,Y&&me.value&&me.value.setModelType("OSGB")):j==="setting"?v.value=Y:j==="cadLayer"?C.value=Y:j==="cadPosition"?w.value=Y:j==="gisCadPosition"?M.value=Y:j==="annotation"?x.value=Y:j==="measurement"?I.value=Y:Y?de.value.includes(j)||de.value.push(j):de.value=de.value.filter(te=>te!==j)},_e=j=>{const Y=j.key||j.ID;if(!Y)return;if(Y==="homeView"||Y==="home"){be(Y,!0);return}if(Y==="measurement"){S.value="distance",I.value=!0;return}const te=!fe.value.includes(j.ID);be(Y,te)},Je=j=>{const Y=j.sub;if(!Y)return;const te=Y.parentKey||j.parent?.key;te==="measurement"?(S.value=Y.id.replace("measure-",""),I.value=!0):te==="section"&&(m.value=!0)};d.watch(f,async j=>{if(j&&_.value?.loadTreeForModel&&_.value?.getMapTileset){const Y=_.value.getMapTileset(),te=Object.values(Y).map(async ze=>{if(ze.leiting&&ze.leiting.model?.treeUrl){const It=ze.leiting.model.modelId;try{ze.leiting?.node?.batchIdEIDInfos||await _.value.loadNodeDetailsForModel(It);const $t=await _.value.loadTreeForModel(It);$t&&(Array.isArray($t)?$t:[$t]).forEach(Yi=>{Yi&&!V.value.find(zd=>zd.id===Yi.id)&&(Yi.modelId=It,V.value=[...V.value,Yi])})}catch($t){console.warn(`Failed to lazy load tree for ${It}`,$t)}}});await Promise.all(te)}});const lt=()=>{_.value&&(_.value.getDxfModels&&(T.value=_.value.getDxfModels()||[]),_.value.getCadModelId&&(P.value=_.value.getCadModelId()||""))};let ct;d.watch(C,j=>{j&<()}),d.watch(w,j=>{j&&(lt(),F.value&&T.value.length&&F.value.addGltfOr3dTilesModelList(T.value))});const Bt=t,vt=j=>{_.value&&_.value.saveCadCalibration&&_.value.saveCadCalibration(j),_.value&&_.value.saveCadRegion&&_.value.saveCadRegion(j)};return d.onMounted(async()=>{if(s.value&&pe.setContainer(s.value),!!n.value)try{const j={...bn,cesiumUrl:u.cesiumUrl||bn.cesiumUrl,cesiumCssUrl:u.cesiumCssUrl||bn.cesiumCssUrl,accessToken:u.accessToken||Kd()||bn.accessToken};await Ua(j),r.value=!0,ct=async(te={},ze)=>{if(n.value){const{showMenu:It,showTree:$t,globe:yn,terrain:Yi,depthTest:zd,mapProvider:nU,tiandituLayerType:sU,tiandituShowLabel:oU,arcgisUrl:rU,shadows:aU,environmentMap:lU,ambientOcclusion:cU,time:dU,brightness:hU,backgroundColor:uU,collision:fU,mouseHabit:pU,heightBasedZoom:mU,mode:sy,...ci}=te||{},gU=u.showMenu!==void 0?u.showMenu:It!==void 0?It:!0;U.value=gU;const ft=(ne,He,jt)=>ne!==void 0?ne:He!==void 0?He:jt,oy=ft(u.globe,yn,!1),ry=ft(u.terrain,Yi,!1),ay=ft(u.depthTest,zd,!1),ly=ft(u.mapProvider,nU,"tianditu"),cy=ft(u.tiandituLayerType,sU,"img_w"),dy=ft(u.tiandituShowLabel,oU,!1),hy=ft(u.arcgisUrl,rU,"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"),uy=ft(u.shadows,aU,!1),fy=ft(u.environmentMap,lU,!1),py=ft(u.ambientOcclusion,cU,!1),my=ft(u.time,dU,void 0),gy=ft(u.brightness,hU,1),Na=u.mode||sy||"3d";console.log("LeitingBIM Mode:",Na,"Props:",u.mode,"Options:",sy),c.value=Na;const yU=Na==="2d"?"#000000":"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)",yy=ft(u.backgroundColor,uU,yU),Ay=ft(u.collision,fU,!1),vy=ft(u.mouseHabit,pU,0),by=ft(u.heightBasedZoom,mU,!1);l.value={globe:oy,terrain:ry,depthTest:ay,mapProvider:ly,tiandituLayerType:cy,tiandituShowLabel:dy,arcgisUrl:hy,shadows:uy,environmentMap:fy,ambientOcclusion:py,time:my,brightness:gy,backgroundColor:yy,collision:Ay,mouseHabit:vy,heightBasedZoom:by,useBrowserRecommendedResolution:!0};const No=CB({container:n.value,appContext:o?.appContext,methods:{..._.value,handleMenuAction:be,setCardFullHeight:k,onLoadingStatus:ne=>{ne?pe.loading(ne,"",s.value):pe.close()},...ci,tilesLoad3dTiles:async ne=>{let He=ne.leiting?.tree;const jt=ne.leiting?.model?.modelId;if(!He&&f.value&&_.value?.loadTreeForModel)try{He=await _.value.loadTreeForModel(jt)}catch(Ro){console.warn("Failed to lazy load tree",Ro)}He&&(Array.isArray(He)?He:[He]).forEach(vn=>{vn&&!V.value.find(wy=>wy.id===vn.id)&&(vn.modelId=jt,V.value=[...V.value,vn])});const{brightness:Hd,contrast:Yd,saturation:Ci}=No.methods.getConfigure();No.methods.setModelColorAdjustment({brightness:Hd,contrast:Yd,saturation:Ci}),ci.tilesLoad3dTiles?.(ne)},mountAll3Dtiles:ne=>{u.mountAll3Dtiles&&u.mountAll3Dtiles(ne),ci.mountAll3Dtiles?.(ne)},updateModels:ne=>{if(Array.isArray(ne))if(ne.length===0)V.value=[];else{const He=ne.map(jt=>jt.modelId);V.value=V.value.filter(jt=>He.includes(jt.modelId))}},mountAllCad:ne=>{if(No.methods.setModelBrightness){const He=u.brightness!==void 0?u.brightness:l.value.brightness;He!==void 0&&No.methods.setModelBrightness(He)}u.mountAllCad&&u.mountAllCad(ne),ci.mountAllCad?.(ne)},saveRegion:ne=>{u.saveRegion&&u.saveRegion(ne),ci.saveRegion?.(ne)},saveCadRegion:ne=>{u.saveCadRegion&&u.saveCadRegion(ne),ci.saveCadRegion?.(ne)},saveCadCalibration:ne=>{u.saveCadCalibration&&u.saveCadCalibration(ne),ci.saveCadCalibration?.(ne)},selectionChange:ne=>{u.selectionChange&&u.selectionChange(ne),ci.selectionChange?.(ne)},onSearchComponent:ne=>{u.searchComponent&&u.searchComponent(ne),ci.searchComponent?.(ne)}},viewerOptions:u.viewerOptions,options:{...ci,mode:Na,playerUrl:u.playerUrl,playerModelName:u.playerModelName,playerModelId:u.playerModelId,playerScale:u.playerScale,globe:oy,terrain:ry,depthTest:ay,mapProvider:ly,tiandituLayerType:cy,tiandituShowLabel:dy,tiandituToken:u.tiandituToken,arcgisUrl:hy,shadows:uy,environmentMap:fy,ambientOcclusion:py,time:my,brightness:gy,backgroundColor:yy,collision:Ay,mouseHabit:vy,heightBasedZoom:by},callbacks:{onLoading:ne=>ne?pe.loading(ne,"",s.value):pe.close(),onSuccess:ne=>pe.success(ne,"",void 0,s.value),onError:ne=>pe.error(ne,"",void 0,s.value)}}),{Cesium:An,viewer:gs,methods:La,menuEvents:Lo}=No,xe=La;Lo.on("showMenu",ne=>{U.value=ne}),Lo.on("insertMenu",ne=>{H.value=[...H.value,...ne]}),Lo.on("setMenuActive",(ne,He)=>{be(ne,He)}),_.value=xe,ze&&(ze.value=xe),Lo.on("setMode",ne=>{c.value=ne}),Lo.on("deleteAllModels",()=>{V.value=[]}),new An.ScreenSpaceEventHandler(gs.scene.canvas).setInputAction(async ne=>{if(O(),c.value==="2d")return;const He=gs.scene.pick(ne.position),jt=gs.container.getBoundingClientRect(),Hd=jt.left+ne.position.x,Yd=jt.top+ne.position.y,Ci=[];if(An.defined(He)&&He instanceof An.Cesium3DTileFeature){const Ro=xe.baseCompt.getFeatureId(He),vn=ks(He.tileset);xe.baseCompt.hasSelectedFeaturesMap[vn]?.some(Fo=>Fo.batchId===Ro&&Fo.rank===0)||(await xe.baseCompt.clearSelection(),await xe.baseCompt.toggleMultiSelect(vn,Ro,xe.baseCompt.selectedColor)),Ci.push({id:"details",label:"构件详情",action:()=>{g.value=!0}}),Ci.push({id:"hide",label:"隐藏选中构件",action:async()=>{const Oo=(await xe.baseCompt.getSelected()).map(wi=>({elementId:wi.elementId,modelId:wi.modelId,show:!1}));xe.baseCompt.setComponentVisibility(Oo)}}),Ci.push({id:"translucent",label:"半透明选中构件",action:async()=>{const Oo=(await xe.baseCompt.getSelected()).map(wi=>({elementId:wi.elementId,modelId:wi.modelId,rgba:{...wi.rgba,a:.3}}));await xe.baseCompt.setSelectColorUserModelCpt(Oo,{rank:0})}}),Ci.push({id:"isolate",label:"隔离选中构件",divided:!0,action:async()=>{await xe.baseCompt.loadAllNodeDetailsForModel();const Oo=(await xe.baseCompt.getSelected()).map(wi=>({elementId:wi.elementId,modelId:wi.modelId,show:!0}));xe.isolateComponents(Oo)}})}Ci.push({id:"showAll",label:"显示所有",action:async()=>{xe.baseCompt.setAllComponentsVisibility(!0),await xe.baseCompt.clearSelection()}}),Ci.push(...N.value),L({x:Hd,y:Yd},Ci)},An.ScreenSpaceEventType.RIGHT_CLICK),xe.addContextMenuItems=D,xe.insertContextMenu=xe.addContextMenuItems,xe.removeContextMenuItems=E,xe.deleteContextMenu=xe.removeContextMenuItems,xe.closeContextMenu=O,xe.hideContextMenu=xe.closeContextMenu,xe.onSetTeleportTarget=ne=>{X.value=ne},await d.nextTick();const Cy=te?.onLoaded||te?.onloaded;Cy&&Cy({Cesium:An,viewer:gs,methods:La}),Bt("init",{Cesium:An,viewer:gs,methods:La}),Bt("ready",{Cesium:An,viewer:gs,methods:La})}};let Y=!1;Bt("register",(te,ze)=>{Y=!0,ct(te,ze)}),Y||setTimeout(()=>{_.value.getViewer||ct()},0)}catch(j){a.value="Failed to load Cesium: "+(j.message||j),console.error(j)}}),d.onUnmounted(()=>{pe.setContainer(null)}),e({initMap:()=>_.value,initializeViewer:(j,Y)=>ct(j,Y)}),(j,Y)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-bim-container",[`theme-${q.value}`]]),onContextmenu:Y[29]||(Y[29]=d.withModifiers(()=>{},["prevent","stop"]))},[!r.value&&!a.value?(d.openBlock(),d.createBlock(d.unref(oe.Spin),{key:0,class:"loading",size:"large",tip:"加载基础组件中..."})):d.createCommentVNode("",!0),a.value?(d.openBlock(),d.createBlock(d.unref(oe.Alert),{key:1,class:"error",type:"error",message:a.value,"show-icon":""},null,8,["message"])):d.createCommentVNode("",!0),d.createElementVNode("div",{ref_key:"containerRef",ref:n,class:"cesium-viewer"},[d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(ao,{key:0,visible:U.value,"active-ids":fe.value,"custom-items":H.value,onAction:be,"is-2d":c.value==="2d"},null,8,["visible","active-ids","custom-items","is-2d"])),d.unref(h)&&!y.value&&!I.value?(d.openBlock(),d.createBlock(Tm,{key:1,"active-ids":fe.value,"is-2d":c.value==="2d",onItemClick:_e,onSubItemClick:Je},null,8,["active-ids","is-2d"])):d.createCommentVNode("",!0),d.unref(h)&&i.showTree!==!1&&!y.value&&c.value!=="2d"?(d.openBlock(),d.createElementBlock("button",{key:2,class:d.normalizeClass(["mobile-float-tree-btn",{active:f.value}]),onClick:Y[0]||(Y[0]=te=>f.value=!f.value)},[d.createElementVNode("img",{src:d.unref(Gr),class:"mobile-float-tree-icon",alt:"目录树"},null,8,z8)],2)):d.createCommentVNode("",!0),(d.openBlock(),d.createBlock(d.Teleport,{to:X.value||"body",disabled:!X.value},[d.createElementVNode("div",{ref_key:"uiOverlayRef",ref:s,class:"leiting-ui-overlay"},[d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(ho,{key:0,visible:g.value,"full-height":G.info,"onUpdate:visible":Y[1]||(Y[1]=te=>g.value=te)},null,8,["visible","full-height"])),d.unref(h)?(d.openBlock(),d.createBlock(Nm,{key:1,visible:g.value,"onUpdate:visible":Y[2]||(Y[2]=te=>g.value=te),onClose:Y[3]||(Y[3]=()=>{g.value=!1})},null,8,["visible"])):d.createCommentVNode("",!0),d.createVNode(uo,{ref_key:"LeitingPositionRef",ref:me,visible:A.value,"full-height":G.adjustModel,"onUpdate:visible":Y[4]||(Y[4]=te=>A.value=te)},null,8,["visible","full-height"]),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(fo,{key:2,visible:v.value,"full-height":G.setting,"tianditu-token":u.tiandituToken,"initial-config":l.value,"onUpdate:visible":Y[5]||(Y[5]=te=>v.value=te)},null,8,["visible","full-height","tianditu-token","initial-config"])),d.unref(h)?(d.openBlock(),d.createBlock(_m,{key:3,visible:v.value,"onUpdate:visible":Y[6]||(Y[6]=te=>v.value=te),onClose:Y[7]||(Y[7]=()=>{v.value=!1,de.value=de.value.filter(te=>te!=="setting")})},null,8,["visible"])):d.createCommentVNode("",!0),i.showTree!==!1&&!d.unref(h)?(d.openBlock(),d.createBlock(Or,d.mergeProps({key:4},{...p,...i.treeProps},{visible:f.value,"full-height":G.tree,"tree-data":V.value.length>0?V.value:i.treeProps?.treeData||[],"onUpdate:visible":Y[8]||(Y[8]=te=>{f.value=te})}),null,16,["visible","full-height","tree-data"])):d.createCommentVNode("",!0),i.showTree!==!1&&d.unref(h)?(d.openBlock(),d.createBlock(Bm,{key:5,visible:f.value,"tree-data":V.value.length>0?V.value:i.treeProps?.treeData||[],"onUpdate:visible":Y[9]||(Y[9]=te=>{f.value=te}),onClose:Y[10]||(Y[10]=()=>{f.value=!1})},null,8,["visible","tree-data"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(cN,{key:6,visible:x.value,"onUpdate:visible":Y[11]||(Y[11]=te=>x.value=te)},null,8,["visible"])),d.unref(h)?(d.openBlock(),d.createBlock(Q8,{key:7,visible:x.value,"onUpdate:visible":Y[12]||(Y[12]=te=>x.value=te)},null,8,["visible"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(BN,{key:8,visible:I.value,"onUpdate:visible":Y[13]||(Y[13]=te=>I.value=te)},null,8,["visible"])),d.unref(h)?(d.openBlock(),d.createBlock(Pm,{key:9,visible:I.value,"default-tool":S.value,"onUpdate:visible":Y[14]||(Y[14]=te=>{I.value=te,te||(S.value=null)}),onClose:Y[15]||(Y[15]=()=>{I.value=!1,S.value=null})},null,8,["visible","default-tool"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(lo,{key:10,visible:m.value,"full-height":G.section,"onUpdate:visible":Y[16]||(Y[16]=te=>m.value=te)},null,8,["visible","full-height"])),d.unref(h)?(d.openBlock(),d.createBlock(km,{key:11,visible:m.value,"onUpdate:visible":Y[17]||(Y[17]=te=>m.value=te),onClose:Y[18]||(Y[18]=()=>{m.value=!1})},null,8,["visible"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(co,{key:12,visible:y.value,"full-height":G.roam,"onUpdate:visible":Y[19]||(Y[19]=te=>y.value=te)},null,8,["visible","full-height"])),d.unref(h)?(d.openBlock(),d.createBlock(Dm,{key:13,visible:y.value,"onUpdate:visible":Y[20]||(Y[20]=te=>y.value=te),onClose:Y[21]||(Y[21]=()=>{y.value=!1})},null,8,["visible"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(Jk,{key:14,visible:C.value,"current-model-id":P.value,"onUpdate:visible":Y[22]||(Y[22]=te=>C.value=te),onHandleCloseCardByCadCard:Y[23]||(Y[23]=()=>{C.value=!1})},null,8,["visible","current-model-id"])),d.unref(h)?(d.openBlock(),d.createBlock(k8,{key:15,visible:C.value,"current-model-id":P.value,"onUpdate:visible":Y[24]||(Y[24]=te=>C.value=te),onHandleCloseCardByCadCard:Y[25]||(Y[25]=()=>{C.value=!1})},null,8,["visible","current-model-id"])):d.createCommentVNode("",!0),d.createVNode(YP,{ref_key:"cadPositionRef",ref:F,visible:w.value,"onUpdate:visible":Y[26]||(Y[26]=te=>w.value=te),onSave:vt},null,8,["visible"]),d.createVNode(eN,{visible:M.value,"onUpdate:visible":Y[27]||(Y[27]=te=>M.value=te)},null,8,["visible"]),d.createVNode(DN,{visible:d.unref(R),position:d.unref(b),items:d.unref(B),"onUpdate:visible":Y[28]||(Y[28]=te=>R.value=te)},null,8,["visible","position","items"]),d.renderSlot(j.$slots,"default",d.normalizeProps(d.guardReactiveProps({methods:_.value,isReady:r.value})),void 0,!0)],512)],8,["to","disabled"]))],512)],34))}}),[["__scopeId","data-v-23352a4a"]]);function H8(i,e={}){const{tapDelay:t=300,doubleTapDelay:n=300,moveThreshold:s=10}=e;let o=0,r={x:0,y:0},a=0,l=0,c=null;const h=[],u=[],p=[],f={},m=b=>{const B=b.touches[0]||b.changedTouches[0];return{x:B?.clientX??0,y:B?.clientY??0}},y=b=>{const B=m(b);o=Date.now(),r=B,a=0,p.forEach(({handler:L,delay:O})=>{c=window.setTimeout(()=>{L(b),c=null},O)})},g=b=>{const B=m(b),L=B.x-r.x,O=B.y-r.y;a=Math.sqrt(L*L+O*O),c&&a>s&&(clearTimeout(c),c=null)},A=b=>{const B=Date.now()-o,L=m(b),O=L.x-r.x,N=L.y-r.y;c&&(clearTimeout(c),c=null);const D=B<t&&a<s;if(D&&Date.now()-l<n&&a<s?(u.forEach(P=>P(b)),l=0):D&&(h.forEach(P=>P(b)),l=Date.now()),a>50){const P=Math.abs(O),F=Math.abs(N);P>F?O>0&&f.right?f.right(b):O<0&&f.left&&f.left(b):N>0&&f.down?f.down(b):N<0&&f.up&&f.up(b)}},v=b=>{h.push(b)},C=b=>{u.push(b)},w=(b,B=500)=>{p.push({handler:b,delay:B})},M=b=>{f.left=b},x=b=>{f.right=b},I=b=>{f.up=b},S=b=>{f.down=b},R=()=>{c&&(clearTimeout(c),c=null),h.length=0,u.length=0,p.length=0,Object.keys(f).forEach(b=>{delete f[b]})};return d.onMounted(()=>{const b=i.value;b&&(b.addEventListener("touchstart",y,{passive:!1}),b.addEventListener("touchmove",g,{passive:!1}),b.addEventListener("touchend",A,{passive:!1}))}),d.onUnmounted(()=>{R();const b=i.value;b&&(b.removeEventListener("touchstart",y),b.removeEventListener("touchmove",g),b.removeEventListener("touchend",A))}),{onTap:v,onDoubleTap:C,onLongPress:w,onSwipeLeft:M,onSwipeRight:x,onSwipeUp:I,onSwipeDown:S,destroy:R}}function Y8(i){const e=t=>{t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLSelectElement||t.preventDefault()};return i.addEventListener("touchmove",e,{passive:!1}),()=>{i.removeEventListener("touchmove",e)}}function $8(){let i=0;const e=t=>{const n=Date.now();n-i<=300&&t.preventDefault(),i=n};return document.addEventListener("touchend",e,{passive:!1}),document.addEventListener("gesturestart",t=>t.preventDefault()),document.addEventListener("gesturechange",t=>t.preventDefault()),()=>{document.removeEventListener("touchend",e)}}function j8(i,e={}){const{delay:t=500,moveThreshold:n=10}=e,s=d.ref(!1);let o=null,r={x:0,y:0},a=!1;const l=f=>{if(f.touches.length!==1)return;f.preventDefault(),a=!0,s.value=!1;const m=f.touches[0];r={x:m?.clientX??0,y:m?.clientY??0},o=window.setTimeout(()=>{a&&(s.value=!0,i())},t)},c=f=>{if(!a||o===null)return;const m=f.touches[0],y=(m?.clientX??0)-r.x,g=(m?.clientY??0)-r.y;Math.sqrt(y*y+g*g)>n&&u()},h=()=>{a=!1,s.value=!1,o!==null&&(clearTimeout(o),o=null)},u=()=>{a=!1,s.value=!1,o!==null&&(clearTimeout(o),o=null)};return{isLongPressing:s,handlers:{onTouchStart:l,onTouchMove:c,onTouchEnd:h},start:l,end:h,cancel:u}}function W8(i,e,t={}){const{delay:n=500,moveThreshold:s=10}=t;let o=null,r={x:0,y:0};const a=h=>{if(h.touches.length!==1)return;h.preventDefault();const u=h.touches[0];r={x:u?.clientX??0,y:u?.clientY??0},o=window.setTimeout(()=>{e()},n)},l=h=>{if(o===null)return;const u=h.touches[0],p=(u?.clientX??0)-r.x,f=(u?.clientY??0)-r.y;Math.sqrt(p*p+f*f)>s&&(clearTimeout(o),o=null)},c=()=>{o!==null&&(clearTimeout(o),o=null)};return i.addEventListener("touchstart",a,{passive:!1}),i.addEventListener("touchmove",l,{passive:!1}),i.addEventListener("touchend",c),i.addEventListener("touchcancel",c),()=>{o!==null&&(clearTimeout(o),o=null),i.removeEventListener("touchstart",a),i.removeEventListener("touchmove",l),i.removeEventListener("touchend",c),i.removeEventListener("touchcancel",c)}}const q8={tapThreshold:10,doubleTapInterval:300,longPressDelay:500,panThreshold:20,pinchThreshold:.02};function K8(i={}){const e={...q8,...i},t=d.reactive({type:"none",startX:0,startY:0,currentX:0,currentY:0,deltaX:0,deltaY:0,scale:1,rotation:0,velocityX:0,velocityY:0,duration:0}),n=d.ref(!1),s=d.ref(!1),o=d.ref(!1);let r=0,a=0,l=null,c=0,h=1,u=0,p=null;const f={onTap:[],onDoubleTap:[],onLongPress:[],onPanStart:[],onPanMove:[],onPanEnd:[],onPinchStart:[],onPinchMove:[],onPinchEnd:[],onRotate:[]},m=N=>{if(N.length<2)return 0;const D=N[1].clientX-N[0].clientX,E=N[1].clientY-N[0].clientY;return Math.sqrt(D*D+E*E)},y=N=>N.length<2?0:Math.atan2(N[1].clientY-N[0].clientY,N[1].clientX-N[0].clientX)*(180/Math.PI);return{state:t,isActive:n,isPanning:s,isPinching:o,handlers:{onTouchStart:N=>{if(N.touches.length===1){const D=N.touches[0];p=D.identifier,r=Date.now(),t.startX=D.clientX,t.startY=D.clientY,t.currentX=D.clientX,t.currentY=D.clientY,t.deltaX=0,t.deltaY=0,n.value=!0,l=window.setTimeout(()=>{t.type="long-press",f.onLongPress.forEach(E=>E(N))},e.longPressDelay)}else N.touches.length===2&&(l&&(clearTimeout(l),l=null),o.value=!0,c=m(N.touches),h=1,u=y(N.touches),f.onPinchStart.forEach(D=>D(N)))},onTouchMove:N=>{if(N.touches.length===1&&p!==null){let D=null;for(let F=0;F<N.touches.length;F++)if(N.touches[F].identifier===p){D=N.touches[F];break}if(!D)return;const E=D.clientX-t.startX,T=D.clientY-t.startY;Math.sqrt(E*E+T*T)>e.panThreshold&&!s.value&&(s.value=!0,t.type="pan",l&&(clearTimeout(l),l=null),f.onPanStart.forEach(F=>F(N))),s.value&&(N.preventDefault(),t.deltaX=D.clientX-t.currentX,t.deltaY=D.clientY-t.currentY,t.currentX=D.clientX,t.currentY=D.clientY,t.velocityX=t.deltaX,t.velocityY=t.deltaY,f.onPanMove.forEach(F=>F(N)))}else if(N.touches.length===2&&o.value){N.preventDefault();const D=m(N.touches),E=y(N.touches),T=D/c;t.scale=h*T,t.rotation=E-u,f.onPinchMove.forEach(P=>P(N)),f.onRotate.forEach(P=>P(N))}},onTouchEnd:N=>{if(t.duration=Date.now()-r,l&&(clearTimeout(l),l=null),N.touches.length===0){if(s.value)t.type="pan",f.onPanEnd.forEach(D=>D(N));else if(o.value)f.onPinchEnd.forEach(D=>D(N));else if(t.type==="none"&&t.duration<300){const D=Date.now();D-a<e.doubleTapInterval?(t.type="double-tap",f.onDoubleTap.forEach(E=>E(N)),a=0):(t.type="tap",f.onTap.forEach(E=>E(N)),a=D)}s.value=!1,o.value=!1,n.value=!1,p=null,setTimeout(()=>{t.type="none",t.deltaX=0,t.deltaY=0,t.scale=1,t.rotation=0},50)}}},onTap:N=>{f.onTap.push(N)},onDoubleTap:N=>{f.onDoubleTap.push(N)},onLongPress:N=>{f.onLongPress.push(N)},onPanStart:N=>{f.onPanStart.push(N)},onPanMove:N=>{f.onPanMove.push(N)},onPanEnd:N=>{f.onPanEnd.push(N)},onPinchStart:N=>{f.onPinchStart.push(N)},onPinchMove:N=>{f.onPinchMove.push(N)},onPinchEnd:N=>{f.onPinchEnd.push(N)},onRotate:N=>{f.onRotate.push(N)}}}const qr={enableFpsLimit:!0,targetFps:30,enableResolutionScale:!0,resolutionScale:.75,enableLazyLoad:!0,lazyLoadDelay:200,enableModelLod:!0,modelQualityLevel:"medium",enablePostProcessing:!1,enableFxaa:!1,enableAmbientOcclusion:!1,enableShadows:!1,maxTextureSize:1024,enableDebounce:!0,debounceDelay:100};function X8(i={}){const e={...qr,...i};return{requestRenderMode:e.enableFpsLimit,maximumRenderTimeChange:e.enableFpsLimit?1e3/e.targetFps:void 0,scene3DOnly:!0,shouldAnimate:!0}}function J8(i={}){const e={...qr,...i};return{resolutionScale:e.enableResolutionScale?e.resolutionScale:1,targetFrameRate:e.enableFpsLimit?e.targetFps:void 0,sceneModePicker:!1,navigationHelpButton:!1,animation:!1,timeline:!1,fullscreenButton:!1,vrButton:!1,infoBox:!1,selectionIndicator:!1,shadows:e.enableShadows,skyAtmosphere:e.enablePostProcessing,fog:e.enablePostProcessing}}function Z8(i={}){const e={...qr,...i},n={low:{maximumScreenSpaceError:64,skipScreenSpaceErrorFactor:256,skipLevels:8,baseScreenSpaceError:2048},medium:{maximumScreenSpaceError:48,skipScreenSpaceErrorFactor:128,skipLevels:5,baseScreenSpaceError:1024},high:{maximumScreenSpaceError:32,skipScreenSpaceErrorFactor:64,skipLevels:3,baseScreenSpaceError:512}}[e.modelQualityLevel];return{cullWithChildrenBounds:!0,cullRequestsWhileMoving:!0,cullRequestsWhileMovingMultiplier:10,backFaceCulling:!0,colorBlendAmount:0,minimumPixelSize:128,maximumScreenSpaceError:n.maximumScreenSpaceError,skipLevelOfDetail:e.enableModelLod,baseScreenSpaceError:n.baseScreenSpaceError,skipScreenSpaceErrorFactor:n.skipScreenSpaceErrorFactor,skipLevels:n.skipLevels,immediatelyLoadDesiredLevelOfDetail:!1,loadSiblings:!1,maximumMemoryUsage:4096*5,preloadWhenHidden:!0,preferLeaves:e.enableModelLod,progressiveResolutionHeightFraction:.5,dynamicScreenSpaceErrorDensity:.002,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorHeightFalloff:.25,foveatedConeSize:0,foveatedTimeDelay:10,foveatedMinimumScreenSpaceErrorRelaxation:0}}function eR(i=30){const e=d.ref(60),t=d.ref(!1);let n=0,s=0,o=0;const r=1e3/i,a=()=>{t.value=!0,n=performance.now(),o=n,s=0},l=()=>{if(!t.value)return!0;const h=performance.now(),u=h-n;return s++,h-o>=1e3&&(e.value=Math.round(s*1e3/(h-o)),s=0,o=h),u>=r?(n=h-u%r,!0):!1},c=()=>{t.value=!1};return d.onUnmounted(()=>{c()}),{fps:e,isControlling:t,startControl:a,stopControl:c,tick:l}}function tR(i,e){let t=null;const n=((...s)=>{t!==null&&clearTimeout(t),t=window.setTimeout(()=>{i(...s),t=null},e)});return n.cancel=()=>{t!==null&&(clearTimeout(t),t=null)},n}function iR(i,e){let t=!1;return((...s)=>{t||(i(...s),t=!0,setTimeout(()=>{t=!1},e))})}function nR(i,e=200){let t=null;const n=()=>{t!==null&&clearTimeout(t),t=window.setTimeout(()=>{i(),t=null},e)},s=()=>{t!==null&&(clearTimeout(t),t=null)};return d.onUnmounted(()=>{s()}),{load:n,cancel:s}}function Lm(i){const e=d.ref(),t=d.ref(i.theme||"dark"),n=d.ref(i.menuSize||"medium");d.provide("leiting-theme",t),d.provide("leiting-menu-size",n);function s(a){d.onUnmounted(()=>{e.value=null}),a(i,e)}function o(){const a=d.unref(e);return a||console.error("未获取到leiting实例!"),a}const r=new Proxy({},{get(a,l){const c=o();if(!c)return;const h=c[l];return typeof h=="function"?h.bind(c):h},set(a,l,c){const h=o();return h?(h[l]=c,!0):!1}});return[s,r]}const sR=bn,oR={install:(i,e)=>{if(i.component("LeitingBIM",Wr),i.component("LeitingTree",Or),i.component("LeitingDraggableCard",gt),i.component("leiting-draggable-card",gt),i.component("LeitingMenu",ao),i.component("leiting-menu",ao),i.component("LeitingSection",lo),i.component("leiting-section",lo),i.component("LeitingPlayer",co),i.component("leiting-player",co),i.component("LeitingInfo",ho),i.component("leiting-info",ho),i.component("LeitingPosition",uo),i.component("leiting-position",uo),i.component("LeitingSetting",fo),i.component("leiting-setting",fo),!e)return;const t={...sR,...e};t.cesiumUrl&&Ua(t).catch(n=>{console.error("[LeitingBim] Failed to load Cesium resources:",n)}),i.config.globalProperties.$leitingBimOptions=t}};function rR(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=i:s.appendChild(document.createTextNode(i))}}var aR="@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:100% 0}75%{background-position:0 100%}to{background-position:0 0}}@keyframes watermark-horizontal{0%{background-position-x:0}to{background-position-x:100%}}@keyframes watermark-vertical{0%{background-position-y:0}to{background-position-y:100%}}";rR(aR);var vc=function(i,e){return vc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])},vc(i,e)};function lR(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");vc(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Fi=function(){return Fi=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Fi.apply(this,arguments)};function pi(i,e,t,n){function s(o){return o instanceof t?o:new t(function(r){r(o)})}return new(t||(t=Promise))(function(o,r){function a(h){try{c(n.next(h))}catch(u){r(u)}}function l(h){try{c(n.throw(h))}catch(u){r(u)}}function c(h){h.done?o(h.value):s(h.value).then(a,l)}c((n=n.apply(i,e||[])).next())})}function ti(i,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,r=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return r.next=a(0),r.throw=a(1),r.return=a(2),typeof Symbol=="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(c){return function(h){return l([c,h])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,c[0]&&(t=0)),t;)try{if(n=1,s&&(o=c[0]&2?s.return:c[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,c[1])).done)return o;switch(s=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,s=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1],o=c;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(c);break}o[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(i,t)}catch(h){c=[6,h],s=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var Rm=function(i){return i.toDataURL("image/png",1)},Fm=function(i){return typeof i=="function"},Ht=function(i){return i===void 0},cR=function(i){return typeof i=="string"},Om=function(i,e,t){e===void 0&&(e={}),t===void 0&&(t="http://www.w3.org/2000/svg");var n=document.createElementNS(t,i);for(var s in e)n.setAttribute(s,e[s]);return n},dR=function(i,e,t){for(var n=[],s="",o="",r=0,a=e.length;r<a;r++){if(o=e.charAt(r),o===`
|
|
122
122
|
`){n.push(s),s="";continue}s+=o,i.measureText(s).width>t&&(n.push(s.substring(0,s.length-1)),s="",r--)}return n.push(s),n},hR=function(i,e){return pi(void 0,void 0,void 0,function(){var t,n,s,o,r,a,l,c,h;return ti(this,function(u){switch(u.label){case 0:return t=Om("svg",{xmlns:"http://www.w3.org/2000/svg"}),n=document.createElement("div"),n.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),n.style.cssText=`
|
|
123
123
|
text-align: center;
|
|
124
124
|
display: flex;
|
|
@@ -137,7 +137,7 @@ northing meters`+i;var p=u/2,f=0,m=0,y,g,A,v,C;return p>0&&(y=1e5/Math.pow(10,p)
|
|
|
137
137
|
z-index:`).concat(this.options.zIndex,"!important;background-image:url(").concat(t,")!important;background-repeat:").concat(this.options.backgroundRepeat,`!important;
|
|
138
138
|
background-size:`).concat(o[0],"px ").concat(o[1],"px!important;background-position:").concat(this.options.backgroundPosition,`;
|
|
139
139
|
`).concat(mR(this.options.movable,this.options.backgroundRepeat),`
|
|
140
|
-
`),this.watermarkDom.appendChild(n),this.parentElement.appendChild(this.watermarkDom),this.options.mutationObserve)try{this.bindMutationObserve()}catch{(h=(c=this.options).onObserveError)===null||h===void 0||h.call(c)}return e&&((p=(u=this.options).onSuccess)===null||p===void 0||p.call(u)),this.isCreating=!1,[2]}})})},i.prototype.destroy=function(){this.remove(),this.watermarkDom=void 0},i.prototype.check=function(){return pi(this,void 0,void 0,function(){return ti(this,function(e){return[2,this.parentElement.contains(this.watermarkDom)]})})},i.prototype.remove=function(){var e,t,n,s,o,r,a,l;(t=(e=this.options).onBeforeDestroy)===null||t===void 0||t.call(e),(n=this.observer)===null||n===void 0||n.disconnect(),(s=this.parentObserve)===null||s===void 0||s.disconnect(),(r=(o=this.watermarkDom)===null||o===void 0?void 0:o.parentNode)===null||r===void 0||r.removeChild(this.watermarkDom),(l=(a=this.options).onDestroyed)===null||l===void 0||l.call(a)},i.prototype.initConfigData=function(e,t){var n=this;t===void 0&&(t="overwrite"),t==="append"?Object.keys(e).forEach(function(s){n.props&&(n.props[s]=e[s])}):this.props=e,this.options=Fi(Fi({},Um),this.props),this.changeParentElement(this.options.parent),this.watermarkCanvas=new Kr(this.props,this.options)},i.prototype.changeParentElement=function(e){if(typeof e=="string"){var t=document.querySelector(e);t&&(this.parentElement=t)}else this.parentElement=e;this.parentElement||console.error("[WatermarkJsPlus]: please pass a valid parent element.")},i.prototype.validateUnique=function(){var e=!0;return Array.from(this.parentElement.childNodes).forEach(function(t){e&&Object.hasOwnProperty.call(t,"__WATERMARK__")&&(e=!1)}),e},i.prototype.validateContent=function(){switch(this.options.contentType){case"image":return Object.hasOwnProperty.call(this.options,"image");case"multi-line-text":case"rich-text":case"text":return this.options.content.length>0}},i.prototype.checkParentElementType=function(){return["html","body"].includes(this.parentElement.tagName.toLocaleLowerCase())?"root":"custom"},i.prototype.bindMutationObserve=function(){var e=this;this.watermarkDom&&(this.observer=new MutationObserver(function(t){return pi(e,void 0,void 0,function(){return ti(this,function(n){switch(n.label){case 0:return t.length>0?(this.remove(),[4,this.create()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})}),this.observer.observe(this.watermarkDom,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),this.parentObserve=new MutationObserver(function(t){return pi(e,void 0,void 0,function(){var n,s,o,r;return ti(this,function(a){switch(a.label){case 0:n=0,s=t,a.label=1;case 1:return n<s.length?(o=s[n],r=Array.from(o.removedNodes).includes(this.watermarkDom),r?(this.remove(),[4,this.create()]):[3,3]):[3,4];case 2:a.sent(),a.label=3;case 3:return n++,[3,1];case 4:return[2]}})})}),this.parentObserve.observe(this.parentElement,{childList:!0}))},i})();(function(i){lR(e,i);function e(t){t===void 0&&(t={});var n={globalAlpha:.005,mode:"blind"};return i.call(this,Fi(Fi({},t),n))||this}return e.prototype.changeOptions=function(){return pi(this,arguments,void 0,function(t,n,s){return t===void 0&&(t={}),n===void 0&&(n="overwrite"),s===void 0&&(s=!0),ti(this,function(o){switch(o.label){case 0:return t.globalAlpha=.005,t.mode="blind",this.initConfigData(t,n),bc(this.options.monitorProtection),s?(this.remove(),[4,this.create()]):[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})},e.decode=function(t){var n=t.url,s=n===void 0?"":n,o=t.fillColor,r=o===void 0?"#000":o,a=t.compositeOperation,l=a===void 0?"color-burn":a,c=t.mode,h=c===void 0?"canvas":c,u=t.compositeTimes,p=u===void 0?3:u,f=t.onSuccess;if(s&&h==="canvas"){var m=new Image;m.src=s,m.addEventListener("load",function(){var y=m.width,g=m.height,A=Kr.createCanvas(y,g),v=A.getContext("2d");if(!v)throw new Error("get context error");v.drawImage(m,0,0,y,g),v.globalCompositeOperation=l,v.fillStyle=r;for(var C=0;C<p;C++)v.fillRect(0,0,y,g);var w=Rm(A);Fm(f)&&f?.(w)})}},e})(Vm);const bR=Object.freeze(Object.defineProperty({__proto__:null,Watermark:Vm},Symbol.toStringTag,{value:"Module"}));function Ne(i,e){this.x=i,this.y=e}Ne.prototype={clone(){return new Ne(this.x,this.y)},add(i){return this.clone()._add(i)},sub(i){return this.clone()._sub(i)},multByPoint(i){return this.clone()._multByPoint(i)},divByPoint(i){return this.clone()._divByPoint(i)},mult(i){return this.clone()._mult(i)},div(i){return this.clone()._div(i)},rotate(i){return this.clone()._rotate(i)},rotateAround(i,e){return this.clone()._rotateAround(i,e)},matMult(i){return this.clone()._matMult(i)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(i){return this.x===i.x&&this.y===i.y},dist(i){return Math.sqrt(this.distSqr(i))},distSqr(i){const e=i.x-this.x,t=i.y-this.y;return e*e+t*t},angle(){return Math.atan2(this.y,this.x)},angleTo(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith(i){return this.angleWithSep(i.x,i.y)},angleWithSep(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult(i){const e=i[0]*this.x+i[1]*this.y,t=i[2]*this.x+i[3]*this.y;return this.x=e,this.y=t,this},_add(i){return this.x+=i.x,this.y+=i.y,this},_sub(i){return this.x-=i.x,this.y-=i.y,this},_mult(i){return this.x*=i,this.y*=i,this},_div(i){return this.x/=i,this.y/=i,this},_multByPoint(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint(i){return this.x/=i.x,this.y/=i.y,this},_unit(){return this._div(this.mag()),this},_perp(){const i=this.y;return this.y=this.x,this.x=-i,this},_rotate(i){const e=Math.cos(i),t=Math.sin(i),n=e*this.x-t*this.y,s=t*this.x+e*this.y;return this.x=n,this.y=s,this},_rotateAround(i,e){const t=Math.cos(i),n=Math.sin(i),s=e.x+t*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+t*(this.y-e.y);return this.x=s,this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ne},Ne.convert=function(i){if(i instanceof Ne)return i;if(Array.isArray(i))return new Ne(+i[0],+i[1]);if(i.x!==void 0&&i.y!==void 0)return new Ne(+i.x,+i.y);throw new Error("Expected [x, y] or {x, y} point format")};class Yn{constructor(e,t,n,s,o){for(this.properties=Object.create(null),this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=s,this._values=o;e.pos<t;){const r=e.readVarint();if(r===8)this.id=e.readVarint();else if(r===18){const a=e.readVarint()+e.pos;for(;e.pos<a;){const l=s[e.readVarint()],c=o[e.readVarint()];this.properties[l]=c}}else r===24?this.type=e.readVarint():(r===34&&(this._geometry=e.pos),e.skip(r))}}loadGeometry(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,n=[];let s,o=1,r=0,a=0,l=0;for(;e.pos<t;){if(r<=0){const c=e.readVarint();if(o=c&7,r=c>>3,r===0)continue}if(r--,o===1)a+=e.readSVarint(),l+=e.readSVarint(),s&&n.push(s),s=[new Ne(a,l)];else if(o===2)a+=e.readSVarint(),l+=e.readSVarint(),s&&s.push(new Ne(a,l));else if(o===7)s&&s.push(s[0].clone());else throw new Error(`unknown command ${o}`)}return s&&n.push(s),n}bbox(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let n=1,s=0,o=0,r=0,a=1/0,l=-1/0,c=1/0,h=-1/0;for(;e.pos<t;){if(s<=0){const u=e.readVarint();if(n=u&7,s=u>>3,s===0)continue}if(s--,n===1||n===2)o+=e.readSVarint(),r+=e.readSVarint(),o<a&&(a=o),o>l&&(l=o),r<c&&(c=r),r>h&&(h=r);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,c,l,h]}toGeoJSON(e,t,n){const s=this.extent*Math.pow(2,n),o=this.extent*e,r=this.extent*t,a=this.loadGeometry();function l(p){return[(p.x+o)*360/s-180,360/Math.PI*Math.atan(Math.exp((1-(p.y+r)*2/s)*Math.PI))-90]}function c(p){return p.map(l)}let h;if(this.type===1){const p=[];for(const m of a)p.push(m[0]);const f=c(p);h=p.length===1?{type:"Point",coordinates:f[0]}:{type:"MultiPoint",coordinates:f}}else if(this.type===2){const p=a.map(c);h=p.length===1?{type:"LineString",coordinates:p[0]}:{type:"MultiLineString",coordinates:p}}else if(this.type===3){const p=Qm(a),f=[];for(const m of p)f.push(m.map(c));h=f.length===1?{type:"Polygon",coordinates:f[0]}:{type:"MultiPolygon",coordinates:f}}else throw new Error("unknown feature type");const u={type:"Feature",geometry:h,properties:this.properties};return this.id!=null&&(u.id=this.id),u}}Yn.types=["Unknown","Point","LineString","Polygon"];function Qm(i){const e=i.length;if(e<=1)return[i];const t=[];let n,s;for(let o=0;o<e;o++){const r=CR(i[o]);r!==0&&(s===void 0&&(s=r<0),s===r<0?(n&&t.push(n),n=[i[o]]):n&&n.push(i[o]))}return n&&t.push(n),t}function CR(i){let e=0;for(let t=0,n=i.length,s=n-1,o,r;t<n;s=t++)o=i[t],r=i[s],e+=(r.x-o.x)*(o.y+r.y);return e}class wR{constructor(e,t){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],t===void 0&&(t=e.length);e.pos<t;){const n=e.readVarint();n===10?this.name=e.readString():n===18?(this._features.push(e.pos),e.skip(n)):n===26?this._keys.push(e.readString()):n===34?this._values.push(ER(e)):n===40?this.extent=e.readVarint():n===120?this.version=e.readVarint():e.skip(n)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Yn(this._pbf,t,this.extent,this._keys,this._values)}}function ER(i){let e=null;const t=i.readVarint()+i.pos;for(;i.pos<t;){const n=i.readVarint();e=n===10?i.readString():n===21?i.readFloat():n===25?i.readDouble():n===32?i.readVarint64():n===40?i.readVarint():n===48?i.readSVarint():n===56?i.readBoolean():(i.skip(n),null)}if(e==null)throw new Error("unknown feature value");return e}class xR{constructor(e,t=e.length){const n=Object.create(null);for(;e.pos<t;){const s=e.readVarint();if(s===26){const o=new wR(e,e.readVarint()+e.pos);o.length&&(n[o.name]=o)}else e.skip(s)}this.layers=n}}class Cc{constructor(e,t=""){this.type=e.type,this.styleSource=e,this.path=t,this.errorEvent=new Cesium.Event}async init(){}requestTile(e,t,n){}destroy(){this.styleSource=null,this.errorEvent=null}}const wc={};function Ec(i,e){wc[i]=e}class $n{constructor(e,t,n){this._name=e,this.dataBuffer=t,typeof n=="number"?this._size=n:(this.nullabilityBuffer=n,this._size=n.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Xr extends $n{}class xc extends Xr{getValueFromBuffer(e){return this.dataBuffer[e]}}class Ic extends Xr{getValueFromBuffer(e){return this.dataBuffer[e]}}class zm extends $n{constructor(e,t,n,s){super(e,t,s),this.delta=n}}class Sc extends zm{constructor(e,t,n,s){super(e,Int32Array.of(t),n,s)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class Mc extends $n{constructor(e,t,n,s){super(e,s?Int32Array.of(t):Uint32Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}class IR{constructor(e,t,n,s,o=4096){if(this._name=e,this._geometryVector=t,this._idVector=n,this._propertyVectors=s,this._extent=o,e.length===0)throw new Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(t=>[t.name,t]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],t=this.geometryVector.getGeometries();for(let n=0;n<this.numFeatures;n++){let s;if(this.idVector){const a=this.idVector.getValue(n);s=this.containsMaxSafeIntegerValues(this.idVector)&&a!==null?Number(a):a}const o={coordinates:t[n],type:this.geometryVector.geometryType(n)},r={};for(const a of this.propertyVectors){if(!a)continue;const l=a.name,c=a.getValue(n);c!==null&&(r[l]=c)}e.push({id:s,geometry:o,properties:r})}return e}containsMaxSafeIntegerValues(e){return e instanceof xc||e instanceof Mc||e instanceof Sc||e instanceof Ic}}const Jr={FEATURE:0},ge={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},po={GEOMETRY:0,STRUCT:1},Tc={ID:0};class Hm{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var re;(function(i){i.NONE="NONE",i.DELTA="DELTA",i.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",i.RLE="RLE",i.MORTON="MORTON",i.PDE="PDE"})(re||(re={}));var ii;(function(i){i.NONE="NONE",i.FAST_PFOR="FAST_PFOR",i.VARINT="VARINT"})(ii||(ii={}));const Bc=new Uint32Array(33);Bc[0]=0;for(let i=1;i<=32;i++)Bc[i]=i===32?4294967295:4294967295>>>32-i;const _c=Bc,Ym=65536,Yt=256;function kc(i,e){return i-i%e}function SR(i){return kc(i+31,32)}function MR(i){if(!Number.isFinite(i)||i<=0)return Ym;const e=kc(Math.floor(i),Yt);return e===0?Yt:e}function TR(i){const e=i>>>0;return((e&255)<<24|(e&65280)<<8|e>>>8&65280|e>>>24&255)>>>0}function BR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0;t[s++]=o>>>0&3,t[s++]=o>>>2&3,t[s++]=o>>>4&3,t[s++]=o>>>6&3,t[s++]=o>>>8&3,t[s++]=o>>>10&3,t[s++]=o>>>12&3,t[s++]=o>>>14&3,t[s++]=o>>>16&3,t[s++]=o>>>18&3,t[s++]=o>>>20&3,t[s++]=o>>>22&3,t[s++]=o>>>24&3,t[s++]=o>>>26&3,t[s++]=o>>>28&3,t[s++]=o>>>30&3,t[s++]=r>>>0&3,t[s++]=r>>>2&3,t[s++]=r>>>4&3,t[s++]=r>>>6&3,t[s++]=r>>>8&3,t[s++]=r>>>10&3,t[s++]=r>>>12&3,t[s++]=r>>>14&3,t[s++]=r>>>16&3,t[s++]=r>>>18&3,t[s++]=r>>>20&3,t[s++]=r>>>22&3,t[s++]=r>>>24&3,t[s++]=r>>>26&3,t[s++]=r>>>28&3,t[s]=r>>>30&3}function _R(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0;t[s++]=o>>>0&7,t[s++]=o>>>3&7,t[s++]=o>>>6&7,t[s++]=o>>>9&7,t[s++]=o>>>12&7,t[s++]=o>>>15&7,t[s++]=o>>>18&7,t[s++]=o>>>21&7,t[s++]=o>>>24&7,t[s++]=o>>>27&7,t[s++]=(o>>>30|(r&1)<<2)&7,t[s++]=r>>>1&7,t[s++]=r>>>4&7,t[s++]=r>>>7&7,t[s++]=r>>>10&7,t[s++]=r>>>13&7,t[s++]=r>>>16&7,t[s++]=r>>>19&7,t[s++]=r>>>22&7,t[s++]=r>>>25&7,t[s++]=r>>>28&7,t[s++]=(r>>>31|(a&3)<<1)&7,t[s++]=a>>>2&7,t[s++]=a>>>5&7,t[s++]=a>>>8&7,t[s++]=a>>>11&7,t[s++]=a>>>14&7,t[s++]=a>>>17&7,t[s++]=a>>>20&7,t[s++]=a>>>23&7,t[s++]=a>>>26&7,t[s]=a>>>29&7}function kR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0;t[s++]=o>>>0&15,t[s++]=o>>>4&15,t[s++]=o>>>8&15,t[s++]=o>>>12&15,t[s++]=o>>>16&15,t[s++]=o>>>20&15,t[s++]=o>>>24&15,t[s++]=o>>>28&15,t[s++]=r>>>0&15,t[s++]=r>>>4&15,t[s++]=r>>>8&15,t[s++]=r>>>12&15,t[s++]=r>>>16&15,t[s++]=r>>>20&15,t[s++]=r>>>24&15,t[s++]=r>>>28&15,t[s++]=a>>>0&15,t[s++]=a>>>4&15,t[s++]=a>>>8&15,t[s++]=a>>>12&15,t[s++]=a>>>16&15,t[s++]=a>>>20&15,t[s++]=a>>>24&15,t[s++]=a>>>28&15,t[s++]=l>>>0&15,t[s++]=l>>>4&15,t[s++]=l>>>8&15,t[s++]=l>>>12&15,t[s++]=l>>>16&15,t[s++]=l>>>20&15,t[s++]=l>>>24&15,t[s]=l>>>28&15}function PR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0;t[s++]=o>>>0&31,t[s++]=o>>>5&31,t[s++]=o>>>10&31,t[s++]=o>>>15&31,t[s++]=o>>>20&31,t[s++]=o>>>25&31,t[s++]=(o>>>30|(r&7)<<2)&31,t[s++]=r>>>3&31,t[s++]=r>>>8&31,t[s++]=r>>>13&31,t[s++]=r>>>18&31,t[s++]=r>>>23&31,t[s++]=(r>>>28|(a&1)<<4)&31,t[s++]=a>>>1&31,t[s++]=a>>>6&31,t[s++]=a>>>11&31,t[s++]=a>>>16&31,t[s++]=a>>>21&31,t[s++]=a>>>26&31,t[s++]=(a>>>31|(l&15)<<1)&31,t[s++]=l>>>4&31,t[s++]=l>>>9&31,t[s++]=l>>>14&31,t[s++]=l>>>19&31,t[s++]=l>>>24&31,t[s++]=(l>>>29|(c&3)<<3)&31,t[s++]=c>>>2&31,t[s++]=c>>>7&31,t[s++]=c>>>12&31,t[s++]=c>>>17&31,t[s++]=c>>>22&31,t[s]=c>>>27&31}function DR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0;t[s++]=o>>>0&63,t[s++]=o>>>6&63,t[s++]=o>>>12&63,t[s++]=o>>>18&63,t[s++]=o>>>24&63,t[s++]=(o>>>30|(r&15)<<2)&63,t[s++]=r>>>4&63,t[s++]=r>>>10&63,t[s++]=r>>>16&63,t[s++]=r>>>22&63,t[s++]=(r>>>28|(a&3)<<4)&63,t[s++]=a>>>2&63,t[s++]=a>>>8&63,t[s++]=a>>>14&63,t[s++]=a>>>20&63,t[s++]=a>>>26&63,t[s++]=l>>>0&63,t[s++]=l>>>6&63,t[s++]=l>>>12&63,t[s++]=l>>>18&63,t[s++]=l>>>24&63,t[s++]=(l>>>30|(c&15)<<2)&63,t[s++]=c>>>4&63,t[s++]=c>>>10&63,t[s++]=c>>>16&63,t[s++]=c>>>22&63,t[s++]=(c>>>28|(h&3)<<4)&63,t[s++]=h>>>2&63,t[s++]=h>>>8&63,t[s++]=h>>>14&63,t[s++]=h>>>20&63,t[s]=h>>>26&63}function NR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0;t[s++]=o>>>0&127,t[s++]=o>>>7&127,t[s++]=o>>>14&127,t[s++]=o>>>21&127,t[s++]=(o>>>28|(r&7)<<4)&127,t[s++]=r>>>3&127,t[s++]=r>>>10&127,t[s++]=r>>>17&127,t[s++]=r>>>24&127,t[s++]=(r>>>31|(a&63)<<1)&127,t[s++]=a>>>6&127,t[s++]=a>>>13&127,t[s++]=a>>>20&127,t[s++]=(a>>>27|(l&3)<<5)&127,t[s++]=l>>>2&127,t[s++]=l>>>9&127,t[s++]=l>>>16&127,t[s++]=l>>>23&127,t[s++]=(l>>>30|(c&31)<<2)&127,t[s++]=c>>>5&127,t[s++]=c>>>12&127,t[s++]=c>>>19&127,t[s++]=(c>>>26|(h&1)<<6)&127,t[s++]=h>>>1&127,t[s++]=h>>>8&127,t[s++]=h>>>15&127,t[s++]=h>>>22&127,t[s++]=(h>>>29|(u&15)<<3)&127,t[s++]=u>>>4&127,t[s++]=u>>>11&127,t[s++]=u>>>18&127,t[s]=u>>>25&127}function LR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0;t[s++]=o>>>0&255,t[s++]=o>>>8&255,t[s++]=o>>>16&255,t[s++]=o>>>24&255,t[s++]=r>>>0&255,t[s++]=r>>>8&255,t[s++]=r>>>16&255,t[s++]=r>>>24&255,t[s++]=a>>>0&255,t[s++]=a>>>8&255,t[s++]=a>>>16&255,t[s++]=a>>>24&255,t[s++]=l>>>0&255,t[s++]=l>>>8&255,t[s++]=l>>>16&255,t[s++]=l>>>24&255,t[s++]=c>>>0&255,t[s++]=c>>>8&255,t[s++]=c>>>16&255,t[s++]=c>>>24&255,t[s++]=h>>>0&255,t[s++]=h>>>8&255,t[s++]=h>>>16&255,t[s++]=h>>>24&255,t[s++]=u>>>0&255,t[s++]=u>>>8&255,t[s++]=u>>>16&255,t[s++]=u>>>24&255,t[s++]=p>>>0&255,t[s++]=p>>>8&255,t[s++]=p>>>16&255,t[s]=p>>>24&255}function RR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0;t[s++]=o>>>0&511,t[s++]=o>>>9&511,t[s++]=o>>>18&511,t[s++]=(o>>>27|(r&15)<<5)&511,t[s++]=r>>>4&511,t[s++]=r>>>13&511,t[s++]=r>>>22&511,t[s++]=(r>>>31|(a&255)<<1)&511,t[s++]=a>>>8&511,t[s++]=a>>>17&511,t[s++]=(a>>>26|(l&7)<<6)&511,t[s++]=l>>>3&511,t[s++]=l>>>12&511,t[s++]=l>>>21&511,t[s++]=(l>>>30|(c&127)<<2)&511,t[s++]=c>>>7&511,t[s++]=c>>>16&511,t[s++]=(c>>>25|(h&3)<<7)&511,t[s++]=h>>>2&511,t[s++]=h>>>11&511,t[s++]=h>>>20&511,t[s++]=(h>>>29|(u&63)<<3)&511,t[s++]=u>>>6&511,t[s++]=u>>>15&511,t[s++]=(u>>>24|(p&1)<<8)&511,t[s++]=p>>>1&511,t[s++]=p>>>10&511,t[s++]=p>>>19&511,t[s++]=(p>>>28|(f&31)<<4)&511,t[s++]=f>>>5&511,t[s++]=f>>>14&511,t[s]=f>>>23&511}function FR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0;t[s++]=o>>>0&1023,t[s++]=o>>>10&1023,t[s++]=o>>>20&1023,t[s++]=(o>>>30|(r&255)<<2)&1023,t[s++]=r>>>8&1023,t[s++]=r>>>18&1023,t[s++]=(r>>>28|(a&63)<<4)&1023,t[s++]=a>>>6&1023,t[s++]=a>>>16&1023,t[s++]=(a>>>26|(l&15)<<6)&1023,t[s++]=l>>>4&1023,t[s++]=l>>>14&1023,t[s++]=(l>>>24|(c&3)<<8)&1023,t[s++]=c>>>2&1023,t[s++]=c>>>12&1023,t[s++]=c>>>22&1023,t[s++]=h>>>0&1023,t[s++]=h>>>10&1023,t[s++]=h>>>20&1023,t[s++]=(h>>>30|(u&255)<<2)&1023,t[s++]=u>>>8&1023,t[s++]=u>>>18&1023,t[s++]=(u>>>28|(p&63)<<4)&1023,t[s++]=p>>>6&1023,t[s++]=p>>>16&1023,t[s++]=(p>>>26|(f&15)<<6)&1023,t[s++]=f>>>4&1023,t[s++]=f>>>14&1023,t[s++]=(f>>>24|(m&3)<<8)&1023,t[s++]=m>>>2&1023,t[s++]=m>>>12&1023,t[s]=m>>>22&1023}function OR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0,y=i[e+10]>>>0;t[s++]=o>>>0&2047,t[s++]=o>>>11&2047,t[s++]=(o>>>22|(r&1)<<10)&2047,t[s++]=r>>>1&2047,t[s++]=r>>>12&2047,t[s++]=(r>>>23|(a&3)<<9)&2047,t[s++]=a>>>2&2047,t[s++]=a>>>13&2047,t[s++]=(a>>>24|(l&7)<<8)&2047,t[s++]=l>>>3&2047,t[s++]=l>>>14&2047,t[s++]=(l>>>25|(c&15)<<7)&2047,t[s++]=c>>>4&2047,t[s++]=c>>>15&2047,t[s++]=(c>>>26|(h&31)<<6)&2047,t[s++]=h>>>5&2047,t[s++]=h>>>16&2047,t[s++]=(h>>>27|(u&63)<<5)&2047,t[s++]=u>>>6&2047,t[s++]=u>>>17&2047,t[s++]=(u>>>28|(p&127)<<4)&2047,t[s++]=p>>>7&2047,t[s++]=p>>>18&2047,t[s++]=(p>>>29|(f&255)<<3)&2047,t[s++]=f>>>8&2047,t[s++]=f>>>19&2047,t[s++]=(f>>>30|(m&511)<<2)&2047,t[s++]=m>>>9&2047,t[s++]=m>>>20&2047,t[s++]=(m>>>31|(y&1023)<<1)&2047,t[s++]=y>>>10&2047,t[s]=y>>>21&2047}function GR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0,y=i[e+10]>>>0,g=i[e+11]>>>0;t[s++]=o>>>0&4095,t[s++]=o>>>12&4095,t[s++]=(o>>>24|(r&15)<<8)&4095,t[s++]=r>>>4&4095,t[s++]=r>>>16&4095,t[s++]=(r>>>28|(a&255)<<4)&4095,t[s++]=a>>>8&4095,t[s++]=a>>>20&4095,t[s++]=l>>>0&4095,t[s++]=l>>>12&4095,t[s++]=(l>>>24|(c&15)<<8)&4095,t[s++]=c>>>4&4095,t[s++]=c>>>16&4095,t[s++]=(c>>>28|(h&255)<<4)&4095,t[s++]=h>>>8&4095,t[s++]=h>>>20&4095,t[s++]=u>>>0&4095,t[s++]=u>>>12&4095,t[s++]=(u>>>24|(p&15)<<8)&4095,t[s++]=p>>>4&4095,t[s++]=p>>>16&4095,t[s++]=(p>>>28|(f&255)<<4)&4095,t[s++]=f>>>8&4095,t[s++]=f>>>20&4095,t[s++]=m>>>0&4095,t[s++]=m>>>12&4095,t[s++]=(m>>>24|(y&15)<<8)&4095,t[s++]=y>>>4&4095,t[s++]=y>>>16&4095,t[s++]=(y>>>28|(g&255)<<4)&4095,t[s++]=g>>>8&4095,t[s]=g>>>20&4095}function UR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0,y=i[e+10]>>>0,g=i[e+11]>>>0,A=i[e+12]>>>0,v=i[e+13]>>>0,C=i[e+14]>>>0,w=i[e+15]>>>0;t[s++]=o>>>0&65535,t[s++]=o>>>16&65535,t[s++]=r>>>0&65535,t[s++]=r>>>16&65535,t[s++]=a>>>0&65535,t[s++]=a>>>16&65535,t[s++]=l>>>0&65535,t[s++]=l>>>16&65535,t[s++]=c>>>0&65535,t[s++]=c>>>16&65535,t[s++]=h>>>0&65535,t[s++]=h>>>16&65535,t[s++]=u>>>0&65535,t[s++]=u>>>16&65535,t[s++]=p>>>0&65535,t[s++]=p>>>16&65535,t[s++]=f>>>0&65535,t[s++]=f>>>16&65535,t[s++]=m>>>0&65535,t[s++]=m>>>16&65535,t[s++]=y>>>0&65535,t[s++]=y>>>16&65535,t[s++]=g>>>0&65535,t[s++]=g>>>16&65535,t[s++]=A>>>0&65535,t[s++]=A>>>16&65535,t[s++]=v>>>0&65535,t[s++]=v>>>16&65535,t[s++]=C>>>0&65535,t[s++]=C>>>16&65535,t[s++]=w>>>0&65535,t[s]=w>>>16&65535}function VR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0;t[s++]=a>>>0&1,t[s++]=a>>>1&1,t[s++]=a>>>2&1,t[s++]=a>>>3&1,t[s++]=a>>>4&1,t[s++]=a>>>5&1,t[s++]=a>>>6&1,t[s++]=a>>>7&1,t[s++]=a>>>8&1,t[s++]=a>>>9&1,t[s++]=a>>>10&1,t[s++]=a>>>11&1,t[s++]=a>>>12&1,t[s++]=a>>>13&1,t[s++]=a>>>14&1,t[s++]=a>>>15&1,t[s++]=a>>>16&1,t[s++]=a>>>17&1,t[s++]=a>>>18&1,t[s++]=a>>>19&1,t[s++]=a>>>20&1,t[s++]=a>>>21&1,t[s++]=a>>>22&1,t[s++]=a>>>23&1,t[s++]=a>>>24&1,t[s++]=a>>>25&1,t[s++]=a>>>26&1,t[s++]=a>>>27&1,t[s++]=a>>>28&1,t[s++]=a>>>29&1,t[s++]=a>>>30&1,t[s++]=a>>>31&1}}function QR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0;t[s++]=a>>>0&3,t[s++]=a>>>2&3,t[s++]=a>>>4&3,t[s++]=a>>>6&3,t[s++]=a>>>8&3,t[s++]=a>>>10&3,t[s++]=a>>>12&3,t[s++]=a>>>14&3,t[s++]=a>>>16&3,t[s++]=a>>>18&3,t[s++]=a>>>20&3,t[s++]=a>>>22&3,t[s++]=a>>>24&3,t[s++]=a>>>26&3,t[s++]=a>>>28&3,t[s++]=a>>>30&3,t[s++]=l>>>0&3,t[s++]=l>>>2&3,t[s++]=l>>>4&3,t[s++]=l>>>6&3,t[s++]=l>>>8&3,t[s++]=l>>>10&3,t[s++]=l>>>12&3,t[s++]=l>>>14&3,t[s++]=l>>>16&3,t[s++]=l>>>18&3,t[s++]=l>>>20&3,t[s++]=l>>>22&3,t[s++]=l>>>24&3,t[s++]=l>>>26&3,t[s++]=l>>>28&3,t[s++]=l>>>30&3}}function zR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0;t[s++]=a>>>0&7,t[s++]=a>>>3&7,t[s++]=a>>>6&7,t[s++]=a>>>9&7,t[s++]=a>>>12&7,t[s++]=a>>>15&7,t[s++]=a>>>18&7,t[s++]=a>>>21&7,t[s++]=a>>>24&7,t[s++]=a>>>27&7,t[s++]=(a>>>30|(l&1)<<2)&7,t[s++]=l>>>1&7,t[s++]=l>>>4&7,t[s++]=l>>>7&7,t[s++]=l>>>10&7,t[s++]=l>>>13&7,t[s++]=l>>>16&7,t[s++]=l>>>19&7,t[s++]=l>>>22&7,t[s++]=l>>>25&7,t[s++]=l>>>28&7,t[s++]=(l>>>31|(c&3)<<1)&7,t[s++]=c>>>2&7,t[s++]=c>>>5&7,t[s++]=c>>>8&7,t[s++]=c>>>11&7,t[s++]=c>>>14&7,t[s++]=c>>>17&7,t[s++]=c>>>20&7,t[s++]=c>>>23&7,t[s++]=c>>>26&7,t[s++]=c>>>29&7}}function HR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0;t[s++]=a>>>0&15,t[s++]=a>>>4&15,t[s++]=a>>>8&15,t[s++]=a>>>12&15,t[s++]=a>>>16&15,t[s++]=a>>>20&15,t[s++]=a>>>24&15,t[s++]=a>>>28&15,t[s++]=l>>>0&15,t[s++]=l>>>4&15,t[s++]=l>>>8&15,t[s++]=l>>>12&15,t[s++]=l>>>16&15,t[s++]=l>>>20&15,t[s++]=l>>>24&15,t[s++]=l>>>28&15,t[s++]=c>>>0&15,t[s++]=c>>>4&15,t[s++]=c>>>8&15,t[s++]=c>>>12&15,t[s++]=c>>>16&15,t[s++]=c>>>20&15,t[s++]=c>>>24&15,t[s++]=c>>>28&15,t[s++]=h>>>0&15,t[s++]=h>>>4&15,t[s++]=h>>>8&15,t[s++]=h>>>12&15,t[s++]=h>>>16&15,t[s++]=h>>>20&15,t[s++]=h>>>24&15,t[s++]=h>>>28&15}}function YR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0;t[s++]=a>>>0&31,t[s++]=a>>>5&31,t[s++]=a>>>10&31,t[s++]=a>>>15&31,t[s++]=a>>>20&31,t[s++]=a>>>25&31,t[s++]=(a>>>30|(l&7)<<2)&31,t[s++]=l>>>3&31,t[s++]=l>>>8&31,t[s++]=l>>>13&31,t[s++]=l>>>18&31,t[s++]=l>>>23&31,t[s++]=(l>>>28|(c&1)<<4)&31,t[s++]=c>>>1&31,t[s++]=c>>>6&31,t[s++]=c>>>11&31,t[s++]=c>>>16&31,t[s++]=c>>>21&31,t[s++]=c>>>26&31,t[s++]=(c>>>31|(h&15)<<1)&31,t[s++]=h>>>4&31,t[s++]=h>>>9&31,t[s++]=h>>>14&31,t[s++]=h>>>19&31,t[s++]=h>>>24&31,t[s++]=(h>>>29|(u&3)<<3)&31,t[s++]=u>>>2&31,t[s++]=u>>>7&31,t[s++]=u>>>12&31,t[s++]=u>>>17&31,t[s++]=u>>>22&31,t[s++]=u>>>27&31}}function $R(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0,p=i[o++]>>>0;t[s++]=a>>>0&63,t[s++]=a>>>6&63,t[s++]=a>>>12&63,t[s++]=a>>>18&63,t[s++]=a>>>24&63,t[s++]=(a>>>30|(l&15)<<2)&63,t[s++]=l>>>4&63,t[s++]=l>>>10&63,t[s++]=l>>>16&63,t[s++]=l>>>22&63,t[s++]=(l>>>28|(c&3)<<4)&63,t[s++]=c>>>2&63,t[s++]=c>>>8&63,t[s++]=c>>>14&63,t[s++]=c>>>20&63,t[s++]=c>>>26&63,t[s++]=h>>>0&63,t[s++]=h>>>6&63,t[s++]=h>>>12&63,t[s++]=h>>>18&63,t[s++]=h>>>24&63,t[s++]=(h>>>30|(u&15)<<2)&63,t[s++]=u>>>4&63,t[s++]=u>>>10&63,t[s++]=u>>>16&63,t[s++]=u>>>22&63,t[s++]=(u>>>28|(p&3)<<4)&63,t[s++]=p>>>2&63,t[s++]=p>>>8&63,t[s++]=p>>>14&63,t[s++]=p>>>20&63,t[s++]=p>>>26&63}}function jR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0,p=i[o++]>>>0,f=i[o++]>>>0;t[s++]=a>>>0&127,t[s++]=a>>>7&127,t[s++]=a>>>14&127,t[s++]=a>>>21&127,t[s++]=(a>>>28|(l&7)<<4)&127,t[s++]=l>>>3&127,t[s++]=l>>>10&127,t[s++]=l>>>17&127,t[s++]=l>>>24&127,t[s++]=(l>>>31|(c&63)<<1)&127,t[s++]=c>>>6&127,t[s++]=c>>>13&127,t[s++]=c>>>20&127,t[s++]=(c>>>27|(h&3)<<5)&127,t[s++]=h>>>2&127,t[s++]=h>>>9&127,t[s++]=h>>>16&127,t[s++]=h>>>23&127,t[s++]=(h>>>30|(u&31)<<2)&127,t[s++]=u>>>5&127,t[s++]=u>>>12&127,t[s++]=u>>>19&127,t[s++]=(u>>>26|(p&1)<<6)&127,t[s++]=p>>>1&127,t[s++]=p>>>8&127,t[s++]=p>>>15&127,t[s++]=p>>>22&127,t[s++]=(p>>>29|(f&15)<<3)&127,t[s++]=f>>>4&127,t[s++]=f>>>11&127,t[s++]=f>>>18&127,t[s++]=f>>>25&127}}function WR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0,p=i[o++]>>>0,f=i[o++]>>>0,m=i[o++]>>>0;t[s++]=a>>>0&255,t[s++]=a>>>8&255,t[s++]=a>>>16&255,t[s++]=a>>>24&255,t[s++]=l>>>0&255,t[s++]=l>>>8&255,t[s++]=l>>>16&255,t[s++]=l>>>24&255,t[s++]=c>>>0&255,t[s++]=c>>>8&255,t[s++]=c>>>16&255,t[s++]=c>>>24&255,t[s++]=h>>>0&255,t[s++]=h>>>8&255,t[s++]=h>>>16&255,t[s++]=h>>>24&255,t[s++]=u>>>0&255,t[s++]=u>>>8&255,t[s++]=u>>>16&255,t[s++]=u>>>24&255,t[s++]=p>>>0&255,t[s++]=p>>>8&255,t[s++]=p>>>16&255,t[s++]=p>>>24&255,t[s++]=f>>>0&255,t[s++]=f>>>8&255,t[s++]=f>>>16&255,t[s++]=f>>>24&255,t[s++]=m>>>0&255,t[s++]=m>>>8&255,t[s++]=m>>>16&255,t[s++]=m>>>24&255}}function qR(i,e,t,n){let s=n,o=e;for(let r=0;r<128;r++){const a=i[o++]>>>0;t[s++]=a&65535,t[s++]=a>>>16&65535}}function KR(i,e,t,n,s){const o=_c[s]>>>0;let r=e,a=0,l=i[r]>>>0,c=n;for(let h=0;h<8;h++){for(let u=0;u<32;u++)if(a+s<=32){const p=l>>>a&o;t[c+u]=p|0,a+=s,a===32&&(a=0,r++,u!==31&&(l=i[r]>>>0))}else{const p=32-a,f=l>>>a;r++,l=i[r]>>>0;const m=s-p,y=-1>>>32-m>>>0,g=l&y,A=(f|g<<p)&o;t[c+u]=A|0,a=m}c+=32,a=0,h<7&&(l=i[r]>>>0)}}const cn=32,Pc=cn+1,Dc=MR(Ym),XR=3*Dc/Yt+Dc|0;function $m(){const i=new Uint8Array(XR);return{dataToBePacked:new Array(Pc),dataPointers:new Int32Array(Pc),byteContainer:i,byteContainerI32:new Int32Array(i.buffer,i.byteOffset,i.byteLength>>>2),exceptionSizes:new Int32Array(Pc)}}function JR(i=16){if(i<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${i}`);const e=Math.max(16,i|0);return{encodedWords:new Uint32Array(e),decoderWorkspace:$m()}}function ZR(i,e){if(e<=i.encodedWords.length)return i.encodedWords;const t=new Uint32Array(Math.max(16,e*2));return i.encodedWords=t,t}function eF(i,e,t,n){n.byteContainer.length<t&&(n.byteContainer=new Uint8Array(t*2),n.byteContainerI32=void 0);const s=n.byteContainer,o=t>>>2;if((s.byteOffset&3)===0){let a=n.byteContainerI32;(!a||a.buffer!==s.buffer||a.byteOffset!==s.byteOffset||a.length<o)&&(a=n.byteContainerI32=new Int32Array(s.buffer,s.byteOffset,s.byteLength>>>2)),a.set(i.subarray(e,e+o))}else for(let a=0;a<o;a=a+1|0){const l=i[e+a|0]|0,c=a<<2;s[c]=l&255,s[c+1|0]=l>>>8&255,s[c+2|0]=l>>>16&255,s[c+3|0]=l>>>24&255}const r=t&3;if(r>0){const a=e+o|0,l=i[a]|0,c=o<<2;for(let h=0;h<r;h=h+1|0)s[c+h|0]=l>>>(h<<3)&255}return s}function tF(i,e,t){const n=i[e++]|0,s=t.dataToBePacked;for(let o=2;o<=cn;o=o+1|0){if((n>>>o-1&1)===0)continue;if(e>=i.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${o}, streamWordIndex=${e}, needWords=1, availableWords=${i.length-e}, encodedWords=${i.length})`);const r=i[e++]>>>0,a=SR(r),l=r*o+31>>>5;if(e+l>i.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${o}, size=${r}, streamWordIndex=${e}, needWords=${l}, availableWords=${i.length-e}, encodedWords=${i.length})`);let c=s[o];(!c||c.length<a)&&(c=s[o]=new Uint32Array(a));let h=0;for(;h<r;h=h+32|0)hF(i,e,c,h,o),e=e+o|0;const u=h-r|0;e=e-(u*o>>>5)|0,t.exceptionSizes[o]=r}return e}function iF(i,e,t,n,s){switch(s){case 1:VR(i,e,t,n);break;case 2:QR(i,e,t,n);break;case 3:zR(i,e,t,n);break;case 4:HR(i,e,t,n);break;case 5:YR(i,e,t,n);break;case 6:$R(i,e,t,n);break;case 7:jR(i,e,t,n);break;case 8:WR(i,e,t,n);break;case 16:qR(i,e,t,n);break;default:KR(i,e,t,n,s);break}return e+(s<<3)|0}function nF(i,e,t,n){if(t+2>e)throw new Error(`FastPFOR decode: byteContainer underflow at block=${n} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${t}, byteSize=${e})`);const s=i[t++],o=i[t++];if(s>cn)throw new Error(`FastPFOR decode: invalid bitWidth=${s} at block=${n} (expected 0..${cn}). This likely indicates corrupted or truncated input.`);return{bitWidth:s,exceptionCount:o,bytePosIn:t}}function sF(i,e,t,n,s,o){if(t+1>e)throw new Error(`FastPFOR decode: exception header underflow at block=${o} (need 1 byte for maxBits, bytePos=${t}, byteSize=${e})`);const r=i[t++];if(r<n||r>cn)throw new Error(`FastPFOR decode: invalid maxBits=${r} at block=${o} (bitWidth=${n}, expected ${n}..${cn})`);const a=r-n|0;if(a<1||a>cn)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${a} at block=${o} (bitWidth=${n}, maxBits=${r})`);if(t+s>e)throw new Error(`FastPFOR decode: exception positions underflow at block=${o} (need=${s}, have=${e-t})`);return{maxBits:r,exceptionBitWidth:a,bytePosIn:t}}function oF(i,e,t,n,s,o,r,a,l){const{maxBits:c,exceptionBitWidth:h,bytePosIn:u}=sF(s,o,r,t,n,l);if(r=u,h===1){const g=1<<t;for(let A=0;A<n;A=A+1|0){const v=s[r++];i[v+e|0]|=g}return r}const p=a.dataToBePacked[h];if(!p)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${t}, maxBits=${c}) at block ${l}`);const f=a.dataPointers;let m=f[h]|0;const y=a.exceptionSizes[h]|0;if(m+n>y)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${m}, need ${n}, size=${y}) at block ${l}`);for(let g=0;g<n;g=g+1|0){const A=s[r++],v=p[m++]|0;i[A+e|0]|=v<<t}return f[h]=m,r}function rF(i,e,t,n,s,o,r,a,l,c){let h=t|0,u=0;for(let p=0;p<r;p=p+1|0){const f=nF(a,l,u,p);u=f.bytePosIn;const m=f.bitWidth,y=f.exceptionCount,g=o+p*Yt|0;switch(m){case 0:s.fill(0,g,g+Yt);break;case 32:for(let A=0;A<Yt;A=A+1|0)s[g+A|0]=i[h+A|0]|0;h=h+Yt|0;break;default:h=iF(i,h,s,g,m);break}y>0&&(u=oF(s,g,m,y,a,l,u,c,p))}if(h!==n)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${t}, consumedPackedEnd=${h}, expectedPackedEnd=${n}, packedWords=${n-t}, encoded.length=${i.length})`)}function aF(i,e,t,n,s,o){const r=t|0,a=i[r]|0;if(a<=0||r+a>i.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${a} at pageStart=${r} (expected > 0 and pageStart+whereMeta < encoded.length=${i.length})`);const l=r+1|0,c=r+a|0,h=i[c]>>>0,u=h+3>>>2,p=c+1,f=p+u;if(f>=i.length)throw new Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${u}, pageStart=${r}, packedEnd=${c}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${i.length})`);const m=eF(i,p,h,o),y=h,g=tF(i,f,o);o.dataPointers.fill(0);const v=n|0,C=s/Yt|0;return rF(i,r,l,c,e,v,C,m,y,o),g}function lF(i,e,t,n,s,o){const r=kc(s,Yt),a=n+r;let l=n,c=t;for(;l!==a;){const h=Math.min(Dc,a-l);c=aF(i,e,c,l,h,o),l=l+h|0}return c}function cF(i,e,t,n,s,o){if(o===0)return e;let r=0,a=e;const l=e+t,c=s;let h=s;const u=s+o;let p=0,f=0;for(;a<l&&h<u;){const y=i[a]>>>r&255;if(r+=8,a+=r>>>5,r&=31,p|=(y&127)<<f,(y&128)!==0)n[h++]=p|0,p=0,f=0;else if(f+=7,f>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-c}/${o}, inPos=${a}, inEnd=${l})`)}if(h!==u)throw new Error(`FastPFOR VByte: truncated stream (decoded=${h-c}, expected=${o}, consumedWords=${a-e}/${t}, vbyteStart=${e}, vbyteEnd=${l})`);return a}function dF(i,e,t){let n=0,s=0;const o=new Uint32Array(e),r=t??$m();if(i.length>0){const c=i[n]|0;if(n=n+1|0,(c&Yt-1)!==0)throw new Error(`FastPFOR decode: invalid alignedLength=${c} (expected multiple of ${Yt})`);if(s+c>o.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${s}, alignedLength=${c}, out.length=${o.length})`);n=lF(i,o,n,s,c,r),s=s+c|0}const a=i.length-n|0,l=e-s|0;return cF(i,n,a,o,s,l),o}function hF(i,e,t,n,s){switch(s){case 2:BR(i,e,t,n);return;case 3:_R(i,e,t,n);return;case 4:kR(i,e,t,n);return;case 5:PR(i,e,t,n);return;case 6:DR(i,e,t,n);return;case 7:NR(i,e,t,n);return;case 8:LR(i,e,t,n);return;case 9:RR(i,e,t,n);return;case 10:FR(i,e,t,n);return;case 11:OR(i,e,t,n);return;case 12:GR(i,e,t,n);return;case 16:UR(i,e,t,n);return;case 32:for(let c=0;c<32;c=c+1|0)t[n+c|0]=i[e+c|0]|0;return}const o=_c[s]>>>0;let r=e,a=0,l=i[r]>>>0;for(let c=0;c<32;c++)if(a+s<=32){const h=l>>>a&o;t[n+c]=h|0,a+=s,a===32&&(a=0,r++,c!==31&&(l=i[r]>>>0))}else{const h=32-a,u=l>>>a;r++,l=i[r]>>>0;const p=_c[s-h]>>>0,f=l&p,m=(u|f<<h)&o;t[n+c]=m|0,a=s-h}}function uF(i,e,t,n){if(e<0||t<0||e+t>i.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${t}, bytes.length=${i.length})`);const s=Math.floor(t/4),o=t%4!==0,r=o?s+1:s;if(n.length<r)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${n.length} < ${r}`);if(s>0){const a=i.byteOffset+e;if((a&3)===0){const l=new Uint32Array(i.buffer,a,s);for(let c=0;c<s;c++)n[c]=TR(l[c])|0}else for(let l=0;l<s;l++){const c=e+l*4;n[l]=i[c]<<24|i[c+1]<<16|i[c+2]<<8|i[c+3]|0}}if(o){const a=e+s*4,l=t-s*4;let c=0;for(let h=0;h<l;h++)c|=i[a+h]<<24-h*8;n[s]=c|0}return r}function rt(i,e,t){const n=new Uint32Array(t);let s=0,o=e.get();for(let r=0;r<n.length;r++){let a=i[o++],l=a&127;if(a<128){n[s++]=l;continue}if(a=i[o++],l|=(a&127)<<7,a<128){n[s++]=l;continue}if(a=i[o++],l|=(a&127)<<14,a<128){n[s++]=l;continue}if(a=i[o++],l|=(a&127)<<21,a<128){n[s++]=l;continue}a=i[o++],l|=(a&15)<<28,n[s++]=l}return e.set(o),n}function jn(i,e,t){const n=new BigUint64Array(t);for(let s=0;s<n.length;s++)n[s]=fF(i,e);return n}function fF(i,e){let t=0n,n=0,s=e.get();for(;s<i.length;){const o=i[s++];if(t|=BigInt(o&127)<<BigInt(n),(o&128)===0)break;if(n+=7,n>=64)throw new Error("Varint too long")}return e.set(s),t}function pF(i,e,t){const n=new Float64Array(t);for(let s=0;s<t;s++)n[s]=mF(i,e);return n}function mF(i,e){let t,n;return n=i[e.get()],e.increment(),t=n&127,n<128||(n=i[e.get()],e.increment(),t|=(n&127)<<7,n<128)||(n=i[e.get()],e.increment(),t|=(n&127)<<14,n<128)||(n=i[e.get()],e.increment(),t|=(n&127)<<21,n<128)?t:(n=i[e.get()],t|=(n&15)<<28,gF(t,i,e))}function gF(i,e,t){let n,s;if(s=e[t.get()],t.increment(),n=(s&112)>>4,s<128||(s=e[t.get()],t.increment(),n|=(s&127)<<3,s<128)||(s=e[t.get()],t.increment(),n|=(s&127)<<10,s<128)||(s=e[t.get()],t.increment(),n|=(s&127)<<17,s<128)||(s=e[t.get()],t.increment(),n|=(s&127)<<24,s<128)||(s=e[t.get()],t.increment(),n|=(s&1)<<31,s<128))return n*4294967296+(i>>>0);throw new Error("Expected varint not more than 10 bytes")}function yF(i,e,t,n){const s=JR(t>>>2);return AF(i,e,t,n,s)}function AF(i,e,t,n,s){const o=n.get();if((t&3)!==0)throw new Error(`FastPFOR: invalid encodedByteLength=${t} at offset=${o} (encodedBytes.length=${i.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);const r=t>>>2,a=ZR(s,r);uF(i,o,t,a);const l=dF(a.subarray(0,r),e,s.decoderWorkspace);return n.add(t),l}function ye(i){return i>>>1^-(i&1)}function at(i){return i>>1n^-(i&1n)}function dn(i){return i%2===1?(i+1)/-2:i/2}function vF(i){const e=new Int32Array(i.length);for(let t=0;t<i.length;t++)e[t]=ye(i[t]);return e}function bF(i){const e=new BigInt64Array(i.length);for(let t=0;t<i.length;t++)e[t]=at(i[t]);return e}function Nc(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=i[o]}const n=new Uint32Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o],a=i[o+e];n.fill(a,s,s+r),s+=r}return n}function Lc(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=Number(i[o])}const n=new BigUint64Array(t);let s=0;for(let o=0;o<e;o++){const r=Number(i[o]),a=i[o+e];n.fill(a,s,s+r),s+=r}return n}function jm(i,e,t){const n=new Float64Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o],a=i[o+e];n.fill(a,s,s+r),s+=r}return n}function Wm(i){const e=new Int32Array(i.length);e[0]=ye(i[0]);const t=i.length/4*4;let n=1;if(t>=4)for(;n<t-4;n+=4){const s=i[n],o=i[n+1],r=i[n+2],a=i[n+3];e[n]=ye(s)+e[n-1],e[n+1]=ye(o)+e[n],e[n+2]=ye(r)+e[n+1],e[n+3]=ye(a)+e[n+2]}for(;n!==i.length;++n)e[n]=ye(i[n])+e[n-1];return e}function qm(i){const e=new BigInt64Array(i.length);e[0]=at(i[0]);const t=i.length/4*4;let n=1;if(t>=4)for(;n<t-4;n+=4){const s=i[n],o=i[n+1],r=i[n+2],a=i[n+3];e[n]=at(s)+e[n-1],e[n+1]=at(o)+e[n],e[n+2]=at(r)+e[n+1],e[n+3]=at(a)+e[n+2]}for(;n!==e.length;++n)e[n]=at(i[n])+e[n-1];return e}function CF(i){i[0]=dn(i[0]);const e=i.length/4*4;let t=1;if(e>=4)for(;t<e-4;t+=4){const n=i[t],s=i[t+1],o=i[t+2],r=i[t+3];i[t]=dn(n)+i[t-1],i[t+1]=dn(s)+i[t],i[t+2]=dn(o)+i[t+1],i[t+3]=dn(r)+i[t+2]}for(;t!==i.length;++t)i[t]=dn(i[t])+i[t-1]}function wF(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=i[o]}const n=new Int32Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o];let a=i[o+e];a=ye(a),n.fill(a,s,s+r),s+=r}return n}function EF(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=Number(i[o])}const n=new BigInt64Array(t);let s=0;for(let o=0;o<e;o++){const r=Number(i[o]);let a=i[o+e];a=at(a),n.fill(a,s,s+r),s+=r}return n}function xF(i,e,t){const n=new Float64Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o];let a=i[o+e];a=dn(a),n.fill(a,s,s+r),s+=r}return n}function Rc(i){const e=i.length/4*4;let t=1;if(e>=4)for(let n=i[0];t<e-4;t+=4)n=i[t]+=n,n=i[t+1]+=n,n=i[t+2]+=n,n=i[t+3]+=n;for(;t!==i.length;)i[t]+=i[t-1],++t}function IF(i){let e=0;for(let t=0;t<i.length;t++)i[t]+=e,e=i[t]}function SF(i){if(i.length<2)return new Int32Array(i);const e=new Int32Array(i.length);e[0]=ye(i[0]),e[1]=ye(i[1]);const t=i.length/4*4;let n=2;if(t>=4)for(;n<t-4;n+=4){const s=i[n],o=i[n+1],r=i[n+2],a=i[n+3];e[n]=ye(s)+e[n-2],e[n+1]=ye(o)+e[n-1],e[n+2]=ye(r)+e[n],e[n+3]=ye(a)+e[n+1]}for(;n!==i.length;n+=2)e[n]=ye(i[n])+e[n-2],e[n+1]=ye(i[n+1])+e[n-1];return e}function MF(i){const e=new Int32Array(i.length+1);e[0]=0,e[1]=ye(i[0]);let t=e[1];for(let n=2;n!==e.length;++n){const s=i[n-1],o=ye(s);t+=o,e[n]=e[n-1]+t}return new Uint32Array(e)}function TF(i,e,t){const n=new Int32Array(t+1);n[0]=0;let s=1,o=n[0];for(let r=0;r<e;r++){const a=i[r];let l=i[r+e];l=ye(l);for(let c=s;c<s+a;c++)n[c]=l+o,o=n[c];s+=a}return n}function BF(i,e,t){const n=new Uint32Array(t+1);n[0]=0;let s=1,o=n[0];for(let r=0;r<e;r++){const a=i[r],l=i[r+e];for(let c=s;c<s+a;c++)n[c]=l+o,o=n[c];s+=a}return n}function _F(i,e,t){const n=new Int32Array(t);let s=0,o=0;for(let r=0;r<e;r++){const a=i[r],l=i[r+e],c=ye(l);for(let h=0;h<a;h++)o+=c,n[s++]=o}return n}function kF(i,e,t){const n=new BigInt64Array(t);let s=0,o=0n;for(let r=0;r<e;r++){const a=Number(i[r]),l=i[r+e],c=at(l);for(let h=0;h<a;h++)o+=c,n[s++]=o}return n}function Km(i){const e=new Uint32Array(i.length);e[0]=ye(i[0])>>>0;for(let t=1;t<i.length;t++)e[t]=e[t-1]+ye(i[t])>>>0;return e}function Xm(i){const e=new BigUint64Array(i.length);e[0]=BigInt.asUintN(64,at(i[0]));for(let t=1;t<i.length;t++)e[t]=BigInt.asUintN(64,e[t-1]+at(i[t]));return e}function PF(i){if(i.length<2)return new Uint32Array(i);const e=new Uint32Array(i.length);e[0]=ye(i[0])>>>0,e[1]=ye(i[1])>>>0;for(let t=2;t<i.length;t+=2)e[t]=e[t-2]+ye(i[t])>>>0,e[t+1]=e[t-1]+ye(i[t+1])>>>0;return e}function DF(i){return i[1]}function NF(i){return ye(i[1])}function LF(i){if(i.length===2){const n=ye(i[1]);return[n,n]}const e=ye(i[2]),t=ye(i[3]);return[e,t]}function RF(i){return i[1]}function FF(i){return at(i[1])}function OF(i){if(i.length===2){const n=at(i[1]);return[n,n]}const e=at(i[2]),t=at(i[3]);return[e,t]}var Ve;(function(i){i.PRESENT="PRESENT",i.DATA="DATA",i.OFFSET="OFFSET",i.LENGTH="LENGTH"})(Ve||(Ve={}));var ht;(function(i){i.NONE="NONE",i.SINGLE="SINGLE",i.SHARED="SHARED",i.VERTEX="VERTEX",i.MORTON="MORTON",i.FSST="FSST"})(ht||(ht={}));var ni;(function(i){i.VERTEX="VERTEX",i.INDEX="INDEX",i.STRING="STRING",i.KEY="KEY"})(ni||(ni={}));var je;(function(i){i.VAR_BINARY="VAR_BINARY",i.GEOMETRIES="GEOMETRIES",i.PARTS="PARTS",i.RINGS="RINGS",i.TRIANGLES="TRIANGLES",i.SYMBOL="SYMBOL",i.DICTIONARY="DICTIONARY"})(je||(je={}));const GF=[Ve.PRESENT,Ve.DATA,Ve.OFFSET,Ve.LENGTH],Jm=[re.NONE,re.DELTA,re.COMPONENTWISE_DELTA,re.RLE,re.MORTON,re.PDE],UF=[ii.NONE,ii.FAST_PFOR,ii.VARINT],VF=[ht.NONE,ht.SINGLE,ht.SHARED,ht.VERTEX,ht.MORTON,ht.FSST],QF=[ni.VERTEX,ni.INDEX,ni.STRING,ni.KEY],zF=[je.VAR_BINARY,je.GEOMETRIES,je.PARTS,je.RINGS,je.TRIANGLES,je.SYMBOL,je.DICTIONARY];function ut(i,e){const t=$F(i,e);return t.logicalLevelTechnique1===re.MORTON?HF(t,i,e):(re.RLE===t.logicalLevelTechnique1||re.RLE===t.logicalLevelTechnique2)&&ii.NONE!==t.physicalLevelTechnique?YF(t,i,e):t}function HF(i,e,t){const n=rt(e,t,2);return{physicalStreamType:i.physicalStreamType,logicalStreamType:i.logicalStreamType,logicalLevelTechnique1:i.logicalLevelTechnique1,logicalLevelTechnique2:i.logicalLevelTechnique2,physicalLevelTechnique:i.physicalLevelTechnique,numValues:i.numValues,byteLength:i.byteLength,decompressedCount:i.decompressedCount,numBits:n[0],coordinateShift:n[1]}}function YF(i,e,t){const n=rt(e,t,2);return{physicalStreamType:i.physicalStreamType,logicalStreamType:i.logicalStreamType,logicalLevelTechnique1:i.logicalLevelTechnique1,logicalLevelTechnique2:i.logicalLevelTechnique2,physicalLevelTechnique:i.physicalLevelTechnique,numValues:i.numValues,byteLength:i.byteLength,decompressedCount:n[1],runs:n[0],numRleValues:n[1]}}function $F(i,e){const t=i[e.get()],n=GF[t>>4];let s={};switch(n){case Ve.DATA:s={dictionaryType:VF[t&15]};break;case Ve.OFFSET:s={offsetType:QF[t&15]};break;case Ve.LENGTH:s={lengthType:zF[t&15]};break}e.increment();const o=i[e.get()],r=Jm[o>>5],a=Jm[o>>2&7],l=UF[o&3];e.increment();const c=rt(i,e,2),h=c[0],u=c[1];return{physicalStreamType:n,logicalStreamType:s,logicalLevelTechnique1:r,logicalLevelTechnique2:a,physicalLevelTechnique:l,numValues:h,byteLength:u,decompressedCount:h}}var we;(function(i){i[i.FLAT=0]="FLAT",i[i.CONST=1]="CONST",i[i.SEQUENCE=2]="SEQUENCE",i[i.DICTIONARY=3]="DICTIONARY",i[i.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(we||(we={}));class mi{constructor(e,t){this.values=e,this._size=t}get(e){const t=Math.floor(e/8),n=e%8;return(this.values[t]>>n&1)===1}set(e,t){const n=Math.floor(e/8),s=e%8;this.values[n]=this.values[n]|(t?1:0)<<s}getInt(e){const t=Math.floor(e/8),n=e%8;return this.values[t]>>n&1}size(){return this._size}getBuffer(){return this.values}}function Wn(i,e,t){if(!e)return i;const n=e.size(),s=i.constructor,o=new s(n);let r=0;for(let a=0;a<n;a++)o[a]=e.get(a)?i[r++]:t;return o}function jF(i,e,t){if(!t)return i;const n=t.size(),s=new mi(i,e),o=new mi(new Uint8Array(Math.ceil(n/8)),n);let r=0;for(let a=0;a<n;a++){const l=t.get(a)?s.get(r++):!1;o.set(a,l)}return o.getBuffer()}function Fc(i,e,t,n,s){const o=qn(i,e,t);return JF(o,t,n,s)}function xt(i,e,t,n,s){const o=qn(i,e,t);return ZF(o,t,n,s)}function Oi(i,e,t){const n=qn(i,e,t);return nO(n,t)}function qn(i,e,t){const n=t.physicalLevelTechnique;switch(n){case ii.FAST_PFOR:return yF(i,t.numValues,t.byteLength,e);case ii.VARINT:return rt(i,e,t.numValues);case ii.NONE:{const s=e.get(),o=t.byteLength;e.add(o);const r=i.subarray(s,e.get());return new Uint32Array(r)}default:throw new Error(`Specified physicalLevelTechnique ${n} is not supported (yet).`)}}function WF(i,e,t){const n=qn(i,e,t);return n.length===1?ye(n[0]):NF(n)}function Oc(i,e,t){const n=qn(i,e,t);return n.length===1?t.logicalLevelTechnique1===re.DELTA?ye(n[0]):n[0]:DF(n)}function Zm(i,e,t){const n=qn(i,e,t);return LF(n)}function eg(i,e,t){const n=jn(i,e,t.numValues);return OF(n)}function qF(i,e,t,n){const s=jn(i,e,t.numValues);return eO(s,t,n)}function tg(i,e,t,n){const s=jn(i,e,t.numValues);return tO(s,t,n)}function KF(i,e,t){const n=pF(i,e,t.numValues);return iO(n,t,!1)}function XF(i,e,t){const n=jn(i,e,t.numValues);return n.length===1?at(n[0]):FF(n)}function ig(i,e,t){const n=jn(i,e,t.numValues);return n.length===1?t.logicalLevelTechnique1===re.DELTA?at(n[0]):n[0]:RF(n)}function JF(i,e,t,n){let s;switch(e.logicalLevelTechnique1){case re.DELTA:if(e.logicalLevelTechnique2===re.RLE){const o=e;if(!n)return _F(i,o.runs,o.numRleValues);i=Nc(i,o.runs,o.numRleValues),s=Wm(i)}else s=Wm(i);break;case re.RLE:s=wF(i,e.runs,e.numRleValues);break;case re.MORTON:Rc(i),s=new Int32Array(i);break;case re.COMPONENTWISE_DELTA:s=SF(i);break;case re.NONE:s=vF(i);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return n?Wn(s,n,0):s}function ZF(i,e,t,n){let s;switch(e.logicalLevelTechnique1){case re.DELTA:if(e.logicalLevelTechnique2===re.RLE){const o=e,r=Nc(i,o.runs,o.numRleValues);s=Km(r)}else s=Km(i);break;case re.RLE:s=Nc(i,e.runs,e.numRleValues);break;case re.MORTON:Rc(i),s=i;break;case re.COMPONENTWISE_DELTA:s=PF(i);break;case re.NONE:s=i;break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return n?Wn(s,n,0):s}function eO(i,e,t){let n;switch(e.logicalLevelTechnique1){case re.DELTA:if(e.logicalLevelTechnique2===re.RLE){const s=e;if(!t)return kF(i,s.runs,s.numRleValues);i=Lc(i,s.runs,s.numRleValues),n=qm(i)}else n=qm(i);break;case re.RLE:n=EF(i,e.runs,e.numRleValues);break;case re.NONE:n=bF(i);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return t?Wn(n,t,0n):n}function tO(i,e,t){let n;switch(e.logicalLevelTechnique1){case re.DELTA:if(e.logicalLevelTechnique2===re.RLE){const s=e,o=Lc(i,s.runs,s.numRleValues);n=Xm(o)}else n=Xm(i);break;case re.RLE:n=Lc(i,e.runs,e.numRleValues);break;case re.NONE:n=i;break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return t?Wn(n,t,0n):n}function iO(i,e,t){switch(e.logicalLevelTechnique1){case re.DELTA:if(e.logicalLevelTechnique2===re.RLE){const n=e;i=jm(i,n.runs,n.numRleValues)}return CF(i),i;case re.RLE:return oO(i,e,t);case re.NONE:return i;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function nO(i,e){if(e.logicalLevelTechnique1===re.DELTA&&e.logicalLevelTechnique2===re.NONE)return MF(i);if(e.logicalLevelTechnique1===re.RLE&&e.logicalLevelTechnique2===re.NONE){const t=e;return BF(i,t.runs,t.numRleValues)}if(e.logicalLevelTechnique1===re.NONE&&e.logicalLevelTechnique2===re.NONE){IF(i);const t=new Uint32Array(e.numValues+1);return t[0]=0,t.set(i,1),t}if(e.logicalLevelTechnique1===re.DELTA&&e.logicalLevelTechnique2===re.RLE){const t=e,n=TF(i,t.runs,t.numRleValues);return Rc(n),new Uint32Array(n)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}function Zr(i,e,t,n,s="int32"){const o=i.logicalLevelTechnique1;if(o===re.RLE)return i.runs===1?we.CONST:we.FLAT;if(o!==re.DELTA||i.logicalLevelTechnique2!==re.RLE)return i.numValues===1?we.CONST:we.FLAT;const r=e instanceof mi?e.size():e,a=i;if(a.numRleValues!==r)return we.FLAT;if(a.runs===1)return we.SEQUENCE;if(a.runs!==2)return i.numValues===1?we.CONST:we.FLAT;const l=n.get();if(i.physicalLevelTechnique===ii.VARINT)return sO(t,n,s)?we.SEQUENCE:i.numValues===1?we.CONST:we.FLAT;const c=n.get(),h=new Int32Array(t.buffer,t.byteOffset+c,4);n.set(l);const u=2;return h[2]===u&&h[3]===u?we.SEQUENCE:i.numValues===1?we.CONST:we.FLAT}function sO(i,e,t){const n=new Hm(e.get());if(t==="int64"){const o=jn(i,n,4);return o[2]===2n&&o[3]===2n}const s=rt(i,n,4);return s[2]===2&&s[3]===2}function oO(i,e,t){return t?xF(i,e.runs,e.numRleValues):jm(i,e.runs,e.numRleValues)}class ng extends Xr{getValueFromBuffer(e){return this.dataBuffer[e]}}class sg extends zm{constructor(e,t,n,s){super(e,BigInt64Array.of(t),n,s)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function Gc(i,e,t){const n=og(i,e)-t,s=og(i>>1,e)-t;return{x:n,y:s}}function og(i,e){let t=0;for(let n=0;n<e;n++)t|=(i&1<<2*n)>>n;return t}var We;(function(i){i[i.POINT=0]="POINT",i[i.LINESTRING=1]="LINESTRING",i[i.POLYGON=2]="POLYGON",i[i.MULTIPOINT=3]="MULTIPOINT",i[i.MULTILINESTRING=4]="MULTILINESTRING",i[i.MULTIPOLYGON=5]="MULTIPOLYGON"})(We||(We={}));var rg;(function(i){i[i.POINT=0]="POINT",i[i.LINESTRING=1]="LINESTRING",i[i.POLYGON=2]="POLYGON"})(rg||(rg={}));var Gi;(function(i){i[i.MORTON=0]="MORTON",i[i.VEC_2=1]="VEC_2",i[i.VEC_3=2]="VEC_3"})(Gi||(Gi={}));function rO(i){const e=new Array(i.numGeometries);let t=1,n=1,s=1,o=0,r=0,a=0;const l=i.mortonSettings,c=i.topologyVector,h=c.geometryOffsets,u=c.partOffsets,p=c.ringOffsets,f=i.vertexOffsets,m=!f||f.length===0,y=i.containsPolygonGeometry(),g=i.vertexBuffer;for(let A=0;A<i.numGeometries;A++){const v=i.geometryType(A);switch(v){case We.POINT:{let C,w;if(m)C=g[r++],w=g[r++];else if(i.vertexBufferType===Gi.MORTON){const M=f[a++],x=g[M],I=Gc(x,l.numBits,l.coordinateShift);C=I.x,w=I.y}else{const M=f[a++]*2;C=g[M],w=g[M+1]}e[o++]=[[new Ne(C,w)]],h&&s++,u&&t++,p&&n++}break;case We.MULTIPOINT:{const C=h[s]-h[s-1];s++;const w=new Array(C);if(m)for(let M=0;M<C;M++){const x=g[r++],I=g[r++];w[M]=new Ne(x,I)}else for(let M=0;M<C;M++){const x=f[a++]*2,I=g[x],S=g[x+1];w[M]=new Ne(I,S)}e[o++]=w.map(M=>[M]),t+=C,n+=C}break;case We.LINESTRING:{let C;y?(C=p[n]-p[n-1],n++):C=u[t]-u[t-1],t++;let w;m?(w=Xn(g,r,C,!1),r+=C*2):(w=Kn(i.vertexBufferType,g,f,a,C,!1,l),a+=C),e[o++]=[w],h&&s++}break;case We.POLYGON:{const C=u[t]-u[t-1];t++;const w=new Array(C-1);let M,x=p[n]-p[n-1];if(n++,m){M=Xn(g,r,x,!0),r+=x*2;for(let I=0;I<w.length;I++)x=p[n]-p[n-1],n++,w[I]=Xn(g,r,x,!0),r+=x*2}else{M=Kn(i.vertexBufferType,g,f,a,x,!0,l),a+=x;for(let I=0;I<w.length;I++)x=p[n]-p[n-1],n++,w[I]=Kn(i.vertexBufferType,g,f,a,x,!0,l),a+=x}e[o++]=[M].concat(w),h&&s++}break;case We.MULTILINESTRING:{const C=h[s]-h[s-1];s++;const w=new Array(C);for(let M=0;M<C;M++){let x;if(y?(x=p[n]-p[n-1],n++):x=u[t]-u[t-1],t++,m)w[M]=Xn(g,r,x,!1),r+=x*2;else{const I=Kn(i.vertexBufferType,g,f,a,x,!1,l);w[M]=I,a+=x}}e[o++]=w}break;case We.MULTIPOLYGON:{const C=h[s]-h[s-1];s++;const w=new Array(C);for(let M=0;M<C;M++){const x=u[t]-u[t-1];t++;let I;const S=new Array(x-1),R=p[n]-p[n-1];n++,m?(I=Xn(g,r,R,!0),r+=R*2):(I=Kn(i.vertexBufferType,g,f,a,R,!0,l),a+=R);for(let b=0;b<S.length;b++){const B=p[n]-p[n-1];n++,m?(S[b]=Xn(g,r,B,!0),r+=B*2):(S[b]=Kn(i.vertexBufferType,g,f,a,B,!0,l),a+=B)}w[M]=[I].concat(S)}e[o++]=w.flat()}break;default:throw new Error(`The specified geometry type (${v}) is currently not supported.`)}}return e}function Kn(i,e,t,n,s,o,r){return i===Gi.MORTON?lO(e,t,n,s,o,r):aO(e,t,n,s,o)}function Xn(i,e,t,n){const s=new Array(n?t+1:t);for(let o=0;o<t*2;o+=2){const r=i[e+o],a=i[e+o+1];s[o/2]=new Ne(r,a)}return n&&(s[s.length-1]=s[0]),s}function aO(i,e,t,n,s){const o=new Array(s?n+1:n);for(let r=0;r<n*2;r+=2){const a=e[t+r/2]*2,l=i[a],c=i[a+1];o[r/2]=new Ne(l,c)}return s&&(o[o.length-1]=o[0]),o}function lO(i,e,t,n,s,o){const r=new Array(s?n+1:n);for(let a=0;a<n;a++){const l=e[t+a],c=i[l],h=Gc(c,o.numBits,o.coordinateShift);r[a]=new Ne(h.x,h.y)}return s&&(r[r.length-1]=r[0]),r}class ag{constructor(e,t,n,s,o){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=n,this._vertexBuffer=s,this._mortonSettings=o}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){const t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2,n=this.vertexBuffer[t],s=this.vertexBuffer[t+1];return[n,s]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const o=this.vertexOffsets[e],r=this.vertexBuffer[o],a=Gc(r,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[a.x,a.y]}const t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2,n=this.vertexBuffer[t],s=this.vertexBuffer[t+1];return[n,s]}getGeometries(){return rO(this)}get mortonSettings(){return this._mortonSettings}}function cO(i,e,t,n,s){return new lg(i,e,Gi.VEC_2,t,n,s)}function dO(i,e,t,n,s,o){return new lg(i,e,Gi.MORTON,t,n,s,o)}class lg extends ag{constructor(e,t,n,s,o,r,a){super(n,s,o,r,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===We.POLYGON||this._geometryType===We.MULTIPOLYGON}containsSingleGeometryType(){return!0}}function hO(i,e,t,n){return new cg(Gi.VEC_2,i,e,t,n)}function uO(i,e,t,n,s){return new cg(Gi.MORTON,i,e,t,n,s)}class cg extends ag{constructor(e,t,n,s,o,r){super(e,n,s,o,r),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===We.POLYGON||this.geometryType(e)===We.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class dg{constructor(e,t,n,s){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=n,this._topologyVector=s}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),t=this._topologyVector,n=t.partOffsets,s=t.ringOffsets,o=t.geometryOffsets;let r=0,a=1,l=1,c=1;for(let h=0;h<this.numGeometries;h++)switch(this.geometryType(h)){case We.POLYGON:{const p=n[a]-n[a-1];a++;const f=[];for(let m=0;m<p;m++){const y=s[l]-s[l-1];l++;const g=[];for(let A=0;A<y;A++){const v=this._vertexBuffer[r++],C=this._vertexBuffer[r++];g.push(new Ne(v,C))}g.length>0&&g.push(g[0]),f.push(g)}e[h]=f,o&&c++}break;case We.MULTIPOLYGON:{const p=o[c]-o[c-1];c++;const f=[];for(let m=0;m<p;m++){const y=n[a]-n[a-1];a++;for(let g=0;g<y;g++){const A=s[l]-s[l-1];l++;const v=[];for(let C=0;C<A;C++){const w=this._vertexBuffer[r++],M=this._vertexBuffer[r++];v.push(new Ne(w,M))}v.length>0&&v.push(v[0]),f.push(v)}}e[h]=f}break}return e}[Symbol.iterator](){return null}}function hg(i,e,t,n,s,o){return new fO(i,e,t,n,s,o)}class fO extends dg{constructor(e,t,n,s,o,r){super(n,s,o,r),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function ug(i,e,t,n,s){return new pO(i,e,t,n,s)}class pO extends dg{constructor(e,t,n,s,o){super(t,n,s,o),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function mO(i,e,t,n,s){const o=ut(i,t),r=Zr(o,n,i,t);let a,l,c,h;if(r===we.CONST){const C=Oc(i,t,o);let w,M,x,I;for(let S=0;S<e-1;S++){const R=ut(i,t);switch(R.physicalStreamType){case Ve.LENGTH:switch(R.logicalStreamType.lengthType){case je.GEOMETRIES:w=Oi(i,t,R);break;case je.PARTS:M=Oi(i,t,R);break;case je.RINGS:x=Oi(i,t,R);break;case je.TRIANGLES:I=Oi(i,t,R)}break;case Ve.OFFSET:{switch(R.logicalStreamType.offsetType){case ni.VERTEX:a=xt(i,t,R);break;case ni.INDEX:h=xt(i,t,R);break}break}case Ve.DATA:{if(ht.VERTEX===R.logicalStreamType.dictionaryType)l=Fc(i,t,R,s);else{const b=R;c={numBits:b.numBits,coordinateShift:b.coordinateShift},l=xt(i,t,R,s)}break}}}return h?w!==void 0||M!==void 0?hg(n,C,I,h,l,{geometryOffsets:w,partOffsets:M,ringOffsets:x}):hg(n,C,I,h,l):c===void 0?cO(n,C,{geometryOffsets:w,partOffsets:M,ringOffsets:x},a,l):dO(n,C,{geometryOffsets:w,partOffsets:M,ringOffsets:x},a,l,c)}const u=xt(i,t,o);let p,f,m,y;for(let C=0;C<e-1;C++){const w=ut(i,t);switch(w.physicalStreamType){case Ve.LENGTH:switch(w.logicalStreamType.lengthType){case je.GEOMETRIES:p=xt(i,t,w);break;case je.PARTS:f=xt(i,t,w);break;case je.RINGS:m=xt(i,t,w);break;case je.TRIANGLES:y=Oi(i,t,w)}break;case Ve.OFFSET:switch(w.logicalStreamType.offsetType){case ni.VERTEX:a=xt(i,t,w);break;case ni.INDEX:h=xt(i,t,w);break}break;case Ve.DATA:if(ht.VERTEX===w.logicalStreamType.dictionaryType)l=Fc(i,t,w,s);else{const M=w;c={numBits:M.numBits,coordinateShift:M.coordinateShift},l=xt(i,t,w,s)}break}}let g,A,v;return p?(g=Uc(u,p,2),f&&m?(A=fg(u,g,f,!1),v=yO(u,g,A,m)):f&&(A=gO(u,g,f))):f&&m?(A=Uc(u,f,1),v=fg(u,A,m,!0)):f&&(A=Uc(u,f,0)),h&&!A?ug(u,y,h,l):h?ug(u,y,h,l,{geometryOffsets:g,partOffsets:A,ringOffsets:v}):c===void 0?hO(u,{geometryOffsets:g,partOffsets:A,ringOffsets:v},a,l):uO(u,{geometryOffsets:g,partOffsets:A,ringOffsets:v},a,l,c)}function Uc(i,e,t){const n=new Uint32Array(i.length+1);let s=0;n[0]=s;let o=0;for(let r=0;r<i.length;r++)s=n[r+1]=s+(i[r]>t?e[o++]:1);return n}function fg(i,e,t,n){const s=new Uint32Array(e[e.length-1]+1);let o=0;s[0]=o;let r=1,a=0;for(let l=0;l<i.length;l++){const c=i[l],h=e[l+1]-e[l];if(c===5||c===2||n&&(c===4||c===1))for(let u=0;u<h;u++)o=s[r++]=o+t[a++];else for(let u=0;u<h;u++)s[r++]=++o}return s}function gO(i,e,t){const n=new Uint32Array(e[e.length-1]+1);let s=0;n[0]=s;let o=1,r=0;for(let a=0;a<i.length;a++){const l=i[a],c=e[a+1]-e[a];if(l===4||l===1)for(let h=0;h<c;h++)s=n[o++]=s+t[r++];else for(let h=0;h<c;h++)n[o++]=++s}return n}function yO(i,e,t,n){const s=new Uint32Array(t[t.length-1]+1);let o=0;s[0]=o;let r=1,a=1,l=0;for(let c=0;c<i.length;c++){const h=i[c],u=e[c+1]-e[c];if(h!==0&&h!==3)for(let p=0;p<u;p++){const f=t[r]-t[r-1];r++;for(let m=0;m<f;m++)o=s[a++]=o+n[l++]}else for(let p=0;p<u;p++)s[a++]=++o,r++}return s}class AO extends $n{constructor(e,t,n){super(e,t.getBuffer(),n),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class vO extends Xr{getValueFromBuffer(e){return this.dataBuffer[e]}}class pg extends $n{constructor(e,t,n,s){super(e,s?BigInt64Array.of(t):BigUint64Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}function mo(i,e,t,n,s){const o=Math.ceil(e/8),r=bO(i,o,t,n);return s?jF(r,e,s):r}function bO(i,e,t,n){const s=new Uint8Array(e);let o=0;const r=n.get()+t;for(;o<e&&!(n.get()>=r);){const a=i[n.increment()];if(a<=127){const l=a+3,c=i[n.increment()],h=Math.min(o+l,e);s.fill(c,o,h),o=h}else{const l=256-a;for(let c=0;c<l&&o<e;c++)s[o++]=i[n.increment()]}}return n.set(r),s}function CO(i,e,t,n){const s=e.get(),o=s+t*Float32Array.BYTES_PER_ELEMENT,r=new Uint8Array(i.subarray(s,o)).buffer,a=new Float32Array(r);return e.set(o),n?Wn(a,n,0):a}function wO(i,e,t,n){const s=e.get(),o=s+t*Float64Array.BYTES_PER_ELEMENT,r=new Uint8Array(i.subarray(s,o)).buffer,a=new Float64Array(r);return e.set(o),n?Wn(a,n,0):a}const EO=12,xO=new TextDecoder;function Vc(i,e,t){return t-e>=EO?xO.decode(i.subarray(e,t)):IO(i,e,t)}function IO(i,e,t){let n="",s=e;for(;s<t;){const o=i[s];let r=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>t)break;let l,c,h;a===1?o<128&&(r=o):a===2?(l=i[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=i[s+1],c=i[s+2],(l&192)===128&&(c&192)===128&&(r=(o&15)<<12|(l&63)<<6|c&63,(r<=2047||r>=55296&&r<=57343)&&(r=null))):a===4&&(l=i[s+1],c=i[s+2],h=i[s+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(r=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,(r<=65535||r>=1114112)&&(r=null))),r===null?(r=65533,a=1):r>65535&&(r-=65536,n+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),n+=String.fromCharCode(r),s+=a}return n}class Qc extends $n{constructor(e,t,n,s){super(e,n,s),this.offsetBuffer=t}}class mg extends Qc{constructor(e,t,n,s){super(e,t,n,s??t.length-1)}getValueFromBuffer(e){const t=this.offsetBuffer[e],n=this.offsetBuffer[e+1];return Vc(this.dataBuffer,t,n)}}class Jn extends Qc{constructor(e,t,n,s,o){super(e,n,s,o??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){const t=this.indexBuffer[e],n=this.offsetBuffer[t],s=this.offsetBuffer[t+1];return Vc(this.dataBuffer,n,s)}}function SO(i,e,t){const n=[],s=new Array(e.length).fill(0);for(let o=1;o<e.length;o++)s[o]=s[o-1]+e[o-1];for(let o=0;o<t.length;o++)if(t[o]===255)n.push(t[++o]);else{const r=e[t[o]],a=s[t[o]];for(let l=0;l<r;l++)n.push(i[a+l])}return new Uint8Array(n)}class gg extends Qc{constructor(e,t,n,s,o,r,a){super(e,n,s,a??t.length),this.indexBuffer=t,this.symbolOffsetBuffer=o,this.symbolTableBuffer=r}getValueFromBuffer(e){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=SO(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const t=this.indexBuffer[e],n=this.offsetBuffer[t],s=this.offsetBuffer[t+1];return Vc(this.decodedDictionary,n,s)}offsetToLengthBuffer(e){const t=new Uint32Array(e.length-1);let n=e[0];for(let s=1;s<e.length;s++){const o=e[s];t[s-1]=o-n,n=o}return t}}function MO(i,e,t,n,s){let o=null,r=null,a=null,l=null,c=null,h=s??null,u=null,p=null;for(let f=0;f<n;f++){const m=ut(e,t);switch(m.physicalStreamType){case Ve.PRESENT:{const y=mo(e,m.numValues,m.byteLength,t),g=new mi(y,m.numValues);h=s??g;break}case Ve.OFFSET:{r=xt(e,t,m,void 0,h);break}case Ve.LENGTH:{const y=Oi(e,t,m);je.DICTIONARY===m.logicalStreamType.lengthType?o=y:je.SYMBOL===m.logicalStreamType.lengthType?l=y:u=y;break}case Ve.DATA:{const y=e.subarray(t.get(),t.get()+m.byteLength);t.add(m.byteLength);const g=m.logicalStreamType.dictionaryType;ht.FSST===g?c=y:ht.SINGLE===g||ht.SHARED===g?a=y:ht.NONE===g&&(p=y);break}}}return TO(i,c,r,o,a,l,h)??BO(i,a,r,o,h)??_O(i,u,p,r,h)}function TO(i,e,t,n,s,o,r){return e?new gg(i,t,n,s,o,e,r):null}function BO(i,e,t,n,s){return e?s?new Jn(i,t,n,e,s):new Jn(i,t,n,e):null}function _O(i,e,t,n,s){if(!e||!t)return null;if(n)return s?new Jn(i,n,e,t,s):new Jn(i,n,e,t);if(s&&s.size()!==e.length-1){const o=new Uint32Array(s.size());let r=0;for(let a=0;a<s.size();a++)s.get(a)?o[a]=r++:o[a]=0;return new Jn(i,o,e,t,s)}return s?new mg(i,e,t,s):new mg(i,e,t)}function kO(i,e,t,n){let s=null,o=null,r=null,a=null,l=!1;for(;!l;){const p=ut(i,e);switch(p.physicalStreamType){case Ve.LENGTH:je.DICTIONARY===p.logicalStreamType.lengthType?s=Oi(i,e,p):r=Oi(i,e,p);break;case Ve.DATA:ht.SINGLE===p.logicalStreamType.dictionaryType||ht.SHARED===p.logicalStreamType.dictionaryType?(o=i.subarray(e.get(),e.get()+p.byteLength),l=!0):a=i.subarray(e.get(),e.get()+p.byteLength),e.add(p.byteLength);break}}const c=t.complexType.children,h=[];let u=0;for(const p of c){const f=rt(i,e,1)[0];if(f===0)continue;const m=p.name?`${t.name}${p.name}`:t.name;if(p.type!=="scalarField"||p.scalarField.physicalType!==ge.STRING)throw new Error("Currently only scalar string fields are implemented for a struct.");if(f>1&&!p.nullable||f===1&&p.nullable)throw new Error(`The number of streams for the child field ${p.name} does not match its nullability. nullibilty: ${p.nullable}, numStreams: ${f}`);let y;if(p.nullable){const v=ut(i,e),C=mo(i,v.numValues,v.byteLength,e);y=new mi(C,v.numValues)}const g=ut(i,e),A=xt(i,e,g,void 0,y);h[u++]=a?new gg(m,A,s,o,r,a,y):new Jn(m,A,s,o,y)}return h}function PO(i,e,t,n,s,o){return t.type==="scalarType"?DO(n,i,e,s,t.scalarType,t):n===0?null:kO(i,e,t)}function DO(i,e,t,n,s,o){let r=null;if(i===0)return null;if(o.nullable){const c=ut(e,t),h=c.numValues,u=t.get(),p=mo(e,h,c.byteLength,t);t.set(u+c.byteLength),r=new mi(p,c.numValues)}const a=r??n;switch(s.physicalType){case ge.UINT_32:case ge.INT_32:return OO(e,t,o,s,a);case ge.STRING:{const c=o.nullable?i-1:i;return MO(o.name,e,t,c,r)}case ge.BOOLEAN:return NO(e,t,o,n,a);case ge.UINT_64:case ge.INT_64:return FO(e,t,o,a,s);case ge.FLOAT:return LO(e,t,o,a);case ge.DOUBLE:return RO(e,t,o,a);default:throw new Error(`The specified data type for the field is currently not supported: ${s}`)}}function NO(i,e,t,n,s){const o=ut(i,e),r=o.numValues,a=e.get(),l=go(s)?s:void 0,c=mo(i,r,o.byteLength,e,l);e.set(a+o.byteLength);const h=new mi(c,r);return new AO(t.name,h,s)}function LO(i,e,t,n){const s=ut(i,e),o=go(n)?n:void 0,r=CO(i,e,s.numValues,o);return new vO(t.name,r,n)}function RO(i,e,t,n){const s=ut(i,e),o=go(n)?n:void 0,r=wO(i,e,s.numValues,o);return new Ic(t.name,r,n)}function FO(i,e,t,n,s){const o=ut(i,e),r=Zr(o,n,i,e,"int64"),a=s.physicalType===ge.INT_64;if(r===we.FLAT){const c=go(n)?n:void 0,h=a?qF(i,e,o,c):tg(i,e,o,c);return new ng(t.name,h,n)}if(r===we.SEQUENCE){const c=eg(i,e,o);return new sg(t.name,c[0],c[1],o.numRleValues)}const l=a?XF(i,e,o):ig(i,e,o);return new pg(t.name,l,n,a)}function OO(i,e,t,n,s){const o=ut(i,e),r=Zr(o,s,i,e),a=n.physicalType===ge.INT_32;if(r===we.FLAT){const c=go(s)?s:void 0,h=a?Fc(i,e,o,void 0,c):xt(i,e,o,void 0,c);return new xc(t.name,h,s)}if(r===we.SEQUENCE){const c=Zm(i,e,o);return new Sc(t.name,c[0],c[1],o.numRleValues)}const l=a?WF(i,e,o):Oc(i,e,o);return new Mc(t.name,l,s,a)}function go(i){return i instanceof mi}function yg(i){switch(i){case 0:case 1:case 2:case 3:{const e={};e.nullable=(i&1)!==0,e.columnScope=Jr.FEATURE;const t={};return t.type="logicalType",t.logicalType=Tc.ID,t.longID=(i&2)!==0,e.scalarType=t,e.type="scalarType",e}case 4:{const e={};e.nullable=!1,e.columnScope=Jr.FEATURE;const t={};return t.type="physicalType",t.physicalType=po.GEOMETRY,e.type="complexType",e.complexType=t,e}case 30:{const e={};e.nullable=!1,e.columnScope=Jr.FEATURE;const t={};return t.type="physicalType",t.physicalType=po.STRUCT,e.type="complexType",e.complexType=t,e}default:return QO(i)}}function Ag(i){return i>=10}function vg(i){return i===30}function GO(i){if(i.type==="scalarType"){const e=i.scalarType;if(e.type==="physicalType")switch(e.physicalType){case ge.BOOLEAN:case ge.INT_8:case ge.UINT_8:case ge.INT_32:case ge.UINT_32:case ge.INT_64:case ge.UINT_64:case ge.FLOAT:case ge.DOUBLE:return!1;case ge.STRING:return!0;default:return!1}if(e.type==="logicalType")return!1}else if(i.type==="complexType"){const e=i.complexType;if(e.type==="physicalType")switch(e.physicalType){case po.GEOMETRY:case po.STRUCT:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",i),!1}function UO(i){return i.type==="scalarType"&&i.scalarType?.type==="logicalType"&&i.scalarType.logicalType===Tc.ID}function VO(i){return i.type==="complexType"&&i.complexType?.type==="physicalType"&&i.complexType.physicalType===po.GEOMETRY}function QO(i){let e;switch(i){case 10:case 11:e=ge.BOOLEAN;break;case 12:case 13:e=ge.INT_8;break;case 14:case 15:e=ge.UINT_8;break;case 16:case 17:e=ge.INT_32;break;case 18:case 19:e=ge.UINT_32;break;case 20:case 21:e=ge.INT_64;break;case 22:case 23:e=ge.UINT_64;break;case 24:case 25:e=ge.FLOAT;break;case 26:case 27:e=ge.DOUBLE;break;case 28:case 29:e=ge.STRING;break;default:return null}const t={};t.nullable=(i&1)!==0,t.columnScope=Jr.FEATURE;const n={};return n.type="physicalType",n.physicalType=e,t.type="scalarType",t.scalarType=n,t}const zO=new TextDecoder,HO="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)",YO="10-29(scalars), 30(STRUCT)";function zc(i,e){const t=rt(i,e,1)[0];if(t===0)return"";const n=e.get(),s=n+t,o=i.subarray(n,s);return e.add(t),zO.decode(o)}function $O(i){return{name:i.name,nullable:i.nullable,scalarField:i.scalarType,complexField:i.complexType,type:i.type==="scalarType"?"scalarField":"complexField"}}function bg(i,e){const t=rt(i,e,1)[0]>>>0;if(t<10||t>30)throw new Error(`Unsupported field type code ${t}. Supported: ${YO}`);const n=yg(t);if(Ag(t)&&(n.name=zc(i,e)),vg(t)){const s=rt(i,e,1)[0]>>>0;n.complexType.children=new Array(s);for(let o=0;o<s;o++)n.complexType.children[o]=bg(i,e)}return $O(n)}function jO(i,e){const t=rt(i,e,1)[0]>>>0,n=yg(t);if(!n)throw new Error(`Unsupported column type code ${t}. Supported: ${HO}`);if(Ag(t)?n.name=zc(i,e):t>=0&&t<=3?n.name="id":t===4&&(n.name="geometry"),vg(t)){const s=rt(i,e,1)[0]>>>0,o=n.complexType;o.children=new Array(s);for(let r=0;r<s;r++)o.children[r]=bg(i,e)}return n}function WO(i,e){const t={};t.featureTables=[];const n={};if(n.name=zc(i,e),n.name.length===0)throw new Error("Missing layer name");const s=rt(i,e,1)[0]>>>0,o=rt(i,e,1)[0]>>>0;n.columns=new Array(o);for(let r=0;r<o;r++)n.columns[r]=jO(i,e);return t.featureTables.push(n),[t,s]}function qO(i,e,t=!0){const n=new Hm(0),s=[];for(;n.get()<i.length;){const o=rt(i,n,1)[0]>>>0,a=n.get()+o;if(a>i.length)throw new Error(`Block overruns tile: ${a} > ${i.length}`);if(rt(i,n,1)[0]>>>0!==1){n.set(a);continue}const[c,h]=WO(i,n),u=c.featureTables[0];let p=null,f=null;const m=[];let y=0;for(const A of u.columns){const v=A.name;if(UO(A)){let C=null;if(A.nullable){const M=ut(i,n),x=n.get(),I=mo(i,M.numValues,M.byteLength,n);n.set(x+M.byteLength),C=new mi(I,M.numValues)}const w=ut(i,n);y=C?C.size():w.decompressedCount,p=KO(i,A,n,v,w,C??y,t)}else if(VO(A)){const C=rt(i,n,1)[0];if(y===0){const w=n.get();y=ut(i,n).decompressedCount,n.set(w)}f=mO(i,C,n,y,e)}else{const w=GO(A)?rt(i,n,1)[0]:1;if(w===0)continue;const M=PO(i,n,A,w,y);if(M)if(Array.isArray(M))for(const x of M)m.push(x);else m.push(M)}}const g=new IR(u.name,f,p,m,h);s.push(g),n.set(a)}return s}function KO(i,e,t,n,s,o,r=!1){const a=e.scalarType;if(a?.type!=="logicalType"||a.logicalType!==Tc.ID)throw new Error(`ID column must be a logical ID scalar type: ${n}`);const l=a.longID?ge.UINT_64:ge.UINT_32,c=typeof o=="number"?void 0:o,h=Zr(s,o,i,t,l===ge.UINT_64?"int64":"int32");if(l===ge.UINT_32)switch(h){case we.FLAT:{const u=xt(i,t,s,void 0,c);return new xc(n,u,o)}case we.SEQUENCE:{const u=Zm(i,t,s);return new Sc(n,u[0],u[1],s.numRleValues)}case we.CONST:{const u=Oc(i,t,s);return new Mc(n,u,o,!1)}}switch(h){case we.FLAT:{if(r){const p=KF(i,t,s);return new Ic(n,p,o)}const u=tg(i,t,s,c);return new ng(n,u,o)}case we.SEQUENCE:{const u=eg(i,t,s);return new sg(n,u[0],u[1],s.numRleValues)}case we.CONST:{const u=ig(i,t,s);return new pg(n,u,o,!1)}}throw new Error("Vector type not supported for id column.")}class XO{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case We.POINT:case We.MULTIPOINT:this.type=1;break;case We.LINESTRING:case We.MULTILINESTRING:this.type=2;break;case We.POLYGON:case We.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const t of this._featureData.geometry.coordinates){const n=[];for(const s of t)n.push(new Ne(s.x,s.y));e.push(n)}return e}}class JO{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new XO(this.features[e],this.extent)}}class ZO{constructor(e){this.layers={};const t=qO(new Uint8Array(e));this.layers=t.reduce((n,s)=>({...n,[s.name]:new JO(s)}),{})}}const Hc=65536*65536,Cg=1/Hc,e6=12,wg=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),Yc=0,ea=1,yo=2,ta=5;class t6{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,n=this.length){for(;this.pos<n;){const s=this.readVarint(),o=s>>3,r=this.pos;this.type=s&7,e(o,t,this),this.pos===r&&this.skip(s)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Hc;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Hc;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let n,s;return s=t[this.pos++],n=s&127,s<128||(s=t[this.pos++],n|=(s&127)<<7,s<128)||(s=t[this.pos++],n|=(s&127)<<14,s<128)||(s=t[this.pos++],n|=(s&127)<<21,s<128)?n:(s=t[this.pos],n|=(s&15)<<28,i6(n,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=e6&&wg?wg.decode(this.buf.subarray(t,e)):m6(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===yo?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===Yc)for(;this.buf[this.pos++]>127;);else if(t===yo)this.pos=this.readVarint()+this.pos;else if(t===ta)this.pos+=4;else if(t===ea)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Cg),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Cg),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){n6(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=g6(this.buf,e,this.pos);const n=this.pos-t;n>=128&&Eg(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;const n=this.pos;e(t,this);const s=this.pos-n;s>=128&&Eg(n,s,this),this.pos=n-1,this.writeVarint(s),this.pos+=s}writeMessage(e,t,n){this.writeTag(e,yo),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,r6,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,a6,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,d6,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,l6,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,c6,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,h6,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,u6,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,f6,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,p6,t)}writeBytesField(e,t){this.writeTag(e,yo),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,ta),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,ta),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,ea),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,ea),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,Yc),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,Yc),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,yo),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,ta),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,ea),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function i6(i,e,t){const n=t.buf;let s,o;if(o=n[t.pos++],s=(o&112)>>4,o<128||(o=n[t.pos++],s|=(o&127)<<3,o<128)||(o=n[t.pos++],s|=(o&127)<<10,o<128)||(o=n[t.pos++],s|=(o&127)<<17,o<128)||(o=n[t.pos++],s|=(o&127)<<24,o<128)||(o=n[t.pos++],s|=(o&1)<<31,o<128))return Zn(i,s,e);throw new Error("Expected varint not more than 10 bytes")}function Zn(i,e,t){return t?e*4294967296+(i>>>0):(e>>>0)*4294967296+(i>>>0)}function n6(i,e){let t,n;if(i>=0?(t=i%4294967296|0,n=i/4294967296|0):(t=~(-i%4294967296),n=~(-i/4294967296),t^4294967295?t=t+1|0:(t=0,n=n+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),s6(t,n,e),o6(n,e)}function s6(i,e,t){t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos]=i&127}function o6(i,e){const t=(i&7)<<4;e.buf[e.pos++]|=t|((i>>>=3)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127)))))}function Eg(i,e,t){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(n);for(let s=t.pos-1;s>=i;s--)t.buf[s+n]=t.buf[s]}function r6(i,e){for(let t=0;t<i.length;t++)e.writeVarint(i[t])}function a6(i,e){for(let t=0;t<i.length;t++)e.writeSVarint(i[t])}function l6(i,e){for(let t=0;t<i.length;t++)e.writeFloat(i[t])}function c6(i,e){for(let t=0;t<i.length;t++)e.writeDouble(i[t])}function d6(i,e){for(let t=0;t<i.length;t++)e.writeBoolean(i[t])}function h6(i,e){for(let t=0;t<i.length;t++)e.writeFixed32(i[t])}function u6(i,e){for(let t=0;t<i.length;t++)e.writeSFixed32(i[t])}function f6(i,e){for(let t=0;t<i.length;t++)e.writeFixed64(i[t])}function p6(i,e){for(let t=0;t<i.length;t++)e.writeSFixed64(i[t])}function m6(i,e,t){let n="",s=e;for(;s<t;){const o=i[s];let r=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>t)break;let l,c,h;a===1?o<128&&(r=o):a===2?(l=i[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=i[s+1],c=i[s+2],(l&192)===128&&(c&192)===128&&(r=(o&15)<<12|(l&63)<<6|c&63,(r<=2047||r>=55296&&r<=57343)&&(r=null))):a===4&&(l=i[s+1],c=i[s+2],h=i[s+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(r=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,(r<=65535||r>=1114112)&&(r=null))),r===null?(r=65533,a=1):r>65535&&(r-=65536,n+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),n+=String.fromCharCode(r),s+=a}return n}function g6(i,e,t){for(let n=0,s,o;n<e.length;n++){if(s=e.charCodeAt(n),s>55295&&s<57344)if(o)if(s<56320){i[t++]=239,i[t++]=191,i[t++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||n+1===e.length?(i[t++]=239,i[t++]=191,i[t++]=189):o=s;continue}else o&&(i[t++]=239,i[t++]=191,i[t++]=189,o=null);s<128?i[t++]=s:(s<2048?i[t++]=s>>6|192:(s<65536?i[t++]=s>>12|224:(i[t++]=s>>18|240,i[t++]=s>>12&63|128),i[t++]=s>>6&63|128),i[t++]=s&63|128)}return t}class xg extends Cc{constructor(e,t){super(e,t),this.tilingScheme=new Cesium.WebMercatorTilingScheme}async init(){const e=this.styleSource;let t=e.url;if(t&&!e.tiles){t=/^((http)|(https)|(data:)|\/)/.test(t)?t:this.path+e.url;try{const n=await Cesium.Resource.fetchJson(t);for(const s in n)e[s]||(e[s]=n[s])}catch(n){this.errorEvent.raiseEvent(n)}}}async requestTile(e,t,n){const s=this.styleSource;if(!s.tiles||!s.tiles.length)return;s.scheme==="tms"&&(t=this.tilingScheme.getNumberOfYTilesAtLevel(n)-t-1);let o=s.tiles[0].replace("{x}",e).replace("{y}",t).replace("{z}",n);o=/^((http)|(https)|(data:)|\/)/.test(o)?o:this.path+o;try{const r=await fetch(o).then(l=>l.arrayBuffer());return s.encoding=="mlt"?new ZO(r):new xR(new t6(r))}catch(r){this.errorEvent.raiseEvent(r)}}async requestTileBuffer(e,t,n,s){const o=this.styleSource;if(!o.tiles||!o.tiles.length)return;o.scheme==="tms"&&(t=this.tilingScheme.getNumberOfYTilesAtLevel(n)-t-1);let r=o.tiles[0].replace("{x}",e).replace("{y}",t).replace("{z}",n);r=/^((http)|(https)|(data:)|\/)/.test(r)?r:this.path+r;try{const a=await fetch(r).then(c=>c.arrayBuffer()),l=o.encoding==="mlt"?"mlt":"mvt";return{buffer:a,encoding:l}}catch(a){this.errorEvent.raiseEvent(a)}}}Ec("vector",xg);function $c(i,e,t,n){let s=n;const o=e+(t-e>>1);let r=t-e,a;const l=i[e],c=i[e+1],h=i[t],u=i[t+1];for(let p=e+3;p<t;p+=3){const f=y6(i[p],i[p+1],l,c,h,u);if(f>s)a=p,s=f;else if(f===s){const m=Math.abs(p-o);m<r&&(a=p,r=m)}}s>n&&(a-e>3&&$c(i,e,a,n),i[a+2]=s,t-a>3&&$c(i,a,t,n))}function y6(i,e,t,n,s,o){let r=s-t,a=o-n;if(r!==0||a!==0){const l=((i-t)*r+(e-n)*a)/(r*r+a*a);l>1?(t=s,n=o):l>0&&(t+=r*l,n+=a*l)}return r=i-t,a=e-n,r*r+a*a}function Ao(i,e,t,n){const s={id:i??null,type:e,geometry:t,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(e==="Point"||e==="MultiPoint"||e==="LineString")ia(s,t);else if(e==="Polygon")ia(s,t[0]);else if(e==="MultiLineString")for(const o of t)ia(s,o);else if(e==="MultiPolygon")for(const o of t)ia(s,o[0]);return s}function ia(i,e){for(let t=0;t<e.length;t+=3)i.minX=Math.min(i.minX,e[t]),i.minY=Math.min(i.minY,e[t+1]),i.maxX=Math.max(i.maxX,e[t]),i.maxY=Math.max(i.maxY,e[t+1])}function A6(i,e){const t=[];if(i.type==="FeatureCollection")for(let n=0;n<i.features.length;n++)na(t,i.features[n],e,n);else i.type==="Feature"?na(t,i,e):na(t,{geometry:i},e);return t}function na(i,e,t,n){if(!e.geometry)return;const s=e.geometry.coordinates;if(s&&s.length===0)return;const o=e.geometry.type,r=Math.pow(t.tolerance/((1<<t.maxZoom)*t.extent),2);let a=[],l=e.id;if(t.promoteId?l=e.properties[t.promoteId]:t.generateId&&(l=n||0),o==="Point")Ig(s,a);else if(o==="MultiPoint")for(const c of s)Ig(c,a);else if(o==="LineString")jc(s,a,r,!1);else if(o==="MultiLineString"){if(t.lineMetrics){for(const c of s)a=[],jc(c,a,r,!1),i.push(Ao(l,"LineString",a,e.properties));return}Wc(s,a,r,!1)}else if(o==="Polygon")Wc(s,a,r,!0);else if(o==="MultiPolygon")for(const c of s){const h=[];Wc(c,h,r,!0),a.push(h)}else if(o==="GeometryCollection"){for(const c of e.geometry.geometries)na(i,{id:l,geometry:c,properties:e.properties},t,n);return}else throw new Error("Input data is not a valid GeoJSON object.");i.push(Ao(l,o,a,e.properties))}function Ig(i,e){e.push(Sg(i[0]),Mg(i[1]),0)}function jc(i,e,t,n){let s,o,r=0;for(let l=0;l<i.length;l++){const c=Sg(i[l][0]),h=Mg(i[l][1]);e.push(c,h,0),l>0&&(n?r+=(s*h-c*o)/2:r+=Math.sqrt(Math.pow(c-s,2)+Math.pow(h-o,2))),s=c,o=h}const a=e.length-3;e[2]=1,$c(e,0,a,t),e[a+2]=1,e.size=Math.abs(r),e.start=0,e.end=e.size}function Wc(i,e,t,n){for(let s=0;s<i.length;s++){const o=[];jc(i[s],o,t,n),e.push(o)}}function Sg(i){return i/360+.5}function Mg(i){const e=Math.sin(i*Math.PI/180),t=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return t<0?0:t>1?1:t}function gi(i,e,t,n,s,o,r,a){if(t/=e,n/=e,o>=t&&r<n)return i;if(r<t||o>=n)return null;const l=[];for(const c of i){const h=c.geometry;let u=c.type;const p=s===0?c.minX:c.minY,f=s===0?c.maxX:c.maxY;if(p>=t&&f<n){l.push(c);continue}else if(f<t||p>=n)continue;let m=[];if(u==="Point"||u==="MultiPoint")v6(h,m,t,n,s);else if(u==="LineString")Tg(h,m,t,n,s,!1,a.lineMetrics);else if(u==="MultiLineString")qc(h,m,t,n,s,!1);else if(u==="Polygon")qc(h,m,t,n,s,!0);else if(u==="MultiPolygon")for(const y of h){const g=[];qc(y,g,t,n,s,!0),g.length&&m.push(g)}if(m.length){if(a.lineMetrics&&u==="LineString"){for(const y of m)l.push(Ao(c.id,u,y,c.tags));continue}(u==="LineString"||u==="MultiLineString")&&(m.length===1?(u="LineString",m=m[0]):u="MultiLineString"),(u==="Point"||u==="MultiPoint")&&(u=m.length===3?"Point":"MultiPoint"),l.push(Ao(c.id,u,m,c.tags))}}return l.length?l:null}function v6(i,e,t,n,s){for(let o=0;o<i.length;o+=3){const r=i[o+s];r>=t&&r<=n&&es(e,i[o],i[o+1],i[o+2])}}function Tg(i,e,t,n,s,o,r){let a=Bg(i);const l=s===0?b6:C6;let c=i.start,h,u;for(let A=0;A<i.length-3;A+=3){const v=i[A],C=i[A+1],w=i[A+2],M=i[A+3],x=i[A+4],I=s===0?v:C,S=s===0?M:x;let R=!1;r&&(h=Math.sqrt(Math.pow(v-M,2)+Math.pow(C-x,2))),I<t?S>=t&&(u=l(a,v,C,M,x,t),r&&(a.start=c+h*u)):I>n?S<=n&&(u=l(a,v,C,M,x,n),r&&(a.start=c+h*u)):es(a,v,C,w),S<t&&I>=t&&(u=l(a,v,C,M,x,t),R=!0),S>n&&I<=n&&(u=l(a,v,C,M,x,n),R=!0),!o&&R&&(r&&(a.end=c+h*u),e.push(a),a=Bg(i)),r&&(c+=h)}let p=i.length-3;const f=i[p],m=i[p+1],y=i[p+2],g=s===0?f:m;g>=t&&g<=n&&es(a,f,m,y),p=a.length-3,o&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&es(a,a[0],a[1],a[2]),a.length&&e.push(a)}function Bg(i){const e=[];return e.size=i.size,e.start=i.start,e.end=i.end,e}function qc(i,e,t,n,s,o){for(const r of i)Tg(r,e,t,n,s,o,!1)}function es(i,e,t,n){i.push(e,t,n)}function b6(i,e,t,n,s,o){const r=(o-e)/(n-e);return es(i,o,t+(s-t)*r,1),r}function C6(i,e,t,n,s,o){const r=(o-t)/(s-t);return es(i,e+(n-e)*r,o,1),r}function w6(i,e){const t=e.buffer/e.extent;let n=i;const s=gi(i,1,-1-t,t,0,-1,2,e),o=gi(i,1,1-t,2+t,0,-1,2,e);return(s||o)&&(n=gi(i,1,-t,1+t,0,-1,2,e)||[],s&&(n=_g(s,1).concat(n)),o&&(n=n.concat(_g(o,-1)))),n}function _g(i,e){const t=[];for(let n=0;n<i.length;n++){const s=i[n],o=s.type;let r;if(o==="Point"||o==="MultiPoint"||o==="LineString")r=Kc(s.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){r=[];for(const a of s.geometry)r.push(Kc(a,e))}else if(o==="MultiPolygon"){r=[];for(const a of s.geometry){const l=[];for(const c of a)l.push(Kc(c,e));r.push(l)}}t.push(Ao(s.id,o,r,s.tags))}return t}function Kc(i,e){const t=[];t.size=i.size,i.start!==void 0&&(t.start=i.start,t.end=i.end);for(let n=0;n<i.length;n+=3)t.push(i[n]+e,i[n+1],i[n+2]);return t}function kg(i,e){if(i.transformed)return i;const t=1<<i.z,n=i.x,s=i.y;for(const o of i.features){const r=o.geometry,a=o.type;if(o.geometry=[],a===1)for(let l=0;l<r.length;l+=2)o.geometry.push(Pg(r[l],r[l+1],e,t,n,s));else for(let l=0;l<r.length;l++){const c=[];for(let h=0;h<r[l].length;h+=2)c.push(Pg(r[l][h],r[l][h+1],e,t,n,s));o.geometry.push(c)}}return i.transformed=!0,i}function Pg(i,e,t,n,s,o){return[Math.round(t*(i*n-s)),Math.round(t*(e*n-o))]}function E6(i,e,t,n,s){const o=e===s.maxZoom?0:s.tolerance/((1<<e)*s.extent),r={features:[],numPoints:0,numSimplified:0,numFeatures:i.length,source:null,x:t,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const a of i)x6(r,a,o,s);return r}function x6(i,e,t,n){const s=e.geometry,o=e.type,r=[];if(i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),o==="Point"||o==="MultiPoint")for(let a=0;a<s.length;a+=3)r.push(s[a],s[a+1]),i.numPoints++,i.numSimplified++;else if(o==="LineString")Xc(r,s,i,t,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(let a=0;a<s.length;a++)Xc(r,s[a],i,t,o==="Polygon",a===0);else if(o==="MultiPolygon")for(let a=0;a<s.length;a++){const l=s[a];for(let c=0;c<l.length;c++)Xc(r,l[c],i,t,!0,c===0)}if(r.length){let a=e.tags||null;if(o==="LineString"&&n.lineMetrics){a={};for(const c in e.tags)a[c]=e.tags[c];a.mapbox_clip_start=s.start/s.size,a.mapbox_clip_end=s.end/s.size}const l={geometry:r,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:a};e.id!==null&&(l.id=e.id),i.features.push(l)}}function Xc(i,e,t,n,s,o){const r=n*n;if(n>0&&e.size<(s?r:n)){t.numPoints+=e.length/3;return}const a=[];for(let l=0;l<e.length;l+=3)(n===0||e[l+2]>r)&&(t.numSimplified++,a.push(e[l],e[l+1])),t.numPoints++;s&&I6(a,o),i.push(a)}function I6(i,e){let t=0;for(let n=0,s=i.length,o=s-2;n<s;o=n,n+=2)t+=(i[n]-i[o])*(i[n+1]+i[o+1]);if(t>0===e)for(let n=0,s=i.length;n<s/2;n+=2){const o=i[n],r=i[n+1];i[n]=i[s-2-n],i[n+1]=i[s-1-n],i[s-2-n]=o,i[s-1-n]=r}}const S6={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class M6{constructor(e,t){t=this.options=T6(Object.create(S6),t);const n=t.debug;if(n&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let s=A6(e,t);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),s=w6(s,t),s.length&&this.splitTile(s,0,0,0),n&&(s.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,t,n,s,o,r,a){const l=[e,t,n,s],c=this.options,h=c.debug;for(;l.length;){s=l.pop(),n=l.pop(),t=l.pop(),e=l.pop();const u=1<<t,p=Jc(t,n,s);let f=this.tiles[p];if(!f&&(h>1&&console.time("creation"),f=this.tiles[p]=E6(e,t,n,s,c),this.tileCoords.push({z:t,x:n,y:s}),h)){h>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,s,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));const S=`z${t}`;this.stats[S]=(this.stats[S]||0)+1,this.total++}if(f.source=e,o==null){if(t===c.indexMaxZoom||f.numPoints<=c.indexMaxPoints)continue}else{if(t===c.maxZoom||t===o)continue;if(o!=null){const S=o-t;if(n!==r>>S||s!==a>>S)continue}}if(f.source=null,e.length===0)continue;h>1&&console.time("clipping");const m=.5*c.buffer/c.extent,y=.5-m,g=.5+m,A=1+m;let v=null,C=null,w=null,M=null;const x=gi(e,u,n-m,n+g,0,f.minX,f.maxX,c),I=gi(e,u,n+y,n+A,0,f.minX,f.maxX,c);x&&(v=gi(x,u,s-m,s+g,1,f.minY,f.maxY,c),C=gi(x,u,s+y,s+A,1,f.minY,f.maxY,c)),I&&(w=gi(I,u,s-m,s+g,1,f.minY,f.maxY,c),M=gi(I,u,s+y,s+A,1,f.minY,f.maxY,c)),h>1&&console.timeEnd("clipping"),l.push(v||[],t+1,n*2,s*2),l.push(C||[],t+1,n*2,s*2+1),l.push(w||[],t+1,n*2+1,s*2),l.push(M||[],t+1,n*2+1,s*2+1)}}getTile(e,t,n){e=+e,t=+t,n=+n;const s=this.options,{extent:o,debug:r}=s;if(e<0||e>24)return null;const a=1<<e;t=t+a&a-1;const l=Jc(e,t,n);if(this.tiles[l])return kg(this.tiles[l],o);r>1&&console.log("drilling down to z%d-%d-%d",e,t,n);let c=e,h=t,u=n,p;for(;!p&&c>0;)c--,h=h>>1,u=u>>1,p=this.tiles[Jc(c,h,u)];return!p||!p.source?null:(r>1&&(console.log("found parent tile z%d-%d-%d",c,h,u),console.time("drilling down")),this.splitTile(p.source,c,h,u,e,t,n),r>1&&console.timeEnd("drilling down"),this.tiles[l]?kg(this.tiles[l],o):null)}}function Jc(i,e,t){return((1<<i)*t+e)*32+i}function T6(i,e){for(const t in e)i[t]=e[t];return i}function B6(i,e){return new M6(i,e)}typeof TextDecoder>"u"||new TextDecoder("utf-8");var _6=class{constructor(i,e){this.feature=i,this.type=i.type,this.properties=i.tags?i.tags:{},this.extent=e,"id"in i&&(typeof i.id=="string"?this.id=parseInt(i.id,10):typeof i.id=="number"&&!isNaN(i.id)&&(this.id=i.id))}loadGeometry(){const i=[],e=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const t of e){const n=[];for(const s of t)n.push(new Ne(s[0],s[1]));i.push(n)}return i}};const Dg="_geojsonTileLayer";var k6=class{constructor(i,e){this.layers={[Dg]:this},this.name=Dg,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=i.length,this.features=i}feature(i){return new _6(this.features[i],this.extent)}};const Tt=8192;class Ng extends Cc{constructor(e,t){super(e,t)}async init(){const e=this.styleSource;let t=e.data;if(typeof t=="string"){const n=/^((http)|(https)|(data:)|\/)/.test(t)?t:this.path+t;try{t=await Cesium.Resource.fetchJson(n)}catch(s){this.errorEvent.raiseEvent(s)}}t&&t.features?.length&&(this.tileIndex=new B6(t,{extent:Tt,buffer:e.buffer===void 0?128:e.buffer,tolerance:e.tolerance===e.tolerance?.375:e.tolerance}))}async requestTile(e,t,n){if(this.tileIndex)try{const s=this.tileIndex.getTile(n,e,t);return s?new k6(s.features,{extent:Tt}):void 0}catch(s){this.errorEvent.raiseEvent(s)}}}Ec("geojson",Ng);var P6=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],D6=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],N6={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:P6,layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:D6,paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}},Lg=N6;function Rg(i,...e){for(const t of e)for(const n in t)i[n]=t[n];return i}var si=class extends Error{constructor(i,e){super(e),this.message=e,this.key=i}},L6=class Ey{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[n,s]of t)this.bindings[n]=s}concat(e){return new Ey(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}};const sa={kind:"null"},W={kind:"number"},le={kind:"string"},ue={kind:"boolean"},oi={kind:"color"},oa={kind:"projectionDefinition"},hn={kind:"object"},ce={kind:"value"},R6={kind:"error"},ra={kind:"collator"},aa={kind:"formatted"},la={kind:"padding"},vo={kind:"colorArray"},ca={kind:"numberArray"},bo={kind:"resolvedImage"},da={kind:"variableAnchorOffsetCollection"};function yt(i,e){return{kind:"array",itemType:i,N:e}}function Pe(i){if(i.kind==="array"){const e=Pe(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}else return i.kind}const F6=[sa,W,le,ue,oi,oa,aa,hn,yt(ce),la,ca,vo,bo,da];function Co(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Co(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const t of F6)if(!Co(t,e))return null}}return`Expected ${Pe(i)} but found ${Pe(e)} instead.`}function Zc(i,e){return e.some(t=>t.kind===i.kind)}function un(i,e){return e.some(t=>t==="null"?i===null:t==="array"?Array.isArray(i):t==="object"?i&&!Array.isArray(i)&&typeof i=="object":t===typeof i)}function Ui(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const Fg=.96422,Og=1,Gg=.82521,Ug=4/29,ts=6/29,Vg=3*ts*ts,O6=ts*ts*ts,G6=Math.PI/180,U6=180/Math.PI;function Qg(i){return i=i%360,i<0&&(i+=360),i}function zg([i,e,t,n]){i=ed(i),e=ed(e),t=ed(t);let s,o;const r=td((.2225045*i+.7168786*e+.0606169*t)/Og);i===e&&e===t?s=o=r:(s=td((.4360747*i+.3850649*e+.1430804*t)/Fg),o=td((.0139322*i+.0971045*e+.7141733*t)/Gg));const a=116*r-16;return[a<0?0:a,500*(s-r),200*(r-o),n]}function ed(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function td(i){return i>O6?Math.pow(i,1/3):i/Vg+Ug}function Hg([i,e,t,n]){let s=(i+16)/116,o=isNaN(e)?s:s+e/500,r=isNaN(t)?s:s-t/200;return s=Og*nd(s),o=Fg*nd(o),r=Gg*nd(r),[id(3.1338561*o-1.6168667*s-.4906146*r),id(-.9787684*o+1.9161415*s+.033454*r),id(.0719453*o-.2289914*s+1.4052427*r),n]}function id(i){return i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055,i<0?0:i>1?1:i}function nd(i){return i>ts?i*i*i:Vg*(i-Ug)}function V6(i){const[e,t,n,s]=zg(i),o=Math.sqrt(t*t+n*n);return[Math.round(o*1e4)?Qg(Math.atan2(n,t)*U6):NaN,o,e,s]}function Q6([i,e,t,n]){return i=isNaN(i)?0:i*G6,Hg([t,Math.cos(i)*e,Math.sin(i)*e,n])}function z6([i,e,t,n]){i=Qg(i),e/=100,t/=100;function s(o){const r=(o+i/30)%12,a=e*Math.min(t,1-t);return t-a*Math.max(-1,Math.min(r-3,9-r,1))}return[s(0),s(8),s(4),n]}const H6=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Yg(i,e){return H6(i,e)?i[e]:void 0}function Y6(i){if(i=i.toLowerCase().trim(),i==="transparent")return[0,0,0,0];const e=Yg($6,i);if(e){const[n,s,o]=e;return[n/255,s/255,o/255,1]}if(i.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(i)){const n=i.length<6?1:2;let s=1;return[ha(i.slice(s,s+=n)),ha(i.slice(s,s+=n)),ha(i.slice(s,s+=n)),ha(i.slice(s,s+n)||"ff")]}if(i.startsWith("rgb")){const n=i.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){const[s,o,r,a,l,c,h,u,p,f,m,y]=n,g=[a||" ",h||" ",f].join("");if(g===" "||g===" /"||g===",,"||g===",,,"){const A=[r,c,p].join(""),v=A==="%%%"?100:A===""?255:0;if(v){const C=[is(+o/v,0,1),is(+l/v,0,1),is(+u/v,0,1),m?$g(+m,y):1];if(jg(C))return C}}return}}const t=i.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[n,s,o,r,a,l,c,h,u]=t,p=[o||" ",a||" ",c].join("");if(p===" "||p===" /"||p===",,"||p===",,,"){const f=[+s,is(+r,0,100),is(+l,0,100),h?$g(+h,u):1];if(jg(f))return z6(f)}}}function ha(i){return parseInt(i.padEnd(2,i),16)/255}function $g(i,e){return is(e?i/100:i,0,1)}function is(i,e,t){return Math.min(Math.max(e,i),t)}function jg(i){return!i.some(Number.isNaN)}const $6={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Vi(i,e,t){return i+t*(e-i)}function ns(i,e,t){return i.map((n,s)=>Vi(n,e[s],t))}function j6(i){return i==="rgb"||i==="hcl"||i==="lab"}var qe=(et=class{constructor(e,t,n,s=1,o=!0){this.r=e,this.g=t,this.b=n,this.a=s,o||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[e,t,n,s]))}static parse(e){if(e instanceof et)return e;if(typeof e!="string")return;const t=Y6(e);if(t)return new et(...t,!1)}get rgb(){const{r:e,g:t,b:n,a:s}=this,o=s||1/0;return this.overwriteGetter("rgb",[e/o,t/o,n/o,s])}get hcl(){return this.overwriteGetter("hcl",V6(this.rgb))}get lab(){return this.overwriteGetter("lab",zg(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,n,s]=this.rgb;return`rgba(${[e,t,n].map(o=>Math.round(o*255)).join(",")},${s})`}static interpolate(e,t,n,s="rgb"){switch(s){case"rgb":{const[o,r,a,l]=ns(e.rgb,t.rgb,n);return new et(o,r,a,l,!1)}case"hcl":{const[o,r,a,l]=e.hcl,[c,h,u,p]=t.hcl;let f,m;if(!isNaN(o)&&!isNaN(c)){let C=c-o;c>o&&C>180?C-=360:c<o&&o-c>180&&(C+=360),f=o+n*C}else isNaN(o)?isNaN(c)?f=NaN:(f=c,(a===1||a===0)&&(m=h)):(f=o,(u===1||u===0)&&(m=r));const[y,g,A,v]=Q6([f,m??Vi(r,h,n),Vi(a,u,n),Vi(l,p,n)]);return new et(y,g,A,v,!1)}case"lab":{const[o,r,a,l]=Hg(ns(e.lab,t.lab,n));return new et(o,r,a,l,!1)}}}},et.black=new et(0,0,0,1),et.white=new et(1,1,1,1),et.transparent=new et(0,0,0,0),et.red=new et(1,0,0,1),et),sd=class{constructor(i,e,t){i?this.sensitivity=e?"variant":"case":this.sensitivity=e?"accent":"base",this.locale=t,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,e){return this.collator.compare(i,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};const W6=["bottom","center","top"];var od=class{constructor(i,e,t,n,s,o){this.text=i,this.image=e,this.scale=t,this.fontStack=n,this.textColor=s,this.verticalAlign=o}},ss=class Ra{constructor(e){this.sections=e}static fromString(e){return new Ra([new od(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Ra?e:Ra.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},ri=class Go{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Go)return e;if(typeof e=="number")return new Go([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new Go(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Go(ns(e.values,t.values,n))}},ai=class Uo{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Uo)return e;if(typeof e=="number")return new Uo([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new Uo(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Uo(ns(e.values,t.values,n))}},Lt=class Vo{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Vo)return e;if(typeof e=="string"){const n=qe.parse(e);return n?new Vo([n]):void 0}if(!Array.isArray(e))return;const t=[];for(const n of e){if(typeof n!="string")return;const s=qe.parse(n);if(!s)return;t.push(s)}return new Vo(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,s="rgb"){const o=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let r=0;r<e.values.length;r++)o.push(qe.interpolate(e.values[r],t.values[r],n,s));return new Vo(o)}},Le=class extends Error{constructor(i){super(i),this.name="RuntimeError"}toJSON(){return this.message}};const q6=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var Qi=class Fa{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Fa)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const n=e[t],s=e[t+1];if(typeof n!="string"||!q6.has(n)||!Array.isArray(s)||s.length!==2||typeof s[0]!="number"||typeof s[1]!="number")return}return new Fa(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){const s=e.values,o=t.values;if(s.length!==o.length)throw new Le(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const r=[];for(let a=0;a<s.length;a+=2){if(s[a]!==o[a])throw new Le(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${s[a]}, to[${a}]: ${o[a]}`);r.push(s[a]);const[l,c]=s[a+1],[h,u]=o[a+1];r.push([Vi(l,h,n),Vi(c,u,n)])}return new Fa(r)}},zi=class xy{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new xy({name:e,available:!1}):null}},os=class ys{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new ys(e,t,n)}static parse(e){if(e instanceof ys)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new ys(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new ys(e.from,e.to,e.transition);if(typeof e=="string")return new ys(e,e,1)}};function Wg(i,e,t,n){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,t,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,t,n]:[i,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function wo(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof os||i instanceof qe||i instanceof sd||i instanceof ss||i instanceof ri||i instanceof ai||i instanceof Lt||i instanceof Qi||i instanceof zi)return!0;if(Array.isArray(i)){for(const e of i)if(!wo(e))return!1;return!0}else if(typeof i=="object"){for(const e in i)if(!wo(i[e]))return!1;return!0}else return!1}function Ke(i){if(i===null)return sa;if(typeof i=="string")return le;if(typeof i=="boolean")return ue;if(typeof i=="number")return W;if(i instanceof qe)return oi;if(i instanceof os)return oa;if(i instanceof sd)return ra;if(i instanceof ss)return aa;if(i instanceof ri)return la;if(i instanceof ai)return ca;if(i instanceof Lt)return vo;if(i instanceof Qi)return da;if(i instanceof zi)return bo;if(Array.isArray(i)){const e=i.length;let t;for(const n of i){const s=Ke(n);if(!t)t=s;else{if(t===s)continue;t=ce;break}}return yt(t||ce,e)}else return hn}function Eo(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof qe||i instanceof os||i instanceof ss||i instanceof ri||i instanceof ai||i instanceof Lt||i instanceof Qi||i instanceof zi?i.toString():JSON.stringify(i)}var ua=class Iy{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!wo(e[1]))return t.error("invalid value");const n=e[1];let s=Ke(n);const o=t.expectedType;return s.kind==="array"&&s.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(s=o),new Iy(s,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};const fa={string:le,number:W,boolean:ue,object:hn};var yi=class Sy{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=1,s;const o=e[0];if(o==="array"){let a;if(e.length>2){const c=e[1];if(typeof c!="string"||!(c in fa)||c==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=fa[c],n++}else a=ce;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],n++}s=yt(a,l)}else{if(!fa[o])throw new Error(`Types doesn't contain name = ${o}`);s=fa[o]}const r=[];for(;n<e.length;n++){const a=t.parse(e[n],n,ce);if(!a)return null;r.push(a)}return new Sy(s,r)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(Co(this.type,Ke(n))){if(t===this.args.length-1)throw new Le(`Expected value to be of type ${Pe(this.type)}, but found ${Pe(Ke(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};const qg={"to-boolean":ue,"to-color":oi,"to-number":W,"to-string":le};var rs=class My{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[0];if(!qg[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return t.error("Expected one argument.");const s=qg[n],o=[];for(let r=1;r<e.length;r++){const a=t.parse(e[r],r,ce);if(!a)return null;o.push(a)}return new My(s,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,n;for(const s of this.args){if(t=s.evaluate(e),n=null,t instanceof qe)return t;if(typeof t=="string"){const o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?n=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:n=Wg(t[0],t[1],t[2],t[3]),!n))return new qe(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Le(n||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const n of this.args){t=n.evaluate(e);const s=ri.parse(t);if(s)return s}throw new Le(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=ai.parse(t);if(s)return s}throw new Le(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=Lt.parse(t);if(s)return s}throw new Le(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const n of this.args){t=n.evaluate(e);const s=Qi.parse(t);if(s)return s}throw new Le(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const n of this.args){if(t=n.evaluate(e),t===null)return 0;const s=Number(t);if(!isNaN(s))return s}throw new Le(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return ss.fromString(Eo(this.args[0].evaluate(e)));case"resolvedImage":return zi.fromString(Eo(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Eo(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};const K6=["Unknown","Point","LineString","Polygon"];var Kg=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?K6[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(i){let e=this._parseColorCache.get(i);return e||(e=qe.parse(i),this._parseColorCache.set(i,e)),e}},Xg=class Ty{constructor(e,t,n=[],s,o=new L6,r=[]){this.registry=e,this.path=n,this.key=n.map(a=>`[${a}]`).join(""),this.scope=o,this.errors=r,this.expectedType=s,this._isConstant=t}parse(e,t,n,s,o={}){return t?this.concat(t,n,s)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(s,o,r){return r==="assert"?new yi(o,[s]):r==="coerce"?new rs(o,[s]):s}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=e[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const o=this.registry[s];if(o){let r=o.parse(e,this);if(!r)return null;if(this.expectedType){const a=this.expectedType,l=r.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")r=n(r,a,t.typeAnnotation||"assert");else if(a.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(a.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(a.kind)&&["value","number","array"].includes(l.kind)||a.kind==="colorArray"&&["value","string","array"].includes(l.kind)||a.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))r=n(r,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(r instanceof ua)&&r.type.kind!=="resolvedImage"&&this._isConstant(r)){const a=new Kg;try{r=new ua(r.type,r.evaluate(a))}catch(l){return this.error(l.message),null}}return r}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){const s=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new Ty(this.registry,this._isConstant,s,t||null,o,this.errors)}error(e,...t){const n=`${this.key}${t.map(s=>`[${s}]`).join("")}`;this.errors.push(new si(n,e))}checkSubtype(e,t){const n=Co(e,t);return n&&this.error(n),n}},Jg=class By{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let o=1;o<e.length-1;o+=2){const r=e[o];if(typeof r!="string")return t.error(`Expected string, but found ${typeof r} instead.`,o);if(/[^a-zA-Z0-9_]/.test(r))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);const a=t.parse(e[o+1],o+1);if(!a)return null;n.push([r,a])}const s=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return s?new By(n,s):null}outputDefined(){return this.result.outputDefined()}},Zg=class _y{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const n=e[1];return t.scope.has(n)?new _y(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},X6=class ky{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,W),s=t.parse(e[2],2,yt(t.expectedType||ce));if(!n||!s)return null;const o=s.type;return new ky(o.itemType,n,s)}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new Le(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new Le(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new Le(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},J6=class Py{constructor(e,t){this.type=ue,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,ce),s=t.parse(e[2],2,ce);return!n||!s?null:Zc(n.type,[ue,le,W,sa,ce])?new Py(n,s):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Pe(n.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!un(t,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Pe(Ke(t))} instead.`);if(!un(n,["string","array"]))throw new Le(`Expected second argument to be of type array or string, but found ${Pe(Ke(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Z6=class $d{constructor(e,t,n){this.type=W,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,ce),s=t.parse(e[2],2,ce);if(!n||!s)return null;if(!Zc(n.type,[ue,le,W,sa,ce]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Pe(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,W);return o?new $d(n,s,o):null}else return new $d(n,s)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!un(t,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Pe(Ke(t))} instead.`);let s;if(this.fromIndex&&(s=this.fromIndex.evaluate(e)),un(n,["string"])){const o=n.indexOf(t,s);return o===-1?-1:[...n.slice(0,o)].length}else{if(un(n,["array"]))return n.indexOf(t,s);throw new Le(`Expected second argument to be of type array or string, but found ${Pe(Ke(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},e5=class Dy{constructor(e,t,n,s,o,r){this.inputType=e,this.type=t,this.input=n,this.cases=s,this.outputs=o,this.otherwise=r}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return t.error("Expected an even number of arguments.");let n,s;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);const o={},r=[];for(let c=2;c<e.length-1;c+=2){let h=e[c];const u=e[c+1];Array.isArray(h)||(h=[h]);const p=t.concat(c);if(h.length===0)return p.error("Expected at least one branch label.");for(const m of h){if(typeof m!="number"&&typeof m!="string")return p.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return p.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof m=="number"&&Math.floor(m)!==m)return p.error("Numeric branch labels must be integer values.");if(!n)n=Ke(m);else if(p.checkSubtype(n,Ke(m)))return null;if(typeof o[String(m)]<"u")return p.error("Branch labels must be unique.");o[String(m)]=r.length}const f=t.parse(u,c,s);if(!f)return null;s=s||f.type,r.push(f)}const a=t.parse(e[1],1,ce);if(!a)return null;const l=t.parse(e[e.length-1],e.length-1,s);return!l||a.type.kind!=="value"&&t.concat(1).checkSubtype(n,a.type)?null:new Dy(n,s,a,o,r,l)}evaluate(e){const t=this.input.evaluate(e);return(Ke(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},t5=class Ny{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);const s=[];for(let r=1;r<e.length-1;r+=2){const a=t.parse(e[r],r,ue);if(!a)return null;const l=t.parse(e[r+1],r+1,n);if(!l)return null;s.push([a,l]),n=n||l.type}const o=t.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can't infer output type");return new Ny(n,s,o)}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}},i5=class jd{constructor(e,t,n,s){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=s}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,ce),s=t.parse(e[2],2,W);if(!n||!s)return null;if(!Zc(n.type,[yt(ce),le,ce]))return t.error(`Expected first argument to be of type array or string, but found ${Pe(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,W);return o?new jd(n.type,n,s,o):null}else return new jd(n.type,n,s)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);let s;if(this.endIndex&&(s=this.endIndex.evaluate(e)),un(t,["string"]))return[...t].slice(n,s).join("");if(un(t,["array"]))return t.slice(n,s);throw new Le(`Expected first argument to be of type array or string, but found ${Pe(Ke(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function pa(i,e){const t=i.length-1;let n=0,s=t,o=0,r,a;for(;n<=s;)if(o=Math.floor((n+s)/2),r=i[o],a=i[o+1],r<=e){if(o===t||e<a)return o;n=o+1}else if(r>e)s=o-1;else throw new Le("Input is not a number.");return 0}var e0=class Ly{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,o]of n)this.labels.push(s),this.outputs.push(o)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");const n=t.parse(e[1],1,W);if(!n)return null;const s=[];let o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.expectedType);for(let r=1;r<e.length;r+=2){const a=r===1?-1/0:e[r],l=e[r+1],c=r,h=r+1;if(typeof a!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(s.length&&s[s.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);const u=t.parse(l,h,o);if(!u)return null;o=o||u.type,s.push([a,u])}return new Ly(o,n,s)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;return s>=t[o-1]?n[o-1].evaluate(e):n[pa(t,s)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function n5(i,e,t,n){const s=3*i,o=3*(t-i)-s,r=1-s-o,a=3*e,l=3*(n-e)-a,c=1-a-l;return function(u,p=1e-6){if(u<=0)return 0;if(u>=1)return 1;let f=u;for(let g=0;g<8;g++){const A=((r*f+o)*f+s)*f-u;if(Math.abs(A)<p)return((c*f+l)*f+a)*f;const v=(3*r*f+2*o)*f+s;if(Math.abs(v)<1e-6)break;f-=A/v}let m=0,y=1;f=u;for(let g=0;g<20;g++){const A=((r*f+o)*f+s)*f;if(Math.abs(A-u)<p)break;u>A?m=f:y=f,f=(m+y)*.5}return((c*f+l)*f+a)*f}}var Ai=class Wd{constructor(e,t,n,s,o){this.type=e,this.operator=t,this.interpolation=n,this.input=s,this.labels=[],this.outputs=[];for(const[r,a]of o)this.labels.push(r),this.outputs.push(a)}static interpolationFactor(e,t,n,s){let o=0;if(e.name==="exponential")o=rd(t,e.base,n,s);else if(e.name==="linear")o=rd(t,1,n,s);else if(e.name==="cubic-bezier"){const r=e.controlPoints;o=n5(r[0],r[1],r[2],r[3])(rd(t,1,n,s))}return o}static parse(e,t){let[n,s,o,...r]=e;if(!Array.isArray(s)||s.length===0)return t.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const c=s[1];if(typeof c!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:c}}else if(s[0]==="cubic-bezier"){const c=s.slice(1);if(c.length!==4||c.some(h=>typeof h!="number"||h<0||h>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:c}}else return t.error(`Unknown interpolation type ${String(s[0])}`,1,0);if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,W),!o)return null;const a=[];let l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&t.expectedType!=vo?l=oi:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let c=0;c<r.length;c+=2){const h=r[c],u=r[c+1],p=c+3,f=c+4;if(typeof h!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(a.length&&a[a.length-1][0]>=h)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);const m=t.parse(u,f,l);if(!m)return null;l=l||m.type,a.push([h,m])}return!Ui(l,W)&&!Ui(l,oa)&&!Ui(l,oi)&&!Ui(l,la)&&!Ui(l,ca)&&!Ui(l,vo)&&!Ui(l,da)&&!Ui(l,yt(W))?t.error(`Type ${Pe(l)} is not interpolatable.`):new Wd(l,n,s,o,a)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;if(s>=t[o-1])return n[o-1].evaluate(e);const r=pa(t,s),a=t[r],l=t[r+1],c=Wd.interpolationFactor(this.interpolation,s,a,l),h=n[r].evaluate(e),u=n[r+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Vi(h,u,c);case"color":return qe.interpolate(h,u,c);case"padding":return ri.interpolate(h,u,c);case"colorArray":return Lt.interpolate(h,u,c);case"numberArray":return ai.interpolate(h,u,c);case"variableAnchorOffsetCollection":return Qi.interpolate(h,u,c);case"array":return ns(h,u,c);case"projectionDefinition":return os.interpolate(h,u,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return qe.interpolate(h,u,c,"hcl");case"colorArray":return Lt.interpolate(h,u,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return qe.interpolate(h,u,c,"lab");case"colorArray":return Lt.interpolate(h,u,c,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function rd(i,e,t,n){const s=n-t,o=i-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}const s5={color:qe.interpolate,number:Vi,padding:ri.interpolate,numberArray:ai.interpolate,colorArray:Lt.interpolate,variableAnchorOffsetCollection:Qi.interpolate,array:ns};var t0=class qd{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=null;const s=t.expectedType;s&&s.kind!=="value"&&(n=s);const o=[];for(const r of e.slice(1)){const a=t.parse(r,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!a)return null;n=n||a.type,o.push(a)}if(!n)throw new Error("No output type");return s&&o.some(r=>Co(s,r.type))?new qd(ce,o):new qd(n,o)}evaluate(e){let t=null,n=0,s;for(const o of this.args)if(n++,t=o.evaluate(e),t&&t instanceof zi&&!t.available&&(s||(s=t.name),t=null,n===this.args.length&&(t=s)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function i0(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function o5(i,e,t){return e===t}function r5(i,e,t){return e!==t}function a5(i,e,t){return e<t}function l5(i,e,t){return e>t}function c5(i,e,t){return e<=t}function d5(i,e,t){return e>=t}function n0(i,e,t,n){return n.compare(e,t)===0}function h5(i,e,t,n){return!n0(i,e,t,n)}function u5(i,e,t,n){return n.compare(e,t)<0}function f5(i,e,t,n){return n.compare(e,t)>0}function p5(i,e,t,n){return n.compare(e,t)<=0}function m5(i,e,t,n){return n.compare(e,t)>=0}function as(i,e,t){const n=i!=="=="&&i!=="!=";return class Ry{constructor(o,r,a){this.type=ue,this.lhs=o,this.rhs=r,this.collator=a,this.hasUntypedArgument=o.type.kind==="value"||r.type.kind==="value"}static parse(o,r){if(o.length!==3&&o.length!==4)return r.error("Expected two or three arguments.");const a=o[0];let l=r.parse(o[1],1,ce);if(!l)return null;if(!i0(a,l.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${Pe(l.type)}'.`);let c=r.parse(o[2],2,ce);if(!c)return null;if(!i0(a,c.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${Pe(c.type)}'.`);if(l.type.kind!==c.type.kind&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error(`Cannot compare types '${Pe(l.type)}' and '${Pe(c.type)}'.`);n&&(l.type.kind==="value"&&c.type.kind!=="value"?l=new yi(c.type,[l]):l.type.kind!=="value"&&c.type.kind==="value"&&(c=new yi(l.type,[c])));let h=null;if(o.length===4){if(l.type.kind!=="string"&&c.type.kind!=="string"&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error("Cannot use collator to compare non-string types.");if(h=r.parse(o[3],3,ra),!h)return null}return new Ry(l,c,h)}evaluate(o){const r=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){const l=Ke(r),c=Ke(a);if(l.kind!==c.kind||!(l.kind==="string"||l.kind==="number"))throw new Le(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${l.kind}, ${c.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const l=Ke(r),c=Ke(a);if(l.kind!=="string"||c.kind!=="string")return e(o,r,a)}return this.collator?t(o,r,a,this.collator.evaluate(o)):e(o,r,a)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}const g5=as("==",o5,n0),y5=as("!=",r5,h5),A5=as("<",a5,u5),v5=as(">",l5,f5),b5=as("<=",c5,p5),C5=as(">=",d5,m5);var s0=class Fy{constructor(e,t,n){this.type=ra,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return t.error("Collator options argument must be an object.");const s=t.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,ue);if(!s)return null;const o=t.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,ue);if(!o)return null;let r=null;return n.locale&&(r=t.parse(n.locale,1,le),!r)?null:new Fy(s,o,r)}evaluate(e){return new sd(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},w5=class Oy{constructor(e,t,n,s,o,r){this.type=le,this.number=e,this.locale=t,this.currency=n,this.unit=s,this.minFractionDigits=o,this.maxFractionDigits=r}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const n=t.parse(e[1],1,W);if(!n)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return t.error("NumberFormat options argument must be an object.");let o=null;if(s.locale&&(o=t.parse(s.locale,1,le),!o))return null;let r=null;if(s.currency&&(r=t.parse(s.currency,1,le),!r))return null;let a=null;if(s.unit&&(a=t.parse(s.unit,1,le),!a))return null;if(r&&a)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(s["min-fraction-digits"]&&(l=t.parse(s["min-fraction-digits"],1,W),!l))return null;let c=null;return s["max-fraction-digits"]&&(c=t.parse(s["max-fraction-digits"],1,W),!c)?null:new Oy(n,o,r,a,l,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},E5=class Gy{constructor(e){this.type=aa,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return t.error("First argument must be an image or text section.");const s=[];let o=!1;for(let r=1;r<=e.length-1;++r){const a=e[r];if(o&&typeof a=="object"&&!Array.isArray(a)){o=!1;let l=null;if(a["font-scale"]&&(l=t.parse(a["font-scale"],1,W),!l))return null;let c=null;if(a["text-font"]&&(c=t.parse(a["text-font"],1,yt(le)),!c))return null;let h=null;if(a["text-color"]&&(h=t.parse(a["text-color"],1,oi),!h))return null;let u=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!W6.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(u=t.parse(a["vertical-align"],1,le),!u)return null}const p=s[s.length-1];p.scale=l,p.font=c,p.textColor=h,p.verticalAlign=u}else{const l=t.parse(e[r],1,ce);if(!l)return null;const c=l.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,s.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Gy(s)}evaluate(e){const t=n=>{const s=n.content.evaluate(e);return Ke(s)===bo?new od("",s,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new od(Eo(s),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new ss(this.sections.map(t))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}},x5=class Uy{constructor(e){this.type=bo,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const n=t.parse(e[1],1,le);return n?new Uy(n):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=zi.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},I5=class Vy{constructor(e){this.type=W,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=t.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${Pe(n.type)} instead.`):new Vy(n):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new Le(`Expected value to be of type string or array, but found ${Pe(Ke(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}};const li=8192;function S5(i,e){const t=M5(i[0]),n=B5(i[1]),s=Math.pow(2,e.z);return[Math.round(t*s*li),Math.round(n*s*li)]}function ad(i,e){const t=Math.pow(2,e.z),n=(i[0]/li+e.x)/t,s=(i[1]/li+e.y)/t;return[T5(n),_5(s)]}function M5(i){return(180+i)/360}function T5(i){return i*360-180}function B5(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function _5(i){return 360/Math.PI*Math.atan(Math.exp((180-i*360)*Math.PI/180))-90}function xo(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Io(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function k5(i,e,t){return e[1]>i[1]!=t[1]>i[1]&&i[0]<(t[0]-e[0])*(i[1]-e[1])/(t[1]-e[1])+e[0]}function P5(i,e,t){const n=i[0]-e[0],s=i[1]-e[1],o=i[0]-t[0],r=i[1]-t[1];return n*r-o*s===0&&n*o<=0&&s*r<=0}function ma(i,e,t,n){const s=[e[0]-i[0],e[1]-i[1]];return R5([n[0]-t[0],n[1]-t[1]],s)===0?!1:!!(r0(i,e,t,n)&&r0(t,n,i,e))}function D5(i,e,t){for(const n of t)for(let s=0;s<n.length-1;++s)if(ma(i,e,n[s],n[s+1]))return!0;return!1}function ls(i,e,t=!1){let n=!1;for(const s of e)for(let o=0;o<s.length-1;o++){if(P5(i,s[o],s[o+1]))return t;k5(i,s[o],s[o+1])&&(n=!n)}return n}function N5(i,e){for(const t of e)if(ls(i,t))return!0;return!1}function o0(i,e){for(const t of i)if(!ls(t,e))return!1;for(let t=0;t<i.length-1;++t)if(D5(i[t],i[t+1],e))return!1;return!0}function L5(i,e){for(const t of e)if(o0(i,t))return!0;return!1}function R5(i,e){return i[0]*e[1]-i[1]*e[0]}function r0(i,e,t,n){const s=i[0]-t[0],o=i[1]-t[1],r=e[0]-t[0],a=e[1]-t[1],l=n[0]-t[0],c=n[1]-t[1],h=s*c-l*o,u=r*c-l*a;return h>0&&u<0||h<0&&u>0}function ld(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=[];for(let r=0;r<i[s].length;r++){const a=S5(i[s][r],t);xo(e,a),o.push(a)}n.push(o)}return n}function a0(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=ld(i[s],e,t);n.push(o)}return n}function l0(i,e,t,n){if(i[0]<t[0]||i[0]>t[2]){const s=n*.5;let o=i[0]-t[0]>s?-n:t[0]-i[0]>s?n:0;o===0&&(o=i[0]-t[2]>s?-n:t[2]-i[0]>s?n:0),i[0]+=o}xo(e,i)}function F5(i){i[0]=i[1]=1/0,i[2]=i[3]=-1/0}function c0(i,e,t,n){const s=Math.pow(2,n.z)*li,o=[n.x*li,n.y*li],r=[];for(const a of i)for(const l of a){const c=[l.x+o[0],l.y+o[1]];l0(c,e,t,s),r.push(c)}return r}function d0(i,e,t,n){const s=Math.pow(2,n.z)*li,o=[n.x*li,n.y*li],r=[];for(const a of i){const l=[];for(const c of a){const h=[c.x+o[0],c.y+o[1]];xo(e,h),l.push(h)}r.push(l)}if(e[2]-e[0]<=s/2){F5(e);for(const a of r)for(const l of a)l0(l,e,t,s)}return r}function O5(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=ld(e.coordinates,n,s),r=c0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!ls(a,o))return!1}if(e.type==="MultiPolygon"){const o=a0(e.coordinates,n,s),r=c0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!N5(a,o))return!1}return!0}function G5(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=ld(e.coordinates,n,s),r=d0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!o0(a,o))return!1}if(e.type==="MultiPolygon"){const o=a0(e.coordinates,n,s),r=d0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!L5(a,o))return!1}return!0}var cd=class Oa{constructor(e,t){this.type=ue,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(wo(e[1])){const n=e[1];if(n.type==="FeatureCollection"){const s=[];for(const o of n.features){const{type:r,coordinates:a}=o.geometry;r==="Polygon"&&s.push(a),r==="MultiPolygon"&&s.push(...a)}if(s.length)return new Oa(n,{type:"MultiPolygon",coordinates:s})}else if(n.type==="Feature"){const s=n.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new Oa(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Oa(n,n)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return O5(e,this.geometries);if(e.geometryType()==="LineString")return G5(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},h0=class{constructor(i=[],e=(t,n)=>t<n?-1:t>n?1:0){if(this.data=i,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;const i=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:e,compare:t}=this,n=e[i];for(;i>0;){const s=i-1>>1,o=e[s];if(t(n,o)>=0)break;e[i]=o,i=s}e[i]=n}_down(i){const{data:e,compare:t}=this,n=this.length>>1,s=e[i];for(;i<n;){let o=(i<<1)+1;const r=o+1;if(r<this.length&&t(e[r],e[o])<0&&(o=r),t(e[o],s)>=0)break;e[i]=e[o],i=o}e[i]=s}};function U5(i,e){if(i.length<=1)return[i];const t=[];let n,s;for(const o of i){const r=V5(o);r!==0&&(o.area=Math.abs(r),s===void 0&&(s=r<0),s===r<0?(n&&t.push(n),n=[o]):n.push(o))}return n&&t.push(n),t}function V5(i){let e=0;for(let t=0,n=i.length,s=n-1,o,r;t<n;s=t++)o=i[t],r=i[s],e+=(r.x-o.x)*(o.y+r.y);return e}const Q5=6378.137,u0=1/298.257223563,f0=u0*(2-u0),p0=Math.PI/180;var dd=class{constructor(i){const e=p0*Q5*1e3,t=Math.cos(i*p0),n=1/(1-f0*(1-t*t)),s=Math.sqrt(n);this.kx=e*s*t,this.ky=e*s*n*(1-f0)}distance(i,e){const t=this.wrap(i[0]-e[0])*this.kx,n=(i[1]-e[1])*this.ky;return Math.sqrt(t*t+n*n)}pointOnLine(i,e){let t=1/0,n,s,o,r;for(let a=0;a<i.length-1;a++){let l=i[a][0],c=i[a][1],h=this.wrap(i[a+1][0]-l)*this.kx,u=(i[a+1][1]-c)*this.ky,p=0;(h!==0||u!==0)&&(p=(this.wrap(e[0]-l)*this.kx*h+(e[1]-c)*this.ky*u)/(h*h+u*u),p>1?(l=i[a+1][0],c=i[a+1][1]):p>0&&(l+=h/this.kx*p,c+=u/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,u=(e[1]-c)*this.ky;const f=h*h+u*u;f<t&&(t=f,n=l,s=c,o=a,r=p)}return{point:[n,s],index:o,t:Math.max(0,Math.min(1,r))}}wrap(i){for(;i<-180;)i+=360;for(;i>180;)i-=360;return i}};const hd=100,ud=50;function m0(i,e){return e[0]-i[0]}function ga(i){return i[1]-i[0]+1}function vi(i,e){return i[1]>=i[0]&&i[1]<e}function fd(i,e){if(i[0]>i[1])return[null,null];const t=ga(i);if(e){if(t===2)return[i,null];const s=Math.floor(t/2);return[[i[0],i[0]+s],[i[0]+s,i[1]]]}if(t===1)return[i,null];const n=Math.floor(t/2)-1;return[[i[0],i[0]+n],[i[0]+n+1,i[1]]]}function pd(i,e){if(!vi(e,i.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)xo(t,i[n]);return t}function md(i){const e=[1/0,1/0,-1/0,-1/0];for(const t of i)for(const n of t)xo(e,n);return e}function g0(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function gd(i,e,t){if(!g0(i)||!g0(e))return NaN;let n=0,s=0;return i[2]<e[0]&&(n=e[0]-i[2]),i[0]>e[2]&&(n=i[0]-e[2]),i[1]>e[3]&&(s=i[1]-e[3]),i[3]<e[1]&&(s=e[1]-i[3]),t.distance([0,0],[n,s])}function fn(i,e,t){const n=t.pointOnLine(e,i);return t.distance(i,n.point)}function yd(i,e,t,n,s){const o=Math.min(fn(i,[t,n],s),fn(e,[t,n],s)),r=Math.min(fn(t,[i,e],s),fn(n,[i,e],s));return Math.min(o,r)}function z5(i,e,t,n,s){if(!(vi(e,i.length)&&vi(n,t.length)))return 1/0;let o=1/0;for(let r=e[0];r<e[1];++r){const a=i[r],l=i[r+1];for(let c=n[0];c<n[1];++c){const h=t[c],u=t[c+1];if(ma(a,l,h,u))return 0;o=Math.min(o,yd(a,l,h,u,s))}}return o}function H5(i,e,t,n,s){if(!(vi(e,i.length)&&vi(n,t.length)))return NaN;let o=1/0;for(let r=e[0];r<=e[1];++r)for(let a=n[0];a<=n[1];++a)if(o=Math.min(o,s.distance(i[r],t[a])),o===0)return o;return o}function Y5(i,e,t){if(ls(i,e,!0))return 0;let n=1/0;for(const s of e){const o=s[0],r=s[s.length-1];if(o!==r&&(n=Math.min(n,fn(i,[r,o],t)),n===0))return n;const a=t.pointOnLine(s,i);if(n=Math.min(n,t.distance(i,a.point)),n===0)return n}return n}function $5(i,e,t,n){if(!vi(e,i.length))return NaN;for(let o=e[0];o<=e[1];++o)if(ls(i[o],t,!0))return 0;let s=1/0;for(let o=e[0];o<e[1];++o){const r=i[o],a=i[o+1];for(const l of t)for(let c=0,h=l.length,u=h-1;c<h;u=c++){const p=l[u],f=l[c];if(ma(r,a,p,f))return 0;s=Math.min(s,yd(r,a,p,f,n))}}return s}function y0(i,e){for(const t of i)for(const n of t)if(ls(n,e,!0))return!0;return!1}function j5(i,e,t,n=1/0){const s=md(i),o=md(e);if(n!==1/0&&gd(s,o,t)>=n)return n;if(Io(s,o)){if(y0(i,e))return 0}else if(y0(e,i))return 0;let r=1/0;for(const a of i)for(let l=0,c=a.length,h=c-1;l<c;h=l++){const u=a[h],p=a[l];for(const f of e)for(let m=0,y=f.length,g=y-1;m<y;g=m++){const A=f[g],v=f[m];if(ma(u,p,A,v))return 0;r=Math.min(r,yd(u,p,A,v,t))}}return r}function A0(i,e,t,n,s,o){if(!o)return;const r=gd(pd(n,o),s,t);r<e&&i.push([r,o,[0,0]])}function ya(i,e,t,n,s,o,r){if(!o||!r)return;const a=gd(pd(n,o),pd(s,r),t);a<e&&i.push([a,o,r])}function Aa(i,e,t,n,s=1/0){let o=Math.min(n.distance(i[0],t[0][0]),s);if(o===0)return o;const r=new h0([[0,[0,i.length-1],[0,0]]],m0),a=md(t);for(;r.length>0;){const l=r.pop();if(l[0]>=o)continue;const c=l[1],h=e?ud:hd;if(ga(c)<=h){if(!vi(c,i.length))return NaN;if(e){const u=$5(i,c,t,n);if(isNaN(u)||u===0)return u;o=Math.min(o,u)}else for(let u=c[0];u<=c[1];++u){const p=Y5(i[u],t,n);if(o=Math.min(o,p),o===0)return 0}}else{const u=fd(c,e);A0(r,o,n,i,a,u[0]),A0(r,o,n,i,a,u[1])}}return o}function va(i,e,t,n,s,o=1/0){let r=Math.min(o,s.distance(i[0],t[0]));if(r===0)return r;const a=new h0([[0,[0,i.length-1],[0,t.length-1]]],m0);for(;a.length>0;){const l=a.pop();if(l[0]>=r)continue;const c=l[1],h=l[2],u=e?ud:hd,p=n?ud:hd;if(ga(c)<=u&&ga(h)<=p){if(!vi(c,i.length)&&vi(h,t.length))return NaN;let f;if(e&&n)f=z5(i,c,t,h,s),r=Math.min(r,f);else if(e&&!n){const m=i.slice(c[0],c[1]+1);for(let y=h[0];y<=h[1];++y)if(f=fn(t[y],m,s),r=Math.min(r,f),r===0)return r}else if(!e&&n){const m=t.slice(h[0],h[1]+1);for(let y=c[0];y<=c[1];++y)if(f=fn(i[y],m,s),r=Math.min(r,f),r===0)return r}else f=H5(i,c,t,h,s),r=Math.min(r,f)}else{const f=fd(c,e),m=fd(h,n);ya(a,r,s,i,t,f[0],m[0]),ya(a,r,s,i,t,f[0],m[1]),ya(a,r,s,i,t,f[1],m[0]),ya(a,r,s,i,t,f[1],m[1])}}return r}function W5(i,e){const t=i.geometry(),n=t.flat().map(r=>ad([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new dd(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,va(n,!1,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,va(n,!1,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,Aa(n,!1,r.coordinates,s,o));break}if(o===0)return o}return o}function q5(i,e){const t=i.geometry(),n=t.flat().map(r=>ad([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new dd(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,va(n,!0,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,va(n,!0,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,Aa(n,!0,r.coordinates,s,o));break}if(o===0)return o}return o}function K5(i,e){const t=i.geometry();if(t.length===0||t[0].length===0)return NaN;const n=U5(t).map(r=>r.map(a=>a.map(l=>ad([l.x,l.y],i.canonical)))),s=new dd(n[0][0][0][1]);let o=1/0;for(const r of e)for(const a of n){switch(r.type){case"Point":o=Math.min(o,Aa([r.coordinates],!1,a,s,o));break;case"LineString":o=Math.min(o,Aa(r.coordinates,!0,a,s,o));break;case"Polygon":o=Math.min(o,j5(a,r.coordinates,s,o));break}if(o===0)return o}return o}function Ad(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}var vd=class Ga{constructor(e,t){this.type=W,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(wo(e[1])){const n=e[1];if(n.type==="FeatureCollection")return new Ga(n,n.features.map(s=>Ad(s.geometry)).flat());if(n.type==="Feature")return new Ga(n,Ad(n.geometry));if("type"in n&&"coordinates"in n)return new Ga(n,Ad(n))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return W5(e,this.geometries);if(e.geometryType()==="LineString")return q5(e,this.geometries);if(e.geometryType()==="Polygon")return K5(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},bd=class Qy{constructor(e){this.type=ce,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=e[1];return n==null?t.error("Global state property must be defined."):typeof n!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new Qy(n)}evaluate(e){const t=e.globals?.globalState;return!t||Object.keys(t).length===0?null:Yg(t,this.key)??null}eachChild(){}outputDefined(){return!1}};const cs={"==":g5,"!=":y5,">":v5,"<":A5,">=":C5,"<=":b5,array:yi,at:X6,boolean:yi,case:t5,coalesce:t0,collator:s0,format:E5,image:x5,in:J6,"index-of":Z6,interpolate:Ai,"interpolate-hcl":Ai,"interpolate-lab":Ai,length:I5,let:Jg,literal:ua,match:e5,number:yi,"number-format":w5,object:yi,slice:i5,step:e0,string:yi,"to-boolean":rs,"to-color":rs,"to-number":rs,"to-string":rs,var:Zg,within:cd,distance:vd,"global-state":bd};var pn=class Qo{constructor(e,t,n,s){this.name=e,this.type=t,this._evaluate=n,this.args=s}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const n=e[0],s=Qo.definitions[n];if(!s)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(s)?s[0]:s.type,r=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,a=r.filter(([c])=>!Array.isArray(c)||c.length===e.length-1);let l=null;for(const[c,h]of a){l=new Xg(t.registry,ba,t.path,null,t.scope);const u=[];let p=!1;for(let f=1;f<e.length;f++){const m=e[f],y=Array.isArray(c)?c[f-1]:c.type,g=l.parse(m,1+u.length,y);if(!g){p=!0;break}u.push(g)}if(!p){if(Array.isArray(c)&&c.length!==u.length){l.error(`Expected ${c.length} arguments, but found ${u.length} instead.`);continue}for(let f=0;f<u.length;f++){const m=Array.isArray(c)?c[f]:c.type,y=u[f];l.concat(f+1).checkSubtype(m,y.type)}if(l.errors.length===0)return new Qo(n,o,h,u)}}if(a.length===1)t.errors.push(...l.errors);else{const c=(a.length?a:r).map(([u])=>J5(u)).join(" | "),h=[];for(let u=1;u<e.length;u++){const p=t.parse(e[u],1+h.length);if(!p)return null;h.push(Pe(p.type))}t.error(`Expected arguments of type ${c}, but found (${h.join(", ")}) instead.`)}return null}static register(e,t){Qo.definitions=t;for(const n in t)e[n]=Qo}};function v0(i,[e,t,n,s]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const o=s?s.evaluate(i):1,r=Wg(e,t,n,o);if(r)throw new Le(r);return new qe(e/255,t/255,n/255,o,!1)}function b0(i,e){return i in e}function Cd(i,e){const t=e[i];return typeof t>"u"?null:t}function X5(i,e,t,n){for(;t<=n;){const s=t+n>>1;if(e[s]===i)return!0;e[s]>i?n=s-1:t=s+1}return!1}function mn(i){return{type:i}}pn.register(cs,{error:[R6,[le],(i,[e])=>{throw new Le(e.evaluate(i))}],typeof:[le,[ce],(i,[e])=>Pe(Ke(e.evaluate(i)))],"to-rgba":[yt(W,4),[oi],(i,[e])=>{const[t,n,s,o]=e.evaluate(i).rgb;return[t*255,n*255,s*255,o]}],rgb:[oi,[W,W,W],v0],rgba:[oi,[W,W,W,W],v0],has:{type:ue,overloads:[[[le],(i,[e])=>b0(e.evaluate(i),i.properties())],[[le,hn],(i,[e,t])=>b0(e.evaluate(i),t.evaluate(i))]]},get:{type:ce,overloads:[[[le],(i,[e])=>Cd(e.evaluate(i),i.properties())],[[le,hn],(i,[e,t])=>Cd(e.evaluate(i),t.evaluate(i))]]},"feature-state":[ce,[le],(i,[e])=>Cd(e.evaluate(i),i.featureState||{})],properties:[hn,[],i=>i.properties()],"geometry-type":[le,[],i=>i.geometryType()],id:[ce,[],i=>i.id()],zoom:[W,[],i=>i.globals.zoom],"heatmap-density":[W,[],i=>i.globals.heatmapDensity||0],elevation:[W,[],i=>i.globals.elevation||0],"line-progress":[W,[],i=>i.globals.lineProgress||0],accumulated:[ce,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[W,mn(W),(i,e)=>{let t=0;for(const n of e)t+=n.evaluate(i);return t}],"*":[W,mn(W),(i,e)=>{let t=1;for(const n of e)t*=n.evaluate(i);return t}],"-":{type:W,overloads:[[[W,W],(i,[e,t])=>e.evaluate(i)-t.evaluate(i)],[[W],(i,[e])=>-e.evaluate(i)]]},"/":[W,[W,W],(i,[e,t])=>e.evaluate(i)/t.evaluate(i)],"%":[W,[W,W],(i,[e,t])=>e.evaluate(i)%t.evaluate(i)],ln2:[W,[],()=>Math.LN2],pi:[W,[],()=>Math.PI],e:[W,[],()=>Math.E],"^":[W,[W,W],(i,[e,t])=>Math.pow(e.evaluate(i),t.evaluate(i))],sqrt:[W,[W],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[W,[W],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[W,[W],(i,[e])=>Math.log(e.evaluate(i))],log2:[W,[W],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[W,[W],(i,[e])=>Math.sin(e.evaluate(i))],cos:[W,[W],(i,[e])=>Math.cos(e.evaluate(i))],tan:[W,[W],(i,[e])=>Math.tan(e.evaluate(i))],asin:[W,[W],(i,[e])=>Math.asin(e.evaluate(i))],acos:[W,[W],(i,[e])=>Math.acos(e.evaluate(i))],atan:[W,[W],(i,[e])=>Math.atan(e.evaluate(i))],min:[W,mn(W),(i,e)=>Math.min(...e.map(t=>t.evaluate(i)))],max:[W,mn(W),(i,e)=>Math.max(...e.map(t=>t.evaluate(i)))],abs:[W,[W],(i,[e])=>Math.abs(e.evaluate(i))],round:[W,[W],(i,[e])=>{const t=e.evaluate(i);return t<0?-Math.round(-t):Math.round(t)}],floor:[W,[W],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[W,[W],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[ue,[le,ce],(i,[e,t])=>i.properties()[e.value]===t.value],"filter-id-==":[ue,[ce],(i,[e])=>i.id()===e.value],"filter-type-==":[ue,[le],(i,[e])=>i.geometryType()===e.value],"filter-<":[ue,[le,ce],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<s}],"filter-id-<":[ue,[ce],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<n}],"filter->":[ue,[le,ce],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>s}],"filter-id->":[ue,[ce],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>n}],"filter-<=":[ue,[le,ce],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[ue,[ce],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<=n}],"filter->=":[ue,[le,ce],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[ue,[ce],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>=n}],"filter-has":[ue,[ce],(i,[e])=>e.value in i.properties()],"filter-has-id":[ue,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[ue,[yt(le)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[ue,[yt(ce)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[ue,[le,yt(ce)],(i,[e,t])=>t.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[ue,[le,yt(ce)],(i,[e,t])=>X5(i.properties()[e.value],t.value,0,t.value.length-1)],all:{type:ue,overloads:[[[ue,ue],(i,[e,t])=>e.evaluate(i)&&t.evaluate(i)],[mn(ue),(i,e)=>{for(const t of e)if(!t.evaluate(i))return!1;return!0}]]},any:{type:ue,overloads:[[[ue,ue],(i,[e,t])=>e.evaluate(i)||t.evaluate(i)],[mn(ue),(i,e)=>{for(const t of e)if(t.evaluate(i))return!0;return!1}]]},"!":[ue,[ue],(i,[e])=>!e.evaluate(i)],"is-supported-script":[ue,[le],(i,[e])=>{const t=i.globals&&i.globals.isSupportedScript;return t?t(e.evaluate(i)):!0}],upcase:[le,[le],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[le,[le],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[le,mn(ce),(i,e)=>e.map(t=>Eo(t.evaluate(i))).join("")],split:[yt(le),[le,le],(i,[e,t])=>e.evaluate(i).split(t.evaluate(i))],join:[le,[yt(le),le],(i,[e,t])=>e.evaluate(i).join(t.evaluate(i))],"resolved-locale":[le,[ra],(i,[e])=>e.evaluate(i).resolvedLocale()]});function J5(i){return Array.isArray(i)?`(${i.map(Pe).join(", ")})`:`(${Pe(i.type)}...)`}function ba(i){if(i instanceof Zg)return ba(i.boundExpression);if(i instanceof pn&&i.name==="error")return!1;if(i instanceof s0)return!1;if(i instanceof cd)return!1;if(i instanceof vd)return!1;if(i instanceof bd)return!1;const e=i instanceof rs||i instanceof yi;let t=!0;return i.eachChild(n=>{e?t=t&&ba(n):t=t&&n instanceof ua}),t?wd(i)&&xd(i,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function wd(i){if(i instanceof pn){if(i.name==="get"&&i.args.length===1)return!1;if(i.name==="feature-state")return!1;if(i.name==="has"&&i.args.length===1)return!1;if(i.name==="properties"||i.name==="geometry-type"||i.name==="id")return!1;if(/^filter-/.test(i.name))return!1}if(i instanceof cd||i instanceof vd)return!1;let e=!0;return i.eachChild(t=>{e&&!wd(t)&&(e=!1)}),e}function Ed(i){if(i instanceof pn&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(t=>{e&&!Ed(t)&&(e=!1)}),e}function xd(i,e){if(i instanceof pn&&e.indexOf(i.name)>=0)return!1;let t=!0;return i.eachChild(n=>{t&&!xd(n,e)&&(t=!1)}),t}function Id(i){return{result:"success",value:i}}function ds(i){return{result:"error",value:i}}function Z5(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function eG(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function C0(i){return!!i.expression&&i.expression.interpolated}function Sd(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function w0(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&Ke(i)===hn}function tG(i){return i}function iG(i){switch(i.type){case"color":return qe.parse;case"padding":return ri.parse;case"numberArray":return ai.parse;case"colorArray":return Lt.parse;default:return null}}function nG(i){switch(i){case"exponential":return x0;case"interval":return oG;case"categorical":return sG;case"identity":return rG;default:throw new Error(`Unknown function type "${i}"`)}}function E0(i,e){const t=i.stops&&typeof i.stops[0][0]=="object",n=t||i.property!==void 0,s=t||!n,o=i.type||(C0(e)?"exponential":"interval"),r=iG(e);if(r&&(i=Rg({},i),i.stops&&(i.stops=i.stops.map(h=>[h[0],r(h[1])])),i.default?i.default=r(i.default):i.default=r(e.default)),i.colorSpace&&!j6(i.colorSpace))throw new Error(`Unknown color space: "${i.colorSpace}"`);const a=nG(o);let l,c;if(o==="categorical"){l=Object.create(null);for(const h of i.stops)l[h[0]]=h[1];c=typeof i.stops[0][0]}if(t){const h={},u=[];for(let m=0;m<i.stops.length;m++){const y=i.stops[m],g=y[0].zoom;h[g]===void 0&&(h[g]={zoom:g,type:i.type,property:i.property,default:i.default,stops:[]},u.push(g)),h[g].stops.push([y[0].value,y[1]])}const p=[];for(const m of u)p.push([h[m].zoom,E0(h[m],e)]);const f={name:"linear"};return{kind:"composite",interpolationType:f,interpolationFactor:Ai.interpolationFactor.bind(void 0,f),zoomStops:p.map(m=>m[0]),evaluate({zoom:m},y){return x0({stops:p,base:i.base},e,m).evaluate(m,y)}}}else if(s){const h=o==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:h,interpolationFactor:Ai.interpolationFactor.bind(void 0,h),zoomStops:i.stops.map(u=>u[0]),evaluate:({zoom:u})=>a(i,e,u,l,c)}}else return{kind:"source",evaluate(h,u){const p=u&&u.properties?u.properties[i.property]:void 0;return p===void 0?So(i.default,e.default):a(i,e,p,l,c)}}}function So(i,e,t){if(i!==void 0)return i;if(e!==void 0)return e;if(t!==void 0)return t}function sG(i,e,t,n,s){return So(typeof t===s?n[t]:void 0,i.default,e.default)}function oG(i,e,t){if(Sd(t)!=="number")return So(i.default,e.default);const n=i.stops.length;if(n===1||t<=i.stops[0][0])return i.stops[0][1];if(t>=i.stops[n-1][0])return i.stops[n-1][1];const s=pa(i.stops.map(o=>o[0]),t);return i.stops[s][1]}function x0(i,e,t){const n=i.base!==void 0?i.base:1;if(Sd(t)!=="number")return So(i.default,e.default);const s=i.stops.length;if(s===1||t<=i.stops[0][0])return i.stops[0][1];if(t>=i.stops[s-1][0])return i.stops[s-1][1];const o=pa(i.stops.map(h=>h[0]),t),r=aG(t,n,i.stops[o][0],i.stops[o+1][0]),a=i.stops[o][1],l=i.stops[o+1][1],c=s5[e.type]||tG;return typeof a.evaluate=="function"?{evaluate(...h){const u=a.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(!(u===void 0||p===void 0))return c(u,p,r,i.colorSpace)}}:c(a,l,r,i.colorSpace)}function rG(i,e,t){switch(e.type){case"color":t=qe.parse(t);break;case"formatted":t=ss.fromString(t.toString());break;case"resolvedImage":t=zi.fromString(t.toString());break;case"padding":t=ri.parse(t);break;case"colorArray":t=Lt.parse(t);break;case"numberArray":t=ai.parse(t);break;default:Sd(t)!==e.type&&(e.type!=="enum"||!e.values[t])&&(t=void 0)}return So(t,i.default,e.default)}function aG(i,e,t,n){const s=n-t,o=i-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}var Md=class{constructor(i,e,t){this.expression=i,this._warningHistory={},this._evaluator=new Kg,this._defaultValue=e?hG(e):null,this._enumValues=e&&e.type==="enum"?e.values:null,this._globalState=t}evaluateWithoutErrorHandling(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._evaluator.globals=i,this._evaluator.feature=e,this._evaluator.featureState=t,this._evaluator.canonical=n,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(i,e,t,n,s,o){this._globalState&&(i=hs(i,this._globalState)),this._evaluator.globals=i,this._evaluator.feature=e||null,this._evaluator.featureState=t||null,this._evaluator.canonical=n,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o||null;try{const r=this.expression.evaluate(this._evaluator);if(r==null||typeof r=="number"&&r!==r)return this._defaultValue;if(this._enumValues&&!(r in this._enumValues))throw new Le(`Expected value to be one of ${Object.keys(this._enumValues).map(a=>JSON.stringify(a)).join(", ")}, but found ${JSON.stringify(r)} instead.`);return r}catch(r){return this._warningHistory[r.message]||(this._warningHistory[r.message]=!0,typeof console<"u"&&console.warn(r.message)),this._defaultValue}}};function I0(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in cs}function Td(i,e,t){const n=new Xg(cs,ba,[],e?dG(e):void 0),s=n.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Id(new Md(s,e,t)):ds(n.errors)}var Ca=class{constructor(i,e,t){this.kind=i,this._styleExpression=e,this.isStateDependent=i!=="constant"&&!Ed(e.expression),this.globalStateRefs=xa(e.expression),this._globalState=t}evaluateWithoutErrorHandling(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(i,e,t,n,s,o)}evaluate(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluate(i,e,t,n,s,o)}},wa=class{constructor(i,e,t,n,s){this.kind=i,this.zoomStops=t,this._styleExpression=e,this.isStateDependent=i!=="camera"&&!Ed(e.expression),this.globalStateRefs=xa(e.expression),this.interpolationType=n,this._globalState=s}evaluateWithoutErrorHandling(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(i,e,t,n,s,o)}evaluate(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluate(i,e,t,n,s,o)}interpolationFactor(i,e,t){return this.interpolationType?Ai.interpolationFactor(this.interpolationType,i,e,t):0}};function lG(i){return i._styleExpression!==void 0}function S0(i,e,t){const n=Td(i,e,t);if(n.result==="error")return n;const s=n.value.expression,o=wd(s);if(!o&&!Z5(e))return ds([new si("","data expressions not supported")]);const r=xd(s,["zoom"]);if(!r&&!eG(e))return ds([new si("","zoom expressions not supported")]);const a=Ea(s);if(!a&&!r)return ds([new si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof si)return ds([a]);if(a instanceof Ai&&!C0(e))return ds([new si("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Id(o?new Ca("constant",n.value,t):new Ca("source",n.value,t));const l=a instanceof Ai?a.interpolation:void 0;return Id(o?new wa("camera",n.value,a.labels,l,t):new wa("composite",n.value,a.labels,l,t))}var Bd=class zy{constructor(e,t){this._parameters=e,this._specification=t,Rg(this,E0(this._parameters,this._specification))}static deserialize(e){return new zy(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function cG(i,e,t){if(w0(i))return new Bd(i,e);if(I0(i)){const n=S0(i,e,t);if(n.result==="error")throw new Error(n.value.map(s=>`${s.key}: ${s.message}`).join(", "));return n.value}else{let n=i;return e.type==="color"&&typeof i=="string"?n=qe.parse(i):e.type==="padding"&&(typeof i=="number"||Array.isArray(i))?n=ri.parse(i):e.type==="numberArray"&&(typeof i=="number"||Array.isArray(i))?n=ai.parse(i):e.type==="colorArray"&&(typeof i=="string"||Array.isArray(i))?n=Lt.parse(i):e.type==="variableAnchorOffsetCollection"&&Array.isArray(i)?n=Qi.parse(i):e.type==="projectionDefinition"&&typeof i=="string"&&(n=os.parse(i)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>n}}}function Ea(i){let e=null;if(i instanceof Jg)e=Ea(i.result);else if(i instanceof t0){for(const t of i.args)if(e=Ea(t),e)break}else(i instanceof e0||i instanceof Ai)&&i.input instanceof pn&&i.input.name==="zoom"&&(e=i);return e instanceof si||i.eachChild(t=>{const n=Ea(t);n instanceof si?e=n:!e&&n?e=new si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new si("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function xa(i,e=new Set){return i instanceof bd&&e.add(i.key),i.eachChild(t=>{xa(t,e)}),e}function dG(i){const e={color:oi,string:le,number:W,enum:le,boolean:ue,formatted:aa,padding:la,numberArray:ca,colorArray:vo,projectionDefinition:oa,resolvedImage:bo,variableAnchorOffsetCollection:da};return i.type==="array"?yt(e[i.value]||ce,i.length):e[i.type]}function hG(i){if(i.type==="color"&&w0(i.default))return new qe(0,0,0,0);switch(i.type){case"color":return qe.parse(i.default)||null;case"padding":return ri.parse(i.default)||null;case"numberArray":return ai.parse(i.default)||null;case"colorArray":return Lt.parse(i.default)||null;case"variableAnchorOffsetCollection":return Qi.parse(i.default)||null;case"projectionDefinition":return os.parse(i.default)||null;default:return i.default===void 0?null:i.default}}function hs(i,e){const{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a}=i??{};return{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a,globalState:e}}function _d(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!_d(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const uG={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function M0(i,e){if(i==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};_d(i)||(i=Ia(i));const t=Td(i,uG,e);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,s,o)=>t.value.evaluate(n,s,{},o),needGeometry:T0(i),getGlobalStateRefs:()=>xa(t.value.expression)}}function fG(i,e){return i<e?-1:i>e?1:0}function T0(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(T0(i[e]))return!0;return!1}function Ia(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?kd(i[1],i[2],"=="):e==="!="?Sa(kd(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?kd(i[1],i[2],e):e==="any"?pG(i.slice(1)):e==="all"?["all"].concat(i.slice(1).map(Ia)):e==="none"?["all"].concat(i.slice(1).map(Ia).map(Sa)):e==="in"?B0(i[1],i.slice(2)):e==="!in"?Sa(B0(i[1],i.slice(2))):e==="has"?_0(i[1]):e==="!has"?Sa(_0(i[1])):!0}function kd(i,e,t){switch(i){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,i,e]}}function pG(i){return["any"].concat(i.map(Ia))}function B0(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",i,["literal",e.sort(fG)]]:["filter-in-small",i,["literal",e]]}}function _0(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Sa(i){return["!",i]}const k0={StyleExpression:Md,StylePropertyFunction:Bd,ZoomConstantExpression:Ca,ZoomDependentExpression:wa,createExpression:Td,createPropertyExpression:S0,isExpression:I0,isExpressionFilter:_d,isZoomExpression:lG,normalizePropertyExpression:cG};var Pd,P0;function mG(){if(P0)return Pd;P0=1,Pd=i;function i(e,t,n,s){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=s}return i.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,s=0;s<8;s++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<t)return n;var r=this.sampleCurveDerivativeX(n);if(Math.abs(r)<1e-6)break;n=n-o/r}var a=0,l=1;for(n=e,s=0;s<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<t));s++)e>o?a=n:l=n,n=(l-a)*.5+a;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Pd}var gG=mG();const yG=nn(gG);function AG(i,e,t,n){const s=new yG(i,e,t,n);return o=>s.solve(o)}AG(.25,.1,.25,1);function D0(i,e,t){return Math.min(t,Math.max(e,i))}const N0={};function Qe(i){N0[i]||(typeof console<"u"&&console.warn(i),N0[i]=!0)}class Dd{constructor(e,t={}){this.data=t,this.props=new Map,this.groupName=e;const n=Lg[e];for(const s in n)if(Object.hasOwnProperty.call(n,s)){const o=n[s],r=t[s],a=k0.normalizePropertyExpression(r===void 0?o.default:r,o);this.props.set(s,a)}}setProperty(e,t){const n=Lg[this.groupName];if(Object.hasOwnProperty.call(n,e)){const s=n[e];if(this.data[e]===t)return!1;const r=k0.normalizePropertyExpression(Cesium.defined(t)?t:s.default,s);return this.props.set(e,r),!0}else return Qe(`maplibre样式规范不支持属性:${this.groupName}.${e}`),!1}resolveTokens(e,t){return t.replace(/{([^{}]+)}/g,(n,s)=>e&&s in e?String(e[s]):"")}getDataConstValue(e,t){const n=this.props.get(e);return n&&n.evaluate({zoom:t})}getDataValue(e,t,n){const s=this.props.get(e);return s&&s.evaluate({zoom:t},n)}}class L0{constructor(e){this.data=e,this.type=e.type,this.id=e.id,this.minzoom=e.minzoom||0,this.maxzoom=e.maxzoom||24,this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=null,this.paint=new Dd("paint_"+e.type,e.paint),this.layout=new Dd("layout_"+e.type,e.layout),e.filter&&(this.filter=M0(e.filter)),this.paintVersion=0}setLayoutProperty(e,t){return this.layout.setProperty(e,t)}setPaintProperty(e,t){const n=this.paint.setProperty(e,t);return n&&this.paintVersion++,n}setFilter(e){if(e){if(JSON.stringify(this.data.filter)!==JSON.stringify(e))return this.data.filter=e,this.filter=M0(e),!0}else{const t=Cesium.defined(this.filter);return this.filter=null,delete this.data.filter,t}return!1}convertColor(e,t){if(!e)return;const n=e.a>0?1/e.a:1;return t||(t=new Cesium.Color),t.red=e.r*n,t.green=e.g*n,t.blue=e.b*n,t.alpha=e.a,t}}class R0{constructor(e){this.styleLayers=e,this.renderLayers=[],this.layerIndexMap={},this.list=[],this.tileIdCommands=[],this.tileCommands=[],this.visualizers=[]}init(){const{styleLayers:e,renderLayers:t,layerIndexMap:n}=this;for(let s=0;s<e.length;s++){const o=e[s];t[s]=[],n[o.id]=s}this.tileIdCommands.length=0,this.tileCommands.length=0,this.visualizers.length=0}beginFrame(){const e=this.renderLayers;for(const t of e)t.length=0;this.tileIdCommands.length=0,this.tileCommands.length=0,this.visualizers.length=0}push(e){const t=this.layerIndexMap[e.id];this.renderLayers[t].push(e)}getList(){const e=this.list;e.length=0;const t=this.renderLayers;for(const n of t)n&&e.push(...n);return e}destroy(){this.styleLayers.length=0,this.renderLayers.length=0,this.layerIndexMap=null,this.init()}}var Nd,F0;function vG(){if(F0)return Nd;F0=1,Nd=i;function i(e,t){this.x=e,this.y=t}return i.prototype={clone:function(){return new i(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),s=t*this.x-n*this.y,o=n*this.x+t*this.y;return this.x=s,this.y=o,this},_rotateAround:function(e,t){var n=Math.cos(e),s=Math.sin(e),o=t.x+n*(this.x-t.x)-s*(this.y-t.y),r=t.y+s*(this.x-t.x)+n*(this.y-t.y);return this.x=o,this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(e){return e instanceof i?e:Array.isArray(e)?new i(e[0],e[1]):e},Nd}vG();function bG(i,e,t=2){const n=e&&e.length,s=n?e[0]*t:i.length;let o=O0(i,0,s,t,!0);const r=[];if(!o||o.next===o.prev)return r;let a,l,c;if(n&&(o=IG(i,e,o,t)),i.length>80*t){a=i[0],l=i[1];let h=a,u=l;for(let p=t;p<s;p+=t){const f=i[p],m=i[p+1];f<a&&(a=f),m<l&&(l=m),f>h&&(h=f),m>u&&(u=m)}c=Math.max(h-a,u-l),c=c!==0?32767/c:0}return Mo(o,r,t,a,l,c,0),r}function O0(i,e,t,n,s){let o;if(s===RG(i,e,t,n)>0)for(let r=e;r<t;r+=n)o=Q0(r/n|0,i[r],i[r+1],o);else for(let r=t-n;r>=e;r-=n)o=Q0(r/n|0,i[r],i[r+1],o);return o&&us(o,o.next)&&(_o(o),o=o.next),o}function gn(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(us(t,t.next)||Re(t.prev,t,t.next)===0)){if(_o(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Mo(i,e,t,n,s,o,r){if(!i)return;!r&&o&&_G(i,n,s,o);let a=i;for(;i.prev!==i.next;){const l=i.prev,c=i.next;if(o?wG(i,n,s,o):CG(i)){e.push(l.i,i.i,c.i),_o(i),i=c.next,a=c.next;continue}if(i=c,i===a){r?r===1?(i=EG(gn(i),e),Mo(i,e,t,n,s,o,2)):r===2&&xG(i,e,t,n,s,o):Mo(gn(i),e,t,n,s,o,1);break}}}function CG(i){const e=i.prev,t=i,n=i.next;if(Re(e,t,n)>=0)return!1;const s=e.x,o=t.x,r=n.x,a=e.y,l=t.y,c=n.y,h=Math.min(s,o,r),u=Math.min(a,l,c),p=Math.max(s,o,r),f=Math.max(a,l,c);let m=n.next;for(;m!==e;){if(m.x>=h&&m.x<=p&&m.y>=u&&m.y<=f&&To(s,a,o,l,r,c,m.x,m.y)&&Re(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function wG(i,e,t,n){const s=i.prev,o=i,r=i.next;if(Re(s,o,r)>=0)return!1;const a=s.x,l=o.x,c=r.x,h=s.y,u=o.y,p=r.y,f=Math.min(a,l,c),m=Math.min(h,u,p),y=Math.max(a,l,c),g=Math.max(h,u,p),A=Ld(f,m,e,t,n),v=Ld(y,g,e,t,n);let C=i.prevZ,w=i.nextZ;for(;C&&C.z>=A&&w&&w.z<=v;){if(C.x>=f&&C.x<=y&&C.y>=m&&C.y<=g&&C!==s&&C!==r&&To(a,h,l,u,c,p,C.x,C.y)&&Re(C.prev,C,C.next)>=0||(C=C.prevZ,w.x>=f&&w.x<=y&&w.y>=m&&w.y<=g&&w!==s&&w!==r&&To(a,h,l,u,c,p,w.x,w.y)&&Re(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;C&&C.z>=A;){if(C.x>=f&&C.x<=y&&C.y>=m&&C.y<=g&&C!==s&&C!==r&&To(a,h,l,u,c,p,C.x,C.y)&&Re(C.prev,C,C.next)>=0)return!1;C=C.prevZ}for(;w&&w.z<=v;){if(w.x>=f&&w.x<=y&&w.y>=m&&w.y<=g&&w!==s&&w!==r&&To(a,h,l,u,c,p,w.x,w.y)&&Re(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function EG(i,e){let t=i;do{const n=t.prev,s=t.next.next;!us(n,s)&&U0(n,t,t.next,s)&&Bo(n,s)&&Bo(s,n)&&(e.push(n.i,t.i,s.i),_o(t),_o(t.next),t=i=s),t=t.next}while(t!==i);return gn(t)}function xG(i,e,t,n,s,o){let r=i;do{let a=r.next.next;for(;a!==r.prev;){if(r.i!==a.i&&DG(r,a)){let l=V0(r,a);r=gn(r,r.next),l=gn(l,l.next),Mo(r,e,t,n,s,o,0),Mo(l,e,t,n,s,o,0);return}a=a.next}r=r.next}while(r!==i)}function IG(i,e,t,n){const s=[];for(let o=0,r=e.length;o<r;o++){const a=e[o]*n,l=o<r-1?e[o+1]*n:i.length,c=O0(i,a,l,n,!1);c===c.next&&(c.steiner=!0),s.push(PG(c))}s.sort(SG);for(let o=0;o<s.length;o++)t=MG(s[o],t);return t}function SG(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),s=(e.next.y-e.y)/(e.next.x-e.x);t=n-s}return t}function MG(i,e){const t=TG(i,e);if(!t)return e;const n=V0(t,i);return gn(n,n.next),gn(t,t.next)}function TG(i,e){let t=e;const n=i.x,s=i.y;let o=-1/0,r;if(us(i,t))return t;do{if(us(i,t.next))return t.next;if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){const u=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>o&&(o=u,r=t.x<t.next.x?t:t.next,u===n))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,c=r.y;let h=1/0;t=r;do{if(n>=t.x&&t.x>=l&&n!==t.x&&G0(s<c?n:o,s,l,c,s<c?o:n,s,t.x,t.y)){const u=Math.abs(s-t.y)/(n-t.x);Bo(t,i)&&(u<h||u===h&&(t.x>r.x||t.x===r.x&&BG(r,t)))&&(r=t,h=u)}t=t.next}while(t!==a);return r}function BG(i,e){return Re(i.prev,i,e.prev)<0&&Re(e.next,i,i.next)<0}function _G(i,e,t,n){let s=i;do s.z===0&&(s.z=Ld(s.x,s.y,e,t,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,kG(s)}function kG(i){let e,t=1;do{let n=i,s;i=null;let o=null;for(e=0;n;){e++;let r=n,a=0;for(let c=0;c<t&&(a++,r=r.nextZ,!!r);c++);let l=t;for(;a>0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(s=n,n=n.nextZ,a--):(s=r,r=r.nextZ,l--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;n=r}o.nextZ=null,t*=2}while(e>1);return i}function Ld(i,e,t,n,s){return i=(i-t)*s|0,e=(e-n)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function PG(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function G0(i,e,t,n,s,o,r,a){return(s-r)*(e-a)>=(i-r)*(o-a)&&(i-r)*(n-a)>=(t-r)*(e-a)&&(t-r)*(o-a)>=(s-r)*(n-a)}function To(i,e,t,n,s,o,r,a){return!(i===r&&e===a)&&G0(i,e,t,n,s,o,r,a)}function DG(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!NG(i,e)&&(Bo(i,e)&&Bo(e,i)&&LG(i,e)&&(Re(i.prev,i,e.prev)||Re(i,e.prev,e))||us(i,e)&&Re(i.prev,i,i.next)>0&&Re(e.prev,e,e.next)>0)}function Re(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function us(i,e){return i.x===e.x&&i.y===e.y}function U0(i,e,t,n){const s=Ta(Re(i,e,t)),o=Ta(Re(i,e,n)),r=Ta(Re(t,n,i)),a=Ta(Re(t,n,e));return!!(s!==o&&r!==a||s===0&&Ma(i,t,e)||o===0&&Ma(i,n,e)||r===0&&Ma(t,i,n)||a===0&&Ma(t,e,n))}function Ma(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function Ta(i){return i>0?1:i<0?-1:0}function NG(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&U0(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Bo(i,e){return Re(i.prev,i,i.next)<0?Re(i,e,i.next)>=0&&Re(i,i.prev,e)>=0:Re(i,e,i.prev)<0||Re(i,i.next,e)<0}function LG(i,e){let t=i,n=!1;const s=(i.x+e.x)/2,o=(i.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&s<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function V0(i,e){const t=Rd(i.i,i.x,i.y),n=Rd(e.i,e.x,e.y),s=i.next,o=e.prev;return i.next=e,e.prev=i,t.next=s,s.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function Q0(i,e,t,n){const s=Rd(i,e,t);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function _o(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Rd(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function RG(i,e,t,n){let s=0;for(let o=e,r=t-n;o<t;o+=n)s+=(i[r]-i[o])*(i[o+1]+i[r+1]),r=o;return s}class bi{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){const t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}}const Da=class Da{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};Da.noSubdivision=new Da({fill:new bi(0,0),line:new bi(0,0),tile:new bi(0,0),stencil:new bi(0,0),circle:1});let Ba=Da;const Hi=3;class Fd{constructor(e,t,n){const s=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const r=new Int32Array(this.arrayBuffer);e=r[0],t=r[1],n=r[2],this.d=t+2*n;for(let c=0;c<this.d*this.d;c++){const h=r[Hi+c],u=r[Hi+c+1];s.push(h===u?null:r.subarray(h,u))}const a=r[Hi+s.length],l=r[Hi+s.length+1];this.keys=r.subarray(a,l),this.bboxes=r.subarray(l),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let r=0;r<this.d*this.d;r++)s.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;const o=n/t*e;this.min=-o,this.max=e+o}insert(e,t,n,s,o){this._forEachCell(t,n,s,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,n,s,o,r){this.cells[o].push(r)}query(e,t,n,s,o){const r=this.min,a=this.max;if(e<=r&&t<=r&&a<=n&&a<=s&&!o)return[...this.keys];{const l=[],c={};return this._forEachCell(e,t,n,s,this._queryCell,l,c,o),l}}_queryCell(e,t,n,s,o,r,a,l){const c=this.cells[o];if(c!==null){const h=this.keys,u=this.bboxes;for(const p of c)if(a[p]===void 0){const f=p*4;(l?l(u[f+0],u[f+1],u[f+2],u[f+3]):e<=u[f+2]&&t<=u[f+3]&&n>=u[f+0]&&s>=u[f+1])?(a[p]=!0,r.push(h[p])):a[p]=!1}}}_forEachCell(e,t,n,s,o,r,a,l){const c=this._convertToCellCoord(e),h=this._convertToCellCoord(t),u=this._convertToCellCoord(n),p=this._convertToCellCoord(s);for(let f=c;f<=u;f++)for(let m=h;m<=p;m++){const y=this.d*m+f;if(!(l&&!l(this._convertFromCellCoord(f),this._convertFromCellCoord(m),this._convertFromCellCoord(f+1),this._convertFromCellCoord(m+1)))&&o.call(this,e,t,n,s,y,r,a,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=Hi+this.cells.length+1+1;let n=0;for(const r of this.cells)n+=r.length;const s=new Int32Array(t+n+this.keys.length+this.bboxes.length);s[0]=this.extent,s[1]=this.n,s[2]=this.padding;let o=t;for(let r=0;r<e.length;r++){const a=e[r];s[Hi+r]=o,s.set(a,o),o+=a.length}return s[Hi+e.length]=o,s.set(this.keys,o),o+=this.keys.length,s[Hi+e.length+1]=o,s.set(this.bboxes,o),o+=this.bboxes.length,s.buffer}static serialize(e,t){const n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new Fd(e.buffer)}}class FG extends Error{constructor(e,t,n,s){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=s}}const z0={};function At(i,e,t={}){if(z0[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),z0[i]={klass:e,omit:t.omit||[],shallow:t.shallow||[]}}At("Object",Object),At("Set",Set),At("TransferableGridIndex",Fd),At("Color",qe),At("Error",Error),At("AJAXError",FG),At("ResolvedImage",zi),At("StylePropertyFunction",Bd),At("StyleExpression",Md,{omit:["_evaluator"]}),At("ZoomDependentExpression",wa),At("ZoomConstantExpression",Ca),At("CompoundExpression",pn,{omit:["_evaluate"]});for(const i in cs)cs[i]._classRegistryKey||At(`Expression_${i}`,cs[i]);At("SubdivisionGranularityExpression",bi),At("SubdivisionGranularitySetting",Ba);const fs=-32768,ko=32767;class OG{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=Tt/e,this._canonical=t}_getKey(e,t){return e=e+32768,t=t+32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const n=Math.round(e)|0,s=Math.round(t)|0,o=this._getKey(n,s);if(this._vertexDictionary.has(o))return this._vertexDictionary.get(o);const r=this._vertexBuffer.length/2;return this._vertexDictionary.set(o,r),this._vertexBuffer.push(n,s),r}_subdivideTrianglesScanline(e){if(this._granularity<2)return VG(this._vertexBuffer,e);const t=[],n=e.length;for(let s=0;s<n;s+=3){const o=[e[s+0],e[s+1],e[s+2]],r=[this._vertexBuffer[e[s+0]*2+0],this._vertexBuffer[e[s+0]*2+1],this._vertexBuffer[e[s+1]*2+0],this._vertexBuffer[e[s+1]*2+1],this._vertexBuffer[e[s+2]*2+0],this._vertexBuffer[e[s+2]*2+1]];let a=1/0,l=1/0,c=-1/0,h=-1/0;for(let y=0;y<3;y++){const g=r[y*2],A=r[y*2+1];a=Math.min(a,g),c=Math.max(c,g),l=Math.min(l,A),h=Math.max(h,A)}if(a===c||l===h)continue;const u=Math.floor(a/this._granularityCellSize),p=Math.ceil(c/this._granularityCellSize),f=Math.floor(l/this._granularityCellSize),m=Math.ceil(h/this._granularityCellSize);if(u===p&&f===m){t.push(...o);continue}for(let y=f;y<m;y++){const g=this._scanlineGenerateVertexRingForCellRow(y,r,o);QG(this._vertexBuffer,g,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,n){const s=e*this._granularityCellSize,o=s+this._granularityCellSize,r=[];for(let a=0;a<3;a++){const l=t[a*2],c=t[a*2+1],h=t[(a+1)*2%6],u=t[((a+1)*2+1)%6],p=t[(a+2)*2%6],f=t[((a+2)*2+1)%6],m=h-l,y=u-c,g=m===0,A=y===0,v=(s-c)/y,C=(o-c)/y,w=Math.min(v,C),M=Math.max(v,C);if(!A&&(w>=1||M<=0)||A&&(c<s||c>o)){u>=s&&u<=o&&r.push(n[(a+1)%3]);continue}if(!A&&w>0){const S=l+m*w,R=c+y*w;r.push(this._vertexToIndex(S,R))}const x=l+m*Math.max(w,0),I=l+m*Math.min(M,1);if(g||this._generateIntraEdgeVertices(r,l,c,h,u,x,I),!A&&M<1){const S=l+m*M,R=c+y*M;r.push(this._vertexToIndex(S,R))}(A||u>=s&&u<=o)&&r.push(n[(a+1)%3]),!A&&(u<=s||u>=o)&&this._generateInterEdgeVertices(r,l,c,h,u,p,f,I,s,o)}return r}_generateIntraEdgeVertices(e,t,n,s,o,r,a){const l=s-t,c=o-n,h=c===0,u=h?Math.min(t,s):Math.min(r,a),p=h?Math.max(t,s):Math.max(r,a),f=Math.floor(u/this._granularityCellSize)+1,m=Math.ceil(p/this._granularityCellSize)-1;if(h?t<s:r<a)for(let g=f;g<=m;g++){const A=g*this._granularityCellSize,v=n+c*(A-t)/l;e.push(this._vertexToIndex(A,v))}else for(let g=m;g>=f;g--){const A=g*this._granularityCellSize,v=n+c*(A-t)/l;e.push(this._vertexToIndex(A,v))}}_generateInterEdgeVertices(e,t,n,s,o,r,a,l,c,h){const u=o-n,p=r-s,f=a-o,m=(c-o)/f,y=(h-o)/f,g=Math.min(m,y),A=Math.max(m,y),v=s+p*g;let C=Math.floor(Math.min(v,l)/this._granularityCellSize)+1,w=Math.ceil(Math.max(v,l)/this._granularityCellSize)-1,M=l<v;const x=f===0;if(x&&(a===c||a===h))return;if(x||g>=1||A<=0){const S=t-r,R=n-a,b=(c-a)/R,B=(h-a)/R,L=Math.min(b,B),O=r+S*L;C=Math.floor(Math.min(O,l)/this._granularityCellSize)+1,w=Math.ceil(Math.max(O,l)/this._granularityCellSize)-1,M=l<O}const I=u>0?h:c;if(M)for(let S=C;S<=w;S++){const R=S*this._granularityCellSize;e.push(this._vertexToIndex(R,I))}else for(let S=w;S>=C;S--){const R=S*this._granularityCellSize;e.push(this._vertexToIndex(R,I))}}_generateOutline(e){const t=[];for(const n of e){const s=H0(n,this._granularity,!0),o=this._pointArrayToIndices(s),r=[];for(let a=1;a<o.length;a++)r.push(o[a-1]),r.push(o[a]);t.push(r)}return t}_handlePoles(e){let t=!1,n=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(t||n)&&this._fillPoles(e,t,n)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){const n=e[t+1];n===fs&&(e[t+1]=fs+1),n===ko&&(e[t+1]=ko-1)}}_generatePoleQuad(e,t,n,s,o,r){s>o!=(r===fs)?(e.push(t),e.push(n),e.push(this._vertexToIndex(s,r)),e.push(n),e.push(this._vertexToIndex(o,r)),e.push(this._vertexToIndex(s,r))):(e.push(n),e.push(t),e.push(this._vertexToIndex(s,r)),e.push(this._vertexToIndex(o,r)),e.push(n),e.push(this._vertexToIndex(s,r)))}_fillPoles(e,t,n){const s=this._vertexBuffer,o=0,r=Tt,a=e.length;for(let l=2;l<a;l+=3){const c=e[l-2],h=e[l-1],u=e[l],p=s[c*2],f=s[c*2+1],m=s[h*2],y=s[h*2+1],g=s[u*2],A=s[u*2+1];t&&(f===o&&y===o&&this._generatePoleQuad(e,c,h,p,m,fs),y===o&&A===o&&this._generatePoleQuad(e,h,u,m,g,fs),A===o&&f===o&&this._generatePoleQuad(e,u,c,g,p,fs)),n&&(f===r&&y===r&&this._generatePoleQuad(e,c,h,p,m,ko),y===r&&A===r&&this._generatePoleQuad(e,h,u,m,g,ko),A===r&&f===r&&this._generatePoleQuad(e,u,c,g,p,ko))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:n,holeIndices:s}=UG(e);this._initializeVertices(n);let o;try{const a=bG(n,s),l=this._convertIndices(n,a);o=this._subdivideTrianglesScanline(l)}catch(a){console.error(a)}let r=[];return t&&(r=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(o),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:r}}_convertIndices(e,t){const n=[];for(const s of t){const o=e[s*2],r=e[s*2+1];n.push(this._vertexToIndex(o,r))}return n}_pointArrayToIndices(e){const t=[];for(const n of e)t.push(this._vertexToIndex(n.x,n.y));return t}}function GG(i,e,t,n=!0){return new OG(t,e).subdividePolygonInternal(i,n)}function H0(i,e,t=!1){if(!i||i.length<1)return[];if(i.length<2)return[];const n=i[0],s=i[i.length-1],o=t&&(n.x!==s.x||n.y!==s.y);if(e<2)return o?[...i,i[0]]:[...i];const r=Math.floor(Tt/e),a=[];a.push(new Ne(i[0].x,i[0].y));const l=i.length,c=o?l:l-1;for(let h=0;h<c;h++){const u=i[h],p=h<l-1?i[h+1]:i[0],f=u.x,m=u.y,y=p.x,g=p.y,A=f!==y,v=m!==g;if(!A&&!v)continue;const C=y-f,w=g-m,M=Math.abs(C),x=Math.abs(w);let I=f,S=m;for(;;){const b=C>0?(Math.floor(I/r)+1)*r:(Math.ceil(I/r)-1)*r,B=w>0?(Math.floor(S/r)+1)*r:(Math.ceil(S/r)-1)*r,L=Math.abs(I-b),O=Math.abs(S-B),N=Math.abs(I-y),D=Math.abs(S-g),E=A?L/M:Number.POSITIVE_INFINITY,T=v?O/x:Number.POSITIVE_INFINITY;if((N<=L||!A)&&(D<=O||!v))break;if(E<T&&A||!v){I=b,S=S+w*E;const P=new Ne(I,Math.round(S));(a[a.length-1].x!==P.x||a[a.length-1].y!==P.y)&&a.push(P)}else{I=I+C*T,S=B;const P=new Ne(Math.round(I),S);(a[a.length-1].x!==P.x||a[a.length-1].y!==P.y)&&a.push(P)}}const R=new Ne(y,g);(a[a.length-1].x!==R.x||a[a.length-1].y!==R.y)&&a.push(R)}return a}function UG(i){const e=[],t=[];for(const n of i)if(n.length!==0){n!==i[0]&&e.push(t.length/2);for(const s of n)t.push(s.x),t.push(s.y)}return{flattened:t,holeIndices:e}}function VG(i,e){const t=[];for(let n=0;n<e.length;n+=3){const s=e[n],o=e[n+1],r=e[n+2],a=i[s*2],l=i[s*2+1],c=i[o*2],h=i[o*2+1],u=i[r*2],p=i[r*2+1],f=c-a,m=h-l,y=u-a,g=p-l;f*g-m*y>0?(t.push(s),t.push(r),t.push(o)):(t.push(s),t.push(o),t.push(r))}return t}function QG(i,e,t){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let n=0,s=i[e[0]*2];for(let l=1;l<e.length;l++){const c=i[e[l]*2];c<s&&(s=c,n=l)}const o=e.length;let r=n,a=(r+1)%o;for(;;){const l=r-1>=0?r-1:o-1,c=(a+1)%o,h=i[e[l]*2],u=i[e[l]*2+1],p=i[e[c]*2],f=i[e[c]*2+1],m=i[e[r]*2],y=i[e[r]*2+1],g=i[e[a]*2],A=i[e[a]*2+1];let v=!1;if(h<p)v=!0;else if(h>p)v=!1;else{const C=A-y,w=-(g-m),M=y<A?1:-1,x=((h-m)*C+(u-y)*w)*M,I=((p-m)*C+(f-y)*w)*M;x>I&&(v=!0)}if(v){const C=e[l],w=e[r],M=e[a];C!==w&&C!==M&&w!==M&&t.push(M,w,C),r--,r<0&&(r=o-1)}else{const C=e[c],w=e[r],M=e[a];C!==w&&C!==M&&w!==M&&t.push(M,w,C),a++,a>=o&&(a=0)}if(l===c)break}}const Y0={globe:new Ba({fill:new bi(128,2),line:new bi(512,0),tile:new bi(128,32),stencil:new bi(128,1),circle:3})};let Od=null,$0=0,Gd=null;function zG(i,e){return Gd===null&&(Gd=Cesium.TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.ellipsoid,128,e.getNumberOfXTilesAtLevel(0))),Gd/(1<<i)}function HG(i,e){const t=zG(e.z,e.tilingScheme),n=e.distanceToCamera,s=i.context.drawingBufferHeight,o=i.camera.frustum.sseDenominator;let r=t*s/(n*o);return i.fog.enabled&&(r-=Cesium.Math.fog(n,i.fog.density)*i.fog.sse),r/=i.pixelRatio,r}function YG(){Od===null&&(Od=Cesium.RenderState.fromCache({id:"vt_tile-depth",blending:Cesium.BlendingState.DISABLED,depthTest:{enabled:!0},depthMask:!0,cull:{enabled:!0},stencilMask:Cesium.StencilConstants.CESIUM_3D_TILE_MASK,stencilTest:{backFunction:519,backOperation:{fail:7680,zFail:7680,zPass:7681},enabled:!0,frontFunction:519,frontOperation:{fail:7680,zFail:7680,zPass:7681},mask:128,reference:128},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}))}class _a{constructor(e){YG(),this.x=e.x,this.y=e.y,this.z=e.z,this.parent=e.parent,this.children=[],this.tilingScheme=e.tilingScheme,this.rectangle=this.tilingScheme.tileXYToRectangle(this.x,this.y,this.z),this.tileBoundingRegion=new Cesium.TileBoundingRegion({rectangle:this.rectangle,minimumHeight:0,maximumHeight:0,ellipsoid:this.tilingScheme.ellipsoid,computeBoundingVolumes:!0}),this.layers=[],this.visualizers=[],this.sources={},this.tileId=null,this.lastVisitTime=0,this.state="none",this.renderable=!1,this.tileId={x:this.x,y:this.y,z:this.z,key:$0++,color:Cesium.Color.fromRgba($0-1),tileColor:Cesium.Color.fromRandom({alpha:1})};const t=Tt*Math.pow(2,this.z),n=Tt*this.x,s=Tt*this.y;this.transformPoint=function(o,r,a){return a[0]=(o+n)*360/t-180,a[1]=360/Math.PI*Math.atan(Math.exp((1-(r+s)*2/t)*Math.PI))-90,a}}createChildren(){var e=[{x:this.x*2,y:this.y*2+1,z:this.z+1},{x:this.x*2+1,y:this.y*2+1,z:this.z+1},{x:this.x*2,y:this.y*2,z:this.z+1},{x:this.x*2+1,y:this.y*2,z:this.z+1}];for(const{x:n,y:s,z:o}of e){var t=new _a({x:n,y:s,z:o,tilingScheme:this.tilingScheme,parent:this});this.children.push(t)}}visit(e,t){const n=this.tileBoundingRegion;if(this.distanceToCamera=n.distanceToCamera(e),this.visibility=e.cullingVolume.computeVisibility(n),this.visibility==Cesium.Intersect.OUTSIDE)return;const s=e.maximumScreenSpaceError;HG(e,this)>=s?t.visitChildren(this):t.accept(this)}async getSources(e){const t={},n=e._styleJson;for(const o of n.layers){const r=o.source,a=e.sources[r];a&&!t[r]&&(t[r]=a)}if(e._taskProcessor&&Object.values(t).every(o=>o.type==="vector")){for(const o in t){const r=t[o];try{const a=await r.requestTileBuffer(this.x,this.y,this.z,e);a&&a.buffer&&(this.sources[o]=a)}catch{}}this._workerBuffers=!0}else for(const o in t){const r=t[o];try{const a=await r.requestTile(this.x,this.y,this.z,e);a&&(this.sources[o]=a)}catch{}}e.numLoading--,this.state="loaded"}async createRenderLayers(e,t){const n=this.sources,s=t._styleLayers,o=this.layers,r=this.visualizers,a={};for(const l of s){const c=n[l.source],h=ps[l.type],u=ms[l.type],p=l.type==="background";if(h||Qe("不支持图层类型"+l.type),!p&&!c||!h)continue;const f=[];if(!p){const g=(l.source&&t.sources[l.source].type)=="geojson"?"_geojsonTileLayer":l.sourceLayer,A=c.layers[g];if(!A)continue;const v=A.length;for(let C=0;C<v;C++){const w=A.feature(C);l.filter&&!l.filter.filter({zoom:this.z},w)||(w.toGeoJSON||(w.toGeoJSON=Yn.prototype.toGeoJSON),f.push(w))}if(!f.length)continue}const m=new h(f,l,this);if(o.push(m),u){let y=a[l.type];y||(y=new u(this),a[l.type]=y,r.push(y)),y.addLayer(f,m,e,t)}}this.state="ready"}createRenderLayersFromWorkerResult(e,t,n){if(e.error){this.state="error";return}const s=n._styleLayers,o=this.layers,r=this.visualizers,a={};for(const l of e.fill||[]){const c=s.find(m=>m.id===l.layerId);if(!c)continue;const h=ps.fill,u=ms.fill,p=new h([],c,this);o.push(p);let f=a.fill;f||(f=new u(this),a.fill=f,r.push(f)),f.addLayerFromWorkerResult(l,p,t,n)}for(const l of e.line||[]){const c=s.find(m=>m.id===l.layerId);if(!c)continue;const h=ps.line,u=ms.line,p=new h([],c,this);o.push(p);let f=a.line;f||(f=new u(this),a.line=f,r.push(f)),f.addLayerFromWorkerResult(l,p,t,n)}for(const l of e.symbol||[]){const c=s.find(m=>m.id===l.layerId);if(!c)continue;const h=ps.symbol,u=ms.symbol,p=new h([],c,this);o.push(p);let f=a.symbol;f||(f=new u(this),a.symbol=f,r.push(f)),f.addLayerFromWorkerResult(l,p,t,n)}this.state="ready"}update(e,t,n){this.primitive||(this.primitive=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:new Cesium.RectangleGeometry({rectangle:this.rectangle})}),compressVertices:!1,asynchronous:!1,appearance:new Cesium.MaterialAppearance({flat:!0,translucent:!1,material:Cesium.Material.fromType("Color",{color:Cesium.Color.fromAlpha(this.tileId.tileColor,.25)}),renderState:{blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!1}}})}),this.primitive.name="_tile-color_");const s=this.commandList||[],o=this.tileIdCommands||[],r=this.tileDepthCommands||[];if(!s.length){const a=e.commandList;if(e.commandList=s,this.primitive.update(e),s.length){const l=this.tileId.color;for(const c of s){c.pass=Cesium.Pass.CESIUM_3D_TILE;const h=Cesium.DrawCommand.shallowClone(c);h.renderState=Cesium.RenderState.fromCache({id:"tileId",blending:{enabled:!1},depthTest:{enabled:!1},depthMask:!0,cull:{enabled:!0}}),h.layerType="tile-id",h.uniformMap={...c.uniformMap},h.uniformMap.color_0=function(){return l},o.push(h);const u=Cesium.DrawCommand.shallowClone(c);u.pass=Cesium.Pass.CESIUM_3D_TILE,u.renderState=Od,r.layerType="tile-depth",r.push(u)}this.tileIdCommands=o,this.tileDepthCommands=r}this.commandList=s,e.commandList=a}if(n.showTileColor&&s.length&&t.tileCommands.push(...s),this.state=="none"&&n.numLoading<=n.maxLoading&&(n.numLoading++,this.state="loading",this.getSources(n)),this.state==="loaded"&&n.numInitializing<n.maxInitializing)if(this._workerBuffers&&n._taskProcessor){const a={sources:{},x:this.x,y:this.y,z:this.z,extent:Tt,styleLayers:n._styleLayers.map(h=>({id:h.id,type:h.type,source:h.source,sourceLayer:h.sourceLayer??h.data["source-layer"],filter:h.data.filter,paint:h.data.paint,layout:h.data.layout}))},l=[];for(const h in this.sources){const u=this.sources[h];u&&u.buffer&&(a.sources[h]={buffer:u.buffer,encoding:u.encoding||"mvt"},l.push(u.buffer))}const c=n._taskProcessor.scheduleTask(a,l);Cesium.defined(c)&&(this.state="initializing",n.numInitializing++,c.then(h=>{this.createRenderLayersFromWorkerResult(h,e,n)}).catch(()=>{this.state="error"}))}else this.state="initializing",n.numInitializing++,this.createRenderLayers(e,n);if(this.state==="ready"){let a=!0,l=!0;for(const c of this.visualizers)c.update(e,n),c.state==="none"&&(a=!1);for(const c of this.layers)c.update(e,n),c.visibility!="none"&&c.state=="none"&&(l=!1);this.renderable=a&&l}}render(e,t,n){if(!this.renderable)return;this.commandList;const s=this.tileIdCommands,o=this.tileDepthCommands;for(const r of this.layers)t.push(r);for(const r of this.visualizers)t.visualizers.push(r);for(const r of s)t.tileIdCommands.push(r);o.length&&t.tileCommands.push(...o)}unload(){this.primitive&&(this.primitive.destroy(),this.primitive=null),this.tileGeometry=null,this.commandList&&(this.commandList.length=0),this.tileIdCommands&&(this.tileIdCommands.length=0),this.tileDepthCommands&&(this.tileDepthCommands.length=0);for(const e of this.visualizers)e.destroy();this.visualizers.length=0;for(const e of this.layers)e.destroy();this.layers.length=0,this.sources={},this.state="none"}destroy(){if(this.unload(),this.tileId=null,this.tilingScheme=null,this.parent=null,this.children){for(const e of this.children)e.destroy();this.children.length=0,this.children=null}}}function ka(i,e){let t=!0;return i==="always"||(i==="never"||e==="never")&&(t=!1),t}class $G{constructor(e,t,n){const s=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let r=0;r<this.xCellCount*this.yCellCount;r++)s.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,s,o){this._forEachCell(t,n,s,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(o)}insertCircle(e,t,n,s){this._forEachCell(t-s,n-s,t+s,n+s,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(s)}_insertBoxCell(e,t,n,s,o,r){this.boxCells[o].push(r)}_insertCircleCell(e,t,n,s,o,r){this.circleCells[o].push(r)}_query(e,t,n,s,o,r,a){if(n<0||e>this.width||s<0||t>this.height)return[];const l=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=s){if(o)return[{key:null,x1:e,y1:t,x2:n,y2:s}];for(let c=0;c<this.boxKeys.length;c++)l.push({key:this.boxKeys[c],x1:this.bboxes[c*4],y1:this.bboxes[c*4+1],x2:this.bboxes[c*4+2],y2:this.bboxes[c*4+3]});for(let c=0;c<this.circleKeys.length;c++){const h=this.circles[c*3],u=this.circles[c*3+1],p=this.circles[c*3+2];l.push({key:this.circleKeys[c],x1:h-p,y1:u-p,x2:h+p,y2:u+p})}}else{const c={hitTest:o,overlapMode:r,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,n,s,this._queryCell,l,c,a)}return l}query(e,t,n,s){return this._query(e,t,n,s,!1,null)}hitTest(e,t,n,s,o,r){return this._query(e,t,n,s,!0,o,r).length>0}hitTestCircle(e,t,n,s,o){const r=e-n,a=e+n,l=t-n,c=t+n;if(a<0||r>this.width||c<0||l>this.height)return!1;const h=[],u={hitTest:!0,overlapMode:s,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}};return this._forEachCell(r,l,a,c,this._queryCellCircle,h,u,o),h.length>0}_queryCell(e,t,n,s,o,r,a,l){const{seenUids:c,hitTest:h,overlapMode:u}=a,p=this.boxCells[o],f=1e-6;if(p!==null){const y=this.bboxes;for(const g of p)if(!c.box[g]){c.box[g]=!0;const A=g*4,v=this.boxKeys[g];if(e<=y[A+2]+f&&t<=y[A+3]+f&&n>=y[A+0]-f&&s>=y[A+1]-f&&(!l||l(v))&&(!h||!ka(u,v.overlapMode))&&(r.push({key:v,x1:y[A],y1:y[A+1],x2:y[A+2],y2:y[A+3]}),h))return!0}}const m=this.circleCells[o];if(m!==null){const y=this.circles;for(const g of m)if(!c.circle[g]){c.circle[g]=!0;const A=g*3,v=this.circleKeys[g];if(this._circleAndRectCollide(y[A],y[A+1],y[A+2],e,t,n,s)&&(!l||l(v))&&(!h||!ka(u,v.overlapMode))){const C=y[A],w=y[A+1],M=y[A+2];if(r.push({key:v,x1:C-M,y1:w-M,x2:C+M,y2:w+M}),h)return!0}}}return!1}_queryCellCircle(e,t,n,s,o,r,a,l){const{circle:c,seenUids:h,overlapMode:u}=a,p=this.boxCells[o];if(p!==null){const m=this.bboxes;for(const y of p)if(!h.box[y]){h.box[y]=!0;const g=y*4,A=this.boxKeys[y];if(this._circleAndRectCollide(c.x,c.y,c.radius,m[g+0],m[g+1],m[g+2],m[g+3])&&(!l||l(A))&&!ka(u,A.overlapMode))return r.push(!0),!0}}const f=this.circleCells[o];if(f!==null){const m=this.circles;for(const y of f)if(!h.circle[y]){h.circle[y]=!0;const g=y*3,A=this.circleKeys[y];if(this._circlesCollide(m[g],m[g+1],m[g+2],c.x,c.y,c.radius)&&(!l||l(A))&&!ka(u,A.overlapMode))return r.push(!0),!0}}}_forEachCell(e,t,n,s,o,r,a,l){const c=this._convertToXCellCoord(e),h=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),p=this._convertToYCellCoord(s);for(let f=c;f<=u;f++)for(let m=h;m<=p;m++){const y=this.xCellCount*m+f;if(o.call(this,e,t,n,s,y,r,a,l))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,s,o,r){const a=s-e,l=o-t,c=n+r;return c*c>a*a+l*l}_circleAndRectCollide(e,t,n,s,o,r,a){const l=(r-s)/2,c=Math.abs(e-(s+l));if(c>l+n)return!1;const h=(a-o)/2,u=Math.abs(t-(o+h));if(u>h+n)return!1;if(c<=l||u<=h)return!0;const p=c-l,f=u-h;return p*p+f*f<=n*n}}const j0=100;let W0=null,q0=null;class jG{constructor(){W0=new Cesium.Cartesian2,q0=new Cesium.BoundingRectangle}update(e,t,n){const s=e.context.drawingBufferWidth/e.pixelRatio,o=e.context.drawingBufferHeight/e.pixelRatio,r=e.camera._scene,a=new $G(s+2*j0,o+2*j0,25);for(const l of t){const c=l.style,h=l.labels;if(l.type!=="symbol"||l.visibility==="none"||n<c.minzoom||n>=c.maxzoom||!Cesium.defined(h)||!h.length)continue;const u=c.layout.getDataConstValue("text-allow-overlap",l.tile.z),p=c.layout.getDataConstValue("text-overlap",l.tile.z),f=WG(p,u),m=c.layout.getDataConstValue("text-padding",l.tile.z);for(const y of h){const g=y.computeScreenSpacePosition(r,W0);if(!g){y.vtPlaceable=!0;continue}const A=Cesium.Label.getScreenSpaceBoundingBox(y,g,q0),v=A.x-m,C=A.y-m,w=v+A.width+m,M=C+A.height+m;if(a.hitTest(v,C,w,M,f,null))y.vtPlaceable=!1;else{const x={overlapMode:f};a.insert(x,v,C,w,M),y.vtPlaceable=!0}}}}}function WG(i,e){let t="never";return i?t=i:e&&(t="always"),t}class qG{constructor(e){this.maximumLevel=24,this.show=!0,this.showTileColor=!!e.showTileColor,this.ready=!1,this.tilingScheme=new Cesium.WebMercatorTilingScheme,this.readyEvent=new Cesium.Event,this.errorEvent=new Cesium.Event,this._styleJson=null,this._style=e.style,this._rootTiles=[],this._cacheTiles=[],this._tilesToUpdate=[],this._tilesToRender=[],this._styleLayers=[],this._styleLayerIndexMap=new Map,this._renderList=new R0(this._styleLayers),this.numLoading=0,this.maxLoading=6,this.numInitializing=0,this.maxInitializing=6,this._taskProcessor=null,this._workerUrl=e.workerUrl||null,this._maximumActiveTasks=e.maximumActiveTasks??4,this.tileIdTexture=null,this.zoom=0,this._symbolPlacements=new jG,requestAnimationFrame(()=>{this.init()})}async init(){let e=this._style;if(!e){this.errorEvent.raiseEvent(new Error("请传入 style 参数"));return}this.path="",typeof e=="string"&&(this.path=e.split("/").slice(0,-1).join("/"),this.path&&(this.path+="/"),e=await Cesium.Resource.fetchJson(e)),this.sources={};for(const r in e.sources){const a=e.sources[r],l=wc[a.type];if(l){this.sources[r]=new l(a,this.path);try{await this.sources[r].init(),this.maximumLevel=Math.min(a.maxzoom||24,this.maximumLevel)}catch(c){this.errorEvent.raiseEvent(c)}}}for(let r=0;r<e.layers.length;r++)this._styleLayers[r]=new L0(e.layers[r]),this._styleLayerIndexMap.set(e.layers[r].id,r);const t=this.tilingScheme.getNumberOfXTilesAtLevel(0),n=this.tilingScheme.getNumberOfYTilesAtLevel(0);let s=0;for(let r=0;r<n;r++)for(let a=0;a<t;a++){var o=new _a({parent:this,x:a,y:r,z:0,tilingScheme:this.tilingScheme});o.createChildren(),this._rootTiles[s++]=o}this._renderList.init(),this._workerUrl&&typeof Cesium.TaskProcessor<"u"&&(this._taskProcessor=new Cesium.TaskProcessor(this._workerUrl,Math.min(this._maximumActiveTasks,this.maxInitializing))),this._styleJson=e,this.ready=!0,this.readyEvent.raiseEvent(this)}executeTileIdCommands(e){const t=this._renderList.tileIdCommands;if(t.length>0){const n=e.context;let s=this._tileIdFbo;s||(s=new Cesium.FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._tileIdFbo=s,this._idClearCommand=new Cesium.ClearCommand({color:new Cesium.Color(0,0,0,0),depth:1,stencil:0}));const o=n.floatingPointTexture?Cesium.PixelDatatype.FLOAT:Cesium.PixelDatatype.UNSIGNED_BYTE,r=n.drawingBufferWidth,a=n.drawingBufferHeight;s.update(n,r,a,1,o),s.clear(n,this._idClearCommand);const l=s.framebuffer;for(const c of t)c.framebuffer=l,c.execute(n);this.tileIdTexture=s.getColorTexture(0)}}update(e){if(!this.ready||!this.show)return;e.context.webgl2&&Qe("webgl2模式下贴地线面的支持将导致性能下降");const t=this._renderList;t.beginFrame(),this.numInitializing=0;const n=e.camera._scene,o=n.globe._surface._debug.suspendLodUpdate;this.scene=n;const r=KG(e,this);o||r.sort((h,u)=>h.distanceToCamera-u.distanceToCamera);for(const h of r)h.lastVisitTime=e.frameNumber,h.expired=!1,h.update(e,t,this);const a=o?this._tilesToRender:XG(r,this._tilesToRender);o||a.sort((h,u)=>h.distanceToCamera-u.distanceToCamera);for(const h of a)h.lastVisitTime=e.frameNumber,h.expired=!1,h.render(e,t,this);const l=t.getList();this._symbolPlacements.update(e,l,this.zoom);for(const h of l)h.render(e,this);for(const h of t.visualizers)h.render(e,this);e.commandList.push(...t.tileCommands),this.executeTileIdCommands(e);const c=[];for(const h of this._cacheTiles)h.lastVisitTime<e.frameNumber&&(h.expired||c.push(h));if(c.sort((h,u)=>h.lastVisitTime-u.lastVisitTime),c.length>100){for(const h of c)if(h.unload(),h.expired=!0,c.length<=50)break}}setLayoutProperty(e,t,n){const s=this._styleLayerIndexMap;if(!s.has(e))return Qe(`不存在图层:${e}`),!1;const o=s.get(e),a=this._styleLayers[o].setLayoutProperty(t,n);return a&&t!=="visibility"&&this._forceUpdate(),a}setPaintProperty(e,t,n){const s=this._styleLayerIndexMap;if(!s.has(e))return Qe(`不存在图层:${e}`),!1;const o=s.get(e);return this._styleLayers[o].setPaintProperty(t,n)}setFilter(e,t){const n=this._styleLayerIndexMap;if(!n.has(e))return Qe(`不存在图层:${e}`),!1;const s=n.get(e),r=this._styleLayers[s].setFilter(t);return r&&this._forceUpdate(),r}_forceUpdate(){for(const e of this._cacheTiles)e.unload();for(const e of this._tilesToRender)e.unload();for(const e of this._tilesToUpdate)e.unload();this._tilesToRender.length=0,this._tilesToUpdate.length=0}destroy(){const e=this.scene,t=this._rootTiles;if(this.scene=null,e&&e.primitives.contains(this)&&e.primitives.remove(this),t){for(const n of t)n.destroy();t.length=0,this._rootTiles=null}if(this._cacheTiles&&(this._cacheTiles.length=0,this._cacheTiles=null),this.sources){for(const n in this.sources)Object.hasOwnProperty.call(this.sources,n)&&this.sources[n].destroy();this.sources=null}this._styleLayers=null,this._renderList&&(this._renderList.destroy(),this._renderList=null),this._taskProcessor&&!this._taskProcessor.isDestroyed()&&(this._taskProcessor.destroy(),this._taskProcessor=null),this._tilesToUpdate&&(this._tilesToUpdate.length=0,this._tilesToUpdate=null),this._tilesToRender&&(this._tilesToRender.length=0,this._tilesToRender=null),this._tileIdFbo&&(this._tileIdFbo.destroy(),this.tileIdTexture=null,this._tileIdFbo=null,this._idClearCommand=null),this._styleJson=null}isDestroyed(){return!1}}function KG(i,e){const t=[...e._rootTiles],n=e._tilesToUpdate;let s=24,o=1/0;const r={visitChildren(a){if(a.z>=e.maximumLevel)return a.distanceToCamera<o&&(o=a.distanceToCamera,s=a.z),n.push(a);if(a.children.length==0){a.createChildren();for(const l of a.children)e._cacheTiles.push(l)}for(const l of a.children)t.push(l)},accept(a){a.distanceToCamera<o&&(o=a.distanceToCamera,s=a.z),n.push(a)}};n.length=0;do t.shift().visit(i,r);while(t.length>0);return e.zoom=s,n}function XG(i,e){const t=new Map;for(const o of i)o.renderable&&t.set(o,!0);const n=[];for(let o=0;o<e.length;o++){const r=e[o];if(r.renderable=t.has(r),r.renderable)continue;const a={tiles:[],total:0,renderable:0};n[o]=a;for(const l of i){const c=l.z-r.z;if(c!==0)if(c>0){const h=Math.pow(2,c),u=Math.floor(l.x/h),p=Math.floor(l.y/h);u===r.x&&p===r.y&&(a.total++,a.tiles.push(l),l.renderable&&a.renderable++)}else{const h=Math.pow(2,-c),u=Math.floor(r.x/h),p=Math.floor(r.y/h);u===l.x&&p===l.y&&(r.renderable=!l.renderable)}}}for(let o=0;o<e.length;o++){const r=e[o],a=n[o];if(a&&a.total){const l=a.total===a.renderable;r.renderable=!l;for(const c of a.tiles)c.renderable=l}}t.clear();let s=e.length;for(let o=0;o<s;o++){const r=e.shift();r.renderable&&(e.push(r),t.set(r,!0))}s=i.length;for(let o=0;o<s;o++){const r=i[o];r.renderable&&!t.has(r)&&(e.push(r),t.set(r,!0))}return e}class Po{constructor(e,t,n){this.sourceFeatures=e,this.style=t,this.tile=n,this.features=[],this.firstBatchId=-1,this.lastBatchId=-1,this.offsets=[],this.counts=[],this.commandList=[],this.visibility="visible",this.state="none",this.paintVersion=t.paintVersion}get id(){return this.style.id}get type(){return this.style.type}get paintNeedsUpdate(){return this.paintVersion!==this.style.paintVersion}set paintNeedsUpdate(e){e||(this.paintVersion=this.style.paintVersion)}update(e,t){const n=this.style.layout.getDataConstValue("visibility",this.tile.z);this.visibility=n}render(e,t){const n=this.style,s=t.zoom;if(this.visibility==="none"||s<n.minzoom||s>=n.maxzoom)return;const o=this.commandList;if(o&&o.length)for(const r of o)e.commandList.push(r)}isDestroyed(){return!1}destroy(){this.commandList&&(this.commandList.length=0),this.sourceFeatures&&(this.sourceFeatures.length=0),this.style=null,this.offsets=null,this.counts=null,this.tile=null,this.isDestroyed=function(){return!0}}}class Pa{constructor(e,t=[]){this.tile=e,this.layers=t,this.state="none",this.commandList=[]}addLayer(e,t,n,s){}setState(e){for(const t of this.layers)t.state=e;this.state=e}update(e,t){}render(e){const t=this.commandList;if(t&&t.length)for(const n of t)e.commandList.push(n)}destroy(){this.tile=null,this.layers.length=0,this.isDestroyed=function(){return!0}}isDestroyed(){return!1}}const ps={},ms={};function Do(i,e,t){ps[i]=e,ms[i]=t}class K0 extends Po{createPrimitve(e,t){const n=this.style,s=this.tile,o=n.convertColor(n.paint.getDataConstValue("background-color",s.z)),r=n.paint.getDataConstValue("background-opacity",s.z);if(n.paint.getDataConstValue("background-pattern",s.z))return Qe("background图层:不支持纹理填充");o.alpha*=r;const l=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:new Cesium.RectangleGeometry({rectangle:this.tile.rectangle})}),compressVertices:!1,asynchronous:!1,appearance:new Cesium.MaterialAppearance({translucent:!1,material:Cesium.Material.fromType("Color",{color:o}),flat:!0})});this.primitive=l}update(e,t){if(super.update(e,t),this.visibility!="none"){if(this.primitive||this.createPrimitve(e,t),this.primitive&&!this.commandList.length){const n=e.commandList,s=e.commandList=this.commandList;if(this.primitive.update(e),s.length>0){const o=Cesium.RenderState.fromCache({blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!0}});for(const r of s)r.renderState=o,r.pass=Cesium.Pass.CESIUM_3D_TILE;this.state="done"}this.primitive._state===Cesium.PrimitiveState.FAILED&&(this.state="error"),e.commandList=n}if(this.primitive&&this.paintNeedsUpdate){const n=this.style,s=this.tile,o=n.convertColor(n.paint.getDataConstValue("background-color",s.z)),r=n.paint.getDataConstValue("background-opacity",s.z);o.alpha*=r,this.primitive.appearance.material.uniforms.color=o,this.paintNeedsUpdate=!1}}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}}Do("background",K0);const Ud=Math.pow(2,15-1)-1,X0=-Ud-1;function J0(i){const e=Tt/i.extent,t=i.loadGeometry();for(const n of t)for(const s of n){const o=Math.round(s.x*e),r=Math.round(s.y*e);s.x=D0(o,X0,Ud),s.y=D0(r,X0,Ud),(o<s.x||o>s.x+1||r<s.y||r>s.y+1)&&Qe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return t}class JG extends Pa{constructor(e,t){super(e,t),this.geometryInstances=[],this.outlineGeometryInstances=[],this.primitive=null,this.commandsReady=!1}addLayer(e,t,n,s){const o=t.style,{tile:r,geometryInstances:a}=this,l=Y0.globe.line.getGranularityForZoomLevel(r.z)/2,c=this;let h=0;const u=s.sources[t.style.source].styleSource.promoteId;for(const p of e){const f=Yn.types[p.type],m=p.properties;if(f!=="Polygon")continue;if(o.paint.getDataValue("fill-pattern",r.z,p)){Qe("fill图层:不支持纹理填充(fill-pattern)");continue}const g=p.id||m[u],A=o.convertColor(o.paint.getDataValue("fill-color",r.z,p)),v=o.paint.getDataValue("fill-opacity",r.z,p),C=o.convertColor(o.paint.getDataValue("fill-outline-color",r.z,p))||A,w=J0(p),M=Qm(w);for(const x of M){if(x.some(R=>R.length<3))continue;const I=a.length;h==0&&(t.firstBatchId=I),t.lastBatchId=I;const S={coordinates:x,featureId:h,fillColor:A,fillOpacity:v,fillOutlineColor:C,properties:m,id:g,batchId:I};c.addFeature(S,l),t.features.push(S),h++}}t.offsets=[],t.counts=[],this.layers.push(t)}addLayerFromWorkerResult(e,t,n,s){const{batches:o,firstBatchId:r,lastBatchId:a}=e,l=this.geometryInstances,c=new Cesium.Cartesian3;for(const h of o){const{positions:u,normals:p,st:f,indices:m,colorBytes:y,id:g,properties:A}=h;u.length/3;const v=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:u},normal:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1,values:p},st:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:f}},primitiveType:Cesium.PrimitiveType.TRIANGLES,indices:m,boundingSphere:Cesium.BoundingSphere.fromVertices(u)}),C=Cesium.Cartographic.fromCartesian(v.boundingSphere.center);C.height=0;const w=Cesium.Cartographic.toCartesian(C,null,c),M=new Cesium.GeometryInstance({geometry:v,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:Array.from(y)})},id:new Cesium.Entity({position:w,id:g,properties:A})});l.push(M)}t.firstBatchId=r,t.lastBatchId=a,t.offsets=[],t.counts=[],this.layers.push(t)}addFeature(e,t){const n=this.geometryInstances,s=this.outlineGeometryInstances,{coordinates:o,fillColor:r,fillOpacity:a,fillOutlineColor:l}=e,c=r.toBytes();c[3]=Math.floor(c[3]*a);const h=l.toBytes();h[3]=Math.floor(h[3]*a);const u=GG(o,this.tile,t,!0),p=u.verticesFlattened,f=[0,0],m=new Cesium.Cartesian3,y=p.length/2,g=new Float64Array(y*3),A=new Float32Array(y*3),v=new Float32Array(y*2);for(let B=0,L=0;B<p.length;B+=2,L++){const O=p[B],N=p[B+1],D=this.tile.transformPoint(O,N,f),E=Cesium.Cartesian3.fromDegrees(D[0],D[1],0,null,m);g[L*3]=E.x,g[L*3+1]=E.y,g[L*3+2]=E.z;const T=Cesium.Cartesian3.normalize(E,E);A[L*3]=T.x,A[L*3+1]=T.y,A[L*3+2]=T.z,v[L*2]=O/Tt,v[L*2+1]=N/Tt}const C=new(y>65535?Uint32Array:y>255?Uint16Array:Uint8Array)(u.indicesTriangles),w=new(y>65535?Uint32Array:y>255?Uint16Array:Uint8Array)(u.indicesLineList.flat(3)),M=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:g},normal:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1,values:A},st:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:v}},primitiveType:Cesium.PrimitiveType.TRIANGLES,indices:C,boundingSphere:Cesium.BoundingSphere.fromVertices(g)}),x=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:g}},primitiveType:Cesium.PrimitiveType.LINES,indices:w,boundingSphere:Cesium.BoundingSphere.fromVertices(g)}),I=Cesium.Cartographic.fromCartesian(M.boundingSphere.center);I.height=0;const S=Cesium.Cartographic.toCartesian(I,null,m),R=new Cesium.GeometryInstance({geometry:M,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:c})},id:new Cesium.Entity({position:S,id:e.id,properties:e.properties})});n.push(R);const b=new Cesium.GeometryInstance({geometry:x,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:h})},id:new Cesium.Entity({position:S,id:e.id,properties:e.properties})});s.push(b)}createPrimitive(){const e=new Cesium.Primitive({geometryInstances:this.geometryInstances,asynchronous:!(this.geometryInstances[0].geometry instanceof Cesium.Geometry),appearance:new Cesium.PerInstanceColorAppearance({flat:!0,translucent:!1,renderState:{depthMask:!1},fragmentShaderSource:`
|
|
140
|
+
`),this.watermarkDom.appendChild(n),this.parentElement.appendChild(this.watermarkDom),this.options.mutationObserve)try{this.bindMutationObserve()}catch{(h=(c=this.options).onObserveError)===null||h===void 0||h.call(c)}return e&&((p=(u=this.options).onSuccess)===null||p===void 0||p.call(u)),this.isCreating=!1,[2]}})})},i.prototype.destroy=function(){this.remove(),this.watermarkDom=void 0},i.prototype.check=function(){return pi(this,void 0,void 0,function(){return ti(this,function(e){return[2,this.parentElement.contains(this.watermarkDom)]})})},i.prototype.remove=function(){var e,t,n,s,o,r,a,l;(t=(e=this.options).onBeforeDestroy)===null||t===void 0||t.call(e),(n=this.observer)===null||n===void 0||n.disconnect(),(s=this.parentObserve)===null||s===void 0||s.disconnect(),(r=(o=this.watermarkDom)===null||o===void 0?void 0:o.parentNode)===null||r===void 0||r.removeChild(this.watermarkDom),(l=(a=this.options).onDestroyed)===null||l===void 0||l.call(a)},i.prototype.initConfigData=function(e,t){var n=this;t===void 0&&(t="overwrite"),t==="append"?Object.keys(e).forEach(function(s){n.props&&(n.props[s]=e[s])}):this.props=e,this.options=Fi(Fi({},Um),this.props),this.changeParentElement(this.options.parent),this.watermarkCanvas=new Kr(this.props,this.options)},i.prototype.changeParentElement=function(e){if(typeof e=="string"){var t=document.querySelector(e);t&&(this.parentElement=t)}else this.parentElement=e;this.parentElement||console.error("[WatermarkJsPlus]: please pass a valid parent element.")},i.prototype.validateUnique=function(){var e=!0;return Array.from(this.parentElement.childNodes).forEach(function(t){e&&Object.hasOwnProperty.call(t,"__WATERMARK__")&&(e=!1)}),e},i.prototype.validateContent=function(){switch(this.options.contentType){case"image":return Object.hasOwnProperty.call(this.options,"image");case"multi-line-text":case"rich-text":case"text":return this.options.content.length>0}},i.prototype.checkParentElementType=function(){return["html","body"].includes(this.parentElement.tagName.toLocaleLowerCase())?"root":"custom"},i.prototype.bindMutationObserve=function(){var e=this;this.watermarkDom&&(this.observer=new MutationObserver(function(t){return pi(e,void 0,void 0,function(){return ti(this,function(n){switch(n.label){case 0:return t.length>0?(this.remove(),[4,this.create()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})}),this.observer.observe(this.watermarkDom,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),this.parentObserve=new MutationObserver(function(t){return pi(e,void 0,void 0,function(){var n,s,o,r;return ti(this,function(a){switch(a.label){case 0:n=0,s=t,a.label=1;case 1:return n<s.length?(o=s[n],r=Array.from(o.removedNodes).includes(this.watermarkDom),r?(this.remove(),[4,this.create()]):[3,3]):[3,4];case 2:a.sent(),a.label=3;case 3:return n++,[3,1];case 4:return[2]}})})}),this.parentObserve.observe(this.parentElement,{childList:!0}))},i})();(function(i){lR(e,i);function e(t){t===void 0&&(t={});var n={globalAlpha:.005,mode:"blind"};return i.call(this,Fi(Fi({},t),n))||this}return e.prototype.changeOptions=function(){return pi(this,arguments,void 0,function(t,n,s){return t===void 0&&(t={}),n===void 0&&(n="overwrite"),s===void 0&&(s=!0),ti(this,function(o){switch(o.label){case 0:return t.globalAlpha=.005,t.mode="blind",this.initConfigData(t,n),bc(this.options.monitorProtection),s?(this.remove(),[4,this.create()]):[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})},e.decode=function(t){var n=t.url,s=n===void 0?"":n,o=t.fillColor,r=o===void 0?"#000":o,a=t.compositeOperation,l=a===void 0?"color-burn":a,c=t.mode,h=c===void 0?"canvas":c,u=t.compositeTimes,p=u===void 0?3:u,f=t.onSuccess;if(s&&h==="canvas"){var m=new Image;m.src=s,m.addEventListener("load",function(){var y=m.width,g=m.height,A=Kr.createCanvas(y,g),v=A.getContext("2d");if(!v)throw new Error("get context error");v.drawImage(m,0,0,y,g),v.globalCompositeOperation=l,v.fillStyle=r;for(var C=0;C<p;C++)v.fillRect(0,0,y,g);var w=Rm(A);Fm(f)&&f?.(w)})}},e})(Vm);const bR=Object.freeze(Object.defineProperty({__proto__:null,Watermark:Vm},Symbol.toStringTag,{value:"Module"}));function Ne(i,e){this.x=i,this.y=e}Ne.prototype={clone(){return new Ne(this.x,this.y)},add(i){return this.clone()._add(i)},sub(i){return this.clone()._sub(i)},multByPoint(i){return this.clone()._multByPoint(i)},divByPoint(i){return this.clone()._divByPoint(i)},mult(i){return this.clone()._mult(i)},div(i){return this.clone()._div(i)},rotate(i){return this.clone()._rotate(i)},rotateAround(i,e){return this.clone()._rotateAround(i,e)},matMult(i){return this.clone()._matMult(i)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(i){return this.x===i.x&&this.y===i.y},dist(i){return Math.sqrt(this.distSqr(i))},distSqr(i){const e=i.x-this.x,t=i.y-this.y;return e*e+t*t},angle(){return Math.atan2(this.y,this.x)},angleTo(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith(i){return this.angleWithSep(i.x,i.y)},angleWithSep(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult(i){const e=i[0]*this.x+i[1]*this.y,t=i[2]*this.x+i[3]*this.y;return this.x=e,this.y=t,this},_add(i){return this.x+=i.x,this.y+=i.y,this},_sub(i){return this.x-=i.x,this.y-=i.y,this},_mult(i){return this.x*=i,this.y*=i,this},_div(i){return this.x/=i,this.y/=i,this},_multByPoint(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint(i){return this.x/=i.x,this.y/=i.y,this},_unit(){return this._div(this.mag()),this},_perp(){const i=this.y;return this.y=this.x,this.x=-i,this},_rotate(i){const e=Math.cos(i),t=Math.sin(i),n=e*this.x-t*this.y,s=t*this.x+e*this.y;return this.x=n,this.y=s,this},_rotateAround(i,e){const t=Math.cos(i),n=Math.sin(i),s=e.x+t*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+t*(this.y-e.y);return this.x=s,this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ne},Ne.convert=function(i){if(i instanceof Ne)return i;if(Array.isArray(i))return new Ne(+i[0],+i[1]);if(i.x!==void 0&&i.y!==void 0)return new Ne(+i.x,+i.y);throw new Error("Expected [x, y] or {x, y} point format")};class Yn{constructor(e,t,n,s,o){for(this.properties=Object.create(null),this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=s,this._values=o;e.pos<t;){const r=e.readVarint();if(r===8)this.id=e.readVarint();else if(r===18){const a=e.readVarint()+e.pos;for(;e.pos<a;){const l=s[e.readVarint()],c=o[e.readVarint()];this.properties[l]=c}}else r===24?this.type=e.readVarint():(r===34&&(this._geometry=e.pos),e.skip(r))}}loadGeometry(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,n=[];let s,o=1,r=0,a=0,l=0;for(;e.pos<t;){if(r<=0){const c=e.readVarint();if(o=c&7,r=c>>3,r===0)continue}if(r--,o===1)a+=e.readSVarint(),l+=e.readSVarint(),s&&n.push(s),s=[new Ne(a,l)];else if(o===2)a+=e.readSVarint(),l+=e.readSVarint(),s&&s.push(new Ne(a,l));else if(o===7)s&&s.push(s[0].clone());else throw new Error(`unknown command ${o}`)}return s&&n.push(s),n}bbox(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let n=1,s=0,o=0,r=0,a=1/0,l=-1/0,c=1/0,h=-1/0;for(;e.pos<t;){if(s<=0){const u=e.readVarint();if(n=u&7,s=u>>3,s===0)continue}if(s--,n===1||n===2)o+=e.readSVarint(),r+=e.readSVarint(),o<a&&(a=o),o>l&&(l=o),r<c&&(c=r),r>h&&(h=r);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,c,l,h]}toGeoJSON(e,t,n){const s=this.extent*Math.pow(2,n),o=this.extent*e,r=this.extent*t,a=this.loadGeometry();function l(p){return[(p.x+o)*360/s-180,360/Math.PI*Math.atan(Math.exp((1-(p.y+r)*2/s)*Math.PI))-90]}function c(p){return p.map(l)}let h;if(this.type===1){const p=[];for(const m of a)p.push(m[0]);const f=c(p);h=p.length===1?{type:"Point",coordinates:f[0]}:{type:"MultiPoint",coordinates:f}}else if(this.type===2){const p=a.map(c);h=p.length===1?{type:"LineString",coordinates:p[0]}:{type:"MultiLineString",coordinates:p}}else if(this.type===3){const p=Qm(a),f=[];for(const m of p)f.push(m.map(c));h=f.length===1?{type:"Polygon",coordinates:f[0]}:{type:"MultiPolygon",coordinates:f}}else throw new Error("unknown feature type");const u={type:"Feature",geometry:h,properties:this.properties};return this.id!=null&&(u.id=this.id),u}}Yn.types=["Unknown","Point","LineString","Polygon"];function Qm(i){const e=i.length;if(e<=1)return[i];const t=[];let n,s;for(let o=0;o<e;o++){const r=CR(i[o]);r!==0&&(s===void 0&&(s=r<0),s===r<0?(n&&t.push(n),n=[i[o]]):n&&n.push(i[o]))}return n&&t.push(n),t}function CR(i){let e=0;for(let t=0,n=i.length,s=n-1,o,r;t<n;s=t++)o=i[t],r=i[s],e+=(r.x-o.x)*(o.y+r.y);return e}class wR{constructor(e,t){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],t===void 0&&(t=e.length);e.pos<t;){const n=e.readVarint();n===10?this.name=e.readString():n===18?(this._features.push(e.pos),e.skip(n)):n===26?this._keys.push(e.readString()):n===34?this._values.push(ER(e)):n===40?this.extent=e.readVarint():n===120?this.version=e.readVarint():e.skip(n)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Yn(this._pbf,t,this.extent,this._keys,this._values)}}function ER(i){let e=null;const t=i.readVarint()+i.pos;for(;i.pos<t;){const n=i.readVarint();e=n===10?i.readString():n===21?i.readFloat():n===25?i.readDouble():n===32?i.readVarint64():n===40?i.readVarint():n===48?i.readSVarint():n===56?i.readBoolean():(i.skip(n),null)}if(e==null)throw new Error("unknown feature value");return e}class xR{constructor(e,t=e.length){const n=Object.create(null);for(;e.pos<t;){const s=e.readVarint();if(s===26){const o=new wR(e,e.readVarint()+e.pos);o.length&&(n[o.name]=o)}else e.skip(s)}this.layers=n}}class Cc{constructor(e,t=""){this.type=e.type,this.styleSource=e,this.path=t,this.errorEvent=new Cesium.Event}async init(){}requestTile(e,t,n){}destroy(){this.styleSource=null,this.errorEvent=null}}const wc={};function Ec(i,e){wc[i]=e}class $n{constructor(e,t,n){this._name=e,this.dataBuffer=t,typeof n=="number"?this._size=n:(this.nullabilityBuffer=n,this._size=n.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Xr extends $n{}class xc extends Xr{getValueFromBuffer(e){return this.dataBuffer[e]}}class Ic extends Xr{getValueFromBuffer(e){return this.dataBuffer[e]}}class zm extends $n{constructor(e,t,n,s){super(e,t,s),this.delta=n}}class Sc extends zm{constructor(e,t,n,s){super(e,Int32Array.of(t),n,s)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class Mc extends $n{constructor(e,t,n,s){super(e,s?Int32Array.of(t):Uint32Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}class IR{constructor(e,t,n,s,o=4096){if(this._name=e,this._geometryVector=t,this._idVector=n,this._propertyVectors=s,this._extent=o,e.length===0)throw new Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(t=>[t.name,t]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],t=this.geometryVector.getGeometries();for(let n=0;n<this.numFeatures;n++){let s;if(this.idVector){const a=this.idVector.getValue(n);s=this.containsMaxSafeIntegerValues(this.idVector)&&a!==null?Number(a):a}const o={coordinates:t[n],type:this.geometryVector.geometryType(n)},r={};for(const a of this.propertyVectors){if(!a)continue;const l=a.name,c=a.getValue(n);c!==null&&(r[l]=c)}e.push({id:s,geometry:o,properties:r})}return e}containsMaxSafeIntegerValues(e){return e instanceof xc||e instanceof Mc||e instanceof Sc||e instanceof Ic}}const Jr={FEATURE:0},ge={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},po={GEOMETRY:0,STRUCT:1},Tc={ID:0};class Hm{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var re;(function(i){i.NONE="NONE",i.DELTA="DELTA",i.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",i.RLE="RLE",i.MORTON="MORTON",i.PDE="PDE"})(re||(re={}));var ii;(function(i){i.NONE="NONE",i.FAST_PFOR="FAST_PFOR",i.VARINT="VARINT"})(ii||(ii={}));const Bc=new Uint32Array(33);Bc[0]=0;for(let i=1;i<=32;i++)Bc[i]=i===32?4294967295:4294967295>>>32-i;const _c=Bc,Ym=65536,Yt=256;function kc(i,e){return i-i%e}function SR(i){return kc(i+31,32)}function MR(i){if(!Number.isFinite(i)||i<=0)return Ym;const e=kc(Math.floor(i),Yt);return e===0?Yt:e}function TR(i){const e=i>>>0;return((e&255)<<24|(e&65280)<<8|e>>>8&65280|e>>>24&255)>>>0}function BR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0;t[s++]=o>>>0&3,t[s++]=o>>>2&3,t[s++]=o>>>4&3,t[s++]=o>>>6&3,t[s++]=o>>>8&3,t[s++]=o>>>10&3,t[s++]=o>>>12&3,t[s++]=o>>>14&3,t[s++]=o>>>16&3,t[s++]=o>>>18&3,t[s++]=o>>>20&3,t[s++]=o>>>22&3,t[s++]=o>>>24&3,t[s++]=o>>>26&3,t[s++]=o>>>28&3,t[s++]=o>>>30&3,t[s++]=r>>>0&3,t[s++]=r>>>2&3,t[s++]=r>>>4&3,t[s++]=r>>>6&3,t[s++]=r>>>8&3,t[s++]=r>>>10&3,t[s++]=r>>>12&3,t[s++]=r>>>14&3,t[s++]=r>>>16&3,t[s++]=r>>>18&3,t[s++]=r>>>20&3,t[s++]=r>>>22&3,t[s++]=r>>>24&3,t[s++]=r>>>26&3,t[s++]=r>>>28&3,t[s]=r>>>30&3}function _R(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0;t[s++]=o>>>0&7,t[s++]=o>>>3&7,t[s++]=o>>>6&7,t[s++]=o>>>9&7,t[s++]=o>>>12&7,t[s++]=o>>>15&7,t[s++]=o>>>18&7,t[s++]=o>>>21&7,t[s++]=o>>>24&7,t[s++]=o>>>27&7,t[s++]=(o>>>30|(r&1)<<2)&7,t[s++]=r>>>1&7,t[s++]=r>>>4&7,t[s++]=r>>>7&7,t[s++]=r>>>10&7,t[s++]=r>>>13&7,t[s++]=r>>>16&7,t[s++]=r>>>19&7,t[s++]=r>>>22&7,t[s++]=r>>>25&7,t[s++]=r>>>28&7,t[s++]=(r>>>31|(a&3)<<1)&7,t[s++]=a>>>2&7,t[s++]=a>>>5&7,t[s++]=a>>>8&7,t[s++]=a>>>11&7,t[s++]=a>>>14&7,t[s++]=a>>>17&7,t[s++]=a>>>20&7,t[s++]=a>>>23&7,t[s++]=a>>>26&7,t[s]=a>>>29&7}function kR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0;t[s++]=o>>>0&15,t[s++]=o>>>4&15,t[s++]=o>>>8&15,t[s++]=o>>>12&15,t[s++]=o>>>16&15,t[s++]=o>>>20&15,t[s++]=o>>>24&15,t[s++]=o>>>28&15,t[s++]=r>>>0&15,t[s++]=r>>>4&15,t[s++]=r>>>8&15,t[s++]=r>>>12&15,t[s++]=r>>>16&15,t[s++]=r>>>20&15,t[s++]=r>>>24&15,t[s++]=r>>>28&15,t[s++]=a>>>0&15,t[s++]=a>>>4&15,t[s++]=a>>>8&15,t[s++]=a>>>12&15,t[s++]=a>>>16&15,t[s++]=a>>>20&15,t[s++]=a>>>24&15,t[s++]=a>>>28&15,t[s++]=l>>>0&15,t[s++]=l>>>4&15,t[s++]=l>>>8&15,t[s++]=l>>>12&15,t[s++]=l>>>16&15,t[s++]=l>>>20&15,t[s++]=l>>>24&15,t[s]=l>>>28&15}function PR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0;t[s++]=o>>>0&31,t[s++]=o>>>5&31,t[s++]=o>>>10&31,t[s++]=o>>>15&31,t[s++]=o>>>20&31,t[s++]=o>>>25&31,t[s++]=(o>>>30|(r&7)<<2)&31,t[s++]=r>>>3&31,t[s++]=r>>>8&31,t[s++]=r>>>13&31,t[s++]=r>>>18&31,t[s++]=r>>>23&31,t[s++]=(r>>>28|(a&1)<<4)&31,t[s++]=a>>>1&31,t[s++]=a>>>6&31,t[s++]=a>>>11&31,t[s++]=a>>>16&31,t[s++]=a>>>21&31,t[s++]=a>>>26&31,t[s++]=(a>>>31|(l&15)<<1)&31,t[s++]=l>>>4&31,t[s++]=l>>>9&31,t[s++]=l>>>14&31,t[s++]=l>>>19&31,t[s++]=l>>>24&31,t[s++]=(l>>>29|(c&3)<<3)&31,t[s++]=c>>>2&31,t[s++]=c>>>7&31,t[s++]=c>>>12&31,t[s++]=c>>>17&31,t[s++]=c>>>22&31,t[s]=c>>>27&31}function DR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0;t[s++]=o>>>0&63,t[s++]=o>>>6&63,t[s++]=o>>>12&63,t[s++]=o>>>18&63,t[s++]=o>>>24&63,t[s++]=(o>>>30|(r&15)<<2)&63,t[s++]=r>>>4&63,t[s++]=r>>>10&63,t[s++]=r>>>16&63,t[s++]=r>>>22&63,t[s++]=(r>>>28|(a&3)<<4)&63,t[s++]=a>>>2&63,t[s++]=a>>>8&63,t[s++]=a>>>14&63,t[s++]=a>>>20&63,t[s++]=a>>>26&63,t[s++]=l>>>0&63,t[s++]=l>>>6&63,t[s++]=l>>>12&63,t[s++]=l>>>18&63,t[s++]=l>>>24&63,t[s++]=(l>>>30|(c&15)<<2)&63,t[s++]=c>>>4&63,t[s++]=c>>>10&63,t[s++]=c>>>16&63,t[s++]=c>>>22&63,t[s++]=(c>>>28|(h&3)<<4)&63,t[s++]=h>>>2&63,t[s++]=h>>>8&63,t[s++]=h>>>14&63,t[s++]=h>>>20&63,t[s]=h>>>26&63}function NR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0;t[s++]=o>>>0&127,t[s++]=o>>>7&127,t[s++]=o>>>14&127,t[s++]=o>>>21&127,t[s++]=(o>>>28|(r&7)<<4)&127,t[s++]=r>>>3&127,t[s++]=r>>>10&127,t[s++]=r>>>17&127,t[s++]=r>>>24&127,t[s++]=(r>>>31|(a&63)<<1)&127,t[s++]=a>>>6&127,t[s++]=a>>>13&127,t[s++]=a>>>20&127,t[s++]=(a>>>27|(l&3)<<5)&127,t[s++]=l>>>2&127,t[s++]=l>>>9&127,t[s++]=l>>>16&127,t[s++]=l>>>23&127,t[s++]=(l>>>30|(c&31)<<2)&127,t[s++]=c>>>5&127,t[s++]=c>>>12&127,t[s++]=c>>>19&127,t[s++]=(c>>>26|(h&1)<<6)&127,t[s++]=h>>>1&127,t[s++]=h>>>8&127,t[s++]=h>>>15&127,t[s++]=h>>>22&127,t[s++]=(h>>>29|(u&15)<<3)&127,t[s++]=u>>>4&127,t[s++]=u>>>11&127,t[s++]=u>>>18&127,t[s]=u>>>25&127}function LR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0;t[s++]=o>>>0&255,t[s++]=o>>>8&255,t[s++]=o>>>16&255,t[s++]=o>>>24&255,t[s++]=r>>>0&255,t[s++]=r>>>8&255,t[s++]=r>>>16&255,t[s++]=r>>>24&255,t[s++]=a>>>0&255,t[s++]=a>>>8&255,t[s++]=a>>>16&255,t[s++]=a>>>24&255,t[s++]=l>>>0&255,t[s++]=l>>>8&255,t[s++]=l>>>16&255,t[s++]=l>>>24&255,t[s++]=c>>>0&255,t[s++]=c>>>8&255,t[s++]=c>>>16&255,t[s++]=c>>>24&255,t[s++]=h>>>0&255,t[s++]=h>>>8&255,t[s++]=h>>>16&255,t[s++]=h>>>24&255,t[s++]=u>>>0&255,t[s++]=u>>>8&255,t[s++]=u>>>16&255,t[s++]=u>>>24&255,t[s++]=p>>>0&255,t[s++]=p>>>8&255,t[s++]=p>>>16&255,t[s]=p>>>24&255}function RR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0;t[s++]=o>>>0&511,t[s++]=o>>>9&511,t[s++]=o>>>18&511,t[s++]=(o>>>27|(r&15)<<5)&511,t[s++]=r>>>4&511,t[s++]=r>>>13&511,t[s++]=r>>>22&511,t[s++]=(r>>>31|(a&255)<<1)&511,t[s++]=a>>>8&511,t[s++]=a>>>17&511,t[s++]=(a>>>26|(l&7)<<6)&511,t[s++]=l>>>3&511,t[s++]=l>>>12&511,t[s++]=l>>>21&511,t[s++]=(l>>>30|(c&127)<<2)&511,t[s++]=c>>>7&511,t[s++]=c>>>16&511,t[s++]=(c>>>25|(h&3)<<7)&511,t[s++]=h>>>2&511,t[s++]=h>>>11&511,t[s++]=h>>>20&511,t[s++]=(h>>>29|(u&63)<<3)&511,t[s++]=u>>>6&511,t[s++]=u>>>15&511,t[s++]=(u>>>24|(p&1)<<8)&511,t[s++]=p>>>1&511,t[s++]=p>>>10&511,t[s++]=p>>>19&511,t[s++]=(p>>>28|(f&31)<<4)&511,t[s++]=f>>>5&511,t[s++]=f>>>14&511,t[s]=f>>>23&511}function FR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0;t[s++]=o>>>0&1023,t[s++]=o>>>10&1023,t[s++]=o>>>20&1023,t[s++]=(o>>>30|(r&255)<<2)&1023,t[s++]=r>>>8&1023,t[s++]=r>>>18&1023,t[s++]=(r>>>28|(a&63)<<4)&1023,t[s++]=a>>>6&1023,t[s++]=a>>>16&1023,t[s++]=(a>>>26|(l&15)<<6)&1023,t[s++]=l>>>4&1023,t[s++]=l>>>14&1023,t[s++]=(l>>>24|(c&3)<<8)&1023,t[s++]=c>>>2&1023,t[s++]=c>>>12&1023,t[s++]=c>>>22&1023,t[s++]=h>>>0&1023,t[s++]=h>>>10&1023,t[s++]=h>>>20&1023,t[s++]=(h>>>30|(u&255)<<2)&1023,t[s++]=u>>>8&1023,t[s++]=u>>>18&1023,t[s++]=(u>>>28|(p&63)<<4)&1023,t[s++]=p>>>6&1023,t[s++]=p>>>16&1023,t[s++]=(p>>>26|(f&15)<<6)&1023,t[s++]=f>>>4&1023,t[s++]=f>>>14&1023,t[s++]=(f>>>24|(m&3)<<8)&1023,t[s++]=m>>>2&1023,t[s++]=m>>>12&1023,t[s]=m>>>22&1023}function OR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0,y=i[e+10]>>>0;t[s++]=o>>>0&2047,t[s++]=o>>>11&2047,t[s++]=(o>>>22|(r&1)<<10)&2047,t[s++]=r>>>1&2047,t[s++]=r>>>12&2047,t[s++]=(r>>>23|(a&3)<<9)&2047,t[s++]=a>>>2&2047,t[s++]=a>>>13&2047,t[s++]=(a>>>24|(l&7)<<8)&2047,t[s++]=l>>>3&2047,t[s++]=l>>>14&2047,t[s++]=(l>>>25|(c&15)<<7)&2047,t[s++]=c>>>4&2047,t[s++]=c>>>15&2047,t[s++]=(c>>>26|(h&31)<<6)&2047,t[s++]=h>>>5&2047,t[s++]=h>>>16&2047,t[s++]=(h>>>27|(u&63)<<5)&2047,t[s++]=u>>>6&2047,t[s++]=u>>>17&2047,t[s++]=(u>>>28|(p&127)<<4)&2047,t[s++]=p>>>7&2047,t[s++]=p>>>18&2047,t[s++]=(p>>>29|(f&255)<<3)&2047,t[s++]=f>>>8&2047,t[s++]=f>>>19&2047,t[s++]=(f>>>30|(m&511)<<2)&2047,t[s++]=m>>>9&2047,t[s++]=m>>>20&2047,t[s++]=(m>>>31|(y&1023)<<1)&2047,t[s++]=y>>>10&2047,t[s]=y>>>21&2047}function GR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0,y=i[e+10]>>>0,g=i[e+11]>>>0;t[s++]=o>>>0&4095,t[s++]=o>>>12&4095,t[s++]=(o>>>24|(r&15)<<8)&4095,t[s++]=r>>>4&4095,t[s++]=r>>>16&4095,t[s++]=(r>>>28|(a&255)<<4)&4095,t[s++]=a>>>8&4095,t[s++]=a>>>20&4095,t[s++]=l>>>0&4095,t[s++]=l>>>12&4095,t[s++]=(l>>>24|(c&15)<<8)&4095,t[s++]=c>>>4&4095,t[s++]=c>>>16&4095,t[s++]=(c>>>28|(h&255)<<4)&4095,t[s++]=h>>>8&4095,t[s++]=h>>>20&4095,t[s++]=u>>>0&4095,t[s++]=u>>>12&4095,t[s++]=(u>>>24|(p&15)<<8)&4095,t[s++]=p>>>4&4095,t[s++]=p>>>16&4095,t[s++]=(p>>>28|(f&255)<<4)&4095,t[s++]=f>>>8&4095,t[s++]=f>>>20&4095,t[s++]=m>>>0&4095,t[s++]=m>>>12&4095,t[s++]=(m>>>24|(y&15)<<8)&4095,t[s++]=y>>>4&4095,t[s++]=y>>>16&4095,t[s++]=(y>>>28|(g&255)<<4)&4095,t[s++]=g>>>8&4095,t[s]=g>>>20&4095}function UR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0,y=i[e+10]>>>0,g=i[e+11]>>>0,A=i[e+12]>>>0,v=i[e+13]>>>0,C=i[e+14]>>>0,w=i[e+15]>>>0;t[s++]=o>>>0&65535,t[s++]=o>>>16&65535,t[s++]=r>>>0&65535,t[s++]=r>>>16&65535,t[s++]=a>>>0&65535,t[s++]=a>>>16&65535,t[s++]=l>>>0&65535,t[s++]=l>>>16&65535,t[s++]=c>>>0&65535,t[s++]=c>>>16&65535,t[s++]=h>>>0&65535,t[s++]=h>>>16&65535,t[s++]=u>>>0&65535,t[s++]=u>>>16&65535,t[s++]=p>>>0&65535,t[s++]=p>>>16&65535,t[s++]=f>>>0&65535,t[s++]=f>>>16&65535,t[s++]=m>>>0&65535,t[s++]=m>>>16&65535,t[s++]=y>>>0&65535,t[s++]=y>>>16&65535,t[s++]=g>>>0&65535,t[s++]=g>>>16&65535,t[s++]=A>>>0&65535,t[s++]=A>>>16&65535,t[s++]=v>>>0&65535,t[s++]=v>>>16&65535,t[s++]=C>>>0&65535,t[s++]=C>>>16&65535,t[s++]=w>>>0&65535,t[s]=w>>>16&65535}function VR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0;t[s++]=a>>>0&1,t[s++]=a>>>1&1,t[s++]=a>>>2&1,t[s++]=a>>>3&1,t[s++]=a>>>4&1,t[s++]=a>>>5&1,t[s++]=a>>>6&1,t[s++]=a>>>7&1,t[s++]=a>>>8&1,t[s++]=a>>>9&1,t[s++]=a>>>10&1,t[s++]=a>>>11&1,t[s++]=a>>>12&1,t[s++]=a>>>13&1,t[s++]=a>>>14&1,t[s++]=a>>>15&1,t[s++]=a>>>16&1,t[s++]=a>>>17&1,t[s++]=a>>>18&1,t[s++]=a>>>19&1,t[s++]=a>>>20&1,t[s++]=a>>>21&1,t[s++]=a>>>22&1,t[s++]=a>>>23&1,t[s++]=a>>>24&1,t[s++]=a>>>25&1,t[s++]=a>>>26&1,t[s++]=a>>>27&1,t[s++]=a>>>28&1,t[s++]=a>>>29&1,t[s++]=a>>>30&1,t[s++]=a>>>31&1}}function QR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0;t[s++]=a>>>0&3,t[s++]=a>>>2&3,t[s++]=a>>>4&3,t[s++]=a>>>6&3,t[s++]=a>>>8&3,t[s++]=a>>>10&3,t[s++]=a>>>12&3,t[s++]=a>>>14&3,t[s++]=a>>>16&3,t[s++]=a>>>18&3,t[s++]=a>>>20&3,t[s++]=a>>>22&3,t[s++]=a>>>24&3,t[s++]=a>>>26&3,t[s++]=a>>>28&3,t[s++]=a>>>30&3,t[s++]=l>>>0&3,t[s++]=l>>>2&3,t[s++]=l>>>4&3,t[s++]=l>>>6&3,t[s++]=l>>>8&3,t[s++]=l>>>10&3,t[s++]=l>>>12&3,t[s++]=l>>>14&3,t[s++]=l>>>16&3,t[s++]=l>>>18&3,t[s++]=l>>>20&3,t[s++]=l>>>22&3,t[s++]=l>>>24&3,t[s++]=l>>>26&3,t[s++]=l>>>28&3,t[s++]=l>>>30&3}}function zR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0;t[s++]=a>>>0&7,t[s++]=a>>>3&7,t[s++]=a>>>6&7,t[s++]=a>>>9&7,t[s++]=a>>>12&7,t[s++]=a>>>15&7,t[s++]=a>>>18&7,t[s++]=a>>>21&7,t[s++]=a>>>24&7,t[s++]=a>>>27&7,t[s++]=(a>>>30|(l&1)<<2)&7,t[s++]=l>>>1&7,t[s++]=l>>>4&7,t[s++]=l>>>7&7,t[s++]=l>>>10&7,t[s++]=l>>>13&7,t[s++]=l>>>16&7,t[s++]=l>>>19&7,t[s++]=l>>>22&7,t[s++]=l>>>25&7,t[s++]=l>>>28&7,t[s++]=(l>>>31|(c&3)<<1)&7,t[s++]=c>>>2&7,t[s++]=c>>>5&7,t[s++]=c>>>8&7,t[s++]=c>>>11&7,t[s++]=c>>>14&7,t[s++]=c>>>17&7,t[s++]=c>>>20&7,t[s++]=c>>>23&7,t[s++]=c>>>26&7,t[s++]=c>>>29&7}}function HR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0;t[s++]=a>>>0&15,t[s++]=a>>>4&15,t[s++]=a>>>8&15,t[s++]=a>>>12&15,t[s++]=a>>>16&15,t[s++]=a>>>20&15,t[s++]=a>>>24&15,t[s++]=a>>>28&15,t[s++]=l>>>0&15,t[s++]=l>>>4&15,t[s++]=l>>>8&15,t[s++]=l>>>12&15,t[s++]=l>>>16&15,t[s++]=l>>>20&15,t[s++]=l>>>24&15,t[s++]=l>>>28&15,t[s++]=c>>>0&15,t[s++]=c>>>4&15,t[s++]=c>>>8&15,t[s++]=c>>>12&15,t[s++]=c>>>16&15,t[s++]=c>>>20&15,t[s++]=c>>>24&15,t[s++]=c>>>28&15,t[s++]=h>>>0&15,t[s++]=h>>>4&15,t[s++]=h>>>8&15,t[s++]=h>>>12&15,t[s++]=h>>>16&15,t[s++]=h>>>20&15,t[s++]=h>>>24&15,t[s++]=h>>>28&15}}function YR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0;t[s++]=a>>>0&31,t[s++]=a>>>5&31,t[s++]=a>>>10&31,t[s++]=a>>>15&31,t[s++]=a>>>20&31,t[s++]=a>>>25&31,t[s++]=(a>>>30|(l&7)<<2)&31,t[s++]=l>>>3&31,t[s++]=l>>>8&31,t[s++]=l>>>13&31,t[s++]=l>>>18&31,t[s++]=l>>>23&31,t[s++]=(l>>>28|(c&1)<<4)&31,t[s++]=c>>>1&31,t[s++]=c>>>6&31,t[s++]=c>>>11&31,t[s++]=c>>>16&31,t[s++]=c>>>21&31,t[s++]=c>>>26&31,t[s++]=(c>>>31|(h&15)<<1)&31,t[s++]=h>>>4&31,t[s++]=h>>>9&31,t[s++]=h>>>14&31,t[s++]=h>>>19&31,t[s++]=h>>>24&31,t[s++]=(h>>>29|(u&3)<<3)&31,t[s++]=u>>>2&31,t[s++]=u>>>7&31,t[s++]=u>>>12&31,t[s++]=u>>>17&31,t[s++]=u>>>22&31,t[s++]=u>>>27&31}}function $R(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0,p=i[o++]>>>0;t[s++]=a>>>0&63,t[s++]=a>>>6&63,t[s++]=a>>>12&63,t[s++]=a>>>18&63,t[s++]=a>>>24&63,t[s++]=(a>>>30|(l&15)<<2)&63,t[s++]=l>>>4&63,t[s++]=l>>>10&63,t[s++]=l>>>16&63,t[s++]=l>>>22&63,t[s++]=(l>>>28|(c&3)<<4)&63,t[s++]=c>>>2&63,t[s++]=c>>>8&63,t[s++]=c>>>14&63,t[s++]=c>>>20&63,t[s++]=c>>>26&63,t[s++]=h>>>0&63,t[s++]=h>>>6&63,t[s++]=h>>>12&63,t[s++]=h>>>18&63,t[s++]=h>>>24&63,t[s++]=(h>>>30|(u&15)<<2)&63,t[s++]=u>>>4&63,t[s++]=u>>>10&63,t[s++]=u>>>16&63,t[s++]=u>>>22&63,t[s++]=(u>>>28|(p&3)<<4)&63,t[s++]=p>>>2&63,t[s++]=p>>>8&63,t[s++]=p>>>14&63,t[s++]=p>>>20&63,t[s++]=p>>>26&63}}function jR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0,p=i[o++]>>>0,f=i[o++]>>>0;t[s++]=a>>>0&127,t[s++]=a>>>7&127,t[s++]=a>>>14&127,t[s++]=a>>>21&127,t[s++]=(a>>>28|(l&7)<<4)&127,t[s++]=l>>>3&127,t[s++]=l>>>10&127,t[s++]=l>>>17&127,t[s++]=l>>>24&127,t[s++]=(l>>>31|(c&63)<<1)&127,t[s++]=c>>>6&127,t[s++]=c>>>13&127,t[s++]=c>>>20&127,t[s++]=(c>>>27|(h&3)<<5)&127,t[s++]=h>>>2&127,t[s++]=h>>>9&127,t[s++]=h>>>16&127,t[s++]=h>>>23&127,t[s++]=(h>>>30|(u&31)<<2)&127,t[s++]=u>>>5&127,t[s++]=u>>>12&127,t[s++]=u>>>19&127,t[s++]=(u>>>26|(p&1)<<6)&127,t[s++]=p>>>1&127,t[s++]=p>>>8&127,t[s++]=p>>>15&127,t[s++]=p>>>22&127,t[s++]=(p>>>29|(f&15)<<3)&127,t[s++]=f>>>4&127,t[s++]=f>>>11&127,t[s++]=f>>>18&127,t[s++]=f>>>25&127}}function WR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0,p=i[o++]>>>0,f=i[o++]>>>0,m=i[o++]>>>0;t[s++]=a>>>0&255,t[s++]=a>>>8&255,t[s++]=a>>>16&255,t[s++]=a>>>24&255,t[s++]=l>>>0&255,t[s++]=l>>>8&255,t[s++]=l>>>16&255,t[s++]=l>>>24&255,t[s++]=c>>>0&255,t[s++]=c>>>8&255,t[s++]=c>>>16&255,t[s++]=c>>>24&255,t[s++]=h>>>0&255,t[s++]=h>>>8&255,t[s++]=h>>>16&255,t[s++]=h>>>24&255,t[s++]=u>>>0&255,t[s++]=u>>>8&255,t[s++]=u>>>16&255,t[s++]=u>>>24&255,t[s++]=p>>>0&255,t[s++]=p>>>8&255,t[s++]=p>>>16&255,t[s++]=p>>>24&255,t[s++]=f>>>0&255,t[s++]=f>>>8&255,t[s++]=f>>>16&255,t[s++]=f>>>24&255,t[s++]=m>>>0&255,t[s++]=m>>>8&255,t[s++]=m>>>16&255,t[s++]=m>>>24&255}}function qR(i,e,t,n){let s=n,o=e;for(let r=0;r<128;r++){const a=i[o++]>>>0;t[s++]=a&65535,t[s++]=a>>>16&65535}}function KR(i,e,t,n,s){const o=_c[s]>>>0;let r=e,a=0,l=i[r]>>>0,c=n;for(let h=0;h<8;h++){for(let u=0;u<32;u++)if(a+s<=32){const p=l>>>a&o;t[c+u]=p|0,a+=s,a===32&&(a=0,r++,u!==31&&(l=i[r]>>>0))}else{const p=32-a,f=l>>>a;r++,l=i[r]>>>0;const m=s-p,y=-1>>>32-m>>>0,g=l&y,A=(f|g<<p)&o;t[c+u]=A|0,a=m}c+=32,a=0,h<7&&(l=i[r]>>>0)}}const cn=32,Pc=cn+1,Dc=MR(Ym),XR=3*Dc/Yt+Dc|0;function $m(){const i=new Uint8Array(XR);return{dataToBePacked:new Array(Pc),dataPointers:new Int32Array(Pc),byteContainer:i,byteContainerI32:new Int32Array(i.buffer,i.byteOffset,i.byteLength>>>2),exceptionSizes:new Int32Array(Pc)}}function JR(i=16){if(i<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${i}`);const e=Math.max(16,i|0);return{encodedWords:new Uint32Array(e),decoderWorkspace:$m()}}function ZR(i,e){if(e<=i.encodedWords.length)return i.encodedWords;const t=new Uint32Array(Math.max(16,e*2));return i.encodedWords=t,t}function eF(i,e,t,n){n.byteContainer.length<t&&(n.byteContainer=new Uint8Array(t*2),n.byteContainerI32=void 0);const s=n.byteContainer,o=t>>>2;if((s.byteOffset&3)===0){let a=n.byteContainerI32;(!a||a.buffer!==s.buffer||a.byteOffset!==s.byteOffset||a.length<o)&&(a=n.byteContainerI32=new Int32Array(s.buffer,s.byteOffset,s.byteLength>>>2)),a.set(i.subarray(e,e+o))}else for(let a=0;a<o;a=a+1|0){const l=i[e+a|0]|0,c=a<<2;s[c]=l&255,s[c+1|0]=l>>>8&255,s[c+2|0]=l>>>16&255,s[c+3|0]=l>>>24&255}const r=t&3;if(r>0){const a=e+o|0,l=i[a]|0,c=o<<2;for(let h=0;h<r;h=h+1|0)s[c+h|0]=l>>>(h<<3)&255}return s}function tF(i,e,t){const n=i[e++]|0,s=t.dataToBePacked;for(let o=2;o<=cn;o=o+1|0){if((n>>>o-1&1)===0)continue;if(e>=i.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${o}, streamWordIndex=${e}, needWords=1, availableWords=${i.length-e}, encodedWords=${i.length})`);const r=i[e++]>>>0,a=SR(r),l=r*o+31>>>5;if(e+l>i.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${o}, size=${r}, streamWordIndex=${e}, needWords=${l}, availableWords=${i.length-e}, encodedWords=${i.length})`);let c=s[o];(!c||c.length<a)&&(c=s[o]=new Uint32Array(a));let h=0;for(;h<r;h=h+32|0)hF(i,e,c,h,o),e=e+o|0;const u=h-r|0;e=e-(u*o>>>5)|0,t.exceptionSizes[o]=r}return e}function iF(i,e,t,n,s){switch(s){case 1:VR(i,e,t,n);break;case 2:QR(i,e,t,n);break;case 3:zR(i,e,t,n);break;case 4:HR(i,e,t,n);break;case 5:YR(i,e,t,n);break;case 6:$R(i,e,t,n);break;case 7:jR(i,e,t,n);break;case 8:WR(i,e,t,n);break;case 16:qR(i,e,t,n);break;default:KR(i,e,t,n,s);break}return e+(s<<3)|0}function nF(i,e,t,n){if(t+2>e)throw new Error(`FastPFOR decode: byteContainer underflow at block=${n} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${t}, byteSize=${e})`);const s=i[t++],o=i[t++];if(s>cn)throw new Error(`FastPFOR decode: invalid bitWidth=${s} at block=${n} (expected 0..${cn}). This likely indicates corrupted or truncated input.`);return{bitWidth:s,exceptionCount:o,bytePosIn:t}}function sF(i,e,t,n,s,o){if(t+1>e)throw new Error(`FastPFOR decode: exception header underflow at block=${o} (need 1 byte for maxBits, bytePos=${t}, byteSize=${e})`);const r=i[t++];if(r<n||r>cn)throw new Error(`FastPFOR decode: invalid maxBits=${r} at block=${o} (bitWidth=${n}, expected ${n}..${cn})`);const a=r-n|0;if(a<1||a>cn)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${a} at block=${o} (bitWidth=${n}, maxBits=${r})`);if(t+s>e)throw new Error(`FastPFOR decode: exception positions underflow at block=${o} (need=${s}, have=${e-t})`);return{maxBits:r,exceptionBitWidth:a,bytePosIn:t}}function oF(i,e,t,n,s,o,r,a,l){const{maxBits:c,exceptionBitWidth:h,bytePosIn:u}=sF(s,o,r,t,n,l);if(r=u,h===1){const g=1<<t;for(let A=0;A<n;A=A+1|0){const v=s[r++];i[v+e|0]|=g}return r}const p=a.dataToBePacked[h];if(!p)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${t}, maxBits=${c}) at block ${l}`);const f=a.dataPointers;let m=f[h]|0;const y=a.exceptionSizes[h]|0;if(m+n>y)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${m}, need ${n}, size=${y}) at block ${l}`);for(let g=0;g<n;g=g+1|0){const A=s[r++],v=p[m++]|0;i[A+e|0]|=v<<t}return f[h]=m,r}function rF(i,e,t,n,s,o,r,a,l,c){let h=t|0,u=0;for(let p=0;p<r;p=p+1|0){const f=nF(a,l,u,p);u=f.bytePosIn;const m=f.bitWidth,y=f.exceptionCount,g=o+p*Yt|0;switch(m){case 0:s.fill(0,g,g+Yt);break;case 32:for(let A=0;A<Yt;A=A+1|0)s[g+A|0]=i[h+A|0]|0;h=h+Yt|0;break;default:h=iF(i,h,s,g,m);break}y>0&&(u=oF(s,g,m,y,a,l,u,c,p))}if(h!==n)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${t}, consumedPackedEnd=${h}, expectedPackedEnd=${n}, packedWords=${n-t}, encoded.length=${i.length})`)}function aF(i,e,t,n,s,o){const r=t|0,a=i[r]|0;if(a<=0||r+a>i.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${a} at pageStart=${r} (expected > 0 and pageStart+whereMeta < encoded.length=${i.length})`);const l=r+1|0,c=r+a|0,h=i[c]>>>0,u=h+3>>>2,p=c+1,f=p+u;if(f>=i.length)throw new Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${u}, pageStart=${r}, packedEnd=${c}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${i.length})`);const m=eF(i,p,h,o),y=h,g=tF(i,f,o);o.dataPointers.fill(0);const v=n|0,C=s/Yt|0;return rF(i,r,l,c,e,v,C,m,y,o),g}function lF(i,e,t,n,s,o){const r=kc(s,Yt),a=n+r;let l=n,c=t;for(;l!==a;){const h=Math.min(Dc,a-l);c=aF(i,e,c,l,h,o),l=l+h|0}return c}function cF(i,e,t,n,s,o){if(o===0)return e;let r=0,a=e;const l=e+t,c=s;let h=s;const u=s+o;let p=0,f=0;for(;a<l&&h<u;){const y=i[a]>>>r&255;if(r+=8,a+=r>>>5,r&=31,p|=(y&127)<<f,(y&128)!==0)n[h++]=p|0,p=0,f=0;else if(f+=7,f>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-c}/${o}, inPos=${a}, inEnd=${l})`)}if(h!==u)throw new Error(`FastPFOR VByte: truncated stream (decoded=${h-c}, expected=${o}, consumedWords=${a-e}/${t}, vbyteStart=${e}, vbyteEnd=${l})`);return a}function dF(i,e,t){let n=0,s=0;const o=new Uint32Array(e),r=t??$m();if(i.length>0){const c=i[n]|0;if(n=n+1|0,(c&Yt-1)!==0)throw new Error(`FastPFOR decode: invalid alignedLength=${c} (expected multiple of ${Yt})`);if(s+c>o.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${s}, alignedLength=${c}, out.length=${o.length})`);n=lF(i,o,n,s,c,r),s=s+c|0}const a=i.length-n|0,l=e-s|0;return cF(i,n,a,o,s,l),o}function hF(i,e,t,n,s){switch(s){case 2:BR(i,e,t,n);return;case 3:_R(i,e,t,n);return;case 4:kR(i,e,t,n);return;case 5:PR(i,e,t,n);return;case 6:DR(i,e,t,n);return;case 7:NR(i,e,t,n);return;case 8:LR(i,e,t,n);return;case 9:RR(i,e,t,n);return;case 10:FR(i,e,t,n);return;case 11:OR(i,e,t,n);return;case 12:GR(i,e,t,n);return;case 16:UR(i,e,t,n);return;case 32:for(let c=0;c<32;c=c+1|0)t[n+c|0]=i[e+c|0]|0;return}const o=_c[s]>>>0;let r=e,a=0,l=i[r]>>>0;for(let c=0;c<32;c++)if(a+s<=32){const h=l>>>a&o;t[n+c]=h|0,a+=s,a===32&&(a=0,r++,c!==31&&(l=i[r]>>>0))}else{const h=32-a,u=l>>>a;r++,l=i[r]>>>0;const p=_c[s-h]>>>0,f=l&p,m=(u|f<<h)&o;t[n+c]=m|0,a=s-h}}function uF(i,e,t,n){if(e<0||t<0||e+t>i.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${t}, bytes.length=${i.length})`);const s=Math.floor(t/4),o=t%4!==0,r=o?s+1:s;if(n.length<r)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${n.length} < ${r}`);if(s>0){const a=i.byteOffset+e;if((a&3)===0){const l=new Uint32Array(i.buffer,a,s);for(let c=0;c<s;c++)n[c]=TR(l[c])|0}else for(let l=0;l<s;l++){const c=e+l*4;n[l]=i[c]<<24|i[c+1]<<16|i[c+2]<<8|i[c+3]|0}}if(o){const a=e+s*4,l=t-s*4;let c=0;for(let h=0;h<l;h++)c|=i[a+h]<<24-h*8;n[s]=c|0}return r}function rt(i,e,t){const n=new Uint32Array(t);let s=0,o=e.get();for(let r=0;r<n.length;r++){let a=i[o++],l=a&127;if(a<128){n[s++]=l;continue}if(a=i[o++],l|=(a&127)<<7,a<128){n[s++]=l;continue}if(a=i[o++],l|=(a&127)<<14,a<128){n[s++]=l;continue}if(a=i[o++],l|=(a&127)<<21,a<128){n[s++]=l;continue}a=i[o++],l|=(a&15)<<28,n[s++]=l}return e.set(o),n}function jn(i,e,t){const n=new BigUint64Array(t);for(let s=0;s<n.length;s++)n[s]=fF(i,e);return n}function fF(i,e){let t=0n,n=0,s=e.get();for(;s<i.length;){const o=i[s++];if(t|=BigInt(o&127)<<BigInt(n),(o&128)===0)break;if(n+=7,n>=64)throw new Error("Varint too long")}return e.set(s),t}function pF(i,e,t){const n=new Float64Array(t);for(let s=0;s<t;s++)n[s]=mF(i,e);return n}function mF(i,e){let t,n;return n=i[e.get()],e.increment(),t=n&127,n<128||(n=i[e.get()],e.increment(),t|=(n&127)<<7,n<128)||(n=i[e.get()],e.increment(),t|=(n&127)<<14,n<128)||(n=i[e.get()],e.increment(),t|=(n&127)<<21,n<128)?t:(n=i[e.get()],t|=(n&15)<<28,gF(t,i,e))}function gF(i,e,t){let n,s;if(s=e[t.get()],t.increment(),n=(s&112)>>4,s<128||(s=e[t.get()],t.increment(),n|=(s&127)<<3,s<128)||(s=e[t.get()],t.increment(),n|=(s&127)<<10,s<128)||(s=e[t.get()],t.increment(),n|=(s&127)<<17,s<128)||(s=e[t.get()],t.increment(),n|=(s&127)<<24,s<128)||(s=e[t.get()],t.increment(),n|=(s&1)<<31,s<128))return n*4294967296+(i>>>0);throw new Error("Expected varint not more than 10 bytes")}function yF(i,e,t,n){const s=JR(t>>>2);return AF(i,e,t,n,s)}function AF(i,e,t,n,s){const o=n.get();if((t&3)!==0)throw new Error(`FastPFOR: invalid encodedByteLength=${t} at offset=${o} (encodedBytes.length=${i.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);const r=t>>>2,a=ZR(s,r);uF(i,o,t,a);const l=dF(a.subarray(0,r),e,s.decoderWorkspace);return n.add(t),l}function ye(i){return i>>>1^-(i&1)}function at(i){return i>>1n^-(i&1n)}function dn(i){return i%2===1?(i+1)/-2:i/2}function vF(i){const e=new Int32Array(i.length);for(let t=0;t<i.length;t++)e[t]=ye(i[t]);return e}function bF(i){const e=new BigInt64Array(i.length);for(let t=0;t<i.length;t++)e[t]=at(i[t]);return e}function Nc(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=i[o]}const n=new Uint32Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o],a=i[o+e];n.fill(a,s,s+r),s+=r}return n}function Lc(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=Number(i[o])}const n=new BigUint64Array(t);let s=0;for(let o=0;o<e;o++){const r=Number(i[o]),a=i[o+e];n.fill(a,s,s+r),s+=r}return n}function jm(i,e,t){const n=new Float64Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o],a=i[o+e];n.fill(a,s,s+r),s+=r}return n}function Wm(i){const e=new Int32Array(i.length);e[0]=ye(i[0]);const t=i.length/4*4;let n=1;if(t>=4)for(;n<t-4;n+=4){const s=i[n],o=i[n+1],r=i[n+2],a=i[n+3];e[n]=ye(s)+e[n-1],e[n+1]=ye(o)+e[n],e[n+2]=ye(r)+e[n+1],e[n+3]=ye(a)+e[n+2]}for(;n!==i.length;++n)e[n]=ye(i[n])+e[n-1];return e}function qm(i){const e=new BigInt64Array(i.length);e[0]=at(i[0]);const t=i.length/4*4;let n=1;if(t>=4)for(;n<t-4;n+=4){const s=i[n],o=i[n+1],r=i[n+2],a=i[n+3];e[n]=at(s)+e[n-1],e[n+1]=at(o)+e[n],e[n+2]=at(r)+e[n+1],e[n+3]=at(a)+e[n+2]}for(;n!==e.length;++n)e[n]=at(i[n])+e[n-1];return e}function CF(i){i[0]=dn(i[0]);const e=i.length/4*4;let t=1;if(e>=4)for(;t<e-4;t+=4){const n=i[t],s=i[t+1],o=i[t+2],r=i[t+3];i[t]=dn(n)+i[t-1],i[t+1]=dn(s)+i[t],i[t+2]=dn(o)+i[t+1],i[t+3]=dn(r)+i[t+2]}for(;t!==i.length;++t)i[t]=dn(i[t])+i[t-1]}function wF(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=i[o]}const n=new Int32Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o];let a=i[o+e];a=ye(a),n.fill(a,s,s+r),s+=r}return n}function EF(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=Number(i[o])}const n=new BigInt64Array(t);let s=0;for(let o=0;o<e;o++){const r=Number(i[o]);let a=i[o+e];a=at(a),n.fill(a,s,s+r),s+=r}return n}function xF(i,e,t){const n=new Float64Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o];let a=i[o+e];a=dn(a),n.fill(a,s,s+r),s+=r}return n}function Rc(i){const e=i.length/4*4;let t=1;if(e>=4)for(let n=i[0];t<e-4;t+=4)n=i[t]+=n,n=i[t+1]+=n,n=i[t+2]+=n,n=i[t+3]+=n;for(;t!==i.length;)i[t]+=i[t-1],++t}function IF(i){let e=0;for(let t=0;t<i.length;t++)i[t]+=e,e=i[t]}function SF(i){if(i.length<2)return new Int32Array(i);const e=new Int32Array(i.length);e[0]=ye(i[0]),e[1]=ye(i[1]);const t=i.length/4*4;let n=2;if(t>=4)for(;n<t-4;n+=4){const s=i[n],o=i[n+1],r=i[n+2],a=i[n+3];e[n]=ye(s)+e[n-2],e[n+1]=ye(o)+e[n-1],e[n+2]=ye(r)+e[n],e[n+3]=ye(a)+e[n+1]}for(;n!==i.length;n+=2)e[n]=ye(i[n])+e[n-2],e[n+1]=ye(i[n+1])+e[n-1];return e}function MF(i){const e=new Int32Array(i.length+1);e[0]=0,e[1]=ye(i[0]);let t=e[1];for(let n=2;n!==e.length;++n){const s=i[n-1],o=ye(s);t+=o,e[n]=e[n-1]+t}return new Uint32Array(e)}function TF(i,e,t){const n=new Int32Array(t+1);n[0]=0;let s=1,o=n[0];for(let r=0;r<e;r++){const a=i[r];let l=i[r+e];l=ye(l);for(let c=s;c<s+a;c++)n[c]=l+o,o=n[c];s+=a}return n}function BF(i,e,t){const n=new Uint32Array(t+1);n[0]=0;let s=1,o=n[0];for(let r=0;r<e;r++){const a=i[r],l=i[r+e];for(let c=s;c<s+a;c++)n[c]=l+o,o=n[c];s+=a}return n}function _F(i,e,t){const n=new Int32Array(t);let s=0,o=0;for(let r=0;r<e;r++){const a=i[r],l=i[r+e],c=ye(l);for(let h=0;h<a;h++)o+=c,n[s++]=o}return n}function kF(i,e,t){const n=new BigInt64Array(t);let s=0,o=0n;for(let r=0;r<e;r++){const a=Number(i[r]),l=i[r+e],c=at(l);for(let h=0;h<a;h++)o+=c,n[s++]=o}return n}function Km(i){const e=new Uint32Array(i.length);e[0]=ye(i[0])>>>0;for(let t=1;t<i.length;t++)e[t]=e[t-1]+ye(i[t])>>>0;return e}function Xm(i){const e=new BigUint64Array(i.length);e[0]=BigInt.asUintN(64,at(i[0]));for(let t=1;t<i.length;t++)e[t]=BigInt.asUintN(64,e[t-1]+at(i[t]));return e}function PF(i){if(i.length<2)return new Uint32Array(i);const e=new Uint32Array(i.length);e[0]=ye(i[0])>>>0,e[1]=ye(i[1])>>>0;for(let t=2;t<i.length;t+=2)e[t]=e[t-2]+ye(i[t])>>>0,e[t+1]=e[t-1]+ye(i[t+1])>>>0;return e}function DF(i){return i[1]}function NF(i){return ye(i[1])}function LF(i){if(i.length===2){const n=ye(i[1]);return[n,n]}const e=ye(i[2]),t=ye(i[3]);return[e,t]}function RF(i){return i[1]}function FF(i){return at(i[1])}function OF(i){if(i.length===2){const n=at(i[1]);return[n,n]}const e=at(i[2]),t=at(i[3]);return[e,t]}var Ve;(function(i){i.PRESENT="PRESENT",i.DATA="DATA",i.OFFSET="OFFSET",i.LENGTH="LENGTH"})(Ve||(Ve={}));var ht;(function(i){i.NONE="NONE",i.SINGLE="SINGLE",i.SHARED="SHARED",i.VERTEX="VERTEX",i.MORTON="MORTON",i.FSST="FSST"})(ht||(ht={}));var ni;(function(i){i.VERTEX="VERTEX",i.INDEX="INDEX",i.STRING="STRING",i.KEY="KEY"})(ni||(ni={}));var je;(function(i){i.VAR_BINARY="VAR_BINARY",i.GEOMETRIES="GEOMETRIES",i.PARTS="PARTS",i.RINGS="RINGS",i.TRIANGLES="TRIANGLES",i.SYMBOL="SYMBOL",i.DICTIONARY="DICTIONARY"})(je||(je={}));const GF=[Ve.PRESENT,Ve.DATA,Ve.OFFSET,Ve.LENGTH],Jm=[re.NONE,re.DELTA,re.COMPONENTWISE_DELTA,re.RLE,re.MORTON,re.PDE],UF=[ii.NONE,ii.FAST_PFOR,ii.VARINT],VF=[ht.NONE,ht.SINGLE,ht.SHARED,ht.VERTEX,ht.MORTON,ht.FSST],QF=[ni.VERTEX,ni.INDEX,ni.STRING,ni.KEY],zF=[je.VAR_BINARY,je.GEOMETRIES,je.PARTS,je.RINGS,je.TRIANGLES,je.SYMBOL,je.DICTIONARY];function ut(i,e){const t=$F(i,e);return t.logicalLevelTechnique1===re.MORTON?HF(t,i,e):(re.RLE===t.logicalLevelTechnique1||re.RLE===t.logicalLevelTechnique2)&&ii.NONE!==t.physicalLevelTechnique?YF(t,i,e):t}function HF(i,e,t){const n=rt(e,t,2);return{physicalStreamType:i.physicalStreamType,logicalStreamType:i.logicalStreamType,logicalLevelTechnique1:i.logicalLevelTechnique1,logicalLevelTechnique2:i.logicalLevelTechnique2,physicalLevelTechnique:i.physicalLevelTechnique,numValues:i.numValues,byteLength:i.byteLength,decompressedCount:i.decompressedCount,numBits:n[0],coordinateShift:n[1]}}function YF(i,e,t){const n=rt(e,t,2);return{physicalStreamType:i.physicalStreamType,logicalStreamType:i.logicalStreamType,logicalLevelTechnique1:i.logicalLevelTechnique1,logicalLevelTechnique2:i.logicalLevelTechnique2,physicalLevelTechnique:i.physicalLevelTechnique,numValues:i.numValues,byteLength:i.byteLength,decompressedCount:n[1],runs:n[0],numRleValues:n[1]}}function $F(i,e){const t=i[e.get()],n=GF[t>>4];let s={};switch(n){case Ve.DATA:s={dictionaryType:VF[t&15]};break;case Ve.OFFSET:s={offsetType:QF[t&15]};break;case Ve.LENGTH:s={lengthType:zF[t&15]};break}e.increment();const o=i[e.get()],r=Jm[o>>5],a=Jm[o>>2&7],l=UF[o&3];e.increment();const c=rt(i,e,2),h=c[0],u=c[1];return{physicalStreamType:n,logicalStreamType:s,logicalLevelTechnique1:r,logicalLevelTechnique2:a,physicalLevelTechnique:l,numValues:h,byteLength:u,decompressedCount:h}}var we;(function(i){i[i.FLAT=0]="FLAT",i[i.CONST=1]="CONST",i[i.SEQUENCE=2]="SEQUENCE",i[i.DICTIONARY=3]="DICTIONARY",i[i.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(we||(we={}));class mi{constructor(e,t){this.values=e,this._size=t}get(e){const t=Math.floor(e/8),n=e%8;return(this.values[t]>>n&1)===1}set(e,t){const n=Math.floor(e/8),s=e%8;this.values[n]=this.values[n]|(t?1:0)<<s}getInt(e){const t=Math.floor(e/8),n=e%8;return this.values[t]>>n&1}size(){return this._size}getBuffer(){return this.values}}function Wn(i,e,t){if(!e)return i;const n=e.size(),s=i.constructor,o=new s(n);let r=0;for(let a=0;a<n;a++)o[a]=e.get(a)?i[r++]:t;return o}function jF(i,e,t){if(!t)return i;const n=t.size(),s=new mi(i,e),o=new mi(new Uint8Array(Math.ceil(n/8)),n);let r=0;for(let a=0;a<n;a++){const l=t.get(a)?s.get(r++):!1;o.set(a,l)}return o.getBuffer()}function Fc(i,e,t,n,s){const o=qn(i,e,t);return JF(o,t,n,s)}function xt(i,e,t,n,s){const o=qn(i,e,t);return ZF(o,t,n,s)}function Oi(i,e,t){const n=qn(i,e,t);return nO(n,t)}function qn(i,e,t){const n=t.physicalLevelTechnique;switch(n){case ii.FAST_PFOR:return yF(i,t.numValues,t.byteLength,e);case ii.VARINT:return rt(i,e,t.numValues);case ii.NONE:{const s=e.get(),o=t.byteLength;e.add(o);const r=i.subarray(s,e.get());return new Uint32Array(r)}default:throw new Error(`Specified physicalLevelTechnique ${n} is not supported (yet).`)}}function WF(i,e,t){const n=qn(i,e,t);return n.length===1?ye(n[0]):NF(n)}function Oc(i,e,t){const n=qn(i,e,t);return n.length===1?t.logicalLevelTechnique1===re.DELTA?ye(n[0]):n[0]:DF(n)}function Zm(i,e,t){const n=qn(i,e,t);return LF(n)}function eg(i,e,t){const n=jn(i,e,t.numValues);return OF(n)}function qF(i,e,t,n){const s=jn(i,e,t.numValues);return eO(s,t,n)}function tg(i,e,t,n){const s=jn(i,e,t.numValues);return tO(s,t,n)}function KF(i,e,t){const n=pF(i,e,t.numValues);return iO(n,t,!1)}function XF(i,e,t){const n=jn(i,e,t.numValues);return n.length===1?at(n[0]):FF(n)}function ig(i,e,t){const n=jn(i,e,t.numValues);return n.length===1?t.logicalLevelTechnique1===re.DELTA?at(n[0]):n[0]:RF(n)}function JF(i,e,t,n){let s;switch(e.logicalLevelTechnique1){case re.DELTA:if(e.logicalLevelTechnique2===re.RLE){const o=e;if(!n)return _F(i,o.runs,o.numRleValues);i=Nc(i,o.runs,o.numRleValues),s=Wm(i)}else s=Wm(i);break;case re.RLE:s=wF(i,e.runs,e.numRleValues);break;case re.MORTON:Rc(i),s=new Int32Array(i);break;case re.COMPONENTWISE_DELTA:s=SF(i);break;case re.NONE:s=vF(i);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return n?Wn(s,n,0):s}function ZF(i,e,t,n){let s;switch(e.logicalLevelTechnique1){case re.DELTA:if(e.logicalLevelTechnique2===re.RLE){const o=e,r=Nc(i,o.runs,o.numRleValues);s=Km(r)}else s=Km(i);break;case re.RLE:s=Nc(i,e.runs,e.numRleValues);break;case re.MORTON:Rc(i),s=i;break;case re.COMPONENTWISE_DELTA:s=PF(i);break;case re.NONE:s=i;break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return n?Wn(s,n,0):s}function eO(i,e,t){let n;switch(e.logicalLevelTechnique1){case re.DELTA:if(e.logicalLevelTechnique2===re.RLE){const s=e;if(!t)return kF(i,s.runs,s.numRleValues);i=Lc(i,s.runs,s.numRleValues),n=qm(i)}else n=qm(i);break;case re.RLE:n=EF(i,e.runs,e.numRleValues);break;case re.NONE:n=bF(i);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return t?Wn(n,t,0n):n}function tO(i,e,t){let n;switch(e.logicalLevelTechnique1){case re.DELTA:if(e.logicalLevelTechnique2===re.RLE){const s=e,o=Lc(i,s.runs,s.numRleValues);n=Xm(o)}else n=Xm(i);break;case re.RLE:n=Lc(i,e.runs,e.numRleValues);break;case re.NONE:n=i;break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return t?Wn(n,t,0n):n}function iO(i,e,t){switch(e.logicalLevelTechnique1){case re.DELTA:if(e.logicalLevelTechnique2===re.RLE){const n=e;i=jm(i,n.runs,n.numRleValues)}return CF(i),i;case re.RLE:return oO(i,e,t);case re.NONE:return i;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function nO(i,e){if(e.logicalLevelTechnique1===re.DELTA&&e.logicalLevelTechnique2===re.NONE)return MF(i);if(e.logicalLevelTechnique1===re.RLE&&e.logicalLevelTechnique2===re.NONE){const t=e;return BF(i,t.runs,t.numRleValues)}if(e.logicalLevelTechnique1===re.NONE&&e.logicalLevelTechnique2===re.NONE){IF(i);const t=new Uint32Array(e.numValues+1);return t[0]=0,t.set(i,1),t}if(e.logicalLevelTechnique1===re.DELTA&&e.logicalLevelTechnique2===re.RLE){const t=e,n=TF(i,t.runs,t.numRleValues);return Rc(n),new Uint32Array(n)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}function Zr(i,e,t,n,s="int32"){const o=i.logicalLevelTechnique1;if(o===re.RLE)return i.runs===1?we.CONST:we.FLAT;if(o!==re.DELTA||i.logicalLevelTechnique2!==re.RLE)return i.numValues===1?we.CONST:we.FLAT;const r=e instanceof mi?e.size():e,a=i;if(a.numRleValues!==r)return we.FLAT;if(a.runs===1)return we.SEQUENCE;if(a.runs!==2)return i.numValues===1?we.CONST:we.FLAT;const l=n.get();if(i.physicalLevelTechnique===ii.VARINT)return sO(t,n,s)?we.SEQUENCE:i.numValues===1?we.CONST:we.FLAT;const c=n.get(),h=new Int32Array(t.buffer,t.byteOffset+c,4);n.set(l);const u=2;return h[2]===u&&h[3]===u?we.SEQUENCE:i.numValues===1?we.CONST:we.FLAT}function sO(i,e,t){const n=new Hm(e.get());if(t==="int64"){const o=jn(i,n,4);return o[2]===2n&&o[3]===2n}const s=rt(i,n,4);return s[2]===2&&s[3]===2}function oO(i,e,t){return t?xF(i,e.runs,e.numRleValues):jm(i,e.runs,e.numRleValues)}class ng extends Xr{getValueFromBuffer(e){return this.dataBuffer[e]}}class sg extends zm{constructor(e,t,n,s){super(e,BigInt64Array.of(t),n,s)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function Gc(i,e,t){const n=og(i,e)-t,s=og(i>>1,e)-t;return{x:n,y:s}}function og(i,e){let t=0;for(let n=0;n<e;n++)t|=(i&1<<2*n)>>n;return t}var We;(function(i){i[i.POINT=0]="POINT",i[i.LINESTRING=1]="LINESTRING",i[i.POLYGON=2]="POLYGON",i[i.MULTIPOINT=3]="MULTIPOINT",i[i.MULTILINESTRING=4]="MULTILINESTRING",i[i.MULTIPOLYGON=5]="MULTIPOLYGON"})(We||(We={}));var rg;(function(i){i[i.POINT=0]="POINT",i[i.LINESTRING=1]="LINESTRING",i[i.POLYGON=2]="POLYGON"})(rg||(rg={}));var Gi;(function(i){i[i.MORTON=0]="MORTON",i[i.VEC_2=1]="VEC_2",i[i.VEC_3=2]="VEC_3"})(Gi||(Gi={}));function rO(i){const e=new Array(i.numGeometries);let t=1,n=1,s=1,o=0,r=0,a=0;const l=i.mortonSettings,c=i.topologyVector,h=c.geometryOffsets,u=c.partOffsets,p=c.ringOffsets,f=i.vertexOffsets,m=!f||f.length===0,y=i.containsPolygonGeometry(),g=i.vertexBuffer;for(let A=0;A<i.numGeometries;A++){const v=i.geometryType(A);switch(v){case We.POINT:{let C,w;if(m)C=g[r++],w=g[r++];else if(i.vertexBufferType===Gi.MORTON){const M=f[a++],x=g[M],I=Gc(x,l.numBits,l.coordinateShift);C=I.x,w=I.y}else{const M=f[a++]*2;C=g[M],w=g[M+1]}e[o++]=[[new Ne(C,w)]],h&&s++,u&&t++,p&&n++}break;case We.MULTIPOINT:{const C=h[s]-h[s-1];s++;const w=new Array(C);if(m)for(let M=0;M<C;M++){const x=g[r++],I=g[r++];w[M]=new Ne(x,I)}else for(let M=0;M<C;M++){const x=f[a++]*2,I=g[x],S=g[x+1];w[M]=new Ne(I,S)}e[o++]=w.map(M=>[M]),t+=C,n+=C}break;case We.LINESTRING:{let C;y?(C=p[n]-p[n-1],n++):C=u[t]-u[t-1],t++;let w;m?(w=Xn(g,r,C,!1),r+=C*2):(w=Kn(i.vertexBufferType,g,f,a,C,!1,l),a+=C),e[o++]=[w],h&&s++}break;case We.POLYGON:{const C=u[t]-u[t-1];t++;const w=new Array(C-1);let M,x=p[n]-p[n-1];if(n++,m){M=Xn(g,r,x,!0),r+=x*2;for(let I=0;I<w.length;I++)x=p[n]-p[n-1],n++,w[I]=Xn(g,r,x,!0),r+=x*2}else{M=Kn(i.vertexBufferType,g,f,a,x,!0,l),a+=x;for(let I=0;I<w.length;I++)x=p[n]-p[n-1],n++,w[I]=Kn(i.vertexBufferType,g,f,a,x,!0,l),a+=x}e[o++]=[M].concat(w),h&&s++}break;case We.MULTILINESTRING:{const C=h[s]-h[s-1];s++;const w=new Array(C);for(let M=0;M<C;M++){let x;if(y?(x=p[n]-p[n-1],n++):x=u[t]-u[t-1],t++,m)w[M]=Xn(g,r,x,!1),r+=x*2;else{const I=Kn(i.vertexBufferType,g,f,a,x,!1,l);w[M]=I,a+=x}}e[o++]=w}break;case We.MULTIPOLYGON:{const C=h[s]-h[s-1];s++;const w=new Array(C);for(let M=0;M<C;M++){const x=u[t]-u[t-1];t++;let I;const S=new Array(x-1),R=p[n]-p[n-1];n++,m?(I=Xn(g,r,R,!0),r+=R*2):(I=Kn(i.vertexBufferType,g,f,a,R,!0,l),a+=R);for(let b=0;b<S.length;b++){const B=p[n]-p[n-1];n++,m?(S[b]=Xn(g,r,B,!0),r+=B*2):(S[b]=Kn(i.vertexBufferType,g,f,a,B,!0,l),a+=B)}w[M]=[I].concat(S)}e[o++]=w.flat()}break;default:throw new Error(`The specified geometry type (${v}) is currently not supported.`)}}return e}function Kn(i,e,t,n,s,o,r){return i===Gi.MORTON?lO(e,t,n,s,o,r):aO(e,t,n,s,o)}function Xn(i,e,t,n){const s=new Array(n?t+1:t);for(let o=0;o<t*2;o+=2){const r=i[e+o],a=i[e+o+1];s[o/2]=new Ne(r,a)}return n&&(s[s.length-1]=s[0]),s}function aO(i,e,t,n,s){const o=new Array(s?n+1:n);for(let r=0;r<n*2;r+=2){const a=e[t+r/2]*2,l=i[a],c=i[a+1];o[r/2]=new Ne(l,c)}return s&&(o[o.length-1]=o[0]),o}function lO(i,e,t,n,s,o){const r=new Array(s?n+1:n);for(let a=0;a<n;a++){const l=e[t+a],c=i[l],h=Gc(c,o.numBits,o.coordinateShift);r[a]=new Ne(h.x,h.y)}return s&&(r[r.length-1]=r[0]),r}class ag{constructor(e,t,n,s,o){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=n,this._vertexBuffer=s,this._mortonSettings=o}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){const t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2,n=this.vertexBuffer[t],s=this.vertexBuffer[t+1];return[n,s]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const o=this.vertexOffsets[e],r=this.vertexBuffer[o],a=Gc(r,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[a.x,a.y]}const t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2,n=this.vertexBuffer[t],s=this.vertexBuffer[t+1];return[n,s]}getGeometries(){return rO(this)}get mortonSettings(){return this._mortonSettings}}function cO(i,e,t,n,s){return new lg(i,e,Gi.VEC_2,t,n,s)}function dO(i,e,t,n,s,o){return new lg(i,e,Gi.MORTON,t,n,s,o)}class lg extends ag{constructor(e,t,n,s,o,r,a){super(n,s,o,r,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===We.POLYGON||this._geometryType===We.MULTIPOLYGON}containsSingleGeometryType(){return!0}}function hO(i,e,t,n){return new cg(Gi.VEC_2,i,e,t,n)}function uO(i,e,t,n,s){return new cg(Gi.MORTON,i,e,t,n,s)}class cg extends ag{constructor(e,t,n,s,o,r){super(e,n,s,o,r),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===We.POLYGON||this.geometryType(e)===We.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class dg{constructor(e,t,n,s){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=n,this._topologyVector=s}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),t=this._topologyVector,n=t.partOffsets,s=t.ringOffsets,o=t.geometryOffsets;let r=0,a=1,l=1,c=1;for(let h=0;h<this.numGeometries;h++)switch(this.geometryType(h)){case We.POLYGON:{const p=n[a]-n[a-1];a++;const f=[];for(let m=0;m<p;m++){const y=s[l]-s[l-1];l++;const g=[];for(let A=0;A<y;A++){const v=this._vertexBuffer[r++],C=this._vertexBuffer[r++];g.push(new Ne(v,C))}g.length>0&&g.push(g[0]),f.push(g)}e[h]=f,o&&c++}break;case We.MULTIPOLYGON:{const p=o[c]-o[c-1];c++;const f=[];for(let m=0;m<p;m++){const y=n[a]-n[a-1];a++;for(let g=0;g<y;g++){const A=s[l]-s[l-1];l++;const v=[];for(let C=0;C<A;C++){const w=this._vertexBuffer[r++],M=this._vertexBuffer[r++];v.push(new Ne(w,M))}v.length>0&&v.push(v[0]),f.push(v)}}e[h]=f}break}return e}[Symbol.iterator](){return null}}function hg(i,e,t,n,s,o){return new fO(i,e,t,n,s,o)}class fO extends dg{constructor(e,t,n,s,o,r){super(n,s,o,r),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function ug(i,e,t,n,s){return new pO(i,e,t,n,s)}class pO extends dg{constructor(e,t,n,s,o){super(t,n,s,o),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function mO(i,e,t,n,s){const o=ut(i,t),r=Zr(o,n,i,t);let a,l,c,h;if(r===we.CONST){const C=Oc(i,t,o);let w,M,x,I;for(let S=0;S<e-1;S++){const R=ut(i,t);switch(R.physicalStreamType){case Ve.LENGTH:switch(R.logicalStreamType.lengthType){case je.GEOMETRIES:w=Oi(i,t,R);break;case je.PARTS:M=Oi(i,t,R);break;case je.RINGS:x=Oi(i,t,R);break;case je.TRIANGLES:I=Oi(i,t,R)}break;case Ve.OFFSET:{switch(R.logicalStreamType.offsetType){case ni.VERTEX:a=xt(i,t,R);break;case ni.INDEX:h=xt(i,t,R);break}break}case Ve.DATA:{if(ht.VERTEX===R.logicalStreamType.dictionaryType)l=Fc(i,t,R,s);else{const b=R;c={numBits:b.numBits,coordinateShift:b.coordinateShift},l=xt(i,t,R,s)}break}}}return h?w!==void 0||M!==void 0?hg(n,C,I,h,l,{geometryOffsets:w,partOffsets:M,ringOffsets:x}):hg(n,C,I,h,l):c===void 0?cO(n,C,{geometryOffsets:w,partOffsets:M,ringOffsets:x},a,l):dO(n,C,{geometryOffsets:w,partOffsets:M,ringOffsets:x},a,l,c)}const u=xt(i,t,o);let p,f,m,y;for(let C=0;C<e-1;C++){const w=ut(i,t);switch(w.physicalStreamType){case Ve.LENGTH:switch(w.logicalStreamType.lengthType){case je.GEOMETRIES:p=xt(i,t,w);break;case je.PARTS:f=xt(i,t,w);break;case je.RINGS:m=xt(i,t,w);break;case je.TRIANGLES:y=Oi(i,t,w)}break;case Ve.OFFSET:switch(w.logicalStreamType.offsetType){case ni.VERTEX:a=xt(i,t,w);break;case ni.INDEX:h=xt(i,t,w);break}break;case Ve.DATA:if(ht.VERTEX===w.logicalStreamType.dictionaryType)l=Fc(i,t,w,s);else{const M=w;c={numBits:M.numBits,coordinateShift:M.coordinateShift},l=xt(i,t,w,s)}break}}let g,A,v;return p?(g=Uc(u,p,2),f&&m?(A=fg(u,g,f,!1),v=yO(u,g,A,m)):f&&(A=gO(u,g,f))):f&&m?(A=Uc(u,f,1),v=fg(u,A,m,!0)):f&&(A=Uc(u,f,0)),h&&!A?ug(u,y,h,l):h?ug(u,y,h,l,{geometryOffsets:g,partOffsets:A,ringOffsets:v}):c===void 0?hO(u,{geometryOffsets:g,partOffsets:A,ringOffsets:v},a,l):uO(u,{geometryOffsets:g,partOffsets:A,ringOffsets:v},a,l,c)}function Uc(i,e,t){const n=new Uint32Array(i.length+1);let s=0;n[0]=s;let o=0;for(let r=0;r<i.length;r++)s=n[r+1]=s+(i[r]>t?e[o++]:1);return n}function fg(i,e,t,n){const s=new Uint32Array(e[e.length-1]+1);let o=0;s[0]=o;let r=1,a=0;for(let l=0;l<i.length;l++){const c=i[l],h=e[l+1]-e[l];if(c===5||c===2||n&&(c===4||c===1))for(let u=0;u<h;u++)o=s[r++]=o+t[a++];else for(let u=0;u<h;u++)s[r++]=++o}return s}function gO(i,e,t){const n=new Uint32Array(e[e.length-1]+1);let s=0;n[0]=s;let o=1,r=0;for(let a=0;a<i.length;a++){const l=i[a],c=e[a+1]-e[a];if(l===4||l===1)for(let h=0;h<c;h++)s=n[o++]=s+t[r++];else for(let h=0;h<c;h++)n[o++]=++s}return n}function yO(i,e,t,n){const s=new Uint32Array(t[t.length-1]+1);let o=0;s[0]=o;let r=1,a=1,l=0;for(let c=0;c<i.length;c++){const h=i[c],u=e[c+1]-e[c];if(h!==0&&h!==3)for(let p=0;p<u;p++){const f=t[r]-t[r-1];r++;for(let m=0;m<f;m++)o=s[a++]=o+n[l++]}else for(let p=0;p<u;p++)s[a++]=++o,r++}return s}class AO extends $n{constructor(e,t,n){super(e,t.getBuffer(),n),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class vO extends Xr{getValueFromBuffer(e){return this.dataBuffer[e]}}class pg extends $n{constructor(e,t,n,s){super(e,s?BigInt64Array.of(t):BigUint64Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}function mo(i,e,t,n,s){const o=Math.ceil(e/8),r=bO(i,o,t,n);return s?jF(r,e,s):r}function bO(i,e,t,n){const s=new Uint8Array(e);let o=0;const r=n.get()+t;for(;o<e&&!(n.get()>=r);){const a=i[n.increment()];if(a<=127){const l=a+3,c=i[n.increment()],h=Math.min(o+l,e);s.fill(c,o,h),o=h}else{const l=256-a;for(let c=0;c<l&&o<e;c++)s[o++]=i[n.increment()]}}return n.set(r),s}function CO(i,e,t,n){const s=e.get(),o=s+t*Float32Array.BYTES_PER_ELEMENT,r=new Uint8Array(i.subarray(s,o)).buffer,a=new Float32Array(r);return e.set(o),n?Wn(a,n,0):a}function wO(i,e,t,n){const s=e.get(),o=s+t*Float64Array.BYTES_PER_ELEMENT,r=new Uint8Array(i.subarray(s,o)).buffer,a=new Float64Array(r);return e.set(o),n?Wn(a,n,0):a}const EO=12,xO=new TextDecoder;function Vc(i,e,t){return t-e>=EO?xO.decode(i.subarray(e,t)):IO(i,e,t)}function IO(i,e,t){let n="",s=e;for(;s<t;){const o=i[s];let r=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>t)break;let l,c,h;a===1?o<128&&(r=o):a===2?(l=i[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=i[s+1],c=i[s+2],(l&192)===128&&(c&192)===128&&(r=(o&15)<<12|(l&63)<<6|c&63,(r<=2047||r>=55296&&r<=57343)&&(r=null))):a===4&&(l=i[s+1],c=i[s+2],h=i[s+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(r=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,(r<=65535||r>=1114112)&&(r=null))),r===null?(r=65533,a=1):r>65535&&(r-=65536,n+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),n+=String.fromCharCode(r),s+=a}return n}class Qc extends $n{constructor(e,t,n,s){super(e,n,s),this.offsetBuffer=t}}class mg extends Qc{constructor(e,t,n,s){super(e,t,n,s??t.length-1)}getValueFromBuffer(e){const t=this.offsetBuffer[e],n=this.offsetBuffer[e+1];return Vc(this.dataBuffer,t,n)}}class Jn extends Qc{constructor(e,t,n,s,o){super(e,n,s,o??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){const t=this.indexBuffer[e],n=this.offsetBuffer[t],s=this.offsetBuffer[t+1];return Vc(this.dataBuffer,n,s)}}function SO(i,e,t){const n=[],s=new Array(e.length).fill(0);for(let o=1;o<e.length;o++)s[o]=s[o-1]+e[o-1];for(let o=0;o<t.length;o++)if(t[o]===255)n.push(t[++o]);else{const r=e[t[o]],a=s[t[o]];for(let l=0;l<r;l++)n.push(i[a+l])}return new Uint8Array(n)}class gg extends Qc{constructor(e,t,n,s,o,r,a){super(e,n,s,a??t.length),this.indexBuffer=t,this.symbolOffsetBuffer=o,this.symbolTableBuffer=r}getValueFromBuffer(e){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=SO(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const t=this.indexBuffer[e],n=this.offsetBuffer[t],s=this.offsetBuffer[t+1];return Vc(this.decodedDictionary,n,s)}offsetToLengthBuffer(e){const t=new Uint32Array(e.length-1);let n=e[0];for(let s=1;s<e.length;s++){const o=e[s];t[s-1]=o-n,n=o}return t}}function MO(i,e,t,n,s){let o=null,r=null,a=null,l=null,c=null,h=s??null,u=null,p=null;for(let f=0;f<n;f++){const m=ut(e,t);switch(m.physicalStreamType){case Ve.PRESENT:{const y=mo(e,m.numValues,m.byteLength,t),g=new mi(y,m.numValues);h=s??g;break}case Ve.OFFSET:{r=xt(e,t,m,void 0,h);break}case Ve.LENGTH:{const y=Oi(e,t,m);je.DICTIONARY===m.logicalStreamType.lengthType?o=y:je.SYMBOL===m.logicalStreamType.lengthType?l=y:u=y;break}case Ve.DATA:{const y=e.subarray(t.get(),t.get()+m.byteLength);t.add(m.byteLength);const g=m.logicalStreamType.dictionaryType;ht.FSST===g?c=y:ht.SINGLE===g||ht.SHARED===g?a=y:ht.NONE===g&&(p=y);break}}}return TO(i,c,r,o,a,l,h)??BO(i,a,r,o,h)??_O(i,u,p,r,h)}function TO(i,e,t,n,s,o,r){return e?new gg(i,t,n,s,o,e,r):null}function BO(i,e,t,n,s){return e?s?new Jn(i,t,n,e,s):new Jn(i,t,n,e):null}function _O(i,e,t,n,s){if(!e||!t)return null;if(n)return s?new Jn(i,n,e,t,s):new Jn(i,n,e,t);if(s&&s.size()!==e.length-1){const o=new Uint32Array(s.size());let r=0;for(let a=0;a<s.size();a++)s.get(a)?o[a]=r++:o[a]=0;return new Jn(i,o,e,t,s)}return s?new mg(i,e,t,s):new mg(i,e,t)}function kO(i,e,t,n){let s=null,o=null,r=null,a=null,l=!1;for(;!l;){const p=ut(i,e);switch(p.physicalStreamType){case Ve.LENGTH:je.DICTIONARY===p.logicalStreamType.lengthType?s=Oi(i,e,p):r=Oi(i,e,p);break;case Ve.DATA:ht.SINGLE===p.logicalStreamType.dictionaryType||ht.SHARED===p.logicalStreamType.dictionaryType?(o=i.subarray(e.get(),e.get()+p.byteLength),l=!0):a=i.subarray(e.get(),e.get()+p.byteLength),e.add(p.byteLength);break}}const c=t.complexType.children,h=[];let u=0;for(const p of c){const f=rt(i,e,1)[0];if(f===0)continue;const m=p.name?`${t.name}${p.name}`:t.name;if(p.type!=="scalarField"||p.scalarField.physicalType!==ge.STRING)throw new Error("Currently only scalar string fields are implemented for a struct.");if(f>1&&!p.nullable||f===1&&p.nullable)throw new Error(`The number of streams for the child field ${p.name} does not match its nullability. nullibilty: ${p.nullable}, numStreams: ${f}`);let y;if(p.nullable){const v=ut(i,e),C=mo(i,v.numValues,v.byteLength,e);y=new mi(C,v.numValues)}const g=ut(i,e),A=xt(i,e,g,void 0,y);h[u++]=a?new gg(m,A,s,o,r,a,y):new Jn(m,A,s,o,y)}return h}function PO(i,e,t,n,s,o){return t.type==="scalarType"?DO(n,i,e,s,t.scalarType,t):n===0?null:kO(i,e,t)}function DO(i,e,t,n,s,o){let r=null;if(i===0)return null;if(o.nullable){const c=ut(e,t),h=c.numValues,u=t.get(),p=mo(e,h,c.byteLength,t);t.set(u+c.byteLength),r=new mi(p,c.numValues)}const a=r??n;switch(s.physicalType){case ge.UINT_32:case ge.INT_32:return OO(e,t,o,s,a);case ge.STRING:{const c=o.nullable?i-1:i;return MO(o.name,e,t,c,r)}case ge.BOOLEAN:return NO(e,t,o,n,a);case ge.UINT_64:case ge.INT_64:return FO(e,t,o,a,s);case ge.FLOAT:return LO(e,t,o,a);case ge.DOUBLE:return RO(e,t,o,a);default:throw new Error(`The specified data type for the field is currently not supported: ${s}`)}}function NO(i,e,t,n,s){const o=ut(i,e),r=o.numValues,a=e.get(),l=go(s)?s:void 0,c=mo(i,r,o.byteLength,e,l);e.set(a+o.byteLength);const h=new mi(c,r);return new AO(t.name,h,s)}function LO(i,e,t,n){const s=ut(i,e),o=go(n)?n:void 0,r=CO(i,e,s.numValues,o);return new vO(t.name,r,n)}function RO(i,e,t,n){const s=ut(i,e),o=go(n)?n:void 0,r=wO(i,e,s.numValues,o);return new Ic(t.name,r,n)}function FO(i,e,t,n,s){const o=ut(i,e),r=Zr(o,n,i,e,"int64"),a=s.physicalType===ge.INT_64;if(r===we.FLAT){const c=go(n)?n:void 0,h=a?qF(i,e,o,c):tg(i,e,o,c);return new ng(t.name,h,n)}if(r===we.SEQUENCE){const c=eg(i,e,o);return new sg(t.name,c[0],c[1],o.numRleValues)}const l=a?XF(i,e,o):ig(i,e,o);return new pg(t.name,l,n,a)}function OO(i,e,t,n,s){const o=ut(i,e),r=Zr(o,s,i,e),a=n.physicalType===ge.INT_32;if(r===we.FLAT){const c=go(s)?s:void 0,h=a?Fc(i,e,o,void 0,c):xt(i,e,o,void 0,c);return new xc(t.name,h,s)}if(r===we.SEQUENCE){const c=Zm(i,e,o);return new Sc(t.name,c[0],c[1],o.numRleValues)}const l=a?WF(i,e,o):Oc(i,e,o);return new Mc(t.name,l,s,a)}function go(i){return i instanceof mi}function yg(i){switch(i){case 0:case 1:case 2:case 3:{const e={};e.nullable=(i&1)!==0,e.columnScope=Jr.FEATURE;const t={};return t.type="logicalType",t.logicalType=Tc.ID,t.longID=(i&2)!==0,e.scalarType=t,e.type="scalarType",e}case 4:{const e={};e.nullable=!1,e.columnScope=Jr.FEATURE;const t={};return t.type="physicalType",t.physicalType=po.GEOMETRY,e.type="complexType",e.complexType=t,e}case 30:{const e={};e.nullable=!1,e.columnScope=Jr.FEATURE;const t={};return t.type="physicalType",t.physicalType=po.STRUCT,e.type="complexType",e.complexType=t,e}default:return QO(i)}}function Ag(i){return i>=10}function vg(i){return i===30}function GO(i){if(i.type==="scalarType"){const e=i.scalarType;if(e.type==="physicalType")switch(e.physicalType){case ge.BOOLEAN:case ge.INT_8:case ge.UINT_8:case ge.INT_32:case ge.UINT_32:case ge.INT_64:case ge.UINT_64:case ge.FLOAT:case ge.DOUBLE:return!1;case ge.STRING:return!0;default:return!1}if(e.type==="logicalType")return!1}else if(i.type==="complexType"){const e=i.complexType;if(e.type==="physicalType")switch(e.physicalType){case po.GEOMETRY:case po.STRUCT:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",i),!1}function UO(i){return i.type==="scalarType"&&i.scalarType?.type==="logicalType"&&i.scalarType.logicalType===Tc.ID}function VO(i){return i.type==="complexType"&&i.complexType?.type==="physicalType"&&i.complexType.physicalType===po.GEOMETRY}function QO(i){let e;switch(i){case 10:case 11:e=ge.BOOLEAN;break;case 12:case 13:e=ge.INT_8;break;case 14:case 15:e=ge.UINT_8;break;case 16:case 17:e=ge.INT_32;break;case 18:case 19:e=ge.UINT_32;break;case 20:case 21:e=ge.INT_64;break;case 22:case 23:e=ge.UINT_64;break;case 24:case 25:e=ge.FLOAT;break;case 26:case 27:e=ge.DOUBLE;break;case 28:case 29:e=ge.STRING;break;default:return null}const t={};t.nullable=(i&1)!==0,t.columnScope=Jr.FEATURE;const n={};return n.type="physicalType",n.physicalType=e,t.type="scalarType",t.scalarType=n,t}const zO=new TextDecoder,HO="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)",YO="10-29(scalars), 30(STRUCT)";function zc(i,e){const t=rt(i,e,1)[0];if(t===0)return"";const n=e.get(),s=n+t,o=i.subarray(n,s);return e.add(t),zO.decode(o)}function $O(i){return{name:i.name,nullable:i.nullable,scalarField:i.scalarType,complexField:i.complexType,type:i.type==="scalarType"?"scalarField":"complexField"}}function bg(i,e){const t=rt(i,e,1)[0]>>>0;if(t<10||t>30)throw new Error(`Unsupported field type code ${t}. Supported: ${YO}`);const n=yg(t);if(Ag(t)&&(n.name=zc(i,e)),vg(t)){const s=rt(i,e,1)[0]>>>0;n.complexType.children=new Array(s);for(let o=0;o<s;o++)n.complexType.children[o]=bg(i,e)}return $O(n)}function jO(i,e){const t=rt(i,e,1)[0]>>>0,n=yg(t);if(!n)throw new Error(`Unsupported column type code ${t}. Supported: ${HO}`);if(Ag(t)?n.name=zc(i,e):t>=0&&t<=3?n.name="id":t===4&&(n.name="geometry"),vg(t)){const s=rt(i,e,1)[0]>>>0,o=n.complexType;o.children=new Array(s);for(let r=0;r<s;r++)o.children[r]=bg(i,e)}return n}function WO(i,e){const t={};t.featureTables=[];const n={};if(n.name=zc(i,e),n.name.length===0)throw new Error("Missing layer name");const s=rt(i,e,1)[0]>>>0,o=rt(i,e,1)[0]>>>0;n.columns=new Array(o);for(let r=0;r<o;r++)n.columns[r]=jO(i,e);return t.featureTables.push(n),[t,s]}function qO(i,e,t=!0){const n=new Hm(0),s=[];for(;n.get()<i.length;){const o=rt(i,n,1)[0]>>>0,a=n.get()+o;if(a>i.length)throw new Error(`Block overruns tile: ${a} > ${i.length}`);if(rt(i,n,1)[0]>>>0!==1){n.set(a);continue}const[c,h]=WO(i,n),u=c.featureTables[0];let p=null,f=null;const m=[];let y=0;for(const A of u.columns){const v=A.name;if(UO(A)){let C=null;if(A.nullable){const M=ut(i,n),x=n.get(),I=mo(i,M.numValues,M.byteLength,n);n.set(x+M.byteLength),C=new mi(I,M.numValues)}const w=ut(i,n);y=C?C.size():w.decompressedCount,p=KO(i,A,n,v,w,C??y,t)}else if(VO(A)){const C=rt(i,n,1)[0];if(y===0){const w=n.get();y=ut(i,n).decompressedCount,n.set(w)}f=mO(i,C,n,y,e)}else{const w=GO(A)?rt(i,n,1)[0]:1;if(w===0)continue;const M=PO(i,n,A,w,y);if(M)if(Array.isArray(M))for(const x of M)m.push(x);else m.push(M)}}const g=new IR(u.name,f,p,m,h);s.push(g),n.set(a)}return s}function KO(i,e,t,n,s,o,r=!1){const a=e.scalarType;if(a?.type!=="logicalType"||a.logicalType!==Tc.ID)throw new Error(`ID column must be a logical ID scalar type: ${n}`);const l=a.longID?ge.UINT_64:ge.UINT_32,c=typeof o=="number"?void 0:o,h=Zr(s,o,i,t,l===ge.UINT_64?"int64":"int32");if(l===ge.UINT_32)switch(h){case we.FLAT:{const u=xt(i,t,s,void 0,c);return new xc(n,u,o)}case we.SEQUENCE:{const u=Zm(i,t,s);return new Sc(n,u[0],u[1],s.numRleValues)}case we.CONST:{const u=Oc(i,t,s);return new Mc(n,u,o,!1)}}switch(h){case we.FLAT:{if(r){const p=KF(i,t,s);return new Ic(n,p,o)}const u=tg(i,t,s,c);return new ng(n,u,o)}case we.SEQUENCE:{const u=eg(i,t,s);return new sg(n,u[0],u[1],s.numRleValues)}case we.CONST:{const u=ig(i,t,s);return new pg(n,u,o,!1)}}throw new Error("Vector type not supported for id column.")}class XO{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case We.POINT:case We.MULTIPOINT:this.type=1;break;case We.LINESTRING:case We.MULTILINESTRING:this.type=2;break;case We.POLYGON:case We.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const t of this._featureData.geometry.coordinates){const n=[];for(const s of t)n.push(new Ne(s.x,s.y));e.push(n)}return e}}class JO{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new XO(this.features[e],this.extent)}}class ZO{constructor(e){this.layers={};const t=qO(new Uint8Array(e));this.layers=t.reduce((n,s)=>({...n,[s.name]:new JO(s)}),{})}}const Hc=65536*65536,Cg=1/Hc,e5=12,wg=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),Yc=0,ea=1,yo=2,ta=5;class t5{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,n=this.length){for(;this.pos<n;){const s=this.readVarint(),o=s>>3,r=this.pos;this.type=s&7,e(o,t,this),this.pos===r&&this.skip(s)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Hc;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Hc;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let n,s;return s=t[this.pos++],n=s&127,s<128||(s=t[this.pos++],n|=(s&127)<<7,s<128)||(s=t[this.pos++],n|=(s&127)<<14,s<128)||(s=t[this.pos++],n|=(s&127)<<21,s<128)?n:(s=t[this.pos],n|=(s&15)<<28,i5(n,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=e5&&wg?wg.decode(this.buf.subarray(t,e)):m5(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===yo?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===Yc)for(;this.buf[this.pos++]>127;);else if(t===yo)this.pos=this.readVarint()+this.pos;else if(t===ta)this.pos+=4;else if(t===ea)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Cg),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Cg),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){n5(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=g5(this.buf,e,this.pos);const n=this.pos-t;n>=128&&Eg(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;const n=this.pos;e(t,this);const s=this.pos-n;s>=128&&Eg(n,s,this),this.pos=n-1,this.writeVarint(s),this.pos+=s}writeMessage(e,t,n){this.writeTag(e,yo),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,r5,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,a5,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,d5,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,l5,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,c5,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,h5,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,u5,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,f5,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,p5,t)}writeBytesField(e,t){this.writeTag(e,yo),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,ta),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,ta),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,ea),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,ea),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,Yc),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,Yc),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,yo),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,ta),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,ea),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function i5(i,e,t){const n=t.buf;let s,o;if(o=n[t.pos++],s=(o&112)>>4,o<128||(o=n[t.pos++],s|=(o&127)<<3,o<128)||(o=n[t.pos++],s|=(o&127)<<10,o<128)||(o=n[t.pos++],s|=(o&127)<<17,o<128)||(o=n[t.pos++],s|=(o&127)<<24,o<128)||(o=n[t.pos++],s|=(o&1)<<31,o<128))return Zn(i,s,e);throw new Error("Expected varint not more than 10 bytes")}function Zn(i,e,t){return t?e*4294967296+(i>>>0):(e>>>0)*4294967296+(i>>>0)}function n5(i,e){let t,n;if(i>=0?(t=i%4294967296|0,n=i/4294967296|0):(t=~(-i%4294967296),n=~(-i/4294967296),t^4294967295?t=t+1|0:(t=0,n=n+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),s5(t,n,e),o5(n,e)}function s5(i,e,t){t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos]=i&127}function o5(i,e){const t=(i&7)<<4;e.buf[e.pos++]|=t|((i>>>=3)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127)))))}function Eg(i,e,t){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(n);for(let s=t.pos-1;s>=i;s--)t.buf[s+n]=t.buf[s]}function r5(i,e){for(let t=0;t<i.length;t++)e.writeVarint(i[t])}function a5(i,e){for(let t=0;t<i.length;t++)e.writeSVarint(i[t])}function l5(i,e){for(let t=0;t<i.length;t++)e.writeFloat(i[t])}function c5(i,e){for(let t=0;t<i.length;t++)e.writeDouble(i[t])}function d5(i,e){for(let t=0;t<i.length;t++)e.writeBoolean(i[t])}function h5(i,e){for(let t=0;t<i.length;t++)e.writeFixed32(i[t])}function u5(i,e){for(let t=0;t<i.length;t++)e.writeSFixed32(i[t])}function f5(i,e){for(let t=0;t<i.length;t++)e.writeFixed64(i[t])}function p5(i,e){for(let t=0;t<i.length;t++)e.writeSFixed64(i[t])}function m5(i,e,t){let n="",s=e;for(;s<t;){const o=i[s];let r=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>t)break;let l,c,h;a===1?o<128&&(r=o):a===2?(l=i[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=i[s+1],c=i[s+2],(l&192)===128&&(c&192)===128&&(r=(o&15)<<12|(l&63)<<6|c&63,(r<=2047||r>=55296&&r<=57343)&&(r=null))):a===4&&(l=i[s+1],c=i[s+2],h=i[s+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(r=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,(r<=65535||r>=1114112)&&(r=null))),r===null?(r=65533,a=1):r>65535&&(r-=65536,n+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),n+=String.fromCharCode(r),s+=a}return n}function g5(i,e,t){for(let n=0,s,o;n<e.length;n++){if(s=e.charCodeAt(n),s>55295&&s<57344)if(o)if(s<56320){i[t++]=239,i[t++]=191,i[t++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||n+1===e.length?(i[t++]=239,i[t++]=191,i[t++]=189):o=s;continue}else o&&(i[t++]=239,i[t++]=191,i[t++]=189,o=null);s<128?i[t++]=s:(s<2048?i[t++]=s>>6|192:(s<65536?i[t++]=s>>12|224:(i[t++]=s>>18|240,i[t++]=s>>12&63|128),i[t++]=s>>6&63|128),i[t++]=s&63|128)}return t}class xg extends Cc{constructor(e,t){super(e,t),this.tilingScheme=new Cesium.WebMercatorTilingScheme}async init(){const e=this.styleSource;let t=e.url;if(t&&!e.tiles){t=/^((http)|(https)|(data:)|\/)/.test(t)?t:this.path+e.url;try{const n=await Cesium.Resource.fetchJson(t);for(const s in n)e[s]||(e[s]=n[s])}catch(n){this.errorEvent.raiseEvent(n)}}}async requestTile(e,t,n){const s=this.styleSource;if(!s.tiles||!s.tiles.length)return;s.scheme==="tms"&&(t=this.tilingScheme.getNumberOfYTilesAtLevel(n)-t-1);let o=s.tiles[0].replace("{x}",e).replace("{y}",t).replace("{z}",n);o=/^((http)|(https)|(data:)|\/)/.test(o)?o:this.path+o;try{const r=await fetch(o).then(l=>l.arrayBuffer());return s.encoding=="mlt"?new ZO(r):new xR(new t5(r))}catch(r){this.errorEvent.raiseEvent(r)}}async requestTileBuffer(e,t,n,s){const o=this.styleSource;if(!o.tiles||!o.tiles.length)return;o.scheme==="tms"&&(t=this.tilingScheme.getNumberOfYTilesAtLevel(n)-t-1);let r=o.tiles[0].replace("{x}",e).replace("{y}",t).replace("{z}",n);r=/^((http)|(https)|(data:)|\/)/.test(r)?r:this.path+r;try{const a=await fetch(r).then(c=>c.arrayBuffer()),l=o.encoding==="mlt"?"mlt":"mvt";return{buffer:a,encoding:l}}catch(a){this.errorEvent.raiseEvent(a)}}}Ec("vector",xg);function $c(i,e,t,n){let s=n;const o=e+(t-e>>1);let r=t-e,a;const l=i[e],c=i[e+1],h=i[t],u=i[t+1];for(let p=e+3;p<t;p+=3){const f=y5(i[p],i[p+1],l,c,h,u);if(f>s)a=p,s=f;else if(f===s){const m=Math.abs(p-o);m<r&&(a=p,r=m)}}s>n&&(a-e>3&&$c(i,e,a,n),i[a+2]=s,t-a>3&&$c(i,a,t,n))}function y5(i,e,t,n,s,o){let r=s-t,a=o-n;if(r!==0||a!==0){const l=((i-t)*r+(e-n)*a)/(r*r+a*a);l>1?(t=s,n=o):l>0&&(t+=r*l,n+=a*l)}return r=i-t,a=e-n,r*r+a*a}function Ao(i,e,t,n){const s={id:i??null,type:e,geometry:t,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(e==="Point"||e==="MultiPoint"||e==="LineString")ia(s,t);else if(e==="Polygon")ia(s,t[0]);else if(e==="MultiLineString")for(const o of t)ia(s,o);else if(e==="MultiPolygon")for(const o of t)ia(s,o[0]);return s}function ia(i,e){for(let t=0;t<e.length;t+=3)i.minX=Math.min(i.minX,e[t]),i.minY=Math.min(i.minY,e[t+1]),i.maxX=Math.max(i.maxX,e[t]),i.maxY=Math.max(i.maxY,e[t+1])}function A5(i,e){const t=[];if(i.type==="FeatureCollection")for(let n=0;n<i.features.length;n++)na(t,i.features[n],e,n);else i.type==="Feature"?na(t,i,e):na(t,{geometry:i},e);return t}function na(i,e,t,n){if(!e.geometry)return;const s=e.geometry.coordinates;if(s&&s.length===0)return;const o=e.geometry.type,r=Math.pow(t.tolerance/((1<<t.maxZoom)*t.extent),2);let a=[],l=e.id;if(t.promoteId?l=e.properties[t.promoteId]:t.generateId&&(l=n||0),o==="Point")Ig(s,a);else if(o==="MultiPoint")for(const c of s)Ig(c,a);else if(o==="LineString")jc(s,a,r,!1);else if(o==="MultiLineString"){if(t.lineMetrics){for(const c of s)a=[],jc(c,a,r,!1),i.push(Ao(l,"LineString",a,e.properties));return}Wc(s,a,r,!1)}else if(o==="Polygon")Wc(s,a,r,!0);else if(o==="MultiPolygon")for(const c of s){const h=[];Wc(c,h,r,!0),a.push(h)}else if(o==="GeometryCollection"){for(const c of e.geometry.geometries)na(i,{id:l,geometry:c,properties:e.properties},t,n);return}else throw new Error("Input data is not a valid GeoJSON object.");i.push(Ao(l,o,a,e.properties))}function Ig(i,e){e.push(Sg(i[0]),Mg(i[1]),0)}function jc(i,e,t,n){let s,o,r=0;for(let l=0;l<i.length;l++){const c=Sg(i[l][0]),h=Mg(i[l][1]);e.push(c,h,0),l>0&&(n?r+=(s*h-c*o)/2:r+=Math.sqrt(Math.pow(c-s,2)+Math.pow(h-o,2))),s=c,o=h}const a=e.length-3;e[2]=1,$c(e,0,a,t),e[a+2]=1,e.size=Math.abs(r),e.start=0,e.end=e.size}function Wc(i,e,t,n){for(let s=0;s<i.length;s++){const o=[];jc(i[s],o,t,n),e.push(o)}}function Sg(i){return i/360+.5}function Mg(i){const e=Math.sin(i*Math.PI/180),t=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return t<0?0:t>1?1:t}function gi(i,e,t,n,s,o,r,a){if(t/=e,n/=e,o>=t&&r<n)return i;if(r<t||o>=n)return null;const l=[];for(const c of i){const h=c.geometry;let u=c.type;const p=s===0?c.minX:c.minY,f=s===0?c.maxX:c.maxY;if(p>=t&&f<n){l.push(c);continue}else if(f<t||p>=n)continue;let m=[];if(u==="Point"||u==="MultiPoint")v5(h,m,t,n,s);else if(u==="LineString")Tg(h,m,t,n,s,!1,a.lineMetrics);else if(u==="MultiLineString")qc(h,m,t,n,s,!1);else if(u==="Polygon")qc(h,m,t,n,s,!0);else if(u==="MultiPolygon")for(const y of h){const g=[];qc(y,g,t,n,s,!0),g.length&&m.push(g)}if(m.length){if(a.lineMetrics&&u==="LineString"){for(const y of m)l.push(Ao(c.id,u,y,c.tags));continue}(u==="LineString"||u==="MultiLineString")&&(m.length===1?(u="LineString",m=m[0]):u="MultiLineString"),(u==="Point"||u==="MultiPoint")&&(u=m.length===3?"Point":"MultiPoint"),l.push(Ao(c.id,u,m,c.tags))}}return l.length?l:null}function v5(i,e,t,n,s){for(let o=0;o<i.length;o+=3){const r=i[o+s];r>=t&&r<=n&&es(e,i[o],i[o+1],i[o+2])}}function Tg(i,e,t,n,s,o,r){let a=Bg(i);const l=s===0?b5:C5;let c=i.start,h,u;for(let A=0;A<i.length-3;A+=3){const v=i[A],C=i[A+1],w=i[A+2],M=i[A+3],x=i[A+4],I=s===0?v:C,S=s===0?M:x;let R=!1;r&&(h=Math.sqrt(Math.pow(v-M,2)+Math.pow(C-x,2))),I<t?S>=t&&(u=l(a,v,C,M,x,t),r&&(a.start=c+h*u)):I>n?S<=n&&(u=l(a,v,C,M,x,n),r&&(a.start=c+h*u)):es(a,v,C,w),S<t&&I>=t&&(u=l(a,v,C,M,x,t),R=!0),S>n&&I<=n&&(u=l(a,v,C,M,x,n),R=!0),!o&&R&&(r&&(a.end=c+h*u),e.push(a),a=Bg(i)),r&&(c+=h)}let p=i.length-3;const f=i[p],m=i[p+1],y=i[p+2],g=s===0?f:m;g>=t&&g<=n&&es(a,f,m,y),p=a.length-3,o&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&es(a,a[0],a[1],a[2]),a.length&&e.push(a)}function Bg(i){const e=[];return e.size=i.size,e.start=i.start,e.end=i.end,e}function qc(i,e,t,n,s,o){for(const r of i)Tg(r,e,t,n,s,o,!1)}function es(i,e,t,n){i.push(e,t,n)}function b5(i,e,t,n,s,o){const r=(o-e)/(n-e);return es(i,o,t+(s-t)*r,1),r}function C5(i,e,t,n,s,o){const r=(o-t)/(s-t);return es(i,e+(n-e)*r,o,1),r}function w5(i,e){const t=e.buffer/e.extent;let n=i;const s=gi(i,1,-1-t,t,0,-1,2,e),o=gi(i,1,1-t,2+t,0,-1,2,e);return(s||o)&&(n=gi(i,1,-t,1+t,0,-1,2,e)||[],s&&(n=_g(s,1).concat(n)),o&&(n=n.concat(_g(o,-1)))),n}function _g(i,e){const t=[];for(let n=0;n<i.length;n++){const s=i[n],o=s.type;let r;if(o==="Point"||o==="MultiPoint"||o==="LineString")r=Kc(s.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){r=[];for(const a of s.geometry)r.push(Kc(a,e))}else if(o==="MultiPolygon"){r=[];for(const a of s.geometry){const l=[];for(const c of a)l.push(Kc(c,e));r.push(l)}}t.push(Ao(s.id,o,r,s.tags))}return t}function Kc(i,e){const t=[];t.size=i.size,i.start!==void 0&&(t.start=i.start,t.end=i.end);for(let n=0;n<i.length;n+=3)t.push(i[n]+e,i[n+1],i[n+2]);return t}function kg(i,e){if(i.transformed)return i;const t=1<<i.z,n=i.x,s=i.y;for(const o of i.features){const r=o.geometry,a=o.type;if(o.geometry=[],a===1)for(let l=0;l<r.length;l+=2)o.geometry.push(Pg(r[l],r[l+1],e,t,n,s));else for(let l=0;l<r.length;l++){const c=[];for(let h=0;h<r[l].length;h+=2)c.push(Pg(r[l][h],r[l][h+1],e,t,n,s));o.geometry.push(c)}}return i.transformed=!0,i}function Pg(i,e,t,n,s,o){return[Math.round(t*(i*n-s)),Math.round(t*(e*n-o))]}function E5(i,e,t,n,s){const o=e===s.maxZoom?0:s.tolerance/((1<<e)*s.extent),r={features:[],numPoints:0,numSimplified:0,numFeatures:i.length,source:null,x:t,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const a of i)x5(r,a,o,s);return r}function x5(i,e,t,n){const s=e.geometry,o=e.type,r=[];if(i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),o==="Point"||o==="MultiPoint")for(let a=0;a<s.length;a+=3)r.push(s[a],s[a+1]),i.numPoints++,i.numSimplified++;else if(o==="LineString")Xc(r,s,i,t,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(let a=0;a<s.length;a++)Xc(r,s[a],i,t,o==="Polygon",a===0);else if(o==="MultiPolygon")for(let a=0;a<s.length;a++){const l=s[a];for(let c=0;c<l.length;c++)Xc(r,l[c],i,t,!0,c===0)}if(r.length){let a=e.tags||null;if(o==="LineString"&&n.lineMetrics){a={};for(const c in e.tags)a[c]=e.tags[c];a.mapbox_clip_start=s.start/s.size,a.mapbox_clip_end=s.end/s.size}const l={geometry:r,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:a};e.id!==null&&(l.id=e.id),i.features.push(l)}}function Xc(i,e,t,n,s,o){const r=n*n;if(n>0&&e.size<(s?r:n)){t.numPoints+=e.length/3;return}const a=[];for(let l=0;l<e.length;l+=3)(n===0||e[l+2]>r)&&(t.numSimplified++,a.push(e[l],e[l+1])),t.numPoints++;s&&I5(a,o),i.push(a)}function I5(i,e){let t=0;for(let n=0,s=i.length,o=s-2;n<s;o=n,n+=2)t+=(i[n]-i[o])*(i[n+1]+i[o+1]);if(t>0===e)for(let n=0,s=i.length;n<s/2;n+=2){const o=i[n],r=i[n+1];i[n]=i[s-2-n],i[n+1]=i[s-1-n],i[s-2-n]=o,i[s-1-n]=r}}const S5={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class M5{constructor(e,t){t=this.options=T5(Object.create(S5),t);const n=t.debug;if(n&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let s=A5(e,t);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),s=w5(s,t),s.length&&this.splitTile(s,0,0,0),n&&(s.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,t,n,s,o,r,a){const l=[e,t,n,s],c=this.options,h=c.debug;for(;l.length;){s=l.pop(),n=l.pop(),t=l.pop(),e=l.pop();const u=1<<t,p=Jc(t,n,s);let f=this.tiles[p];if(!f&&(h>1&&console.time("creation"),f=this.tiles[p]=E5(e,t,n,s,c),this.tileCoords.push({z:t,x:n,y:s}),h)){h>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,s,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));const S=`z${t}`;this.stats[S]=(this.stats[S]||0)+1,this.total++}if(f.source=e,o==null){if(t===c.indexMaxZoom||f.numPoints<=c.indexMaxPoints)continue}else{if(t===c.maxZoom||t===o)continue;if(o!=null){const S=o-t;if(n!==r>>S||s!==a>>S)continue}}if(f.source=null,e.length===0)continue;h>1&&console.time("clipping");const m=.5*c.buffer/c.extent,y=.5-m,g=.5+m,A=1+m;let v=null,C=null,w=null,M=null;const x=gi(e,u,n-m,n+g,0,f.minX,f.maxX,c),I=gi(e,u,n+y,n+A,0,f.minX,f.maxX,c);x&&(v=gi(x,u,s-m,s+g,1,f.minY,f.maxY,c),C=gi(x,u,s+y,s+A,1,f.minY,f.maxY,c)),I&&(w=gi(I,u,s-m,s+g,1,f.minY,f.maxY,c),M=gi(I,u,s+y,s+A,1,f.minY,f.maxY,c)),h>1&&console.timeEnd("clipping"),l.push(v||[],t+1,n*2,s*2),l.push(C||[],t+1,n*2,s*2+1),l.push(w||[],t+1,n*2+1,s*2),l.push(M||[],t+1,n*2+1,s*2+1)}}getTile(e,t,n){e=+e,t=+t,n=+n;const s=this.options,{extent:o,debug:r}=s;if(e<0||e>24)return null;const a=1<<e;t=t+a&a-1;const l=Jc(e,t,n);if(this.tiles[l])return kg(this.tiles[l],o);r>1&&console.log("drilling down to z%d-%d-%d",e,t,n);let c=e,h=t,u=n,p;for(;!p&&c>0;)c--,h=h>>1,u=u>>1,p=this.tiles[Jc(c,h,u)];return!p||!p.source?null:(r>1&&(console.log("found parent tile z%d-%d-%d",c,h,u),console.time("drilling down")),this.splitTile(p.source,c,h,u,e,t,n),r>1&&console.timeEnd("drilling down"),this.tiles[l]?kg(this.tiles[l],o):null)}}function Jc(i,e,t){return((1<<i)*t+e)*32+i}function T5(i,e){for(const t in e)i[t]=e[t];return i}function B5(i,e){return new M5(i,e)}typeof TextDecoder>"u"||new TextDecoder("utf-8");var _5=class{constructor(i,e){this.feature=i,this.type=i.type,this.properties=i.tags?i.tags:{},this.extent=e,"id"in i&&(typeof i.id=="string"?this.id=parseInt(i.id,10):typeof i.id=="number"&&!isNaN(i.id)&&(this.id=i.id))}loadGeometry(){const i=[],e=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const t of e){const n=[];for(const s of t)n.push(new Ne(s[0],s[1]));i.push(n)}return i}};const Dg="_geojsonTileLayer";var k5=class{constructor(i,e){this.layers={[Dg]:this},this.name=Dg,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=i.length,this.features=i}feature(i){return new _5(this.features[i],this.extent)}};const Tt=8192;class Ng extends Cc{constructor(e,t){super(e,t)}async init(){const e=this.styleSource;let t=e.data;if(typeof t=="string"){const n=/^((http)|(https)|(data:)|\/)/.test(t)?t:this.path+t;try{t=await Cesium.Resource.fetchJson(n)}catch(s){this.errorEvent.raiseEvent(s)}}t&&t.features?.length&&(this.tileIndex=new B5(t,{extent:Tt,buffer:e.buffer===void 0?128:e.buffer,tolerance:e.tolerance===e.tolerance?.375:e.tolerance}))}async requestTile(e,t,n){if(this.tileIndex)try{const s=this.tileIndex.getTile(n,e,t);return s?new k5(s.features,{extent:Tt}):void 0}catch(s){this.errorEvent.raiseEvent(s)}}}Ec("geojson",Ng);var P5=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],D5=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],N5={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:P5,layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:D5,paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}},Lg=N5;function Rg(i,...e){for(const t of e)for(const n in t)i[n]=t[n];return i}var si=class extends Error{constructor(i,e){super(e),this.message=e,this.key=i}},L5=class Ey{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[n,s]of t)this.bindings[n]=s}concat(e){return new Ey(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}};const sa={kind:"null"},W={kind:"number"},le={kind:"string"},ue={kind:"boolean"},oi={kind:"color"},oa={kind:"projectionDefinition"},hn={kind:"object"},ce={kind:"value"},R5={kind:"error"},ra={kind:"collator"},aa={kind:"formatted"},la={kind:"padding"},vo={kind:"colorArray"},ca={kind:"numberArray"},bo={kind:"resolvedImage"},da={kind:"variableAnchorOffsetCollection"};function yt(i,e){return{kind:"array",itemType:i,N:e}}function Pe(i){if(i.kind==="array"){const e=Pe(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}else return i.kind}const F5=[sa,W,le,ue,oi,oa,aa,hn,yt(ce),la,ca,vo,bo,da];function Co(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Co(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const t of F5)if(!Co(t,e))return null}}return`Expected ${Pe(i)} but found ${Pe(e)} instead.`}function Zc(i,e){return e.some(t=>t.kind===i.kind)}function un(i,e){return e.some(t=>t==="null"?i===null:t==="array"?Array.isArray(i):t==="object"?i&&!Array.isArray(i)&&typeof i=="object":t===typeof i)}function Ui(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const Fg=.96422,Og=1,Gg=.82521,Ug=4/29,ts=6/29,Vg=3*ts*ts,O5=ts*ts*ts,G5=Math.PI/180,U5=180/Math.PI;function Qg(i){return i=i%360,i<0&&(i+=360),i}function zg([i,e,t,n]){i=ed(i),e=ed(e),t=ed(t);let s,o;const r=td((.2225045*i+.7168786*e+.0606169*t)/Og);i===e&&e===t?s=o=r:(s=td((.4360747*i+.3850649*e+.1430804*t)/Fg),o=td((.0139322*i+.0971045*e+.7141733*t)/Gg));const a=116*r-16;return[a<0?0:a,500*(s-r),200*(r-o),n]}function ed(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function td(i){return i>O5?Math.pow(i,1/3):i/Vg+Ug}function Hg([i,e,t,n]){let s=(i+16)/116,o=isNaN(e)?s:s+e/500,r=isNaN(t)?s:s-t/200;return s=Og*nd(s),o=Fg*nd(o),r=Gg*nd(r),[id(3.1338561*o-1.6168667*s-.4906146*r),id(-.9787684*o+1.9161415*s+.033454*r),id(.0719453*o-.2289914*s+1.4052427*r),n]}function id(i){return i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055,i<0?0:i>1?1:i}function nd(i){return i>ts?i*i*i:Vg*(i-Ug)}function V5(i){const[e,t,n,s]=zg(i),o=Math.sqrt(t*t+n*n);return[Math.round(o*1e4)?Qg(Math.atan2(n,t)*U5):NaN,o,e,s]}function Q5([i,e,t,n]){return i=isNaN(i)?0:i*G5,Hg([t,Math.cos(i)*e,Math.sin(i)*e,n])}function z5([i,e,t,n]){i=Qg(i),e/=100,t/=100;function s(o){const r=(o+i/30)%12,a=e*Math.min(t,1-t);return t-a*Math.max(-1,Math.min(r-3,9-r,1))}return[s(0),s(8),s(4),n]}const H5=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Yg(i,e){return H5(i,e)?i[e]:void 0}function Y5(i){if(i=i.toLowerCase().trim(),i==="transparent")return[0,0,0,0];const e=Yg($5,i);if(e){const[n,s,o]=e;return[n/255,s/255,o/255,1]}if(i.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(i)){const n=i.length<6?1:2;let s=1;return[ha(i.slice(s,s+=n)),ha(i.slice(s,s+=n)),ha(i.slice(s,s+=n)),ha(i.slice(s,s+n)||"ff")]}if(i.startsWith("rgb")){const n=i.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){const[s,o,r,a,l,c,h,u,p,f,m,y]=n,g=[a||" ",h||" ",f].join("");if(g===" "||g===" /"||g===",,"||g===",,,"){const A=[r,c,p].join(""),v=A==="%%%"?100:A===""?255:0;if(v){const C=[is(+o/v,0,1),is(+l/v,0,1),is(+u/v,0,1),m?$g(+m,y):1];if(jg(C))return C}}return}}const t=i.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[n,s,o,r,a,l,c,h,u]=t,p=[o||" ",a||" ",c].join("");if(p===" "||p===" /"||p===",,"||p===",,,"){const f=[+s,is(+r,0,100),is(+l,0,100),h?$g(+h,u):1];if(jg(f))return z5(f)}}}function ha(i){return parseInt(i.padEnd(2,i),16)/255}function $g(i,e){return is(e?i/100:i,0,1)}function is(i,e,t){return Math.min(Math.max(e,i),t)}function jg(i){return!i.some(Number.isNaN)}const $5={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Vi(i,e,t){return i+t*(e-i)}function ns(i,e,t){return i.map((n,s)=>Vi(n,e[s],t))}function j5(i){return i==="rgb"||i==="hcl"||i==="lab"}var qe=(et=class{constructor(e,t,n,s=1,o=!0){this.r=e,this.g=t,this.b=n,this.a=s,o||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[e,t,n,s]))}static parse(e){if(e instanceof et)return e;if(typeof e!="string")return;const t=Y5(e);if(t)return new et(...t,!1)}get rgb(){const{r:e,g:t,b:n,a:s}=this,o=s||1/0;return this.overwriteGetter("rgb",[e/o,t/o,n/o,s])}get hcl(){return this.overwriteGetter("hcl",V5(this.rgb))}get lab(){return this.overwriteGetter("lab",zg(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,n,s]=this.rgb;return`rgba(${[e,t,n].map(o=>Math.round(o*255)).join(",")},${s})`}static interpolate(e,t,n,s="rgb"){switch(s){case"rgb":{const[o,r,a,l]=ns(e.rgb,t.rgb,n);return new et(o,r,a,l,!1)}case"hcl":{const[o,r,a,l]=e.hcl,[c,h,u,p]=t.hcl;let f,m;if(!isNaN(o)&&!isNaN(c)){let C=c-o;c>o&&C>180?C-=360:c<o&&o-c>180&&(C+=360),f=o+n*C}else isNaN(o)?isNaN(c)?f=NaN:(f=c,(a===1||a===0)&&(m=h)):(f=o,(u===1||u===0)&&(m=r));const[y,g,A,v]=Q5([f,m??Vi(r,h,n),Vi(a,u,n),Vi(l,p,n)]);return new et(y,g,A,v,!1)}case"lab":{const[o,r,a,l]=Hg(ns(e.lab,t.lab,n));return new et(o,r,a,l,!1)}}}},et.black=new et(0,0,0,1),et.white=new et(1,1,1,1),et.transparent=new et(0,0,0,0),et.red=new et(1,0,0,1),et),sd=class{constructor(i,e,t){i?this.sensitivity=e?"variant":"case":this.sensitivity=e?"accent":"base",this.locale=t,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,e){return this.collator.compare(i,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};const W5=["bottom","center","top"];var od=class{constructor(i,e,t,n,s,o){this.text=i,this.image=e,this.scale=t,this.fontStack=n,this.textColor=s,this.verticalAlign=o}},ss=class Ra{constructor(e){this.sections=e}static fromString(e){return new Ra([new od(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Ra?e:Ra.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},ri=class Go{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Go)return e;if(typeof e=="number")return new Go([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new Go(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Go(ns(e.values,t.values,n))}},ai=class Uo{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Uo)return e;if(typeof e=="number")return new Uo([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new Uo(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Uo(ns(e.values,t.values,n))}},Lt=class Vo{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Vo)return e;if(typeof e=="string"){const n=qe.parse(e);return n?new Vo([n]):void 0}if(!Array.isArray(e))return;const t=[];for(const n of e){if(typeof n!="string")return;const s=qe.parse(n);if(!s)return;t.push(s)}return new Vo(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,s="rgb"){const o=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let r=0;r<e.values.length;r++)o.push(qe.interpolate(e.values[r],t.values[r],n,s));return new Vo(o)}},Le=class extends Error{constructor(i){super(i),this.name="RuntimeError"}toJSON(){return this.message}};const q5=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var Qi=class Fa{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Fa)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const n=e[t],s=e[t+1];if(typeof n!="string"||!q5.has(n)||!Array.isArray(s)||s.length!==2||typeof s[0]!="number"||typeof s[1]!="number")return}return new Fa(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){const s=e.values,o=t.values;if(s.length!==o.length)throw new Le(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const r=[];for(let a=0;a<s.length;a+=2){if(s[a]!==o[a])throw new Le(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${s[a]}, to[${a}]: ${o[a]}`);r.push(s[a]);const[l,c]=s[a+1],[h,u]=o[a+1];r.push([Vi(l,h,n),Vi(c,u,n)])}return new Fa(r)}},zi=class xy{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new xy({name:e,available:!1}):null}},os=class ys{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new ys(e,t,n)}static parse(e){if(e instanceof ys)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new ys(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new ys(e.from,e.to,e.transition);if(typeof e=="string")return new ys(e,e,1)}};function Wg(i,e,t,n){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,t,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,t,n]:[i,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function wo(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof os||i instanceof qe||i instanceof sd||i instanceof ss||i instanceof ri||i instanceof ai||i instanceof Lt||i instanceof Qi||i instanceof zi)return!0;if(Array.isArray(i)){for(const e of i)if(!wo(e))return!1;return!0}else if(typeof i=="object"){for(const e in i)if(!wo(i[e]))return!1;return!0}else return!1}function Ke(i){if(i===null)return sa;if(typeof i=="string")return le;if(typeof i=="boolean")return ue;if(typeof i=="number")return W;if(i instanceof qe)return oi;if(i instanceof os)return oa;if(i instanceof sd)return ra;if(i instanceof ss)return aa;if(i instanceof ri)return la;if(i instanceof ai)return ca;if(i instanceof Lt)return vo;if(i instanceof Qi)return da;if(i instanceof zi)return bo;if(Array.isArray(i)){const e=i.length;let t;for(const n of i){const s=Ke(n);if(!t)t=s;else{if(t===s)continue;t=ce;break}}return yt(t||ce,e)}else return hn}function Eo(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof qe||i instanceof os||i instanceof ss||i instanceof ri||i instanceof ai||i instanceof Lt||i instanceof Qi||i instanceof zi?i.toString():JSON.stringify(i)}var ua=class Iy{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!wo(e[1]))return t.error("invalid value");const n=e[1];let s=Ke(n);const o=t.expectedType;return s.kind==="array"&&s.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(s=o),new Iy(s,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};const fa={string:le,number:W,boolean:ue,object:hn};var yi=class Sy{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=1,s;const o=e[0];if(o==="array"){let a;if(e.length>2){const c=e[1];if(typeof c!="string"||!(c in fa)||c==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=fa[c],n++}else a=ce;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],n++}s=yt(a,l)}else{if(!fa[o])throw new Error(`Types doesn't contain name = ${o}`);s=fa[o]}const r=[];for(;n<e.length;n++){const a=t.parse(e[n],n,ce);if(!a)return null;r.push(a)}return new Sy(s,r)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(Co(this.type,Ke(n))){if(t===this.args.length-1)throw new Le(`Expected value to be of type ${Pe(this.type)}, but found ${Pe(Ke(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};const qg={"to-boolean":ue,"to-color":oi,"to-number":W,"to-string":le};var rs=class My{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[0];if(!qg[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return t.error("Expected one argument.");const s=qg[n],o=[];for(let r=1;r<e.length;r++){const a=t.parse(e[r],r,ce);if(!a)return null;o.push(a)}return new My(s,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,n;for(const s of this.args){if(t=s.evaluate(e),n=null,t instanceof qe)return t;if(typeof t=="string"){const o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?n=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:n=Wg(t[0],t[1],t[2],t[3]),!n))return new qe(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Le(n||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const n of this.args){t=n.evaluate(e);const s=ri.parse(t);if(s)return s}throw new Le(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=ai.parse(t);if(s)return s}throw new Le(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=Lt.parse(t);if(s)return s}throw new Le(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const n of this.args){t=n.evaluate(e);const s=Qi.parse(t);if(s)return s}throw new Le(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const n of this.args){if(t=n.evaluate(e),t===null)return 0;const s=Number(t);if(!isNaN(s))return s}throw new Le(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return ss.fromString(Eo(this.args[0].evaluate(e)));case"resolvedImage":return zi.fromString(Eo(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Eo(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};const K5=["Unknown","Point","LineString","Polygon"];var Kg=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?K5[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(i){let e=this._parseColorCache.get(i);return e||(e=qe.parse(i),this._parseColorCache.set(i,e)),e}},Xg=class Ty{constructor(e,t,n=[],s,o=new L5,r=[]){this.registry=e,this.path=n,this.key=n.map(a=>`[${a}]`).join(""),this.scope=o,this.errors=r,this.expectedType=s,this._isConstant=t}parse(e,t,n,s,o={}){return t?this.concat(t,n,s)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(s,o,r){return r==="assert"?new yi(o,[s]):r==="coerce"?new rs(o,[s]):s}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=e[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const o=this.registry[s];if(o){let r=o.parse(e,this);if(!r)return null;if(this.expectedType){const a=this.expectedType,l=r.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")r=n(r,a,t.typeAnnotation||"assert");else if(a.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(a.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(a.kind)&&["value","number","array"].includes(l.kind)||a.kind==="colorArray"&&["value","string","array"].includes(l.kind)||a.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))r=n(r,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(r instanceof ua)&&r.type.kind!=="resolvedImage"&&this._isConstant(r)){const a=new Kg;try{r=new ua(r.type,r.evaluate(a))}catch(l){return this.error(l.message),null}}return r}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){const s=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new Ty(this.registry,this._isConstant,s,t||null,o,this.errors)}error(e,...t){const n=`${this.key}${t.map(s=>`[${s}]`).join("")}`;this.errors.push(new si(n,e))}checkSubtype(e,t){const n=Co(e,t);return n&&this.error(n),n}},Jg=class By{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let o=1;o<e.length-1;o+=2){const r=e[o];if(typeof r!="string")return t.error(`Expected string, but found ${typeof r} instead.`,o);if(/[^a-zA-Z0-9_]/.test(r))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);const a=t.parse(e[o+1],o+1);if(!a)return null;n.push([r,a])}const s=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return s?new By(n,s):null}outputDefined(){return this.result.outputDefined()}},Zg=class _y{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const n=e[1];return t.scope.has(n)?new _y(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},X5=class ky{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,W),s=t.parse(e[2],2,yt(t.expectedType||ce));if(!n||!s)return null;const o=s.type;return new ky(o.itemType,n,s)}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new Le(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new Le(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new Le(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},J5=class Py{constructor(e,t){this.type=ue,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,ce),s=t.parse(e[2],2,ce);return!n||!s?null:Zc(n.type,[ue,le,W,sa,ce])?new Py(n,s):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Pe(n.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!un(t,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Pe(Ke(t))} instead.`);if(!un(n,["string","array"]))throw new Le(`Expected second argument to be of type array or string, but found ${Pe(Ke(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Z5=class $d{constructor(e,t,n){this.type=W,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,ce),s=t.parse(e[2],2,ce);if(!n||!s)return null;if(!Zc(n.type,[ue,le,W,sa,ce]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Pe(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,W);return o?new $d(n,s,o):null}else return new $d(n,s)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!un(t,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Pe(Ke(t))} instead.`);let s;if(this.fromIndex&&(s=this.fromIndex.evaluate(e)),un(n,["string"])){const o=n.indexOf(t,s);return o===-1?-1:[...n.slice(0,o)].length}else{if(un(n,["array"]))return n.indexOf(t,s);throw new Le(`Expected second argument to be of type array or string, but found ${Pe(Ke(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},e6=class Dy{constructor(e,t,n,s,o,r){this.inputType=e,this.type=t,this.input=n,this.cases=s,this.outputs=o,this.otherwise=r}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return t.error("Expected an even number of arguments.");let n,s;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);const o={},r=[];for(let c=2;c<e.length-1;c+=2){let h=e[c];const u=e[c+1];Array.isArray(h)||(h=[h]);const p=t.concat(c);if(h.length===0)return p.error("Expected at least one branch label.");for(const m of h){if(typeof m!="number"&&typeof m!="string")return p.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return p.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof m=="number"&&Math.floor(m)!==m)return p.error("Numeric branch labels must be integer values.");if(!n)n=Ke(m);else if(p.checkSubtype(n,Ke(m)))return null;if(typeof o[String(m)]<"u")return p.error("Branch labels must be unique.");o[String(m)]=r.length}const f=t.parse(u,c,s);if(!f)return null;s=s||f.type,r.push(f)}const a=t.parse(e[1],1,ce);if(!a)return null;const l=t.parse(e[e.length-1],e.length-1,s);return!l||a.type.kind!=="value"&&t.concat(1).checkSubtype(n,a.type)?null:new Dy(n,s,a,o,r,l)}evaluate(e){const t=this.input.evaluate(e);return(Ke(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},t6=class Ny{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);const s=[];for(let r=1;r<e.length-1;r+=2){const a=t.parse(e[r],r,ue);if(!a)return null;const l=t.parse(e[r+1],r+1,n);if(!l)return null;s.push([a,l]),n=n||l.type}const o=t.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can't infer output type");return new Ny(n,s,o)}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}},i6=class jd{constructor(e,t,n,s){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=s}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,ce),s=t.parse(e[2],2,W);if(!n||!s)return null;if(!Zc(n.type,[yt(ce),le,ce]))return t.error(`Expected first argument to be of type array or string, but found ${Pe(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,W);return o?new jd(n.type,n,s,o):null}else return new jd(n.type,n,s)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);let s;if(this.endIndex&&(s=this.endIndex.evaluate(e)),un(t,["string"]))return[...t].slice(n,s).join("");if(un(t,["array"]))return t.slice(n,s);throw new Le(`Expected first argument to be of type array or string, but found ${Pe(Ke(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function pa(i,e){const t=i.length-1;let n=0,s=t,o=0,r,a;for(;n<=s;)if(o=Math.floor((n+s)/2),r=i[o],a=i[o+1],r<=e){if(o===t||e<a)return o;n=o+1}else if(r>e)s=o-1;else throw new Le("Input is not a number.");return 0}var e0=class Ly{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,o]of n)this.labels.push(s),this.outputs.push(o)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");const n=t.parse(e[1],1,W);if(!n)return null;const s=[];let o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.expectedType);for(let r=1;r<e.length;r+=2){const a=r===1?-1/0:e[r],l=e[r+1],c=r,h=r+1;if(typeof a!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(s.length&&s[s.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);const u=t.parse(l,h,o);if(!u)return null;o=o||u.type,s.push([a,u])}return new Ly(o,n,s)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;return s>=t[o-1]?n[o-1].evaluate(e):n[pa(t,s)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function n6(i,e,t,n){const s=3*i,o=3*(t-i)-s,r=1-s-o,a=3*e,l=3*(n-e)-a,c=1-a-l;return function(u,p=1e-6){if(u<=0)return 0;if(u>=1)return 1;let f=u;for(let g=0;g<8;g++){const A=((r*f+o)*f+s)*f-u;if(Math.abs(A)<p)return((c*f+l)*f+a)*f;const v=(3*r*f+2*o)*f+s;if(Math.abs(v)<1e-6)break;f-=A/v}let m=0,y=1;f=u;for(let g=0;g<20;g++){const A=((r*f+o)*f+s)*f;if(Math.abs(A-u)<p)break;u>A?m=f:y=f,f=(m+y)*.5}return((c*f+l)*f+a)*f}}var Ai=class Wd{constructor(e,t,n,s,o){this.type=e,this.operator=t,this.interpolation=n,this.input=s,this.labels=[],this.outputs=[];for(const[r,a]of o)this.labels.push(r),this.outputs.push(a)}static interpolationFactor(e,t,n,s){let o=0;if(e.name==="exponential")o=rd(t,e.base,n,s);else if(e.name==="linear")o=rd(t,1,n,s);else if(e.name==="cubic-bezier"){const r=e.controlPoints;o=n6(r[0],r[1],r[2],r[3])(rd(t,1,n,s))}return o}static parse(e,t){let[n,s,o,...r]=e;if(!Array.isArray(s)||s.length===0)return t.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const c=s[1];if(typeof c!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:c}}else if(s[0]==="cubic-bezier"){const c=s.slice(1);if(c.length!==4||c.some(h=>typeof h!="number"||h<0||h>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:c}}else return t.error(`Unknown interpolation type ${String(s[0])}`,1,0);if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,W),!o)return null;const a=[];let l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&t.expectedType!=vo?l=oi:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let c=0;c<r.length;c+=2){const h=r[c],u=r[c+1],p=c+3,f=c+4;if(typeof h!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(a.length&&a[a.length-1][0]>=h)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);const m=t.parse(u,f,l);if(!m)return null;l=l||m.type,a.push([h,m])}return!Ui(l,W)&&!Ui(l,oa)&&!Ui(l,oi)&&!Ui(l,la)&&!Ui(l,ca)&&!Ui(l,vo)&&!Ui(l,da)&&!Ui(l,yt(W))?t.error(`Type ${Pe(l)} is not interpolatable.`):new Wd(l,n,s,o,a)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;if(s>=t[o-1])return n[o-1].evaluate(e);const r=pa(t,s),a=t[r],l=t[r+1],c=Wd.interpolationFactor(this.interpolation,s,a,l),h=n[r].evaluate(e),u=n[r+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Vi(h,u,c);case"color":return qe.interpolate(h,u,c);case"padding":return ri.interpolate(h,u,c);case"colorArray":return Lt.interpolate(h,u,c);case"numberArray":return ai.interpolate(h,u,c);case"variableAnchorOffsetCollection":return Qi.interpolate(h,u,c);case"array":return ns(h,u,c);case"projectionDefinition":return os.interpolate(h,u,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return qe.interpolate(h,u,c,"hcl");case"colorArray":return Lt.interpolate(h,u,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return qe.interpolate(h,u,c,"lab");case"colorArray":return Lt.interpolate(h,u,c,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function rd(i,e,t,n){const s=n-t,o=i-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}const s6={color:qe.interpolate,number:Vi,padding:ri.interpolate,numberArray:ai.interpolate,colorArray:Lt.interpolate,variableAnchorOffsetCollection:Qi.interpolate,array:ns};var t0=class qd{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=null;const s=t.expectedType;s&&s.kind!=="value"&&(n=s);const o=[];for(const r of e.slice(1)){const a=t.parse(r,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!a)return null;n=n||a.type,o.push(a)}if(!n)throw new Error("No output type");return s&&o.some(r=>Co(s,r.type))?new qd(ce,o):new qd(n,o)}evaluate(e){let t=null,n=0,s;for(const o of this.args)if(n++,t=o.evaluate(e),t&&t instanceof zi&&!t.available&&(s||(s=t.name),t=null,n===this.args.length&&(t=s)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function i0(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function o6(i,e,t){return e===t}function r6(i,e,t){return e!==t}function a6(i,e,t){return e<t}function l6(i,e,t){return e>t}function c6(i,e,t){return e<=t}function d6(i,e,t){return e>=t}function n0(i,e,t,n){return n.compare(e,t)===0}function h6(i,e,t,n){return!n0(i,e,t,n)}function u6(i,e,t,n){return n.compare(e,t)<0}function f6(i,e,t,n){return n.compare(e,t)>0}function p6(i,e,t,n){return n.compare(e,t)<=0}function m6(i,e,t,n){return n.compare(e,t)>=0}function as(i,e,t){const n=i!=="=="&&i!=="!=";return class Ry{constructor(o,r,a){this.type=ue,this.lhs=o,this.rhs=r,this.collator=a,this.hasUntypedArgument=o.type.kind==="value"||r.type.kind==="value"}static parse(o,r){if(o.length!==3&&o.length!==4)return r.error("Expected two or three arguments.");const a=o[0];let l=r.parse(o[1],1,ce);if(!l)return null;if(!i0(a,l.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${Pe(l.type)}'.`);let c=r.parse(o[2],2,ce);if(!c)return null;if(!i0(a,c.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${Pe(c.type)}'.`);if(l.type.kind!==c.type.kind&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error(`Cannot compare types '${Pe(l.type)}' and '${Pe(c.type)}'.`);n&&(l.type.kind==="value"&&c.type.kind!=="value"?l=new yi(c.type,[l]):l.type.kind!=="value"&&c.type.kind==="value"&&(c=new yi(l.type,[c])));let h=null;if(o.length===4){if(l.type.kind!=="string"&&c.type.kind!=="string"&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error("Cannot use collator to compare non-string types.");if(h=r.parse(o[3],3,ra),!h)return null}return new Ry(l,c,h)}evaluate(o){const r=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){const l=Ke(r),c=Ke(a);if(l.kind!==c.kind||!(l.kind==="string"||l.kind==="number"))throw new Le(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${l.kind}, ${c.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const l=Ke(r),c=Ke(a);if(l.kind!=="string"||c.kind!=="string")return e(o,r,a)}return this.collator?t(o,r,a,this.collator.evaluate(o)):e(o,r,a)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}const g6=as("==",o6,n0),y6=as("!=",r6,h6),A6=as("<",a6,u6),v6=as(">",l6,f6),b6=as("<=",c6,p6),C6=as(">=",d6,m6);var s0=class Fy{constructor(e,t,n){this.type=ra,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return t.error("Collator options argument must be an object.");const s=t.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,ue);if(!s)return null;const o=t.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,ue);if(!o)return null;let r=null;return n.locale&&(r=t.parse(n.locale,1,le),!r)?null:new Fy(s,o,r)}evaluate(e){return new sd(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},w6=class Oy{constructor(e,t,n,s,o,r){this.type=le,this.number=e,this.locale=t,this.currency=n,this.unit=s,this.minFractionDigits=o,this.maxFractionDigits=r}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const n=t.parse(e[1],1,W);if(!n)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return t.error("NumberFormat options argument must be an object.");let o=null;if(s.locale&&(o=t.parse(s.locale,1,le),!o))return null;let r=null;if(s.currency&&(r=t.parse(s.currency,1,le),!r))return null;let a=null;if(s.unit&&(a=t.parse(s.unit,1,le),!a))return null;if(r&&a)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(s["min-fraction-digits"]&&(l=t.parse(s["min-fraction-digits"],1,W),!l))return null;let c=null;return s["max-fraction-digits"]&&(c=t.parse(s["max-fraction-digits"],1,W),!c)?null:new Oy(n,o,r,a,l,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},E6=class Gy{constructor(e){this.type=aa,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return t.error("First argument must be an image or text section.");const s=[];let o=!1;for(let r=1;r<=e.length-1;++r){const a=e[r];if(o&&typeof a=="object"&&!Array.isArray(a)){o=!1;let l=null;if(a["font-scale"]&&(l=t.parse(a["font-scale"],1,W),!l))return null;let c=null;if(a["text-font"]&&(c=t.parse(a["text-font"],1,yt(le)),!c))return null;let h=null;if(a["text-color"]&&(h=t.parse(a["text-color"],1,oi),!h))return null;let u=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!W5.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(u=t.parse(a["vertical-align"],1,le),!u)return null}const p=s[s.length-1];p.scale=l,p.font=c,p.textColor=h,p.verticalAlign=u}else{const l=t.parse(e[r],1,ce);if(!l)return null;const c=l.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,s.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Gy(s)}evaluate(e){const t=n=>{const s=n.content.evaluate(e);return Ke(s)===bo?new od("",s,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new od(Eo(s),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new ss(this.sections.map(t))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}},x6=class Uy{constructor(e){this.type=bo,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const n=t.parse(e[1],1,le);return n?new Uy(n):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=zi.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},I6=class Vy{constructor(e){this.type=W,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=t.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${Pe(n.type)} instead.`):new Vy(n):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new Le(`Expected value to be of type string or array, but found ${Pe(Ke(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}};const li=8192;function S6(i,e){const t=M6(i[0]),n=B6(i[1]),s=Math.pow(2,e.z);return[Math.round(t*s*li),Math.round(n*s*li)]}function ad(i,e){const t=Math.pow(2,e.z),n=(i[0]/li+e.x)/t,s=(i[1]/li+e.y)/t;return[T6(n),_6(s)]}function M6(i){return(180+i)/360}function T6(i){return i*360-180}function B6(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function _6(i){return 360/Math.PI*Math.atan(Math.exp((180-i*360)*Math.PI/180))-90}function xo(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Io(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function k6(i,e,t){return e[1]>i[1]!=t[1]>i[1]&&i[0]<(t[0]-e[0])*(i[1]-e[1])/(t[1]-e[1])+e[0]}function P6(i,e,t){const n=i[0]-e[0],s=i[1]-e[1],o=i[0]-t[0],r=i[1]-t[1];return n*r-o*s===0&&n*o<=0&&s*r<=0}function ma(i,e,t,n){const s=[e[0]-i[0],e[1]-i[1]];return R6([n[0]-t[0],n[1]-t[1]],s)===0?!1:!!(r0(i,e,t,n)&&r0(t,n,i,e))}function D6(i,e,t){for(const n of t)for(let s=0;s<n.length-1;++s)if(ma(i,e,n[s],n[s+1]))return!0;return!1}function ls(i,e,t=!1){let n=!1;for(const s of e)for(let o=0;o<s.length-1;o++){if(P6(i,s[o],s[o+1]))return t;k6(i,s[o],s[o+1])&&(n=!n)}return n}function N6(i,e){for(const t of e)if(ls(i,t))return!0;return!1}function o0(i,e){for(const t of i)if(!ls(t,e))return!1;for(let t=0;t<i.length-1;++t)if(D6(i[t],i[t+1],e))return!1;return!0}function L6(i,e){for(const t of e)if(o0(i,t))return!0;return!1}function R6(i,e){return i[0]*e[1]-i[1]*e[0]}function r0(i,e,t,n){const s=i[0]-t[0],o=i[1]-t[1],r=e[0]-t[0],a=e[1]-t[1],l=n[0]-t[0],c=n[1]-t[1],h=s*c-l*o,u=r*c-l*a;return h>0&&u<0||h<0&&u>0}function ld(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=[];for(let r=0;r<i[s].length;r++){const a=S6(i[s][r],t);xo(e,a),o.push(a)}n.push(o)}return n}function a0(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=ld(i[s],e,t);n.push(o)}return n}function l0(i,e,t,n){if(i[0]<t[0]||i[0]>t[2]){const s=n*.5;let o=i[0]-t[0]>s?-n:t[0]-i[0]>s?n:0;o===0&&(o=i[0]-t[2]>s?-n:t[2]-i[0]>s?n:0),i[0]+=o}xo(e,i)}function F6(i){i[0]=i[1]=1/0,i[2]=i[3]=-1/0}function c0(i,e,t,n){const s=Math.pow(2,n.z)*li,o=[n.x*li,n.y*li],r=[];for(const a of i)for(const l of a){const c=[l.x+o[0],l.y+o[1]];l0(c,e,t,s),r.push(c)}return r}function d0(i,e,t,n){const s=Math.pow(2,n.z)*li,o=[n.x*li,n.y*li],r=[];for(const a of i){const l=[];for(const c of a){const h=[c.x+o[0],c.y+o[1]];xo(e,h),l.push(h)}r.push(l)}if(e[2]-e[0]<=s/2){F6(e);for(const a of r)for(const l of a)l0(l,e,t,s)}return r}function O6(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=ld(e.coordinates,n,s),r=c0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!ls(a,o))return!1}if(e.type==="MultiPolygon"){const o=a0(e.coordinates,n,s),r=c0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!N6(a,o))return!1}return!0}function G6(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=ld(e.coordinates,n,s),r=d0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!o0(a,o))return!1}if(e.type==="MultiPolygon"){const o=a0(e.coordinates,n,s),r=d0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!L6(a,o))return!1}return!0}var cd=class Oa{constructor(e,t){this.type=ue,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(wo(e[1])){const n=e[1];if(n.type==="FeatureCollection"){const s=[];for(const o of n.features){const{type:r,coordinates:a}=o.geometry;r==="Polygon"&&s.push(a),r==="MultiPolygon"&&s.push(...a)}if(s.length)return new Oa(n,{type:"MultiPolygon",coordinates:s})}else if(n.type==="Feature"){const s=n.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new Oa(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Oa(n,n)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return O6(e,this.geometries);if(e.geometryType()==="LineString")return G6(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},h0=class{constructor(i=[],e=(t,n)=>t<n?-1:t>n?1:0){if(this.data=i,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;const i=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:e,compare:t}=this,n=e[i];for(;i>0;){const s=i-1>>1,o=e[s];if(t(n,o)>=0)break;e[i]=o,i=s}e[i]=n}_down(i){const{data:e,compare:t}=this,n=this.length>>1,s=e[i];for(;i<n;){let o=(i<<1)+1;const r=o+1;if(r<this.length&&t(e[r],e[o])<0&&(o=r),t(e[o],s)>=0)break;e[i]=e[o],i=o}e[i]=s}};function U6(i,e){if(i.length<=1)return[i];const t=[];let n,s;for(const o of i){const r=V6(o);r!==0&&(o.area=Math.abs(r),s===void 0&&(s=r<0),s===r<0?(n&&t.push(n),n=[o]):n.push(o))}return n&&t.push(n),t}function V6(i){let e=0;for(let t=0,n=i.length,s=n-1,o,r;t<n;s=t++)o=i[t],r=i[s],e+=(r.x-o.x)*(o.y+r.y);return e}const Q6=6378.137,u0=1/298.257223563,f0=u0*(2-u0),p0=Math.PI/180;var dd=class{constructor(i){const e=p0*Q6*1e3,t=Math.cos(i*p0),n=1/(1-f0*(1-t*t)),s=Math.sqrt(n);this.kx=e*s*t,this.ky=e*s*n*(1-f0)}distance(i,e){const t=this.wrap(i[0]-e[0])*this.kx,n=(i[1]-e[1])*this.ky;return Math.sqrt(t*t+n*n)}pointOnLine(i,e){let t=1/0,n,s,o,r;for(let a=0;a<i.length-1;a++){let l=i[a][0],c=i[a][1],h=this.wrap(i[a+1][0]-l)*this.kx,u=(i[a+1][1]-c)*this.ky,p=0;(h!==0||u!==0)&&(p=(this.wrap(e[0]-l)*this.kx*h+(e[1]-c)*this.ky*u)/(h*h+u*u),p>1?(l=i[a+1][0],c=i[a+1][1]):p>0&&(l+=h/this.kx*p,c+=u/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,u=(e[1]-c)*this.ky;const f=h*h+u*u;f<t&&(t=f,n=l,s=c,o=a,r=p)}return{point:[n,s],index:o,t:Math.max(0,Math.min(1,r))}}wrap(i){for(;i<-180;)i+=360;for(;i>180;)i-=360;return i}};const hd=100,ud=50;function m0(i,e){return e[0]-i[0]}function ga(i){return i[1]-i[0]+1}function vi(i,e){return i[1]>=i[0]&&i[1]<e}function fd(i,e){if(i[0]>i[1])return[null,null];const t=ga(i);if(e){if(t===2)return[i,null];const s=Math.floor(t/2);return[[i[0],i[0]+s],[i[0]+s,i[1]]]}if(t===1)return[i,null];const n=Math.floor(t/2)-1;return[[i[0],i[0]+n],[i[0]+n+1,i[1]]]}function pd(i,e){if(!vi(e,i.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)xo(t,i[n]);return t}function md(i){const e=[1/0,1/0,-1/0,-1/0];for(const t of i)for(const n of t)xo(e,n);return e}function g0(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function gd(i,e,t){if(!g0(i)||!g0(e))return NaN;let n=0,s=0;return i[2]<e[0]&&(n=e[0]-i[2]),i[0]>e[2]&&(n=i[0]-e[2]),i[1]>e[3]&&(s=i[1]-e[3]),i[3]<e[1]&&(s=e[1]-i[3]),t.distance([0,0],[n,s])}function fn(i,e,t){const n=t.pointOnLine(e,i);return t.distance(i,n.point)}function yd(i,e,t,n,s){const o=Math.min(fn(i,[t,n],s),fn(e,[t,n],s)),r=Math.min(fn(t,[i,e],s),fn(n,[i,e],s));return Math.min(o,r)}function z6(i,e,t,n,s){if(!(vi(e,i.length)&&vi(n,t.length)))return 1/0;let o=1/0;for(let r=e[0];r<e[1];++r){const a=i[r],l=i[r+1];for(let c=n[0];c<n[1];++c){const h=t[c],u=t[c+1];if(ma(a,l,h,u))return 0;o=Math.min(o,yd(a,l,h,u,s))}}return o}function H6(i,e,t,n,s){if(!(vi(e,i.length)&&vi(n,t.length)))return NaN;let o=1/0;for(let r=e[0];r<=e[1];++r)for(let a=n[0];a<=n[1];++a)if(o=Math.min(o,s.distance(i[r],t[a])),o===0)return o;return o}function Y6(i,e,t){if(ls(i,e,!0))return 0;let n=1/0;for(const s of e){const o=s[0],r=s[s.length-1];if(o!==r&&(n=Math.min(n,fn(i,[r,o],t)),n===0))return n;const a=t.pointOnLine(s,i);if(n=Math.min(n,t.distance(i,a.point)),n===0)return n}return n}function $6(i,e,t,n){if(!vi(e,i.length))return NaN;for(let o=e[0];o<=e[1];++o)if(ls(i[o],t,!0))return 0;let s=1/0;for(let o=e[0];o<e[1];++o){const r=i[o],a=i[o+1];for(const l of t)for(let c=0,h=l.length,u=h-1;c<h;u=c++){const p=l[u],f=l[c];if(ma(r,a,p,f))return 0;s=Math.min(s,yd(r,a,p,f,n))}}return s}function y0(i,e){for(const t of i)for(const n of t)if(ls(n,e,!0))return!0;return!1}function j6(i,e,t,n=1/0){const s=md(i),o=md(e);if(n!==1/0&&gd(s,o,t)>=n)return n;if(Io(s,o)){if(y0(i,e))return 0}else if(y0(e,i))return 0;let r=1/0;for(const a of i)for(let l=0,c=a.length,h=c-1;l<c;h=l++){const u=a[h],p=a[l];for(const f of e)for(let m=0,y=f.length,g=y-1;m<y;g=m++){const A=f[g],v=f[m];if(ma(u,p,A,v))return 0;r=Math.min(r,yd(u,p,A,v,t))}}return r}function A0(i,e,t,n,s,o){if(!o)return;const r=gd(pd(n,o),s,t);r<e&&i.push([r,o,[0,0]])}function ya(i,e,t,n,s,o,r){if(!o||!r)return;const a=gd(pd(n,o),pd(s,r),t);a<e&&i.push([a,o,r])}function Aa(i,e,t,n,s=1/0){let o=Math.min(n.distance(i[0],t[0][0]),s);if(o===0)return o;const r=new h0([[0,[0,i.length-1],[0,0]]],m0),a=md(t);for(;r.length>0;){const l=r.pop();if(l[0]>=o)continue;const c=l[1],h=e?ud:hd;if(ga(c)<=h){if(!vi(c,i.length))return NaN;if(e){const u=$6(i,c,t,n);if(isNaN(u)||u===0)return u;o=Math.min(o,u)}else for(let u=c[0];u<=c[1];++u){const p=Y6(i[u],t,n);if(o=Math.min(o,p),o===0)return 0}}else{const u=fd(c,e);A0(r,o,n,i,a,u[0]),A0(r,o,n,i,a,u[1])}}return o}function va(i,e,t,n,s,o=1/0){let r=Math.min(o,s.distance(i[0],t[0]));if(r===0)return r;const a=new h0([[0,[0,i.length-1],[0,t.length-1]]],m0);for(;a.length>0;){const l=a.pop();if(l[0]>=r)continue;const c=l[1],h=l[2],u=e?ud:hd,p=n?ud:hd;if(ga(c)<=u&&ga(h)<=p){if(!vi(c,i.length)&&vi(h,t.length))return NaN;let f;if(e&&n)f=z6(i,c,t,h,s),r=Math.min(r,f);else if(e&&!n){const m=i.slice(c[0],c[1]+1);for(let y=h[0];y<=h[1];++y)if(f=fn(t[y],m,s),r=Math.min(r,f),r===0)return r}else if(!e&&n){const m=t.slice(h[0],h[1]+1);for(let y=c[0];y<=c[1];++y)if(f=fn(i[y],m,s),r=Math.min(r,f),r===0)return r}else f=H6(i,c,t,h,s),r=Math.min(r,f)}else{const f=fd(c,e),m=fd(h,n);ya(a,r,s,i,t,f[0],m[0]),ya(a,r,s,i,t,f[0],m[1]),ya(a,r,s,i,t,f[1],m[0]),ya(a,r,s,i,t,f[1],m[1])}}return r}function W6(i,e){const t=i.geometry(),n=t.flat().map(r=>ad([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new dd(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,va(n,!1,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,va(n,!1,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,Aa(n,!1,r.coordinates,s,o));break}if(o===0)return o}return o}function q6(i,e){const t=i.geometry(),n=t.flat().map(r=>ad([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new dd(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,va(n,!0,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,va(n,!0,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,Aa(n,!0,r.coordinates,s,o));break}if(o===0)return o}return o}function K6(i,e){const t=i.geometry();if(t.length===0||t[0].length===0)return NaN;const n=U6(t).map(r=>r.map(a=>a.map(l=>ad([l.x,l.y],i.canonical)))),s=new dd(n[0][0][0][1]);let o=1/0;for(const r of e)for(const a of n){switch(r.type){case"Point":o=Math.min(o,Aa([r.coordinates],!1,a,s,o));break;case"LineString":o=Math.min(o,Aa(r.coordinates,!0,a,s,o));break;case"Polygon":o=Math.min(o,j6(a,r.coordinates,s,o));break}if(o===0)return o}return o}function Ad(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}var vd=class Ga{constructor(e,t){this.type=W,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(wo(e[1])){const n=e[1];if(n.type==="FeatureCollection")return new Ga(n,n.features.map(s=>Ad(s.geometry)).flat());if(n.type==="Feature")return new Ga(n,Ad(n.geometry));if("type"in n&&"coordinates"in n)return new Ga(n,Ad(n))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return W6(e,this.geometries);if(e.geometryType()==="LineString")return q6(e,this.geometries);if(e.geometryType()==="Polygon")return K6(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},bd=class Qy{constructor(e){this.type=ce,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=e[1];return n==null?t.error("Global state property must be defined."):typeof n!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new Qy(n)}evaluate(e){const t=e.globals?.globalState;return!t||Object.keys(t).length===0?null:Yg(t,this.key)??null}eachChild(){}outputDefined(){return!1}};const cs={"==":g6,"!=":y6,">":v6,"<":A6,">=":C6,"<=":b6,array:yi,at:X5,boolean:yi,case:t6,coalesce:t0,collator:s0,format:E6,image:x6,in:J5,"index-of":Z5,interpolate:Ai,"interpolate-hcl":Ai,"interpolate-lab":Ai,length:I6,let:Jg,literal:ua,match:e6,number:yi,"number-format":w6,object:yi,slice:i6,step:e0,string:yi,"to-boolean":rs,"to-color":rs,"to-number":rs,"to-string":rs,var:Zg,within:cd,distance:vd,"global-state":bd};var pn=class Qo{constructor(e,t,n,s){this.name=e,this.type=t,this._evaluate=n,this.args=s}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const n=e[0],s=Qo.definitions[n];if(!s)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(s)?s[0]:s.type,r=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,a=r.filter(([c])=>!Array.isArray(c)||c.length===e.length-1);let l=null;for(const[c,h]of a){l=new Xg(t.registry,ba,t.path,null,t.scope);const u=[];let p=!1;for(let f=1;f<e.length;f++){const m=e[f],y=Array.isArray(c)?c[f-1]:c.type,g=l.parse(m,1+u.length,y);if(!g){p=!0;break}u.push(g)}if(!p){if(Array.isArray(c)&&c.length!==u.length){l.error(`Expected ${c.length} arguments, but found ${u.length} instead.`);continue}for(let f=0;f<u.length;f++){const m=Array.isArray(c)?c[f]:c.type,y=u[f];l.concat(f+1).checkSubtype(m,y.type)}if(l.errors.length===0)return new Qo(n,o,h,u)}}if(a.length===1)t.errors.push(...l.errors);else{const c=(a.length?a:r).map(([u])=>J6(u)).join(" | "),h=[];for(let u=1;u<e.length;u++){const p=t.parse(e[u],1+h.length);if(!p)return null;h.push(Pe(p.type))}t.error(`Expected arguments of type ${c}, but found (${h.join(", ")}) instead.`)}return null}static register(e,t){Qo.definitions=t;for(const n in t)e[n]=Qo}};function v0(i,[e,t,n,s]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const o=s?s.evaluate(i):1,r=Wg(e,t,n,o);if(r)throw new Le(r);return new qe(e/255,t/255,n/255,o,!1)}function b0(i,e){return i in e}function Cd(i,e){const t=e[i];return typeof t>"u"?null:t}function X6(i,e,t,n){for(;t<=n;){const s=t+n>>1;if(e[s]===i)return!0;e[s]>i?n=s-1:t=s+1}return!1}function mn(i){return{type:i}}pn.register(cs,{error:[R5,[le],(i,[e])=>{throw new Le(e.evaluate(i))}],typeof:[le,[ce],(i,[e])=>Pe(Ke(e.evaluate(i)))],"to-rgba":[yt(W,4),[oi],(i,[e])=>{const[t,n,s,o]=e.evaluate(i).rgb;return[t*255,n*255,s*255,o]}],rgb:[oi,[W,W,W],v0],rgba:[oi,[W,W,W,W],v0],has:{type:ue,overloads:[[[le],(i,[e])=>b0(e.evaluate(i),i.properties())],[[le,hn],(i,[e,t])=>b0(e.evaluate(i),t.evaluate(i))]]},get:{type:ce,overloads:[[[le],(i,[e])=>Cd(e.evaluate(i),i.properties())],[[le,hn],(i,[e,t])=>Cd(e.evaluate(i),t.evaluate(i))]]},"feature-state":[ce,[le],(i,[e])=>Cd(e.evaluate(i),i.featureState||{})],properties:[hn,[],i=>i.properties()],"geometry-type":[le,[],i=>i.geometryType()],id:[ce,[],i=>i.id()],zoom:[W,[],i=>i.globals.zoom],"heatmap-density":[W,[],i=>i.globals.heatmapDensity||0],elevation:[W,[],i=>i.globals.elevation||0],"line-progress":[W,[],i=>i.globals.lineProgress||0],accumulated:[ce,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[W,mn(W),(i,e)=>{let t=0;for(const n of e)t+=n.evaluate(i);return t}],"*":[W,mn(W),(i,e)=>{let t=1;for(const n of e)t*=n.evaluate(i);return t}],"-":{type:W,overloads:[[[W,W],(i,[e,t])=>e.evaluate(i)-t.evaluate(i)],[[W],(i,[e])=>-e.evaluate(i)]]},"/":[W,[W,W],(i,[e,t])=>e.evaluate(i)/t.evaluate(i)],"%":[W,[W,W],(i,[e,t])=>e.evaluate(i)%t.evaluate(i)],ln2:[W,[],()=>Math.LN2],pi:[W,[],()=>Math.PI],e:[W,[],()=>Math.E],"^":[W,[W,W],(i,[e,t])=>Math.pow(e.evaluate(i),t.evaluate(i))],sqrt:[W,[W],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[W,[W],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[W,[W],(i,[e])=>Math.log(e.evaluate(i))],log2:[W,[W],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[W,[W],(i,[e])=>Math.sin(e.evaluate(i))],cos:[W,[W],(i,[e])=>Math.cos(e.evaluate(i))],tan:[W,[W],(i,[e])=>Math.tan(e.evaluate(i))],asin:[W,[W],(i,[e])=>Math.asin(e.evaluate(i))],acos:[W,[W],(i,[e])=>Math.acos(e.evaluate(i))],atan:[W,[W],(i,[e])=>Math.atan(e.evaluate(i))],min:[W,mn(W),(i,e)=>Math.min(...e.map(t=>t.evaluate(i)))],max:[W,mn(W),(i,e)=>Math.max(...e.map(t=>t.evaluate(i)))],abs:[W,[W],(i,[e])=>Math.abs(e.evaluate(i))],round:[W,[W],(i,[e])=>{const t=e.evaluate(i);return t<0?-Math.round(-t):Math.round(t)}],floor:[W,[W],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[W,[W],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[ue,[le,ce],(i,[e,t])=>i.properties()[e.value]===t.value],"filter-id-==":[ue,[ce],(i,[e])=>i.id()===e.value],"filter-type-==":[ue,[le],(i,[e])=>i.geometryType()===e.value],"filter-<":[ue,[le,ce],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<s}],"filter-id-<":[ue,[ce],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<n}],"filter->":[ue,[le,ce],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>s}],"filter-id->":[ue,[ce],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>n}],"filter-<=":[ue,[le,ce],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[ue,[ce],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<=n}],"filter->=":[ue,[le,ce],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[ue,[ce],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>=n}],"filter-has":[ue,[ce],(i,[e])=>e.value in i.properties()],"filter-has-id":[ue,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[ue,[yt(le)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[ue,[yt(ce)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[ue,[le,yt(ce)],(i,[e,t])=>t.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[ue,[le,yt(ce)],(i,[e,t])=>X6(i.properties()[e.value],t.value,0,t.value.length-1)],all:{type:ue,overloads:[[[ue,ue],(i,[e,t])=>e.evaluate(i)&&t.evaluate(i)],[mn(ue),(i,e)=>{for(const t of e)if(!t.evaluate(i))return!1;return!0}]]},any:{type:ue,overloads:[[[ue,ue],(i,[e,t])=>e.evaluate(i)||t.evaluate(i)],[mn(ue),(i,e)=>{for(const t of e)if(t.evaluate(i))return!0;return!1}]]},"!":[ue,[ue],(i,[e])=>!e.evaluate(i)],"is-supported-script":[ue,[le],(i,[e])=>{const t=i.globals&&i.globals.isSupportedScript;return t?t(e.evaluate(i)):!0}],upcase:[le,[le],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[le,[le],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[le,mn(ce),(i,e)=>e.map(t=>Eo(t.evaluate(i))).join("")],split:[yt(le),[le,le],(i,[e,t])=>e.evaluate(i).split(t.evaluate(i))],join:[le,[yt(le),le],(i,[e,t])=>e.evaluate(i).join(t.evaluate(i))],"resolved-locale":[le,[ra],(i,[e])=>e.evaluate(i).resolvedLocale()]});function J6(i){return Array.isArray(i)?`(${i.map(Pe).join(", ")})`:`(${Pe(i.type)}...)`}function ba(i){if(i instanceof Zg)return ba(i.boundExpression);if(i instanceof pn&&i.name==="error")return!1;if(i instanceof s0)return!1;if(i instanceof cd)return!1;if(i instanceof vd)return!1;if(i instanceof bd)return!1;const e=i instanceof rs||i instanceof yi;let t=!0;return i.eachChild(n=>{e?t=t&&ba(n):t=t&&n instanceof ua}),t?wd(i)&&xd(i,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function wd(i){if(i instanceof pn){if(i.name==="get"&&i.args.length===1)return!1;if(i.name==="feature-state")return!1;if(i.name==="has"&&i.args.length===1)return!1;if(i.name==="properties"||i.name==="geometry-type"||i.name==="id")return!1;if(/^filter-/.test(i.name))return!1}if(i instanceof cd||i instanceof vd)return!1;let e=!0;return i.eachChild(t=>{e&&!wd(t)&&(e=!1)}),e}function Ed(i){if(i instanceof pn&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(t=>{e&&!Ed(t)&&(e=!1)}),e}function xd(i,e){if(i instanceof pn&&e.indexOf(i.name)>=0)return!1;let t=!0;return i.eachChild(n=>{t&&!xd(n,e)&&(t=!1)}),t}function Id(i){return{result:"success",value:i}}function ds(i){return{result:"error",value:i}}function Z6(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function eG(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function C0(i){return!!i.expression&&i.expression.interpolated}function Sd(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function w0(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&Ke(i)===hn}function tG(i){return i}function iG(i){switch(i.type){case"color":return qe.parse;case"padding":return ri.parse;case"numberArray":return ai.parse;case"colorArray":return Lt.parse;default:return null}}function nG(i){switch(i){case"exponential":return x0;case"interval":return oG;case"categorical":return sG;case"identity":return rG;default:throw new Error(`Unknown function type "${i}"`)}}function E0(i,e){const t=i.stops&&typeof i.stops[0][0]=="object",n=t||i.property!==void 0,s=t||!n,o=i.type||(C0(e)?"exponential":"interval"),r=iG(e);if(r&&(i=Rg({},i),i.stops&&(i.stops=i.stops.map(h=>[h[0],r(h[1])])),i.default?i.default=r(i.default):i.default=r(e.default)),i.colorSpace&&!j5(i.colorSpace))throw new Error(`Unknown color space: "${i.colorSpace}"`);const a=nG(o);let l,c;if(o==="categorical"){l=Object.create(null);for(const h of i.stops)l[h[0]]=h[1];c=typeof i.stops[0][0]}if(t){const h={},u=[];for(let m=0;m<i.stops.length;m++){const y=i.stops[m],g=y[0].zoom;h[g]===void 0&&(h[g]={zoom:g,type:i.type,property:i.property,default:i.default,stops:[]},u.push(g)),h[g].stops.push([y[0].value,y[1]])}const p=[];for(const m of u)p.push([h[m].zoom,E0(h[m],e)]);const f={name:"linear"};return{kind:"composite",interpolationType:f,interpolationFactor:Ai.interpolationFactor.bind(void 0,f),zoomStops:p.map(m=>m[0]),evaluate({zoom:m},y){return x0({stops:p,base:i.base},e,m).evaluate(m,y)}}}else if(s){const h=o==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:h,interpolationFactor:Ai.interpolationFactor.bind(void 0,h),zoomStops:i.stops.map(u=>u[0]),evaluate:({zoom:u})=>a(i,e,u,l,c)}}else return{kind:"source",evaluate(h,u){const p=u&&u.properties?u.properties[i.property]:void 0;return p===void 0?So(i.default,e.default):a(i,e,p,l,c)}}}function So(i,e,t){if(i!==void 0)return i;if(e!==void 0)return e;if(t!==void 0)return t}function sG(i,e,t,n,s){return So(typeof t===s?n[t]:void 0,i.default,e.default)}function oG(i,e,t){if(Sd(t)!=="number")return So(i.default,e.default);const n=i.stops.length;if(n===1||t<=i.stops[0][0])return i.stops[0][1];if(t>=i.stops[n-1][0])return i.stops[n-1][1];const s=pa(i.stops.map(o=>o[0]),t);return i.stops[s][1]}function x0(i,e,t){const n=i.base!==void 0?i.base:1;if(Sd(t)!=="number")return So(i.default,e.default);const s=i.stops.length;if(s===1||t<=i.stops[0][0])return i.stops[0][1];if(t>=i.stops[s-1][0])return i.stops[s-1][1];const o=pa(i.stops.map(h=>h[0]),t),r=aG(t,n,i.stops[o][0],i.stops[o+1][0]),a=i.stops[o][1],l=i.stops[o+1][1],c=s6[e.type]||tG;return typeof a.evaluate=="function"?{evaluate(...h){const u=a.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(!(u===void 0||p===void 0))return c(u,p,r,i.colorSpace)}}:c(a,l,r,i.colorSpace)}function rG(i,e,t){switch(e.type){case"color":t=qe.parse(t);break;case"formatted":t=ss.fromString(t.toString());break;case"resolvedImage":t=zi.fromString(t.toString());break;case"padding":t=ri.parse(t);break;case"colorArray":t=Lt.parse(t);break;case"numberArray":t=ai.parse(t);break;default:Sd(t)!==e.type&&(e.type!=="enum"||!e.values[t])&&(t=void 0)}return So(t,i.default,e.default)}function aG(i,e,t,n){const s=n-t,o=i-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}var Md=class{constructor(i,e,t){this.expression=i,this._warningHistory={},this._evaluator=new Kg,this._defaultValue=e?hG(e):null,this._enumValues=e&&e.type==="enum"?e.values:null,this._globalState=t}evaluateWithoutErrorHandling(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._evaluator.globals=i,this._evaluator.feature=e,this._evaluator.featureState=t,this._evaluator.canonical=n,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(i,e,t,n,s,o){this._globalState&&(i=hs(i,this._globalState)),this._evaluator.globals=i,this._evaluator.feature=e||null,this._evaluator.featureState=t||null,this._evaluator.canonical=n,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o||null;try{const r=this.expression.evaluate(this._evaluator);if(r==null||typeof r=="number"&&r!==r)return this._defaultValue;if(this._enumValues&&!(r in this._enumValues))throw new Le(`Expected value to be one of ${Object.keys(this._enumValues).map(a=>JSON.stringify(a)).join(", ")}, but found ${JSON.stringify(r)} instead.`);return r}catch(r){return this._warningHistory[r.message]||(this._warningHistory[r.message]=!0,typeof console<"u"&&console.warn(r.message)),this._defaultValue}}};function I0(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in cs}function Td(i,e,t){const n=new Xg(cs,ba,[],e?dG(e):void 0),s=n.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Id(new Md(s,e,t)):ds(n.errors)}var Ca=class{constructor(i,e,t){this.kind=i,this._styleExpression=e,this.isStateDependent=i!=="constant"&&!Ed(e.expression),this.globalStateRefs=xa(e.expression),this._globalState=t}evaluateWithoutErrorHandling(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(i,e,t,n,s,o)}evaluate(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluate(i,e,t,n,s,o)}},wa=class{constructor(i,e,t,n,s){this.kind=i,this.zoomStops=t,this._styleExpression=e,this.isStateDependent=i!=="camera"&&!Ed(e.expression),this.globalStateRefs=xa(e.expression),this.interpolationType=n,this._globalState=s}evaluateWithoutErrorHandling(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(i,e,t,n,s,o)}evaluate(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluate(i,e,t,n,s,o)}interpolationFactor(i,e,t){return this.interpolationType?Ai.interpolationFactor(this.interpolationType,i,e,t):0}};function lG(i){return i._styleExpression!==void 0}function S0(i,e,t){const n=Td(i,e,t);if(n.result==="error")return n;const s=n.value.expression,o=wd(s);if(!o&&!Z6(e))return ds([new si("","data expressions not supported")]);const r=xd(s,["zoom"]);if(!r&&!eG(e))return ds([new si("","zoom expressions not supported")]);const a=Ea(s);if(!a&&!r)return ds([new si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof si)return ds([a]);if(a instanceof Ai&&!C0(e))return ds([new si("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Id(o?new Ca("constant",n.value,t):new Ca("source",n.value,t));const l=a instanceof Ai?a.interpolation:void 0;return Id(o?new wa("camera",n.value,a.labels,l,t):new wa("composite",n.value,a.labels,l,t))}var Bd=class zy{constructor(e,t){this._parameters=e,this._specification=t,Rg(this,E0(this._parameters,this._specification))}static deserialize(e){return new zy(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function cG(i,e,t){if(w0(i))return new Bd(i,e);if(I0(i)){const n=S0(i,e,t);if(n.result==="error")throw new Error(n.value.map(s=>`${s.key}: ${s.message}`).join(", "));return n.value}else{let n=i;return e.type==="color"&&typeof i=="string"?n=qe.parse(i):e.type==="padding"&&(typeof i=="number"||Array.isArray(i))?n=ri.parse(i):e.type==="numberArray"&&(typeof i=="number"||Array.isArray(i))?n=ai.parse(i):e.type==="colorArray"&&(typeof i=="string"||Array.isArray(i))?n=Lt.parse(i):e.type==="variableAnchorOffsetCollection"&&Array.isArray(i)?n=Qi.parse(i):e.type==="projectionDefinition"&&typeof i=="string"&&(n=os.parse(i)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>n}}}function Ea(i){let e=null;if(i instanceof Jg)e=Ea(i.result);else if(i instanceof t0){for(const t of i.args)if(e=Ea(t),e)break}else(i instanceof e0||i instanceof Ai)&&i.input instanceof pn&&i.input.name==="zoom"&&(e=i);return e instanceof si||i.eachChild(t=>{const n=Ea(t);n instanceof si?e=n:!e&&n?e=new si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new si("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function xa(i,e=new Set){return i instanceof bd&&e.add(i.key),i.eachChild(t=>{xa(t,e)}),e}function dG(i){const e={color:oi,string:le,number:W,enum:le,boolean:ue,formatted:aa,padding:la,numberArray:ca,colorArray:vo,projectionDefinition:oa,resolvedImage:bo,variableAnchorOffsetCollection:da};return i.type==="array"?yt(e[i.value]||ce,i.length):e[i.type]}function hG(i){if(i.type==="color"&&w0(i.default))return new qe(0,0,0,0);switch(i.type){case"color":return qe.parse(i.default)||null;case"padding":return ri.parse(i.default)||null;case"numberArray":return ai.parse(i.default)||null;case"colorArray":return Lt.parse(i.default)||null;case"variableAnchorOffsetCollection":return Qi.parse(i.default)||null;case"projectionDefinition":return os.parse(i.default)||null;default:return i.default===void 0?null:i.default}}function hs(i,e){const{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a}=i??{};return{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a,globalState:e}}function _d(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!_d(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const uG={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function M0(i,e){if(i==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};_d(i)||(i=Ia(i));const t=Td(i,uG,e);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,s,o)=>t.value.evaluate(n,s,{},o),needGeometry:T0(i),getGlobalStateRefs:()=>xa(t.value.expression)}}function fG(i,e){return i<e?-1:i>e?1:0}function T0(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(T0(i[e]))return!0;return!1}function Ia(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?kd(i[1],i[2],"=="):e==="!="?Sa(kd(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?kd(i[1],i[2],e):e==="any"?pG(i.slice(1)):e==="all"?["all"].concat(i.slice(1).map(Ia)):e==="none"?["all"].concat(i.slice(1).map(Ia).map(Sa)):e==="in"?B0(i[1],i.slice(2)):e==="!in"?Sa(B0(i[1],i.slice(2))):e==="has"?_0(i[1]):e==="!has"?Sa(_0(i[1])):!0}function kd(i,e,t){switch(i){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,i,e]}}function pG(i){return["any"].concat(i.map(Ia))}function B0(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",i,["literal",e.sort(fG)]]:["filter-in-small",i,["literal",e]]}}function _0(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Sa(i){return["!",i]}const k0={StyleExpression:Md,StylePropertyFunction:Bd,ZoomConstantExpression:Ca,ZoomDependentExpression:wa,createExpression:Td,createPropertyExpression:S0,isExpression:I0,isExpressionFilter:_d,isZoomExpression:lG,normalizePropertyExpression:cG};var Pd,P0;function mG(){if(P0)return Pd;P0=1,Pd=i;function i(e,t,n,s){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=s}return i.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,s=0;s<8;s++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<t)return n;var r=this.sampleCurveDerivativeX(n);if(Math.abs(r)<1e-6)break;n=n-o/r}var a=0,l=1;for(n=e,s=0;s<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<t));s++)e>o?a=n:l=n,n=(l-a)*.5+a;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Pd}var gG=mG();const yG=nn(gG);function AG(i,e,t,n){const s=new yG(i,e,t,n);return o=>s.solve(o)}AG(.25,.1,.25,1);function D0(i,e,t){return Math.min(t,Math.max(e,i))}const N0={};function Qe(i){N0[i]||(typeof console<"u"&&console.warn(i),N0[i]=!0)}class Dd{constructor(e,t={}){this.data=t,this.props=new Map,this.groupName=e;const n=Lg[e];for(const s in n)if(Object.hasOwnProperty.call(n,s)){const o=n[s],r=t[s],a=k0.normalizePropertyExpression(r===void 0?o.default:r,o);this.props.set(s,a)}}setProperty(e,t){const n=Lg[this.groupName];if(Object.hasOwnProperty.call(n,e)){const s=n[e];if(this.data[e]===t)return!1;const r=k0.normalizePropertyExpression(Cesium.defined(t)?t:s.default,s);return this.props.set(e,r),!0}else return Qe(`maplibre样式规范不支持属性:${this.groupName}.${e}`),!1}resolveTokens(e,t){return t.replace(/{([^{}]+)}/g,(n,s)=>e&&s in e?String(e[s]):"")}getDataConstValue(e,t){const n=this.props.get(e);return n&&n.evaluate({zoom:t})}getDataValue(e,t,n){const s=this.props.get(e);return s&&s.evaluate({zoom:t},n)}}class L0{constructor(e){this.data=e,this.type=e.type,this.id=e.id,this.minzoom=e.minzoom||0,this.maxzoom=e.maxzoom||24,this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=null,this.paint=new Dd("paint_"+e.type,e.paint),this.layout=new Dd("layout_"+e.type,e.layout),e.filter&&(this.filter=M0(e.filter)),this.paintVersion=0}setLayoutProperty(e,t){return this.layout.setProperty(e,t)}setPaintProperty(e,t){const n=this.paint.setProperty(e,t);return n&&this.paintVersion++,n}setFilter(e){if(e){if(JSON.stringify(this.data.filter)!==JSON.stringify(e))return this.data.filter=e,this.filter=M0(e),!0}else{const t=Cesium.defined(this.filter);return this.filter=null,delete this.data.filter,t}return!1}convertColor(e,t){if(!e)return;const n=e.a>0?1/e.a:1;return t||(t=new Cesium.Color),t.red=e.r*n,t.green=e.g*n,t.blue=e.b*n,t.alpha=e.a,t}}class R0{constructor(e){this.styleLayers=e,this.renderLayers=[],this.layerIndexMap={},this.list=[],this.tileIdCommands=[],this.tileCommands=[],this.visualizers=[]}init(){const{styleLayers:e,renderLayers:t,layerIndexMap:n}=this;for(let s=0;s<e.length;s++){const o=e[s];t[s]=[],n[o.id]=s}this.tileIdCommands.length=0,this.tileCommands.length=0,this.visualizers.length=0}beginFrame(){const e=this.renderLayers;for(const t of e)t.length=0;this.tileIdCommands.length=0,this.tileCommands.length=0,this.visualizers.length=0}push(e){const t=this.layerIndexMap[e.id];this.renderLayers[t].push(e)}getList(){const e=this.list;e.length=0;const t=this.renderLayers;for(const n of t)n&&e.push(...n);return e}destroy(){this.styleLayers.length=0,this.renderLayers.length=0,this.layerIndexMap=null,this.init()}}var Nd,F0;function vG(){if(F0)return Nd;F0=1,Nd=i;function i(e,t){this.x=e,this.y=t}return i.prototype={clone:function(){return new i(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),s=t*this.x-n*this.y,o=n*this.x+t*this.y;return this.x=s,this.y=o,this},_rotateAround:function(e,t){var n=Math.cos(e),s=Math.sin(e),o=t.x+n*(this.x-t.x)-s*(this.y-t.y),r=t.y+s*(this.x-t.x)+n*(this.y-t.y);return this.x=o,this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(e){return e instanceof i?e:Array.isArray(e)?new i(e[0],e[1]):e},Nd}vG();function bG(i,e,t=2){const n=e&&e.length,s=n?e[0]*t:i.length;let o=O0(i,0,s,t,!0);const r=[];if(!o||o.next===o.prev)return r;let a,l,c;if(n&&(o=IG(i,e,o,t)),i.length>80*t){a=i[0],l=i[1];let h=a,u=l;for(let p=t;p<s;p+=t){const f=i[p],m=i[p+1];f<a&&(a=f),m<l&&(l=m),f>h&&(h=f),m>u&&(u=m)}c=Math.max(h-a,u-l),c=c!==0?32767/c:0}return Mo(o,r,t,a,l,c,0),r}function O0(i,e,t,n,s){let o;if(s===RG(i,e,t,n)>0)for(let r=e;r<t;r+=n)o=Q0(r/n|0,i[r],i[r+1],o);else for(let r=t-n;r>=e;r-=n)o=Q0(r/n|0,i[r],i[r+1],o);return o&&us(o,o.next)&&(_o(o),o=o.next),o}function gn(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(us(t,t.next)||Re(t.prev,t,t.next)===0)){if(_o(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Mo(i,e,t,n,s,o,r){if(!i)return;!r&&o&&_G(i,n,s,o);let a=i;for(;i.prev!==i.next;){const l=i.prev,c=i.next;if(o?wG(i,n,s,o):CG(i)){e.push(l.i,i.i,c.i),_o(i),i=c.next,a=c.next;continue}if(i=c,i===a){r?r===1?(i=EG(gn(i),e),Mo(i,e,t,n,s,o,2)):r===2&&xG(i,e,t,n,s,o):Mo(gn(i),e,t,n,s,o,1);break}}}function CG(i){const e=i.prev,t=i,n=i.next;if(Re(e,t,n)>=0)return!1;const s=e.x,o=t.x,r=n.x,a=e.y,l=t.y,c=n.y,h=Math.min(s,o,r),u=Math.min(a,l,c),p=Math.max(s,o,r),f=Math.max(a,l,c);let m=n.next;for(;m!==e;){if(m.x>=h&&m.x<=p&&m.y>=u&&m.y<=f&&To(s,a,o,l,r,c,m.x,m.y)&&Re(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function wG(i,e,t,n){const s=i.prev,o=i,r=i.next;if(Re(s,o,r)>=0)return!1;const a=s.x,l=o.x,c=r.x,h=s.y,u=o.y,p=r.y,f=Math.min(a,l,c),m=Math.min(h,u,p),y=Math.max(a,l,c),g=Math.max(h,u,p),A=Ld(f,m,e,t,n),v=Ld(y,g,e,t,n);let C=i.prevZ,w=i.nextZ;for(;C&&C.z>=A&&w&&w.z<=v;){if(C.x>=f&&C.x<=y&&C.y>=m&&C.y<=g&&C!==s&&C!==r&&To(a,h,l,u,c,p,C.x,C.y)&&Re(C.prev,C,C.next)>=0||(C=C.prevZ,w.x>=f&&w.x<=y&&w.y>=m&&w.y<=g&&w!==s&&w!==r&&To(a,h,l,u,c,p,w.x,w.y)&&Re(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;C&&C.z>=A;){if(C.x>=f&&C.x<=y&&C.y>=m&&C.y<=g&&C!==s&&C!==r&&To(a,h,l,u,c,p,C.x,C.y)&&Re(C.prev,C,C.next)>=0)return!1;C=C.prevZ}for(;w&&w.z<=v;){if(w.x>=f&&w.x<=y&&w.y>=m&&w.y<=g&&w!==s&&w!==r&&To(a,h,l,u,c,p,w.x,w.y)&&Re(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function EG(i,e){let t=i;do{const n=t.prev,s=t.next.next;!us(n,s)&&U0(n,t,t.next,s)&&Bo(n,s)&&Bo(s,n)&&(e.push(n.i,t.i,s.i),_o(t),_o(t.next),t=i=s),t=t.next}while(t!==i);return gn(t)}function xG(i,e,t,n,s,o){let r=i;do{let a=r.next.next;for(;a!==r.prev;){if(r.i!==a.i&&DG(r,a)){let l=V0(r,a);r=gn(r,r.next),l=gn(l,l.next),Mo(r,e,t,n,s,o,0),Mo(l,e,t,n,s,o,0);return}a=a.next}r=r.next}while(r!==i)}function IG(i,e,t,n){const s=[];for(let o=0,r=e.length;o<r;o++){const a=e[o]*n,l=o<r-1?e[o+1]*n:i.length,c=O0(i,a,l,n,!1);c===c.next&&(c.steiner=!0),s.push(PG(c))}s.sort(SG);for(let o=0;o<s.length;o++)t=MG(s[o],t);return t}function SG(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),s=(e.next.y-e.y)/(e.next.x-e.x);t=n-s}return t}function MG(i,e){const t=TG(i,e);if(!t)return e;const n=V0(t,i);return gn(n,n.next),gn(t,t.next)}function TG(i,e){let t=e;const n=i.x,s=i.y;let o=-1/0,r;if(us(i,t))return t;do{if(us(i,t.next))return t.next;if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){const u=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>o&&(o=u,r=t.x<t.next.x?t:t.next,u===n))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,c=r.y;let h=1/0;t=r;do{if(n>=t.x&&t.x>=l&&n!==t.x&&G0(s<c?n:o,s,l,c,s<c?o:n,s,t.x,t.y)){const u=Math.abs(s-t.y)/(n-t.x);Bo(t,i)&&(u<h||u===h&&(t.x>r.x||t.x===r.x&&BG(r,t)))&&(r=t,h=u)}t=t.next}while(t!==a);return r}function BG(i,e){return Re(i.prev,i,e.prev)<0&&Re(e.next,i,i.next)<0}function _G(i,e,t,n){let s=i;do s.z===0&&(s.z=Ld(s.x,s.y,e,t,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,kG(s)}function kG(i){let e,t=1;do{let n=i,s;i=null;let o=null;for(e=0;n;){e++;let r=n,a=0;for(let c=0;c<t&&(a++,r=r.nextZ,!!r);c++);let l=t;for(;a>0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(s=n,n=n.nextZ,a--):(s=r,r=r.nextZ,l--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;n=r}o.nextZ=null,t*=2}while(e>1);return i}function Ld(i,e,t,n,s){return i=(i-t)*s|0,e=(e-n)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function PG(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function G0(i,e,t,n,s,o,r,a){return(s-r)*(e-a)>=(i-r)*(o-a)&&(i-r)*(n-a)>=(t-r)*(e-a)&&(t-r)*(o-a)>=(s-r)*(n-a)}function To(i,e,t,n,s,o,r,a){return!(i===r&&e===a)&&G0(i,e,t,n,s,o,r,a)}function DG(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!NG(i,e)&&(Bo(i,e)&&Bo(e,i)&&LG(i,e)&&(Re(i.prev,i,e.prev)||Re(i,e.prev,e))||us(i,e)&&Re(i.prev,i,i.next)>0&&Re(e.prev,e,e.next)>0)}function Re(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function us(i,e){return i.x===e.x&&i.y===e.y}function U0(i,e,t,n){const s=Ta(Re(i,e,t)),o=Ta(Re(i,e,n)),r=Ta(Re(t,n,i)),a=Ta(Re(t,n,e));return!!(s!==o&&r!==a||s===0&&Ma(i,t,e)||o===0&&Ma(i,n,e)||r===0&&Ma(t,i,n)||a===0&&Ma(t,e,n))}function Ma(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function Ta(i){return i>0?1:i<0?-1:0}function NG(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&U0(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Bo(i,e){return Re(i.prev,i,i.next)<0?Re(i,e,i.next)>=0&&Re(i,i.prev,e)>=0:Re(i,e,i.prev)<0||Re(i,i.next,e)<0}function LG(i,e){let t=i,n=!1;const s=(i.x+e.x)/2,o=(i.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&s<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function V0(i,e){const t=Rd(i.i,i.x,i.y),n=Rd(e.i,e.x,e.y),s=i.next,o=e.prev;return i.next=e,e.prev=i,t.next=s,s.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function Q0(i,e,t,n){const s=Rd(i,e,t);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function _o(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Rd(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function RG(i,e,t,n){let s=0;for(let o=e,r=t-n;o<t;o+=n)s+=(i[r]-i[o])*(i[o+1]+i[r+1]),r=o;return s}class bi{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){const t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}}const Da=class Da{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};Da.noSubdivision=new Da({fill:new bi(0,0),line:new bi(0,0),tile:new bi(0,0),stencil:new bi(0,0),circle:1});let Ba=Da;const Hi=3;class Fd{constructor(e,t,n){const s=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const r=new Int32Array(this.arrayBuffer);e=r[0],t=r[1],n=r[2],this.d=t+2*n;for(let c=0;c<this.d*this.d;c++){const h=r[Hi+c],u=r[Hi+c+1];s.push(h===u?null:r.subarray(h,u))}const a=r[Hi+s.length],l=r[Hi+s.length+1];this.keys=r.subarray(a,l),this.bboxes=r.subarray(l),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let r=0;r<this.d*this.d;r++)s.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;const o=n/t*e;this.min=-o,this.max=e+o}insert(e,t,n,s,o){this._forEachCell(t,n,s,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,n,s,o,r){this.cells[o].push(r)}query(e,t,n,s,o){const r=this.min,a=this.max;if(e<=r&&t<=r&&a<=n&&a<=s&&!o)return[...this.keys];{const l=[],c={};return this._forEachCell(e,t,n,s,this._queryCell,l,c,o),l}}_queryCell(e,t,n,s,o,r,a,l){const c=this.cells[o];if(c!==null){const h=this.keys,u=this.bboxes;for(const p of c)if(a[p]===void 0){const f=p*4;(l?l(u[f+0],u[f+1],u[f+2],u[f+3]):e<=u[f+2]&&t<=u[f+3]&&n>=u[f+0]&&s>=u[f+1])?(a[p]=!0,r.push(h[p])):a[p]=!1}}}_forEachCell(e,t,n,s,o,r,a,l){const c=this._convertToCellCoord(e),h=this._convertToCellCoord(t),u=this._convertToCellCoord(n),p=this._convertToCellCoord(s);for(let f=c;f<=u;f++)for(let m=h;m<=p;m++){const y=this.d*m+f;if(!(l&&!l(this._convertFromCellCoord(f),this._convertFromCellCoord(m),this._convertFromCellCoord(f+1),this._convertFromCellCoord(m+1)))&&o.call(this,e,t,n,s,y,r,a,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=Hi+this.cells.length+1+1;let n=0;for(const r of this.cells)n+=r.length;const s=new Int32Array(t+n+this.keys.length+this.bboxes.length);s[0]=this.extent,s[1]=this.n,s[2]=this.padding;let o=t;for(let r=0;r<e.length;r++){const a=e[r];s[Hi+r]=o,s.set(a,o),o+=a.length}return s[Hi+e.length]=o,s.set(this.keys,o),o+=this.keys.length,s[Hi+e.length+1]=o,s.set(this.bboxes,o),o+=this.bboxes.length,s.buffer}static serialize(e,t){const n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new Fd(e.buffer)}}class FG extends Error{constructor(e,t,n,s){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=s}}const z0={};function At(i,e,t={}){if(z0[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),z0[i]={klass:e,omit:t.omit||[],shallow:t.shallow||[]}}At("Object",Object),At("Set",Set),At("TransferableGridIndex",Fd),At("Color",qe),At("Error",Error),At("AJAXError",FG),At("ResolvedImage",zi),At("StylePropertyFunction",Bd),At("StyleExpression",Md,{omit:["_evaluator"]}),At("ZoomDependentExpression",wa),At("ZoomConstantExpression",Ca),At("CompoundExpression",pn,{omit:["_evaluate"]});for(const i in cs)cs[i]._classRegistryKey||At(`Expression_${i}`,cs[i]);At("SubdivisionGranularityExpression",bi),At("SubdivisionGranularitySetting",Ba);const fs=-32768,ko=32767;class OG{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=Tt/e,this._canonical=t}_getKey(e,t){return e=e+32768,t=t+32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const n=Math.round(e)|0,s=Math.round(t)|0,o=this._getKey(n,s);if(this._vertexDictionary.has(o))return this._vertexDictionary.get(o);const r=this._vertexBuffer.length/2;return this._vertexDictionary.set(o,r),this._vertexBuffer.push(n,s),r}_subdivideTrianglesScanline(e){if(this._granularity<2)return VG(this._vertexBuffer,e);const t=[],n=e.length;for(let s=0;s<n;s+=3){const o=[e[s+0],e[s+1],e[s+2]],r=[this._vertexBuffer[e[s+0]*2+0],this._vertexBuffer[e[s+0]*2+1],this._vertexBuffer[e[s+1]*2+0],this._vertexBuffer[e[s+1]*2+1],this._vertexBuffer[e[s+2]*2+0],this._vertexBuffer[e[s+2]*2+1]];let a=1/0,l=1/0,c=-1/0,h=-1/0;for(let y=0;y<3;y++){const g=r[y*2],A=r[y*2+1];a=Math.min(a,g),c=Math.max(c,g),l=Math.min(l,A),h=Math.max(h,A)}if(a===c||l===h)continue;const u=Math.floor(a/this._granularityCellSize),p=Math.ceil(c/this._granularityCellSize),f=Math.floor(l/this._granularityCellSize),m=Math.ceil(h/this._granularityCellSize);if(u===p&&f===m){t.push(...o);continue}for(let y=f;y<m;y++){const g=this._scanlineGenerateVertexRingForCellRow(y,r,o);QG(this._vertexBuffer,g,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,n){const s=e*this._granularityCellSize,o=s+this._granularityCellSize,r=[];for(let a=0;a<3;a++){const l=t[a*2],c=t[a*2+1],h=t[(a+1)*2%6],u=t[((a+1)*2+1)%6],p=t[(a+2)*2%6],f=t[((a+2)*2+1)%6],m=h-l,y=u-c,g=m===0,A=y===0,v=(s-c)/y,C=(o-c)/y,w=Math.min(v,C),M=Math.max(v,C);if(!A&&(w>=1||M<=0)||A&&(c<s||c>o)){u>=s&&u<=o&&r.push(n[(a+1)%3]);continue}if(!A&&w>0){const S=l+m*w,R=c+y*w;r.push(this._vertexToIndex(S,R))}const x=l+m*Math.max(w,0),I=l+m*Math.min(M,1);if(g||this._generateIntraEdgeVertices(r,l,c,h,u,x,I),!A&&M<1){const S=l+m*M,R=c+y*M;r.push(this._vertexToIndex(S,R))}(A||u>=s&&u<=o)&&r.push(n[(a+1)%3]),!A&&(u<=s||u>=o)&&this._generateInterEdgeVertices(r,l,c,h,u,p,f,I,s,o)}return r}_generateIntraEdgeVertices(e,t,n,s,o,r,a){const l=s-t,c=o-n,h=c===0,u=h?Math.min(t,s):Math.min(r,a),p=h?Math.max(t,s):Math.max(r,a),f=Math.floor(u/this._granularityCellSize)+1,m=Math.ceil(p/this._granularityCellSize)-1;if(h?t<s:r<a)for(let g=f;g<=m;g++){const A=g*this._granularityCellSize,v=n+c*(A-t)/l;e.push(this._vertexToIndex(A,v))}else for(let g=m;g>=f;g--){const A=g*this._granularityCellSize,v=n+c*(A-t)/l;e.push(this._vertexToIndex(A,v))}}_generateInterEdgeVertices(e,t,n,s,o,r,a,l,c,h){const u=o-n,p=r-s,f=a-o,m=(c-o)/f,y=(h-o)/f,g=Math.min(m,y),A=Math.max(m,y),v=s+p*g;let C=Math.floor(Math.min(v,l)/this._granularityCellSize)+1,w=Math.ceil(Math.max(v,l)/this._granularityCellSize)-1,M=l<v;const x=f===0;if(x&&(a===c||a===h))return;if(x||g>=1||A<=0){const S=t-r,R=n-a,b=(c-a)/R,B=(h-a)/R,L=Math.min(b,B),O=r+S*L;C=Math.floor(Math.min(O,l)/this._granularityCellSize)+1,w=Math.ceil(Math.max(O,l)/this._granularityCellSize)-1,M=l<O}const I=u>0?h:c;if(M)for(let S=C;S<=w;S++){const R=S*this._granularityCellSize;e.push(this._vertexToIndex(R,I))}else for(let S=w;S>=C;S--){const R=S*this._granularityCellSize;e.push(this._vertexToIndex(R,I))}}_generateOutline(e){const t=[];for(const n of e){const s=H0(n,this._granularity,!0),o=this._pointArrayToIndices(s),r=[];for(let a=1;a<o.length;a++)r.push(o[a-1]),r.push(o[a]);t.push(r)}return t}_handlePoles(e){let t=!1,n=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(t||n)&&this._fillPoles(e,t,n)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){const n=e[t+1];n===fs&&(e[t+1]=fs+1),n===ko&&(e[t+1]=ko-1)}}_generatePoleQuad(e,t,n,s,o,r){s>o!=(r===fs)?(e.push(t),e.push(n),e.push(this._vertexToIndex(s,r)),e.push(n),e.push(this._vertexToIndex(o,r)),e.push(this._vertexToIndex(s,r))):(e.push(n),e.push(t),e.push(this._vertexToIndex(s,r)),e.push(this._vertexToIndex(o,r)),e.push(n),e.push(this._vertexToIndex(s,r)))}_fillPoles(e,t,n){const s=this._vertexBuffer,o=0,r=Tt,a=e.length;for(let l=2;l<a;l+=3){const c=e[l-2],h=e[l-1],u=e[l],p=s[c*2],f=s[c*2+1],m=s[h*2],y=s[h*2+1],g=s[u*2],A=s[u*2+1];t&&(f===o&&y===o&&this._generatePoleQuad(e,c,h,p,m,fs),y===o&&A===o&&this._generatePoleQuad(e,h,u,m,g,fs),A===o&&f===o&&this._generatePoleQuad(e,u,c,g,p,fs)),n&&(f===r&&y===r&&this._generatePoleQuad(e,c,h,p,m,ko),y===r&&A===r&&this._generatePoleQuad(e,h,u,m,g,ko),A===r&&f===r&&this._generatePoleQuad(e,u,c,g,p,ko))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:n,holeIndices:s}=UG(e);this._initializeVertices(n);let o;try{const a=bG(n,s),l=this._convertIndices(n,a);o=this._subdivideTrianglesScanline(l)}catch(a){console.error(a)}let r=[];return t&&(r=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(o),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:r}}_convertIndices(e,t){const n=[];for(const s of t){const o=e[s*2],r=e[s*2+1];n.push(this._vertexToIndex(o,r))}return n}_pointArrayToIndices(e){const t=[];for(const n of e)t.push(this._vertexToIndex(n.x,n.y));return t}}function GG(i,e,t,n=!0){return new OG(t,e).subdividePolygonInternal(i,n)}function H0(i,e,t=!1){if(!i||i.length<1)return[];if(i.length<2)return[];const n=i[0],s=i[i.length-1],o=t&&(n.x!==s.x||n.y!==s.y);if(e<2)return o?[...i,i[0]]:[...i];const r=Math.floor(Tt/e),a=[];a.push(new Ne(i[0].x,i[0].y));const l=i.length,c=o?l:l-1;for(let h=0;h<c;h++){const u=i[h],p=h<l-1?i[h+1]:i[0],f=u.x,m=u.y,y=p.x,g=p.y,A=f!==y,v=m!==g;if(!A&&!v)continue;const C=y-f,w=g-m,M=Math.abs(C),x=Math.abs(w);let I=f,S=m;for(;;){const b=C>0?(Math.floor(I/r)+1)*r:(Math.ceil(I/r)-1)*r,B=w>0?(Math.floor(S/r)+1)*r:(Math.ceil(S/r)-1)*r,L=Math.abs(I-b),O=Math.abs(S-B),N=Math.abs(I-y),D=Math.abs(S-g),E=A?L/M:Number.POSITIVE_INFINITY,T=v?O/x:Number.POSITIVE_INFINITY;if((N<=L||!A)&&(D<=O||!v))break;if(E<T&&A||!v){I=b,S=S+w*E;const P=new Ne(I,Math.round(S));(a[a.length-1].x!==P.x||a[a.length-1].y!==P.y)&&a.push(P)}else{I=I+C*T,S=B;const P=new Ne(Math.round(I),S);(a[a.length-1].x!==P.x||a[a.length-1].y!==P.y)&&a.push(P)}}const R=new Ne(y,g);(a[a.length-1].x!==R.x||a[a.length-1].y!==R.y)&&a.push(R)}return a}function UG(i){const e=[],t=[];for(const n of i)if(n.length!==0){n!==i[0]&&e.push(t.length/2);for(const s of n)t.push(s.x),t.push(s.y)}return{flattened:t,holeIndices:e}}function VG(i,e){const t=[];for(let n=0;n<e.length;n+=3){const s=e[n],o=e[n+1],r=e[n+2],a=i[s*2],l=i[s*2+1],c=i[o*2],h=i[o*2+1],u=i[r*2],p=i[r*2+1],f=c-a,m=h-l,y=u-a,g=p-l;f*g-m*y>0?(t.push(s),t.push(r),t.push(o)):(t.push(s),t.push(o),t.push(r))}return t}function QG(i,e,t){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let n=0,s=i[e[0]*2];for(let l=1;l<e.length;l++){const c=i[e[l]*2];c<s&&(s=c,n=l)}const o=e.length;let r=n,a=(r+1)%o;for(;;){const l=r-1>=0?r-1:o-1,c=(a+1)%o,h=i[e[l]*2],u=i[e[l]*2+1],p=i[e[c]*2],f=i[e[c]*2+1],m=i[e[r]*2],y=i[e[r]*2+1],g=i[e[a]*2],A=i[e[a]*2+1];let v=!1;if(h<p)v=!0;else if(h>p)v=!1;else{const C=A-y,w=-(g-m),M=y<A?1:-1,x=((h-m)*C+(u-y)*w)*M,I=((p-m)*C+(f-y)*w)*M;x>I&&(v=!0)}if(v){const C=e[l],w=e[r],M=e[a];C!==w&&C!==M&&w!==M&&t.push(M,w,C),r--,r<0&&(r=o-1)}else{const C=e[c],w=e[r],M=e[a];C!==w&&C!==M&&w!==M&&t.push(M,w,C),a++,a>=o&&(a=0)}if(l===c)break}}const Y0={globe:new Ba({fill:new bi(128,2),line:new bi(512,0),tile:new bi(128,32),stencil:new bi(128,1),circle:3})};let Od=null,$0=0,Gd=null;function zG(i,e){return Gd===null&&(Gd=Cesium.TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.ellipsoid,128,e.getNumberOfXTilesAtLevel(0))),Gd/(1<<i)}function HG(i,e){const t=zG(e.z,e.tilingScheme),n=e.distanceToCamera,s=i.context.drawingBufferHeight,o=i.camera.frustum.sseDenominator;let r=t*s/(n*o);return i.fog.enabled&&(r-=Cesium.Math.fog(n,i.fog.density)*i.fog.sse),r/=i.pixelRatio,r}function YG(){Od===null&&(Od=Cesium.RenderState.fromCache({id:"vt_tile-depth",blending:Cesium.BlendingState.DISABLED,depthTest:{enabled:!0},depthMask:!0,cull:{enabled:!0},stencilMask:Cesium.StencilConstants.CESIUM_3D_TILE_MASK,stencilTest:{backFunction:519,backOperation:{fail:7680,zFail:7680,zPass:7681},enabled:!0,frontFunction:519,frontOperation:{fail:7680,zFail:7680,zPass:7681},mask:128,reference:128},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}))}class _a{constructor(e){YG(),this.x=e.x,this.y=e.y,this.z=e.z,this.parent=e.parent,this.children=[],this.tilingScheme=e.tilingScheme,this.rectangle=this.tilingScheme.tileXYToRectangle(this.x,this.y,this.z),this.tileBoundingRegion=new Cesium.TileBoundingRegion({rectangle:this.rectangle,minimumHeight:0,maximumHeight:0,ellipsoid:this.tilingScheme.ellipsoid,computeBoundingVolumes:!0}),this.layers=[],this.visualizers=[],this.sources={},this.tileId=null,this.lastVisitTime=0,this.state="none",this.renderable=!1,this.tileId={x:this.x,y:this.y,z:this.z,key:$0++,color:Cesium.Color.fromRgba($0-1),tileColor:Cesium.Color.fromRandom({alpha:1})};const t=Tt*Math.pow(2,this.z),n=Tt*this.x,s=Tt*this.y;this.transformPoint=function(o,r,a){return a[0]=(o+n)*360/t-180,a[1]=360/Math.PI*Math.atan(Math.exp((1-(r+s)*2/t)*Math.PI))-90,a}}createChildren(){var e=[{x:this.x*2,y:this.y*2+1,z:this.z+1},{x:this.x*2+1,y:this.y*2+1,z:this.z+1},{x:this.x*2,y:this.y*2,z:this.z+1},{x:this.x*2+1,y:this.y*2,z:this.z+1}];for(const{x:n,y:s,z:o}of e){var t=new _a({x:n,y:s,z:o,tilingScheme:this.tilingScheme,parent:this});this.children.push(t)}}visit(e,t){const n=this.tileBoundingRegion;if(this.distanceToCamera=n.distanceToCamera(e),this.visibility=e.cullingVolume.computeVisibility(n),this.visibility==Cesium.Intersect.OUTSIDE)return;const s=e.maximumScreenSpaceError;HG(e,this)>=s?t.visitChildren(this):t.accept(this)}async getSources(e){const t={},n=e._styleJson;for(const o of n.layers){const r=o.source,a=e.sources[r];a&&!t[r]&&(t[r]=a)}if(e._taskProcessor&&Object.values(t).every(o=>o.type==="vector")){for(const o in t){const r=t[o];try{const a=await r.requestTileBuffer(this.x,this.y,this.z,e);a&&a.buffer&&(this.sources[o]=a)}catch{}}this._workerBuffers=!0}else for(const o in t){const r=t[o];try{const a=await r.requestTile(this.x,this.y,this.z,e);a&&(this.sources[o]=a)}catch{}}e.numLoading--,this.state="loaded"}async createRenderLayers(e,t){const n=this.sources,s=t._styleLayers,o=this.layers,r=this.visualizers,a={};for(const l of s){const c=n[l.source],h=ps[l.type],u=ms[l.type],p=l.type==="background";if(h||Qe("不支持图层类型"+l.type),!p&&!c||!h)continue;const f=[];if(!p){const g=(l.source&&t.sources[l.source].type)=="geojson"?"_geojsonTileLayer":l.sourceLayer,A=c.layers[g];if(!A)continue;const v=A.length;for(let C=0;C<v;C++){const w=A.feature(C);l.filter&&!l.filter.filter({zoom:this.z},w)||(w.toGeoJSON||(w.toGeoJSON=Yn.prototype.toGeoJSON),f.push(w))}if(!f.length)continue}const m=new h(f,l,this);if(o.push(m),u){let y=a[l.type];y||(y=new u(this),a[l.type]=y,r.push(y)),y.addLayer(f,m,e,t)}}this.state="ready"}createRenderLayersFromWorkerResult(e,t,n){if(e.error){this.state="error";return}const s=n._styleLayers,o=this.layers,r=this.visualizers,a={};for(const l of e.fill||[]){const c=s.find(m=>m.id===l.layerId);if(!c)continue;const h=ps.fill,u=ms.fill,p=new h([],c,this);o.push(p);let f=a.fill;f||(f=new u(this),a.fill=f,r.push(f)),f.addLayerFromWorkerResult(l,p,t,n)}for(const l of e.line||[]){const c=s.find(m=>m.id===l.layerId);if(!c)continue;const h=ps.line,u=ms.line,p=new h([],c,this);o.push(p);let f=a.line;f||(f=new u(this),a.line=f,r.push(f)),f.addLayerFromWorkerResult(l,p,t,n)}for(const l of e.symbol||[]){const c=s.find(m=>m.id===l.layerId);if(!c)continue;const h=ps.symbol,u=ms.symbol,p=new h([],c,this);o.push(p);let f=a.symbol;f||(f=new u(this),a.symbol=f,r.push(f)),f.addLayerFromWorkerResult(l,p,t,n)}this.state="ready"}update(e,t,n){this.primitive||(this.primitive=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:new Cesium.RectangleGeometry({rectangle:this.rectangle})}),compressVertices:!1,asynchronous:!1,appearance:new Cesium.MaterialAppearance({flat:!0,translucent:!1,material:Cesium.Material.fromType("Color",{color:Cesium.Color.fromAlpha(this.tileId.tileColor,.25)}),renderState:{blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!1}}})}),this.primitive.name="_tile-color_");const s=this.commandList||[],o=this.tileIdCommands||[],r=this.tileDepthCommands||[];if(!s.length){const a=e.commandList;if(e.commandList=s,this.primitive.update(e),s.length){const l=this.tileId.color;for(const c of s){c.pass=Cesium.Pass.CESIUM_3D_TILE;const h=Cesium.DrawCommand.shallowClone(c);h.renderState=Cesium.RenderState.fromCache({id:"tileId",blending:{enabled:!1},depthTest:{enabled:!1},depthMask:!0,cull:{enabled:!0}}),h.layerType="tile-id",h.uniformMap={...c.uniformMap},h.uniformMap.color_0=function(){return l},o.push(h);const u=Cesium.DrawCommand.shallowClone(c);u.pass=Cesium.Pass.CESIUM_3D_TILE,u.renderState=Od,r.layerType="tile-depth",r.push(u)}this.tileIdCommands=o,this.tileDepthCommands=r}this.commandList=s,e.commandList=a}if(n.showTileColor&&s.length&&t.tileCommands.push(...s),this.state=="none"&&n.numLoading<=n.maxLoading&&(n.numLoading++,this.state="loading",this.getSources(n)),this.state==="loaded"&&n.numInitializing<n.maxInitializing)if(this._workerBuffers&&n._taskProcessor){const a={sources:{},x:this.x,y:this.y,z:this.z,extent:Tt,styleLayers:n._styleLayers.map(h=>({id:h.id,type:h.type,source:h.source,sourceLayer:h.sourceLayer??h.data["source-layer"],filter:h.data.filter,paint:h.data.paint,layout:h.data.layout}))},l=[];for(const h in this.sources){const u=this.sources[h];u&&u.buffer&&(a.sources[h]={buffer:u.buffer,encoding:u.encoding||"mvt"},l.push(u.buffer))}const c=n._taskProcessor.scheduleTask(a,l);Cesium.defined(c)&&(this.state="initializing",n.numInitializing++,c.then(h=>{this.createRenderLayersFromWorkerResult(h,e,n)}).catch(()=>{this.state="error"}))}else this.state="initializing",n.numInitializing++,this.createRenderLayers(e,n);if(this.state==="ready"){let a=!0,l=!0;for(const c of this.visualizers)c.update(e,n),c.state==="none"&&(a=!1);for(const c of this.layers)c.update(e,n),c.visibility!="none"&&c.state=="none"&&(l=!1);this.renderable=a&&l}}render(e,t,n){if(!this.renderable)return;this.commandList;const s=this.tileIdCommands,o=this.tileDepthCommands;for(const r of this.layers)t.push(r);for(const r of this.visualizers)t.visualizers.push(r);for(const r of s)t.tileIdCommands.push(r);o.length&&t.tileCommands.push(...o)}unload(){this.primitive&&(this.primitive.destroy(),this.primitive=null),this.tileGeometry=null,this.commandList&&(this.commandList.length=0),this.tileIdCommands&&(this.tileIdCommands.length=0),this.tileDepthCommands&&(this.tileDepthCommands.length=0);for(const e of this.visualizers)e.destroy();this.visualizers.length=0;for(const e of this.layers)e.destroy();this.layers.length=0,this.sources={},this.state="none"}destroy(){if(this.unload(),this.tileId=null,this.tilingScheme=null,this.parent=null,this.children){for(const e of this.children)e.destroy();this.children.length=0,this.children=null}}}function ka(i,e){let t=!0;return i==="always"||(i==="never"||e==="never")&&(t=!1),t}class $G{constructor(e,t,n){const s=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let r=0;r<this.xCellCount*this.yCellCount;r++)s.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,s,o){this._forEachCell(t,n,s,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(o)}insertCircle(e,t,n,s){this._forEachCell(t-s,n-s,t+s,n+s,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(s)}_insertBoxCell(e,t,n,s,o,r){this.boxCells[o].push(r)}_insertCircleCell(e,t,n,s,o,r){this.circleCells[o].push(r)}_query(e,t,n,s,o,r,a){if(n<0||e>this.width||s<0||t>this.height)return[];const l=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=s){if(o)return[{key:null,x1:e,y1:t,x2:n,y2:s}];for(let c=0;c<this.boxKeys.length;c++)l.push({key:this.boxKeys[c],x1:this.bboxes[c*4],y1:this.bboxes[c*4+1],x2:this.bboxes[c*4+2],y2:this.bboxes[c*4+3]});for(let c=0;c<this.circleKeys.length;c++){const h=this.circles[c*3],u=this.circles[c*3+1],p=this.circles[c*3+2];l.push({key:this.circleKeys[c],x1:h-p,y1:u-p,x2:h+p,y2:u+p})}}else{const c={hitTest:o,overlapMode:r,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,n,s,this._queryCell,l,c,a)}return l}query(e,t,n,s){return this._query(e,t,n,s,!1,null)}hitTest(e,t,n,s,o,r){return this._query(e,t,n,s,!0,o,r).length>0}hitTestCircle(e,t,n,s,o){const r=e-n,a=e+n,l=t-n,c=t+n;if(a<0||r>this.width||c<0||l>this.height)return!1;const h=[],u={hitTest:!0,overlapMode:s,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}};return this._forEachCell(r,l,a,c,this._queryCellCircle,h,u,o),h.length>0}_queryCell(e,t,n,s,o,r,a,l){const{seenUids:c,hitTest:h,overlapMode:u}=a,p=this.boxCells[o],f=1e-6;if(p!==null){const y=this.bboxes;for(const g of p)if(!c.box[g]){c.box[g]=!0;const A=g*4,v=this.boxKeys[g];if(e<=y[A+2]+f&&t<=y[A+3]+f&&n>=y[A+0]-f&&s>=y[A+1]-f&&(!l||l(v))&&(!h||!ka(u,v.overlapMode))&&(r.push({key:v,x1:y[A],y1:y[A+1],x2:y[A+2],y2:y[A+3]}),h))return!0}}const m=this.circleCells[o];if(m!==null){const y=this.circles;for(const g of m)if(!c.circle[g]){c.circle[g]=!0;const A=g*3,v=this.circleKeys[g];if(this._circleAndRectCollide(y[A],y[A+1],y[A+2],e,t,n,s)&&(!l||l(v))&&(!h||!ka(u,v.overlapMode))){const C=y[A],w=y[A+1],M=y[A+2];if(r.push({key:v,x1:C-M,y1:w-M,x2:C+M,y2:w+M}),h)return!0}}}return!1}_queryCellCircle(e,t,n,s,o,r,a,l){const{circle:c,seenUids:h,overlapMode:u}=a,p=this.boxCells[o];if(p!==null){const m=this.bboxes;for(const y of p)if(!h.box[y]){h.box[y]=!0;const g=y*4,A=this.boxKeys[y];if(this._circleAndRectCollide(c.x,c.y,c.radius,m[g+0],m[g+1],m[g+2],m[g+3])&&(!l||l(A))&&!ka(u,A.overlapMode))return r.push(!0),!0}}const f=this.circleCells[o];if(f!==null){const m=this.circles;for(const y of f)if(!h.circle[y]){h.circle[y]=!0;const g=y*3,A=this.circleKeys[y];if(this._circlesCollide(m[g],m[g+1],m[g+2],c.x,c.y,c.radius)&&(!l||l(A))&&!ka(u,A.overlapMode))return r.push(!0),!0}}}_forEachCell(e,t,n,s,o,r,a,l){const c=this._convertToXCellCoord(e),h=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),p=this._convertToYCellCoord(s);for(let f=c;f<=u;f++)for(let m=h;m<=p;m++){const y=this.xCellCount*m+f;if(o.call(this,e,t,n,s,y,r,a,l))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,s,o,r){const a=s-e,l=o-t,c=n+r;return c*c>a*a+l*l}_circleAndRectCollide(e,t,n,s,o,r,a){const l=(r-s)/2,c=Math.abs(e-(s+l));if(c>l+n)return!1;const h=(a-o)/2,u=Math.abs(t-(o+h));if(u>h+n)return!1;if(c<=l||u<=h)return!0;const p=c-l,f=u-h;return p*p+f*f<=n*n}}const j0=100;let W0=null,q0=null;class jG{constructor(){W0=new Cesium.Cartesian2,q0=new Cesium.BoundingRectangle}update(e,t,n){const s=e.context.drawingBufferWidth/e.pixelRatio,o=e.context.drawingBufferHeight/e.pixelRatio,r=e.camera._scene,a=new $G(s+2*j0,o+2*j0,25);for(const l of t){const c=l.style,h=l.labels;if(l.type!=="symbol"||l.visibility==="none"||n<c.minzoom||n>=c.maxzoom||!Cesium.defined(h)||!h.length)continue;const u=c.layout.getDataConstValue("text-allow-overlap",l.tile.z),p=c.layout.getDataConstValue("text-overlap",l.tile.z),f=WG(p,u),m=c.layout.getDataConstValue("text-padding",l.tile.z);for(const y of h){const g=y.computeScreenSpacePosition(r,W0);if(!g){y.vtPlaceable=!0;continue}const A=Cesium.Label.getScreenSpaceBoundingBox(y,g,q0),v=A.x-m,C=A.y-m,w=v+A.width+m,M=C+A.height+m;if(a.hitTest(v,C,w,M,f,null))y.vtPlaceable=!1;else{const x={overlapMode:f};a.insert(x,v,C,w,M),y.vtPlaceable=!0}}}}}function WG(i,e){let t="never";return i?t=i:e&&(t="always"),t}class qG{constructor(e){this.maximumLevel=24,this.show=!0,this.showTileColor=!!e.showTileColor,this.ready=!1,this.tilingScheme=new Cesium.WebMercatorTilingScheme,this.readyEvent=new Cesium.Event,this.errorEvent=new Cesium.Event,this._styleJson=null,this._style=e.style,this._rootTiles=[],this._cacheTiles=[],this._tilesToUpdate=[],this._tilesToRender=[],this._styleLayers=[],this._styleLayerIndexMap=new Map,this._renderList=new R0(this._styleLayers),this.numLoading=0,this.maxLoading=6,this.numInitializing=0,this.maxInitializing=6,this._taskProcessor=null,this._workerUrl=e.workerUrl||null,this._maximumActiveTasks=e.maximumActiveTasks??4,this.tileIdTexture=null,this.zoom=0,this._symbolPlacements=new jG,requestAnimationFrame(()=>{this.init()})}async init(){let e=this._style;if(!e){this.errorEvent.raiseEvent(new Error("请传入 style 参数"));return}this.path="",typeof e=="string"&&(this.path=e.split("/").slice(0,-1).join("/"),this.path&&(this.path+="/"),e=await Cesium.Resource.fetchJson(e)),this.sources={};for(const r in e.sources){const a=e.sources[r],l=wc[a.type];if(l){this.sources[r]=new l(a,this.path);try{await this.sources[r].init(),this.maximumLevel=Math.min(a.maxzoom||24,this.maximumLevel)}catch(c){this.errorEvent.raiseEvent(c)}}}for(let r=0;r<e.layers.length;r++)this._styleLayers[r]=new L0(e.layers[r]),this._styleLayerIndexMap.set(e.layers[r].id,r);const t=this.tilingScheme.getNumberOfXTilesAtLevel(0),n=this.tilingScheme.getNumberOfYTilesAtLevel(0);let s=0;for(let r=0;r<n;r++)for(let a=0;a<t;a++){var o=new _a({parent:this,x:a,y:r,z:0,tilingScheme:this.tilingScheme});o.createChildren(),this._rootTiles[s++]=o}this._renderList.init(),this._workerUrl&&typeof Cesium.TaskProcessor<"u"&&(this._taskProcessor=new Cesium.TaskProcessor(this._workerUrl,Math.min(this._maximumActiveTasks,this.maxInitializing))),this._styleJson=e,this.ready=!0,this.readyEvent.raiseEvent(this)}executeTileIdCommands(e){const t=this._renderList.tileIdCommands;if(t.length>0){const n=e.context;let s=this._tileIdFbo;s||(s=new Cesium.FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._tileIdFbo=s,this._idClearCommand=new Cesium.ClearCommand({color:new Cesium.Color(0,0,0,0),depth:1,stencil:0}));const o=n.floatingPointTexture?Cesium.PixelDatatype.FLOAT:Cesium.PixelDatatype.UNSIGNED_BYTE,r=n.drawingBufferWidth,a=n.drawingBufferHeight;s.update(n,r,a,1,o),s.clear(n,this._idClearCommand);const l=s.framebuffer;for(const c of t)c.framebuffer=l,c.execute(n);this.tileIdTexture=s.getColorTexture(0)}}update(e){if(!this.ready||!this.show)return;e.context.webgl2&&Qe("webgl2模式下贴地线面的支持将导致性能下降");const t=this._renderList;t.beginFrame(),this.numInitializing=0;const n=e.camera._scene,o=n.globe._surface._debug.suspendLodUpdate;this.scene=n;const r=KG(e,this);o||r.sort((h,u)=>h.distanceToCamera-u.distanceToCamera);for(const h of r)h.lastVisitTime=e.frameNumber,h.expired=!1,h.update(e,t,this);const a=o?this._tilesToRender:XG(r,this._tilesToRender);o||a.sort((h,u)=>h.distanceToCamera-u.distanceToCamera);for(const h of a)h.lastVisitTime=e.frameNumber,h.expired=!1,h.render(e,t,this);const l=t.getList();this._symbolPlacements.update(e,l,this.zoom);for(const h of l)h.render(e,this);for(const h of t.visualizers)h.render(e,this);e.commandList.push(...t.tileCommands),this.executeTileIdCommands(e);const c=[];for(const h of this._cacheTiles)h.lastVisitTime<e.frameNumber&&(h.expired||c.push(h));if(c.sort((h,u)=>h.lastVisitTime-u.lastVisitTime),c.length>100){for(const h of c)if(h.unload(),h.expired=!0,c.length<=50)break}}setLayoutProperty(e,t,n){const s=this._styleLayerIndexMap;if(!s.has(e))return Qe(`不存在图层:${e}`),!1;const o=s.get(e),a=this._styleLayers[o].setLayoutProperty(t,n);return a&&t!=="visibility"&&this._forceUpdate(),a}setPaintProperty(e,t,n){const s=this._styleLayerIndexMap;if(!s.has(e))return Qe(`不存在图层:${e}`),!1;const o=s.get(e);return this._styleLayers[o].setPaintProperty(t,n)}setFilter(e,t){const n=this._styleLayerIndexMap;if(!n.has(e))return Qe(`不存在图层:${e}`),!1;const s=n.get(e),r=this._styleLayers[s].setFilter(t);return r&&this._forceUpdate(),r}_forceUpdate(){for(const e of this._cacheTiles)e.unload();for(const e of this._tilesToRender)e.unload();for(const e of this._tilesToUpdate)e.unload();this._tilesToRender.length=0,this._tilesToUpdate.length=0}destroy(){const e=this.scene,t=this._rootTiles;if(this.scene=null,e&&e.primitives.contains(this)&&e.primitives.remove(this),t){for(const n of t)n.destroy();t.length=0,this._rootTiles=null}if(this._cacheTiles&&(this._cacheTiles.length=0,this._cacheTiles=null),this.sources){for(const n in this.sources)Object.hasOwnProperty.call(this.sources,n)&&this.sources[n].destroy();this.sources=null}this._styleLayers=null,this._renderList&&(this._renderList.destroy(),this._renderList=null),this._taskProcessor&&!this._taskProcessor.isDestroyed()&&(this._taskProcessor.destroy(),this._taskProcessor=null),this._tilesToUpdate&&(this._tilesToUpdate.length=0,this._tilesToUpdate=null),this._tilesToRender&&(this._tilesToRender.length=0,this._tilesToRender=null),this._tileIdFbo&&(this._tileIdFbo.destroy(),this.tileIdTexture=null,this._tileIdFbo=null,this._idClearCommand=null),this._styleJson=null}isDestroyed(){return!1}}function KG(i,e){const t=[...e._rootTiles],n=e._tilesToUpdate;let s=24,o=1/0;const r={visitChildren(a){if(a.z>=e.maximumLevel)return a.distanceToCamera<o&&(o=a.distanceToCamera,s=a.z),n.push(a);if(a.children.length==0){a.createChildren();for(const l of a.children)e._cacheTiles.push(l)}for(const l of a.children)t.push(l)},accept(a){a.distanceToCamera<o&&(o=a.distanceToCamera,s=a.z),n.push(a)}};n.length=0;do t.shift().visit(i,r);while(t.length>0);return e.zoom=s,n}function XG(i,e){const t=new Map;for(const o of i)o.renderable&&t.set(o,!0);const n=[];for(let o=0;o<e.length;o++){const r=e[o];if(r.renderable=t.has(r),r.renderable)continue;const a={tiles:[],total:0,renderable:0};n[o]=a;for(const l of i){const c=l.z-r.z;if(c!==0)if(c>0){const h=Math.pow(2,c),u=Math.floor(l.x/h),p=Math.floor(l.y/h);u===r.x&&p===r.y&&(a.total++,a.tiles.push(l),l.renderable&&a.renderable++)}else{const h=Math.pow(2,-c),u=Math.floor(r.x/h),p=Math.floor(r.y/h);u===l.x&&p===l.y&&(r.renderable=!l.renderable)}}}for(let o=0;o<e.length;o++){const r=e[o],a=n[o];if(a&&a.total){const l=a.total===a.renderable;r.renderable=!l;for(const c of a.tiles)c.renderable=l}}t.clear();let s=e.length;for(let o=0;o<s;o++){const r=e.shift();r.renderable&&(e.push(r),t.set(r,!0))}s=i.length;for(let o=0;o<s;o++){const r=i[o];r.renderable&&!t.has(r)&&(e.push(r),t.set(r,!0))}return e}class Po{constructor(e,t,n){this.sourceFeatures=e,this.style=t,this.tile=n,this.features=[],this.firstBatchId=-1,this.lastBatchId=-1,this.offsets=[],this.counts=[],this.commandList=[],this.visibility="visible",this.state="none",this.paintVersion=t.paintVersion}get id(){return this.style.id}get type(){return this.style.type}get paintNeedsUpdate(){return this.paintVersion!==this.style.paintVersion}set paintNeedsUpdate(e){e||(this.paintVersion=this.style.paintVersion)}update(e,t){const n=this.style.layout.getDataConstValue("visibility",this.tile.z);this.visibility=n}render(e,t){const n=this.style,s=t.zoom;if(this.visibility==="none"||s<n.minzoom||s>=n.maxzoom)return;const o=this.commandList;if(o&&o.length)for(const r of o)e.commandList.push(r)}isDestroyed(){return!1}destroy(){this.commandList&&(this.commandList.length=0),this.sourceFeatures&&(this.sourceFeatures.length=0),this.style=null,this.offsets=null,this.counts=null,this.tile=null,this.isDestroyed=function(){return!0}}}class Pa{constructor(e,t=[]){this.tile=e,this.layers=t,this.state="none",this.commandList=[]}addLayer(e,t,n,s){}setState(e){for(const t of this.layers)t.state=e;this.state=e}update(e,t){}render(e){const t=this.commandList;if(t&&t.length)for(const n of t)e.commandList.push(n)}destroy(){this.tile=null,this.layers.length=0,this.isDestroyed=function(){return!0}}isDestroyed(){return!1}}const ps={},ms={};function Do(i,e,t){ps[i]=e,ms[i]=t}class K0 extends Po{createPrimitve(e,t){const n=this.style,s=this.tile,o=n.convertColor(n.paint.getDataConstValue("background-color",s.z)),r=n.paint.getDataConstValue("background-opacity",s.z);if(n.paint.getDataConstValue("background-pattern",s.z))return Qe("background图层:不支持纹理填充");o.alpha*=r;const l=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:new Cesium.RectangleGeometry({rectangle:this.tile.rectangle})}),compressVertices:!1,asynchronous:!1,appearance:new Cesium.MaterialAppearance({translucent:!1,material:Cesium.Material.fromType("Color",{color:o}),flat:!0})});this.primitive=l}update(e,t){if(super.update(e,t),this.visibility!="none"){if(this.primitive||this.createPrimitve(e,t),this.primitive&&!this.commandList.length){const n=e.commandList,s=e.commandList=this.commandList;if(this.primitive.update(e),s.length>0){const o=Cesium.RenderState.fromCache({blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!0}});for(const r of s)r.renderState=o,r.pass=Cesium.Pass.CESIUM_3D_TILE;this.state="done"}this.primitive._state===Cesium.PrimitiveState.FAILED&&(this.state="error"),e.commandList=n}if(this.primitive&&this.paintNeedsUpdate){const n=this.style,s=this.tile,o=n.convertColor(n.paint.getDataConstValue("background-color",s.z)),r=n.paint.getDataConstValue("background-opacity",s.z);o.alpha*=r,this.primitive.appearance.material.uniforms.color=o,this.paintNeedsUpdate=!1}}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}}Do("background",K0);const Ud=Math.pow(2,15-1)-1,X0=-Ud-1;function J0(i){const e=Tt/i.extent,t=i.loadGeometry();for(const n of t)for(const s of n){const o=Math.round(s.x*e),r=Math.round(s.y*e);s.x=D0(o,X0,Ud),s.y=D0(r,X0,Ud),(o<s.x||o>s.x+1||r<s.y||r>s.y+1)&&Qe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return t}class JG extends Pa{constructor(e,t){super(e,t),this.geometryInstances=[],this.outlineGeometryInstances=[],this.primitive=null,this.commandsReady=!1}addLayer(e,t,n,s){const o=t.style,{tile:r,geometryInstances:a}=this,l=Y0.globe.line.getGranularityForZoomLevel(r.z)/2,c=this;let h=0;const u=s.sources[t.style.source].styleSource.promoteId;for(const p of e){const f=Yn.types[p.type],m=p.properties;if(f!=="Polygon")continue;if(o.paint.getDataValue("fill-pattern",r.z,p)){Qe("fill图层:不支持纹理填充(fill-pattern)");continue}const g=p.id||m[u],A=o.convertColor(o.paint.getDataValue("fill-color",r.z,p)),v=o.paint.getDataValue("fill-opacity",r.z,p),C=o.convertColor(o.paint.getDataValue("fill-outline-color",r.z,p))||A,w=J0(p),M=Qm(w);for(const x of M){if(x.some(R=>R.length<3))continue;const I=a.length;h==0&&(t.firstBatchId=I),t.lastBatchId=I;const S={coordinates:x,featureId:h,fillColor:A,fillOpacity:v,fillOutlineColor:C,properties:m,id:g,batchId:I};c.addFeature(S,l),t.features.push(S),h++}}t.offsets=[],t.counts=[],this.layers.push(t)}addLayerFromWorkerResult(e,t,n,s){const{batches:o,firstBatchId:r,lastBatchId:a}=e,l=this.geometryInstances,c=new Cesium.Cartesian3;for(const h of o){const{positions:u,normals:p,st:f,indices:m,colorBytes:y,id:g,properties:A}=h;u.length/3;const v=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:u},normal:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1,values:p},st:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:f}},primitiveType:Cesium.PrimitiveType.TRIANGLES,indices:m,boundingSphere:Cesium.BoundingSphere.fromVertices(u)}),C=Cesium.Cartographic.fromCartesian(v.boundingSphere.center);C.height=0;const w=Cesium.Cartographic.toCartesian(C,null,c),M=new Cesium.GeometryInstance({geometry:v,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:Array.from(y)})},id:new Cesium.Entity({position:w,id:g,properties:A})});l.push(M)}t.firstBatchId=r,t.lastBatchId=a,t.offsets=[],t.counts=[],this.layers.push(t)}addFeature(e,t){const n=this.geometryInstances,s=this.outlineGeometryInstances,{coordinates:o,fillColor:r,fillOpacity:a,fillOutlineColor:l}=e,c=r.toBytes();c[3]=Math.floor(c[3]*a);const h=l.toBytes();h[3]=Math.floor(h[3]*a);const u=GG(o,this.tile,t,!0),p=u.verticesFlattened,f=[0,0],m=new Cesium.Cartesian3,y=p.length/2,g=new Float64Array(y*3),A=new Float32Array(y*3),v=new Float32Array(y*2);for(let B=0,L=0;B<p.length;B+=2,L++){const O=p[B],N=p[B+1],D=this.tile.transformPoint(O,N,f),E=Cesium.Cartesian3.fromDegrees(D[0],D[1],0,null,m);g[L*3]=E.x,g[L*3+1]=E.y,g[L*3+2]=E.z;const T=Cesium.Cartesian3.normalize(E,E);A[L*3]=T.x,A[L*3+1]=T.y,A[L*3+2]=T.z,v[L*2]=O/Tt,v[L*2+1]=N/Tt}const C=new(y>65535?Uint32Array:y>255?Uint16Array:Uint8Array)(u.indicesTriangles),w=new(y>65535?Uint32Array:y>255?Uint16Array:Uint8Array)(u.indicesLineList.flat(3)),M=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:g},normal:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1,values:A},st:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:v}},primitiveType:Cesium.PrimitiveType.TRIANGLES,indices:C,boundingSphere:Cesium.BoundingSphere.fromVertices(g)}),x=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:g}},primitiveType:Cesium.PrimitiveType.LINES,indices:w,boundingSphere:Cesium.BoundingSphere.fromVertices(g)}),I=Cesium.Cartographic.fromCartesian(M.boundingSphere.center);I.height=0;const S=Cesium.Cartographic.toCartesian(I,null,m),R=new Cesium.GeometryInstance({geometry:M,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:c})},id:new Cesium.Entity({position:S,id:e.id,properties:e.properties})});n.push(R);const b=new Cesium.GeometryInstance({geometry:x,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:h})},id:new Cesium.Entity({position:S,id:e.id,properties:e.properties})});s.push(b)}createPrimitive(){const e=new Cesium.Primitive({geometryInstances:this.geometryInstances,asynchronous:!(this.geometryInstances[0].geometry instanceof Cesium.Geometry),appearance:new Cesium.PerInstanceColorAppearance({flat:!0,translucent:!1,renderState:{depthMask:!1},fragmentShaderSource:`
|
|
141
141
|
in vec4 v_color;
|
|
142
142
|
|
|
143
143
|
uniform vec4 tileId;
|