@gis_victory/gismap 1.0.39 → 1.0.41

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/dist/index.es.js CHANGED
@@ -83371,8 +83371,14 @@ class TemplateManager {
83371
83371
  switch (item.fieldType) {
83372
83372
  case "date":
83373
83373
  case "dateTime":
83374
+ if (value) {
83375
+ value = renderTemplate(item.format || "{0:yyyy-MM-dd HH:mm:ss}", [value]);
83376
+ }
83374
83377
  break;
83375
83378
  case "number":
83379
+ if (value) {
83380
+ value = renderTemplate(item.format || "{0:N2}", [value]);
83381
+ }
83376
83382
  break;
83377
83383
  default:
83378
83384
  bodyHTMLS.push(`${value}`);
@@ -83389,11 +83395,16 @@ class TemplateManager {
83389
83395
  if (footer && footer.length > 0) {
83390
83396
  footerHTMLS.push(`<div class="gismap-popup-footer">`);
83391
83397
  footer.forEach((item) => {
83398
+ let html = void 0;
83392
83399
  switch (item.type) {
83393
83400
  case "click":
83394
- footerHTMLS.push(`<span class="footer-btn" @click="${item.event}"><span class="s"></span> ${item.label}</span>`);
83401
+ html = `<span class="footer-btn" onclick="eval(${item.event})"><span class="s"></span> ${item.label}</span>`;
83395
83402
  break;
83396
83403
  }
83404
+ if (html) {
83405
+ html = renderTemplate(html || "", properties);
83406
+ }
83407
+ footerHTMLS.push(html || "");
83397
83408
  });
83398
83409
  footerHTMLS.push(`</div>`);
83399
83410
  }
package/dist/index.umd.js CHANGED
@@ -25,7 +25,7 @@
25
25
  * limitations under the License.
26
26
  *
27
27
  * SPDX-License-Identifier: Apache-2.0
28
- */var lT=null;try{lT=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function cT(e,t,i){this.low=0|e,this.high=0|t,this.unsigned=!!i}function uT(e){return!0===(e&&e.__isLong__)}function hT(e){var t=Math.clz32(e&-e);return e?31-t:t}cT.prototype.__isLong__,Object.defineProperty(cT.prototype,"__isLong__",{value:!0}),cT.isLong=uT;var dT={},pT={};function fT(e,t){var i,n,r;return t?(r=0<=(e>>>=0)&&e<256)&&(n=pT[e])?n:(i=gT(e,0,!0),r&&(pT[e]=i),i):(r=-128<=(e|=0)&&e<128)&&(n=dT[e])?n:(i=gT(e,e<0?-1:0,!1),r&&(dT[e]=i),i)}function mT(e,t){if(isNaN(e))return t?AT:TT;if(t){if(e<0)return AT;if(e>=bT)return RT}else{if(e<=-wT)return PT;if(e+1>=wT)return MT}return e<0?mT(-e,t).neg():gT(e%xT|0,e/xT|0,t)}function gT(e,t,i){return new cT(e,t,i)}cT.fromInt=fT,cT.fromNumber=mT,cT.fromBits=gT;var _T=Math.pow;function yT(e,t,i){if(0===e.length)throw Error("empty string");if("number"==typeof t?(i=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?AT:TT;if((i=i||10)<2||36<i)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return yT(e.substring(1),t,i).neg();for(var r=mT(_T(i,8)),s=TT,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),l=parseInt(e.substring(o,o+a),i);if(a<8){var c=mT(_T(i,a));s=s.mul(c).add(mT(l))}else s=(s=s.mul(r)).add(mT(l))}return s.unsigned=t,s}function vT(e,t){return"number"==typeof e?mT(e,t):"string"==typeof e?yT(e,t):gT(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}cT.fromString=yT,cT.fromValue=vT;var xT=4294967296,bT=xT*xT,wT=bT/2,ET=fT(1<<24),TT=fT(0);cT.ZERO=TT;var AT=fT(0,!0);cT.UZERO=AT;var ST=fT(1);cT.ONE=ST;var CT=fT(1,!0);cT.UONE=CT;var IT=fT(-1);cT.NEG_ONE=IT;var MT=gT(-1,2147483647,!1);cT.MAX_VALUE=MT;var RT=gT(-1,-1,!0);cT.MAX_UNSIGNED_VALUE=RT;var PT=gT(0,-2147483648,!1);cT.MIN_VALUE=PT;var BT=cT.prototype;BT.toInt=function(){return this.unsigned?this.low>>>0:this.low},BT.toNumber=function(){return this.unsigned?(this.high>>>0)*xT+(this.low>>>0):this.high*xT+(this.low>>>0)},BT.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(PT)){var t=mT(e),i=this.div(t),n=i.mul(t).sub(this);return i.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var r=mT(_T(e,6),this.unsigned),s=this,o="";;){var a=s.div(r),l=(s.sub(a.mul(r)).toInt()>>>0).toString(e);if((s=a).isZero())return l+o;for(;l.length<6;)l="0"+l;o=""+l+o}},BT.getHighBits=function(){return this.high},BT.getHighBitsUnsigned=function(){return this.high>>>0},BT.getLowBits=function(){return this.low},BT.getLowBitsUnsigned=function(){return this.low>>>0},BT.getNumBitsAbs=function(){if(this.isNegative())return this.eq(PT)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},BT.isSafeInteger=function(){var e=this.high>>21;return!e||!this.unsigned&&(-1===e&&!(0===this.low&&-2097152===this.high))},BT.isZero=function(){return 0===this.high&&0===this.low},BT.eqz=BT.isZero,BT.isNegative=function(){return!this.unsigned&&this.high<0},BT.isPositive=function(){return this.unsigned||this.high>=0},BT.isOdd=function(){return!(1&~this.low)},BT.isEven=function(){return!(1&this.low)},BT.equals=function(e){return uT(e)||(e=vT(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},BT.eq=BT.equals,BT.notEquals=function(e){return!this.eq(e)},BT.neq=BT.notEquals,BT.ne=BT.notEquals,BT.lessThan=function(e){return this.comp(e)<0},BT.lt=BT.lessThan,BT.lessThanOrEqual=function(e){return this.comp(e)<=0},BT.lte=BT.lessThanOrEqual,BT.le=BT.lessThanOrEqual,BT.greaterThan=function(e){return this.comp(e)>0},BT.gt=BT.greaterThan,BT.greaterThanOrEqual=function(e){return this.comp(e)>=0},BT.gte=BT.greaterThanOrEqual,BT.ge=BT.greaterThanOrEqual,BT.compare=function(e){if(uT(e)||(e=vT(e)),this.eq(e))return 0;var t=this.isNegative(),i=e.isNegative();return t&&!i?-1:!t&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},BT.comp=BT.compare,BT.negate=function(){return!this.unsigned&&this.eq(PT)?PT:this.not().add(ST)},BT.neg=BT.negate,BT.add=function(e){uT(e)||(e=vT(e));var t=this.high>>>16,i=65535&this.high,n=this.low>>>16,r=65535&this.low,s=e.high>>>16,o=65535&e.high,a=e.low>>>16,l=0,c=0,u=0,h=0;return u+=(h+=r+(65535&e.low))>>>16,c+=(u+=n+a)>>>16,l+=(c+=i+o)>>>16,l+=t+s,gT((u&=65535)<<16|(h&=65535),(l&=65535)<<16|(c&=65535),this.unsigned)},BT.subtract=function(e){return uT(e)||(e=vT(e)),this.add(e.neg())},BT.sub=BT.subtract,BT.multiply=function(e){if(this.isZero())return this;if(uT(e)||(e=vT(e)),lT)return gT(lT.mul(this.low,this.high,e.low,e.high),lT.get_high(),this.unsigned);if(e.isZero())return this.unsigned?AT:TT;if(this.eq(PT))return e.isOdd()?PT:TT;if(e.eq(PT))return this.isOdd()?PT:TT;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(ET)&&e.lt(ET))return mT(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,i=65535&this.high,n=this.low>>>16,r=65535&this.low,s=e.high>>>16,o=65535&e.high,a=e.low>>>16,l=65535&e.low,c=0,u=0,h=0,d=0;return h+=(d+=r*l)>>>16,u+=(h+=n*l)>>>16,h&=65535,u+=(h+=r*a)>>>16,c+=(u+=i*l)>>>16,u&=65535,c+=(u+=n*a)>>>16,u&=65535,c+=(u+=r*o)>>>16,c+=t*l+i*a+n*o+r*s,gT((h&=65535)<<16|(d&=65535),(c&=65535)<<16|(u&=65535),this.unsigned)},BT.mul=BT.multiply,BT.divide=function(e){if(uT(e)||(e=vT(e)),e.isZero())throw Error("division by zero");var t,i,n;if(lT)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?gT((this.unsigned?lT.div_u:lT.div_s)(this.low,this.high,e.low,e.high),lT.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?AT:TT;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return AT;if(e.gt(this.shru(1)))return CT;n=AT}else{if(this.eq(PT))return e.eq(ST)||e.eq(IT)?PT:e.eq(PT)?ST:(t=this.shr(1).div(e).shl(1)).eq(TT)?e.isNegative()?ST:IT:(i=this.sub(e.mul(t)),n=t.add(i.div(e)));if(e.eq(PT))return this.unsigned?AT:TT;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=TT}for(i=this;i.gte(e);){t=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var r=Math.ceil(Math.log(t)/Math.LN2),s=r<=48?1:_T(2,r-48),o=mT(t),a=o.mul(e);a.isNegative()||a.gt(i);)a=(o=mT(t-=s,this.unsigned)).mul(e);o.isZero()&&(o=ST),n=n.add(o),i=i.sub(a)}return n},BT.div=BT.divide,BT.modulo=function(e){return uT(e)||(e=vT(e)),lT?gT((this.unsigned?lT.rem_u:lT.rem_s)(this.low,this.high,e.low,e.high),lT.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},BT.mod=BT.modulo,BT.rem=BT.modulo,BT.not=function(){return gT(~this.low,~this.high,this.unsigned)},BT.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},BT.clz=BT.countLeadingZeros,BT.countTrailingZeros=function(){return this.low?hT(this.low):hT(this.high)+32},BT.ctz=BT.countTrailingZeros,BT.and=function(e){return uT(e)||(e=vT(e)),gT(this.low&e.low,this.high&e.high,this.unsigned)},BT.or=function(e){return uT(e)||(e=vT(e)),gT(this.low|e.low,this.high|e.high,this.unsigned)},BT.xor=function(e){return uT(e)||(e=vT(e)),gT(this.low^e.low,this.high^e.high,this.unsigned)},BT.shiftLeft=function(e){return uT(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?gT(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):gT(0,this.low<<e-32,this.unsigned)},BT.shl=BT.shiftLeft,BT.shiftRight=function(e){return uT(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?gT(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):gT(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},BT.shr=BT.shiftRight,BT.shiftRightUnsigned=function(e){return uT(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?gT(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):gT(32===e?this.high:this.high>>>e-32,0,this.unsigned)},BT.shru=BT.shiftRightUnsigned,BT.shr_u=BT.shiftRightUnsigned,BT.rotateLeft=function(e){var t;return uT(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?gT(this.high,this.low,this.unsigned):e<32?(t=32-e,gT(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),gT(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},BT.rotl=BT.rotateLeft,BT.rotateRight=function(e){var t;return uT(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?gT(this.high,this.low,this.unsigned):e<32?(t=32-e,gT(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),gT(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},BT.rotr=BT.rotateRight,BT.toSigned=function(){return this.unsigned?gT(this.low,this.high,!1):this},BT.toUnsigned=function(){return this.unsigned?this:gT(this.low,this.high,!0)},BT.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},BT.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},BT.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},cT.fromBytes=function(e,t,i){return i?cT.fromBytesLE(e,t):cT.fromBytesBE(e,t)},cT.fromBytesLE=function(e,t){return new cT(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},cT.fromBytesBE=function(e,t){return new cT(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)},"function"==typeof BigInt&&(cT.fromBigInt=function(e,t){return gT(Number(BigInt.asIntN(32,e)),Number(BigInt.asIntN(32,e>>BigInt(32))),t)},cT.fromValue=function(e,t){return"bigint"==typeof e?cT.fromBigInt(e,t):vT(e,t)},BT.toBigInt=function(){var e=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|e});function LT(e){"X"===e&&(e="");const t=e.padEnd(16,"0");return cT.fromString(t,!0,16)}const OT=180/Math.PI;function kT(e,t,i){const n=1<<t;return[(e[0]+i[0])/n,(e[1]+i[1])/n]}function DT(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function FT(e){return[DT(e[0]),DT(e[1])]}function NT(e,[t,i]){switch(e){case 0:return[1,t,i];case 1:return[-t,1,i];case 2:return[-t,-i,1];case 3:return[-1,-i,-t];case 4:return[i,-1,-t];case 5:return[i,t,-1];default:throw new Error("Invalid face")}}function zT([e,t,i]){const n=Math.atan2(i,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*OT,n*OT]}function UT(e,t,i,n){if(0===n){1===i&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);const n=t[0];t[0]=t[1],t[1]=n}}function VT(e){const{face:t,ij:i,level:n}=e,r=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(100*Math.pow(2,-n))),o=new Float64Array(4*s*2+2);let a=0,l=0;for(let c=0;c<4;c++){const e=r[c].slice(0),u=r[c+1],h=(u[0]-e[0])/s,d=(u[1]-e[1])/s;for(let r=0;r<s;r++){e[0]+=h,e[1]+=d;const r=zT(NT(t,FT(kT(i,n,e))));Math.abs(r[1])>89.999&&(r[0]=l);const s=r[0]-l;r[0]+=s>180?-360:s<-180?360:0,o[a++]=r[0],o[a++]=r[1],l=r[0]}}return o[a++]=o[0],o[a++]=o[1],o}function GT(e){const t=function(e){if(e.indexOf("/")>0)return e;const t=LT(e);return function(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<64;)t="0"+t;const i=t.lastIndexOf("1"),n=t.substring(0,3),r=t.substring(3,i),s=r.length/2,o=cT.fromString(n,!0,2).toString(10);let a="";if(0!==s)for(a=cT.fromString(r,!0,2).toString(4);a.length<s;)a="0"+a;return`${o}/${a}`}(t)}(e);return function(e){if(0===e.length)throw new Error(`Invalid Hilbert quad key ${e}`);const t=e.split("/"),i=parseInt(t[0],10),n=t[1],r=n.length;let s=0;const o=[0,0];for(let a=r-1;a>=0;a--){s=r-a;const e=n[a];let t=0,i=0;"1"===e?i=1:"2"===e?(t=1,i=1):"3"===e&&(t=1);const l=Math.pow(2,s-1);UT(l,o,t,i),o[0]+=l*t,o[1]+=l*i}if(i%2==1){const e=o[0];o[0]=o[1],o[1]=e}return{face:i,ij:o,level:s}}(t)}function jT(e){return function(e){const t=FT(kT(e.ij,e.level,[.5,.5]));return zT(NT(e.face,t))}(GT(e))}function HT(e){if(e.length%2!=0)throw new Error("Invalid corners");const t=[],i=[];for(let n=0;n<e.length;n+=2)t.push(e[n]),i.push(e[n+1]);return t.sort((e,t)=>e-t),i.sort((e,t)=>e-t),{west:t[0],east:t[t.length-1],north:i[i.length-1],south:i[0]}}function WT(e,t){const i=t?.minimumHeight||0,n=t?.maximumHeight||0,r=function(e){let t;if(2===e.face||5===e.face){let i=null,n=0;for(let t=0;t<4;t++){const r=VT(GT(`${e.face}/${t}`));null==i&&(i=new Float64Array(4*r.length)),i.set(r,n),n+=r.length}t=HT(i)}else t=HT(VT(e));return t}(GT(e)),s=r.west,o=r.south,a=r.east,l=r.north,c=[];return c.push(new ca(s,l,i)),c.push(new ca(a,l,i)),c.push(new ca(a,o,i)),c.push(new ca(s,o,i)),c.push(new ca(s,l,n)),c.push(new ca(a,l,n)),c.push(new ca(a,o,n)),c.push(new ca(s,o,n)),c}function $T(e){const t=e.token,i={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=WT(t,i),r=jT(t),s=r[0],o=r[1],a=qb.WGS84.cartographicToCartesian([s,o,i.maximumHeight]),l=new ca(a[0],a[1],a[2]);n.push(l);const c=function(e,t=new __){if(!e||0===e.length)return t.halfAxes=new _a([0,0,0,0,0,0,0,0,0]),t.center=new ca,t;const i=e.length,n=new ca(0,0,0);for(const A of e)n.add(A);const r=1/i;n.multiplyByScalar(r);let s=0,o=0,a=0,l=0,c=0,u=0;for(const A of e){const e=k_.copy(A).subtract(n);s+=e.x*e.x,o+=e.x*e.y,a+=e.x*e.z,l+=e.y*e.y,c+=e.y*e.z,u+=e.z*e.z}s*=r,o*=r,a*=r,l*=r,c*=r,u*=r;const h=U_;h[0]=s,h[1]=o,h[2]=a,h[3]=o,h[4]=l,h[5]=c,h[6]=a,h[7]=c,h[8]=u;const{unitary:d}=R_(h,V_),p=t.halfAxes.copy(d);let f=p.getColumn(0,F_),m=p.getColumn(1,N_),g=p.getColumn(2,z_),_=-Number.MAX_VALUE,y=-Number.MAX_VALUE,v=-Number.MAX_VALUE,x=Number.MAX_VALUE,b=Number.MAX_VALUE,w=Number.MAX_VALUE;for(const A of e)k_.copy(A),_=Math.max(k_.dot(f),_),y=Math.max(k_.dot(m),y),v=Math.max(k_.dot(g),v),x=Math.min(k_.dot(f),x),b=Math.min(k_.dot(m),b),w=Math.min(k_.dot(g),w);f=f.multiplyByScalar(.5*(x+_)),m=m.multiplyByScalar(.5*(b+y)),g=g.multiplyByScalar(.5*(w+v)),t.center.copy(f).add(m).add(g);const E=D_.set(_-x,y-b,v-w).multiplyByScalar(.5),T=new _a([E[0],0,0,0,E[1],0,0,0,E[2]]);return t.halfAxes.multiplyRight(T),t}(n);return[...c.center,...c.halfAxes]}const qT={QUADTREE:4,OCTREE:8};function XT(e,t,i){if(e?.box){const n=function(e,t){const i=function(e){return e.and(e.not().add(1))}(e).shiftRightUnsigned(2);return e.add(cT.fromNumber(2*t+1-4).multiply(i))}(LT(e.s2VolumeInfo.token),t),r=function(e){if(e.isZero())return"X";let t=e.countTrailingZeros();t=(t-t%4)/4;const i=t;t*=4;const n=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-i-n.length).join("0")+n}(n),s={...e.s2VolumeInfo};if(s.token=r,"OCTREE"===i){const t=e.s2VolumeInfo,i=t.maximumHeight-t.minimumHeight,n=i/2,r=t.minimumHeight+i/2;t.minimumHeight=r-n,t.maximumHeight=r+n}return{box:$T(s),s2VolumeInfo:s}}}async function ZT(e){const{subtree:t,subtreeData:i={level:0,x:0,y:0,z:0},parentData:n={mortonIndex:0,localLevel:-1,localX:0,localY:0,localZ:0},childIndex:r=0,implicitOptions:s,loaderOptions:o,s2VolumeBox:a}=e,{subdivisionScheme:l,subtreeLevels:c,maximumLevel:u,contentUrlTemplate:h,subtreesUriTemplate:d,basePath:p}=s,f={children:[],lodMetricValue:0,contentUrl:""};if(!u)return O.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${h} won't be loaded...`),f;const m=n.localLevel+1,g=i.level+m;if(g>u)return f;const _=qT[l],y=Math.log2(_),v=1&r,x=r>>1&1,b=r>>2&1,w=JT(n.localX,v,1),E=JT(n.localY,x,1),T=JT(n.localZ,b,1),A=JT(i.x,w,m),S=JT(i.y,E,m),C=JT(i.z,T,m),I=JT(n.mortonIndex,r,y);let M,R,P,B;if(m===c&&KT(t.childSubtreeAvailability,I)){const e=YT(`${p}/${d}`,g,A,S,C);M=await Et(e,aT,o),B=0,R={level:g,x:A,y:S,z:C},P={mortonIndex:0,localLevel:0,localX:0,localY:0,localZ:0}}else{M=t;B=(_**m-1)/(_-1)+I,R=i,P={mortonIndex:I,localLevel:m,localX:w,localY:E,localZ:T}}if(!KT(M.tileAvailability,B))return f;KT(M.contentAvailability,B)&&(f.contentUrl=YT(h,g,A,S,C));for(let L=0;L<_;L++){const e=XT(a,L,l),t=await ZT({subtree:M,subtreeData:R,parentData:P,childIndex:L,implicitOptions:s,loaderOptions:o,s2VolumeBox:e});(t.contentUrl||t.children.length)&&f.children.push(t)}if(f.contentUrl||f.children.length){const e=function(e,t,i,n){const{basePath:r,refine:s,getRefine:o,lodMetricType:a,getTileType:l,rootLodMetricValue:c,rootBoundingVolume:u}=i,h=e.contentUrl&&e.contentUrl.replace(`${r}/`,""),d=c/2**t.level,p=n?.box?{box:n.box}:u,f=function(e,t,i){if(e.region){const{level:n,x:r,y:s,z:o}=t,[a,l,c,u,h,d]=e.region,p=2**n,f=(c-a)/p,[m,g]=[a+f*r,a+f*(r+1)],_=(u-l)/p,[y,v]=[l+_*s,l+_*(s+1)];let x,b;if("OCTREE"===i){const e=(d-h)/p;[x,b]=[h+e*o,h+e*(o+1)]}else[x,b]=[h,d];return{region:[m,y,g,v,x,b]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${JSON.stringify(e)}`)}(p,t,i.subdivisionScheme);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},id:e.contentUrl,refine:o(s),type:l(e),lodMetricType:a,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:f}}(f,{level:g,x:A,y:S,z:C},s,a);return e}return f}function KT(e,t){let i;return Array.isArray(e)?(i=e[0],e.length>1&&O.once('Not supported extension "3DTILES_multiple_contents" has been detected')):i=e,"constant"in i?Boolean(i.constant):!!i.explicitBitstream&&function(e,t){const i=Math.floor(e/8),n=e%8;return 1==(t[i]>>n&1)}(t,i.explicitBitstream)}function JT(e,t,i){return(e<<i)+t}function YT(e,t,i,n,r){const s=function(e){const t={};for(const i in e)t[`{${i}}`]=e[i];return t}({level:t,x:i,y:n,z:r});return e.replace(/{level}|{x}|{y}|{z}/gi,e=>s[e])}function QT(e,t=""){if(!t)return fw.EMPTY;const i=t.split("?")[0].split(".").pop();switch(i){case"pnts":return fw.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return fw.SCENEGRAPH;default:return i||fw.EMPTY}}function eA(e){switch(e){case"REPLACE":case"replace":return dw.REPLACE;case"ADD":case"add":return dw.ADD;default:return e}}function tA(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){const i=new URL(e,`${t}/`);return decodeURI(i.toString())}return e.startsWith("/")?e:Te(t,e)}function iA(e,t){if(!e)return null;let i;if(e.content){const n=e.content.uri||e.content?.url;void 0!==n&&(i=tA(n,t))}return{...e,id:i,contentUrl:i,lodMetricType:yw.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:QT(0,i),refine:eA(e.refine)}}async function nA(e,t,i,n,r){const{subdivisionScheme:s,maximumLevel:o,availableLevels:a,subtreeLevels:l,subtrees:{uri:c}}=n,u=tA(YT(c,0,0,0,0),i),h=await Et(u,aT,r),d=e.content?.uri,p=d?tA(d,i):"",f=t?.root?.refine,m=e.geometricError,g=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(g){const t={box:$T(g),s2VolumeInfo:g};e.boundingVolume=t}const _=e.boundingVolume,y={contentUrlTemplate:p,subtreesUriTemplate:c,subdivisionScheme:s,subtreeLevels:l,maximumLevel:Number.isFinite(a)?a-1:o,refine:f,basePath:i,lodMetricType:yw.GEOMETRIC_ERROR,rootLodMetricValue:m,rootBoundingVolume:_,getTileType:QT,getRefine:eA};return await async function(e,t,i,n,r){if(!e)return null;const{children:s,contentUrl:o}=await ZT({subtree:i,implicitOptions:n,loaderOptions:r});let a,l=null;o&&(a=o,l={uri:o.replace(`${t}/`,"")});const c={...e,id:a,contentUrl:a,lodMetricType:yw.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:QT(0,a),refine:eA(e.refine),content:l||e.content,children:s};return c}(e,i,h,y,r)}function rA(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}const sA={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:mE,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(e,t={},i){const n=t["3d-tiles"]||{};let r;r="auto"===n.isTileset?i?.url&&-1!==i.url.indexOf(".json"):n.isTileset;return r?async function(e,t,i){const n=JSON.parse((new TextDecoder).decode(e)),r=i?.url||"",s=function(e){return Ee(e)}(r),o=await async function(e,t,i){let n=null;const r=rA(e.root);n=r&&e.root?await nA(e.root,e,t,r,i):iA(e.root,t);const s=[];for(s.push(n);s.length>0;){const n=s.pop()||{},r=n.children||[],o=[];for(const a of r){const n=rA(a);let r;r=n?await nA(a,e,t,n,i):iA(a,t),r&&(o.push(r),s.push(r))}n.children=o}return n}(n,s,t||{}),a={...n,shape:"tileset3d",loader:sA,url:r,queryString:i?.queryString||"",basePath:s,root:o||n.root,type:gw.TILES3D,lodMetricType:yw.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0};return a}(e,t,i):async function(e,t,i){const n={content:{shape:"tile3d",featureIds:null}},r=0;return await rT(e,r,t,i,n.content),n.content}(e,t,i)},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};const oA=[0],aA={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:sA,onTilesetLoad:{type:"function",value:e=>{}},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:(e,t,i)=>{}},_getMeshColor:{type:"function",value:e=>[255,255,255]}};let lA=class extends _g{initializeState(){"onTileLoadFail"in this.props&&qt.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({props:e,oldProps:t,changeFlags:i}){if(e.data&&e.data!==t.data&&this._loadTileset(e.data),i.viewportChanged){const{activeViewports:e}=this.state;Object.keys(e).length&&(this._updateTileset(e),this.state.lastUpdatedViewports=e,this.state.activeViewports={})}if(i.propsChanged){const{layerMap:e}=this.state;for(const t in e)e[t].needsUpdate=!0}}activateViewport(e){const{activeViewports:t,lastUpdatedViewports:i}=this.state;this.internalState.viewport=e,t[e.id]=e;const n=i?.[e.id];n&&e.equals(n)||(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:e,sourceLayer:t}){const i=t&&t.props.tile;return e.picked&&(e.object=i),e.sourceTile=i,e}filterSubLayer({layer:e,viewport:t}){const{tile:i}=e.props,{id:n}=t;return i.selected&&i.viewportIds.includes(n)}_updateAutoHighlight(e){const t=e.sourceTile,i=this.state.layerMap[t?.id];i&&i.layer&&i.layer.updateAutoHighlight(e)}async _loadTileset(e){const{loadOptions:t={}}=this.props,i=this.props.loader||this.props.loaders,n=Array.isArray(i)?i[0]:i,r={loadOptions:{...t}};let s=e;if(n.preload){const i=await n.preload(e,t);i.url&&(s=i.url),i.headers&&(r.loadOptions.fetch={...r.loadOptions.fetch,headers:i.headers}),Object.assign(r,i)}const o=await Et(s,n,r.loadOptions),a=new fE(o,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...r});this.setState({tileset3d:a,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(a)}_onTileLoad(e){const{lastUpdatedViewports:t}=this.state;this.props.onTileLoad(e),this._updateTileset(t),this.setNeedsUpdate()}_onTileUnload(e){delete this.state.layerMap[e.id],this.props.onTileUnload(e)}_updateTileset(e){if(!e)return;const{tileset3d:t}=this.state,{timeline:i}=this.context,n=Object.keys(e).length;i&&n&&t&&t.selectTiles(Object.values(e)).then(e=>{this.state.frameNumber!==e&&this.setState({frameNumber:e})})}_getSubLayer(e,t){if(!e.content)return null;switch(e.type){case fw.POINTCLOUD:return this._makePointCloudLayer(e,t);case fw.SCENEGRAPH:return this._make3DModelLayer(e);case fw.MESH:return this._makeSimpleMeshLayer(e,t);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${e.content.type}`)}}_makePointCloudLayer(e,t){const{attributes:i,pointCount:n,constantRGBA:r,cartographicOrigin:s,modelMatrix:o}=e.content,{positions:a,normals:l,colors:c}=i;if(!a)return null;const u=t&&t.props.data||{header:{vertexCount:n},attributes:{POSITION:a,NORMAL:l,COLOR_0:c}},{pointSize:h,getPointColor:d}=this.props;return new(this.getSubLayerClass("pointcloud",Xg))({pointSize:h},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${e.id}`,tile:e,data:u,coordinateSystem:Ec.METER_OFFSETS,coordinateOrigin:s,modelMatrix:o,getColor:r||d,_offset:0})}_make3DModelLayer(e){const{gltf:t,instances:i,cartographicOrigin:n,modelMatrix:r}=e.content;return new(this.getSubLayerClass("scenegraph",Eb))({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${e.id}`,tile:e,data:i||oA,scenegraph:t,coordinateSystem:Ec.METER_OFFSETS,coordinateOrigin:n,modelMatrix:r,getTransformMatrix:e=>e.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(e,t){const i=e.content,{attributes:n,indices:r,modelMatrix:s,cartographicOrigin:o,coordinateSystem:a=Ec.METER_OFFSETS,material:l,featureIds:c}=i,{_getMeshColor:u}=this.props,h=t&&t.props.mesh||new kh({topology:"triangle-list",attributes:cA(n),indices:r});return new(this.getSubLayerClass("mesh",Sb))(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${e.id}`,tile:e,mesh:h,data:oA,getColor:u(e),pbrMaterial:l,modelMatrix:s,coordinateOrigin:o,coordinateSystem:a,featureIds:c,_offset:0})}renderLayers(){const{tileset3d:e,layerMap:t}=this.state;return e?e.tiles.map(e=>{const i=t[e.id]=t[e.id]||{tile:e};let{layer:n}=i;return e.selected&&(n?i.needsUpdate&&(n=this._getSubLayer(e,n),i.needsUpdate=!1):n=this._getSubLayer(e)),i.layer=n,n}).filter(Boolean):null}};function cA(e){const t={};return t.positions={...e.positions,value:new Float32Array(e.positions.value)},e.normals&&(t.normals=e.normals),e.texCoords&&(t.texCoords=e.texCoords),e.colors&&(t.colors=e.colors),e.uvRegions&&(t.uvRegions=e.uvRegions),t}lA.defaultProps=aA,lA.layerName="Tile3DLayer";class uA extends o.Marker{data;constructor(e){super(e)}setData(e){this.data=e}getData(){return this.data}}var hA=6371008.8,dA={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:39.37*hA,kilometers:6371.0088,kilometres:6371.0088,meters:hA,metres:hA,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:hA/1852,radians:1,yards:6967335.223679999};function pA(e){return 180*(e%(2*Math.PI))/Math.PI}function fA(e){return e%360*Math.PI/180}function mA(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function gA(e,t,i,n={}){const r=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}(e),s=fA(r[0]),o=fA(r[1]),a=fA(i),l=function(e,t="kilometers"){const i=dA[t];if(!i)throw new Error(t+" units is invalid");return e/i}(t,n.units),c=Math.asin(Math.sin(o)*Math.cos(l)+Math.cos(o)*Math.sin(l)*Math.cos(a));return function(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!mA(e[0])||!mA(e[1]))throw new Error("coordinates must contain numbers");return function(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}({type:"Point",coordinates:e},t,i)}([pA(s+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(o),Math.cos(l)-Math.sin(o)*Math.sin(c))),pA(c)],n.properties)}function _A(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function yA(e,t,i){if(null!==e)for(var n,r,s,o,a,l,c,u,h=0,d=0,p=e.type,f="FeatureCollection"===p,m="Feature"===p,g=f?e.features.length:1,_=0;_<g;_++){a=(u=!!(c=f?e.features[_].geometry:m?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<a;y++){var v=0,x=0;if(null!==(o=u?c.geometries[y]:c)){l=o.coordinates;var b=o.type;switch(h="Polygon"===b||"MultiPolygon"===b?1:0,b){case null:break;case"Point":if(!1===t(l,d,_,v,x))return!1;d++,v++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===t(l[n],d,_,v,x))return!1;d++,"MultiPoint"===b&&v++}"LineString"===b&&v++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-h;r++){if(!1===t(l[n][r],d,_,v,x))return!1;d++}"MultiLineString"===b&&v++,"Polygon"===b&&x++}"Polygon"===b&&v++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(x=0,r=0;r<l[n].length;r++){for(s=0;s<l[n][r].length-h;s++){if(!1===t(l[n][r][s],d,_,v,x))return!1;d++}x++}v++}break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===yA(o.geometries[n],t))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function vA(e,t={}){let i=0,n=0,r=0;return yA(e,function(e){i+=e[0],n+=e[1],r++}),function(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!_A(e[0])||!_A(e[1]))throw new Error("coordinates must contain numbers");return function(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}({type:"Point",coordinates:e},t,i)}([i/r,n/r],t.properties)}function xA(e,t,i={}){const n=i.steps||64,r=i.properties?i.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},s=[];for(let o=0;o<n;o++)s.push(gA(e,t,-360*o/n,i).geometry.coordinates);return s.push(s[0]),function(e,t,i={}){for(const n of e){if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(n[n.length-1].length!==n[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<n[n.length-1].length;e++)if(n[n.length-1][e]!==n[0][e])throw new Error("First and last Position are not equivalent.")}return function(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}({type:"Polygon",coordinates:e},t,i)}([s],r)}function bA(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return function(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}({type:"LineString",coordinates:e},t,i)}function wA(e){let t=e%360;return t<0&&(t+=360),t}function EA(e,t,i){if(null!==e)for(var n,r,s,o,a,l,c,u,h=0,d=0,p=e.type,f="FeatureCollection"===p,m="Feature"===p,g=f?e.features.length:1,_=0;_<g;_++){a=(u=!!(c=f?e.features[_].geometry:m?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<a;y++){var v=0,x=0;if(null!==(o=u?c.geometries[y]:c)){l=o.coordinates;var b=o.type;switch(h=0,b){case null:break;case"Point":if(!1===t(l,d,_,v,x))return!1;d++,v++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===t(l[n],d,_,v,x))return!1;d++,"MultiPoint"===b&&v++}"LineString"===b&&v++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-h;r++){if(!1===t(l[n][r],d,_,v,x))return!1;d++}"MultiLineString"===b&&v++,"Polygon"===b&&x++}"Polygon"===b&&v++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(x=0,r=0;r<l[n].length;r++){for(s=0;s<l[n][r].length-h;s++){if(!1===t(l[n][r][s],d,_,v,x))return!1;d++}x++}v++}break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===EA(o.geometries[n],t))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function TA(e,t,i,n,r={}){if(null===(s=r=r||{})||"object"!=typeof s||Array.isArray(s))throw new Error("options is invalid");var s;const o=r.properties;if(!e)throw new Error("center is required");if(null==i)throw new Error("bearing1 is required");if(null==n)throw new Error("bearing2 is required");if(!t)throw new Error("radius is required");if("object"!=typeof r)throw new Error("options must be an object");if(AA(i)===AA(n))return xA(e,t,r);const a=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(e),l=function(e,t,i,n,r={}){const s=r.steps||64,o=wA(i),a=wA(n),l=Array.isArray(e)||"Feature"!==e.type?{}:e.properties;if(o===a)return bA(xA(e,t,r).geometry.coordinates[0],l);const c=o,u=o<a?a:a+360;let h=c;const d=[];let p=0;const f=(u-c)/s;for(;h<=u;)d.push(gA(e,t,h,r).geometry.coordinates),p++,h=c+p*f;return bA(d,l)}(e,t,i,n,r),c=[[a]];return EA(l,function(e){c[0].push(e)}),c[0].push(a),function(e,t,i={}){for(const n of e){if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(n[n.length-1].length!==n[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<n[n.length-1].length;e++)if(n[n.length-1][e]!==n[0][e])throw new Error("First and last Position are not equivalent.")}return function(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}({type:"Polygon",coordinates:e},t,i)}(c,o)}function AA(e){let t=e%360;return t<0&&(t+=360),t}class SA{map;sourceId=`gismap_placeholder_source_${Math.random().toString(10)}`;static symbolPointId="gismap_placeholder_symbol_point";static layerPointId="gismap_placeholder_layer_point";static layerLineId="gismap_placeholder_layer_line";static layerPolygonId="gismap_placeholder_layer_polygon";static maskLayerId="gismap_placeholder_mask_layer";constructor(e){this.map=e,this.map.addSource(this.sourceId,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}addLayer(e){this.map.addLayer({id:SA.layerPolygonId,type:"fill",source:this.sourceId,paint:{}},e?.beforeLayerFillId),this.map.addLayer({id:SA.layerLineId,type:"line",source:this.sourceId,paint:{}},e?.beforeLayerLineId),this.map.addLayer({id:SA.layerPointId,type:"circle",source:this.sourceId,paint:{}},e?.beforeLayerPointId),this.map.addLayer({id:SA.symbolPointId,type:"symbol",source:this.sourceId,paint:{}},e?.beforeLayerPointId),this.map.addLayer({id:SA.maskLayerId,type:"circle",source:this.sourceId,paint:{}},e?.beforeMaskLayerId)}}class CA{map;layerId="";layerFilter;isQuery=!1;dataExtension={};templateId=void 0;feature=void 0;constructor(e){this.map=e}addSource(e){if(!this.map.getSource(e.id)){const t=Object.assign({type:"vector",tiles:[e.url]},e);switch(t.type){case"vector":delete t?.data;break;case"geojson":delete t?.target}this.map.addSource(e.id,t)}return this}add(e,t){this.addSource(e.source);const i=e.source.id,n=Object.assign({id:e.id,source:i},e.layer);"vector"===this.map.getSource(i).type&&(n["source-layer"]||(n["source-layer"]="layer")),this.dataExtension=e.dataExt||{},this.templateId=e.templateId||this.dataExtension?.templateId||void 0;let r=t;this.map.addLayer(n,r),this.layerFilter=n.filter||void 0,this.layerId=n.id,(e.isQuery||e.query)&&(this.isQuery=!0,this.addInteraction())}remove(){this.map.getLayer(this.layerId)&&this.map.removeLayer(this.layerId),this.isQuery&&this.removeInteraction()}addInteraction(){this.map.on("click",`${this.layerId}`,e=>{if(e.features.length>0){this.feature=e.features[0];let t=e.lngLat.toArray();"Point"===this.feature.geometry.type&&(t=this.feature.geometry.coordinates),this.map.pubsub.emit("layer:click",{layerId:this.layerId,templateId:this.templateId,center:t,feature:this.feature,features:e.features})}}),this.map.on("mouseenter",`${this.layerId}`,e=>{this.map.getCanvas().style.cursor="pointer"}),this.map.on("mouseleave",`${this.layerId}`,e=>{this.map.getCanvas().style.cursor="default"})}removeInteraction(){this.map.off("click",`${this.layerId}`,e=>{}),this.map.off("mouseenter",`${this.layerId}`,e=>{}),this.map.off("mouseleave",`${this.layerId}`,e=>{})}}class IA{map;checkedParentLayers=new Map;checkedLayers=new Map;queryLayerIds=[];symbolLayerIds=[];pointLayerIds=[];lineLayerIds=[];polygonLayerIds=[];constructor(e){this.map=e}addSource(e){this.map.getSource(e.id)||this.map.addSource(e.id,e)}addLayer(e,t){const i=new CA(this.map);let n=t;switch(e.layerType){case"symbol":n=SA.symbolPointId,this.symbolLayerIds.push(e.id);break;case"point":n=SA.layerPointId,this.pointLayerIds.push(e.id);break;case"line":n=SA.layerLineId,this.lineLayerIds.push(e.id);break;case"fill":case"fill-extrusion":n=SA.layerPolygonId,this.polygonLayerIds.push(e.id)}return i.add(e,n),this.checkedLayers.set(e.id,i),i.isQuery&&this.queryLayerIds.push(e.id),this}addGroupLayer(e){const{id:t,layers:i}=e;i&&(i.forEach(e=>{e.layer=Object.assign({id:e.id,source:e.source.id||e.id},e.layer),e.source=Object.assign({id:e.id},e.source),e.source.id||(e.source.id=t),e.layer.id||(e.layer.id=t,e.layer.source=t),this.map.getLayer(e.layer.id)||this.addLayer(e)}),this.checkedParentLayers.get(t)||this.checkedParentLayers.set(t,e))}removeLayer(e){this.map.getLayer(e.layer.id)&&this.map.removeLayer(e.layer.id),this.checkedLayers.delete(e.layer.id),e.isQuery&&(this.queryLayerIds=this.queryLayerIds.filter(t=>t!==e.layer.id))}removeGroupLayer(e){const{id:t,layers:i}=e;i&&i.forEach(e=>{e.layer=Object.assign({id:e.id},e.layer),e.source=Object.assign({id:e.id},e.source),this.removeLayer(e)}),this.checkedParentLayers.delete(t)}getCheckedLayers(){return Array.from(this.checkedLayers.values())}getLayer(e){return e?this.checkedLayers.get(e):null}}class MA{map;eraserLayerId="eraser_layer";eraserDebugLayerId="eraser_debug_layer";constructor(e){this.map=e}add(e,t){this.map.addSource(this.eraserLayerId,{type:"geojson",data:e}),this.map.addLayer({id:this.eraserLayerId,source:this.eraserLayerId,type:"clip",layout:{"clip-layer-types":t,"clip-layer-scope":["basemap"]}})}remove(){this.map.removeLayer(this.eraserLayerId),this.map.removeSource(this.eraserLayerId)}showPolygon(){this.map.addLayer({id:this.eraserDebugLayerId,type:"line",source:this.eraserLayerId,paint:{"line-color":"rgba(255, 0, 0, 0.9)","line-dasharray":[0,4,3],"line-width":5}})}hidePolygon(){this.map.getLayer(this.eraserDebugLayerId)&&this.map.removeLayer(this.eraserDebugLayerId)}}class RA{map;layerId="mask_layer";constructor(e){this.map=e}add(e,t={},i){this.map.getSource(this.layerId)||this.map.addSource(this.layerId,{type:"geojson",data:e}),i||(i=SA.maskLayerId);const n=Object.assign({id:this.layerId,source:this.layerId,type:"fill",paint:{"fill-color":"#000000","fill-opacity":.7}},t);return this.map.getLayer(this.layerId)||this.map.addLayer(n,i),this}addLine(e,t={}){this.map.getSource(this.layerId)||this.map.addSource(this.layerId,{type:"geojson",data:e});const i=Object.assign({id:`${this.layerId}_line`,source:this.layerId,type:"line",paint:{"line-color":"#ff0000","line-width":2}},t);this.map.addLayer(i,this.layerId)}remove(){this.map.removeLayer(this.layerId),this.map.removeLayer(`${this.layerId}_line`),this.map.removeSource(this.layerId)}}class PA{map;popup;constructor(e){this.map=e,this.popup=new o.Popup({closeOnClick:!1,closeOnMove:!1,className:"gismap-popup",anchor:"bottom"})}show({position:e,html:t,offset:i=[0,-10],flyTo:n=!1}){t&&this.popup.setHTML(t),i&&this.popup.setOffset(i),this.popup.setLngLat(e),this.popup.addTo(this.map),n&&this.map.flyTo({center:e})}close(){this.popup.remove()}}class BA{map;tdtImgId="tdt-img";tdtVecId="tdt-vec";tdtCiaId="tdt-cia";tdtLayer=new Map;token="6c8a0fffe8f584f8310306723f5bc776";constructor(e,t){this.map=e,this.token=t||this.token,this.tdtLayer.set(this.tdtImgId,{type:"raster",tiles:[`https://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t1.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t2.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t3.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t4.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t5.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t6.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t7.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`],tileSize:512,buffer:128,tolerance:0,maxzoom:17,scheme:"xyz",roundZoom:!0,crs:"EPSG:4326"}),this.tdtLayer.set(this.tdtCiaId,{type:"raster",tiles:[`https://t0.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t1.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t2.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t3.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t4.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t5.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t6.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t7.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`],tileSize:256,maxzoom:17,crs:"EPSG:4326"}),this.tdtLayer.set(this.tdtVecId,{type:"raster",tiles:[`http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t1.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t2.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t3.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t4.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t5.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t6.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t7.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`],tileSize:256,maxzoom:18,crs:"EPSG:4326"})}addImgLayer(e){let t=this.map.getSource(this.tdtImgId);t||(t=this.tdtLayer.get(this.tdtImgId),this.map.addSource(this.tdtImgId,t)),e&&this.map.getLayer(e)?this.map.addLayer({id:this.tdtImgId,type:"raster",source:this.tdtImgId},e):this.map.addLayer({id:this.tdtImgId,type:"raster",source:this.tdtImgId})}removeImgLayer(){this.map.getLayer(this.tdtImgId)&&this.map.removeLayer(this.tdtImgId)}addVecLayer(e){let t=this.map.getSource(this.tdtVecId);t||(t=this.tdtLayer.get(this.tdtVecId),this.map.addSource(this.tdtVecId,t)),e&&this.map.getLayer(e)?this.map.addLayer({id:this.tdtVecId,type:"raster",source:this.tdtVecId},e):this.map.addLayer({id:this.tdtVecId,type:"raster",source:this.tdtVecId})}removeVecLayer(){this.map.getLayer(this.tdtVecId)&&this.map.removeLayer(this.tdtVecId)}addCiaLayer(e){let t=this.map.getSource(this.tdtCiaId);t||(t=this.tdtLayer.get(this.tdtCiaId),this.map.addSource(this.tdtCiaId,t)),e&&this.map.getLayer(e)?this.map.addLayer({id:this.tdtCiaId,type:"raster",source:this.tdtCiaId},e):this.map.addLayer({id:this.tdtCiaId,type:"raster",source:this.tdtCiaId})}removeCiaLayer(){this.map.getLayer(this.tdtCiaId)&&this.map.removeLayer(this.tdtCiaId)}clear(){this.removeImgLayer(),this.removeVecLayer(),this.removeCiaLayer()}}class LA{map;constructor(e){this.map=e}addSource(e){if(e?.tiles&&!this.map.getSource("raster-dem"))return this.map.addSource("raster-dem",{type:"raster-dem",minzoom:6,maxzoom:14,tileSize:256,...e}),this}add(e={source:{},layer:{}}){return this.map.getSource("raster-dem")||this.addSource(e.source),this.map.setTerrain({source:"raster-dem",exaggeration:1,...e.layer}),this}remove(){return this.map.setTerrain(null),this}addHillshade(){if(this.map.getSource("raster-dem"))return this.map.addLayer({id:"hillshade",type:"hillshade",source:"raster-dem",paint:{"hillshade-exaggeration":.5,"hillshade-highlight-color":"#FFFFFF","hillshade-shadow-color":"#025505"}}),this}}class OA{map;constructor(e){this.map=e}addSource(e){if(!this.map.getSource(e.id)){const t=Object.assign({type:"geojson",tiles:[e.url],tileSize:256},e);this.map.addSource(e.id,t)}return this}addLayer(e){if(!this.map.getLayer(e.id)){const t=Object.assign({id:e.id,source:e.source},e);this.map.addLayer(t)}return this}removeSource(e){return this.map.getSource(e)&&this.map.removeSource(e),this}removeLayer(e){return this.map.getLayer(e)&&this.map.removeLayer(e),this}}function kA(e,t){if(null==e||""===e)return"";return e.replace(/\{(?:p\.)?([^}]+)\}|\$\{(?:p\.)?([^}]+)\}/g,(e,i,n)=>{return r=t,(i||n).split(".").reduce((e,t)=>{const i=(e||{})[t];return void 0!==i?String(i):""},r);var r})}function DA(e,t,i="children"){function n(e){"function"==typeof t&&t(e),Array.isArray(e[i])&&e[i].forEach(e=>{n(e)})}Array.isArray(e)&&e.forEach(e=>{n(e)})}function FA(e=10){if(e<=0)throw new Error("随机数长度必须大于0");let t="";t+=Math.floor(9*Math.random())+1;for(let i=1;i<e;i++)t+=Math.floor(10*Math.random());return t}class NA{templates=new Map;constructor(){}add(e,t){this.templates.set(e,t)}get(e){return this.templates.get(e)}renderHtml(e,t){const i=this.templates.get(e);if(i){return this._unionFromTemplate(i,t)}}_unionFromTemplate(e,t){let i="";const n=[],r=[],{width:s,labelWidth:o,header:a,body:l,footer:c}=e,u=[];return u.push(`<div class="gismap-popup-box" style="width: ${s||260}px;">`),a&&(i=kA(a,t)),l&&l.length>0&&(n.push('<div class="gismap-row gismap-popup-body no-scrollbar">'),l.forEach(e=>{n.push(`<div class="gismap-col gismap-col-${e.style.span||12}">`),n.push(`<div class="popup-label" style="width: ${o||80}px;">${e.fieldLabel}:</div>`);let i=t[e.fieldName]||"";switch(n.push('<div class="popup-value">'),e.fieldType){case"date":case"dateTime":case"number":break;default:n.push(`${i}`)}""!=i&&e.unit&&n.push(`<span class="popup-unit">${e.unit}</span>`),n.push("</div>"),n.push("</div>")}),n.push("</div>")),c&&c.length>0&&(r.push('<div class="gismap-popup-footer">'),c.forEach(e=>{if("click"===e.type)r.push(`<span class="footer-btn" @click="${e.event}"><span class="s"></span> ${e.label}</span>`)}),r.push("</div>")),u.push(i),u.push(...n),u.push(...r),u.push("</div>"),u.join("")}remove(e){this.templates.delete(e)}}class zA{map;marker;constructor(e){this.map=e}show({position:e,html:t,markerIcon:i="marker",offset:n=[0,-30],iconName:r,flyTo:s=!1}){this.marker&&this.marker.remove();const a=document.createElement("div");a.className="marker-container";const l=document.createElement("div");l.className=`${i}`,r&&(l.innerHTML=`<img src='${r}' class="marker-icon" />`),a.appendChild(l),this.marker=new o.Marker({element:a,anchor:"bottom"}).setLngLat(e).addTo(this.map),t&&this.marker.setPopup(new o.Popup({closeOnClick:!1,closeOnMove:!1,className:"gismap-popup",anchor:"bottom",offset:n}).setHTML(t)).togglePopup(),s&&this.map.flyTo({center:e})}close(){this.marker?.remove()}}class UA{map;constructor(e){this.map=e}load(e){let t=[];for(let i of e)t.push(this._loadImage(i));return new Promise((e,i)=>{Promise.all(t).then(t=>{e(!0)}).catch(e=>{i(e)})})}_loadImage(e){return new Promise((t,i)=>{this.map.loadImage(e.url,(n,r)=>{if(n)throw i(!1),n;this.map.hasImage(e.name)?this.map.updateImage(e.name,r):this.map.addImage(e.name,r),t(!0)})})}}class VA{map;options;constructor(e){this.map=e,this.options={range:[-1,10],"horizon-blend":.3,color:"white","high-color":"#add8e6","space-color":"#d8f2ff","star-intensity":0}}setFog(e={}){this.map.setFog({...this.options,...e})}}class GA{map;markers=new Map;selectMarker;popup;callback;constructor(e){return this.map=e,this.popup=new s.Popup({offset:[0,-32],closeButton:!1}),this}addFunction(e){this.callback=e}add(e){const t={anchor:"bottom",...e};let i=[0,0];switch(e.geometry.type.toLowerCase()){case"point":i=e.geometry.coordinates;break;case"linestring":case"polygon":i=vA(e.geometry.coordinates).geometry.coordinates}const n=document.createElement("div");n.className="gismap-marker marker_r",n.innerHTML=`<span>${e.index}</span>`,n.id=e.uuid,n.onclick=t=>{this.selectMarker&&this.selectMarker.toggleClassName("active");const i=this.markers.get(t.currentTarget.id);i&&(i.toggleClassName("active"),this.selectMarker=i,this.addPopup()),this.callback&&this.callback({uuid:e.uuid,marker:i})},t.element=n;const r=new uA(t);r.setData({templateId:e.templateId,data:e.properties}),r.setLngLat(i),r.addTo(this.map),this.markers.set(e.uuid,r)}addGroup(e){e.data.forEach(e=>{this.add(e)})}flyTo(e){this.selectMarker&&this.selectMarker.toggleClassName("active");const t=this.markers.get(e);t&&(this.map.flyTo({center:t.getLngLat(),zoom:16,essential:!0}),t.toggleClassName("active"),this.selectMarker=t,this.addPopup())}addPopup(){const{templateId:e,data:t}=this.selectMarker?.getData();if(!e)return;const i=this.map?.manager?.templateManager?.renderHtml(e,t);i&&this.map.manager?.popupManager.show({position:this.selectMarker?.getLngLat(),offset:[0,-32],html:i})}clear(){this.markers.forEach(e=>{e.remove()}),this.markers.clear(),this.selectMarker=void 0,this.popup&&this.popup.remove()}}class jA{map;layerManager;maskManager;tdtManager;eraserManager;popupManager;markerManager;terrainManager;vectorManager;templateManager;placeholderManager;iconManager;fogManager;quickSearchManager;constructor(e,t){this.map=e,this.layerManager=new IA(this.map),this.maskManager=new RA(this.map),this.tdtManager=new BA(this.map,t),this.eraserManager=new MA(this.map),this.popupManager=new PA(this.map),this.markerManager=new zA(this.map),this.terrainManager=new LA(this.map),this.vectorManager=new OA(this.map),this.templateManager=new NA,this.placeholderManager=new SA(this.map),this.iconManager=new UA(this.map),this.fogManager=new VA(this.map),this.quickSearchManager=new GA(this.map)}}const HA={key:0,class:"gismap-control"},WA={class:"widget top-left"},$A={class:"widget top-right"},qA={class:"widget bottom-left"},XA={class:"widget bottom-right"},ZA=t.defineComponent({name:"MapView",props:{accessToken:{type:String,default:()=>""},tdtToken:{type:String,default:()=>""},options:{type:Object,default:()=>({})}},emits:["load"],setup(e,{emit:i}){const n=i,r=e,s=t.ref(!1),a=t.ref();return t.onMounted(()=>{r.accessToken&&(o.accessToken=r.accessToken);const e={container:a.value,center:[120.65851,29.5714],minZoom:8,maxZoom:20,zoom:15,pitch:0,bearing:0,maxPitch:65,attributionControl:!1,spriteFormat:"auto",...r.options};e.style={version:8,sources:{},layers:[],...e.style||{}};const i=new l(e);i.on("load",async()=>{i.manager=new jA(i,r.tdtToken),await i.manager.iconManager.load(r.options?.icons||[]),i.manager.placeholderManager.addLayer(),s.value=!0,n("load",i)}),t.provide("map",i)}),(e,i)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"mapContainer",ref:a,class:"gismap-container"},null,512),s.value?(t.openBlock(),t.createElementBlock("div",HA,[t.createElementVNode("div",WA,[t.renderSlot(e.$slots,"top-left")]),t.createElementVNode("div",$A,[t.renderSlot(e.$slots,"top-right")]),t.createElementVNode("div",qA,[t.renderSlot(e.$slots,"bottom-left")]),t.createElementVNode("div",XA,[t.renderSlot(e.$slots,"bottom-right")]),t.renderSlot(e.$slots,"default")])):t.createCommentVNode("",!0)],64))}}),KA="el",JA=(e,t,i,n,r)=>{let s=`${e}-${t}`;return i&&(s+=`-${i}`),n&&(s+=`__${n}`),r&&(s+=`--${r}`),s},YA=Symbol("namespaceContextKey"),QA=e=>{const i=t.getCurrentInstance()?t.inject(YA,t.ref(KA)):t.ref(KA);return t.computed(()=>t.unref(i)||KA)},eS=(e,t)=>{const i=QA();return{namespace:i,b:(t="")=>JA(i.value,e,t,"",""),e:t=>t?JA(i.value,e,"",t,""):"",m:t=>t?JA(i.value,e,"","",t):"",be:(t,n)=>t&&n?JA(i.value,e,t,n,""):"",em:(t,n)=>t&&n?JA(i.value,e,"",t,n):"",bm:(t,n)=>t&&n?JA(i.value,e,t,"",n):"",bem:(t,n,r)=>t&&n&&r?JA(i.value,e,t,n,r):"",is:(e,...t)=>{const i=!(t.length>=1)||t[0];return e&&i?`is-${e}`:""},cssVar:e=>{const t={};for(const n in e)e[n]&&(t[`--${i.value}-${n}`]=e[n]);return t},cssVarName:e=>`--${i.value}-${e}`,cssVarBlock:t=>{const n={};for(const r in t)t[r]&&(n[`--${i.value}-${e}-${r}`]=t[r]);return n},cssVarBlockName:t=>`--${i.value}-${e}-${t}`}};
28
+ */var lT=null;try{lT=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function cT(e,t,i){this.low=0|e,this.high=0|t,this.unsigned=!!i}function uT(e){return!0===(e&&e.__isLong__)}function hT(e){var t=Math.clz32(e&-e);return e?31-t:t}cT.prototype.__isLong__,Object.defineProperty(cT.prototype,"__isLong__",{value:!0}),cT.isLong=uT;var dT={},pT={};function fT(e,t){var i,n,r;return t?(r=0<=(e>>>=0)&&e<256)&&(n=pT[e])?n:(i=gT(e,0,!0),r&&(pT[e]=i),i):(r=-128<=(e|=0)&&e<128)&&(n=dT[e])?n:(i=gT(e,e<0?-1:0,!1),r&&(dT[e]=i),i)}function mT(e,t){if(isNaN(e))return t?AT:TT;if(t){if(e<0)return AT;if(e>=bT)return RT}else{if(e<=-wT)return PT;if(e+1>=wT)return MT}return e<0?mT(-e,t).neg():gT(e%xT|0,e/xT|0,t)}function gT(e,t,i){return new cT(e,t,i)}cT.fromInt=fT,cT.fromNumber=mT,cT.fromBits=gT;var _T=Math.pow;function yT(e,t,i){if(0===e.length)throw Error("empty string");if("number"==typeof t?(i=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?AT:TT;if((i=i||10)<2||36<i)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return yT(e.substring(1),t,i).neg();for(var r=mT(_T(i,8)),s=TT,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),l=parseInt(e.substring(o,o+a),i);if(a<8){var c=mT(_T(i,a));s=s.mul(c).add(mT(l))}else s=(s=s.mul(r)).add(mT(l))}return s.unsigned=t,s}function vT(e,t){return"number"==typeof e?mT(e,t):"string"==typeof e?yT(e,t):gT(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}cT.fromString=yT,cT.fromValue=vT;var xT=4294967296,bT=xT*xT,wT=bT/2,ET=fT(1<<24),TT=fT(0);cT.ZERO=TT;var AT=fT(0,!0);cT.UZERO=AT;var ST=fT(1);cT.ONE=ST;var CT=fT(1,!0);cT.UONE=CT;var IT=fT(-1);cT.NEG_ONE=IT;var MT=gT(-1,2147483647,!1);cT.MAX_VALUE=MT;var RT=gT(-1,-1,!0);cT.MAX_UNSIGNED_VALUE=RT;var PT=gT(0,-2147483648,!1);cT.MIN_VALUE=PT;var BT=cT.prototype;BT.toInt=function(){return this.unsigned?this.low>>>0:this.low},BT.toNumber=function(){return this.unsigned?(this.high>>>0)*xT+(this.low>>>0):this.high*xT+(this.low>>>0)},BT.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(PT)){var t=mT(e),i=this.div(t),n=i.mul(t).sub(this);return i.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var r=mT(_T(e,6),this.unsigned),s=this,o="";;){var a=s.div(r),l=(s.sub(a.mul(r)).toInt()>>>0).toString(e);if((s=a).isZero())return l+o;for(;l.length<6;)l="0"+l;o=""+l+o}},BT.getHighBits=function(){return this.high},BT.getHighBitsUnsigned=function(){return this.high>>>0},BT.getLowBits=function(){return this.low},BT.getLowBitsUnsigned=function(){return this.low>>>0},BT.getNumBitsAbs=function(){if(this.isNegative())return this.eq(PT)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},BT.isSafeInteger=function(){var e=this.high>>21;return!e||!this.unsigned&&(-1===e&&!(0===this.low&&-2097152===this.high))},BT.isZero=function(){return 0===this.high&&0===this.low},BT.eqz=BT.isZero,BT.isNegative=function(){return!this.unsigned&&this.high<0},BT.isPositive=function(){return this.unsigned||this.high>=0},BT.isOdd=function(){return!(1&~this.low)},BT.isEven=function(){return!(1&this.low)},BT.equals=function(e){return uT(e)||(e=vT(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},BT.eq=BT.equals,BT.notEquals=function(e){return!this.eq(e)},BT.neq=BT.notEquals,BT.ne=BT.notEquals,BT.lessThan=function(e){return this.comp(e)<0},BT.lt=BT.lessThan,BT.lessThanOrEqual=function(e){return this.comp(e)<=0},BT.lte=BT.lessThanOrEqual,BT.le=BT.lessThanOrEqual,BT.greaterThan=function(e){return this.comp(e)>0},BT.gt=BT.greaterThan,BT.greaterThanOrEqual=function(e){return this.comp(e)>=0},BT.gte=BT.greaterThanOrEqual,BT.ge=BT.greaterThanOrEqual,BT.compare=function(e){if(uT(e)||(e=vT(e)),this.eq(e))return 0;var t=this.isNegative(),i=e.isNegative();return t&&!i?-1:!t&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},BT.comp=BT.compare,BT.negate=function(){return!this.unsigned&&this.eq(PT)?PT:this.not().add(ST)},BT.neg=BT.negate,BT.add=function(e){uT(e)||(e=vT(e));var t=this.high>>>16,i=65535&this.high,n=this.low>>>16,r=65535&this.low,s=e.high>>>16,o=65535&e.high,a=e.low>>>16,l=0,c=0,u=0,h=0;return u+=(h+=r+(65535&e.low))>>>16,c+=(u+=n+a)>>>16,l+=(c+=i+o)>>>16,l+=t+s,gT((u&=65535)<<16|(h&=65535),(l&=65535)<<16|(c&=65535),this.unsigned)},BT.subtract=function(e){return uT(e)||(e=vT(e)),this.add(e.neg())},BT.sub=BT.subtract,BT.multiply=function(e){if(this.isZero())return this;if(uT(e)||(e=vT(e)),lT)return gT(lT.mul(this.low,this.high,e.low,e.high),lT.get_high(),this.unsigned);if(e.isZero())return this.unsigned?AT:TT;if(this.eq(PT))return e.isOdd()?PT:TT;if(e.eq(PT))return this.isOdd()?PT:TT;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(ET)&&e.lt(ET))return mT(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,i=65535&this.high,n=this.low>>>16,r=65535&this.low,s=e.high>>>16,o=65535&e.high,a=e.low>>>16,l=65535&e.low,c=0,u=0,h=0,d=0;return h+=(d+=r*l)>>>16,u+=(h+=n*l)>>>16,h&=65535,u+=(h+=r*a)>>>16,c+=(u+=i*l)>>>16,u&=65535,c+=(u+=n*a)>>>16,u&=65535,c+=(u+=r*o)>>>16,c+=t*l+i*a+n*o+r*s,gT((h&=65535)<<16|(d&=65535),(c&=65535)<<16|(u&=65535),this.unsigned)},BT.mul=BT.multiply,BT.divide=function(e){if(uT(e)||(e=vT(e)),e.isZero())throw Error("division by zero");var t,i,n;if(lT)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?gT((this.unsigned?lT.div_u:lT.div_s)(this.low,this.high,e.low,e.high),lT.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?AT:TT;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return AT;if(e.gt(this.shru(1)))return CT;n=AT}else{if(this.eq(PT))return e.eq(ST)||e.eq(IT)?PT:e.eq(PT)?ST:(t=this.shr(1).div(e).shl(1)).eq(TT)?e.isNegative()?ST:IT:(i=this.sub(e.mul(t)),n=t.add(i.div(e)));if(e.eq(PT))return this.unsigned?AT:TT;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=TT}for(i=this;i.gte(e);){t=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var r=Math.ceil(Math.log(t)/Math.LN2),s=r<=48?1:_T(2,r-48),o=mT(t),a=o.mul(e);a.isNegative()||a.gt(i);)a=(o=mT(t-=s,this.unsigned)).mul(e);o.isZero()&&(o=ST),n=n.add(o),i=i.sub(a)}return n},BT.div=BT.divide,BT.modulo=function(e){return uT(e)||(e=vT(e)),lT?gT((this.unsigned?lT.rem_u:lT.rem_s)(this.low,this.high,e.low,e.high),lT.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},BT.mod=BT.modulo,BT.rem=BT.modulo,BT.not=function(){return gT(~this.low,~this.high,this.unsigned)},BT.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},BT.clz=BT.countLeadingZeros,BT.countTrailingZeros=function(){return this.low?hT(this.low):hT(this.high)+32},BT.ctz=BT.countTrailingZeros,BT.and=function(e){return uT(e)||(e=vT(e)),gT(this.low&e.low,this.high&e.high,this.unsigned)},BT.or=function(e){return uT(e)||(e=vT(e)),gT(this.low|e.low,this.high|e.high,this.unsigned)},BT.xor=function(e){return uT(e)||(e=vT(e)),gT(this.low^e.low,this.high^e.high,this.unsigned)},BT.shiftLeft=function(e){return uT(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?gT(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):gT(0,this.low<<e-32,this.unsigned)},BT.shl=BT.shiftLeft,BT.shiftRight=function(e){return uT(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?gT(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):gT(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},BT.shr=BT.shiftRight,BT.shiftRightUnsigned=function(e){return uT(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?gT(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):gT(32===e?this.high:this.high>>>e-32,0,this.unsigned)},BT.shru=BT.shiftRightUnsigned,BT.shr_u=BT.shiftRightUnsigned,BT.rotateLeft=function(e){var t;return uT(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?gT(this.high,this.low,this.unsigned):e<32?(t=32-e,gT(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),gT(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},BT.rotl=BT.rotateLeft,BT.rotateRight=function(e){var t;return uT(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?gT(this.high,this.low,this.unsigned):e<32?(t=32-e,gT(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),gT(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},BT.rotr=BT.rotateRight,BT.toSigned=function(){return this.unsigned?gT(this.low,this.high,!1):this},BT.toUnsigned=function(){return this.unsigned?this:gT(this.low,this.high,!0)},BT.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},BT.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},BT.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},cT.fromBytes=function(e,t,i){return i?cT.fromBytesLE(e,t):cT.fromBytesBE(e,t)},cT.fromBytesLE=function(e,t){return new cT(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},cT.fromBytesBE=function(e,t){return new cT(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)},"function"==typeof BigInt&&(cT.fromBigInt=function(e,t){return gT(Number(BigInt.asIntN(32,e)),Number(BigInt.asIntN(32,e>>BigInt(32))),t)},cT.fromValue=function(e,t){return"bigint"==typeof e?cT.fromBigInt(e,t):vT(e,t)},BT.toBigInt=function(){var e=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|e});function LT(e){"X"===e&&(e="");const t=e.padEnd(16,"0");return cT.fromString(t,!0,16)}const OT=180/Math.PI;function kT(e,t,i){const n=1<<t;return[(e[0]+i[0])/n,(e[1]+i[1])/n]}function DT(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function FT(e){return[DT(e[0]),DT(e[1])]}function NT(e,[t,i]){switch(e){case 0:return[1,t,i];case 1:return[-t,1,i];case 2:return[-t,-i,1];case 3:return[-1,-i,-t];case 4:return[i,-1,-t];case 5:return[i,t,-1];default:throw new Error("Invalid face")}}function zT([e,t,i]){const n=Math.atan2(i,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*OT,n*OT]}function UT(e,t,i,n){if(0===n){1===i&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);const n=t[0];t[0]=t[1],t[1]=n}}function VT(e){const{face:t,ij:i,level:n}=e,r=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(100*Math.pow(2,-n))),o=new Float64Array(4*s*2+2);let a=0,l=0;for(let c=0;c<4;c++){const e=r[c].slice(0),u=r[c+1],h=(u[0]-e[0])/s,d=(u[1]-e[1])/s;for(let r=0;r<s;r++){e[0]+=h,e[1]+=d;const r=zT(NT(t,FT(kT(i,n,e))));Math.abs(r[1])>89.999&&(r[0]=l);const s=r[0]-l;r[0]+=s>180?-360:s<-180?360:0,o[a++]=r[0],o[a++]=r[1],l=r[0]}}return o[a++]=o[0],o[a++]=o[1],o}function GT(e){const t=function(e){if(e.indexOf("/")>0)return e;const t=LT(e);return function(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<64;)t="0"+t;const i=t.lastIndexOf("1"),n=t.substring(0,3),r=t.substring(3,i),s=r.length/2,o=cT.fromString(n,!0,2).toString(10);let a="";if(0!==s)for(a=cT.fromString(r,!0,2).toString(4);a.length<s;)a="0"+a;return`${o}/${a}`}(t)}(e);return function(e){if(0===e.length)throw new Error(`Invalid Hilbert quad key ${e}`);const t=e.split("/"),i=parseInt(t[0],10),n=t[1],r=n.length;let s=0;const o=[0,0];for(let a=r-1;a>=0;a--){s=r-a;const e=n[a];let t=0,i=0;"1"===e?i=1:"2"===e?(t=1,i=1):"3"===e&&(t=1);const l=Math.pow(2,s-1);UT(l,o,t,i),o[0]+=l*t,o[1]+=l*i}if(i%2==1){const e=o[0];o[0]=o[1],o[1]=e}return{face:i,ij:o,level:s}}(t)}function jT(e){return function(e){const t=FT(kT(e.ij,e.level,[.5,.5]));return zT(NT(e.face,t))}(GT(e))}function HT(e){if(e.length%2!=0)throw new Error("Invalid corners");const t=[],i=[];for(let n=0;n<e.length;n+=2)t.push(e[n]),i.push(e[n+1]);return t.sort((e,t)=>e-t),i.sort((e,t)=>e-t),{west:t[0],east:t[t.length-1],north:i[i.length-1],south:i[0]}}function WT(e,t){const i=t?.minimumHeight||0,n=t?.maximumHeight||0,r=function(e){let t;if(2===e.face||5===e.face){let i=null,n=0;for(let t=0;t<4;t++){const r=VT(GT(`${e.face}/${t}`));null==i&&(i=new Float64Array(4*r.length)),i.set(r,n),n+=r.length}t=HT(i)}else t=HT(VT(e));return t}(GT(e)),s=r.west,o=r.south,a=r.east,l=r.north,c=[];return c.push(new ca(s,l,i)),c.push(new ca(a,l,i)),c.push(new ca(a,o,i)),c.push(new ca(s,o,i)),c.push(new ca(s,l,n)),c.push(new ca(a,l,n)),c.push(new ca(a,o,n)),c.push(new ca(s,o,n)),c}function $T(e){const t=e.token,i={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=WT(t,i),r=jT(t),s=r[0],o=r[1],a=qb.WGS84.cartographicToCartesian([s,o,i.maximumHeight]),l=new ca(a[0],a[1],a[2]);n.push(l);const c=function(e,t=new __){if(!e||0===e.length)return t.halfAxes=new _a([0,0,0,0,0,0,0,0,0]),t.center=new ca,t;const i=e.length,n=new ca(0,0,0);for(const A of e)n.add(A);const r=1/i;n.multiplyByScalar(r);let s=0,o=0,a=0,l=0,c=0,u=0;for(const A of e){const e=k_.copy(A).subtract(n);s+=e.x*e.x,o+=e.x*e.y,a+=e.x*e.z,l+=e.y*e.y,c+=e.y*e.z,u+=e.z*e.z}s*=r,o*=r,a*=r,l*=r,c*=r,u*=r;const h=U_;h[0]=s,h[1]=o,h[2]=a,h[3]=o,h[4]=l,h[5]=c,h[6]=a,h[7]=c,h[8]=u;const{unitary:d}=R_(h,V_),p=t.halfAxes.copy(d);let f=p.getColumn(0,F_),m=p.getColumn(1,N_),g=p.getColumn(2,z_),_=-Number.MAX_VALUE,y=-Number.MAX_VALUE,v=-Number.MAX_VALUE,x=Number.MAX_VALUE,b=Number.MAX_VALUE,w=Number.MAX_VALUE;for(const A of e)k_.copy(A),_=Math.max(k_.dot(f),_),y=Math.max(k_.dot(m),y),v=Math.max(k_.dot(g),v),x=Math.min(k_.dot(f),x),b=Math.min(k_.dot(m),b),w=Math.min(k_.dot(g),w);f=f.multiplyByScalar(.5*(x+_)),m=m.multiplyByScalar(.5*(b+y)),g=g.multiplyByScalar(.5*(w+v)),t.center.copy(f).add(m).add(g);const E=D_.set(_-x,y-b,v-w).multiplyByScalar(.5),T=new _a([E[0],0,0,0,E[1],0,0,0,E[2]]);return t.halfAxes.multiplyRight(T),t}(n);return[...c.center,...c.halfAxes]}const qT={QUADTREE:4,OCTREE:8};function XT(e,t,i){if(e?.box){const n=function(e,t){const i=function(e){return e.and(e.not().add(1))}(e).shiftRightUnsigned(2);return e.add(cT.fromNumber(2*t+1-4).multiply(i))}(LT(e.s2VolumeInfo.token),t),r=function(e){if(e.isZero())return"X";let t=e.countTrailingZeros();t=(t-t%4)/4;const i=t;t*=4;const n=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-i-n.length).join("0")+n}(n),s={...e.s2VolumeInfo};if(s.token=r,"OCTREE"===i){const t=e.s2VolumeInfo,i=t.maximumHeight-t.minimumHeight,n=i/2,r=t.minimumHeight+i/2;t.minimumHeight=r-n,t.maximumHeight=r+n}return{box:$T(s),s2VolumeInfo:s}}}async function ZT(e){const{subtree:t,subtreeData:i={level:0,x:0,y:0,z:0},parentData:n={mortonIndex:0,localLevel:-1,localX:0,localY:0,localZ:0},childIndex:r=0,implicitOptions:s,loaderOptions:o,s2VolumeBox:a}=e,{subdivisionScheme:l,subtreeLevels:c,maximumLevel:u,contentUrlTemplate:h,subtreesUriTemplate:d,basePath:p}=s,f={children:[],lodMetricValue:0,contentUrl:""};if(!u)return O.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${h} won't be loaded...`),f;const m=n.localLevel+1,g=i.level+m;if(g>u)return f;const _=qT[l],y=Math.log2(_),v=1&r,x=r>>1&1,b=r>>2&1,w=JT(n.localX,v,1),E=JT(n.localY,x,1),T=JT(n.localZ,b,1),A=JT(i.x,w,m),S=JT(i.y,E,m),C=JT(i.z,T,m),I=JT(n.mortonIndex,r,y);let M,R,P,B;if(m===c&&KT(t.childSubtreeAvailability,I)){const e=YT(`${p}/${d}`,g,A,S,C);M=await Et(e,aT,o),B=0,R={level:g,x:A,y:S,z:C},P={mortonIndex:0,localLevel:0,localX:0,localY:0,localZ:0}}else{M=t;B=(_**m-1)/(_-1)+I,R=i,P={mortonIndex:I,localLevel:m,localX:w,localY:E,localZ:T}}if(!KT(M.tileAvailability,B))return f;KT(M.contentAvailability,B)&&(f.contentUrl=YT(h,g,A,S,C));for(let L=0;L<_;L++){const e=XT(a,L,l),t=await ZT({subtree:M,subtreeData:R,parentData:P,childIndex:L,implicitOptions:s,loaderOptions:o,s2VolumeBox:e});(t.contentUrl||t.children.length)&&f.children.push(t)}if(f.contentUrl||f.children.length){const e=function(e,t,i,n){const{basePath:r,refine:s,getRefine:o,lodMetricType:a,getTileType:l,rootLodMetricValue:c,rootBoundingVolume:u}=i,h=e.contentUrl&&e.contentUrl.replace(`${r}/`,""),d=c/2**t.level,p=n?.box?{box:n.box}:u,f=function(e,t,i){if(e.region){const{level:n,x:r,y:s,z:o}=t,[a,l,c,u,h,d]=e.region,p=2**n,f=(c-a)/p,[m,g]=[a+f*r,a+f*(r+1)],_=(u-l)/p,[y,v]=[l+_*s,l+_*(s+1)];let x,b;if("OCTREE"===i){const e=(d-h)/p;[x,b]=[h+e*o,h+e*(o+1)]}else[x,b]=[h,d];return{region:[m,y,g,v,x,b]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${JSON.stringify(e)}`)}(p,t,i.subdivisionScheme);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},id:e.contentUrl,refine:o(s),type:l(e),lodMetricType:a,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:f}}(f,{level:g,x:A,y:S,z:C},s,a);return e}return f}function KT(e,t){let i;return Array.isArray(e)?(i=e[0],e.length>1&&O.once('Not supported extension "3DTILES_multiple_contents" has been detected')):i=e,"constant"in i?Boolean(i.constant):!!i.explicitBitstream&&function(e,t){const i=Math.floor(e/8),n=e%8;return 1==(t[i]>>n&1)}(t,i.explicitBitstream)}function JT(e,t,i){return(e<<i)+t}function YT(e,t,i,n,r){const s=function(e){const t={};for(const i in e)t[`{${i}}`]=e[i];return t}({level:t,x:i,y:n,z:r});return e.replace(/{level}|{x}|{y}|{z}/gi,e=>s[e])}function QT(e,t=""){if(!t)return fw.EMPTY;const i=t.split("?")[0].split(".").pop();switch(i){case"pnts":return fw.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return fw.SCENEGRAPH;default:return i||fw.EMPTY}}function eA(e){switch(e){case"REPLACE":case"replace":return dw.REPLACE;case"ADD":case"add":return dw.ADD;default:return e}}function tA(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){const i=new URL(e,`${t}/`);return decodeURI(i.toString())}return e.startsWith("/")?e:Te(t,e)}function iA(e,t){if(!e)return null;let i;if(e.content){const n=e.content.uri||e.content?.url;void 0!==n&&(i=tA(n,t))}return{...e,id:i,contentUrl:i,lodMetricType:yw.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:QT(0,i),refine:eA(e.refine)}}async function nA(e,t,i,n,r){const{subdivisionScheme:s,maximumLevel:o,availableLevels:a,subtreeLevels:l,subtrees:{uri:c}}=n,u=tA(YT(c,0,0,0,0),i),h=await Et(u,aT,r),d=e.content?.uri,p=d?tA(d,i):"",f=t?.root?.refine,m=e.geometricError,g=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(g){const t={box:$T(g),s2VolumeInfo:g};e.boundingVolume=t}const _=e.boundingVolume,y={contentUrlTemplate:p,subtreesUriTemplate:c,subdivisionScheme:s,subtreeLevels:l,maximumLevel:Number.isFinite(a)?a-1:o,refine:f,basePath:i,lodMetricType:yw.GEOMETRIC_ERROR,rootLodMetricValue:m,rootBoundingVolume:_,getTileType:QT,getRefine:eA};return await async function(e,t,i,n,r){if(!e)return null;const{children:s,contentUrl:o}=await ZT({subtree:i,implicitOptions:n,loaderOptions:r});let a,l=null;o&&(a=o,l={uri:o.replace(`${t}/`,"")});const c={...e,id:a,contentUrl:a,lodMetricType:yw.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:QT(0,a),refine:eA(e.refine),content:l||e.content,children:s};return c}(e,i,h,y,r)}function rA(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}const sA={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:mE,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(e,t={},i){const n=t["3d-tiles"]||{};let r;r="auto"===n.isTileset?i?.url&&-1!==i.url.indexOf(".json"):n.isTileset;return r?async function(e,t,i){const n=JSON.parse((new TextDecoder).decode(e)),r=i?.url||"",s=function(e){return Ee(e)}(r),o=await async function(e,t,i){let n=null;const r=rA(e.root);n=r&&e.root?await nA(e.root,e,t,r,i):iA(e.root,t);const s=[];for(s.push(n);s.length>0;){const n=s.pop()||{},r=n.children||[],o=[];for(const a of r){const n=rA(a);let r;r=n?await nA(a,e,t,n,i):iA(a,t),r&&(o.push(r),s.push(r))}n.children=o}return n}(n,s,t||{}),a={...n,shape:"tileset3d",loader:sA,url:r,queryString:i?.queryString||"",basePath:s,root:o||n.root,type:gw.TILES3D,lodMetricType:yw.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0};return a}(e,t,i):async function(e,t,i){const n={content:{shape:"tile3d",featureIds:null}},r=0;return await rT(e,r,t,i,n.content),n.content}(e,t,i)},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};const oA=[0],aA={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:sA,onTilesetLoad:{type:"function",value:e=>{}},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:(e,t,i)=>{}},_getMeshColor:{type:"function",value:e=>[255,255,255]}};let lA=class extends _g{initializeState(){"onTileLoadFail"in this.props&&qt.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({props:e,oldProps:t,changeFlags:i}){if(e.data&&e.data!==t.data&&this._loadTileset(e.data),i.viewportChanged){const{activeViewports:e}=this.state;Object.keys(e).length&&(this._updateTileset(e),this.state.lastUpdatedViewports=e,this.state.activeViewports={})}if(i.propsChanged){const{layerMap:e}=this.state;for(const t in e)e[t].needsUpdate=!0}}activateViewport(e){const{activeViewports:t,lastUpdatedViewports:i}=this.state;this.internalState.viewport=e,t[e.id]=e;const n=i?.[e.id];n&&e.equals(n)||(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:e,sourceLayer:t}){const i=t&&t.props.tile;return e.picked&&(e.object=i),e.sourceTile=i,e}filterSubLayer({layer:e,viewport:t}){const{tile:i}=e.props,{id:n}=t;return i.selected&&i.viewportIds.includes(n)}_updateAutoHighlight(e){const t=e.sourceTile,i=this.state.layerMap[t?.id];i&&i.layer&&i.layer.updateAutoHighlight(e)}async _loadTileset(e){const{loadOptions:t={}}=this.props,i=this.props.loader||this.props.loaders,n=Array.isArray(i)?i[0]:i,r={loadOptions:{...t}};let s=e;if(n.preload){const i=await n.preload(e,t);i.url&&(s=i.url),i.headers&&(r.loadOptions.fetch={...r.loadOptions.fetch,headers:i.headers}),Object.assign(r,i)}const o=await Et(s,n,r.loadOptions),a=new fE(o,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...r});this.setState({tileset3d:a,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(a)}_onTileLoad(e){const{lastUpdatedViewports:t}=this.state;this.props.onTileLoad(e),this._updateTileset(t),this.setNeedsUpdate()}_onTileUnload(e){delete this.state.layerMap[e.id],this.props.onTileUnload(e)}_updateTileset(e){if(!e)return;const{tileset3d:t}=this.state,{timeline:i}=this.context,n=Object.keys(e).length;i&&n&&t&&t.selectTiles(Object.values(e)).then(e=>{this.state.frameNumber!==e&&this.setState({frameNumber:e})})}_getSubLayer(e,t){if(!e.content)return null;switch(e.type){case fw.POINTCLOUD:return this._makePointCloudLayer(e,t);case fw.SCENEGRAPH:return this._make3DModelLayer(e);case fw.MESH:return this._makeSimpleMeshLayer(e,t);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${e.content.type}`)}}_makePointCloudLayer(e,t){const{attributes:i,pointCount:n,constantRGBA:r,cartographicOrigin:s,modelMatrix:o}=e.content,{positions:a,normals:l,colors:c}=i;if(!a)return null;const u=t&&t.props.data||{header:{vertexCount:n},attributes:{POSITION:a,NORMAL:l,COLOR_0:c}},{pointSize:h,getPointColor:d}=this.props;return new(this.getSubLayerClass("pointcloud",Xg))({pointSize:h},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${e.id}`,tile:e,data:u,coordinateSystem:Ec.METER_OFFSETS,coordinateOrigin:s,modelMatrix:o,getColor:r||d,_offset:0})}_make3DModelLayer(e){const{gltf:t,instances:i,cartographicOrigin:n,modelMatrix:r}=e.content;return new(this.getSubLayerClass("scenegraph",Eb))({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${e.id}`,tile:e,data:i||oA,scenegraph:t,coordinateSystem:Ec.METER_OFFSETS,coordinateOrigin:n,modelMatrix:r,getTransformMatrix:e=>e.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(e,t){const i=e.content,{attributes:n,indices:r,modelMatrix:s,cartographicOrigin:o,coordinateSystem:a=Ec.METER_OFFSETS,material:l,featureIds:c}=i,{_getMeshColor:u}=this.props,h=t&&t.props.mesh||new kh({topology:"triangle-list",attributes:cA(n),indices:r});return new(this.getSubLayerClass("mesh",Sb))(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${e.id}`,tile:e,mesh:h,data:oA,getColor:u(e),pbrMaterial:l,modelMatrix:s,coordinateOrigin:o,coordinateSystem:a,featureIds:c,_offset:0})}renderLayers(){const{tileset3d:e,layerMap:t}=this.state;return e?e.tiles.map(e=>{const i=t[e.id]=t[e.id]||{tile:e};let{layer:n}=i;return e.selected&&(n?i.needsUpdate&&(n=this._getSubLayer(e,n),i.needsUpdate=!1):n=this._getSubLayer(e)),i.layer=n,n}).filter(Boolean):null}};function cA(e){const t={};return t.positions={...e.positions,value:new Float32Array(e.positions.value)},e.normals&&(t.normals=e.normals),e.texCoords&&(t.texCoords=e.texCoords),e.colors&&(t.colors=e.colors),e.uvRegions&&(t.uvRegions=e.uvRegions),t}lA.defaultProps=aA,lA.layerName="Tile3DLayer";class uA extends o.Marker{data;constructor(e){super(e)}setData(e){this.data=e}getData(){return this.data}}var hA=6371008.8,dA={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:39.37*hA,kilometers:6371.0088,kilometres:6371.0088,meters:hA,metres:hA,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:hA/1852,radians:1,yards:6967335.223679999};function pA(e){return 180*(e%(2*Math.PI))/Math.PI}function fA(e){return e%360*Math.PI/180}function mA(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function gA(e,t,i,n={}){const r=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}(e),s=fA(r[0]),o=fA(r[1]),a=fA(i),l=function(e,t="kilometers"){const i=dA[t];if(!i)throw new Error(t+" units is invalid");return e/i}(t,n.units),c=Math.asin(Math.sin(o)*Math.cos(l)+Math.cos(o)*Math.sin(l)*Math.cos(a));return function(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!mA(e[0])||!mA(e[1]))throw new Error("coordinates must contain numbers");return function(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}({type:"Point",coordinates:e},t,i)}([pA(s+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(o),Math.cos(l)-Math.sin(o)*Math.sin(c))),pA(c)],n.properties)}function _A(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function yA(e,t,i){if(null!==e)for(var n,r,s,o,a,l,c,u,h=0,d=0,p=e.type,f="FeatureCollection"===p,m="Feature"===p,g=f?e.features.length:1,_=0;_<g;_++){a=(u=!!(c=f?e.features[_].geometry:m?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<a;y++){var v=0,x=0;if(null!==(o=u?c.geometries[y]:c)){l=o.coordinates;var b=o.type;switch(h="Polygon"===b||"MultiPolygon"===b?1:0,b){case null:break;case"Point":if(!1===t(l,d,_,v,x))return!1;d++,v++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===t(l[n],d,_,v,x))return!1;d++,"MultiPoint"===b&&v++}"LineString"===b&&v++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-h;r++){if(!1===t(l[n][r],d,_,v,x))return!1;d++}"MultiLineString"===b&&v++,"Polygon"===b&&x++}"Polygon"===b&&v++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(x=0,r=0;r<l[n].length;r++){for(s=0;s<l[n][r].length-h;s++){if(!1===t(l[n][r][s],d,_,v,x))return!1;d++}x++}v++}break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===yA(o.geometries[n],t))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function vA(e,t={}){let i=0,n=0,r=0;return yA(e,function(e){i+=e[0],n+=e[1],r++}),function(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!_A(e[0])||!_A(e[1]))throw new Error("coordinates must contain numbers");return function(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}({type:"Point",coordinates:e},t,i)}([i/r,n/r],t.properties)}function xA(e,t,i={}){const n=i.steps||64,r=i.properties?i.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},s=[];for(let o=0;o<n;o++)s.push(gA(e,t,-360*o/n,i).geometry.coordinates);return s.push(s[0]),function(e,t,i={}){for(const n of e){if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(n[n.length-1].length!==n[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<n[n.length-1].length;e++)if(n[n.length-1][e]!==n[0][e])throw new Error("First and last Position are not equivalent.")}return function(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}({type:"Polygon",coordinates:e},t,i)}([s],r)}function bA(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return function(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}({type:"LineString",coordinates:e},t,i)}function wA(e){let t=e%360;return t<0&&(t+=360),t}function EA(e,t,i){if(null!==e)for(var n,r,s,o,a,l,c,u,h=0,d=0,p=e.type,f="FeatureCollection"===p,m="Feature"===p,g=f?e.features.length:1,_=0;_<g;_++){a=(u=!!(c=f?e.features[_].geometry:m?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<a;y++){var v=0,x=0;if(null!==(o=u?c.geometries[y]:c)){l=o.coordinates;var b=o.type;switch(h=0,b){case null:break;case"Point":if(!1===t(l,d,_,v,x))return!1;d++,v++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===t(l[n],d,_,v,x))return!1;d++,"MultiPoint"===b&&v++}"LineString"===b&&v++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-h;r++){if(!1===t(l[n][r],d,_,v,x))return!1;d++}"MultiLineString"===b&&v++,"Polygon"===b&&x++}"Polygon"===b&&v++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(x=0,r=0;r<l[n].length;r++){for(s=0;s<l[n][r].length-h;s++){if(!1===t(l[n][r][s],d,_,v,x))return!1;d++}x++}v++}break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===EA(o.geometries[n],t))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function TA(e,t,i,n,r={}){if(null===(s=r=r||{})||"object"!=typeof s||Array.isArray(s))throw new Error("options is invalid");var s;const o=r.properties;if(!e)throw new Error("center is required");if(null==i)throw new Error("bearing1 is required");if(null==n)throw new Error("bearing2 is required");if(!t)throw new Error("radius is required");if("object"!=typeof r)throw new Error("options must be an object");if(AA(i)===AA(n))return xA(e,t,r);const a=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(e),l=function(e,t,i,n,r={}){const s=r.steps||64,o=wA(i),a=wA(n),l=Array.isArray(e)||"Feature"!==e.type?{}:e.properties;if(o===a)return bA(xA(e,t,r).geometry.coordinates[0],l);const c=o,u=o<a?a:a+360;let h=c;const d=[];let p=0;const f=(u-c)/s;for(;h<=u;)d.push(gA(e,t,h,r).geometry.coordinates),p++,h=c+p*f;return bA(d,l)}(e,t,i,n,r),c=[[a]];return EA(l,function(e){c[0].push(e)}),c[0].push(a),function(e,t,i={}){for(const n of e){if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(n[n.length-1].length!==n[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<n[n.length-1].length;e++)if(n[n.length-1][e]!==n[0][e])throw new Error("First and last Position are not equivalent.")}return function(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}({type:"Polygon",coordinates:e},t,i)}(c,o)}function AA(e){let t=e%360;return t<0&&(t+=360),t}class SA{map;sourceId=`gismap_placeholder_source_${Math.random().toString(10)}`;static symbolPointId="gismap_placeholder_symbol_point";static layerPointId="gismap_placeholder_layer_point";static layerLineId="gismap_placeholder_layer_line";static layerPolygonId="gismap_placeholder_layer_polygon";static maskLayerId="gismap_placeholder_mask_layer";constructor(e){this.map=e,this.map.addSource(this.sourceId,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}addLayer(e){this.map.addLayer({id:SA.layerPolygonId,type:"fill",source:this.sourceId,paint:{}},e?.beforeLayerFillId),this.map.addLayer({id:SA.layerLineId,type:"line",source:this.sourceId,paint:{}},e?.beforeLayerLineId),this.map.addLayer({id:SA.layerPointId,type:"circle",source:this.sourceId,paint:{}},e?.beforeLayerPointId),this.map.addLayer({id:SA.symbolPointId,type:"symbol",source:this.sourceId,paint:{}},e?.beforeLayerPointId),this.map.addLayer({id:SA.maskLayerId,type:"circle",source:this.sourceId,paint:{}},e?.beforeMaskLayerId)}}class CA{map;layerId="";layerFilter;isQuery=!1;dataExtension={};templateId=void 0;feature=void 0;constructor(e){this.map=e}addSource(e){if(!this.map.getSource(e.id)){const t=Object.assign({type:"vector",tiles:[e.url]},e);switch(t.type){case"vector":delete t?.data;break;case"geojson":delete t?.target}this.map.addSource(e.id,t)}return this}add(e,t){this.addSource(e.source);const i=e.source.id,n=Object.assign({id:e.id,source:i},e.layer);"vector"===this.map.getSource(i).type&&(n["source-layer"]||(n["source-layer"]="layer")),this.dataExtension=e.dataExt||{},this.templateId=e.templateId||this.dataExtension?.templateId||void 0;let r=t;this.map.addLayer(n,r),this.layerFilter=n.filter||void 0,this.layerId=n.id,(e.isQuery||e.query)&&(this.isQuery=!0,this.addInteraction())}remove(){this.map.getLayer(this.layerId)&&this.map.removeLayer(this.layerId),this.isQuery&&this.removeInteraction()}addInteraction(){this.map.on("click",`${this.layerId}`,e=>{if(e.features.length>0){this.feature=e.features[0];let t=e.lngLat.toArray();"Point"===this.feature.geometry.type&&(t=this.feature.geometry.coordinates),this.map.pubsub.emit("layer:click",{layerId:this.layerId,templateId:this.templateId,center:t,feature:this.feature,features:e.features})}}),this.map.on("mouseenter",`${this.layerId}`,e=>{this.map.getCanvas().style.cursor="pointer"}),this.map.on("mouseleave",`${this.layerId}`,e=>{this.map.getCanvas().style.cursor="default"})}removeInteraction(){this.map.off("click",`${this.layerId}`,e=>{}),this.map.off("mouseenter",`${this.layerId}`,e=>{}),this.map.off("mouseleave",`${this.layerId}`,e=>{})}}class IA{map;checkedParentLayers=new Map;checkedLayers=new Map;queryLayerIds=[];symbolLayerIds=[];pointLayerIds=[];lineLayerIds=[];polygonLayerIds=[];constructor(e){this.map=e}addSource(e){this.map.getSource(e.id)||this.map.addSource(e.id,e)}addLayer(e,t){const i=new CA(this.map);let n=t;switch(e.layerType){case"symbol":n=SA.symbolPointId,this.symbolLayerIds.push(e.id);break;case"point":n=SA.layerPointId,this.pointLayerIds.push(e.id);break;case"line":n=SA.layerLineId,this.lineLayerIds.push(e.id);break;case"fill":case"fill-extrusion":n=SA.layerPolygonId,this.polygonLayerIds.push(e.id)}return i.add(e,n),this.checkedLayers.set(e.id,i),i.isQuery&&this.queryLayerIds.push(e.id),this}addGroupLayer(e){const{id:t,layers:i}=e;i&&(i.forEach(e=>{e.layer=Object.assign({id:e.id,source:e.source.id||e.id},e.layer),e.source=Object.assign({id:e.id},e.source),e.source.id||(e.source.id=t),e.layer.id||(e.layer.id=t,e.layer.source=t),this.map.getLayer(e.layer.id)||this.addLayer(e)}),this.checkedParentLayers.get(t)||this.checkedParentLayers.set(t,e))}removeLayer(e){this.map.getLayer(e.layer.id)&&this.map.removeLayer(e.layer.id),this.checkedLayers.delete(e.layer.id),e.isQuery&&(this.queryLayerIds=this.queryLayerIds.filter(t=>t!==e.layer.id))}removeGroupLayer(e){const{id:t,layers:i}=e;i&&i.forEach(e=>{e.layer=Object.assign({id:e.id},e.layer),e.source=Object.assign({id:e.id},e.source),this.removeLayer(e)}),this.checkedParentLayers.delete(t)}getCheckedLayers(){return Array.from(this.checkedLayers.values())}getLayer(e){return e?this.checkedLayers.get(e):null}}class MA{map;eraserLayerId="eraser_layer";eraserDebugLayerId="eraser_debug_layer";constructor(e){this.map=e}add(e,t){this.map.addSource(this.eraserLayerId,{type:"geojson",data:e}),this.map.addLayer({id:this.eraserLayerId,source:this.eraserLayerId,type:"clip",layout:{"clip-layer-types":t,"clip-layer-scope":["basemap"]}})}remove(){this.map.removeLayer(this.eraserLayerId),this.map.removeSource(this.eraserLayerId)}showPolygon(){this.map.addLayer({id:this.eraserDebugLayerId,type:"line",source:this.eraserLayerId,paint:{"line-color":"rgba(255, 0, 0, 0.9)","line-dasharray":[0,4,3],"line-width":5}})}hidePolygon(){this.map.getLayer(this.eraserDebugLayerId)&&this.map.removeLayer(this.eraserDebugLayerId)}}class RA{map;layerId="mask_layer";constructor(e){this.map=e}add(e,t={},i){this.map.getSource(this.layerId)||this.map.addSource(this.layerId,{type:"geojson",data:e}),i||(i=SA.maskLayerId);const n=Object.assign({id:this.layerId,source:this.layerId,type:"fill",paint:{"fill-color":"#000000","fill-opacity":.7}},t);return this.map.getLayer(this.layerId)||this.map.addLayer(n,i),this}addLine(e,t={}){this.map.getSource(this.layerId)||this.map.addSource(this.layerId,{type:"geojson",data:e});const i=Object.assign({id:`${this.layerId}_line`,source:this.layerId,type:"line",paint:{"line-color":"#ff0000","line-width":2}},t);this.map.addLayer(i,this.layerId)}remove(){this.map.removeLayer(this.layerId),this.map.removeLayer(`${this.layerId}_line`),this.map.removeSource(this.layerId)}}class PA{map;popup;constructor(e){this.map=e,this.popup=new o.Popup({closeOnClick:!1,closeOnMove:!1,className:"gismap-popup",anchor:"bottom"})}show({position:e,html:t,offset:i=[0,-10],flyTo:n=!1}){t&&this.popup.setHTML(t),i&&this.popup.setOffset(i),this.popup.setLngLat(e),this.popup.addTo(this.map),n&&this.map.flyTo({center:e})}close(){this.popup.remove()}}class BA{map;tdtImgId="tdt-img";tdtVecId="tdt-vec";tdtCiaId="tdt-cia";tdtLayer=new Map;token="6c8a0fffe8f584f8310306723f5bc776";constructor(e,t){this.map=e,this.token=t||this.token,this.tdtLayer.set(this.tdtImgId,{type:"raster",tiles:[`https://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t1.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t2.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t3.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t4.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t5.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t6.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t7.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${this.token}`],tileSize:512,buffer:128,tolerance:0,maxzoom:17,scheme:"xyz",roundZoom:!0,crs:"EPSG:4326"}),this.tdtLayer.set(this.tdtCiaId,{type:"raster",tiles:[`https://t0.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t1.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t2.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t3.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t4.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t5.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t6.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`,`https://t7.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${this.token}`],tileSize:256,maxzoom:17,crs:"EPSG:4326"}),this.tdtLayer.set(this.tdtVecId,{type:"raster",tiles:[`http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t1.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t2.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t3.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t4.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t5.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t6.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`,`http://t7.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${this.token}`],tileSize:256,maxzoom:18,crs:"EPSG:4326"})}addImgLayer(e){let t=this.map.getSource(this.tdtImgId);t||(t=this.tdtLayer.get(this.tdtImgId),this.map.addSource(this.tdtImgId,t)),e&&this.map.getLayer(e)?this.map.addLayer({id:this.tdtImgId,type:"raster",source:this.tdtImgId},e):this.map.addLayer({id:this.tdtImgId,type:"raster",source:this.tdtImgId})}removeImgLayer(){this.map.getLayer(this.tdtImgId)&&this.map.removeLayer(this.tdtImgId)}addVecLayer(e){let t=this.map.getSource(this.tdtVecId);t||(t=this.tdtLayer.get(this.tdtVecId),this.map.addSource(this.tdtVecId,t)),e&&this.map.getLayer(e)?this.map.addLayer({id:this.tdtVecId,type:"raster",source:this.tdtVecId},e):this.map.addLayer({id:this.tdtVecId,type:"raster",source:this.tdtVecId})}removeVecLayer(){this.map.getLayer(this.tdtVecId)&&this.map.removeLayer(this.tdtVecId)}addCiaLayer(e){let t=this.map.getSource(this.tdtCiaId);t||(t=this.tdtLayer.get(this.tdtCiaId),this.map.addSource(this.tdtCiaId,t)),e&&this.map.getLayer(e)?this.map.addLayer({id:this.tdtCiaId,type:"raster",source:this.tdtCiaId},e):this.map.addLayer({id:this.tdtCiaId,type:"raster",source:this.tdtCiaId})}removeCiaLayer(){this.map.getLayer(this.tdtCiaId)&&this.map.removeLayer(this.tdtCiaId)}clear(){this.removeImgLayer(),this.removeVecLayer(),this.removeCiaLayer()}}class LA{map;constructor(e){this.map=e}addSource(e){if(e?.tiles&&!this.map.getSource("raster-dem"))return this.map.addSource("raster-dem",{type:"raster-dem",minzoom:6,maxzoom:14,tileSize:256,...e}),this}add(e={source:{},layer:{}}){return this.map.getSource("raster-dem")||this.addSource(e.source),this.map.setTerrain({source:"raster-dem",exaggeration:1,...e.layer}),this}remove(){return this.map.setTerrain(null),this}addHillshade(){if(this.map.getSource("raster-dem"))return this.map.addLayer({id:"hillshade",type:"hillshade",source:"raster-dem",paint:{"hillshade-exaggeration":.5,"hillshade-highlight-color":"#FFFFFF","hillshade-shadow-color":"#025505"}}),this}}class OA{map;constructor(e){this.map=e}addSource(e){if(!this.map.getSource(e.id)){const t=Object.assign({type:"geojson",tiles:[e.url],tileSize:256},e);this.map.addSource(e.id,t)}return this}addLayer(e){if(!this.map.getLayer(e.id)){const t=Object.assign({id:e.id,source:e.source},e);this.map.addLayer(t)}return this}removeSource(e){return this.map.getSource(e)&&this.map.removeSource(e),this}removeLayer(e){return this.map.getLayer(e)&&this.map.removeLayer(e),this}}function kA(e,t){if(null==e||""===e)return"";return e.replace(/\{(?:p\.)?([^}]+)\}|\$\{(?:p\.)?([^}]+)\}/g,(e,i,n)=>{return r=t,(i||n).split(".").reduce((e,t)=>{const i=(e||{})[t];return void 0!==i?String(i):""},r);var r})}function DA(e,t,i="children"){function n(e){"function"==typeof t&&t(e),Array.isArray(e[i])&&e[i].forEach(e=>{n(e)})}Array.isArray(e)&&e.forEach(e=>{n(e)})}function FA(e=10){if(e<=0)throw new Error("随机数长度必须大于0");let t="";t+=Math.floor(9*Math.random())+1;for(let i=1;i<e;i++)t+=Math.floor(10*Math.random());return t}class NA{templates=new Map;constructor(){}add(e,t){this.templates.set(e,t)}get(e){return this.templates.get(e)}renderHtml(e,t){const i=this.templates.get(e);if(i){return this._unionFromTemplate(i,t)}}_unionFromTemplate(e,t){let i="";const n=[],r=[],{width:s,labelWidth:o,header:a,body:l,footer:c}=e,u=[];return u.push(`<div class="gismap-popup-box" style="width: ${s||260}px;">`),a&&(i=kA(a,t)),l&&l.length>0&&(n.push('<div class="gismap-row gismap-popup-body no-scrollbar">'),l.forEach(e=>{n.push(`<div class="gismap-col gismap-col-${e.style.span||12}">`),n.push(`<div class="popup-label" style="width: ${o||80}px;">${e.fieldLabel}:</div>`);let i=t[e.fieldName]||"";switch(n.push('<div class="popup-value">'),e.fieldType){case"date":case"dateTime":i&&(i=kA(e.format||"{0:yyyy-MM-dd HH:mm:ss}",[i]));break;case"number":i&&(i=kA(e.format||"{0:N2}",[i]));break;default:n.push(`${i}`)}""!=i&&e.unit&&n.push(`<span class="popup-unit">${e.unit}</span>`),n.push("</div>"),n.push("</div>")}),n.push("</div>")),c&&c.length>0&&(r.push('<div class="gismap-popup-footer">'),c.forEach(e=>{let i;if("click"===e.type)i=`<span class="footer-btn" onclick="eval(${e.event})"><span class="s"></span> ${e.label}</span>`;i&&(i=kA(i||"",t)),r.push(i||"")}),r.push("</div>")),u.push(i),u.push(...n),u.push(...r),u.push("</div>"),u.join("")}remove(e){this.templates.delete(e)}}class zA{map;marker;constructor(e){this.map=e}show({position:e,html:t,markerIcon:i="marker",offset:n=[0,-30],iconName:r,flyTo:s=!1}){this.marker&&this.marker.remove();const a=document.createElement("div");a.className="marker-container";const l=document.createElement("div");l.className=`${i}`,r&&(l.innerHTML=`<img src='${r}' class="marker-icon" />`),a.appendChild(l),this.marker=new o.Marker({element:a,anchor:"bottom"}).setLngLat(e).addTo(this.map),t&&this.marker.setPopup(new o.Popup({closeOnClick:!1,closeOnMove:!1,className:"gismap-popup",anchor:"bottom",offset:n}).setHTML(t)).togglePopup(),s&&this.map.flyTo({center:e})}close(){this.marker?.remove()}}class UA{map;constructor(e){this.map=e}load(e){let t=[];for(let i of e)t.push(this._loadImage(i));return new Promise((e,i)=>{Promise.all(t).then(t=>{e(!0)}).catch(e=>{i(e)})})}_loadImage(e){return new Promise((t,i)=>{this.map.loadImage(e.url,(n,r)=>{if(n)throw i(!1),n;this.map.hasImage(e.name)?this.map.updateImage(e.name,r):this.map.addImage(e.name,r),t(!0)})})}}class VA{map;options;constructor(e){this.map=e,this.options={range:[-1,10],"horizon-blend":.3,color:"white","high-color":"#add8e6","space-color":"#d8f2ff","star-intensity":0}}setFog(e={}){this.map.setFog({...this.options,...e})}}class GA{map;markers=new Map;selectMarker;popup;callback;constructor(e){return this.map=e,this.popup=new s.Popup({offset:[0,-32],closeButton:!1}),this}addFunction(e){this.callback=e}add(e){const t={anchor:"bottom",...e};let i=[0,0];switch(e.geometry.type.toLowerCase()){case"point":i=e.geometry.coordinates;break;case"linestring":case"polygon":i=vA(e.geometry.coordinates).geometry.coordinates}const n=document.createElement("div");n.className="gismap-marker marker_r",n.innerHTML=`<span>${e.index}</span>`,n.id=e.uuid,n.onclick=t=>{this.selectMarker&&this.selectMarker.toggleClassName("active");const i=this.markers.get(t.currentTarget.id);i&&(i.toggleClassName("active"),this.selectMarker=i,this.addPopup()),this.callback&&this.callback({uuid:e.uuid,marker:i})},t.element=n;const r=new uA(t);r.setData({templateId:e.templateId,data:e.properties}),r.setLngLat(i),r.addTo(this.map),this.markers.set(e.uuid,r)}addGroup(e){e.data.forEach(e=>{this.add(e)})}flyTo(e){this.selectMarker&&this.selectMarker.toggleClassName("active");const t=this.markers.get(e);t&&(this.map.flyTo({center:t.getLngLat(),zoom:16,essential:!0}),t.toggleClassName("active"),this.selectMarker=t,this.addPopup())}addPopup(){const{templateId:e,data:t}=this.selectMarker?.getData();if(!e)return;const i=this.map?.manager?.templateManager?.renderHtml(e,t);i&&this.map.manager?.popupManager.show({position:this.selectMarker?.getLngLat(),offset:[0,-32],html:i})}clear(){this.markers.forEach(e=>{e.remove()}),this.markers.clear(),this.selectMarker=void 0,this.popup&&this.popup.remove()}}class jA{map;layerManager;maskManager;tdtManager;eraserManager;popupManager;markerManager;terrainManager;vectorManager;templateManager;placeholderManager;iconManager;fogManager;quickSearchManager;constructor(e,t){this.map=e,this.layerManager=new IA(this.map),this.maskManager=new RA(this.map),this.tdtManager=new BA(this.map,t),this.eraserManager=new MA(this.map),this.popupManager=new PA(this.map),this.markerManager=new zA(this.map),this.terrainManager=new LA(this.map),this.vectorManager=new OA(this.map),this.templateManager=new NA,this.placeholderManager=new SA(this.map),this.iconManager=new UA(this.map),this.fogManager=new VA(this.map),this.quickSearchManager=new GA(this.map)}}const HA={key:0,class:"gismap-control"},WA={class:"widget top-left"},$A={class:"widget top-right"},qA={class:"widget bottom-left"},XA={class:"widget bottom-right"},ZA=t.defineComponent({name:"MapView",props:{accessToken:{type:String,default:()=>""},tdtToken:{type:String,default:()=>""},options:{type:Object,default:()=>({})}},emits:["load"],setup(e,{emit:i}){const n=i,r=e,s=t.ref(!1),a=t.ref();return t.onMounted(()=>{r.accessToken&&(o.accessToken=r.accessToken);const e={container:a.value,center:[120.65851,29.5714],minZoom:8,maxZoom:20,zoom:15,pitch:0,bearing:0,maxPitch:65,attributionControl:!1,spriteFormat:"auto",...r.options};e.style={version:8,sources:{},layers:[],...e.style||{}};const i=new l(e);i.on("load",async()=>{i.manager=new jA(i,r.tdtToken),await i.manager.iconManager.load(r.options?.icons||[]),i.manager.placeholderManager.addLayer(),s.value=!0,n("load",i)}),t.provide("map",i)}),(e,i)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"mapContainer",ref:a,class:"gismap-container"},null,512),s.value?(t.openBlock(),t.createElementBlock("div",HA,[t.createElementVNode("div",WA,[t.renderSlot(e.$slots,"top-left")]),t.createElementVNode("div",$A,[t.renderSlot(e.$slots,"top-right")]),t.createElementVNode("div",qA,[t.renderSlot(e.$slots,"bottom-left")]),t.createElementVNode("div",XA,[t.renderSlot(e.$slots,"bottom-right")]),t.renderSlot(e.$slots,"default")])):t.createCommentVNode("",!0)],64))}}),KA="el",JA=(e,t,i,n,r)=>{let s=`${e}-${t}`;return i&&(s+=`-${i}`),n&&(s+=`__${n}`),r&&(s+=`--${r}`),s},YA=Symbol("namespaceContextKey"),QA=e=>{const i=t.getCurrentInstance()?t.inject(YA,t.ref(KA)):t.ref(KA);return t.computed(()=>t.unref(i)||KA)},eS=(e,t)=>{const i=QA();return{namespace:i,b:(t="")=>JA(i.value,e,t,"",""),e:t=>t?JA(i.value,e,"",t,""):"",m:t=>t?JA(i.value,e,"","",t):"",be:(t,n)=>t&&n?JA(i.value,e,t,n,""):"",em:(t,n)=>t&&n?JA(i.value,e,"",t,n):"",bm:(t,n)=>t&&n?JA(i.value,e,t,"",n):"",bem:(t,n,r)=>t&&n&&r?JA(i.value,e,t,n,r):"",is:(e,...t)=>{const i=!(t.length>=1)||t[0];return e&&i?`is-${e}`:""},cssVar:e=>{const t={};for(const n in e)e[n]&&(t[`--${i.value}-${n}`]=e[n]);return t},cssVarName:e=>`--${i.value}-${e}`,cssVarBlock:t=>{const n={};for(const r in t)t[r]&&(n[`--${i.value}-${e}-${r}`]=t[r]);return n},cssVarBlockName:t=>`--${i.value}-${e}-${t}`}};
29
29
  /**
30
30
  * @vue/shared v3.5.21
31
31
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gis_victory/gismap",
3
3
  "private": false,
4
- "version": "1.0.39",
4
+ "version": "1.0.41",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",