@mappedin/mappedin-js 6.15.0 → 6.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_LICENSES.txt +24 -30
- package/lib/esm/{GLTFExporter-VOK2I2UD.js → GLTFExporter-WJIVKLX5.js} +1 -1
- package/lib/esm/{GLTFLoader-G2EMUIJ7.js → GLTFLoader-UVI44S2F.js} +1 -1
- package/lib/esm/chunk-DWA5ATYZ.js +1 -0
- package/lib/esm/chunk-I6I3EXJN.js +1 -0
- package/lib/esm/chunk-IGHVNMJ3.js +1 -0
- package/lib/esm/chunk-QV35JDEX.js +1 -0
- package/lib/esm/{chunk-GJMPS3WH.js → chunk-QYWRASNF.js} +1 -1
- package/lib/esm/{chunk-Y43IJGBK.js → chunk-VBXAQAZN.js} +1 -1
- package/lib/esm/index.css +1 -1
- package/lib/esm/index.d.ts +19699 -20060
- package/lib/esm/index.js +1 -1
- package/lib/esm/inspector-47NR3USD.js +1 -0
- package/lib/esm/inspector-YWC6NP6D.css +1 -0
- package/lib/esm/internal-HBF7XZ6U.js +1 -0
- package/lib/esm/internal-QC6SWNN2.css +1 -0
- package/lib/esm/{roboto-regular-ERMR6E6W.js → roboto-regular-MRBWMLOE.js} +1 -1
- package/lib/esm/src-GA2Z4OON.css +1 -0
- package/lib/esm/src-QBZJI5BR.js +1 -0
- package/lib/esm/{text3d-XNHJVYRH.js → text3d-I6QPYM5K.js} +1 -1
- package/lib/esm/workers/collision-worker.csp.js +1 -1
- package/lib/index.css +1 -1
- package/package.json +1 -1
- package/lib/esm/chunk-24F4CYUD.js +0 -1
- package/lib/esm/chunk-5W2UDR4H.js +0 -1
- package/lib/esm/chunk-A2VEHCA4.js +0 -1
- package/lib/esm/inspector-3ULGCXLT.js +0 -1
- package/lib/esm/inspector-SKFFAA23.css +0 -1
- package/lib/esm/internal-BQXLERG7.css +0 -1
- package/lib/esm/internal-TE3R347U.js +0 -1
- package/lib/esm/text3d-M57DIX3E.css +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Vo}from"./chunk-Y43IJGBK.js";import{$ as Ct,C as Pu,D as Md,Ka as Ed,Ma as kd,Na as Dd,O as Ni,Oa as Ld,Ta as zd,V as Tu,W as Oe,X as la,Z as Vi,_ as Su,a as F,aa as ut,b as Y,ca as Lr,d as bu,e as Pd,f as wu,ga as sr,ha as Cd,i as sa,nb as No,r as Td,sa as Id,u as Sd,ya as Ad}from"./chunk-GJMPS3WH.js";import{a as He,b as Ht,d as vd,f as bd,h as wd,i as S,j as Ie,k as vt,l as tt}from"./chunk-5W2UDR4H.js";var Iv=bd((bo,Jn)=>{F();var YR=200,uv="__lodash_hash_undefined__",ZR=800,WR=16,hv=9007199254740991,cv="[object Arguments]",HR="[object Array]",KR="[object AsyncFunction]",JR="[object Boolean]",QR="[object Date]",e5="[object Error]",pv="[object Function]",t5="[object GeneratorFunction]",i5="[object Map]",r5="[object Number]",n5="[object Null]",dv="[object Object]",a5="[object Proxy]",o5="[object RegExp]",s5="[object Set]",l5="[object String]",u5="[object Undefined]",h5="[object WeakMap]",c5="[object ArrayBuffer]",p5="[object DataView]",d5="[object Float32Array]",f5="[object Float64Array]",m5="[object Int8Array]",y5="[object Int16Array]",g5="[object Int32Array]",_5="[object Uint8Array]",x5="[object Uint8ClampedArray]",v5="[object Uint16Array]",b5="[object Uint32Array]",w5=/[\\^$.*+?()[\]{}|]/g,P5=/^\[object .+?Constructor\]$/,T5=/^(?:0|[1-9]\d*)$/,je={};je[d5]=je[f5]=je[m5]=je[y5]=je[g5]=je[_5]=je[x5]=je[v5]=je[b5]=!0;je[cv]=je[HR]=je[c5]=je[JR]=je[p5]=je[QR]=je[e5]=je[pv]=je[i5]=je[r5]=je[dv]=je[o5]=je[s5]=je[l5]=je[h5]=!1;var fv=typeof global=="object"&&global&&global.Object===Object&&global,S5=typeof self=="object"&&self&&self.Object===Object&&self,To=fv||S5||Function("return this")(),mv=typeof bo=="object"&&bo&&!bo.nodeType&&bo,wo=mv&&typeof Jn=="object"&&Jn&&!Jn.nodeType&&Jn,yv=wo&&wo.exports===mv,Np=yv&&fv.process,ev=(function(){try{var e=wo&&wo.require&&wo.require("util").types;return e||Np&&Np.binding&&Np.binding("util")}catch(t){}})(),tv=ev&&ev.isTypedArray;function M5(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}function C5(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}function I5(e){return function(t){return e(t)}}function A5(e,t){return e==null?void 0:e[t]}function E5(e,t){return function(i){return e(t(i))}}var k5=Array.prototype,D5=Function.prototype,Yl=Object.prototype,Vp=To["__core-js_shared__"],Zl=D5.toString,tr=Yl.hasOwnProperty,iv=(function(){var e=/[^.]+$/.exec(Vp&&Vp.keys&&Vp.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})(),gv=Yl.toString,L5=Zl.call(Object),z5=RegExp("^"+Zl.call(tr).replace(w5,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$l=yv?To.Buffer:void 0,rv=To.Symbol,nv=To.Uint8Array,av=$l?$l.allocUnsafe:void 0,_v=E5(Object.getPrototypeOf,Object),ov=Object.create,F5=Yl.propertyIsEnumerable,B5=k5.splice,nn=rv?rv.toStringTag:void 0,ql=(function(){try{var e=qp(Object,"defineProperty");return e({},"",{}),e}catch(t){}})(),R5=$l?$l.isBuffer:void 0,sv=Math.max,O5=Date.now,xv=qp(To,"Map"),Po=qp(Object,"create"),N5=(function(){function e(){}return function(t){if(!on(t))return{};if(ov)return ov(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}})();function an(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function V5(){this.__data__=Po?Po(null):{},this.size=0}function j5(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function G5(e){var t=this.__data__;if(Po){var i=t[e];return i===uv?void 0:i}return tr.call(t,e)?t[e]:void 0}function U5(e){var t=this.__data__;return Po?t[e]!==void 0:tr.call(t,e)}function X5(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Po&&t===void 0?uv:t,this}an.prototype.clear=V5;an.prototype.delete=j5;an.prototype.get=G5;an.prototype.has=U5;an.prototype.set=X5;function rr(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function $5(){this.__data__=[],this.size=0}function q5(e){var t=this.__data__,i=Wl(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():B5.call(t,i,1),--this.size,!0}function Y5(e){var t=this.__data__,i=Wl(t,e);return i<0?void 0:t[i][1]}function Z5(e){return Wl(this.__data__,e)>-1}function W5(e,t){var i=this.__data__,r=Wl(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}rr.prototype.clear=$5;rr.prototype.delete=q5;rr.prototype.get=Y5;rr.prototype.has=Z5;rr.prototype.set=W5;function Qn(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function H5(){this.size=0,this.__data__={hash:new an,map:new(xv||rr),string:new an}}function K5(e){var t=Kl(this,e).delete(e);return this.size-=t?1:0,t}function J5(e){return Kl(this,e).get(e)}function Q5(e){return Kl(this,e).has(e)}function eO(e,t){var i=Kl(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}Qn.prototype.clear=H5;Qn.prototype.delete=K5;Qn.prototype.get=J5;Qn.prototype.has=Q5;Qn.prototype.set=eO;function ea(e){var t=this.__data__=new rr(e);this.size=t.size}function tO(){this.__data__=new rr,this.size=0}function iO(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}function rO(e){return this.__data__.get(e)}function nO(e){return this.__data__.has(e)}function aO(e,t){var i=this.__data__;if(i instanceof rr){var r=i.__data__;if(!xv||r.length<YR-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new Qn(r)}return i.set(e,t),this.size=i.size,this}ea.prototype.clear=tO;ea.prototype.delete=iO;ea.prototype.get=rO;ea.prototype.has=nO;ea.prototype.set=aO;function oO(e,t){var i=Xp(e),r=!i&&Up(e),n=!i&&!r&&Pv(e),a=!i&&!r&&!n&&Sv(e),o=i||r||n||a,s=o?C5(e.length,String):[],l=s.length;for(var u in e)(t||tr.call(e,u))&&!(o&&(u=="length"||n&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||bv(u,l)))&&s.push(u);return s}function jp(e,t,i){(i!==void 0&&!Jl(e[t],i)||i===void 0&&!(t in e))&&$p(e,t,i)}function sO(e,t,i){var r=e[t];(!(tr.call(e,t)&&Jl(r,i))||i===void 0&&!(t in e))&&$p(e,t,i)}function Wl(e,t){for(var i=e.length;i--;)if(Jl(e[i][0],t))return i;return-1}function $p(e,t,i){t=="__proto__"&&ql?ql(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}var lO=bO();function Hl(e){return e==null?e===void 0?u5:n5:nn&&nn in Object(e)?wO(e):IO(e)}function lv(e){return So(e)&&Hl(e)==cv}function uO(e){if(!on(e)||MO(e))return!1;var t=Zp(e)?z5:P5;return t.test(DO(e))}function hO(e){return So(e)&&Tv(e.length)&&!!je[Hl(e)]}function cO(e){if(!on(e))return CO(e);var t=wv(e),i=[];for(var r in e)r=="constructor"&&(t||!tr.call(e,r))||i.push(r);return i}function vv(e,t,i,r,n){e!==t&&lO(t,function(a,o){if(n||(n=new ea),on(a))pO(e,t,o,i,vv,r,n);else{var s=r?r(Gp(e,o),a,o+"",e,t,n):void 0;s===void 0&&(s=a),jp(e,o,s)}},Mv)}function pO(e,t,i,r,n,a,o){var s=Gp(e,i),l=Gp(t,i),u=o.get(l);if(u){jp(e,i,u);return}var h=a?a(s,l,i+"",e,t,o):void 0,c=h===void 0;if(c){var p=Xp(l),d=!p&&Pv(l),f=!p&&!d&&Sv(l);h=l,p||d||f?Xp(s)?h=s:LO(s)?h=_O(s):d?(c=!1,h=mO(l,!0)):f?(c=!1,h=gO(l,!0)):h=[]:zO(l)||Up(l)?(h=s,Up(s)?h=FO(s):(!on(s)||Zp(s))&&(h=PO(l))):c=!1}c&&(o.set(l,h),n(h,l,r,a,o),o.delete(l)),jp(e,i,h)}function dO(e,t){return EO(AO(e,t,Cv),e+"")}var fO=ql?function(e,t){return ql(e,"toString",{configurable:!0,enumerable:!1,value:RO(t),writable:!0})}:Cv;function mO(e,t){if(t)return e.slice();var i=e.length,r=av?av(i):new e.constructor(i);return e.copy(r),r}function yO(e){var t=new e.constructor(e.byteLength);return new nv(t).set(new nv(e)),t}function gO(e,t){var i=t?yO(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}function _O(e,t){var i=-1,r=e.length;for(t||(t=Array(r));++i<r;)t[i]=e[i];return t}function xO(e,t,i,r){var n=!i;i||(i={});for(var a=-1,o=t.length;++a<o;){var s=t[a],l=r?r(i[s],e[s],s,i,e):void 0;l===void 0&&(l=e[s]),n?$p(i,s,l):sO(i,s,l)}return i}function vO(e){return dO(function(t,i){var r=-1,n=i.length,a=n>1?i[n-1]:void 0,o=n>2?i[2]:void 0;for(a=e.length>3&&typeof a=="function"?(n--,a):void 0,o&&TO(i[0],i[1],o)&&(a=n<3?void 0:a,n=1),t=Object(t);++r<n;){var s=i[r];s&&e(t,s,r,a)}return t})}function bO(e){return function(t,i,r){for(var n=-1,a=Object(t),o=r(t),s=o.length;s--;){var l=o[e?s:++n];if(i(a[l],l,a)===!1)break}return t}}function Kl(e,t){var i=e.__data__;return SO(t)?i[typeof t=="string"?"string":"hash"]:i.map}function qp(e,t){var i=A5(e,t);return uO(i)?i:void 0}function wO(e){var t=tr.call(e,nn),i=e[nn];try{e[nn]=void 0;var r=!0}catch(a){}var n=gv.call(e);return r&&(t?e[nn]=i:delete e[nn]),n}function PO(e){return typeof e.constructor=="function"&&!wv(e)?N5(_v(e)):{}}function bv(e,t){var i=typeof e;return t=t==null?hv:t,!!t&&(i=="number"||i!="symbol"&&T5.test(e))&&e>-1&&e%1==0&&e<t}function TO(e,t,i){if(!on(i))return!1;var r=typeof t;return(r=="number"?Yp(i)&&bv(t,i.length):r=="string"&&t in i)?Jl(i[t],e):!1}function SO(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function MO(e){return!!iv&&iv in e}function wv(e){var t=e&&e.constructor,i=typeof t=="function"&&t.prototype||Yl;return e===i}function CO(e){var t=[];if(e!=null)for(var i in Object(e))t.push(i);return t}function IO(e){return gv.call(e)}function AO(e,t,i){return t=sv(t===void 0?e.length-1:t,0),function(){for(var r=arguments,n=-1,a=sv(r.length-t,0),o=Array(a);++n<a;)o[n]=r[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=r[n];return s[t]=i(o),M5(e,this,s)}}function Gp(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var EO=kO(fO);function kO(e){var t=0,i=0;return function(){var r=O5(),n=WR-(r-i);if(i=r,n>0){if(++t>=ZR)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function DO(e){if(e!=null){try{return Zl.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Jl(e,t){return e===t||e!==e&&t!==t}var Up=lv((function(){return arguments})())?lv:function(e){return So(e)&&tr.call(e,"callee")&&!F5.call(e,"callee")},Xp=Array.isArray;function Yp(e){return e!=null&&Tv(e.length)&&!Zp(e)}function LO(e){return So(e)&&Yp(e)}var Pv=R5||OO;function Zp(e){if(!on(e))return!1;var t=Hl(e);return t==pv||t==t5||t==KR||t==a5}function Tv(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=hv}function on(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function So(e){return e!=null&&typeof e=="object"}function zO(e){if(!So(e)||Hl(e)!=dv)return!1;var t=_v(e);if(t===null)return!0;var i=tr.call(t,"constructor")&&t.constructor;return typeof i=="function"&&i instanceof i&&Zl.call(i)==L5}var Sv=tv?I5(tv):hO;function FO(e){return xO(e,Mv(e))}function Mv(e){return Yp(e)?oO(e,!0):cO(e)}var BO=vO(function(e,t,i){vv(e,t,i)});function RO(e){return function(){return e}}function Cv(e){return e}function OO(){return!1}Jn.exports=BO});var i1=bd((jY,Do)=>{"use strict";F();var o4=!1,ln=!1,Wv=!0,Hv=!1,m={},Kv=!1;typeof Do<"u"&&Do.exports?(Do.exports=m,Kv=!0):typeof document<"u"?window.ClipperLib=m:self.ClipperLib=m;var uu;Kv?(ct="chrome",uu="Netscape"):(ct=navigator.userAgent.toString().toLowerCase(),uu=navigator.appName);var ct,_e={};ct.indexOf("chrome")!=-1&&ct.indexOf("chromium")==-1?_e.chrome=1:_e.chrome=0;ct.indexOf("chromium")!=-1?_e.chromium=1:_e.chromium=0;ct.indexOf("safari")!=-1&&ct.indexOf("chrome")==-1&&ct.indexOf("chromium")==-1?_e.safari=1:_e.safari=0;ct.indexOf("firefox")!=-1?_e.firefox=1:_e.firefox=0;ct.indexOf("firefox/17")!=-1?_e.firefox17=1:_e.firefox17=0;ct.indexOf("firefox/15")!=-1?_e.firefox15=1:_e.firefox15=0;ct.indexOf("firefox/3")!=-1?_e.firefox3=1:_e.firefox3=0;ct.indexOf("opera")!=-1?_e.opera=1:_e.opera=0;ct.indexOf("msie 10")!=-1?_e.msie10=1:_e.msie10=0;ct.indexOf("msie 9")!=-1?_e.msie9=1:_e.msie9=0;ct.indexOf("msie 8")!=-1?_e.msie8=1:_e.msie8=0;ct.indexOf("msie 7")!=-1?_e.msie7=1:_e.msie7=0;ct.indexOf("msie ")!=-1?_e.msie=1:_e.msie=0;m.biginteger_used=null;var Cr,s4=0xdeadbeefcafe,Yv=(s4&16777215)==15715070;function j(e,t,i){m.biginteger_used=1,e!=null&&(typeof e=="number"&&typeof t>"u"?this.fromInt(e):typeof e=="number"?this.fromNumber(e,t,i):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function we(){return new j(null)}function l4(e,t,i,r,n,a){for(;--a>=0;){var o=t*this[e++]+i[r]+n;n=Math.floor(o/67108864),i[r++]=o&67108863}return n}function u4(e,t,i,r,n,a){for(var o=t&32767,s=t>>15;--a>=0;){var l=this[e]&32767,u=this[e++]>>15,h=s*l+u*o;l=o*l+((h&32767)<<15)+i[r]+(n&1073741823),n=(l>>>30)+(h>>>15)+s*u+(n>>>30),i[r++]=l&1073741823}return n}function h4(e,t,i,r,n,a){for(var o=t&16383,s=t>>14;--a>=0;){var l=this[e]&16383,u=this[e++]>>14,h=s*l+u*o;l=o*l+((h&16383)<<14)+i[r]+n,n=(l>>28)+(h>>14)+s*u,i[r++]=l&268435455}return n}Yv&&uu=="Microsoft Internet Explorer"?(j.prototype.am=u4,Cr=30):Yv&&uu!="Netscape"?(j.prototype.am=l4,Cr=26):(j.prototype.am=h4,Cr=28);j.prototype.DB=Cr;j.prototype.DM=(1<<Cr)-1;j.prototype.DV=1<<Cr;var ad=52;j.prototype.FV=Math.pow(2,ad);j.prototype.F1=ad-Cr;j.prototype.F2=2*Cr-ad;var c4="0123456789abcdefghijklmnopqrstuvwxyz",cu=new Array,aa,ni;aa=48;for(ni=0;ni<=9;++ni)cu[aa++]=ni;aa=97;for(ni=10;ni<36;++ni)cu[aa++]=ni;aa=65;for(ni=10;ni<36;++ni)cu[aa++]=ni;function Zv(e){return c4.charAt(e)}function Jv(e,t){var i=cu[e.charCodeAt(t)];return i==null?-1:i}function p4(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function d4(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function Mr(e){var t=we();return t.fromInt(e),t}function f4(e,t){var i;if(t==16)i=4;else if(t==8)i=3;else if(t==256)i=8;else if(t==2)i=1;else if(t==32)i=5;else if(t==4)i=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,n=!1,a=0;--r>=0;){var o=i==8?e[r]&255:Jv(e,r);if(o<0){e.charAt(r)=="-"&&(n=!0);continue}n=!1,a==0?this[this.t++]=o:a+i>this.DB?(this[this.t-1]|=(o&(1<<this.DB-a)-1)<<a,this[this.t++]=o>>this.DB-a):this[this.t-1]|=o<<a,a+=i,a>=this.DB&&(a-=this.DB)}i==8&&(e[0]&128)!=0&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),n&&j.ZERO.subTo(this,this)}function m4(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function y4(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var i=(1<<t)-1,r,n=!1,a="",o=this.t,s=this.DB-o*this.DB%t;if(o-- >0)for(s<this.DB&&(r=this[o]>>s)>0&&(n=!0,a=Zv(r));o>=0;)s<t?(r=(this[o]&(1<<s)-1)<<t-s,r|=this[--o]>>(s+=this.DB-t)):(r=this[o]>>(s-=t)&i,s<=0&&(s+=this.DB,--o)),r>0&&(n=!0),n&&(a+=Zv(r));return n?a:"0"}function g4(){var e=we();return j.ZERO.subTo(this,e),e}function _4(){return this.s<0?this.negate():this}function x4(e){var t=this.s-e.s;if(t!=0)return t;var i=this.t;if(t=i-e.t,t!=0)return this.s<0?-t:t;for(;--i>=0;)if((t=this[i]-e[i])!=0)return t;return 0}function pu(e){var t=1,i;return(i=e>>>16)!=0&&(e=i,t+=16),(i=e>>8)!=0&&(e=i,t+=8),(i=e>>4)!=0&&(e=i,t+=4),(i=e>>2)!=0&&(e=i,t+=2),(i=e>>1)!=0&&(e=i,t+=1),t}function v4(){return this.t<=0?0:this.DB*(this.t-1)+pu(this[this.t-1]^this.s&this.DM)}function b4(e,t){var i;for(i=this.t-1;i>=0;--i)t[i+e]=this[i];for(i=e-1;i>=0;--i)t[i]=0;t.t=this.t+e,t.s=this.s}function w4(e,t){for(var i=e;i<this.t;++i)t[i-e]=this[i];t.t=Math.max(this.t-e,0),t.s=this.s}function P4(e,t){var i=e%this.DB,r=this.DB-i,n=(1<<r)-1,a=Math.floor(e/this.DB),o=this.s<<i&this.DM,s;for(s=this.t-1;s>=0;--s)t[s+a+1]=this[s]>>r|o,o=(this[s]&n)<<i;for(s=a-1;s>=0;--s)t[s]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()}function T4(e,t){t.s=this.s;var i=Math.floor(e/this.DB);if(i>=this.t){t.t=0;return}var r=e%this.DB,n=this.DB-r,a=(1<<r)-1;t[0]=this[i]>>r;for(var o=i+1;o<this.t;++o)t[o-i-1]|=(this[o]&a)<<n,t[o-i]=this[o]>>r;r>0&&(t[this.t-i-1]|=(this.s&a)<<n),t.t=this.t-i,t.clamp()}function S4(e,t){for(var i=0,r=0,n=Math.min(e.t,this.t);i<n;)r+=this[i]-e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r-=e[i],t[i++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[i++]=this.DV+r:r>0&&(t[i++]=r),t.t=i,t.clamp()}function M4(e,t){var i=this.abs(),r=e.abs(),n=i.t;for(t.t=n+r.t;--n>=0;)t[n]=0;for(n=0;n<r.t;++n)t[n+i.t]=i.am(0,r[n],t,n,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&j.ZERO.subTo(t,t)}function C4(e){for(var t=this.abs(),i=e.t=2*t.t;--i>=0;)e[i]=0;for(i=0;i<t.t-1;++i){var r=t.am(i,t[i],e,2*i,0,1);(e[i+t.t]+=t.am(i+1,2*t[i],e,2*i+1,r,t.t-i-1))>=t.DV&&(e[i+t.t]-=t.DV,e[i+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(i,t[i],e,2*i,0,1)),e.s=0,e.clamp()}function I4(e,t,i){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t){t!=null&&t.fromInt(0),i!=null&&this.copyTo(i);return}i==null&&(i=we());var a=we(),o=this.s,s=e.s,l=this.DB-pu(r[r.t-1]);l>0?(r.lShiftTo(l,a),n.lShiftTo(l,i)):(r.copyTo(a),n.copyTo(i));var u=a.t,h=a[u-1];if(h!=0){var c=h*(1<<this.F1)+(u>1?a[u-2]>>this.F2:0),p=this.FV/c,d=(1<<this.F1)/c,f=1<<this.F2,y=i.t,g=y-u,_=t==null?we():t;for(a.dlShiftTo(g,_),i.compareTo(_)>=0&&(i[i.t++]=1,i.subTo(_,i)),j.ONE.dlShiftTo(u,_),_.subTo(a,a);a.t<u;)a[a.t++]=0;for(;--g>=0;){var b=i[--y]==h?this.DM:Math.floor(i[y]*p+(i[y-1]+f)*d);if((i[y]+=a.am(0,b,i,g,0,u))<b)for(a.dlShiftTo(g,_),i.subTo(_,i);i[y]<--b;)i.subTo(_,i)}t!=null&&(i.drShiftTo(u,t),o!=s&&j.ZERO.subTo(t,t)),i.t=u,i.clamp(),l>0&&i.rShiftTo(l,i),o<0&&j.ZERO.subTo(i,i)}}}function A4(e){var t=we();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(j.ZERO)>0&&e.subTo(t,t),t}function un(e){this.m=e}function E4(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function k4(e){return e}function D4(e){e.divRemTo(this.m,null,e)}function L4(e,t,i){e.multiplyTo(t,i),this.reduce(i)}function z4(e,t){e.squareTo(t),this.reduce(t)}un.prototype.convert=E4;un.prototype.revert=k4;un.prototype.reduce=D4;un.prototype.mulTo=L4;un.prototype.sqrTo=z4;function F4(){if(this.t<1)return 0;var e=this[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function hn(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function B4(e){var t=we();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(j.ZERO)>0&&this.m.subTo(t,t),t}function R4(e){var t=we();return e.copyTo(t),this.reduce(t),t}function O4(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var i=e[t]&32767,r=i*this.mpl+((i*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(i=t+this.m.t,e[i]+=this.m.am(0,r,e,t,0,this.m.t);e[i]>=e.DV;)e[i]-=e.DV,e[++i]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function N4(e,t){e.squareTo(t),this.reduce(t)}function V4(e,t,i){e.multiplyTo(t,i),this.reduce(i)}hn.prototype.convert=B4;hn.prototype.revert=R4;hn.prototype.reduce=O4;hn.prototype.mulTo=V4;hn.prototype.sqrTo=N4;function j4(){return(this.t>0?this[0]&1:this.s)==0}function G4(e,t){if(e>4294967295||e<1)return j.ONE;var i=we(),r=we(),n=t.convert(this),a=pu(e)-1;for(n.copyTo(i);--a>=0;)if(t.sqrTo(i,r),(e&1<<a)>0)t.mulTo(r,n,i);else{var o=i;i=r,r=o}return t.revert(i)}function U4(e,t){var i;return e<256||t.isEven()?i=new un(t):i=new hn(t),this.exp(e,i)}j.prototype.copyTo=p4;j.prototype.fromInt=d4;j.prototype.fromString=f4;j.prototype.clamp=m4;j.prototype.dlShiftTo=b4;j.prototype.drShiftTo=w4;j.prototype.lShiftTo=P4;j.prototype.rShiftTo=T4;j.prototype.subTo=S4;j.prototype.multiplyTo=M4;j.prototype.squareTo=C4;j.prototype.divRemTo=I4;j.prototype.invDigit=F4;j.prototype.isEven=j4;j.prototype.exp=G4;j.prototype.toString=y4;j.prototype.negate=g4;j.prototype.abs=_4;j.prototype.compareTo=x4;j.prototype.bitLength=v4;j.prototype.mod=A4;j.prototype.modPowInt=U4;j.ZERO=Mr(0);j.ONE=Mr(1);function X4(){var e=we();return this.copyTo(e),e}function $4(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function q4(){return this.t==0?this.s:this[0]<<24>>24}function Y4(){return this.t==0?this.s:this[0]<<16>>16}function Z4(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function W4(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function H4(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),i=Math.pow(e,t),r=Mr(i),n=we(),a=we(),o="";for(this.divRemTo(r,n,a);n.signum()>0;)o=(i+a.intValue()).toString(e).substr(1)+o,n.divRemTo(r,n,a);return a.intValue().toString(e)+o}function K4(e,t){this.fromInt(0),t==null&&(t=10);for(var i=this.chunkSize(t),r=Math.pow(t,i),n=!1,a=0,o=0,s=0;s<e.length;++s){var l=Jv(e,s);if(l<0){e.charAt(s)=="-"&&this.signum()==0&&(n=!0);continue}o=t*o+l,++a>=i&&(this.dMultiply(r),this.dAddOffset(o,0),a=0,o=0)}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(o,0)),n&&j.ZERO.subTo(this,this)}function J4(e,t,i){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,i),this.testBit(e-1)||this.bitwiseTo(j.ONE.shiftLeft(e-1),od,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(j.ONE.shiftLeft(e-1),this);else{var r=new Array,n=e&7;r.length=(e>>3)+1,t.nextBytes(r),n>0?r[0]&=(1<<n)-1:r[0]=0,this.fromString(r,256)}}function Q4(){var e=this.t,t=new Array;t[0]=this.s;var i=this.DB-e*this.DB%8,r,n=0;if(e-- >0)for(i<this.DB&&(r=this[e]>>i)!=(this.s&this.DM)>>i&&(t[n++]=r|this.s<<this.DB-i);e>=0;)i<8?(r=(this[e]&(1<<i)-1)<<8-i,r|=this[--e]>>(i+=this.DB-8)):(r=this[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),(r&128)!=0&&(r|=-256),n==0&&(this.s&128)!=(r&128)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t}function e6(e){return this.compareTo(e)==0}function t6(e){return this.compareTo(e)<0?this:e}function i6(e){return this.compareTo(e)>0?this:e}function r6(e,t,i){var r,n,a=Math.min(e.t,this.t);for(r=0;r<a;++r)i[r]=t(this[r],e[r]);if(e.t<this.t){for(n=e.s&this.DM,r=a;r<this.t;++r)i[r]=t(this[r],n);i.t=this.t}else{for(n=this.s&this.DM,r=a;r<e.t;++r)i[r]=t(n,e[r]);i.t=e.t}i.s=t(this.s,e.s),i.clamp()}function n6(e,t){return e&t}function a6(e){var t=we();return this.bitwiseTo(e,n6,t),t}function od(e,t){return e|t}function o6(e){var t=we();return this.bitwiseTo(e,od,t),t}function Qv(e,t){return e^t}function s6(e){var t=we();return this.bitwiseTo(e,Qv,t),t}function e1(e,t){return e&~t}function l6(e){var t=we();return this.bitwiseTo(e,e1,t),t}function u6(){for(var e=we(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function h6(e){var t=we();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function c6(e){var t=we();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function p6(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function d6(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+p6(this[e]);return this.s<0?this.t*this.DB:-1}function f6(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function m6(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=f6(this[i]^t);return e}function y6(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function g6(e,t){var i=j.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i}function _6(e){return this.changeBit(e,od)}function x6(e){return this.changeBit(e,e1)}function v6(e){return this.changeBit(e,Qv)}function b6(e,t){for(var i=0,r=0,n=Math.min(e.t,this.t);i<n;)r+=this[i]+e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r+=e[i],t[i++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[i++]=r:r<-1&&(t[i++]=this.DV+r),t.t=i,t.clamp()}function w6(e){var t=we();return this.addTo(e,t),t}function P6(e){var t=we();return this.subTo(e,t),t}function T6(e){var t=we();return this.multiplyTo(e,t),t}function S6(){var e=we();return this.squareTo(e),e}function M6(e){var t=we();return this.divRemTo(e,t,null),t}function C6(e){var t=we();return this.divRemTo(e,null,t),t}function I6(e){var t=we(),i=we();return this.divRemTo(e,t,i),new Array(t,i)}function A6(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function E6(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function Lo(){}function t1(e){return e}function k6(e,t,i){e.multiplyTo(t,i)}function D6(e,t){e.squareTo(t)}Lo.prototype.convert=t1;Lo.prototype.revert=t1;Lo.prototype.mulTo=k6;Lo.prototype.sqrTo=D6;function L6(e){return this.exp(e,new Lo)}function z6(e,t,i){var r=Math.min(this.t+e.t,t);for(i.s=0,i.t=r;r>0;)i[--r]=0;var n;for(n=i.t-this.t;r<n;++r)i[r+this.t]=this.am(0,e[r],i,r,0,this.t);for(n=Math.min(e.t,t);r<n;++r)this.am(0,e[r],i,r,0,t-r);i.clamp()}function F6(e,t,i){--t;var r=i.t=this.t+e.t-t;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)i[this.t+r-t]=this.am(t-r,e[r],i,0,0,this.t+r-t);i.clamp(),i.drShiftTo(1,i)}function oa(e){this.r2=we(),this.q3=we(),j.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function B6(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=we();return e.copyTo(t),this.reduce(t),t}function R6(e){return e}function O6(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function N6(e,t){e.squareTo(t),this.reduce(t)}function V6(e,t,i){e.multiplyTo(t,i),this.reduce(i)}oa.prototype.convert=B6;oa.prototype.revert=R6;oa.prototype.reduce=O6;oa.prototype.mulTo=V6;oa.prototype.sqrTo=N6;function j6(e,t){var i=e.bitLength(),r,n=Mr(1),a;if(i<=0)return n;i<18?r=1:i<48?r=3:i<144?r=4:i<768?r=5:r=6,i<8?a=new un(t):t.isEven()?a=new oa(t):a=new hn(t);var o=new Array,s=3,l=r-1,u=(1<<r)-1;if(o[1]=a.convert(this),r>1){var h=we();for(a.sqrTo(o[1],h);s<=u;)o[s]=we(),a.mulTo(h,o[s-2],o[s]),s+=2}var c=e.t-1,p,d=!0,f=we(),y;for(i=pu(e[c])-1;c>=0;){for(i>=l?p=e[c]>>i-l&u:(p=(e[c]&(1<<i+1)-1)<<l-i,c>0&&(p|=e[c-1]>>this.DB+i-l)),s=r;(p&1)==0;)p>>=1,--s;if((i-=s)<0&&(i+=this.DB,--c),d)o[p].copyTo(n),d=!1;else{for(;s>1;)a.sqrTo(n,f),a.sqrTo(f,n),s-=2;s>0?a.sqrTo(n,f):(y=n,n=f,f=y),a.mulTo(f,o[p],n)}for(;c>=0&&(e[c]&1<<i)==0;)a.sqrTo(n,f),y=n,n=f,f=y,--i<0&&(i=this.DB-1,--c)}return a.revert(n)}function G6(e){var t=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(t.compareTo(i)<0){var r=t;t=i,i=r}var n=t.getLowestSetBit(),a=i.getLowestSetBit();if(a<0)return t;for(n<a&&(a=n),a>0&&(t.rShiftTo(a,t),i.rShiftTo(a,i));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),t.compareTo(i)>=0?(t.subTo(i,t),t.rShiftTo(1,t)):(i.subTo(t,i),i.rShiftTo(1,i));return a>0&&i.lShiftTo(a,i),i}function U6(e){if(e<=0)return 0;var t=this.DV%e,i=this.s<0?e-1:0;if(this.t>0)if(t==0)i=this[0]%e;else for(var r=this.t-1;r>=0;--r)i=(t*i+this[r])%e;return i}function X6(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return j.ZERO;for(var i=e.clone(),r=this.clone(),n=Mr(1),a=Mr(0),o=Mr(0),s=Mr(1);i.signum()!=0;){for(;i.isEven();)i.rShiftTo(1,i),t?((!n.isEven()||!a.isEven())&&(n.addTo(this,n),a.subTo(e,a)),n.rShiftTo(1,n)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;r.isEven();)r.rShiftTo(1,r),t?((!o.isEven()||!s.isEven())&&(o.addTo(this,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);i.compareTo(r)>=0?(i.subTo(r,i),t&&n.subTo(o,n),a.subTo(s,a)):(r.subTo(i,r),t&&o.subTo(n,o),s.subTo(a,s))}if(r.compareTo(j.ONE)!=0)return j.ZERO;if(s.compareTo(e)>=0)return s.subtract(e);if(s.signum()<0)s.addTo(e,s);else return s;return s.signum()<0?s.add(e):s}var St=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],$6=(1<<26)/St[St.length-1];function q6(e){var t,i=this.abs();if(i.t==1&&i[0]<=St[St.length-1]){for(t=0;t<St.length;++t)if(i[0]==St[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<St.length;){for(var r=St[t],n=t+1;n<St.length&&r<$6;)r*=St[n++];for(r=i.modInt(r);t<n;)if(r%St[t++]==0)return!1}return i.millerRabin(e)}function Y6(e){var t=this.subtract(j.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var r=t.shiftRight(i);e=e+1>>1,e>St.length&&(e=St.length);for(var n=we(),a=0;a<e;++a){n.fromInt(St[Math.floor(Math.random()*St.length)]);var o=n.modPow(r,this);if(o.compareTo(j.ONE)!=0&&o.compareTo(t)!=0){for(var s=1;s++<i&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(j.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}j.prototype.chunkSize=Z4;j.prototype.toRadix=H4;j.prototype.fromRadix=K4;j.prototype.fromNumber=J4;j.prototype.bitwiseTo=r6;j.prototype.changeBit=g6;j.prototype.addTo=b6;j.prototype.dMultiply=A6;j.prototype.dAddOffset=E6;j.prototype.multiplyLowerTo=z6;j.prototype.multiplyUpperTo=F6;j.prototype.modInt=U6;j.prototype.millerRabin=Y6;j.prototype.clone=X4;j.prototype.intValue=$4;j.prototype.byteValue=q4;j.prototype.shortValue=Y4;j.prototype.signum=W4;j.prototype.toByteArray=Q4;j.prototype.equals=e6;j.prototype.min=t6;j.prototype.max=i6;j.prototype.and=a6;j.prototype.or=o6;j.prototype.xor=s6;j.prototype.andNot=l6;j.prototype.not=u6;j.prototype.shiftLeft=h6;j.prototype.shiftRight=c6;j.prototype.getLowestSetBit=d6;j.prototype.bitCount=m6;j.prototype.testBit=y6;j.prototype.setBit=_6;j.prototype.clearBit=x6;j.prototype.flipBit=v6;j.prototype.add=w6;j.prototype.subtract=P6;j.prototype.multiply=T6;j.prototype.divide=M6;j.prototype.remainder=C6;j.prototype.divideAndRemainder=I6;j.prototype.modPow=j6;j.prototype.modInverse=X6;j.prototype.pow=L6;j.prototype.gcd=G6;j.prototype.isProbablePrime=q6;j.prototype.square=S6;var ge=j;ge.prototype.IsNegative=function(){return this.compareTo(ge.ZERO)==-1};ge.op_Equality=function(e,t){return e.compareTo(t)==0};ge.op_Inequality=function(e,t){return e.compareTo(t)!=0};ge.op_GreaterThan=function(e,t){return e.compareTo(t)>0};ge.op_LessThan=function(e,t){return e.compareTo(t)<0};ge.op_Addition=function(e,t){return new ge(e).add(new ge(t))};ge.op_Subtraction=function(e,t){return new ge(e).subtract(new ge(t))};ge.Int128Mul=function(e,t){return new ge(e).multiply(new ge(t))};ge.op_Division=function(e,t){return e.divide(t)};ge.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof hu>"u"&&(hu=function(e,t){var i;if(typeof Object.getOwnPropertyNames>"u"){for(i in t.prototype)(typeof e.prototype[i]>"u"||e.prototype[i]==Object.prototype[i])&&(e.prototype[i]=t.prototype[i]);for(i in t)typeof e[i]>"u"&&(e[i]=t[i]);e.$baseCtor=t}else{for(var r=Object.getOwnPropertyNames(t.prototype),n=0;n<r.length;n++)typeof Object.getOwnPropertyDescriptor(e.prototype,r[n])>"u"&&Object.defineProperty(e.prototype,r[n],Object.getOwnPropertyDescriptor(t.prototype,r[n]));for(i in t)typeof e[i]>"u"&&(e[i]=t[i]);e.$baseCtor=t}});var hu;m.Path=function(){return[]};m.Paths=function(){return[]};m.DoublePoint=function(){var e=arguments;this.X=0,this.Y=0,e.length==1?(this.X=e[0].X,this.Y=e[0].Y):e.length==2&&(this.X=e[0],this.Y=e[1])};m.DoublePoint0=function(){this.X=0,this.Y=0};m.DoublePoint1=function(e){this.X=e.X,this.Y=e.Y};m.DoublePoint2=function(e,t){this.X=e,this.Y=t};m.PolyNode=function(){this.m_Parent=null,this.m_polygon=new m.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};m.PolyNode.prototype.IsHoleNode=function(){for(var e=!0,t=this.m_Parent;t!==null;)e=!e,t=t.m_Parent;return e};m.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};m.PolyNode.prototype.Contour=function(){return this.m_polygon};m.PolyNode.prototype.AddChild=function(e){var t=this.m_Childs.length;this.m_Childs.push(e),e.m_Parent=this,e.m_Index=t};m.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};m.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index==this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};m.PolyNode.prototype.Childs=function(){return this.m_Childs};m.PolyNode.prototype.Parent=function(){return this.m_Parent};m.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};m.PolyTree=function(){this.m_AllPolys=[],m.PolyNode.call(this)};m.PolyTree.prototype.Clear=function(){for(var e=0,t=this.m_AllPolys.length;e<t;e++)this.m_AllPolys[e]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};m.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};m.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};hu(m.PolyTree,m.PolyNode);m.Math_Abs_Int64=m.Math_Abs_Int32=m.Math_Abs_Double=function(e){return Math.abs(e)};m.Math_Max_Int32_Int32=function(e,t){return Math.max(e,t)};_e.msie||_e.opera||_e.safari?m.Cast_Int32=function(e){return e|0}:m.Cast_Int32=function(e){return~~e};_e.chrome?m.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):~~e}:_e.firefox&&typeof Number.toInteger=="function"?m.Cast_Int64=function(e){return Number.toInteger(e)}:_e.msie7||_e.msie8?m.Cast_Int64=function(e){return parseInt(e,10)}:_e.msie?m.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):e|0}:m.Cast_Int64=function(e){return e<0?Math.ceil(e):Math.floor(e)};m.Clear=function(e){e.length=0};m.PI=3.141592653589793;m.PI2=2*3.141592653589793;m.IntPoint=function(){var e=arguments,t=e.length;if(this.X=0,this.Y=0,ln)if(this.Z=0,t==3)this.X=e[0],this.Y=e[1],this.Z=e[2];else if(t==2)this.X=e[0],this.Y=e[1],this.Z=0;else if(t==1)if(e[0]instanceof m.DoublePoint){var i=e[0];this.X=m.Clipper.Round(i.X),this.Y=m.Clipper.Round(i.Y),this.Z=0}else{var r=e[0];typeof r.Z>"u"&&(r.Z=0),this.X=r.X,this.Y=r.Y,this.Z=r.Z}else this.X=0,this.Y=0,this.Z=0;else if(t==2)this.X=e[0],this.Y=e[1];else if(t==1)if(e[0]instanceof m.DoublePoint){var i=e[0];this.X=m.Clipper.Round(i.X),this.Y=m.Clipper.Round(i.Y)}else{var r=e[0];this.X=r.X,this.Y=r.Y}else this.X=0,this.Y=0};m.IntPoint.op_Equality=function(e,t){return e.X==t.X&&e.Y==t.Y};m.IntPoint.op_Inequality=function(e,t){return e.X!=t.X||e.Y!=t.Y};ln?(m.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},m.IntPoint1=function(e){this.X=e.X,this.Y=e.Y,this.Z=e.Z},m.IntPoint1dp=function(e){this.X=m.Clipper.Round(e.X),this.Y=m.Clipper.Round(e.Y),this.Z=0},m.IntPoint2=function(e,t){this.X=e,this.Y=t,this.Z=0},m.IntPoint3=function(e,t,i){this.X=e,this.Y=t,this.Z=i}):(m.IntPoint0=function(){this.X=0,this.Y=0},m.IntPoint1=function(e){this.X=e.X,this.Y=e.Y},m.IntPoint1dp=function(e){this.X=m.Clipper.Round(e.X),this.Y=m.Clipper.Round(e.Y)},m.IntPoint2=function(e,t){this.X=e,this.Y=t});m.IntRect=function(){var e=arguments,t=e.length;t==4?(this.left=e[0],this.top=e[1],this.right=e[2],this.bottom=e[3]):t==1?(this.left=ir.left,this.top=ir.top,this.right=ir.right,this.bottom=ir.bottom):(this.left=0,this.top=0,this.right=0,this.bottom=0)};m.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};m.IntRect1=function(e){this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom};m.IntRect4=function(e,t,i,r){this.left=e,this.top=t,this.right=i,this.bottom=r};m.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};m.PolyType={ptSubject:0,ptClip:1};m.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};m.JoinType={jtSquare:0,jtRound:1,jtMiter:2};m.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};Hv&&(m.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});m.EdgeSide={esLeft:0,esRight:1};m.Direction={dRightToLeft:0,dLeftToRight:1};m.TEdge=function(){this.Bot=new m.IntPoint,this.Curr=new m.IntPoint,this.Top=new m.IntPoint,this.Delta=new m.IntPoint,this.Dx=0,this.PolyTyp=m.PolyType.ptSubject,this.Side=m.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};m.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new m.IntPoint};m.MyIntersectNodeSort=function(){};m.MyIntersectNodeSort.Compare=function(e,t){return t.Pt.Y-e.Pt.Y};m.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};m.Scanbeam=function(){this.Y=0,this.Next=null};m.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};m.OutPt=function(){this.Idx=0,this.Pt=new m.IntPoint,this.Next=null,this.Prev=null};m.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new m.IntPoint};m.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_MinimaList=null,this.m_CurrentLM=null,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};m.ClipperBase.horizontal=-9007199254740992;m.ClipperBase.Skip=-2;m.ClipperBase.Unassigned=-1;m.ClipperBase.tolerance=1e-20;o4?(m.ClipperBase.loRange=46340,m.ClipperBase.hiRange=46340):(m.ClipperBase.loRange=47453132,m.ClipperBase.hiRange=0xfffffffffffff);m.ClipperBase.near_zero=function(e){return e>-m.ClipperBase.tolerance&&e<m.ClipperBase.tolerance};m.ClipperBase.IsHorizontal=function(e){return e.Delta.Y===0};m.ClipperBase.prototype.PointIsVertex=function(e,t){var i=t;do{if(m.IntPoint.op_Equality(i.Pt,e))return!0;i=i.Next}while(i!=t);return!1};m.ClipperBase.prototype.PointOnLineSegment=function(e,t,i,r){return r?e.X==t.X&&e.Y==t.Y||e.X==i.X&&e.Y==i.Y||e.X>t.X==e.X<i.X&&e.Y>t.Y==e.Y<i.Y&&ge.op_Equality(ge.Int128Mul(e.X-t.X,i.Y-t.Y),ge.Int128Mul(i.X-t.X,e.Y-t.Y)):e.X==t.X&&e.Y==t.Y||e.X==i.X&&e.Y==i.Y||e.X>t.X==e.X<i.X&&e.Y>t.Y==e.Y<i.Y&&(e.X-t.X)*(i.Y-t.Y)==(i.X-t.X)*(e.Y-t.Y)};m.ClipperBase.prototype.PointOnPolygon=function(e,t,i){for(var r=t;;){if(this.PointOnLineSegment(e,r.Pt,r.Next.Pt,i))return!0;if(r=r.Next,r==t)break}return!1};m.ClipperBase.prototype.SlopesEqual=m.ClipperBase.SlopesEqual=function(){var e=arguments,t=e.length,i,r,n,a,o,s,l;return t==3?(i=e[0],r=e[1],l=e[2],l?ge.op_Equality(ge.Int128Mul(i.Delta.Y,r.Delta.X),ge.Int128Mul(i.Delta.X,r.Delta.Y)):m.Cast_Int64(i.Delta.Y*r.Delta.X)==m.Cast_Int64(i.Delta.X*r.Delta.Y)):t==4?(n=e[0],a=e[1],o=e[2],l=e[3],l?ge.op_Equality(ge.Int128Mul(n.Y-a.Y,a.X-o.X),ge.Int128Mul(n.X-a.X,a.Y-o.Y)):m.Cast_Int64((n.Y-a.Y)*(a.X-o.X))-m.Cast_Int64((n.X-a.X)*(a.Y-o.Y))===0):(n=e[0],a=e[1],o=e[2],s=e[3],l=e[4],l?ge.op_Equality(ge.Int128Mul(n.Y-a.Y,o.X-s.X),ge.Int128Mul(n.X-a.X,o.Y-s.Y)):m.Cast_Int64((n.Y-a.Y)*(o.X-s.X))-m.Cast_Int64((n.X-a.X)*(o.Y-s.Y))===0)};m.ClipperBase.SlopesEqual3=function(e,t,i){return i?ge.op_Equality(ge.Int128Mul(e.Delta.Y,t.Delta.X),ge.Int128Mul(e.Delta.X,t.Delta.Y)):m.Cast_Int64(e.Delta.Y*t.Delta.X)==m.Cast_Int64(e.Delta.X*t.Delta.Y)};m.ClipperBase.SlopesEqual4=function(e,t,i,r){return r?ge.op_Equality(ge.Int128Mul(e.Y-t.Y,t.X-i.X),ge.Int128Mul(e.X-t.X,t.Y-i.Y)):m.Cast_Int64((e.Y-t.Y)*(t.X-i.X))-m.Cast_Int64((e.X-t.X)*(t.Y-i.Y))===0};m.ClipperBase.SlopesEqual5=function(e,t,i,r,n){return n?ge.op_Equality(ge.Int128Mul(e.Y-t.Y,i.X-r.X),ge.Int128Mul(e.X-t.X,i.Y-r.Y)):m.Cast_Int64((e.Y-t.Y)*(i.X-r.X))-m.Cast_Int64((e.X-t.X)*(i.Y-r.Y))===0};m.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var e=0,t=this.m_edges.length;e<t;++e){for(var i=0,r=this.m_edges[e].length;i<r;++i)this.m_edges[e][i]=null;m.Clear(this.m_edges[e])}m.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};m.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var e=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=e}this.m_CurrentLM=null};m.ClipperBase.prototype.RangeTest=function(e,t){t.Value?(e.X>m.ClipperBase.hiRange||e.Y>m.ClipperBase.hiRange||-e.X>m.ClipperBase.hiRange||-e.Y>m.ClipperBase.hiRange)&&m.Error("Coordinate outside allowed range in RangeTest()."):(e.X>m.ClipperBase.loRange||e.Y>m.ClipperBase.loRange||-e.X>m.ClipperBase.loRange||-e.Y>m.ClipperBase.loRange)&&(t.Value=!0,this.RangeTest(e,t))};m.ClipperBase.prototype.InitEdge=function(e,t,i,r){e.Next=t,e.Prev=i,e.Curr.X=r.X,e.Curr.Y=r.Y,e.OutIdx=-1};m.ClipperBase.prototype.InitEdge2=function(e,t){e.Curr.Y>=e.Next.Curr.Y?(e.Bot.X=e.Curr.X,e.Bot.Y=e.Curr.Y,e.Top.X=e.Next.Curr.X,e.Top.Y=e.Next.Curr.Y):(e.Top.X=e.Curr.X,e.Top.Y=e.Curr.Y,e.Bot.X=e.Next.Curr.X,e.Bot.Y=e.Next.Curr.Y),this.SetDx(e),e.PolyTyp=t};m.ClipperBase.prototype.FindNextLocMin=function(e){for(var t;;){for(;m.IntPoint.op_Inequality(e.Bot,e.Prev.Bot)||m.IntPoint.op_Equality(e.Curr,e.Top);)e=e.Next;if(e.Dx!=m.ClipperBase.horizontal&&e.Prev.Dx!=m.ClipperBase.horizontal)break;for(;e.Prev.Dx==m.ClipperBase.horizontal;)e=e.Prev;for(t=e;e.Dx==m.ClipperBase.horizontal;)e=e.Next;if(e.Top.Y!=e.Prev.Bot.Y){t.Prev.Bot.X<e.Bot.X&&(e=t);break}}return e};m.ClipperBase.prototype.ProcessBound=function(e,t){var i=e,r=e,n,a;if(e.Dx==m.ClipperBase.horizontal&&(t?a=e.Prev.Bot.X:a=e.Next.Bot.X,e.Bot.X!=a&&this.ReverseHorizontal(e)),r.OutIdx!=m.ClipperBase.Skip)if(t){for(;r.Top.Y==r.Next.Bot.Y&&r.Next.OutIdx!=m.ClipperBase.Skip;)r=r.Next;if(r.Dx==m.ClipperBase.horizontal&&r.Next.OutIdx!=m.ClipperBase.Skip){for(n=r;n.Prev.Dx==m.ClipperBase.horizontal;)n=n.Prev;n.Prev.Top.X==r.Next.Top.X?t||(r=n.Prev):n.Prev.Top.X>r.Next.Top.X&&(r=n.Prev)}for(;e!=r;)e.NextInLML=e.Next,e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),e=e.Next;e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),r=r.Next}else{for(;r.Top.Y==r.Prev.Bot.Y&&r.Prev.OutIdx!=m.ClipperBase.Skip;)r=r.Prev;if(r.Dx==m.ClipperBase.horizontal&&r.Prev.OutIdx!=m.ClipperBase.Skip){for(n=r;n.Next.Dx==m.ClipperBase.horizontal;)n=n.Next;n.Next.Top.X==r.Prev.Top.X?t||(r=n.Next):n.Next.Top.X>r.Prev.Top.X&&(r=n.Next)}for(;e!=r;)e.NextInLML=e.Prev,e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),e=e.Prev;e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),r=r.Prev}if(r.OutIdx==m.ClipperBase.Skip){if(e=r,t){for(;e.Top.Y==e.Next.Bot.Y;)e=e.Next;for(;e!=r&&e.Dx==m.ClipperBase.horizontal;)e=e.Prev}else{for(;e.Top.Y==e.Prev.Bot.Y;)e=e.Prev;for(;e!=r&&e.Dx==m.ClipperBase.horizontal;)e=e.Next}if(e==r)t?r=e.Next:r=e.Prev;else{t?e=r.Next:e=r.Prev;var o=new m.LocalMinima;o.Next=null,o.Y=e.Bot.Y,o.LeftBound=null,o.RightBound=e,o.RightBound.WindDelta=0,r=this.ProcessBound(o.RightBound,t),this.InsertLocalMinima(o)}}return r};m.ClipperBase.prototype.AddPath=function(e,t,i){Wv?!i&&t==m.PolyType.ptClip&&m.Error("AddPath: Open paths must be subject."):i||m.Error("AddPath: Open paths have been disabled.");var r=e.length-1;if(i)for(;r>0&&m.IntPoint.op_Equality(e[r],e[0]);)--r;for(;r>0&&m.IntPoint.op_Equality(e[r],e[r-1]);)--r;if(i&&r<2||!i&&r<1)return!1;for(var n=new Array,a=0;a<=r;a++)n.push(new m.TEdge);var o=!0;n[1].Curr.X=e[1].X,n[1].Curr.Y=e[1].Y;var s={Value:this.m_UseFullRange};this.RangeTest(e[0],s),this.m_UseFullRange=s.Value,s.Value=this.m_UseFullRange,this.RangeTest(e[r],s),this.m_UseFullRange=s.Value,this.InitEdge(n[0],n[1],n[r],e[0]),this.InitEdge(n[r],n[0],n[r-1],e[r]);for(var a=r-1;a>=1;--a)s.Value=this.m_UseFullRange,this.RangeTest(e[a],s),this.m_UseFullRange=s.Value,this.InitEdge(n[a],n[a+1],n[a-1],e[a]);for(var l=n[0],u=l,h=l;;){if(m.IntPoint.op_Equality(u.Curr,u.Next.Curr)){if(u==u.Next)break;u==l&&(l=u.Next),u=this.RemoveEdge(u),h=u;continue}if(u.Prev==u.Next)break;if(i&&m.ClipperBase.SlopesEqual(u.Prev.Curr,u.Curr,u.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(u.Prev.Curr,u.Curr,u.Next.Curr))){u==l&&(l=u.Next),u=this.RemoveEdge(u),u=u.Prev,h=u;continue}if(u=u.Next,u==h)break}if(!i&&u==u.Next||i&&u.Prev==u.Next)return!1;i||(this.m_HasOpenPaths=!0,l.Prev.OutIdx=m.ClipperBase.Skip);var c=l;u=l;do this.InitEdge2(u,t),u=u.Next,o&&u.Curr.Y!=l.Curr.Y&&(o=!1);while(u!=l);if(o){if(i)return!1;u.Prev.OutIdx=m.ClipperBase.Skip,u.Prev.Bot.X<u.Prev.Top.X&&this.ReverseHorizontal(u.Prev);var p=new m.LocalMinima;for(p.Next=null,p.Y=u.Bot.Y,p.LeftBound=null,p.RightBound=u,p.RightBound.Side=m.EdgeSide.esRight,p.RightBound.WindDelta=0;u.Next.OutIdx!=m.ClipperBase.Skip;)u.NextInLML=u.Next,u.Bot.X!=u.Prev.Top.X&&this.ReverseHorizontal(u),u=u.Next;return this.InsertLocalMinima(p),this.m_edges.push(n),!0}this.m_edges.push(n);for(var d,f=null;u=this.FindNextLocMin(u),u!=f;){f==null&&(f=u);var p=new m.LocalMinima;p.Next=null,p.Y=u.Bot.Y,u.Dx<u.Prev.Dx?(p.LeftBound=u.Prev,p.RightBound=u,d=!1):(p.LeftBound=u,p.RightBound=u.Prev,d=!0),p.LeftBound.Side=m.EdgeSide.esLeft,p.RightBound.Side=m.EdgeSide.esRight,i?p.LeftBound.Next==p.RightBound?p.LeftBound.WindDelta=-1:p.LeftBound.WindDelta=1:p.LeftBound.WindDelta=0,p.RightBound.WindDelta=-p.LeftBound.WindDelta,u=this.ProcessBound(p.LeftBound,d);var y=this.ProcessBound(p.RightBound,!d);p.LeftBound.OutIdx==m.ClipperBase.Skip?p.LeftBound=null:p.RightBound.OutIdx==m.ClipperBase.Skip&&(p.RightBound=null),this.InsertLocalMinima(p),d||(u=y)}return!0};m.ClipperBase.prototype.AddPaths=function(e,t,i){for(var r=!1,n=0,a=e.length;n<a;++n)this.AddPath(e[n],t,i)&&(r=!0);return r};m.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(e,t,i){return m.IntPoint.op_Equality(e,i)||m.IntPoint.op_Equality(e,t)||m.IntPoint.op_Equality(i,t)?!1:e.X!=i.X?t.X>e.X==t.X<i.X:t.Y>e.Y==t.Y<i.Y};m.ClipperBase.prototype.RemoveEdge=function(e){e.Prev.Next=e.Next,e.Next.Prev=e.Prev;var t=e.Next;return e.Prev=null,t};m.ClipperBase.prototype.SetDx=function(e){e.Delta.X=e.Top.X-e.Bot.X,e.Delta.Y=e.Top.Y-e.Bot.Y,e.Delta.Y===0?e.Dx=m.ClipperBase.horizontal:e.Dx=e.Delta.X/e.Delta.Y};m.ClipperBase.prototype.InsertLocalMinima=function(e){if(this.m_MinimaList===null)this.m_MinimaList=e;else if(e.Y>=this.m_MinimaList.Y)e.Next=this.m_MinimaList,this.m_MinimaList=e;else{for(var t=this.m_MinimaList;t.Next!==null&&e.Y<t.Next.Y;)t=t.Next;e.Next=t.Next,t.Next=e}};m.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};m.ClipperBase.prototype.ReverseHorizontal=function(e){var t=e.Top.X;e.Top.X=e.Bot.X,e.Bot.X=t,ln&&(t=e.Top.Z,e.Top.Z=e.Bot.Z,e.Bot.Z=t)};m.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var e=this.m_MinimaList;e!=null;){var t=e.LeftBound;t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=m.EdgeSide.esLeft,t.OutIdx=m.ClipperBase.Unassigned),t=e.RightBound,t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=m.EdgeSide.esRight,t.OutIdx=m.ClipperBase.Unassigned),e=e.Next}};m.Clipper=function(e){typeof e>"u"&&(e=0),this.m_PolyOuts=null,this.m_ClipType=m.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=m.PolyFillType.pftEvenOdd,this.m_SubjFillType=m.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,m.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=m.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&e)!==0,this.StrictlySimple=(2&e)!==0,this.PreserveCollinear=(4&e)!==0,ln&&(this.ZFillFunction=null)};m.Clipper.ioReverseSolution=1;m.Clipper.ioStrictlySimple=2;m.Clipper.ioPreserveCollinear=4;m.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),m.ClipperBase.prototype.Clear.call(this))};m.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var e=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=e}};m.Clipper.prototype.Reset=function(){m.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var e=this.m_MinimaList;e!==null;)this.InsertScanbeam(e.Y),e=e.Next};m.Clipper.prototype.InsertScanbeam=function(e){if(this.m_Scanbeam===null)this.m_Scanbeam=new m.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=e;else if(e>this.m_Scanbeam.Y){var t=new m.Scanbeam;t.Y=e,t.Next=this.m_Scanbeam,this.m_Scanbeam=t}else{for(var i=this.m_Scanbeam;i.Next!==null&&e<=i.Next.Y;)i=i.Next;if(e==i.Y)return;var t=new m.Scanbeam;t.Y=e,t.Next=i.Next,i.Next=t}};m.Clipper.prototype.Execute=function(){var e=arguments,t=e.length,i=e[1]instanceof m.PolyTree;if(t==4&&!i){var r=e[0],n=e[1],a=e[2],o=e[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&m.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,m.Clear(n),this.m_SubjFillType=a,this.m_ClipFillType=o,this.m_ClipType=r,this.m_UsingPolyTree=!1;try{var s=this.ExecuteInternal();s&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return s}else if(t==4&&i){var r=e[0],l=e[1],a=e[2],o=e[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=a,this.m_ClipFillType=o,this.m_ClipType=r,this.m_UsingPolyTree=!0;try{var s=this.ExecuteInternal();s&&this.BuildResult2(l)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return s}else if(t==2&&!i){var r=e[0],n=e[1];return this.Execute(r,n,m.PolyFillType.pftEvenOdd,m.PolyFillType.pftEvenOdd)}else if(t==2&&i){var r=e[0],l=e[1];return this.Execute(r,l,m.PolyFillType.pftEvenOdd,m.PolyFillType.pftEvenOdd)}};m.Clipper.prototype.FixHoleLinkage=function(e){if(!(e.FirstLeft===null||e.IsHole!=e.FirstLeft.IsHole&&e.FirstLeft.Pts!==null)){for(var t=e.FirstLeft;t!==null&&(t.IsHole==e.IsHole||t.Pts===null);)t=t.FirstLeft;e.FirstLeft=t}};m.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var e=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(e),m.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var t=this.PopScanbeam();if(!this.ProcessIntersections(e,t))return!1;this.ProcessEdgesAtTopOfScanbeam(t),e=t}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var i=0,r=this.m_PolyOuts.length;i<r;i++){var n=this.m_PolyOuts[i];n.Pts===null||n.IsOpen||(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)}this.JoinCommonEdges();for(var i=0,r=this.m_PolyOuts.length;i<r;i++){var n=this.m_PolyOuts[i];n.Pts!==null&&!n.IsOpen&&this.FixupOutPolygon(n)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{m.Clear(this.m_Joins),m.Clear(this.m_GhostJoins)}};m.Clipper.prototype.PopScanbeam=function(){var e=this.m_Scanbeam.Y,t=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,t=null,e};m.Clipper.prototype.DisposeAllPolyPts=function(){for(var e=0,t=this.m_PolyOuts.length;e<t;++e)this.DisposeOutRec(e);m.Clear(this.m_PolyOuts)};m.Clipper.prototype.DisposeOutRec=function(e){var t=this.m_PolyOuts[e];t.Pts!==null&&this.DisposeOutPts(t.Pts),t=null,this.m_PolyOuts[e]=null};m.Clipper.prototype.DisposeOutPts=function(e){if(e!==null){var t=null;for(e.Prev.Next=null;e!==null;)t=e,e=e.Next,t=null}};m.Clipper.prototype.AddJoin=function(e,t,i){var r=new m.Join;r.OutPt1=e,r.OutPt2=t,r.OffPt.X=i.X,r.OffPt.Y=i.Y,this.m_Joins.push(r)};m.Clipper.prototype.AddGhostJoin=function(e,t){var i=new m.Join;i.OutPt1=e,i.OffPt.X=t.X,i.OffPt.Y=t.Y,this.m_GhostJoins.push(i)};ln&&(m.Clipper.prototype.SetZ=function(e,t){e.Z=0,this.ZFillFunction!==null&&(t.OutIdx<0?this.ZFillFunction(t.Bot,t.Top,e):this.ZFillFunction(t.Top,t.Bot,e))});m.Clipper.prototype.InsertLocalMinimaIntoAEL=function(e){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==e;){var t=this.m_CurrentLM.LeftBound,i=this.m_CurrentLM.RightBound;this.PopLocalMinima();var r=null;if(t===null?(this.InsertEdgeIntoAEL(i,null),this.SetWindingCount(i),this.IsContributing(i)&&(r=this.AddOutPt(i,i.Bot))):i==null?(this.InsertEdgeIntoAEL(t,null),this.SetWindingCount(t),this.IsContributing(t)&&(r=this.AddOutPt(t,t.Bot)),this.InsertScanbeam(t.Top.Y)):(this.InsertEdgeIntoAEL(t,null),this.InsertEdgeIntoAEL(i,t),this.SetWindingCount(t),i.WindCnt=t.WindCnt,i.WindCnt2=t.WindCnt2,this.IsContributing(t)&&(r=this.AddLocalMinPoly(t,i,t.Bot)),this.InsertScanbeam(t.Top.Y)),i!=null&&(m.ClipperBase.IsHorizontal(i)?this.AddEdgeToSEL(i):this.InsertScanbeam(i.Top.Y)),!(t==null||i==null)){if(r!==null&&m.ClipperBase.IsHorizontal(i)&&this.m_GhostJoins.length>0&&i.WindDelta!==0)for(var n=0,a=this.m_GhostJoins.length;n<a;n++){var o=this.m_GhostJoins[n];this.HorzSegmentsOverlap(o.OutPt1.Pt,o.OffPt,i.Bot,i.Top)&&this.AddJoin(o.OutPt1,r,o.OffPt)}if(t.OutIdx>=0&&t.PrevInAEL!==null&&t.PrevInAEL.Curr.X==t.Bot.X&&t.PrevInAEL.OutIdx>=0&&m.ClipperBase.SlopesEqual(t.PrevInAEL,t,this.m_UseFullRange)&&t.WindDelta!==0&&t.PrevInAEL.WindDelta!==0){var s=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(r,s,t.Top)}if(t.NextInAEL!=i){if(i.OutIdx>=0&&i.PrevInAEL.OutIdx>=0&&m.ClipperBase.SlopesEqual(i.PrevInAEL,i,this.m_UseFullRange)&&i.WindDelta!==0&&i.PrevInAEL.WindDelta!==0){var s=this.AddOutPt(i.PrevInAEL,i.Bot);this.AddJoin(r,s,i.Top)}var l=t.NextInAEL;if(l!==null)for(;l!=i;)this.IntersectEdges(i,l,t.Curr,!1),l=l.NextInAEL}}}};m.Clipper.prototype.InsertEdgeIntoAEL=function(e,t){if(this.m_ActiveEdges===null)e.PrevInAEL=null,e.NextInAEL=null,this.m_ActiveEdges=e;else if(t===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,e))e.PrevInAEL=null,e.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=e,this.m_ActiveEdges=e;else{for(t===null&&(t=this.m_ActiveEdges);t.NextInAEL!==null&&!this.E2InsertsBeforeE1(t.NextInAEL,e);)t=t.NextInAEL;e.NextInAEL=t.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=e),e.PrevInAEL=t,t.NextInAEL=e}};m.Clipper.prototype.E2InsertsBeforeE1=function(e,t){return t.Curr.X==e.Curr.X?t.Top.Y>e.Top.Y?t.Top.X<m.Clipper.TopX(e,t.Top.Y):e.Top.X>m.Clipper.TopX(t,e.Top.Y):t.Curr.X<e.Curr.X};m.Clipper.prototype.IsEvenOddFillType=function(e){return e.PolyTyp==m.PolyType.ptSubject?this.m_SubjFillType==m.PolyFillType.pftEvenOdd:this.m_ClipFillType==m.PolyFillType.pftEvenOdd};m.Clipper.prototype.IsEvenOddAltFillType=function(e){return e.PolyTyp==m.PolyType.ptSubject?this.m_ClipFillType==m.PolyFillType.pftEvenOdd:this.m_SubjFillType==m.PolyFillType.pftEvenOdd};m.Clipper.prototype.IsContributing=function(e){var t,i;switch(e.PolyTyp==m.PolyType.ptSubject?(t=this.m_SubjFillType,i=this.m_ClipFillType):(t=this.m_ClipFillType,i=this.m_SubjFillType),t){case m.PolyFillType.pftEvenOdd:if(e.WindDelta===0&&e.WindCnt!=1)return!1;break;case m.PolyFillType.pftNonZero:if(Math.abs(e.WindCnt)!=1)return!1;break;case m.PolyFillType.pftPositive:if(e.WindCnt!=1)return!1;break;default:if(e.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case m.ClipType.ctIntersection:switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2!==0;case m.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case m.ClipType.ctUnion:switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2===0;case m.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}case m.ClipType.ctDifference:if(e.PolyTyp==m.PolyType.ptSubject)switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2===0;case m.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2!==0;case m.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case m.ClipType.ctXor:if(e.WindDelta===0)switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2===0;case m.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else return!0}return!0};m.Clipper.prototype.SetWindingCount=function(e){for(var t=e.PrevInAEL;t!==null&&(t.PolyTyp!=e.PolyTyp||t.WindDelta===0);)t=t.PrevInAEL;if(t===null)e.WindCnt=e.WindDelta===0?1:e.WindDelta,e.WindCnt2=0,t=this.m_ActiveEdges;else if(e.WindDelta===0&&this.m_ClipType!=m.ClipType.ctUnion)e.WindCnt=1,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;else if(this.IsEvenOddFillType(e)){if(e.WindDelta===0){for(var i=!0,r=t.PrevInAEL;r!==null;)r.PolyTyp==t.PolyTyp&&r.WindDelta!==0&&(i=!i),r=r.PrevInAEL;e.WindCnt=i?0:1}else e.WindCnt=e.WindDelta;e.WindCnt2=t.WindCnt2,t=t.NextInAEL}else t.WindCnt*t.WindDelta<0?Math.abs(t.WindCnt)>1?t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta:e.WindCnt=e.WindDelta===0?1:e.WindDelta:e.WindDelta===0?e.WindCnt=t.WindCnt<0?t.WindCnt-1:t.WindCnt+1:t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;if(this.IsEvenOddAltFillType(e))for(;t!=e;)t.WindDelta!==0&&(e.WindCnt2=e.WindCnt2===0?1:0),t=t.NextInAEL;else for(;t!=e;)e.WindCnt2+=t.WindDelta,t=t.NextInAEL};m.Clipper.prototype.AddEdgeToSEL=function(e){this.m_SortedEdges===null?(this.m_SortedEdges=e,e.PrevInSEL=null,e.NextInSEL=null):(e.NextInSEL=this.m_SortedEdges,e.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=e,this.m_SortedEdges=e)};m.Clipper.prototype.CopyAELToSEL=function(){var e=this.m_ActiveEdges;for(this.m_SortedEdges=e;e!==null;)e.PrevInSEL=e.PrevInAEL,e.NextInSEL=e.NextInAEL,e=e.NextInAEL};m.Clipper.prototype.SwapPositionsInAEL=function(e,t){if(!(e.NextInAEL==e.PrevInAEL||t.NextInAEL==t.PrevInAEL)){if(e.NextInAEL==t){var i=t.NextInAEL;i!==null&&(i.PrevInAEL=e);var r=e.PrevInAEL;r!==null&&(r.NextInAEL=t),t.PrevInAEL=r,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=i}else if(t.NextInAEL==e){var i=e.NextInAEL;i!==null&&(i.PrevInAEL=t);var r=t.PrevInAEL;r!==null&&(r.NextInAEL=e),e.PrevInAEL=r,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=i}else{var i=e.NextInAEL,r=e.PrevInAEL;e.NextInAEL=t.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=t.PrevInAEL,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e),t.NextInAEL=i,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=r,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t)}e.PrevInAEL===null?this.m_ActiveEdges=e:t.PrevInAEL===null&&(this.m_ActiveEdges=t)}};m.Clipper.prototype.SwapPositionsInSEL=function(e,t){if(!(e.NextInSEL===null&&e.PrevInSEL===null)&&!(t.NextInSEL===null&&t.PrevInSEL===null)){if(e.NextInSEL==t){var i=t.NextInSEL;i!==null&&(i.PrevInSEL=e);var r=e.PrevInSEL;r!==null&&(r.NextInSEL=t),t.PrevInSEL=r,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=i}else if(t.NextInSEL==e){var i=e.NextInSEL;i!==null&&(i.PrevInSEL=t);var r=t.PrevInSEL;r!==null&&(r.NextInSEL=e),e.PrevInSEL=r,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=i}else{var i=e.NextInSEL,r=e.PrevInSEL;e.NextInSEL=t.NextInSEL,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=t.PrevInSEL,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e),t.NextInSEL=i,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=r,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t)}e.PrevInSEL===null?this.m_SortedEdges=e:t.PrevInSEL===null&&(this.m_SortedEdges=t)}};m.Clipper.prototype.AddLocalMaxPoly=function(e,t,i){this.AddOutPt(e,i),t.WindDelta==0&&this.AddOutPt(t,i),e.OutIdx==t.OutIdx?(e.OutIdx=-1,t.OutIdx=-1):e.OutIdx<t.OutIdx?this.AppendPolygon(e,t):this.AppendPolygon(t,e)};m.Clipper.prototype.AddLocalMinPoly=function(e,t,i){var r,n,a;if(m.ClipperBase.IsHorizontal(t)||e.Dx>t.Dx?(r=this.AddOutPt(e,i),t.OutIdx=e.OutIdx,e.Side=m.EdgeSide.esLeft,t.Side=m.EdgeSide.esRight,n=e,n.PrevInAEL==t?a=t.PrevInAEL:a=n.PrevInAEL):(r=this.AddOutPt(t,i),e.OutIdx=t.OutIdx,e.Side=m.EdgeSide.esRight,t.Side=m.EdgeSide.esLeft,n=t,n.PrevInAEL==e?a=e.PrevInAEL:a=n.PrevInAEL),a!==null&&a.OutIdx>=0&&m.Clipper.TopX(a,i.Y)==m.Clipper.TopX(n,i.Y)&&m.ClipperBase.SlopesEqual(n,a,this.m_UseFullRange)&&n.WindDelta!==0&&a.WindDelta!==0){var o=this.AddOutPt(a,i);this.AddJoin(r,o,n.Top)}return r};m.Clipper.prototype.CreateOutRec=function(){var e=new m.OutRec;return e.Idx=-1,e.IsHole=!1,e.IsOpen=!1,e.FirstLeft=null,e.Pts=null,e.BottomPt=null,e.PolyNode=null,this.m_PolyOuts.push(e),e.Idx=this.m_PolyOuts.length-1,e};m.Clipper.prototype.AddOutPt=function(e,t){var i=e.Side==m.EdgeSide.esLeft;if(e.OutIdx<0){var r=this.CreateOutRec();r.IsOpen=e.WindDelta===0;var n=new m.OutPt;return r.Pts=n,n.Idx=r.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=n,n.Prev=n,r.IsOpen||this.SetHoleState(e,r),ln&&(m.IntPoint.op_Equality(t,e.Bot)?(n.Pt.X=e.Bot.X,n.Pt.Y=e.Bot.Y,n.Pt.Z=e.Bot.Z):m.IntPoint.op_Equality(t,e.Top)?(n.Pt.X=e.Top.X,n.Pt.Y=e.Top.Y,n.Pt.Z=e.Top.Z):this.SetZ(n.Pt,e)),e.OutIdx=r.Idx,n}else{var r=this.m_PolyOuts[e.OutIdx],a=r.Pts;if(i&&m.IntPoint.op_Equality(t,a.Pt))return a;if(!i&&m.IntPoint.op_Equality(t,a.Prev.Pt))return a.Prev;var n=new m.OutPt;return n.Idx=r.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=a,n.Prev=a.Prev,n.Prev.Next=n,a.Prev=n,i&&(r.Pts=n),ln&&(m.IntPoint.op_Equality(t,e.Bot)?(n.Pt.X=e.Bot.X,n.Pt.Y=e.Bot.Y,n.Pt.Z=e.Bot.Z):m.IntPoint.op_Equality(t,e.Top)?(n.Pt.X=e.Top.X,n.Pt.Y=e.Top.Y,n.Pt.Z=e.Top.Z):this.SetZ(n.Pt,e)),n}};m.Clipper.prototype.SwapPoints=function(e,t){var i=new m.IntPoint(e.Value);e.Value.X=t.Value.X,e.Value.Y=t.Value.Y,t.Value.X=i.X,t.Value.Y=i.Y};m.Clipper.prototype.HorzSegmentsOverlap=function(e,t,i,r){return e.X>i.X==e.X<r.X||t.X>i.X==t.X<r.X||i.X>e.X==i.X<t.X||r.X>e.X==r.X<t.X||e.X==i.X&&t.X==r.X?!0:e.X==r.X&&t.X==i.X};m.Clipper.prototype.InsertPolyPtBetween=function(e,t,i){var r=new m.OutPt;return r.Pt.X=i.X,r.Pt.Y=i.Y,t==e.Next?(e.Next=r,t.Prev=r,r.Next=t,r.Prev=e):(t.Next=r,e.Prev=r,r.Next=e,r.Prev=t),r};m.Clipper.prototype.SetHoleState=function(e,t){for(var i=!1,r=e.PrevInAEL;r!==null;)r.OutIdx>=0&&r.WindDelta!=0&&(i=!i,t.FirstLeft===null&&(t.FirstLeft=this.m_PolyOuts[r.OutIdx])),r=r.PrevInAEL;i&&(t.IsHole=!0)};m.Clipper.prototype.GetDx=function(e,t){return e.Y==t.Y?m.ClipperBase.horizontal:(t.X-e.X)/(t.Y-e.Y)};m.Clipper.prototype.FirstIsBottomPt=function(e,t){for(var i=e.Prev;m.IntPoint.op_Equality(i.Pt,e.Pt)&&i!=e;)i=i.Prev;var r=Math.abs(this.GetDx(e.Pt,i.Pt));for(i=e.Next;m.IntPoint.op_Equality(i.Pt,e.Pt)&&i!=e;)i=i.Next;var n=Math.abs(this.GetDx(e.Pt,i.Pt));for(i=t.Prev;m.IntPoint.op_Equality(i.Pt,t.Pt)&&i!=t;)i=i.Prev;var a=Math.abs(this.GetDx(t.Pt,i.Pt));for(i=t.Next;m.IntPoint.op_Equality(i.Pt,t.Pt)&&i!=t;)i=i.Next;var o=Math.abs(this.GetDx(t.Pt,i.Pt));return r>=a&&r>=o||n>=a&&n>=o};m.Clipper.prototype.GetBottomPt=function(e){for(var t=null,i=e.Next;i!=e;)i.Pt.Y>e.Pt.Y?(e=i,t=null):i.Pt.Y==e.Pt.Y&&i.Pt.X<=e.Pt.X&&(i.Pt.X<e.Pt.X?(t=null,e=i):i.Next!=e&&i.Prev!=e&&(t=i)),i=i.Next;if(t!==null)for(;t!=i;)for(this.FirstIsBottomPt(i,t)||(e=t),t=t.Next;m.IntPoint.op_Inequality(t.Pt,e.Pt);)t=t.Next;return e};m.Clipper.prototype.GetLowermostRec=function(e,t){e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts)),t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts));var i=e.BottomPt,r=t.BottomPt;return i.Pt.Y>r.Pt.Y?e:i.Pt.Y<r.Pt.Y?t:i.Pt.X<r.Pt.X?e:i.Pt.X>r.Pt.X||i.Next==i?t:r.Next==r||this.FirstIsBottomPt(i,r)?e:t};m.Clipper.prototype.Param1RightOfParam2=function(e,t){do if(e=e.FirstLeft,e==t)return!0;while(e!==null);return!1};m.Clipper.prototype.GetOutRec=function(e){for(var t=this.m_PolyOuts[e];t!=this.m_PolyOuts[t.Idx];)t=this.m_PolyOuts[t.Idx];return t};m.Clipper.prototype.AppendPolygon=function(e,t){var i=this.m_PolyOuts[e.OutIdx],r=this.m_PolyOuts[t.OutIdx],n;this.Param1RightOfParam2(i,r)?n=r:this.Param1RightOfParam2(r,i)?n=i:n=this.GetLowermostRec(i,r);var a=i.Pts,o=a.Prev,s=r.Pts,l=s.Prev,u;e.Side==m.EdgeSide.esLeft?(t.Side==m.EdgeSide.esLeft?(this.ReversePolyPtLinks(s),s.Next=a,a.Prev=s,o.Next=l,l.Prev=o,i.Pts=l):(l.Next=a,a.Prev=l,s.Prev=o,o.Next=s,i.Pts=s),u=m.EdgeSide.esLeft):(t.Side==m.EdgeSide.esRight?(this.ReversePolyPtLinks(s),o.Next=l,l.Prev=o,s.Next=a,a.Prev=s):(o.Next=s,s.Prev=o,a.Prev=l,l.Next=a),u=m.EdgeSide.esRight),i.BottomPt=null,n==r&&(r.FirstLeft!=i&&(i.FirstLeft=r.FirstLeft),i.IsHole=r.IsHole),r.Pts=null,r.BottomPt=null,r.FirstLeft=i;var h=e.OutIdx,c=t.OutIdx;e.OutIdx=-1,t.OutIdx=-1;for(var p=this.m_ActiveEdges;p!==null;){if(p.OutIdx==c){p.OutIdx=h,p.Side=u;break}p=p.NextInAEL}r.Idx=i.Idx};m.Clipper.prototype.ReversePolyPtLinks=function(e){if(e!==null){var t,i;t=e;do i=t.Next,t.Next=t.Prev,t.Prev=i,t=i;while(t!=e)}};m.Clipper.SwapSides=function(e,t){var i=e.Side;e.Side=t.Side,t.Side=i};m.Clipper.SwapPolyIndexes=function(e,t){var i=e.OutIdx;e.OutIdx=t.OutIdx,t.OutIdx=i};m.Clipper.prototype.IntersectEdges=function(e,t,i,r){var n=!r&&e.NextInLML===null&&e.Top.X==i.X&&e.Top.Y==i.Y,a=!r&&t.NextInLML===null&&t.Top.X==i.X&&t.Top.Y==i.Y,o=e.OutIdx>=0,s=t.OutIdx>=0;if(Wv&&(e.WindDelta===0||t.WindDelta===0)){e.WindDelta===0&&t.WindDelta===0?(n||a)&&o&&s&&this.AddLocalMaxPoly(e,t,i):e.PolyTyp==t.PolyTyp&&e.WindDelta!=t.WindDelta&&this.m_ClipType==m.ClipType.ctUnion?e.WindDelta===0?s&&(this.AddOutPt(e,i),o&&(e.OutIdx=-1)):o&&(this.AddOutPt(t,i),s&&(t.OutIdx=-1)):e.PolyTyp!=t.PolyTyp&&(e.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=m.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(e,i),o&&(e.OutIdx=-1)):t.WindDelta===0&&Math.abs(e.WindCnt)==1&&(this.m_ClipType!=m.ClipType.ctUnion||e.WindCnt2===0)&&(this.AddOutPt(t,i),s&&(t.OutIdx=-1))),n&&(e.OutIdx<0?this.DeleteFromAEL(e):m.Error("Error intersecting polylines")),a&&(t.OutIdx<0?this.DeleteFromAEL(t):m.Error("Error intersecting polylines"));return}if(e.PolyTyp==t.PolyTyp)if(this.IsEvenOddFillType(e)){var l=e.WindCnt;e.WindCnt=t.WindCnt,t.WindCnt=l}else e.WindCnt+t.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt+=t.WindDelta,t.WindCnt-e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt-=e.WindDelta;else this.IsEvenOddFillType(t)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2+=t.WindDelta,this.IsEvenOddFillType(e)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2-=e.WindDelta;var u,h,c,p;e.PolyTyp==m.PolyType.ptSubject?(u=this.m_SubjFillType,c=this.m_ClipFillType):(u=this.m_ClipFillType,c=this.m_SubjFillType),t.PolyTyp==m.PolyType.ptSubject?(h=this.m_SubjFillType,p=this.m_ClipFillType):(h=this.m_ClipFillType,p=this.m_SubjFillType);var d,f;switch(u){case m.PolyFillType.pftPositive:d=e.WindCnt;break;case m.PolyFillType.pftNegative:d=-e.WindCnt;break;default:d=Math.abs(e.WindCnt);break}switch(h){case m.PolyFillType.pftPositive:f=t.WindCnt;break;case m.PolyFillType.pftNegative:f=-t.WindCnt;break;default:f=Math.abs(t.WindCnt);break}if(o&&s)n||a||d!==0&&d!=1||f!==0&&f!=1||e.PolyTyp!=t.PolyTyp&&this.m_ClipType!=m.ClipType.ctXor?this.AddLocalMaxPoly(e,t,i):(this.AddOutPt(e,i),this.AddOutPt(t,i),m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t));else if(o)(f===0||f==1)&&(this.AddOutPt(e,i),m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t));else if(s)(d===0||d==1)&&(this.AddOutPt(t,i),m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t));else if((d===0||d==1)&&(f===0||f==1)&&!n&&!a){var y,g;switch(c){case m.PolyFillType.pftPositive:y=e.WindCnt2;break;case m.PolyFillType.pftNegative:y=-e.WindCnt2;break;default:y=Math.abs(e.WindCnt2);break}switch(p){case m.PolyFillType.pftPositive:g=t.WindCnt2;break;case m.PolyFillType.pftNegative:g=-t.WindCnt2;break;default:g=Math.abs(t.WindCnt2);break}if(e.PolyTyp!=t.PolyTyp)this.AddLocalMinPoly(e,t,i);else if(d==1&&f==1)switch(this.m_ClipType){case m.ClipType.ctIntersection:y>0&&g>0&&this.AddLocalMinPoly(e,t,i);break;case m.ClipType.ctUnion:y<=0&&g<=0&&this.AddLocalMinPoly(e,t,i);break;case m.ClipType.ctDifference:(e.PolyTyp==m.PolyType.ptClip&&y>0&&g>0||e.PolyTyp==m.PolyType.ptSubject&&y<=0&&g<=0)&&this.AddLocalMinPoly(e,t,i);break;case m.ClipType.ctXor:this.AddLocalMinPoly(e,t,i);break}else m.Clipper.SwapSides(e,t)}n!=a&&(n&&e.OutIdx>=0||a&&t.OutIdx>=0)&&(m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t)),n&&this.DeleteFromAEL(e),a&&this.DeleteFromAEL(t)};m.Clipper.prototype.DeleteFromAEL=function(e){var t=e.PrevInAEL,i=e.NextInAEL;t===null&&i===null&&e!=this.m_ActiveEdges||(t!==null?t.NextInAEL=i:this.m_ActiveEdges=i,i!==null&&(i.PrevInAEL=t),e.NextInAEL=null,e.PrevInAEL=null)};m.Clipper.prototype.DeleteFromSEL=function(e){var t=e.PrevInSEL,i=e.NextInSEL;t===null&&i===null&&e!=this.m_SortedEdges||(t!==null?t.NextInSEL=i:this.m_SortedEdges=i,i!==null&&(i.PrevInSEL=t),e.NextInSEL=null,e.PrevInSEL=null)};m.Clipper.prototype.UpdateEdgeIntoAEL=function(e){e.NextInLML===null&&m.Error("UpdateEdgeIntoAEL: invalid call");var t=e.PrevInAEL,i=e.NextInAEL;return e.NextInLML.OutIdx=e.OutIdx,t!==null?t.NextInAEL=e.NextInLML:this.m_ActiveEdges=e.NextInLML,i!==null&&(i.PrevInAEL=e.NextInLML),e.NextInLML.Side=e.Side,e.NextInLML.WindDelta=e.WindDelta,e.NextInLML.WindCnt=e.WindCnt,e.NextInLML.WindCnt2=e.WindCnt2,e=e.NextInLML,e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.PrevInAEL=t,e.NextInAEL=i,m.ClipperBase.IsHorizontal(e)||this.InsertScanbeam(e.Top.Y),e};m.Clipper.prototype.ProcessHorizontals=function(e){for(var t=this.m_SortedEdges;t!==null;)this.DeleteFromSEL(t),this.ProcessHorizontal(t,e),t=this.m_SortedEdges};m.Clipper.prototype.GetHorzDirection=function(e,t){e.Bot.X<e.Top.X?(t.Left=e.Bot.X,t.Right=e.Top.X,t.Dir=m.Direction.dLeftToRight):(t.Left=e.Top.X,t.Right=e.Bot.X,t.Dir=m.Direction.dRightToLeft)};m.Clipper.prototype.PrepareHorzJoins=function(e,t){var i=this.m_PolyOuts[e.OutIdx].Pts;e.Side!=m.EdgeSide.esLeft&&(i=i.Prev),t&&(m.IntPoint.op_Equality(i.Pt,e.Top)?this.AddGhostJoin(i,e.Bot):this.AddGhostJoin(i,e.Top))};m.Clipper.prototype.ProcessHorizontal=function(e,t){var i={Dir:null,Left:null,Right:null};this.GetHorzDirection(e,i);for(var r=i.Dir,n=i.Left,a=i.Right,o=e,s=null;o.NextInLML!==null&&m.ClipperBase.IsHorizontal(o.NextInLML);)o=o.NextInLML;for(o.NextInLML===null&&(s=this.GetMaximaPair(o));;){for(var l=e==o,u=this.GetNextInAEL(e,r);u!==null&&!(u.Curr.X==e.Top.X&&e.NextInLML!==null&&u.Dx<e.NextInLML.Dx);){var h=this.GetNextInAEL(u,r);if(r==m.Direction.dLeftToRight&&u.Curr.X<=a||r==m.Direction.dRightToLeft&&u.Curr.X>=n){if(e.OutIdx>=0&&e.WindDelta!=0&&this.PrepareHorzJoins(e,t),u==s&&l){r==m.Direction.dLeftToRight?this.IntersectEdges(e,u,u.Top,!1):this.IntersectEdges(u,e,u.Top,!1),s.OutIdx>=0&&m.Error("ProcessHorizontal error");return}else if(r==m.Direction.dLeftToRight){var c=new m.IntPoint(u.Curr.X,e.Curr.Y);this.IntersectEdges(e,u,c,!0)}else{var c=new m.IntPoint(u.Curr.X,e.Curr.Y);this.IntersectEdges(u,e,c,!0)}this.SwapPositionsInAEL(e,u)}else if(r==m.Direction.dLeftToRight&&u.Curr.X>=a||r==m.Direction.dRightToLeft&&u.Curr.X<=n)break;u=h}if(e.OutIdx>=0&&e.WindDelta!==0&&this.PrepareHorzJoins(e,t),e.NextInLML!==null&&m.ClipperBase.IsHorizontal(e.NextInLML)){e=this.UpdateEdgeIntoAEL(e),e.OutIdx>=0&&this.AddOutPt(e,e.Bot);var i={Dir:r,Left:n,Right:a};this.GetHorzDirection(e,i),r=i.Dir,n=i.Left,a=i.Right}else break}if(e.NextInLML!==null)if(e.OutIdx>=0){var p=this.AddOutPt(e,e.Top);if(e=this.UpdateEdgeIntoAEL(e),e.WindDelta===0)return;var d=e.PrevInAEL,h=e.NextInAEL;if(d!==null&&d.Curr.X==e.Bot.X&&d.Curr.Y==e.Bot.Y&&d.WindDelta!==0&&d.OutIdx>=0&&d.Curr.Y>d.Top.Y&&m.ClipperBase.SlopesEqual(e,d,this.m_UseFullRange)){var f=this.AddOutPt(d,e.Bot);this.AddJoin(p,f,e.Top)}else if(h!==null&&h.Curr.X==e.Bot.X&&h.Curr.Y==e.Bot.Y&&h.WindDelta!==0&&h.OutIdx>=0&&h.Curr.Y>h.Top.Y&&m.ClipperBase.SlopesEqual(e,h,this.m_UseFullRange)){var f=this.AddOutPt(h,e.Bot);this.AddJoin(p,f,e.Top)}}else e=this.UpdateEdgeIntoAEL(e);else s!==null?s.OutIdx>=0?(r==m.Direction.dLeftToRight?this.IntersectEdges(e,s,e.Top,!1):this.IntersectEdges(s,e,e.Top,!1),s.OutIdx>=0&&m.Error("ProcessHorizontal error")):(this.DeleteFromAEL(e),this.DeleteFromAEL(s)):(e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e))};m.Clipper.prototype.GetNextInAEL=function(e,t){return t==m.Direction.dLeftToRight?e.NextInAEL:e.PrevInAEL};m.Clipper.prototype.IsMinima=function(e){return e!==null&&e.Prev.NextInLML!=e&&e.Next.NextInLML!=e};m.Clipper.prototype.IsMaxima=function(e,t){return e!==null&&e.Top.Y==t&&e.NextInLML===null};m.Clipper.prototype.IsIntermediate=function(e,t){return e.Top.Y==t&&e.NextInLML!==null};m.Clipper.prototype.GetMaximaPair=function(e){var t=null;return m.IntPoint.op_Equality(e.Next.Top,e.Top)&&e.Next.NextInLML===null?t=e.Next:m.IntPoint.op_Equality(e.Prev.Top,e.Top)&&e.Prev.NextInLML===null&&(t=e.Prev),t!==null&&(t.OutIdx==-2||t.NextInAEL==t.PrevInAEL&&!m.ClipperBase.IsHorizontal(t))?null:t};m.Clipper.prototype.ProcessIntersections=function(e,t){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(e,t),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch(i){this.m_SortedEdges=null,this.m_IntersectList.length=0,m.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};m.Clipper.prototype.BuildIntersectList=function(e,t){if(this.m_ActiveEdges!==null){var i=this.m_ActiveEdges;for(this.m_SortedEdges=i;i!==null;)i.PrevInSEL=i.PrevInAEL,i.NextInSEL=i.NextInAEL,i.Curr.X=m.Clipper.TopX(i,t),i=i.NextInAEL;for(var r=!0;r&&this.m_SortedEdges!==null;){for(r=!1,i=this.m_SortedEdges;i.NextInSEL!==null;){var n=i.NextInSEL,a=new m.IntPoint;if(i.Curr.X>n.Curr.X){!this.IntersectPoint(i,n,a)&&i.Curr.X>n.Curr.X+1&&m.Error("Intersection error"),a.Y>e&&(a.Y=e,Math.abs(i.Dx)>Math.abs(n.Dx)?a.X=m.Clipper.TopX(n,e):a.X=m.Clipper.TopX(i,e));var o=new m.IntersectNode;o.Edge1=i,o.Edge2=n,o.Pt.X=a.X,o.Pt.Y=a.Y,this.m_IntersectList.push(o),this.SwapPositionsInSEL(i,n),r=!0}else i=n}if(i.PrevInSEL!==null)i.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};m.Clipper.prototype.EdgesAdjacent=function(e){return e.Edge1.NextInSEL==e.Edge2||e.Edge1.PrevInSEL==e.Edge2};m.Clipper.IntersectNodeSort=function(e,t){return t.Pt.Y-e.Pt.Y};m.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var e=this.m_IntersectList.length,t=0;t<e;t++){if(!this.EdgesAdjacent(this.m_IntersectList[t])){for(var i=t+1;i<e&&!this.EdgesAdjacent(this.m_IntersectList[i]);)i++;if(i==e)return!1;var r=this.m_IntersectList[t];this.m_IntersectList[t]=this.m_IntersectList[i],this.m_IntersectList[i]=r}this.SwapPositionsInSEL(this.m_IntersectList[t].Edge1,this.m_IntersectList[t].Edge2)}return!0};m.Clipper.prototype.ProcessIntersectList=function(){for(var e=0,t=this.m_IntersectList.length;e<t;e++){var i=this.m_IntersectList[e];this.IntersectEdges(i.Edge1,i.Edge2,i.Pt,!0),this.SwapPositionsInAEL(i.Edge1,i.Edge2)}this.m_IntersectList.length=0};var Z6=function(e){return e<0?Math.ceil(e-.5):Math.round(e)},W6=function(e){return e<0?Math.ceil(e-.5):Math.floor(e+.5)},H6=function(e){return e<0?-Math.round(Math.abs(e)):Math.round(e)},K6=function(e){return e<0?(e-=.5,e<-2147483648?Math.ceil(e):e|0):(e+=.5,e>2147483647?Math.floor(e):e|0)};_e.msie?m.Clipper.Round=Z6:_e.chromium?m.Clipper.Round=H6:_e.safari?m.Clipper.Round=K6:m.Clipper.Round=W6;m.Clipper.TopX=function(e,t){return t==e.Top.Y?e.Top.X:e.Bot.X+m.Clipper.Round(e.Dx*(t-e.Bot.Y))};m.Clipper.prototype.IntersectPoint=function(e,t,i){i.X=0,i.Y=0;var r,n;if(m.ClipperBase.SlopesEqual(e,t,this.m_UseFullRange)||e.Dx==t.Dx)return t.Bot.Y>e.Bot.Y?(i.X=t.Bot.X,i.Y=t.Bot.Y):(i.X=e.Bot.X,i.Y=e.Bot.Y),!1;if(e.Delta.X===0)i.X=e.Bot.X,m.ClipperBase.IsHorizontal(t)?i.Y=t.Bot.Y:(n=t.Bot.Y-t.Bot.X/t.Dx,i.Y=m.Clipper.Round(i.X/t.Dx+n));else if(t.Delta.X===0)i.X=t.Bot.X,m.ClipperBase.IsHorizontal(e)?i.Y=e.Bot.Y:(r=e.Bot.Y-e.Bot.X/e.Dx,i.Y=m.Clipper.Round(i.X/e.Dx+r));else{r=e.Bot.X-e.Bot.Y*e.Dx,n=t.Bot.X-t.Bot.Y*t.Dx;var a=(n-r)/(e.Dx-t.Dx);i.Y=m.Clipper.Round(a),Math.abs(e.Dx)<Math.abs(t.Dx)?i.X=m.Clipper.Round(e.Dx*a+r):i.X=m.Clipper.Round(t.Dx*a+n)}if(i.Y<e.Top.Y||i.Y<t.Top.Y){if(e.Top.Y>t.Top.Y)return i.Y=e.Top.Y,i.X=m.Clipper.TopX(t,e.Top.Y),i.X<e.Top.X;i.Y=t.Top.Y,Math.abs(e.Dx)<Math.abs(t.Dx)?i.X=m.Clipper.TopX(e,i.Y):i.X=m.Clipper.TopX(t,i.Y)}return!0};m.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(e){for(var t=this.m_ActiveEdges;t!==null;){var i=this.IsMaxima(t,e);if(i){var r=this.GetMaximaPair(t);i=r===null||!m.ClipperBase.IsHorizontal(r)}if(i){var n=t.PrevInAEL;this.DoMaxima(t),n===null?t=this.m_ActiveEdges:t=n.NextInAEL}else{if(this.IsIntermediate(t,e)&&m.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=m.Clipper.TopX(t,e),t.Curr.Y=e),this.StrictlySimple){var n=t.PrevInAEL;if(t.OutIdx>=0&&t.WindDelta!==0&&n!==null&&n.OutIdx>=0&&n.Curr.X==t.Curr.X&&n.WindDelta!==0){var a=this.AddOutPt(n,t.Curr),o=this.AddOutPt(t,t.Curr);this.AddJoin(a,o,t.Curr)}}t=t.NextInAEL}}for(this.ProcessHorizontals(!0),t=this.m_ActiveEdges;t!==null;){if(this.IsIntermediate(t,e)){var a=null;t.OutIdx>=0&&(a=this.AddOutPt(t,t.Top)),t=this.UpdateEdgeIntoAEL(t);var n=t.PrevInAEL,s=t.NextInAEL;if(n!==null&&n.Curr.X==t.Bot.X&&n.Curr.Y==t.Bot.Y&&a!==null&&n.OutIdx>=0&&n.Curr.Y>n.Top.Y&&m.ClipperBase.SlopesEqual(t,n,this.m_UseFullRange)&&t.WindDelta!==0&&n.WindDelta!==0){var o=this.AddOutPt(n,t.Bot);this.AddJoin(a,o,t.Top)}else if(s!==null&&s.Curr.X==t.Bot.X&&s.Curr.Y==t.Bot.Y&&a!==null&&s.OutIdx>=0&&s.Curr.Y>s.Top.Y&&m.ClipperBase.SlopesEqual(t,s,this.m_UseFullRange)&&t.WindDelta!==0&&s.WindDelta!==0){var o=this.AddOutPt(s,t.Bot);this.AddJoin(a,o,t.Top)}}t=t.NextInAEL}};m.Clipper.prototype.DoMaxima=function(e){var t=this.GetMaximaPair(e);if(t===null){e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e);return}for(var i=e.NextInAEL,r=!0;i!==null&&i!=t;)this.IntersectEdges(e,i,e.Top,!0),this.SwapPositionsInAEL(e,i),i=e.NextInAEL;e.OutIdx==-1&&t.OutIdx==-1?(this.DeleteFromAEL(e),this.DeleteFromAEL(t)):e.OutIdx>=0&&t.OutIdx>=0?this.IntersectEdges(e,t,e.Top,!1):r&&e.WindDelta===0?(e.OutIdx>=0&&(this.AddOutPt(e,e.Top),e.OutIdx=-1),this.DeleteFromAEL(e),t.OutIdx>=0&&(this.AddOutPt(t,e.Top),t.OutIdx=-1),this.DeleteFromAEL(t)):m.Error("DoMaxima error")};m.Clipper.ReversePaths=function(e){for(var t=0,i=e.length;t<i;t++)e[t].reverse()};m.Clipper.Orientation=function(e){return m.Clipper.Area(e)>=0};m.Clipper.prototype.PointCount=function(e){if(e===null)return 0;var t=0,i=e;do t++,i=i.Next;while(i!=e);return t};m.Clipper.prototype.BuildResult=function(e){m.Clear(e);for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var r=this.m_PolyOuts[t];if(r.Pts!==null){var n=r.Pts.Prev,a=this.PointCount(n);if(!(a<2)){for(var o=new Array(a),s=0;s<a;s++)o[s]=n.Pt,n=n.Prev;e.push(o)}}}};m.Clipper.prototype.BuildResult2=function(e){e.Clear();for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var r=this.m_PolyOuts[t],n=this.PointCount(r.Pts);if(!(r.IsOpen&&n<2||!r.IsOpen&&n<3)){this.FixHoleLinkage(r);var a=new m.PolyNode;e.m_AllPolys.push(a),r.PolyNode=a,a.m_polygon.length=n;for(var o=r.Pts.Prev,s=0;s<n;s++)a.m_polygon[s]=o.Pt,o=o.Prev}}for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var r=this.m_PolyOuts[t];r.PolyNode!==null&&(r.IsOpen?(r.PolyNode.IsOpen=!0,e.AddChild(r.PolyNode)):r.FirstLeft!==null&&r.FirstLeft.PolyNode!=null?r.FirstLeft.PolyNode.AddChild(r.PolyNode):e.AddChild(r.PolyNode))}};m.Clipper.prototype.FixupOutPolygon=function(e){var t=null;e.BottomPt=null;for(var i=e.Pts;;){if(i.Prev==i||i.Prev==i.Next){this.DisposeOutPts(i),e.Pts=null;return}if(m.IntPoint.op_Equality(i.Pt,i.Next.Pt)||m.IntPoint.op_Equality(i.Pt,i.Prev.Pt)||m.ClipperBase.SlopesEqual(i.Prev.Pt,i.Pt,i.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(i.Prev.Pt,i.Pt,i.Next.Pt))){t=null;var r=i;i.Prev.Next=i.Next,i.Next.Prev=i.Prev,i=i.Prev,r=null}else{if(i==t)break;t===null&&(t=i),i=i.Next}}e.Pts=i};m.Clipper.prototype.DupOutPt=function(e,t){var i=new m.OutPt;return i.Pt.X=e.Pt.X,i.Pt.Y=e.Pt.Y,i.Idx=e.Idx,t?(i.Next=e.Next,i.Prev=e,e.Next.Prev=i,e.Next=i):(i.Prev=e.Prev,i.Next=e,e.Prev.Next=i,e.Prev=i),i};m.Clipper.prototype.GetOverlap=function(e,t,i,r,n){return e<t?i<r?(n.Left=Math.max(e,i),n.Right=Math.min(t,r)):(n.Left=Math.max(e,r),n.Right=Math.min(t,i)):i<r?(n.Left=Math.max(t,i),n.Right=Math.min(e,r)):(n.Left=Math.max(t,r),n.Right=Math.min(e,i)),n.Left<n.Right};m.Clipper.prototype.JoinHorz=function(e,t,i,r,n,a){var o=e.Pt.X>t.Pt.X?m.Direction.dRightToLeft:m.Direction.dLeftToRight,s=i.Pt.X>r.Pt.X?m.Direction.dRightToLeft:m.Direction.dLeftToRight;if(o==s)return!1;if(o==m.Direction.dLeftToRight){for(;e.Next.Pt.X<=n.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;a&&e.Pt.X!=n.X&&(e=e.Next),t=this.DupOutPt(e,!a),m.IntPoint.op_Inequality(t.Pt,n)&&(e=t,e.Pt.X=n.X,e.Pt.Y=n.Y,t=this.DupOutPt(e,!a))}else{for(;e.Next.Pt.X>=n.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;!a&&e.Pt.X!=n.X&&(e=e.Next),t=this.DupOutPt(e,a),m.IntPoint.op_Inequality(t.Pt,n)&&(e=t,e.Pt.X=n.X,e.Pt.Y=n.Y,t=this.DupOutPt(e,a))}if(s==m.Direction.dLeftToRight){for(;i.Next.Pt.X<=n.X&&i.Next.Pt.X>=i.Pt.X&&i.Next.Pt.Y==n.Y;)i=i.Next;a&&i.Pt.X!=n.X&&(i=i.Next),r=this.DupOutPt(i,!a),m.IntPoint.op_Inequality(r.Pt,n)&&(i=r,i.Pt.X=n.X,i.Pt.Y=n.Y,r=this.DupOutPt(i,!a))}else{for(;i.Next.Pt.X>=n.X&&i.Next.Pt.X<=i.Pt.X&&i.Next.Pt.Y==n.Y;)i=i.Next;!a&&i.Pt.X!=n.X&&(i=i.Next),r=this.DupOutPt(i,a),m.IntPoint.op_Inequality(r.Pt,n)&&(i=r,i.Pt.X=n.X,i.Pt.Y=n.Y,r=this.DupOutPt(i,a))}return o==m.Direction.dLeftToRight==a?(e.Prev=i,i.Next=e,t.Next=r,r.Prev=t):(e.Next=i,i.Prev=e,t.Prev=r,r.Next=t),!0};m.Clipper.prototype.JoinPoints=function(e,t,i){var r=e.OutPt1,n=new m.OutPt,a=e.OutPt2,o=new m.OutPt,s=e.OutPt1.Pt.Y==e.OffPt.Y;if(s&&m.IntPoint.op_Equality(e.OffPt,e.OutPt1.Pt)&&m.IntPoint.op_Equality(e.OffPt,e.OutPt2.Pt)){for(n=e.OutPt1.Next;n!=r&&m.IntPoint.op_Equality(n.Pt,e.OffPt);)n=n.Next;var l=n.Pt.Y>e.OffPt.Y;for(o=e.OutPt2.Next;o!=a&&m.IntPoint.op_Equality(o.Pt,e.OffPt);)o=o.Next;var u=o.Pt.Y>e.OffPt.Y;return l==u?!1:l?(n=this.DupOutPt(r,!1),o=this.DupOutPt(a,!0),r.Prev=a,a.Next=r,n.Next=o,o.Prev=n,e.OutPt1=r,e.OutPt2=n,!0):(n=this.DupOutPt(r,!0),o=this.DupOutPt(a,!1),r.Next=a,a.Prev=r,n.Prev=o,o.Next=n,e.OutPt1=r,e.OutPt2=n,!0)}else if(s){for(n=r;r.Prev.Pt.Y==r.Pt.Y&&r.Prev!=n&&r.Prev!=a;)r=r.Prev;for(;n.Next.Pt.Y==n.Pt.Y&&n.Next!=r&&n.Next!=a;)n=n.Next;if(n.Next==r||n.Next==a)return!1;for(o=a;a.Prev.Pt.Y==a.Pt.Y&&a.Prev!=o&&a.Prev!=n;)a=a.Prev;for(;o.Next.Pt.Y==o.Pt.Y&&o.Next!=a&&o.Next!=r;)o=o.Next;if(o.Next==a||o.Next==r)return!1;var h={Left:null,Right:null};if(!this.GetOverlap(r.Pt.X,n.Pt.X,a.Pt.X,o.Pt.X,h))return!1;var c=h.Left,p=h.Right,d=new m.IntPoint,f;return r.Pt.X>=c&&r.Pt.X<=p?(d.X=r.Pt.X,d.Y=r.Pt.Y,f=r.Pt.X>n.Pt.X):a.Pt.X>=c&&a.Pt.X<=p?(d.X=a.Pt.X,d.Y=a.Pt.Y,f=a.Pt.X>o.Pt.X):n.Pt.X>=c&&n.Pt.X<=p?(d.X=n.Pt.X,d.Y=n.Pt.Y,f=n.Pt.X>r.Pt.X):(d.X=o.Pt.X,d.Y=o.Pt.Y,f=o.Pt.X>a.Pt.X),e.OutPt1=r,e.OutPt2=a,this.JoinHorz(r,n,a,o,d,f)}else{for(n=r.Next;m.IntPoint.op_Equality(n.Pt,r.Pt)&&n!=r;)n=n.Next;var y=n.Pt.Y>r.Pt.Y||!m.ClipperBase.SlopesEqual(r.Pt,n.Pt,e.OffPt,this.m_UseFullRange);if(y){for(n=r.Prev;m.IntPoint.op_Equality(n.Pt,r.Pt)&&n!=r;)n=n.Prev;if(n.Pt.Y>r.Pt.Y||!m.ClipperBase.SlopesEqual(r.Pt,n.Pt,e.OffPt,this.m_UseFullRange))return!1}for(o=a.Next;m.IntPoint.op_Equality(o.Pt,a.Pt)&&o!=a;)o=o.Next;var g=o.Pt.Y>a.Pt.Y||!m.ClipperBase.SlopesEqual(a.Pt,o.Pt,e.OffPt,this.m_UseFullRange);if(g){for(o=a.Prev;m.IntPoint.op_Equality(o.Pt,a.Pt)&&o!=a;)o=o.Prev;if(o.Pt.Y>a.Pt.Y||!m.ClipperBase.SlopesEqual(a.Pt,o.Pt,e.OffPt,this.m_UseFullRange))return!1}return n==r||o==a||n==o||t==i&&y==g?!1:y?(n=this.DupOutPt(r,!1),o=this.DupOutPt(a,!0),r.Prev=a,a.Next=r,n.Next=o,o.Prev=n,e.OutPt1=r,e.OutPt2=n,!0):(n=this.DupOutPt(r,!0),o=this.DupOutPt(a,!1),r.Next=a,a.Prev=r,n.Prev=o,o.Next=n,e.OutPt1=r,e.OutPt2=n,!0)}};m.Clipper.GetBounds=function(e){for(var t=0,i=e.length;t<i&&e[t].length==0;)t++;if(t==i)return new m.IntRect(0,0,0,0);var r=new m.IntRect;for(r.left=e[t][0].X,r.right=r.left,r.top=e[t][0].Y,r.bottom=r.top;t<i;t++)for(var n=0,a=e[t].length;n<a;n++)e[t][n].X<r.left?r.left=e[t][n].X:e[t][n].X>r.right&&(r.right=e[t][n].X),e[t][n].Y<r.top?r.top=e[t][n].Y:e[t][n].Y>r.bottom&&(r.bottom=e[t][n].Y);return r};m.Clipper.prototype.GetBounds2=function(e){var t=e,i=new m.IntRect;for(i.left=e.Pt.X,i.right=e.Pt.X,i.top=e.Pt.Y,i.bottom=e.Pt.Y,e=e.Next;e!=t;)e.Pt.X<i.left&&(i.left=e.Pt.X),e.Pt.X>i.right&&(i.right=e.Pt.X),e.Pt.Y<i.top&&(i.top=e.Pt.Y),e.Pt.Y>i.bottom&&(i.bottom=e.Pt.Y),e=e.Next;return i};m.Clipper.PointInPolygon=function(e,t){var i=0,r=t.length;if(r<3)return 0;for(var n=t[0],a=1;a<=r;++a){var o=a==r?t[0]:t[a];if(o.Y==e.Y&&(o.X==e.X||n.Y==e.Y&&o.X>e.X==n.X<e.X))return-1;if(n.Y<e.Y!=o.Y<e.Y){if(n.X>=e.X)if(o.X>e.X)i=1-i;else{var s=(n.X-e.X)*(o.Y-e.Y)-(o.X-e.X)*(n.Y-e.Y);if(s==0)return-1;s>0==o.Y>n.Y&&(i=1-i)}else if(o.X>e.X){var s=(n.X-e.X)*(o.Y-e.Y)-(o.X-e.X)*(n.Y-e.Y);if(s==0)return-1;s>0==o.Y>n.Y&&(i=1-i)}}n=o}return i};m.Clipper.prototype.PointInPolygon=function(e,t){for(var i=0,r=t;;){var n=t.Pt.X,a=t.Pt.Y,o=t.Next.Pt.X,s=t.Next.Pt.Y;if(s==e.Y&&(o==e.X||a==e.Y&&o>e.X==n<e.X))return-1;if(a<e.Y!=s<e.Y){if(n>=e.X)if(o>e.X)i=1-i;else{var l=(n-e.X)*(s-e.Y)-(o-e.X)*(a-e.Y);if(l==0)return-1;l>0==s>a&&(i=1-i)}else if(o>e.X){var l=(n-e.X)*(s-e.Y)-(o-e.X)*(a-e.Y);if(l==0)return-1;l>0==s>a&&(i=1-i)}}if(t=t.Next,r==t)break}return i};m.Clipper.prototype.Poly2ContainsPoly1=function(e,t){var i=e;do{var r=this.PointInPolygon(i.Pt,t);if(r>=0)return r!=0;i=i.Next}while(i!=e);return!0};m.Clipper.prototype.FixupFirstLefts1=function(e,t){for(var i=0,r=this.m_PolyOuts.length;i<r;i++){var n=this.m_PolyOuts[i];n.Pts!==null&&n.FirstLeft==e&&this.Poly2ContainsPoly1(n.Pts,t.Pts)&&(n.FirstLeft=t)}};m.Clipper.prototype.FixupFirstLefts2=function(e,t){for(var i=0,r=this.m_PolyOuts,n=r.length,a=r[i];i<n;i++,a=r[i])a.FirstLeft==e&&(a.FirstLeft=t)};m.Clipper.ParseFirstLeft=function(e){for(;e!=null&&e.Pts==null;)e=e.FirstLeft;return e};m.Clipper.prototype.JoinCommonEdges=function(){for(var e=0,t=this.m_Joins.length;e<t;e++){var i=this.m_Joins[e],r=this.GetOutRec(i.OutPt1.Idx),n=this.GetOutRec(i.OutPt2.Idx);if(!(r.Pts==null||n.Pts==null)){var a;if(r==n?a=r:this.Param1RightOfParam2(r,n)?a=n:this.Param1RightOfParam2(n,r)?a=r:a=this.GetLowermostRec(r,n),!!this.JoinPoints(i,r,n))if(r==n){if(r.Pts=i.OutPt1,r.BottomPt=null,n=this.CreateOutRec(),n.Pts=i.OutPt2,this.UpdateOutPtIdxs(n),this.m_UsingPolyTree)for(var o=0,s=this.m_PolyOuts.length;o<s-1;o++){var l=this.m_PolyOuts[o];l.Pts==null||m.Clipper.ParseFirstLeft(l.FirstLeft)!=r||l.IsHole==r.IsHole||this.Poly2ContainsPoly1(l.Pts,i.OutPt2)&&(l.FirstLeft=n)}this.Poly2ContainsPoly1(n.Pts,r.Pts)?(n.IsHole=!r.IsHole,n.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,r),(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)):this.Poly2ContainsPoly1(r.Pts,n.Pts)?(n.IsHole=r.IsHole,r.IsHole=!n.IsHole,n.FirstLeft=r.FirstLeft,r.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(r,n),(r.IsHole^this.ReverseSolution)==this.Area(r)>0&&this.ReversePolyPtLinks(r.Pts)):(n.IsHole=r.IsHole,n.FirstLeft=r.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(r,n))}else n.Pts=null,n.BottomPt=null,n.Idx=r.Idx,r.IsHole=a.IsHole,a==n&&(r.FirstLeft=n.FirstLeft),n.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,r)}}};m.Clipper.prototype.UpdateOutPtIdxs=function(e){var t=e.Pts;do t.Idx=e.Idx,t=t.Prev;while(t!=e.Pts)};m.Clipper.prototype.DoSimplePolygons=function(){for(var e=0;e<this.m_PolyOuts.length;){var t=this.m_PolyOuts[e++],i=t.Pts;if(i!==null)do{for(var r=i.Next;r!=t.Pts;){if(m.IntPoint.op_Equality(i.Pt,r.Pt)&&r.Next!=i&&r.Prev!=i){var n=i.Prev,a=r.Prev;i.Prev=a,a.Next=i,r.Prev=n,n.Next=r,t.Pts=i;var o=this.CreateOutRec();o.Pts=r,this.UpdateOutPtIdxs(o),this.Poly2ContainsPoly1(o.Pts,t.Pts)?(o.IsHole=!t.IsHole,o.FirstLeft=t):this.Poly2ContainsPoly1(t.Pts,o.Pts)?(o.IsHole=t.IsHole,t.IsHole=!o.IsHole,o.FirstLeft=t.FirstLeft,t.FirstLeft=o):(o.IsHole=t.IsHole,o.FirstLeft=t.FirstLeft),r=i}r=r.Next}i=i.Next}while(i!=t.Pts)}};m.Clipper.Area=function(e){var t=e.length;if(t<3)return 0;for(var i=0,r=0,n=t-1;r<t;++r)i+=(e[n].X+e[r].X)*(e[n].Y-e[r].Y),n=r;return-i*.5};m.Clipper.prototype.Area=function(e){var t=e.Pts;if(t==null)return 0;var i=0;do i=i+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!=e.Pts);return i*.5};Hv&&(m.Clipper.OffsetPaths=function(e,t,i,r,n){var a=new m.Paths,o=new m.ClipperOffset(n,n);return o.AddPaths(e,i,r),o.Execute(a,t),a});m.Clipper.SimplifyPolygon=function(e,t){var i=new Array,r=new m.Clipper(0);return r.StrictlySimple=!0,r.AddPath(e,m.PolyType.ptSubject,!0),r.Execute(m.ClipType.ctUnion,i,t,t),i};m.Clipper.SimplifyPolygons=function(e,t){typeof t>"u"&&(t=m.PolyFillType.pftEvenOdd);var i=new Array,r=new m.Clipper(0);return r.StrictlySimple=!0,r.AddPaths(e,m.PolyType.ptSubject,!0),r.Execute(m.ClipType.ctUnion,i,t,t),i};m.Clipper.DistanceSqrd=function(e,t){var i=e.X-t.X,r=e.Y-t.Y;return i*i+r*r};m.Clipper.DistanceFromLineSqrd=function(e,t,i){var r=t.Y-i.Y,n=i.X-t.X,a=r*t.X+n*t.Y;return a=r*e.X+n*e.Y-a,a*a/(r*r+n*n)};m.Clipper.SlopesNearCollinear=function(e,t,i,r){return m.Clipper.DistanceFromLineSqrd(t,e,i)<r};m.Clipper.PointsAreClose=function(e,t,i){var r=e.X-t.X,n=e.Y-t.Y;return r*r+n*n<=i};m.Clipper.ExcludeOp=function(e){var t=e.Prev;return t.Next=e.Next,e.Next.Prev=t,t.Idx=0,t};m.Clipper.CleanPolygon=function(e,t){typeof t>"u"&&(t=1.415);var i=e.length;if(i==0)return new Array;for(var r=new Array(i),n=0;n<i;++n)r[n]=new m.OutPt;for(var n=0;n<i;++n)r[n].Pt=e[n],r[n].Next=r[(n+1)%i],r[n].Next.Prev=r[n],r[n].Idx=0;for(var a=t*t,o=r[0];o.Idx==0&&o.Next!=o.Prev;)m.Clipper.PointsAreClose(o.Pt,o.Prev.Pt,a)?(o=m.Clipper.ExcludeOp(o),i--):m.Clipper.PointsAreClose(o.Prev.Pt,o.Next.Pt,a)?(m.Clipper.ExcludeOp(o.Next),o=m.Clipper.ExcludeOp(o),i-=2):m.Clipper.SlopesNearCollinear(o.Prev.Pt,o.Pt,o.Next.Pt,a)?(o=m.Clipper.ExcludeOp(o),i--):(o.Idx=1,o=o.Next);i<3&&(i=0);for(var s=new Array(i),n=0;n<i;++n)s[n]=new m.IntPoint(o.Pt),o=o.Next;return r=null,s};m.Clipper.CleanPolygons=function(e,t){for(var i=new Array(e.length),r=0,n=e.length;r<n;r++)i[r]=m.Clipper.CleanPolygon(e[r],t);return i};m.Clipper.Minkowski=function(e,t,i,r){var n=r?1:0,a=e.length,o=t.length,s=new Array;if(i)for(var l=0;l<o;l++){for(var u=new Array(a),h=0,c=e.length,p=e[h];h<c;h++,p=e[h])u[h]=new m.IntPoint(t[l].X+p.X,t[l].Y+p.Y);s.push(u)}else for(var l=0;l<o;l++){for(var u=new Array(a),h=0,c=e.length,p=e[h];h<c;h++,p=e[h])u[h]=new m.IntPoint(t[l].X-p.X,t[l].Y-p.Y);s.push(u)}for(var d=new Array,l=0;l<o-1+n;l++)for(var h=0;h<a;h++){var f=new Array;f.push(s[l%o][h%a]),f.push(s[(l+1)%o][h%a]),f.push(s[(l+1)%o][(h+1)%a]),f.push(s[l%o][(h+1)%a]),m.Clipper.Orientation(f)||f.reverse(),d.push(f)}var y=new m.Clipper(0);return y.AddPaths(d,m.PolyType.ptSubject,!0),y.Execute(m.ClipType.ctUnion,s,m.PolyFillType.pftNonZero,m.PolyFillType.pftNonZero),s};m.Clipper.MinkowskiSum=function(){var e=arguments,t=e.length;if(t==3){var i=e[0],r=e[1],n=e[2];return m.Clipper.Minkowski(i,r,!0,n)}else if(t==4){for(var i=e[0],a=e[1],o=e[2],n=e[3],s=new m.Clipper,l,u=0,h=a.length;u<h;++u){var l=m.Clipper.Minkowski(i,a[u],!0,n);s.AddPaths(l,m.PolyType.ptSubject,!0)}n&&s.AddPaths(a,m.PolyType.ptClip,!0);var c=new m.Paths;return s.Execute(m.ClipType.ctUnion,c,o,o),c}};m.Clipper.MinkowskiDiff=function(e,t,i){return m.Clipper.Minkowski(e,t,!1,i)};m.Clipper.PolyTreeToPaths=function(e){var t=new Array;return m.Clipper.AddPolyNodeToPaths(e,m.Clipper.NodeType.ntAny,t),t};m.Clipper.AddPolyNodeToPaths=function(e,t,i){var r=!0;switch(t){case m.Clipper.NodeType.ntOpen:return;case m.Clipper.NodeType.ntClosed:r=!e.IsOpen;break;default:break}e.m_polygon.length>0&&r&&i.push(e.m_polygon);for(var n=0,a=e.Childs(),o=a.length,s=a[n];n<o;n++,s=a[n])m.Clipper.AddPolyNodeToPaths(s,t,i)};m.Clipper.OpenPathsFromPolyTree=function(e){for(var t=new m.Paths,i=0,r=e.ChildCount();i<r;i++)e.Childs()[i].IsOpen&&t.push(e.Childs()[i].m_polygon);return t};m.Clipper.ClosedPathsFromPolyTree=function(e){var t=new m.Paths;return m.Clipper.AddPolyNodeToPaths(e,m.Clipper.NodeType.ntClosed,t),t};hu(m.Clipper,m.ClipperBase);m.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};m.ClipperOffset=function(e,t){typeof e>"u"&&(e=2),typeof t>"u"&&(t=m.ClipperOffset.def_arc_tolerance),this.m_destPolys=new m.Paths,this.m_srcPoly=new m.Path,this.m_destPoly=new m.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new m.IntPoint,this.m_polyNodes=new m.PolyNode,this.MiterLimit=e,this.ArcTolerance=t,this.m_lowest.X=-1};m.ClipperOffset.two_pi=6.28318530717959;m.ClipperOffset.def_arc_tolerance=.25;m.ClipperOffset.prototype.Clear=function(){m.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};m.ClipperOffset.Round=m.Clipper.Round;m.ClipperOffset.prototype.AddPath=function(e,t,i){var r=e.length-1;if(!(r<0)){var n=new m.PolyNode;if(n.m_jointype=t,n.m_endtype=i,i==m.EndType.etClosedLine||i==m.EndType.etClosedPolygon)for(;r>0&&m.IntPoint.op_Equality(e[0],e[r]);)r--;n.m_polygon.push(e[0]);for(var a=0,o=0,s=1;s<=r;s++)m.IntPoint.op_Inequality(n.m_polygon[a],e[s])&&(a++,n.m_polygon.push(e[s]),(e[s].Y>n.m_polygon[o].Y||e[s].Y==n.m_polygon[o].Y&&e[s].X<n.m_polygon[o].X)&&(o=a));if(!(i==m.EndType.etClosedPolygon&&a<2||i!=m.EndType.etClosedPolygon&&a<0)&&(this.m_polyNodes.AddChild(n),i==m.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new m.IntPoint(0,o);else{var l=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[o].Y>l.Y||n.m_polygon[o].Y==l.Y&&n.m_polygon[o].X<l.X)&&(this.m_lowest=new m.IntPoint(this.m_polyNodes.ChildCount()-1,o))}}};m.ClipperOffset.prototype.AddPaths=function(e,t,i){for(var r=0,n=e.length;r<n;r++)this.AddPath(e[r],t,i)};m.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!m.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];(t.m_endtype==m.EndType.etClosedPolygon||t.m_endtype==m.EndType.etClosedLine&&m.Clipper.Orientation(t.m_polygon))&&t.m_polygon.reverse()}else for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];t.m_endtype==m.EndType.etClosedLine&&!m.Clipper.Orientation(t.m_polygon)&&t.m_polygon.reverse()}};m.ClipperOffset.GetUnitNormal=function(e,t){var i=t.X-e.X,r=t.Y-e.Y;if(i==0&&r==0)return new m.DoublePoint(0,0);var n=1/Math.sqrt(i*i+r*r);return i*=n,r*=n,new m.DoublePoint(r,-i)};m.ClipperOffset.prototype.DoOffset=function(e){if(this.m_destPolys=new Array,this.m_delta=e,m.ClipperBase.near_zero(e)){for(var t=0;t<this.m_polyNodes.ChildCount();t++){var i=this.m_polyNodes.Childs()[t];i.m_endtype==m.EndType.etClosedPolygon&&this.m_destPolys.push(i.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var r;this.ArcTolerance<=0?r=m.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(e)*m.ClipperOffset.def_arc_tolerance?r=Math.abs(e)*m.ClipperOffset.def_arc_tolerance:r=this.ArcTolerance;var n=3.14159265358979/Math.acos(1-r/Math.abs(e));this.m_sin=Math.sin(m.ClipperOffset.two_pi/n),this.m_cos=Math.cos(m.ClipperOffset.two_pi/n),this.m_StepsPerRad=n/m.ClipperOffset.two_pi,e<0&&(this.m_sin=-this.m_sin);for(var t=0;t<this.m_polyNodes.ChildCount();t++){var i=this.m_polyNodes.Childs()[t];this.m_srcPoly=i.m_polygon;var a=this.m_srcPoly.length;if(!(a==0||e<=0&&(a<3||i.m_endtype!=m.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,a==1){if(i.m_jointype==m.JoinType.jtRound)for(var o=1,s=0,l=1;l<=n;l++){this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X+o*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y+s*e)));var u=o;o=o*this.m_cos-this.m_sin*s,s=u*this.m_sin+s*this.m_cos}else for(var o=-1,s=-1,l=0;l<4;++l)this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X+o*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y+s*e))),o<0?o=1:s<0?s=1:o=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var l=0;l<a-1;l++)this.m_normals.push(m.ClipperOffset.GetUnitNormal(this.m_srcPoly[l],this.m_srcPoly[l+1]));if(i.m_endtype==m.EndType.etClosedLine||i.m_endtype==m.EndType.etClosedPolygon?this.m_normals.push(m.ClipperOffset.GetUnitNormal(this.m_srcPoly[a-1],this.m_srcPoly[0])):this.m_normals.push(new m.DoublePoint(this.m_normals[a-2])),i.m_endtype==m.EndType.etClosedPolygon){for(var h=a-1,l=0;l<a;l++)h=this.OffsetPoint(l,h,i.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(i.m_endtype==m.EndType.etClosedLine){for(var h=a-1,l=0;l<a;l++)h=this.OffsetPoint(l,h,i.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var c=this.m_normals[a-1],l=a-1;l>0;l--)this.m_normals[l]=new m.DoublePoint(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new m.DoublePoint(-c.X,-c.Y),h=0;for(var l=a-1;l>=0;l--)h=this.OffsetPoint(l,h,i.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var h=0,l=1;l<a-1;++l)h=this.OffsetPoint(l,h,i.m_jointype);var p;if(i.m_endtype==m.EndType.etOpenButt){var l=a-1;p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[l].X+this.m_normals[l].X*e),m.ClipperOffset.Round(this.m_srcPoly[l].Y+this.m_normals[l].Y*e)),this.m_destPoly.push(p),p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[l].X-this.m_normals[l].X*e),m.ClipperOffset.Round(this.m_srcPoly[l].Y-this.m_normals[l].Y*e)),this.m_destPoly.push(p)}else{var l=a-1;h=a-2,this.m_sinA=0,this.m_normals[l]=new m.DoublePoint(-this.m_normals[l].X,-this.m_normals[l].Y),i.m_endtype==m.EndType.etOpenSquare?this.DoSquare(l,h):this.DoRound(l,h)}for(var l=a-1;l>0;l--)this.m_normals[l]=new m.DoublePoint(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new m.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),h=a-1;for(var l=h-1;l>0;--l)h=this.OffsetPoint(l,h,i.m_jointype);i.m_endtype==m.EndType.etOpenButt?(p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*e)),this.m_destPoly.push(p),p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*e)),this.m_destPoly.push(p)):(h=1,this.m_sinA=0,i.m_endtype==m.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};m.ClipperOffset.prototype.Execute=function(){var e=arguments,t=e[0]instanceof m.PolyTree;if(t){var i=e[0],r=e[1];i.Clear(),this.FixOrientations(),this.DoOffset(r);var n=new m.Clipper(0);if(n.AddPaths(this.m_destPolys,m.PolyType.ptSubject,!0),r>0)n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftPositive,m.PolyFillType.pftPositive);else{var a=m.Clipper.GetBounds(this.m_destPolys),o=new m.Path;if(o.push(new m.IntPoint(a.left-10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.top-10)),o.push(new m.IntPoint(a.left-10,a.top-10)),n.AddPath(o,m.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftNegative,m.PolyFillType.pftNegative),i.ChildCount()==1&&i.Childs()[0].ChildCount()>0){var s=i.Childs()[0];i.Childs()[0]=s.Childs()[0];for(var l=1;l<s.ChildCount();l++)i.AddChild(s.Childs()[l])}else i.Clear()}}else{var i=e[0],r=e[1];m.Clear(i),this.FixOrientations(),this.DoOffset(r);var n=new m.Clipper(0);if(n.AddPaths(this.m_destPolys,m.PolyType.ptSubject,!0),r>0)n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftPositive,m.PolyFillType.pftPositive);else{var a=m.Clipper.GetBounds(this.m_destPolys),o=new m.Path;o.push(new m.IntPoint(a.left-10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.top-10)),o.push(new m.IntPoint(a.left-10,a.top-10)),n.AddPath(o,m.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftNegative,m.PolyFillType.pftNegative),i.length>0&&i.splice(0,1)}}};m.ClipperOffset.prototype.OffsetPoint=function(e,t,i){if(this.m_sinA=this.m_normals[t].X*this.m_normals[e].Y-this.m_normals[e].X*this.m_normals[t].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return t;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[t].X*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[t].Y*this.m_delta))),this.m_destPoly.push(new m.IntPoint(this.m_srcPoly[e])),this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)));else switch(i){case m.JoinType.jtMiter:{var r=1+(this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y);r>=this.m_miterLim?this.DoMiter(e,t,r):this.DoSquare(e,t);break}case m.JoinType.jtSquare:this.DoSquare(e,t);break;case m.JoinType.jtRound:this.DoRound(e,t);break}return t=e,t};m.ClipperOffset.prototype.DoSquare=function(e,t){var i=Math.tan(Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y)/4);this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*i)),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[t].Y+this.m_normals[t].X*i)))),this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[e].X+this.m_normals[e].Y*i)),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[e].Y-this.m_normals[e].X*i))))};m.ClipperOffset.prototype.DoMiter=function(e,t,i){var r=this.m_delta/i;this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+(this.m_normals[t].X+this.m_normals[e].X)*r),m.ClipperOffset.Round(this.m_srcPoly[e].Y+(this.m_normals[t].Y+this.m_normals[e].Y)*r)))};m.ClipperOffset.prototype.DoRound=function(e,t){for(var i=Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y),r=m.Cast_Int32(m.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(i))),n=this.m_normals[t].X,a=this.m_normals[t].Y,o,s=0;s<r;++s)this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+n*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+a*this.m_delta))),o=n,n=n*this.m_cos-this.m_sin*a,a=o*this.m_sin+a*this.m_cos;this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)))};m.Error=function(e){try{throw new Error(e)}catch(t){alert(t.message)}};m.JS={};m.JS.AreaOfPolygon=function(e,t){return t||(t=1),m.Clipper.Area(e)/(t*t)};m.JS.AreaOfPolygons=function(e,t){t||(t=1);for(var i=0,r=0;r<e.length;r++)i+=m.Clipper.Area(e[r]);return i/(t*t)};m.JS.BoundsOfPath=function(e,t){return m.JS.BoundsOfPaths([e],t)};m.JS.BoundsOfPaths=function(e,t){t||(t=1);var i=m.Clipper.GetBounds(e);return i.left/=t,i.bottom/=t,i.right/=t,i.top/=t,i};m.JS.Clean=function(r,t){if(!(r instanceof Array))return[];var i=r[0]instanceof Array,r=m.JS.Clone(r);if(typeof t!="number"||t===null)return m.Error("Delta is not a number in Clean()."),r;if(r.length===0||r.length==1&&r[0].length===0||t<0)return r;i||(r=[r]);for(var n=r.length,a,o,s,l,u,h,c,p=[],d=0;d<n;d++)if(o=r[d],a=o.length,a!==0){if(a<3){s=o,p.push(s);continue}for(s=o,l=t*t,u=o[0],h=1,c=1;c<a;c++)(o[c].X-u.X)*(o[c].X-u.X)+(o[c].Y-u.Y)*(o[c].Y-u.Y)<=l||(s[h]=o[c],u=o[c],h++);u=o[h-1],(o[0].X-u.X)*(o[0].X-u.X)+(o[0].Y-u.Y)*(o[0].Y-u.Y)<=l&&h--,h<a&&s.splice(h,a-h),s.length&&p.push(s)}return!i&&p.length?p=p[0]:!i&&p.length===0?p=[]:i&&p.length===0&&(p=[[]]),p};m.JS.Clone=function(e){if(!(e instanceof Array))return[];if(e.length===0)return[];if(e.length==1&&e[0].length===0)return[[]];var t=e[0]instanceof Array;t||(e=[e]);var i=e.length,r,n,a,o,s=new Array(i);for(n=0;n<i;n++){for(r=e[n].length,o=new Array(r),a=0;a<r;a++)o[a]={X:e[n][a].X,Y:e[n][a].Y};s[n]=o}return t||(s=s[0]),s};m.JS.Lighten=function(e,t){if(!(e instanceof Array))return[];if(typeof t!="number"||t===null)return m.Error("Tolerance is not a number in Lighten()."),m.JS.Clone(e);if(e.length===0||e.length==1&&e[0].length===0||t<0)return m.JS.Clone(e);e[0]instanceof Array||(e=[e]);var i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v=e.length,w=t*t,P=[];for(i=0;i<v;i++)if(n=e[i],s=n.length,s!=0){for(a=0;a<1e6;a++){for(o=[],s=n.length,n[s-1].X!=n[0].X||n[s-1].Y!=n[0].Y?(d=1,n.push({X:n[0].X,Y:n[0].Y}),s=n.length):d=0,p=[],r=0;r<s-2;r++)l=n[r],h=n[r+1],u=n[r+2],_=l.X,b=l.Y,f=u.X-_,y=u.Y-b,(f!==0||y!==0)&&(g=((h.X-_)*f+(h.Y-b)*y)/(f*f+y*y),g>1?(_=u.X,b=u.Y):g>0&&(_+=f*g,b+=y*g)),f=h.X-_,y=h.Y-b,c=f*f+y*y,c<=w&&(p[r+1]=1,r++);for(o.push({X:n[0].X,Y:n[0].Y}),r=1;r<s-1;r++)p[r]||o.push({X:n[r].X,Y:n[r].Y});if(o.push({X:n[s-1].X,Y:n[s-1].Y}),d&&n.pop(),p.length)n=o;else break}s=o.length,o[s-1].X==o[0].X&&o[s-1].Y==o[0].Y&&o.pop(),o.length>2&&P.push(o)}return!e[0]instanceof Array&&(P=P[0]),typeof P>"u"&&(P=[[]]),P};m.JS.PerimeterOfPath=function(e,t,i){if(typeof e>"u")return 0;var r=Math.sqrt,n=0,a,o,s=0,l=0,u=0,h=0,c=e.length;if(c<2)return 0;for(t&&(e[c]=e[0],c++);--c;)a=e[c],s=a.X,l=a.Y,o=e[c-1],u=o.X,h=o.Y,n+=r((s-u)*(s-u)+(l-h)*(l-h));return t&&e.pop(),n/i};m.JS.PerimeterOfPaths=function(e,t,i){i||(i=1);for(var r=0,n=0;n<e.length;n++)r+=m.JS.PerimeterOfPath(e[n],t,i);return r};m.JS.ScaleDownPath=function(e,t){var i,r;for(t||(t=1),i=e.length;i--;)r=e[i],r.X=r.X/t,r.Y=r.Y/t};m.JS.ScaleDownPaths=function(e,t){var i,r,n,a=Math.round;for(t||(t=1),i=e.length;i--;)for(r=e[i].length;r--;)n=e[i][r],n.X=n.X/t,n.Y=n.Y/t};m.JS.ScaleUpPath=function(e,t){var i,r,n=Math.round;for(t||(t=1),i=e.length;i--;)r=e[i],r.X=n(r.X*t),r.Y=n(r.Y*t)};m.JS.ScaleUpPaths=function(e,t){var i,r,n,a=Math.round;for(t||(t=1),i=e.length;i--;)for(r=e[i].length;r--;)n=e[i][r],n.X=a(n.X*t),n.Y=a(n.Y*t)};m.ExPolygons=function(){return[]};m.ExPolygon=function(){this.outer=null,this.holes=null};m.JS.AddOuterPolyNodeToExPolygons=function(e,t){var i=new m.ExPolygon;i.outer=e.Contour();var r=e.Childs(),n=r.length;i.holes=new Array(n);var a,o,s,l,u,h;for(s=0;s<n;s++)for(a=r[s],i.holes[s]=a.Contour(),l=0,u=a.Childs(),h=u.length;l<h;l++)o=u[l],m.JS.AddOuterPolyNodeToExPolygons(o,t);t.push(i)};m.JS.ExPolygonsToPaths=function(e){var t,i,r,n,a=new m.Paths;for(t=0,r=e.length;t<r;t++)for(a.push(e[t].outer),i=0,n=e[t].holes.length;i<n;i++)a.push(e[t].holes[i]);return a};m.JS.PolyTreeToExPolygons=function(e){var t=new m.ExPolygons,i,r,n,a;for(r=0,n=e.Childs(),a=n.length;r<a;r++)i=n[r],m.JS.AddOuterPolyNodeToExPolygons(i,t);return t};Do.exports=m});F();var jo="[MappedinJS]",M1=(n=>(n[n.LOG=0]="LOG",n[n.WARN=1]="WARN",n[n.ERROR=2]="ERROR",n[n.SILENT=3]="SILENT",n))(M1||{});function C1(e="",{prefix:t=jo}={}){let i="".concat(t).concat(e?"-".concat(e):""),r=(n,a)=>{if(typeof window<"u"&&window.rnDebug){let o=a.map(s=>s instanceof Error&&s.stack?"".concat(s.message,"\n").concat(s.stack):s);window.rnDebug("".concat(e," ").concat(n,": ").concat(o.join(" ")))}};return{logState:Y.env.NODE_ENV==="test"?3:0,log(...n){this.logState<=0&&(console.log(i,...n),r("log",n))},warn(...n){this.logState<=1&&(console.warn(i,...n),r("warn",n))},error(...n){this.logState<=2&&(console.error(i,...n),r("error",n))},assert(...n){console.assert(...n)},time(n){console.time(n)},timeEnd(n){console.timeEnd(n)},setLevel(n){0<=n&&n<=3&&(this.logState=n)}}}var Fd=C1();function SN(e){0<=e&&e<=3&&(Fd.logState=e)}var ot=Fd;F();F();var zr=class extends Error{};zr.prototype.name="InvalidTokenError";function I1(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,i)=>{let r=i.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function A1(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return I1(t)}catch(i){return atob(t)}}function Bd(e,t){if(typeof e!="string")throw new zr("Invalid token specified: must be a string");t||(t={});let i=t.header===!0?0:1,r=e.split(".")[i];if(typeof r!="string")throw new zr("Invalid token specified: missing part #".concat(i+1));let n;try{n=A1(r)}catch(a){throw new zr("Invalid token specified: invalid base64 for part #".concat(i+1," (").concat(a.message,")"))}try{return JSON.parse(n)}catch(a){throw new zr("Invalid token specified: invalid json for part #".concat(i+1," (").concat(a.message,")"))}}F();var ji=63710088e-1;F();function E1(e,t,i,r){return(e<t||e>i)&&ot.warn(r),Math.min(i,Math.max(t,e))}F();function k1(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function VN(e){var i,r;let t=Bd(e);if(t.sub==null)throw new Error("Access token is missing sub claim.");return{sub:t.sub,aud:typeof t.aud=="string"?[t.aud]:(i=t.aud)!=null?i:[],capabilities:(r=t.capabilities)!=null?r:{}}}function Fr(e){return e*(Math.PI/180)}function Rd(e){return e*(180/Math.PI)}function jN(e,t){let i=Math.pow(10,t);return Math.sign(e)*Math.round(Math.abs(e)*i)/i}function Od(e,t){return(e%t+t)%t}function GN(e,t){let i=Od(e,Math.PI*2),r=Od(t,Math.PI*2),n=r-i,a=r+(n>Math.PI?-Math.PI*2:n<-Math.PI?Math.PI*2:0);return{start:i,end:a}}function D1(e){return e instanceof No?Number.isFinite(e.min.x)&&Number.isFinite(e.min.y)&&Number.isFinite(e.max.x)&&Number.isFinite(e.max.y):Number.isFinite(e.min.x)&&Number.isFinite(e.min.y)&&Number.isFinite(e.max.x)&&Number.isFinite(e.max.y)&&Number.isFinite(e.min.z)&&Number.isFinite(e.max.z)}function UN(){return typeof window<"u"&&window!==null}function XN(e,t){let[i,r]=e,[n,a]=t,o=Fr(n-i),s=Fr(a-r);return Math.sqrt(o*o+s*s)*ji}function $N(e,t){let[i,r]=e.map(h=>Fr(h)),[n,a]=t.map(h=>Fr(h)),o=a-r,l=(n-i)*Math.cos((r+a)/2),u=o;return Math.sqrt(l*l+u*u)*ji}function qN(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function YN(e){let t=Fr(e),r=Math.cos(t)*ji;function n(o,s){let l=Fr(o[0]),u=Fr(o[1]),h=l*r,c=u*ji;return s?(s.x=h,s.y=c,s):{x:h,y:c}}return{toCartesian:n,toGeographic:(o,s)=>{let l=Rd(o/r),u=Rd(s/ji);return{lon:l,lat:u}}}}F();function L1(e,t,i=!1){let r=null,n=0,a=function(...o){n++,n===1&&i===!0&&e(...o);let s=()=>{(!i||n>1)&&e(...o),r=null,n=0};clearTimeout(r),r=setTimeout(s,t)};return a.cancel=function(){r&&(clearTimeout(r),r=null),n=0},a}function JN(e,t,i){let r=null,n=null,a,o=null,s=0;i||(i={});let l=function(){s=i.leading===!1?0:Date.now(),o=null,n&&(a=e.apply(r,n)),o||(r=n=null)};return function(...u){let h=Date.now();!s&&i.leading===!1&&(s=h);let c=t-(h-s);return c<=0||c>t?(o&&(clearTimeout(o),o=null),s=h,a=e.apply(this,u),o||(r=n=null)):!o&&i.trailing!==!1&&(r=this,n=u,o=setTimeout(l,c)),a}}F();var z1=(e,{id:t}={})=>{let i=Array.isArray(e)?e:[e];if(!i.every(a=>typeof a=="string"))return;let r=i.join(""),n=null;if(t){let a=document.getElementById(t);a instanceof HTMLStyleElement&&(n=a)}n==null&&(n=document.createElement("style")),t&&t!==""&&(n.id=t),n.textContent=r,document.head.appendChild(n)};F();F();function F1(e,t){return"".concat(t," ").concat(e)}var ua=class extends Error{constructor(t,i=jo){super(F1(t,i)),this.name="MappedinError"}},Nd=class extends ua{constructor(t,i=jo){super(t,i),this.name="MappedinRenderError"}};F();var Mu=class e extends Error{constructor(i){super(i);S(this,"name","AssertionError");Error.captureStackTrace&&Error.captureStackTrace(this,e)}};function Vd(e,t){if(e==null){let i;if(t!=null&&t.customMessage)i=t.customMessage;else{let a=t!=null&&t.valueName?"'".concat(t.valueName,"'"):"value";i="Expected ".concat(a," to be defined, but received ").concat(e)}let r=(t==null?void 0:t.errorClass)||Mu,n=new r(i);throw(t==null?void 0:t.captureStackTrace)!==!1&&Error.captureStackTrace&&Error.captureStackTrace(n,Vd),n}}function o8(e,t,i){if(Vd(e),(e==null?void 0:e.type)!==t){let r="Expected type ".concat(t," but got ").concat(e==null?void 0:e.type);throw new Error(i!=null?i:r)}}F();var Cu=[0,4,6,8,10],bt=()=>{let e=new Array(16).fill(0),t=Math.random()*4294967296;for(let r=0;r<e.length;r++)r>0&&(r&3)===0&&(t=Math.random()*4294967296),e[r]=t>>>((r&3)<<3)&255;let i=e.map(r=>r.toString(16).padStart(2,"0"));return i[6]="4"+i[6][1],i[8]=["8","9","a","b"].includes(i[7][0])?i[7]:"a"+i[7][1],Cu.map((r,n)=>i.slice(r,n===Cu.length-1?void 0:Cu[n+1]).join("")).join("-")};function h8(e,t=0){let i=3735928559^t,r=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),i=Math.imul(i^a,2654435761),r=Math.imul(r^a,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&r)+(i>>>0)}F();var ha=class{constructor(){S(this,"_subscribers",{});S(this,"_abortController",new AbortController);S(this,"_cleanupFunctions",[])}get signal(){return this._abortController.signal}publish(t,i){!this._subscribers||!this._subscribers[t]||this.signal.aborted||this._subscribers[t].forEach(function(r){typeof r=="function"&&r(i)})}onAbort(t){this.signal.addEventListener("abort",()=>t(),{once:!0})}on(t,i,r){let n=r==null?void 0:r.signal;if(n!=null&&n.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(i);let a=()=>this.off(t,i);return n&&n.addEventListener("abort",a,{once:!0}),this._cleanupFunctions.push(a),a}off(t,i){if(!this._subscribers||this._subscribers[t]==null||this.signal.aborted)return;let r=this._subscribers[t].indexOf(i);r!==-1&&this._subscribers[t].splice(r,1)}destroy(){if(!this.signal.aborted){for(let t of this._cleanupFunctions)t();this._cleanupFunctions=[],this._subscribers={},this._abortController.abort()}}};F();var jd="mi-session-data",Gd="mi-local-data",ca="id",pa="deviceId",Br,ai,oi,Go=class Go{constructor(){vt(this,ai);vt(this,oi);try{let t=sessionStorage.getItem(jd);t?tt(this,ai,JSON.parse(t)):tt(this,ai,{[ca]:bt()})}catch(t){tt(this,ai,{[ca]:bt()})}try{let t=localStorage.getItem(Gd);t?tt(this,oi,JSON.parse(t)):tt(this,oi,{[pa]:bt()})}catch(t){tt(this,oi,{[pa]:bt()})}Ie(this,ai)[ca]||(Ie(this,ai)[ca]=bt()),Ie(this,oi)[pa]||(Ie(this,oi)[pa]=bt())}static getInstance(){return Ie(this,Br)||tt(this,Br,new Go),Ie(this,Br)}static ___clearInstance(){tt(this,Br,void 0)}saveSessionData(t,i){Ie(this,ai)[t]=i;try{return sessionStorage.setItem(jd,JSON.stringify(Ie(this,ai))),!0}catch(r){return!1}}loadSessionData(t){let i=Ie(this,ai)[t];if(i!=null)return i}saveLocalData(t,i){Ie(this,oi)[t]=i;try{return localStorage.setItem(Gd,JSON.stringify(Ie(this,oi))),!0}catch(r){return!1}}loadLocalData(t){let i=Ie(this,oi)[t];if(i!=null)return i}};Br=new WeakMap,ai=new WeakMap,oi=new WeakMap,vt(Go,Br);var Iu=Go;F();var B1=new Set(Object.keys(ut.NAMES)),Au,Eu;function Uo(){return Au==null&&(Au=new ut),Au}function R1(){return Eu==null&&(Eu=new ut),Eu}var O1=e=>B1.has(e.toLowerCase()),N1=e=>{if(!e.startsWith("#"))return!1;let t=e.slice(1);if(t.length!==3&&t.length!==6)return!1;for(let i=0;i<t.length;i++)if(!(t[i]>="0"&&t[i]<="9"||t[i]>="A"&&t[i]<="F"||t[i]>="a"&&t[i]<="f"))return!1;return!0},V1=e=>{if(!e.startsWith("rgb(")&&!e.startsWith("rgba("))return!1;let t=e.indexOf("("),i=e.lastIndexOf(")");if(t===-1||i===-1||i<=t||i!==e.length-1)return!1;let r=e.slice(t+1,i).split(",");if(r.length!==3&&r.length!==4)return!1;for(let n=0;n<r.length;n++){let a=r[n].trim();if(n<3)if(a.endsWith("%")){let o=parseFloat(a.slice(0,-1));if(isNaN(o)||o<0||o>100)return!1}else{let o=parseInt(a,10);if(isNaN(o)||o<0||o>255)return!1}else{let o=parseFloat(a);if(isNaN(o)||o<0||o>1)return!1}}return!0},j1=e=>{if(!e.startsWith("hsl(")&&!e.startsWith("hsla("))return!1;let t=e.indexOf("("),i=e.lastIndexOf(")");if(t===-1||i===-1||i<=t||i!==e.length-1)return!1;let r=e.slice(t+1,i).split(",");if(r.length!==3&&r.length!==4)return!1;for(let n=0;n<r.length;n++){let a=r[n].trim();if(n===0){let o=parseFloat(a);if(isNaN(o))return!1}else if(n<3){if(!a.endsWith("%"))return!1;let o=parseFloat(a.slice(0,-1));if(isNaN(o)||o<0||o>100)return!1}else{let o=parseFloat(a);if(isNaN(o)||o<0||o>1)return!1}}return!0},Ud=(e,t)=>{if(e instanceof ut&&t instanceof ut)return e.equals(t);if(typeof e=="string"&&typeof t=="string"){if(e===t)return!0;let r=Uo(),n=R1();return r.set(e),n.set(t),r.equals(n)}let i=Uo();return e instanceof ut&&typeof t=="string"?(i.set(t),e.equals(i)):typeof e=="string"&&t instanceof ut?(i.set(e),i.equals(t)):!1},Xo=e=>e==null||typeof e!="string"?!1:!!(N1(e)||V1(e)||j1(e)||O1(e)),b8=e=>{let t=Uo();return t.set(e),[t.r,t.g,t.b]},w8=e=>{let t=Uo();return t.set(e[0],e[1],e[2]),"#"+t.getHexString()};F();var Xd=["ease-in","ease-out","ease-in-out","linear","ease-out-cubic"];var $d=e=>e,G1=e=>e*e,U1=e=>1-Math.cos(e*Math.PI/2),X1=e=>1-(1-e)*(1-e),$1=e=>1-Math.pow(1-e,3),qd={linear:$d,"ease-in":G1,"ease-out":X1,"ease-in-out":U1,"ease-out-cubic":$1};function M8(e,t,i,r,n,a=$d){if(t===i)return n;e=Math.max(t,Math.min(e,i));let o=(e-Math.min(t,i))/Math.abs(i-t),s=typeof a=="function"?a(o):qd[a](o);return r+s*(n-r)}function q1(e,t){let i=0;if(t.length<2)return i;let n=t[0]<t[1]?(a,o)=>a>o:(a,o)=>a<o;for(;i<t.length-1&&n(e,t[i+1]);)i++;return i>t.length-2?Math.max(0,t.length-2):i}function C8(e,t,i,r="ease-in"){if(t.length!==i.length)throw new ua("Input and output ranges must have the same number of values.");e=Math.max(t[0],Math.min(e,t[t.length-1]));let n=q1(e,t),a=(e-t[n])/(t[n+1]-t[n]),o=typeof r=="function"?r(a):qd[r](a);return i[n]+o*(i[n+1]-i[n])}F();function $o(e){return(e%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}F();F();var Y1=Object.create,dc=Object.defineProperty,Z1=Object.getOwnPropertyDescriptor,W1=Object.getOwnPropertyNames,H1=Object.getPrototypeOf,K1=Object.prototype.hasOwnProperty,pi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Kr=(e,t)=>{for(var i in t)dc(e,i,{get:t[i],enumerable:!0})},J1=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of W1(t))!K1.call(e,n)&&n!==i&&dc(e,n,{get:()=>t[n],enumerable:!(r=Z1(t,n))||r.enumerable});return e},ne=(e,t,i)=>(i=e!=null?Y1(H1(e)):{},J1(t||!e||!e.__esModule?dc(i,"default",{value:e,enumerable:!0}):i,e)),le=pi((e,t)=>{"use strict";t.exports=i;function i(r,n){this.x=r,this.y=n}i.prototype={clone:function(){return new i(this.x,this.y)},add:function(r){return this.clone()._add(r)},sub:function(r){return this.clone()._sub(r)},multByPoint:function(r){return this.clone()._multByPoint(r)},divByPoint:function(r){return this.clone()._divByPoint(r)},mult:function(r){return this.clone()._mult(r)},div:function(r){return this.clone()._div(r)},rotate:function(r){return this.clone()._rotate(r)},rotateAround:function(r,n){return this.clone()._rotateAround(r,n)},matMult:function(r){return this.clone()._matMult(r)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(r){return this.x===r.x&&this.y===r.y},dist:function(r){return Math.sqrt(this.distSqr(r))},distSqr:function(r){var n=r.x-this.x,a=r.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith:function(r){return this.angleWithSep(r.x,r.y)},angleWithSep:function(r,n){return Math.atan2(this.x*n-this.y*r,this.x*r+this.y*n)},_matMult:function(r){var n=r[0]*this.x+r[1]*this.y,a=r[2]*this.x+r[3]*this.y;return this.x=n,this.y=a,this},_add:function(r){return this.x+=r.x,this.y+=r.y,this},_sub:function(r){return this.x-=r.x,this.y-=r.y,this},_mult:function(r){return this.x*=r,this.y*=r,this},_div:function(r){return this.x/=r,this.y/=r,this},_multByPoint:function(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint:function(r){return this.x/=r.x,this.y/=r.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var r=this.y;return this.y=this.x,this.x=-r,this},_rotate:function(r){var n=Math.cos(r),a=Math.sin(r),o=n*this.x-a*this.y,s=a*this.x+n*this.y;return this.x=o,this.y=s,this},_rotateAround:function(r,n){var a=Math.cos(r),o=Math.sin(r),s=n.x+a*(this.x-n.x)-o*(this.y-n.y),l=n.y+o*(this.x-n.x)+a*(this.y-n.y);return this.x=s,this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(r){return r instanceof i?r:Array.isArray(r)?new i(r[0],r[1]):r}}),Q1=pi((e,t)=>{"use strict";t.exports=i;function i(r,n,a,o){this.cx=3*r,this.bx=3*(a-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(o-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=n,this.p2x=a,this.p2y=o}i.prototype={sampleCurveX:function(r){return((this.ax*r+this.bx)*r+this.cx)*r},sampleCurveY:function(r){return((this.ay*r+this.by)*r+this.cy)*r},sampleCurveDerivativeX:function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},solveCurveX:function(r,n){if(n===void 0&&(n=1e-6),r<0)return 0;if(r>1)return 1;for(var a=r,o=0;o<8;o++){var s=this.sampleCurveX(a)-r;if(Math.abs(s)<n)return a;var l=this.sampleCurveDerivativeX(a);if(Math.abs(l)<1e-6)break;a=a-s/l}var u=0,h=1;for(a=r,o=0;o<20&&(s=this.sampleCurveX(a),!(Math.abs(s-r)<n));o++)r>s?u=a:h=a,a=(h-u)*.5+u;return a},solve:function(r,n){return this.sampleCurveY(this.solveCurveX(r,n))}}}),eb=pi((e,t)=>{function i(r,n){var a,o,s,l,u,h,c,p,d,f;for(a=r.length&3,o=r.length-a,s=n,u=3432918353,c=461845907,f=0;f<o;)d=r.charCodeAt(f)&255|(r.charCodeAt(++f)&255)<<8|(r.charCodeAt(++f)&255)<<16|(r.charCodeAt(++f)&255)<<24,++f,d=(d&65535)*u+(((d>>>16)*u&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*c+(((d>>>16)*c&65535)<<16)&4294967295,s^=d,s=s<<13|s>>>19,l=(s&65535)*5+(((s>>>16)*5&65535)<<16)&4294967295,s=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(d=0,a){case 3:d^=(r.charCodeAt(f+2)&255)<<16;case 2:d^=(r.charCodeAt(f+1)&255)<<8;case 1:d^=r.charCodeAt(f)&255,d=(d&65535)*u+(((d>>>16)*u&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*c+(((d>>>16)*c&65535)<<16)&4294967295,s^=d}return s^=r.length,s^=s>>>16,s=(s&65535)*2246822507+(((s>>>16)*2246822507&65535)<<16)&4294967295,s^=s>>>13,s=(s&65535)*3266489909+(((s>>>16)*3266489909&65535)<<16)&4294967295,s^=s>>>16,s>>>0}typeof t<"u"&&(t.exports=i)}),tb=pi((e,t)=>{function i(r,n){for(var a=r.length,o=n^a,s=0,l;a>=4;)l=r.charCodeAt(s)&255|(r.charCodeAt(++s)&255)<<8|(r.charCodeAt(++s)&255)<<16|(r.charCodeAt(++s)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)^l,a-=4,++s;switch(a){case 3:o^=(r.charCodeAt(s+2)&255)<<16;case 2:o^=(r.charCodeAt(s+1)&255)<<8;case 1:o^=r.charCodeAt(s)&255,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)}return o^=o>>>13,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>15,o>>>0}typeof t!==void 0&&(t.exports=i)}),Km=pi((e,t)=>{var i=eb(),r=tb();t.exports=i,t.exports.murmur3=i,t.exports.murmur2=r}),Jm=pi((e,t)=>{"use strict";var i=le();t.exports=r;function r(l,u,h,c,p){this.properties={},this.extent=h,this.type=0,this._pbf=l,this._geometry=-1,this._keys=c,this._values=p,l.readFields(n,this,u)}function n(l,u,h){l==1?u.id=h.readVarint():l==2?a(h,u):l==3?u.type=h.readVarint():l==4&&(u._geometry=h.pos)}function a(l,u){for(var h=l.readVarint()+l.pos;l.pos<h;){var c=u._keys[l.readVarint()],p=u._values[l.readVarint()];u.properties[c]=p}}r.types=["Unknown","Point","LineString","Polygon"],r.prototype.loadGeometry=function(){var l=this._pbf;l.pos=this._geometry;for(var u=l.readVarint()+l.pos,h=1,c=0,p=0,d=0,f=[],y;l.pos<u;){if(c<=0){var g=l.readVarint();h=g&7,c=g>>3}if(c--,h===1||h===2)p+=l.readSVarint(),d+=l.readSVarint(),h===1&&(y&&f.push(y),y=[]),y.push(new i(p,d));else if(h===7)y&&y.push(y[0].clone());else throw new Error("unknown command "+h)}return y&&f.push(y),f},r.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var u=l.readVarint()+l.pos,h=1,c=0,p=0,d=0,f=1/0,y=-1/0,g=1/0,_=-1/0;l.pos<u;){if(c<=0){var b=l.readVarint();h=b&7,c=b>>3}if(c--,h===1||h===2)p+=l.readSVarint(),d+=l.readSVarint(),p<f&&(f=p),p>y&&(y=p),d<g&&(g=d),d>_&&(_=d);else if(h!==7)throw new Error("unknown command "+h)}return[f,g,y,_]},r.prototype.toGeoJSON=function(l,u,h){var c=this.extent*Math.pow(2,h),p=this.extent*l,d=this.extent*u,f=this.loadGeometry(),y=r.types[this.type],g,_;function b(P){for(var T=0;T<P.length;T++){var C=P[T],A=180-(C.y+d)*360/c;P[T]=[(C.x+p)*360/c-180,360/Math.PI*Math.atan(Math.exp(A*Math.PI/180))-90]}}switch(this.type){case 1:var v=[];for(g=0;g<f.length;g++)v[g]=f[g][0];f=v,b(f);break;case 2:for(g=0;g<f.length;g++)b(f[g]);break;case 3:for(f=o(f),g=0;g<f.length;g++)for(_=0;_<f[g].length;_++)b(f[g][_]);break}f.length===1?f=f[0]:y="Multi"+y;var w={type:"Feature",geometry:{type:y,coordinates:f},properties:this.properties};return"id"in this&&(w.id=this.id),w};function o(l){var u=l.length;if(u<=1)return[l];for(var h=[],c,p,d=0;d<u;d++){var f=s(l[d]);f!==0&&(p===void 0&&(p=f<0),p===f<0?(c&&h.push(c),c=[l[d]]):c.push(l[d]))}return c&&h.push(c),h}function s(l){for(var u=0,h=0,c=l.length,p=c-1,d,f;h<c;p=h++)d=l[h],f=l[p],u+=(f.x-d.x)*(d.y+f.y);return u}}),Qm=pi((e,t)=>{"use strict";var i=Jm();t.exports=r;function r(o,s){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=o,this._keys=[],this._values=[],this._features=[],o.readFields(n,this,s),this.length=this._features.length}function n(o,s,l){o===15?s.version=l.readVarint():o===1?s.name=l.readString():o===5?s.extent=l.readVarint():o===2?s._features.push(l.pos):o===3?s._keys.push(l.readString()):o===4&&s._values.push(a(l))}function a(o){for(var s=null,l=o.readVarint()+o.pos;o.pos<l;){var u=o.readVarint()>>3;s=u===1?o.readString():u===2?o.readFloat():u===3?o.readDouble():u===4?o.readVarint64():u===5?o.readVarint():u===6?o.readSVarint():u===7?o.readBoolean():null}return s}r.prototype.feature=function(o){if(o<0||o>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[o];var s=this._pbf.readVarint()+this._pbf.pos;return new i(this._pbf,s,this.extent,this._keys,this._values)}}),ib=pi((e,t)=>{"use strict";var i=Qm();t.exports=r;function r(a,o){this.layers=a.readFields(n,{},o)}function n(a,o,s){if(a===3){var l=new i(s,s.readVarint()+s.pos);l.length&&(o[l.name]=l)}}}),rl=pi((e,t)=>{t.exports.VectorTile=ib(),t.exports.VectorTileFeature=Jm(),t.exports.VectorTileLayer=Qm()}),rb=pi(e=>{e.read=function(t,i,r,n,a){var o,s,l=a*8-n-1,u=(1<<l)-1,h=u>>1,c=-7,p=r?a-1:0,d=r?-1:1,f=t[i+p];for(p+=d,o=f&(1<<-c)-1,f>>=-c,c+=l;c>0;o=o*256+t[i+p],p+=d,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=s*256+t[i+p],p+=d,c-=8);if(o===0)o=1-h;else{if(o===u)return s?NaN:(f?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-h}return(f?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,i,r,n,a,o){var s,l,u,h=o*8-a-1,c=(1<<h)-1,p=c>>1,d=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,y=n?1:-1,g=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(l=isNaN(i)?1:0,s=c):(s=Math.floor(Math.log(i)/Math.LN2),i*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+p>=1?i+=d/u:i+=d*Math.pow(2,1-p),i*u>=2&&(s++,u/=2),s+p>=c?(l=0,s=c):s+p>=1?(l=(i*u-1)*Math.pow(2,a),s=s+p):(l=i*Math.pow(2,p-1)*Math.pow(2,a),s=0));a>=8;t[r+f]=l&255,f+=y,l/=256,a-=8);for(s=s<<a|l,h+=a;h>0;t[r+f]=s&255,f+=y,s/=256,h-=8);t[r+f-y]|=g*128}}),ey=pi((e,t)=>{"use strict";t.exports=r;var i=rb();function r(x){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(x)?x:new Uint8Array(x||0),this.pos=0,this.type=0,this.length=this.buf.length}r.Varint=0,r.Fixed64=1,r.Bytes=2,r.Fixed32=5;var n=65536*65536,a=1/n,o=12,s=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");r.prototype={destroy:function(){this.buf=null},readFields:function(x,M,I){for(I=I||this.length;this.pos<I;){var R=this.readVarint(),N=R>>3,$=this.pos;this.type=R&7,x(N,M,this),this.pos===$&&this.skip(R)}return M},readMessage:function(x,M){return this.readFields(x,M,this.readVarint()+this.pos)},readFixed32:function(){var x=A(this.buf,this.pos);return this.pos+=4,x},readSFixed32:function(){var x=z(this.buf,this.pos);return this.pos+=4,x},readFixed64:function(){var x=A(this.buf,this.pos)+A(this.buf,this.pos+4)*n;return this.pos+=8,x},readSFixed64:function(){var x=A(this.buf,this.pos)+z(this.buf,this.pos+4)*n;return this.pos+=8,x},readFloat:function(){var x=i.read(this.buf,this.pos,!0,23,4);return this.pos+=4,x},readDouble:function(){var x=i.read(this.buf,this.pos,!0,52,8);return this.pos+=8,x},readVarint:function(x){var M=this.buf,I,R;return R=M[this.pos++],I=R&127,R<128||(R=M[this.pos++],I|=(R&127)<<7,R<128)||(R=M[this.pos++],I|=(R&127)<<14,R<128)||(R=M[this.pos++],I|=(R&127)<<21,R<128)?I:(R=M[this.pos],I|=(R&15)<<28,l(I,x,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var x=this.readVarint();return x%2===1?(x+1)/-2:x/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var x=this.readVarint()+this.pos,M=this.pos;return this.pos=x,x-M>=o&&s?E(this.buf,M,x):L(this.buf,M,x)},readBytes:function(){var x=this.readVarint()+this.pos,M=this.buf.subarray(this.pos,x);return this.pos=x,M},readPackedVarint:function(x,M){if(this.type!==r.Bytes)return x.push(this.readVarint(M));var I=u(this);for(x=x||[];this.pos<I;)x.push(this.readVarint(M));return x},readPackedSVarint:function(x){if(this.type!==r.Bytes)return x.push(this.readSVarint());var M=u(this);for(x=x||[];this.pos<M;)x.push(this.readSVarint());return x},readPackedBoolean:function(x){if(this.type!==r.Bytes)return x.push(this.readBoolean());var M=u(this);for(x=x||[];this.pos<M;)x.push(this.readBoolean());return x},readPackedFloat:function(x){if(this.type!==r.Bytes)return x.push(this.readFloat());var M=u(this);for(x=x||[];this.pos<M;)x.push(this.readFloat());return x},readPackedDouble:function(x){if(this.type!==r.Bytes)return x.push(this.readDouble());var M=u(this);for(x=x||[];this.pos<M;)x.push(this.readDouble());return x},readPackedFixed32:function(x){if(this.type!==r.Bytes)return x.push(this.readFixed32());var M=u(this);for(x=x||[];this.pos<M;)x.push(this.readFixed32());return x},readPackedSFixed32:function(x){if(this.type!==r.Bytes)return x.push(this.readSFixed32());var M=u(this);for(x=x||[];this.pos<M;)x.push(this.readSFixed32());return x},readPackedFixed64:function(x){if(this.type!==r.Bytes)return x.push(this.readFixed64());var M=u(this);for(x=x||[];this.pos<M;)x.push(this.readFixed64());return x},readPackedSFixed64:function(x){if(this.type!==r.Bytes)return x.push(this.readSFixed64());var M=u(this);for(x=x||[];this.pos<M;)x.push(this.readSFixed64());return x},skip:function(x){var M=x&7;if(M===r.Varint)for(;this.buf[this.pos++]>127;);else if(M===r.Bytes)this.pos=this.readVarint()+this.pos;else if(M===r.Fixed32)this.pos+=4;else if(M===r.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+M)},writeTag:function(x,M){this.writeVarint(x<<3|M)},realloc:function(x){for(var M=this.length||16;M<this.pos+x;)M*=2;if(M!==this.length){var I=new Uint8Array(M);I.set(this.buf),this.buf=I,this.length=M}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(x){this.realloc(4),k(this.buf,x,this.pos),this.pos+=4},writeSFixed32:function(x){this.realloc(4),k(this.buf,x,this.pos),this.pos+=4},writeFixed64:function(x){this.realloc(8),k(this.buf,x&-1,this.pos),k(this.buf,Math.floor(x*a),this.pos+4),this.pos+=8},writeSFixed64:function(x){this.realloc(8),k(this.buf,x&-1,this.pos),k(this.buf,Math.floor(x*a),this.pos+4),this.pos+=8},writeVarint:function(x){if(x=+x||0,x>268435455||x<0){c(x,this);return}this.realloc(4),this.buf[this.pos++]=x&127|(x>127?128:0),!(x<=127)&&(this.buf[this.pos++]=(x>>>=7)&127|(x>127?128:0),!(x<=127)&&(this.buf[this.pos++]=(x>>>=7)&127|(x>127?128:0),!(x<=127)&&(this.buf[this.pos++]=x>>>7&127)))},writeSVarint:function(x){this.writeVarint(x<0?-x*2-1:x*2)},writeBoolean:function(x){this.writeVarint(!!x)},writeString:function(x){x=String(x),this.realloc(x.length*4),this.pos++;var M=this.pos;this.pos=D(this.buf,x,this.pos);var I=this.pos-M;I>=128&&f(M,I,this),this.pos=M-1,this.writeVarint(I),this.pos+=I},writeFloat:function(x){this.realloc(4),i.write(this.buf,x,this.pos,!0,23,4),this.pos+=4},writeDouble:function(x){this.realloc(8),i.write(this.buf,x,this.pos,!0,52,8),this.pos+=8},writeBytes:function(x){var M=x.length;this.writeVarint(M),this.realloc(M);for(var I=0;I<M;I++)this.buf[this.pos++]=x[I]},writeRawMessage:function(x,M){this.pos++;var I=this.pos;x(M,this);var R=this.pos-I;R>=128&&f(I,R,this),this.pos=I-1,this.writeVarint(R),this.pos+=R},writeMessage:function(x,M,I){this.writeTag(x,r.Bytes),this.writeRawMessage(M,I)},writePackedVarint:function(x,M){M.length&&this.writeMessage(x,y,M)},writePackedSVarint:function(x,M){M.length&&this.writeMessage(x,g,M)},writePackedBoolean:function(x,M){M.length&&this.writeMessage(x,v,M)},writePackedFloat:function(x,M){M.length&&this.writeMessage(x,_,M)},writePackedDouble:function(x,M){M.length&&this.writeMessage(x,b,M)},writePackedFixed32:function(x,M){M.length&&this.writeMessage(x,w,M)},writePackedSFixed32:function(x,M){M.length&&this.writeMessage(x,P,M)},writePackedFixed64:function(x,M){M.length&&this.writeMessage(x,T,M)},writePackedSFixed64:function(x,M){M.length&&this.writeMessage(x,C,M)},writeBytesField:function(x,M){this.writeTag(x,r.Bytes),this.writeBytes(M)},writeFixed32Field:function(x,M){this.writeTag(x,r.Fixed32),this.writeFixed32(M)},writeSFixed32Field:function(x,M){this.writeTag(x,r.Fixed32),this.writeSFixed32(M)},writeFixed64Field:function(x,M){this.writeTag(x,r.Fixed64),this.writeFixed64(M)},writeSFixed64Field:function(x,M){this.writeTag(x,r.Fixed64),this.writeSFixed64(M)},writeVarintField:function(x,M){this.writeTag(x,r.Varint),this.writeVarint(M)},writeSVarintField:function(x,M){this.writeTag(x,r.Varint),this.writeSVarint(M)},writeStringField:function(x,M){this.writeTag(x,r.Bytes),this.writeString(M)},writeFloatField:function(x,M){this.writeTag(x,r.Fixed32),this.writeFloat(M)},writeDoubleField:function(x,M){this.writeTag(x,r.Fixed64),this.writeDouble(M)},writeBooleanField:function(x,M){this.writeVarintField(x,!!M)}};function l(x,M,I){var R=I.buf,N,$;if($=R[I.pos++],N=($&112)>>4,$<128||($=R[I.pos++],N|=($&127)<<3,$<128)||($=R[I.pos++],N|=($&127)<<10,$<128)||($=R[I.pos++],N|=($&127)<<17,$<128)||($=R[I.pos++],N|=($&127)<<24,$<128)||($=R[I.pos++],N|=($&1)<<31,$<128))return h(x,N,M);throw new Error("Expected varint not more than 10 bytes")}function u(x){return x.type===r.Bytes?x.readVarint()+x.pos:x.pos+1}function h(x,M,I){return I?M*4294967296+(x>>>0):(M>>>0)*4294967296+(x>>>0)}function c(x,M){var I,R;if(x>=0?(I=x%4294967296|0,R=x/4294967296|0):(I=~(-x%4294967296),R=~(-x/4294967296),I^4294967295?I=I+1|0:(I=0,R=R+1|0)),x>=18446744073709552e3||x<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");M.realloc(10),p(I,R,M),d(R,M)}function p(x,M,I){I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos]=x&127}function d(x,M){var I=(x&7)<<4;M.buf[M.pos++]|=I|((x>>>=3)?128:0),x&&(M.buf[M.pos++]=x&127|((x>>>=7)?128:0),x&&(M.buf[M.pos++]=x&127|((x>>>=7)?128:0),x&&(M.buf[M.pos++]=x&127|((x>>>=7)?128:0),x&&(M.buf[M.pos++]=x&127|((x>>>=7)?128:0),x&&(M.buf[M.pos++]=x&127)))))}function f(x,M,I){var R=M<=16383?1:M<=2097151?2:M<=268435455?3:Math.floor(Math.log(M)/(Math.LN2*7));I.realloc(R);for(var N=I.pos-1;N>=x;N--)I.buf[N+R]=I.buf[N]}function y(x,M){for(var I=0;I<x.length;I++)M.writeVarint(x[I])}function g(x,M){for(var I=0;I<x.length;I++)M.writeSVarint(x[I])}function _(x,M){for(var I=0;I<x.length;I++)M.writeFloat(x[I])}function b(x,M){for(var I=0;I<x.length;I++)M.writeDouble(x[I])}function v(x,M){for(var I=0;I<x.length;I++)M.writeBoolean(x[I])}function w(x,M){for(var I=0;I<x.length;I++)M.writeFixed32(x[I])}function P(x,M){for(var I=0;I<x.length;I++)M.writeSFixed32(x[I])}function T(x,M){for(var I=0;I<x.length;I++)M.writeFixed64(x[I])}function C(x,M){for(var I=0;I<x.length;I++)M.writeSFixed64(x[I])}function A(x,M){return(x[M]|x[M+1]<<8|x[M+2]<<16)+x[M+3]*16777216}function k(x,M,I){x[I]=M,x[I+1]=M>>>8,x[I+2]=M>>>16,x[I+3]=M>>>24}function z(x,M){return(x[M]|x[M+1]<<8|x[M+2]<<16)+(x[M+3]<<24)}function L(x,M,I){for(var R="",N=M;N<I;){var $=x[N],Q=null,oe=$>239?4:$>223?3:$>191?2:1;if(N+oe>I)break;var Le,Ce,ze;oe===1?$<128&&(Q=$):oe===2?(Le=x[N+1],(Le&192)===128&&(Q=($&31)<<6|Le&63,Q<=127&&(Q=null))):oe===3?(Le=x[N+1],Ce=x[N+2],(Le&192)===128&&(Ce&192)===128&&(Q=($&15)<<12|(Le&63)<<6|Ce&63,(Q<=2047||Q>=55296&&Q<=57343)&&(Q=null))):oe===4&&(Le=x[N+1],Ce=x[N+2],ze=x[N+3],(Le&192)===128&&(Ce&192)===128&&(ze&192)===128&&(Q=($&15)<<18|(Le&63)<<12|(Ce&63)<<6|ze&63,(Q<=65535||Q>=1114112)&&(Q=null))),Q===null?(Q=65533,oe=1):Q>65535&&(Q-=65536,R+=String.fromCharCode(Q>>>10&1023|55296),Q=56320|Q&1023),R+=String.fromCharCode(Q),N+=oe}return R}function E(x,M,I){return s.decode(x.subarray(M,I))}function D(x,M,I){for(var R=0,N,$;R<M.length;R++){if(N=M.charCodeAt(R),N>55295&&N<57344)if($)if(N<56320){x[I++]=239,x[I++]=191,x[I++]=189,$=N;continue}else N=$-55296<<10|N-56320|65536,$=null;else{N>56319||R+1===M.length?(x[I++]=239,x[I++]=191,x[I++]=189):$=N;continue}else $&&(x[I++]=239,x[I++]=191,x[I++]=189,$=null);N<128?x[I++]=N:(N<2048?x[I++]=N>>6|192:(N<65536?x[I++]=N>>12|224:(x[I++]=N>>18|240,x[I++]=N>>12&63|128),x[I++]=N>>6&63|128),x[I++]=N&63|128)}return I}}),ty={name:"@mappedin/outdoor-context",description:"Fork of maplibre-gl-js",version:"5.6.0",main:"dist/outdoor-context.js",style:"dist/outdoor-context.css",homepage:"https://www.mappedin.com",private:!1,repository:{type:"git",url:"git://github.com/mappedin/outdoor-context.git"},types:"dist/outdoor-context.d.ts",type:"module",dependencies:{"@mapbox/geojson-rewind":"^0.5.2","@mapbox/jsonlint-lines-primitives":"^2.0.2","@mapbox/point-geometry":"^0.1.0","@mapbox/tiny-sdf":"^2.0.6","@mapbox/unitbezier":"^0.0.1","@mapbox/vector-tile":"^1.3.1","@mapbox/whoots-js":"^3.1.0","@maplibre/maplibre-gl-style-spec":"^23.3.0","@types/geojson":"^7946.0.16","@types/geojson-vt":"3.2.5","@types/mapbox__point-geometry":"^0.1.4","@types/mapbox__vector-tile":"^1.3.4","@types/pbf":"^3.0.5","@types/supercluster":"^7.1.3",earcut:"^3.0.1","geojson-vt":"^4.0.2","gl-matrix":"^3.4.3","global-prefix":"^4.0.0",kdbush:"^4.0.2","murmurhash-js":"^1.0.0",pbf:"^3.3.0",potpack:"^2.0.0",quickselect:"^3.0.0",supercluster:"^8.0.1",tinyqueue:"^3.0.0","vt-pbf":"^3.1.3"},devDependencies:{"@mapbox/mapbox-gl-rtl-text":"^0.3.0","@mapbox/mvt-fixtures":"^3.10.0","@types/benchmark":"^2.1.5","@types/d3":"^7.4.3","@types/diff":"^7.0.2","@types/earcut":"^3.0.0","@types/eslint":"^9.6.1","@types/gl":"^6.0.5","@types/glob":"^8.1.0","@types/jsdom":"^21.1.7","@types/minimist":"^1.2.5","@types/murmurhash-js":"^1.0.6","@types/nise":"^1.4.5","@types/node":"^22.15.29","@types/offscreencanvas":"^2019.7.3","@types/pixelmatch":"^5.2.6","@types/pngjs":"^6.0.5","@types/react":"^19.1.6","@types/react-dom":"^19.1.5","@types/request":"^2.48.12","@types/shuffle-seed":"^1.1.3","@types/window-or-global":"^1.0.6","@typescript-eslint/eslint-plugin":"^8.33.1","@typescript-eslint/parser":"^8.33.0","@vitest/coverage-v8":"3.1.3","@vitest/ui":"3.1.3",address:"^2.0.3",autoprefixer:"^10.4.21",benchmark:"^2.1.4",canvas:"^3.1.0",cspell:"^9.0.2",cssnano:"^7.0.7",d3:"^7.9.0","d3-queue":"^3.0.7","devtools-protocol":"^0.0.1468520",diff:"^8.0.2","dts-bundle-generator":"^9.5.1",esbuild:"^0.27.2","esbuild-plugin-glsl":"^1.4.1",eslint:"^9.28.0","eslint-plugin-html":"^8.1.3","eslint-plugin-import":"^2.31.0","eslint-plugin-react":"^7.37.5","eslint-plugin-tsdoc":"0.4.0","eslint-plugin-vitest":"^0.5.4",expect:"^29.7.0",glob:"^11.0.2",globals:"^16.2.0",husky:"^8.0.0","is-builtin-module":"^5.0.0",jsdom:"^26.1.0","junit-report-builder":"^5.1.1","lint-staged":"^12.1.2",minimist:"^1.2.8","mock-geolocation":"^1.0.11","monocart-coverage-reports":"^2.12.6",nise:"^6.1.1","npm-font-open-sans":"^1.1.0","npm-run-all":"^4.1.5",nyc:"^15.1.0","pdf-merger-js":"^5.1.2",pixelmatch:"^7.1.0",pngjs:"^7.0.0",postcss:"^8.5.4","postcss-cli":"^11.0.1","postcss-inline-svg":"^6.0.0",prettier:"^3.7.4","pretty-bytes":"^7.0.0",puppeteer:"^24.9.0",react:"^19.0.0","react-dom":"^19.1.0",rw:"^1.3.3",semver:"^7.7.2",sharp:"^0.34.2","shuffle-seed":"^1.1.6","source-map-explorer":"^2.5.3",st:"^3.0.2",stylelint:"^16.20.0","stylelint-config-standard":"^38.0.0","ts-node":"^10.9.2",tslib:"^2.8.1",typedoc:"^0.28.5","typedoc-plugin-markdown":"^4.6.4","typedoc-plugin-missing-exports":"^4.0.0",typescript:"^5.8.3",vitest:"3.1.3","vitest-webgl-canvas-mock":"^1.1.0"},scripts:{"generate-dist-package":"node --no-warnings --loader ts-node/esm build/generate-dist-package.js","generate-shaders":"node --no-warnings --loader ts-node/esm build/generate-shaders.ts","generate-struct-arrays":"node --no-warnings --loader ts-node/esm build/generate-struct-arrays.ts","generate-style-code":"node --no-warnings --loader ts-node/esm build/generate-style-code.ts","generate-typings":"dts-bundle-generator --export-referenced-types --umd-module-name=maplibregl -o ./dist/outdoor-context.d.ts ./src/index.ts","generate-docs":"typedoc && node --no-warnings --loader ts-node/esm build/generate-docs.ts","generate-images":"node --no-warnings --loader ts-node/esm build/generate-doc-images.ts","build-dist":"npm run build-css && npm run generate-typings && npm run generate-shaders && npm run build-dev && npm run build-csp-dev && npm run build-prod && npm run build-csp","build-dev":"BUILD=dev node build/esbuild.mjs","watch-dev":"BUILD=dev node build/esbuild.mjs --watch","build-prod":"BUILD=production node build/esbuild.mjs","build-csp":"BUILD=production node build/esbuild.mjs --csp","build-csp-dev":"BUILD=dev node build/esbuild.mjs --csp","build-css":"postcss -o dist/outdoor-context.css src/css/outdoor-context.css && postcss --config postcss.config.min.js -o dist/outdoor-context-min.css src/css/outdoor-context-min.css","watch-css":"postcss --watch -o dist/outdoor-context.css src/css/outdoor-context.css",spellcheck:"cspell","start-server":"st --no-cache -H localhost --port 9966 .","start-docs":"docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material",start:"run-p watch-css watch-dev start-server","start-bench":"run-p watch-css watch-benchmarks start-server",lint:"eslint","lint-css":"stylelint **/*.css --fix -f verbose",test:"run-p lint lint-css test-render test-unit test-integration test-build","test-unit":"vitest run --config vitest.config.unit.ts","test-unit-ci":"vitest run --config vitest.config.unit.ts --coverage","test-integration":"vitest run --config vitest.config.integration.ts","test-integration-ci":"vitest run --config vitest.config.integration.ts --coverage","test-build":"vitest run --config vitest.config.build.ts","test-build-ci":"vitest run --config vitest.config.build.ts --coverage","test-watch-roots":"vitest --config vitest.config.unit.ts --watch","test-render":"node --no-warnings --loader ts-node/esm test/integration/render/run_render_tests.ts",codegen:"run-p --print-label generate-dist-package generate-style-code generate-struct-arrays generate-shaders && npm run generate-typings",benchmark:"node --no-warnings --loader ts-node/esm test/bench/run-benchmarks.ts","gl-stats":"node --no-warnings --loader ts-node/esm test/bench/gl-stats.ts",prepare:"npm run codegen",typecheck:"tsc --noEmit && tsc --project tsconfig.dist.json",tsnode:"node --experimental-loader=ts-node/esm --no-warnings","prettier:check":"prettier --check .","prettier:fix":"prettier --write .","publish:ci":'pnpm publish -r --no-git-checks --ignore-scripts --force --registry "https://npm.pkg.github.com/"',"version:ci":"pnpm version prerelease --no-git-tag-version","test:ci:cover":"mkdir .nyc_temp || true && pnpm cover && pnpm cover:merge && pnpm cover:report && pnpm cover:cleanup",cover:"nyc --silent pnpm test-unit-ci && cp ./coverage/vitest/unit/coverage-final.json ./.nyc_temp/coverage-maplibre.json","cover:merge":"nyc merge .nyc_temp ./.nyc_final/coverage.json","cover:report":"nyc report --reporter=json-summary --report-dir coverage/combined --temp-dir ./.nyc_final","cover:cleanup":"rm -r ./.nyc_final ./.nyc_temp ./.nyc_output"},files:["build/","dist/*","src/"],engines:{npm:">=8.1.0",node:">=16.14.0",pnpm:">=10.11.0"},volta:{node:"24.12.0"},"lint-staged":{"*.{ts,tsx,js,jsx,json,css,md}":["prettier --write"]}},nb=ne(le(),1),ab=ne(Q1(),1),ku;function iy(){return ku==null&&(ku=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ku}var qo;function ob(){if(qo==null&&(qo=!1,iy())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i<25;i++){let r=i*4;e.fillStyle="rgb(".concat(r,",").concat(r+1,",").concat(r+2,")"),e.fillRect(i%5,Math.floor(i/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let i=0;i<100;i++)if(i%4!==3&&t[i]!==i){qo=!0;break}}}return qo||!1}var se=1e-6,Ee=typeof Float32Array<"u"?Float32Array:Array,Ti=Math.random,$8=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ga={};Kr(Ga,{LDU:()=>Pb,add:()=>Tb,adjoint:()=>mb,clone:()=>lb,copy:()=>ub,create:()=>sb,determinant:()=>yb,equals:()=>Mb,exactEquals:()=>Sb,frob:()=>wb,fromRotation:()=>xb,fromScaling:()=>vb,fromValues:()=>cb,identity:()=>hb,invert:()=>fb,mul:()=>Ab,multiply:()=>ry,multiplyScalar:()=>Cb,multiplyScalarAndAdd:()=>Ib,rotate:()=>gb,scale:()=>_b,set:()=>pb,str:()=>bb,sub:()=>Eb,subtract:()=>ny,transpose:()=>db});function sb(){var e=new Ee(4);return Ee!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function lb(e){var t=new Ee(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function ub(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function hb(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function cb(e,t,i,r){var n=new Ee(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n}function pb(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e}function db(e,t){if(e===t){var i=t[1];e[1]=t[2],e[2]=i}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function fb(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*a-n*r;return o?(o=1/o,e[0]=a*o,e[1]=-r*o,e[2]=-n*o,e[3]=i*o,e):null}function mb(e,t){var i=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=i,e}function yb(e){return e[0]*e[3]-e[2]*e[1]}function ry(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=i[0],l=i[1],u=i[2],h=i[3];return e[0]=r*s+a*l,e[1]=n*s+o*l,e[2]=r*u+a*h,e[3]=n*u+o*h,e}function gb(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+a*s,e[1]=n*l+o*s,e[2]=r*-s+a*l,e[3]=n*-s+o*l,e}function _b(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=i[0],l=i[1];return e[0]=r*s,e[1]=n*s,e[2]=a*l,e[3]=o*l,e}function xb(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=-i,e[3]=r,e}function vb(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function bb(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function wb(e){return Math.hypot(e[0],e[1],e[2],e[3])}function Pb(e,t,i,r){return e[2]=r[2]/r[0],i[0]=r[0],i[1]=r[1],i[3]=r[3]-e[2]*i[1],[e,t,i]}function Tb(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e}function ny(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function Sb(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function Mb(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(i-o)<=se*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-s)<=se*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-l)<=se*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=se*Math.max(1,Math.abs(a),Math.abs(u))}function Cb(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function Ib(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e}var Ab=ry,Eb=ny,Ua={};Kr(Ua,{add:()=>Qb,adjoint:()=>Nb,clone:()=>Db,copy:()=>Lb,create:()=>ay,determinant:()=>Vb,equals:()=>rw,exactEquals:()=>iw,frob:()=>Jb,fromMat2d:()=>Yb,fromMat4:()=>kb,fromQuat:()=>Zb,fromRotation:()=>$b,fromScaling:()=>qb,fromTranslation:()=>Xb,fromValues:()=>zb,identity:()=>Bb,invert:()=>Ob,mul:()=>nw,multiply:()=>oy,multiplyScalar:()=>ew,multiplyScalarAndAdd:()=>tw,normalFromMat4:()=>Wb,projection:()=>Hb,rotate:()=>Gb,scale:()=>Ub,set:()=>Fb,str:()=>Kb,sub:()=>aw,subtract:()=>sy,translate:()=>jb,transpose:()=>Rb});function ay(){var e=new Ee(9);return Ee!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function kb(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function Db(e){var t=new Ee(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Lb(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function zb(e,t,i,r,n,a,o,s,l){var u=new Ee(9);return u[0]=e,u[1]=t,u[2]=i,u[3]=r,u[4]=n,u[5]=a,u[6]=o,u[7]=s,u[8]=l,u}function Fb(e,t,i,r,n,a,o,s,l,u){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e}function Bb(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Rb(e,t){if(e===t){var i=t[1],r=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=r,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function Ob(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=h*o-s*u,p=-h*a+s*l,d=u*a-o*l,f=i*c+r*p+n*d;return f?(f=1/f,e[0]=c*f,e[1]=(-h*r+n*u)*f,e[2]=(s*r-n*o)*f,e[3]=p*f,e[4]=(h*i-n*l)*f,e[5]=(-s*i+n*a)*f,e[6]=d*f,e[7]=(-u*i+r*l)*f,e[8]=(o*i-r*a)*f,e):null}function Nb(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8];return e[0]=o*h-s*u,e[1]=n*u-r*h,e[2]=r*s-n*o,e[3]=s*l-a*h,e[4]=i*h-n*l,e[5]=n*a-i*s,e[6]=a*u-o*l,e[7]=r*l-i*u,e[8]=i*o-r*a,e}function Vb(e){var t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*(u*a-o*l)+i*(-u*n+o*s)+r*(l*n-a*s)}function oy(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=i[0],d=i[1],f=i[2],y=i[3],g=i[4],_=i[5],b=i[6],v=i[7],w=i[8];return e[0]=p*r+d*o+f*u,e[1]=p*n+d*s+f*h,e[2]=p*a+d*l+f*c,e[3]=y*r+g*o+_*u,e[4]=y*n+g*s+_*h,e[5]=y*a+g*l+_*c,e[6]=b*r+v*o+w*u,e[7]=b*n+v*s+w*h,e[8]=b*a+v*l+w*c,e}function jb(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=i[0],d=i[1];return e[0]=r,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=p*r+d*o+u,e[7]=p*n+d*s+h,e[8]=p*a+d*l+c,e}function Gb(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=Math.sin(i),d=Math.cos(i);return e[0]=d*r+p*o,e[1]=d*n+p*s,e[2]=d*a+p*l,e[3]=d*o-p*r,e[4]=d*s-p*n,e[5]=d*l-p*a,e[6]=u,e[7]=h,e[8]=c,e}function Ub(e,t,i){var r=i[0],n=i[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Xb(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function $b(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function qb(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Yb(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function Zb(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i+i,s=r+r,l=n+n,u=i*o,h=r*o,c=r*s,p=n*o,d=n*s,f=n*l,y=a*o,g=a*s,_=a*l;return e[0]=1-c-f,e[3]=h-_,e[6]=p+g,e[1]=h+_,e[4]=1-u-f,e[7]=d-y,e[2]=p-g,e[5]=d+y,e[8]=1-u-c,e}function Wb(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],y=t[13],g=t[14],_=t[15],b=i*s-r*o,v=i*l-n*o,w=i*u-a*o,P=r*l-n*s,T=r*u-a*s,C=n*u-a*l,A=h*y-c*f,k=h*g-p*f,z=h*_-d*f,L=c*g-p*y,E=c*_-d*y,D=p*_-d*g,x=b*D-v*E+w*L+P*z-T*k+C*A;return x?(x=1/x,e[0]=(s*D-l*E+u*L)*x,e[1]=(l*z-o*D-u*k)*x,e[2]=(o*E-s*z+u*A)*x,e[3]=(n*E-r*D-a*L)*x,e[4]=(i*D-n*z+a*k)*x,e[5]=(r*z-i*E-a*A)*x,e[6]=(y*C-g*T+_*P)*x,e[7]=(g*w-f*C-_*v)*x,e[8]=(f*T-y*w+_*b)*x,e):null}function Hb(e,t,i){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/i,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function Kb(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function Jb(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function Qb(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e}function sy(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e}function ew(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e}function tw(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e}function iw(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function rw(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=t[0],p=t[1],d=t[2],f=t[3],y=t[4],g=t[5],_=t[6],b=t[7],v=t[8];return Math.abs(i-c)<=se*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(r-p)<=se*Math.max(1,Math.abs(r),Math.abs(p))&&Math.abs(n-d)<=se*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(a-f)<=se*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(o-y)<=se*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(s-g)<=se*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-_)<=se*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(u-b)<=se*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(h-v)<=se*Math.max(1,Math.abs(h),Math.abs(v))}var nw=oy,aw=sy,O={};Kr(O,{add:()=>Uw,adjoint:()=>dw,clone:()=>sw,copy:()=>lw,create:()=>ow,determinant:()=>fw,equals:()=>Yw,exactEquals:()=>qw,frob:()=>Gw,fromQuat:()=>Dw,fromQuat2:()=>Cw,fromRotation:()=>Pw,fromRotationTranslation:()=>hy,fromRotationTranslationScale:()=>Ew,fromRotationTranslationScaleOrigin:()=>kw,fromScaling:()=>ww,fromTranslation:()=>bw,fromValues:()=>uw,fromXRotation:()=>Tw,fromYRotation:()=>Sw,fromZRotation:()=>Mw,frustum:()=>Lw,getRotation:()=>Aw,getScaling:()=>cy,getTranslation:()=>Iw,identity:()=>ly,invert:()=>pw,lookAt:()=>Nw,mul:()=>Zw,multiply:()=>uy,multiplyScalar:()=>Xw,multiplyScalarAndAdd:()=>$w,ortho:()=>Rw,orthoNO:()=>dy,orthoZO:()=>Ow,perspective:()=>zw,perspectiveFromFieldOfView:()=>Bw,perspectiveNO:()=>py,perspectiveZO:()=>Fw,rotate:()=>gw,rotateX:()=>_w,rotateY:()=>xw,rotateZ:()=>vw,scale:()=>yw,set:()=>hw,str:()=>jw,sub:()=>Ww,subtract:()=>fy,targetTo:()=>Vw,translate:()=>mw,transpose:()=>cw});function ow(){var e=new Ee(16);return Ee!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function sw(e){var t=new Ee(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function lw(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function uw(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y){var g=new Ee(16);return g[0]=e,g[1]=t,g[2]=i,g[3]=r,g[4]=n,g[5]=a,g[6]=o,g[7]=s,g[8]=l,g[9]=u,g[10]=h,g[11]=c,g[12]=p,g[13]=d,g[14]=f,g[15]=y,g}function hw(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e[9]=h,e[10]=c,e[11]=p,e[12]=d,e[13]=f,e[14]=y,e[15]=g,e}function ly(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function cw(e,t){if(e===t){var i=t[1],r=t[2],n=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[11]=t[14],e[12]=n,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function pw(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],y=t[13],g=t[14],_=t[15],b=i*s-r*o,v=i*l-n*o,w=i*u-a*o,P=r*l-n*s,T=r*u-a*s,C=n*u-a*l,A=h*y-c*f,k=h*g-p*f,z=h*_-d*f,L=c*g-p*y,E=c*_-d*y,D=p*_-d*g,x=b*D-v*E+w*L+P*z-T*k+C*A;return x?(x=1/x,e[0]=(s*D-l*E+u*L)*x,e[1]=(n*E-r*D-a*L)*x,e[2]=(y*C-g*T+_*P)*x,e[3]=(p*T-c*C-d*P)*x,e[4]=(l*z-o*D-u*k)*x,e[5]=(i*D-n*z+a*k)*x,e[6]=(g*w-f*C-_*v)*x,e[7]=(h*C-p*w+d*v)*x,e[8]=(o*E-s*z+u*A)*x,e[9]=(r*z-i*E-a*A)*x,e[10]=(f*T-y*w+_*b)*x,e[11]=(c*w-h*T-d*b)*x,e[12]=(s*k-o*L-l*A)*x,e[13]=(i*L-r*k+n*A)*x,e[14]=(y*v-f*P-g*b)*x,e[15]=(h*P-c*v+p*b)*x,e):null}function dw(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],y=t[13],g=t[14],_=t[15];return e[0]=s*(p*_-d*g)-c*(l*_-u*g)+y*(l*d-u*p),e[1]=-(r*(p*_-d*g)-c*(n*_-a*g)+y*(n*d-a*p)),e[2]=r*(l*_-u*g)-s*(n*_-a*g)+y*(n*u-a*l),e[3]=-(r*(l*d-u*p)-s*(n*d-a*p)+c*(n*u-a*l)),e[4]=-(o*(p*_-d*g)-h*(l*_-u*g)+f*(l*d-u*p)),e[5]=i*(p*_-d*g)-h*(n*_-a*g)+f*(n*d-a*p),e[6]=-(i*(l*_-u*g)-o*(n*_-a*g)+f*(n*u-a*l)),e[7]=i*(l*d-u*p)-o*(n*d-a*p)+h*(n*u-a*l),e[8]=o*(c*_-d*y)-h*(s*_-u*y)+f*(s*d-u*c),e[9]=-(i*(c*_-d*y)-h*(r*_-a*y)+f*(r*d-a*c)),e[10]=i*(s*_-u*y)-o*(r*_-a*y)+f*(r*u-a*s),e[11]=-(i*(s*d-u*c)-o*(r*d-a*c)+h*(r*u-a*s)),e[12]=-(o*(c*g-p*y)-h*(s*g-l*y)+f*(s*p-l*c)),e[13]=i*(c*g-p*y)-h*(r*g-n*y)+f*(r*p-n*c),e[14]=-(i*(s*g-l*y)-o*(r*g-n*y)+f*(r*l-n*s)),e[15]=i*(s*p-l*c)-o*(r*p-n*c)+h*(r*l-n*s),e}function fw(e){var t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],h=e[9],c=e[10],p=e[11],d=e[12],f=e[13],y=e[14],g=e[15],_=t*o-i*a,b=t*s-r*a,v=t*l-n*a,w=i*s-r*o,P=i*l-n*o,T=r*l-n*s,C=u*f-h*d,A=u*y-c*d,k=u*g-p*d,z=h*y-c*f,L=h*g-p*f,E=c*g-p*y;return _*E-b*L+v*z+w*k-P*A+T*C}function uy(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=t[9],d=t[10],f=t[11],y=t[12],g=t[13],_=t[14],b=t[15],v=i[0],w=i[1],P=i[2],T=i[3];return e[0]=v*r+w*s+P*c+T*y,e[1]=v*n+w*l+P*p+T*g,e[2]=v*a+w*u+P*d+T*_,e[3]=v*o+w*h+P*f+T*b,v=i[4],w=i[5],P=i[6],T=i[7],e[4]=v*r+w*s+P*c+T*y,e[5]=v*n+w*l+P*p+T*g,e[6]=v*a+w*u+P*d+T*_,e[7]=v*o+w*h+P*f+T*b,v=i[8],w=i[9],P=i[10],T=i[11],e[8]=v*r+w*s+P*c+T*y,e[9]=v*n+w*l+P*p+T*g,e[10]=v*a+w*u+P*d+T*_,e[11]=v*o+w*h+P*f+T*b,v=i[12],w=i[13],P=i[14],T=i[15],e[12]=v*r+w*s+P*c+T*y,e[13]=v*n+w*l+P*p+T*g,e[14]=v*a+w*u+P*d+T*_,e[15]=v*o+w*h+P*f+T*b,e}function mw(e,t,i){var r=i[0],n=i[1],a=i[2],o,s,l,u,h,c,p,d,f,y,g,_;return t===e?(e[12]=t[0]*r+t[4]*n+t[8]*a+t[12],e[13]=t[1]*r+t[5]*n+t[9]*a+t[13],e[14]=t[2]*r+t[6]*n+t[10]*a+t[14],e[15]=t[3]*r+t[7]*n+t[11]*a+t[15]):(o=t[0],s=t[1],l=t[2],u=t[3],h=t[4],c=t[5],p=t[6],d=t[7],f=t[8],y=t[9],g=t[10],_=t[11],e[0]=o,e[1]=s,e[2]=l,e[3]=u,e[4]=h,e[5]=c,e[6]=p,e[7]=d,e[8]=f,e[9]=y,e[10]=g,e[11]=_,e[12]=o*r+h*n+f*a+t[12],e[13]=s*r+c*n+y*a+t[13],e[14]=l*r+p*n+g*a+t[14],e[15]=u*r+d*n+_*a+t[15]),e}function yw(e,t,i){var r=i[0],n=i[1],a=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function gw(e,t,i,r){var n=r[0],a=r[1],o=r[2],s=Math.hypot(n,a,o),l,u,h,c,p,d,f,y,g,_,b,v,w,P,T,C,A,k,z,L,E,D,x,M;return s<se?null:(s=1/s,n*=s,a*=s,o*=s,l=Math.sin(i),u=Math.cos(i),h=1-u,c=t[0],p=t[1],d=t[2],f=t[3],y=t[4],g=t[5],_=t[6],b=t[7],v=t[8],w=t[9],P=t[10],T=t[11],C=n*n*h+u,A=a*n*h+o*l,k=o*n*h-a*l,z=n*a*h-o*l,L=a*a*h+u,E=o*a*h+n*l,D=n*o*h+a*l,x=a*o*h-n*l,M=o*o*h+u,e[0]=c*C+y*A+v*k,e[1]=p*C+g*A+w*k,e[2]=d*C+_*A+P*k,e[3]=f*C+b*A+T*k,e[4]=c*z+y*L+v*E,e[5]=p*z+g*L+w*E,e[6]=d*z+_*L+P*E,e[7]=f*z+b*L+T*E,e[8]=c*D+y*x+v*M,e[9]=p*D+g*x+w*M,e[10]=d*D+_*x+P*M,e[11]=f*D+b*x+T*M,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function _w(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*n+u*r,e[5]=o*n+h*r,e[6]=s*n+c*r,e[7]=l*n+p*r,e[8]=u*n-a*r,e[9]=h*n-o*r,e[10]=c*n-s*r,e[11]=p*n-l*r,e}function xw(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],o=t[1],s=t[2],l=t[3],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n-u*r,e[1]=o*n-h*r,e[2]=s*n-c*r,e[3]=l*n-p*r,e[8]=a*r+u*n,e[9]=o*r+h*n,e[10]=s*r+c*n,e[11]=l*r+p*n,e}function vw(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],o=t[1],s=t[2],l=t[3],u=t[4],h=t[5],c=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n+u*r,e[1]=o*n+h*r,e[2]=s*n+c*r,e[3]=l*n+p*r,e[4]=u*n-a*r,e[5]=h*n-o*r,e[6]=c*n-s*r,e[7]=p*n-l*r,e}function bw(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function ww(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Pw(e,t,i){var r=i[0],n=i[1],a=i[2],o=Math.hypot(r,n,a),s,l,u;return o<se?null:(o=1/o,r*=o,n*=o,a*=o,s=Math.sin(t),l=Math.cos(t),u=1-l,e[0]=r*r*u+l,e[1]=n*r*u+a*s,e[2]=a*r*u-n*s,e[3]=0,e[4]=r*n*u-a*s,e[5]=n*n*u+l,e[6]=a*n*u+r*s,e[7]=0,e[8]=r*a*u+n*s,e[9]=n*a*u-r*s,e[10]=a*a*u+l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function Tw(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=i,e[7]=0,e[8]=0,e[9]=-i,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Sw(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=i,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Mw(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=0,e[4]=-i,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function hy(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=r+r,l=n+n,u=a+a,h=r*s,c=r*l,p=r*u,d=n*l,f=n*u,y=a*u,g=o*s,_=o*l,b=o*u;return e[0]=1-(d+y),e[1]=c+b,e[2]=p-_,e[3]=0,e[4]=c-b,e[5]=1-(h+y),e[6]=f+g,e[7]=0,e[8]=p+_,e[9]=f-g,e[10]=1-(h+d),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function Cw(e,t){var i=new Ee(3),r=-t[0],n=-t[1],a=-t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=r*r+n*n+a*a+o*o;return c>0?(i[0]=(s*o+h*r+l*a-u*n)*2/c,i[1]=(l*o+h*n+u*r-s*a)*2/c,i[2]=(u*o+h*a+s*n-l*r)*2/c):(i[0]=(s*o+h*r+l*a-u*n)*2,i[1]=(l*o+h*n+u*r-s*a)*2,i[2]=(u*o+h*a+s*n-l*r)*2),hy(e,t,i),e}function Iw(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function cy(e,t){var i=t[0],r=t[1],n=t[2],a=t[4],o=t[5],s=t[6],l=t[8],u=t[9],h=t[10];return e[0]=Math.hypot(i,r,n),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(l,u,h),e}function Aw(e,t){var i=new Ee(3);cy(i,t);var r=1/i[0],n=1/i[1],a=1/i[2],o=t[0]*r,s=t[1]*n,l=t[2]*a,u=t[4]*r,h=t[5]*n,c=t[6]*a,p=t[8]*r,d=t[9]*n,f=t[10]*a,y=o+h+f,g=0;return y>0?(g=Math.sqrt(y+1)*2,e[3]=.25*g,e[0]=(c-d)/g,e[1]=(p-l)/g,e[2]=(s-u)/g):o>h&&o>f?(g=Math.sqrt(1+o-h-f)*2,e[3]=(c-d)/g,e[0]=.25*g,e[1]=(s+u)/g,e[2]=(p+l)/g):h>f?(g=Math.sqrt(1+h-o-f)*2,e[3]=(p-l)/g,e[0]=(s+u)/g,e[1]=.25*g,e[2]=(c+d)/g):(g=Math.sqrt(1+f-o-h)*2,e[3]=(s-u)/g,e[0]=(p+l)/g,e[1]=(c+d)/g,e[2]=.25*g),e}function Ew(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=t[3],l=n+n,u=a+a,h=o+o,c=n*l,p=n*u,d=n*h,f=a*u,y=a*h,g=o*h,_=s*l,b=s*u,v=s*h,w=r[0],P=r[1],T=r[2];return e[0]=(1-(f+g))*w,e[1]=(p+v)*w,e[2]=(d-b)*w,e[3]=0,e[4]=(p-v)*P,e[5]=(1-(c+g))*P,e[6]=(y+_)*P,e[7]=0,e[8]=(d+b)*T,e[9]=(y-_)*T,e[10]=(1-(c+f))*T,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function kw(e,t,i,r,n){var a=t[0],o=t[1],s=t[2],l=t[3],u=a+a,h=o+o,c=s+s,p=a*u,d=a*h,f=a*c,y=o*h,g=o*c,_=s*c,b=l*u,v=l*h,w=l*c,P=r[0],T=r[1],C=r[2],A=n[0],k=n[1],z=n[2],L=(1-(y+_))*P,E=(d+w)*P,D=(f-v)*P,x=(d-w)*T,M=(1-(p+_))*T,I=(g+b)*T,R=(f+v)*C,N=(g-b)*C,$=(1-(p+y))*C;return e[0]=L,e[1]=E,e[2]=D,e[3]=0,e[4]=x,e[5]=M,e[6]=I,e[7]=0,e[8]=R,e[9]=N,e[10]=$,e[11]=0,e[12]=i[0]+A-(L*A+x*k+R*z),e[13]=i[1]+k-(E*A+M*k+N*z),e[14]=i[2]+z-(D*A+I*k+$*z),e[15]=1,e}function Dw(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i+i,s=r+r,l=n+n,u=i*o,h=r*o,c=r*s,p=n*o,d=n*s,f=n*l,y=a*o,g=a*s,_=a*l;return e[0]=1-c-f,e[1]=h+_,e[2]=p-g,e[3]=0,e[4]=h-_,e[5]=1-u-f,e[6]=d+y,e[7]=0,e[8]=p+g,e[9]=d-y,e[10]=1-u-c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Lw(e,t,i,r,n,a,o){var s=1/(i-t),l=1/(n-r),u=1/(a-o);return e[0]=a*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*l,e[6]=0,e[7]=0,e[8]=(i+t)*s,e[9]=(n+r)*l,e[10]=(o+a)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*u,e[15]=0,e}function py(e,t,i,r,n){var a=1/Math.tan(t/2),o;return e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&&n!==1/0?(o=1/(r-n),e[10]=(n+r)*o,e[14]=2*n*r*o):(e[10]=-1,e[14]=-2*r),e}var zw=py;function Fw(e,t,i,r,n){var a=1/Math.tan(t/2),o;return e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&&n!==1/0?(o=1/(r-n),e[10]=n*o,e[14]=n*r*o):(e[10]=-1,e[14]=-r),e}function Bw(e,t,i,r){var n=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(o+s),u=2/(n+a);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-((o-s)*l*.5),e[9]=(n-a)*u*.5,e[10]=r/(i-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*i/(i-r),e[15]=0,e}function dy(e,t,i,r,n,a,o){var s=1/(t-i),l=1/(r-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+i)*s,e[13]=(n+r)*l,e[14]=(o+a)*u,e[15]=1,e}var Rw=dy;function Ow(e,t,i,r,n,a,o){var s=1/(t-i),l=1/(r-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+i)*s,e[13]=(n+r)*l,e[14]=a*u,e[15]=1,e}function Nw(e,t,i,r){var n,a,o,s,l,u,h,c,p,d,f=t[0],y=t[1],g=t[2],_=r[0],b=r[1],v=r[2],w=i[0],P=i[1],T=i[2];return Math.abs(f-w)<se&&Math.abs(y-P)<se&&Math.abs(g-T)<se?ly(e):(h=f-w,c=y-P,p=g-T,d=1/Math.hypot(h,c,p),h*=d,c*=d,p*=d,n=b*p-v*c,a=v*h-_*p,o=_*c-b*h,d=Math.hypot(n,a,o),d?(d=1/d,n*=d,a*=d,o*=d):(n=0,a=0,o=0),s=c*o-p*a,l=p*n-h*o,u=h*a-c*n,d=Math.hypot(s,l,u),d?(d=1/d,s*=d,l*=d,u*=d):(s=0,l=0,u=0),e[0]=n,e[1]=s,e[2]=h,e[3]=0,e[4]=a,e[5]=l,e[6]=c,e[7]=0,e[8]=o,e[9]=u,e[10]=p,e[11]=0,e[12]=-(n*f+a*y+o*g),e[13]=-(s*f+l*y+u*g),e[14]=-(h*f+c*y+p*g),e[15]=1,e)}function Vw(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=r[0],l=r[1],u=r[2],h=n-i[0],c=a-i[1],p=o-i[2],d=h*h+c*c+p*p;d>0&&(d=1/Math.sqrt(d),h*=d,c*=d,p*=d);var f=l*p-u*c,y=u*h-s*p,g=s*c-l*h;return d=f*f+y*y+g*g,d>0&&(d=1/Math.sqrt(d),f*=d,y*=d,g*=d),e[0]=f,e[1]=y,e[2]=g,e[3]=0,e[4]=c*g-p*y,e[5]=p*f-h*g,e[6]=h*y-c*f,e[7]=0,e[8]=h,e[9]=c,e[10]=p,e[11]=0,e[12]=n,e[13]=a,e[14]=o,e[15]=1,e}function jw(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Gw(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Uw(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e[9]=t[9]+i[9],e[10]=t[10]+i[10],e[11]=t[11]+i[11],e[12]=t[12]+i[12],e[13]=t[13]+i[13],e[14]=t[14]+i[14],e[15]=t[15]+i[15],e}function fy(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e[9]=t[9]-i[9],e[10]=t[10]-i[10],e[11]=t[11]-i[11],e[12]=t[12]-i[12],e[13]=t[13]-i[13],e[14]=t[14]-i[14],e[15]=t[15]-i[15],e}function Xw(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12]*i,e[13]=t[13]*i,e[14]=t[14]*i,e[15]=t[15]*i,e}function $w(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e[9]=t[9]+i[9]*r,e[10]=t[10]+i[10]*r,e[11]=t[11]+i[11]*r,e[12]=t[12]+i[12]*r,e[13]=t[13]+i[13]*r,e[14]=t[14]+i[14]*r,e[15]=t[15]+i[15]*r,e}function qw(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function Yw(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],p=e[10],d=e[11],f=e[12],y=e[13],g=e[14],_=e[15],b=t[0],v=t[1],w=t[2],P=t[3],T=t[4],C=t[5],A=t[6],k=t[7],z=t[8],L=t[9],E=t[10],D=t[11],x=t[12],M=t[13],I=t[14],R=t[15];return Math.abs(i-b)<=se*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(r-v)<=se*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-w)<=se*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(a-P)<=se*Math.max(1,Math.abs(a),Math.abs(P))&&Math.abs(o-T)<=se*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(s-C)<=se*Math.max(1,Math.abs(s),Math.abs(C))&&Math.abs(l-A)<=se*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(u-k)<=se*Math.max(1,Math.abs(u),Math.abs(k))&&Math.abs(h-z)<=se*Math.max(1,Math.abs(h),Math.abs(z))&&Math.abs(c-L)<=se*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(p-E)<=se*Math.max(1,Math.abs(p),Math.abs(E))&&Math.abs(d-D)<=se*Math.max(1,Math.abs(d),Math.abs(D))&&Math.abs(f-x)<=se*Math.max(1,Math.abs(f),Math.abs(x))&&Math.abs(y-M)<=se*Math.max(1,Math.abs(y),Math.abs(M))&&Math.abs(g-I)<=se*Math.max(1,Math.abs(g),Math.abs(I))&&Math.abs(_-R)<=se*Math.max(1,Math.abs(_),Math.abs(R))}var Zw=uy,Ww=fy,nl={};Kr(nl,{add:()=>yP,calculateW:()=>aP,clone:()=>pP,conjugate:()=>uP,copy:()=>fP,create:()=>yh,dot:()=>Yy,equals:()=>wP,exactEquals:()=>bP,exp:()=>Uy,fromEuler:()=>hP,fromMat3:()=>$y,fromValues:()=>dP,getAngle:()=>tP,getAxisAngle:()=>eP,identity:()=>Q2,invert:()=>lP,len:()=>xP,length:()=>Zy,lerp:()=>_P,ln:()=>Xy,mul:()=>gP,multiply:()=>Gy,normalize:()=>_c,pow:()=>oP,random:()=>sP,rotateX:()=>iP,rotateY:()=>rP,rotateZ:()=>nP,rotationTo:()=>PP,scale:()=>qy,set:()=>mP,setAxes:()=>SP,setAxisAngle:()=>jy,slerp:()=>Is,sqlerp:()=>TP,sqrLen:()=>vP,squaredLength:()=>Wy,str:()=>cP});var V={};Kr(V,{add:()=>Qw,angle:()=>x2,bezier:()=>c2,ceil:()=>e2,clone:()=>Hw,copy:()=>Kw,create:()=>fc,cross:()=>Cs,dist:()=>C2,distance:()=>xy,div:()=>M2,divide:()=>_y,dot:()=>mc,equals:()=>P2,exactEquals:()=>w2,floor:()=>t2,forEach:()=>E2,fromValues:()=>mh,hermite:()=>h2,inverse:()=>l2,len:()=>Py,length:()=>my,lerp:()=>u2,max:()=>r2,min:()=>i2,mul:()=>S2,multiply:()=>gy,negate:()=>s2,normalize:()=>wy,random:()=>p2,rotateX:()=>y2,rotateY:()=>g2,rotateZ:()=>_2,round:()=>n2,scale:()=>a2,scaleAndAdd:()=>o2,set:()=>Jw,sqrDist:()=>I2,sqrLen:()=>A2,squaredDistance:()=>vy,squaredLength:()=>by,str:()=>b2,sub:()=>T2,subtract:()=>yy,transformMat3:()=>f2,transformMat4:()=>d2,transformQuat:()=>m2,zero:()=>v2});function fc(){var e=new Ee(3);return Ee!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Hw(e){var t=new Ee(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function my(e){var t=e[0],i=e[1],r=e[2];return Math.hypot(t,i,r)}function mh(e,t,i){var r=new Ee(3);return r[0]=e,r[1]=t,r[2]=i,r}function Kw(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Jw(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e}function Qw(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function yy(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function gy(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function _y(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e}function e2(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function t2(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function i2(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e}function r2(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e}function n2(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function a2(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function o2(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e}function xy(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return Math.hypot(i,r,n)}function vy(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}function by(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r}function s2(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function l2(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function wy(e,t){var i=t[0],r=t[1],n=t[2],a=i*i+r*r+n*n;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function mc(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Cs(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[0],s=i[1],l=i[2];return e[0]=n*l-a*s,e[1]=a*o-r*l,e[2]=r*s-n*o,e}function u2(e,t,i,r){var n=t[0],a=t[1],o=t[2];return e[0]=n+r*(i[0]-n),e[1]=a+r*(i[1]-a),e[2]=o+r*(i[2]-o),e}function h2(e,t,i,r,n,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),h=o*(3-2*a);return e[0]=t[0]*s+i[0]*l+r[0]*u+n[0]*h,e[1]=t[1]*s+i[1]*l+r[1]*u+n[1]*h,e[2]=t[2]*s+i[2]*l+r[2]*u+n[2]*h,e}function c2(e,t,i,r,n,a){var o=1-a,s=o*o,l=a*a,u=s*o,h=3*a*s,c=3*l*o,p=l*a;return e[0]=t[0]*u+i[0]*h+r[0]*c+n[0]*p,e[1]=t[1]*u+i[1]*h+r[1]*c+n[1]*p,e[2]=t[2]*u+i[2]*h+r[2]*c+n[2]*p,e}function p2(e,t){t=t||1;var i=Ti()*2*Math.PI,r=Ti()*2-1,n=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(i)*n,e[1]=Math.sin(i)*n,e[2]=r*t,e}function d2(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[3]*r+i[7]*n+i[11]*a+i[15];return o=o||1,e[0]=(i[0]*r+i[4]*n+i[8]*a+i[12])/o,e[1]=(i[1]*r+i[5]*n+i[9]*a+i[13])/o,e[2]=(i[2]*r+i[6]*n+i[10]*a+i[14])/o,e}function f2(e,t,i){var r=t[0],n=t[1],a=t[2];return e[0]=r*i[0]+n*i[3]+a*i[6],e[1]=r*i[1]+n*i[4]+a*i[7],e[2]=r*i[2]+n*i[5]+a*i[8],e}function m2(e,t,i){var r=i[0],n=i[1],a=i[2],o=i[3],s=t[0],l=t[1],u=t[2],h=n*u-a*l,c=a*s-r*u,p=r*l-n*s,d=n*p-a*c,f=a*h-r*p,y=r*c-n*h,g=o*2;return h*=g,c*=g,p*=g,d*=2,f*=2,y*=2,e[0]=s+h+d,e[1]=l+c+f,e[2]=u+p+y,e}function y2(e,t,i,r){var n=[],a=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],a[0]=n[0],a[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),a[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function g2(e,t,i,r){var n=[],a=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],a[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),a[1]=n[1],a[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function _2(e,t,i,r){var n=[],a=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],a[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),a[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),a[2]=n[2],e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function x2(e,t){var i=e[0],r=e[1],n=e[2],a=t[0],o=t[1],s=t[2],l=Math.sqrt(i*i+r*r+n*n),u=Math.sqrt(a*a+o*o+s*s),h=l*u,c=h&&mc(e,t)/h;return Math.acos(Math.min(Math.max(c,-1),1))}function v2(e){return e[0]=0,e[1]=0,e[2]=0,e}function b2(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function w2(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function P2(e,t){var i=e[0],r=e[1],n=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(i-a)<=se*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-o)<=se*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=se*Math.max(1,Math.abs(n),Math.abs(s))}var T2=yy,S2=gy,M2=_y,C2=xy,I2=vy,Py=my,A2=by,E2=(function(){var e=fc();return function(t,i,r,n,a,o){var s,l;for(i||(i=3),r||(r=0),n?l=Math.min(n*i+r,t.length):l=t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}})(),Ke={};Kr(Ke,{add:()=>Ay,ceil:()=>k2,clone:()=>Sy,copy:()=>Cy,create:()=>Ty,cross:()=>N2,dist:()=>Z2,distance:()=>zy,div:()=>Y2,divide:()=>Dy,dot:()=>Ry,equals:()=>Vy,exactEquals:()=>Ny,floor:()=>D2,forEach:()=>J2,fromValues:()=>My,inverse:()=>O2,len:()=>H2,length:()=>yc,lerp:()=>Oy,max:()=>z2,min:()=>L2,mul:()=>q2,multiply:()=>ky,negate:()=>R2,normalize:()=>By,random:()=>V2,round:()=>F2,scale:()=>Ly,scaleAndAdd:()=>B2,set:()=>Iy,sqrDist:()=>W2,sqrLen:()=>K2,squaredDistance:()=>Fy,squaredLength:()=>gc,str:()=>X2,sub:()=>$2,subtract:()=>Ey,transformMat4:()=>j2,transformQuat:()=>G2,zero:()=>U2});function Ty(){var e=new Ee(4);return Ee!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Sy(e){var t=new Ee(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function My(e,t,i,r){var n=new Ee(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n}function Cy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Iy(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e}function Ay(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e}function Ey(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function ky(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function Dy(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e[3]=t[3]/i[3],e}function k2(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function D2(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function L2(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e[3]=Math.min(t[3],i[3]),e}function z2(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e[3]=Math.max(t[3],i[3]),e}function F2(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function Ly(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function B2(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e}function zy(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return Math.hypot(i,r,n,a)}function Fy(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return i*i+r*r+n*n+a*a}function yc(e){var t=e[0],i=e[1],r=e[2],n=e[3];return Math.hypot(t,i,r,n)}function gc(e){var t=e[0],i=e[1],r=e[2],n=e[3];return t*t+i*i+r*r+n*n}function R2(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function O2(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function By(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*i+r*r+n*n+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=i*o,e[1]=r*o,e[2]=n*o,e[3]=a*o,e}function Ry(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function N2(e,t,i,r){var n=i[0]*r[1]-i[1]*r[0],a=i[0]*r[2]-i[2]*r[0],o=i[0]*r[3]-i[3]*r[0],s=i[1]*r[2]-i[2]*r[1],l=i[1]*r[3]-i[3]*r[1],u=i[2]*r[3]-i[3]*r[2],h=t[0],c=t[1],p=t[2],d=t[3];return e[0]=c*u-p*l+d*s,e[1]=-(h*u)+p*o-d*a,e[2]=h*l-c*o+d*n,e[3]=-(h*s)+c*a-p*n,e}function Oy(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=t[3];return e[0]=n+r*(i[0]-n),e[1]=a+r*(i[1]-a),e[2]=o+r*(i[2]-o),e[3]=s+r*(i[3]-s),e}function V2(e,t){t=t||1;var i,r,n,a,o,s;do i=Ti()*2-1,r=Ti()*2-1,o=i*i+r*r;while(o>=1);do n=Ti()*2-1,a=Ti()*2-1,s=n*n+a*a;while(s>=1);var l=Math.sqrt((1-o)/s);return e[0]=t*i,e[1]=t*r,e[2]=t*n*l,e[3]=t*a*l,e}function j2(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*a+i[12]*o,e[1]=i[1]*r+i[5]*n+i[9]*a+i[13]*o,e[2]=i[2]*r+i[6]*n+i[10]*a+i[14]*o,e[3]=i[3]*r+i[7]*n+i[11]*a+i[15]*o,e}function G2(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[0],s=i[1],l=i[2],u=i[3],h=u*r+s*a-l*n,c=u*n+l*r-o*a,p=u*a+o*n-s*r,d=-o*r-s*n-l*a;return e[0]=h*u+d*-o+c*-l-p*-s,e[1]=c*u+d*-s+p*-o-h*-l,e[2]=p*u+d*-l+h*-s-c*-o,e[3]=t[3],e}function U2(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function X2(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function Ny(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function Vy(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(i-o)<=se*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-s)<=se*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-l)<=se*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=se*Math.max(1,Math.abs(a),Math.abs(u))}var $2=Ey,q2=ky,Y2=Dy,Z2=zy,W2=Fy,H2=yc,K2=gc,J2=(function(){var e=Ty();return function(t,i,r,n,a,o){var s,l;for(i||(i=4),r||(r=0),n?l=Math.min(n*i+r,t.length):l=t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}})();function yh(){var e=new Ee(4);return Ee!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Q2(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function jy(e,t,i){i=i*.5;var r=Math.sin(i);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i),e}function eP(e,t){var i=Math.acos(t[3])*2,r=Math.sin(i/2);return r>se?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),i}function tP(e,t){var i=Yy(e,t);return Math.acos(2*i*i-1)}function Gy(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=i[0],l=i[1],u=i[2],h=i[3];return e[0]=r*h+o*s+n*u-a*l,e[1]=n*h+o*l+a*s-r*u,e[2]=a*h+o*u+r*l-n*s,e[3]=o*h-r*s-n*l-a*u,e}function iP(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+o*s,e[1]=n*l+a*s,e[2]=a*l-n*s,e[3]=o*l-r*s,e}function rP(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l-a*s,e[1]=n*l+o*s,e[2]=a*l+r*s,e[3]=o*l-n*s,e}function nP(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+n*s,e[1]=n*l-r*s,e[2]=a*l+o*s,e[3]=o*l-a*s,e}function aP(e,t){var i=t[0],r=t[1],n=t[2];return e[0]=i,e[1]=r,e[2]=n,e[3]=Math.sqrt(Math.abs(1-i*i-r*r-n*n)),e}function Uy(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=Math.sqrt(i*i+r*r+n*n),s=Math.exp(a),l=o>0?s*Math.sin(o)/o:0;return e[0]=i*l,e[1]=r*l,e[2]=n*l,e[3]=s*Math.cos(o),e}function Xy(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=Math.sqrt(i*i+r*r+n*n),s=o>0?Math.atan2(o,a)/o:0;return e[0]=i*s,e[1]=r*s,e[2]=n*s,e[3]=.5*Math.log(i*i+r*r+n*n+a*a),e}function oP(e,t,i){return Xy(e,t),qy(e,e,i),Uy(e,e),e}function Is(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=t[3],l=i[0],u=i[1],h=i[2],c=i[3],p,d,f,y,g;return d=n*l+a*u+o*h+s*c,d<0&&(d=-d,l=-l,u=-u,h=-h,c=-c),1-d>se?(p=Math.acos(d),f=Math.sin(p),y=Math.sin((1-r)*p)/f,g=Math.sin(r*p)/f):(y=1-r,g=r),e[0]=y*n+g*l,e[1]=y*a+g*u,e[2]=y*o+g*h,e[3]=y*s+g*c,e}function sP(e){var t=Ti(),i=Ti(),r=Ti(),n=Math.sqrt(1-t),a=Math.sqrt(t);return e[0]=n*Math.sin(2*Math.PI*i),e[1]=n*Math.cos(2*Math.PI*i),e[2]=a*Math.sin(2*Math.PI*r),e[3]=a*Math.cos(2*Math.PI*r),e}function lP(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*i+r*r+n*n+a*a,s=o?1/o:0;return e[0]=-i*s,e[1]=-r*s,e[2]=-n*s,e[3]=a*s,e}function uP(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function $y(e,t){var i=t[0]+t[4]+t[8],r;if(i>0)r=Math.sqrt(i+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[n*3+n]&&(n=2);var a=(n+1)%3,o=(n+2)%3;r=Math.sqrt(t[n*3+n]-t[a*3+a]-t[o*3+o]+1),e[n]=.5*r,r=.5/r,e[3]=(t[a*3+o]-t[o*3+a])*r,e[a]=(t[a*3+n]+t[n*3+a])*r,e[o]=(t[o*3+n]+t[n*3+o])*r}return e}function hP(e,t,i,r){var n=.5*Math.PI/180;t*=n,i*=n,r*=n;var a=Math.sin(t),o=Math.cos(t),s=Math.sin(i),l=Math.cos(i),u=Math.sin(r),h=Math.cos(r);return e[0]=a*l*h-o*s*u,e[1]=o*s*h+a*l*u,e[2]=o*l*u-a*s*h,e[3]=o*l*h+a*s*u,e}function cP(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var pP=Sy,dP=My,fP=Cy,mP=Iy,yP=Ay,gP=Gy,qy=Ly,Yy=Ry,_P=Oy,Zy=yc,xP=Zy,Wy=gc,vP=Wy,_c=By,bP=Ny,wP=Vy,PP=(function(){var e=fc(),t=mh(1,0,0),i=mh(0,1,0);return function(r,n,a){var o=mc(n,a);return o<-.999999?(Cs(e,t,n),Py(e)<1e-6&&Cs(e,i,n),wy(e,e),jy(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Cs(e,n,a),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,_c(r,r))}})(),TP=(function(){var e=yh(),t=yh();return function(i,r,n,a,o,s){return Is(e,r,o,s),Is(t,n,a,s),Is(i,e,t,2*s*(1-s)),i}})(),SP=(function(){var e=ay();return function(t,i,r,n){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=n[0],e[4]=n[1],e[7]=n[2],e[2]=-i[0],e[5]=-i[1],e[8]=-i[2],_c(t,$y(t,e))}})(),It={};Kr(It,{add:()=>EP,angle:()=>HP,ceil:()=>kP,clone:()=>MP,copy:()=>IP,create:()=>Hy,cross:()=>GP,dist:()=>aT,distance:()=>eg,div:()=>nT,divide:()=>Qy,dot:()=>jP,equals:()=>eT,exactEquals:()=>QP,floor:()=>DP,forEach:()=>lT,fromValues:()=>CP,inverse:()=>NP,len:()=>tT,length:()=>ig,lerp:()=>UP,max:()=>zP,min:()=>LP,mul:()=>rT,multiply:()=>Jy,negate:()=>OP,normalize:()=>VP,random:()=>XP,rotate:()=>WP,round:()=>FP,scale:()=>BP,scaleAndAdd:()=>RP,set:()=>AP,sqrDist:()=>oT,sqrLen:()=>sT,squaredDistance:()=>tg,squaredLength:()=>rg,str:()=>JP,sub:()=>iT,subtract:()=>Ky,transformMat2:()=>$P,transformMat2d:()=>qP,transformMat3:()=>YP,transformMat4:()=>ZP,zero:()=>KP});function Hy(){var e=new Ee(2);return Ee!=Float32Array&&(e[0]=0,e[1]=0),e}function MP(e){var t=new Ee(2);return t[0]=e[0],t[1]=e[1],t}function CP(e,t){var i=new Ee(2);return i[0]=e,i[1]=t,i}function IP(e,t){return e[0]=t[0],e[1]=t[1],e}function AP(e,t,i){return e[0]=t,e[1]=i,e}function EP(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function Ky(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function Jy(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e}function Qy(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e}function kP(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function DP(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function LP(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e}function zP(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e}function FP(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function BP(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function RP(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e}function eg(e,t){var i=t[0]-e[0],r=t[1]-e[1];return Math.hypot(i,r)}function tg(e,t){var i=t[0]-e[0],r=t[1]-e[1];return i*i+r*r}function ig(e){var t=e[0],i=e[1];return Math.hypot(t,i)}function rg(e){var t=e[0],i=e[1];return t*t+i*i}function OP(e,t){return e[0]=-t[0],e[1]=-t[1],e}function NP(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function VP(e,t){var i=t[0],r=t[1],n=i*i+r*r;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e}function jP(e,t){return e[0]*t[0]+e[1]*t[1]}function GP(e,t,i){var r=t[0]*i[1]-t[1]*i[0];return e[0]=e[1]=0,e[2]=r,e}function UP(e,t,i,r){var n=t[0],a=t[1];return e[0]=n+r*(i[0]-n),e[1]=a+r*(i[1]-a),e}function XP(e,t){t=t||1;var i=Ti()*2*Math.PI;return e[0]=Math.cos(i)*t,e[1]=Math.sin(i)*t,e}function $P(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n,e[1]=i[1]*r+i[3]*n,e}function qP(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n+i[4],e[1]=i[1]*r+i[3]*n+i[5],e}function YP(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[3]*n+i[6],e[1]=i[1]*r+i[4]*n+i[7],e}function ZP(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e}function WP(e,t,i,r){var n=t[0]-i[0],a=t[1]-i[1],o=Math.sin(r),s=Math.cos(r);return e[0]=n*s-a*o+i[0],e[1]=n*o+a*s+i[1],e}function HP(e,t){var i=e[0],r=e[1],n=t[0],a=t[1],o=Math.sqrt(i*i+r*r)*Math.sqrt(n*n+a*a),s=o&&(i*n+r*a)/o;return Math.acos(Math.min(Math.max(s,-1),1))}function KP(e){return e[0]=0,e[1]=0,e}function JP(e){return"vec2("+e[0]+", "+e[1]+")"}function QP(e,t){return e[0]===t[0]&&e[1]===t[1]}function eT(e,t){var i=e[0],r=e[1],n=t[0],a=t[1];return Math.abs(i-n)<=se*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(r-a)<=se*Math.max(1,Math.abs(r),Math.abs(a))}var tT=ig,iT=Ky,rT=Jy,nT=Qy,aT=eg,oT=tg,sT=rg,lT=(function(){var e=Hy();return function(t,i,r,n,a,o){var s,l;for(i||(i=2),r||(r=0),n?l=Math.min(n*i+r,t.length):l=t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],a(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}})();function Nt(e,t,i){return t*(8192/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}function da(){return new Float64Array(4)}function it(){return new Float64Array(3)}function yr(){return new Float64Array(16)}function _n(){let e=new Float64Array(16);return O.identity(e),e}function ng(){let e=new Float32Array(16);return O.identity(e),e}function vr(e,t,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];let a=n?r==="map"?-e.bearingInRadians:0:r==="viewport"?e.bearingInRadians:0;if(a){let o=Math.sin(a),s=Math.cos(a);i=[i[0]*s-i[1]*o,i[0]*o+i[1]*s]}return[n?i[0]:Nt(t,i[0],e.zoom),n?i[1]:Nt(t,i[1],e.zoom)]}function gh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]}function Kt(e,t,i){let r=Ua.determinant([e[0],e[1],e[2],t[0],t[1],t[2],i[0],i[1],i[2]]);if(r===0)return null;let n=V.cross([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),a=V.cross([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),o=V.cross([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),s=V.scale([],n,-e[3]);return V.add(s,s,V.scale([],a,-t[3])),V.add(s,s,V.scale([],o,-i[3])),V.scale(s,s,1/r),s}function uT(e,t,i){let r=e[0]*i[0]+e[1]*i[1]+e[2]*i[2],n=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];return n===0?null:(-r-i[3])/n}function Yo(e,t,i,r){let n=Math.sqrt(e*e+t*t),a=Math.sqrt(i*i+r*r);e/=n,t/=n,i/=a,r/=a;let o=e*i+t*r,s=Math.acos(o);return-t*i+e*r>0?s:-s}function Bt(e,t){let i=Fn(e,360),r=Fn(t,360),n=r-i,a=r>i?n-360:n+360;return Math.abs(n)<Math.abs(a)?n:a}function Zo(e,t){let i=Fn(e,Math.PI*2),r=Fn(t,Math.PI*2);return Math.min(Math.abs(i-r),Math.abs(i-r+Math.PI*2),Math.abs(i-r-Math.PI*2))}function Fn(e,t){return(e%t+t)%t}function As(e,t,i,r,n){let a=Te((e-t)/(i-t),0,1);return An(r,n,a)}function An(e,t,i){return e*(1-i)+t*i}function hT(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(let a of e)t=Math.min(t,a.x),i=Math.min(i,a.y),r=Math.max(r,a.x),n=Math.max(n,a.y);return[t,i,r,n]}function ag(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function xc(e,t,i,r){let n=new ab.default(e,t,i,r);return a=>n.solve(a)}var _h=xc(.25,.1,.25,1);function Te(e,t,i){return Math.min(i,Math.max(t,e))}function jr(e,t,i){let r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function cT(e,t){let i=[];for(let r in e)r in t||i.push(r);return i}function H(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}function lo(e,t){let i={};for(let r=0;r<t.length;r++){let n=t[r];n in e&&(i[n]=e[n])}return i}var pT=1;function og(){return pT++}function dT(e){return Math.log(e)/Math.LN2%1===0}function fT(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function wt(e){return Math.pow(2,e)}function Pt(e){return Math.log(e)/Math.LN2}function vc(e,t,i){let r={};for(let n in e)r[n]=t.call(i||this,e[n],n,e);return r}function sg(e,t,i){let r={};for(let n in e)t.call(i||this,e[n],n,e)&&(r[n]=e[n]);return r}function bi(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!bi(e[i],t[i]))return!1;return!0}if(typeof e=="object"&&e!==null&&t!==null){if(typeof t!="object"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!bi(e[i],t[i]))return!1;return!0}return e===t}function At(e){return Array.isArray(e)?e.map(At):typeof e=="object"&&e?vc(e,At):e}var Yd={};function nt(e){Yd[e]||(typeof console<"u"&&console.warn(e),Yd[e]=!0)}function gr(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function mT(e,t,i,r){let n=t.y-e.y,a=t.x-e.x,o=r.y-i.y,s=r.x-i.x,l=o*a-s*n;if(l===0)return null;let u=e.y-i.y,h=e.x-i.x,c=(s*u-o*h)/l;return new nb.default(e.x+c*a,e.y+c*n)}function yT([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(i),y:e*Math.sin(t)*Math.sin(i),z:e*Math.cos(i)}}function Bn(e){return typeof WorkerGlobalScope<"u"&&typeof e<"u"&&e instanceof WorkerGlobalScope}function gT(e){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,i={};if(e.replace(t,(r,n,a,o)=>{let s=a||o;return i[n]=s?s.toLowerCase():!0,""}),i["max-age"]){let r=parseInt(i["max-age"],10);isNaN(r)?delete i["max-age"]:i["max-age"]=r}return i}var Du=null;function _T(e){if(Du==null){let t=e.navigator?e.navigator.userAgent:null;Du=!!e.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Du}function Zi(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}var xT=async e=>{if(e.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(t)}catch(i){throw new Error("Could not load image because of ".concat(i.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}},Zd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",vT=e=>new Promise((t,i)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=Zd})},r.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let n=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(n):Zd});function bT(e,t,i,r,n){let a=Math.max(-t,0)*4,o=(Math.max(0,i)-i)*r*4+a,s=r*4,l=Math.max(0,t),u=Math.max(0,i),h=Math.min(e.width,t+r),c=Math.min(e.height,i+n);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:o,stride:s}]}}async function wT(e,t,i,r,n){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let a=new VideoFrame(e,{timestamp:0});try{let o=a==null?void 0:a.format;if(!o||!(o.startsWith("BGR")||o.startsWith("RGB")))throw new Error("Unrecognized format ".concat(o));let s=o.startsWith("BGR"),l=new Uint8ClampedArray(r*n*4);if(await a.copyTo(l,bT(e,t,i,r,n)),s)for(let u=0;u<l.length;u+=4){let h=l[u];l[u]=l[u+2],l[u+2]=h}return l}finally{a.close()}}function xh(e,t,i,r){return e.addEventListener(t,i,r),{unsubscribe:()=>{e.removeEventListener(t,i,r)}}}function Fe(e){return e*Math.PI/180}function Mn(e){return e/Math.PI*180}function lg(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing}function PT(e){let t=new Float64Array(9);Ua.fromQuat(t,e);let i=Mn(-Math.asin(Te(t[2],-1,1))),r,n;return Math.hypot(t[5],t[8])<.001?(r=0,n=-Mn(Math.atan2(t[3],t[4]))):(r=Mn(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),n=Mn(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:r,pitch:i+90,bearing:n}}function TT(e,t,i){let r=It.fromValues(t.x-i.x,t.y-i.y),n=It.fromValues(e.x-i.x,e.y-i.y),a=r[0]*n[1]-r[1]*n[0],o=Math.atan2(a,It.dot(r,n));return Mn(o)}function Wd(e,t,i){let r=new Float64Array(4);return nl.fromEuler(r,e,t-90,i),r}var al=25,bc=0,Ei=85.051129,ug={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},hg={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function ST(e,t){return ug[t]&&"touches"in e}function MT(e,t){return hg[t]&&(e instanceof MouseEvent||e instanceof WheelEvent)}function CT(e){return ug[e]||hg[e]}var cg="AbortError";function IT(e){return e.message===cg}function ol(){return new Error(cg)}var AT=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),Wo,Lu,me={now:AT,frame(e,t,i){let r=requestAnimationFrame(a=>{n(),t(a)}),{unsubscribe:n}=xh(e.signal,"abort",()=>{n(),cancelAnimationFrame(r),i(ol())},!1)},frameAsync(e){return new Promise((t,i)=>{this.frame(e,t,i)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0,e.width,e.height),i},resolveURL(e){return Wo||(Wo=document.createElement("a")),Wo.href=e,Wo.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Lu==null&&(Lu=matchMedia("(prefers-reduced-motion: reduce)")),Lu.matches):!1}},ET=ne(le(),1),xn=class ke{static testProp(t){if(!ke.docStyle)return t[0];for(let i=0;i<t.length;i++)if(t[i]in ke.docStyle)return t[i];return t[0]}static create(t,i,r){let n=window.document.createElement(t);return i!==void 0&&(n.className=i),r&&r.appendChild(n),n}static createNS(t,i){return window.document.createElementNS(t,i)}static disableDrag(){ke.docStyle&&ke.selectProp&&(ke.userSelect=ke.docStyle[ke.selectProp],ke.docStyle[ke.selectProp]="none")}static enableDrag(){ke.docStyle&&ke.selectProp&&(ke.docStyle[ke.selectProp]=ke.userSelect)}static setTransform(t,i){t.style[ke.transformProp]=i}static addEventListener(t,i,r,n={}){"passive"in n?t.addEventListener(i,r,n):t.addEventListener(i,r,n.capture)}static removeEventListener(t,i,r,n={}){"passive"in n?t.removeEventListener(i,r,n):t.removeEventListener(i,r,n.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",ke.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ke.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ke.suppressClickInternal,!0)},0)}static getScale(t){let i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}static getPoint(t,i,r){let n=i.boundingClientRect;return new ET.default((r.clientX-n.left)/i.x-t.clientLeft,(r.clientY-n.top)/i.y-t.clientTop)}static mousePos(t,i){let r=ke.getScale(t);return ke.getPoint(t,r,i)}static touchPos(t,i){let r=[],n=ke.getScale(t);for(let a=0;a<i.length;a++)r.push(ke.getPoint(t,n,i[a]));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){let i=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),r=i.querySelectorAll("script");for(let n of r)n.remove();return ke.clean(i),i.innerHTML}static isPossiblyDangerous(t,i){let r=i.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(t)&&(r.includes("javascript:")||r.includes("data:"))||t.startsWith("on"))return!0}static clean(t){let i=t.children;for(let r of i)ke.removeAttributes(r),ke.clean(r)}static removeAttributes(t){for(let{name:i,value:r}of t.attributes)ke.isPossiblyDangerous(i,r)&&t.removeAttribute(i)}};xn.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,xn.selectProp=xn.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),xn.transformProp=xn.testProp(["transform","WebkitTransform"]);var ye=xn,br={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function pg(e){return br.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}var vh="global-dispatcher",Vs=class extends Error{constructor(e,t,i,r){super("AJAXError: ".concat(t," (").concat(e,"): ").concat(i)),this.status=e,this.statusText=t,this.url=i,this.body=r}},wc=()=>Bn(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,kT=e=>/^file:/.test(e)||/^file:/.test(wc())&&!/^\w+:/.test(e);async function DT(e,t){let i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:wc(),signal:t.signal});e.type==="json"&&!i.headers.has("Accept")&&i.headers.set("Accept","application/json");let r;try{r=await fetch(i)}catch(o){throw new Vs(0,o.message,e.url,new Blob)}if(!r.ok){let o=await r.blob();throw new Vs(r.status,r.statusText,e.url,o)}let n;e.type==="arrayBuffer"||e.type==="image"?n=r.arrayBuffer():e.type==="json"?n=r.json():n=r.text();let a=await n;if(t.signal.aborted)throw ol();return{data:a,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}function LT(e,t){return new Promise((i,r)=>{var a;let n=new XMLHttpRequest;n.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(n.responseType="arraybuffer");for(let o in e.headers)n.setRequestHeader(o,e.headers[o]);e.type==="json"&&(n.responseType="text",(a=e.headers)!=null&&a.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials=e.credentials==="include",n.onerror=()=>{r(new Error(n.statusText))},n.onload=()=>{if(!t.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let o=n.response;if(e.type==="json")try{o=JSON.parse(n.response)}catch(s){r(s);return}i({data:o,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{let o=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});r(new Vs(n.status,n.statusText,e.url,o))}},t.signal.addEventListener("abort",()=>{n.abort(),r(ol())}),n.send(e.body)})}var sl=function(e,t){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){let i=pg(e.url);if(i)return i(e,t);if(Bn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:vh},t)}if(!kT(e.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return DT(e,t);if(Bn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:vh},t)}return LT(e,t)},ll=(e,t)=>sl(H(e,{type:"json"}),t),zT=(e,t)=>sl(H(e,{type:"arrayBuffer"}),t);function dg(e){if(!e||e.indexOf("://")<=0||e.indexOf("data:image/")===0||e.indexOf("blob:")===0)return!0;let t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}var FT=e=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(i=>{t.onloadstart=()=>{i(t)};for(let r of e){let n=window.document.createElement("source");dg(r)||(t.crossOrigin="Anonymous"),n.src=r,t.appendChild(n)}})},Pc={supported:!1,testSupport:BT},Ca,Tc=!1,Cn,fg=!1;typeof document<"u"&&(Cn=document.createElement("img"),Cn.onload=()=>{Ca&&mg(Ca),Ca=null,fg=!0},Cn.onerror=()=>{Tc=!0,Ca=null},Cn.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function BT(e){Tc||!Cn||(fg?mg(e):Ca=e)}function mg(e){let t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,Cn),e.isContextLost())return;Pc.supported=!0}catch(i){}e.deleteTexture(t),Tc=!0}var Ci;(e=>{let t,i,r,n;e.resetRequestQueue=()=>{t=[],i=0,r=0,n={}},e.addThrottleControl=h=>{let c=r++;return n[c]=h,c},e.removeThrottleControl=h=>{delete n[h],l()};let a=()=>{for(let h of Object.keys(n))if(n[h]())return!0;return!1};e.getImage=(h,c,p=!0)=>new Promise((d,f)=>{Pc.supported&&(h.headers||(h.headers={}),h.headers.accept="image/webp,*/*"),H(h,{type:"image"});let y={abortController:c,requestParameters:h,supportImageRefresh:p,state:"queued",onError:g=>{f(g)},onSuccess:g=>{d(g)}};t.push(y),l()});let o=h=>typeof createImageBitmap=="function"?xT(h):vT(h),s=async h=>{h.state="running";let{requestParameters:c,supportImageRefresh:p,onError:d,onSuccess:f,abortController:y}=h,g=p===!1&&!Bn(self)&&!pg(c.url)&&(!c.headers||Object.keys(c.headers).reduce((b,v)=>b&&v==="accept",!0));i++;let _=g?u(c,y):sl(c,y);try{let b=await _;if(delete h.abortController,h.state="completed",b.data instanceof HTMLImageElement||Zi(b.data))f(b);else if(b.data){let v=await o(b.data);f({data:v,cacheControl:b.cacheControl,expires:b.expires})}}catch(b){delete h.abortController,d(b)}finally{i--,l()}},l=()=>{let h=a()?br.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:br.MAX_PARALLEL_IMAGE_REQUESTS;for(let c=i;c<h&&t.length>0;c++){let p=t.shift();if(p.abortController.signal.aborted){c--;continue}s(p)}},u=(h,c)=>new Promise((p,d)=>{let f=new Image,y=h.url,g=h.credentials;g&&g==="include"?f.crossOrigin="use-credentials":(g&&g==="same-origin"||!dg(y))&&(f.crossOrigin="anonymous"),c.signal.addEventListener("abort",()=>{f.src="",d(ol())}),f.fetchPriority="high",f.onload=()=>{f.onerror=f.onload=null,p({data:f})},f.onerror=()=>{f.onerror=f.onload=null,!c.signal.aborted&&d(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},f.src=y})})(Ci||(Ci={}));Ci.resetRequestQueue();var RT=class{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn?this._transformRequestFn(e,t)||{url:e}:{url:e}}setTransformRequest(e){this._transformRequestFn=e}};function Hd(e,t,i){i[e]&&i[e].indexOf(t)!==-1||(i[e]=i[e]||[],i[e].push(t))}function zu(e,t,i){if(i&&i[e]){let r=i[e].indexOf(t);r!==-1&&i[e].splice(r,1)}}var U=class{constructor(e,t={}){H(this,t),this.type=e}},te=class extends U{constructor(e,t={}){super("error",H({error:e},t))}},Et=class{on(e,t){return this._listeners=this._listeners||{},Hd(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return zu(e,t,this._listeners),zu(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Hd(e,t,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,t){typeof e=="string"&&(e=new U(e,t||{}));let i=e.type;if(this.listens(i)){e.target=this;let r=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(let o of r)o.call(this,e);let n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(let o of n)zu(i,o,this._oneTimeListeners),o.call(this,e);let a=this._eventedParent;a&&(H(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof te&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}},OT=8,NT={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},VT={"*":{type:"source"}},jT=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],GT={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},UT={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},XT={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},$T={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},qT={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},YT={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},ZT={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},WT=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],HT={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},KT={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},JT={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},QT={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},eS={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},tS={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},iS={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},rS={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},nS={type:"array",value:"*"},aS={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},oS={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},sS={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},lS={type:"array",value:"*",minimum:1},uS={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},hS={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},cS={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},pS={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},dS=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],fS={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},mS={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},yS={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},gS={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},_S={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},xS={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},vS={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},bS={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},wS={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},PS={"*":{type:"string"}},B={$version:OT,$root:NT,sources:VT,source:jT,source_vector:GT,source_raster:UT,source_raster_dem:XT,source_geojson:$T,source_video:qT,source_image:YT,layer:ZT,layout:WT,layout_background:HT,layout_fill:KT,layout_circle:JT,layout_heatmap:QT,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:eS,layout_symbol:tS,layout_raster:iS,layout_hillshade:rS,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:nS,filter_operator:aS,geometry_type:oS,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:sS,expression:lS,light:uS,sky:hS,terrain:cS,projection:pS,paint:dS,paint_fill:fS,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:mS,paint_circle:yS,paint_heatmap:gS,paint_symbol:_S,paint_raster:xS,paint_hillshade:vS,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:bS,transition:wS,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:PS},TS=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function SS(e,t){let i={};for(let r in e)r!=="ref"&&(i[r]=e[r]);return TS.forEach(r=>{r in t&&(i[r]=t[r])}),i}function Kd(e){e=e.slice();let t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=SS(e[i],t[e[i].ref]));return e}function Me(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Me(e[i],t[i]))return!1;return!0}if(typeof e=="object"&&e!==null&&t!==null){if(typeof t!="object"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!Me(e[i],t[i]))return!1;return!0}return e===t}function Jt(e,t){e.push(t)}function yg(e,t,i){Jt(i,{command:"addSource",args:[e,t[e]]})}function gg(e,t,i){Jt(t,{command:"removeSource",args:[e]}),i[e]=!0}function MS(e,t,i,r){gg(e,i,r),yg(e,t,i)}function CS(e,t,i){let r;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&r!=="data"&&!Me(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&r!=="data"&&!Me(e[i][r],t[i][r]))return!1;return!0}function IS(e,t,i,r){e=e||{},t=t||{};let n;for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)||gg(n,i,r));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?Me(e[n],t[n])||(e[n].type==="geojson"&&t[n].type==="geojson"&&CS(e,t,n)?Jt(i,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):MS(n,t,i,r)):yg(n,t,i))}function Ho(e,t,i,r,n,a){e=e||{},t=t||{};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(Me(e[o],t[o])||i.push({command:a,args:[r,o,t[o],n]}));for(let o in t)!Object.prototype.hasOwnProperty.call(t,o)||Object.prototype.hasOwnProperty.call(e,o)||Me(e[o],t[o])||i.push({command:a,args:[r,o,t[o],n]})}function Jd(e){return e.id}function Qd(e,t){return e[t.id]=t,e}function AS(e,t,i){e=e||[],t=t||[];let r=e.map(Jd),n=t.map(Jd),a=e.reduce(Qd,{}),o=t.reduce(Qd,{}),s=r.slice(),l=Object.create(null),u,h,c,p,d;for(let f=0,y=0;f<r.length;f++)u=r[f],Object.prototype.hasOwnProperty.call(o,u)?y++:(Jt(i,{command:"removeLayer",args:[u]}),s.splice(s.indexOf(u,y),1));for(let f=0,y=0;f<n.length;f++)u=n[n.length-1-f],s[s.length-1-f]!==u&&(Object.prototype.hasOwnProperty.call(a,u)?(Jt(i,{command:"removeLayer",args:[u]}),s.splice(s.lastIndexOf(u,s.length-y),1)):y++,p=s[s.length-f],Jt(i,{command:"addLayer",args:[o[u],p]}),s.splice(s.length-f,0,u),l[u]=!0);for(let f=0;f<n.length;f++)if(u=n[f],h=a[u],c=o[u],!(l[u]||Me(h,c))){if(!Me(h.source,c.source)||!Me(h["source-layer"],c["source-layer"])||!Me(h.type,c.type)){Jt(i,{command:"removeLayer",args:[u]}),p=s[s.lastIndexOf(u)+1],Jt(i,{command:"addLayer",args:[c,p]});continue}Ho(h.layout,c.layout,i,u,null,"setLayoutProperty"),Ho(h.paint,c.paint,i,u,null,"setPaintProperty"),Me(h.filter,c.filter)||Jt(i,{command:"setFilter",args:[u,c.filter]}),(!Me(h.minzoom,c.minzoom)||!Me(h.maxzoom,c.maxzoom))&&Jt(i,{command:"setLayerZoomRange",args:[u,c.minzoom,c.maxzoom]});for(d in h)Object.prototype.hasOwnProperty.call(h,d)&&(d==="layout"||d==="paint"||d==="filter"||d==="metadata"||d==="minzoom"||d==="maxzoom"||(d.indexOf("paint.")===0?Ho(h[d],c[d],i,u,d.slice(6),"setPaintProperty"):Me(h[d],c[d])||Jt(i,{command:"setLayerProperty",args:[u,d,c[d]]})));for(d in c)!Object.prototype.hasOwnProperty.call(c,d)||Object.prototype.hasOwnProperty.call(h,d)||d==="layout"||d==="paint"||d==="filter"||d==="metadata"||d==="minzoom"||d==="maxzoom"||(d.indexOf("paint.")===0?Ho(h[d],c[d],i,u,d.slice(6),"setPaintProperty"):Me(h[d],c[d])||Jt(i,{command:"setLayerProperty",args:[u,d,c[d]]}))}}function ES(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!Me(e.version,t.version))return[{command:"setStyle",args:[t]}];Me(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),Me(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),Me(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),Me(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),Me(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),Me(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),Me(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),Me(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),Me(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),Me(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),Me(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),Me(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),Me(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),Me(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});let r={},n=[];IS(e.sources,t.sources,n,r);let a=[];e.layers&&e.layers.forEach(o=>{"source"in o&&r[o.source]?i.push({command:"removeLayer",args:[o.id]}):a.push(o)}),i=i.concat(n),AS(a,t.layers,i)}catch(r){console.warn("Unable to compute style diff:",r),i=[{command:"setStyle",args:[t]}]}return i}var G=class{constructor(e,t,i,r){this.message=(e?"".concat(e,": "):"")+i,r&&(this.identifier=r),t!=null&&t.__line__&&(this.line=t.__line__)}};function Rn(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}var wi=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},kS=class _g{constructor(t,i=[]){this.parent=t,this.bindings={};for(let[r,n]of i)this.bindings[r]=n}concat(t){return new _g(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error("".concat(t," not found in scope."))}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},uo={kind:"null"},q={kind:"number"},de={kind:"string"},ce={kind:"boolean"},hi={kind:"color"},ul={kind:"projectionDefinition"},Gr={kind:"object"},ue={kind:"value"},DS={kind:"error"},hl={kind:"collator"},ho={kind:"formatted"},cl={kind:"padding"},Xa={kind:"colorArray"},pl={kind:"numberArray"},co={kind:"resolvedImage"},dl={kind:"variableAnchorOffsetCollection"};function Rt(e,t){return{kind:"array",itemType:e,N:t}}function Ge(e){if(e.kind==="array"){let t=Ge(e.itemType);return typeof e.N=="number"?"array<".concat(t,", ").concat(e.N,">"):e.itemType.kind==="value"?"array":"array<".concat(t,">")}else return e.kind}var LS=[uo,q,de,ce,hi,ul,ho,Gr,Rt(ue),cl,pl,Xa,co,dl];function $a(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!$a(e.itemType,t.itemType))&&(typeof e.N!="number"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind==="value"){for(let i of LS)if(!$a(i,t))return null}}return"Expected ".concat(Ge(e)," but found ").concat(Ge(t)," instead.")}function Sc(e,t){return t.some(i=>i.kind===e.kind)}function Ur(e,t){return t.some(i=>i==="null"?e===null:i==="array"?Array.isArray(e):i==="object"?e&&!Array.isArray(e)&&typeof e=="object":i===typeof e)}function lr(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}var xg=.96422,vg=1,bg=.82521,wg=4/29,En=6/29,Pg=3*En*En,zS=En*En*En,FS=Math.PI/180,BS=180/Math.PI;function Tg(e){return e=e%360,e<0&&(e+=360),e}function Sg([e,t,i,r]){e=Fu(e),t=Fu(t),i=Fu(i);let n,a,o=Bu((.2225045*e+.7168786*t+.0606169*i)/vg);e===t&&t===i?n=a=o:(n=Bu((.4360747*e+.3850649*t+.1430804*i)/xg),a=Bu((.0139322*e+.0971045*t+.7141733*i)/bg));let s=116*o-16;return[s<0?0:s,500*(n-o),200*(o-a),r]}function Fu(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Bu(e){return e>zS?Math.pow(e,1/3):e/Pg+wg}function Mg([e,t,i,r]){let n=(e+16)/116,a=isNaN(t)?n:n+t/500,o=isNaN(i)?n:n-i/200;return n=vg*Ou(n),a=xg*Ou(a),o=bg*Ou(o),[Ru(3.1338561*a-1.6168667*n-.4906146*o),Ru(-.9787684*a+1.9161415*n+.033454*o),Ru(.0719453*a-.2289914*n+1.4052427*o),r]}function Ru(e){return e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055,e<0?0:e>1?1:e}function Ou(e){return e>En?e*e*e:Pg*(e-wg)}function RS(e){let[t,i,r,n]=Sg(e),a=Math.sqrt(i*i+r*r);return[Math.round(a*1e4)?Tg(Math.atan2(r,i)*BS):NaN,a,t,n]}function OS([e,t,i,r]){return e=isNaN(e)?0:e*FS,Mg([i,Math.cos(e)*t,Math.sin(e)*t,r])}function NS([e,t,i,r]){e=Tg(e),t/=100,i/=100;function n(a){let o=(a+e/30)%12,s=t*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(o-3,9-o,1))}return[n(0),n(8),n(4),r]}var VS=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Ba(e,t){return VS(e,t)?e[t]:void 0}function jS(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=Ba(GS,e);if(t){let[n,a,o]=t;return[n/255,a/255,o/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let n=e.length<6?1:2,a=1;return[Ko(e.slice(a,a+=n)),Ko(e.slice(a,a+=n)),Ko(e.slice(a,a+=n)),Ko(e.slice(a,a+n)||"ff")]}if(e.startsWith("rgb")){let n=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,a=e.match(n);if(a){let[o,s,l,u,h,c,p,d,f,y,g,_]=a,b=[u||" ",p||" ",y].join("");if(b===" "||b===" /"||b===",,"||b===",,,"){let v=[l,c,f].join(""),w=v==="%%%"?100:v===""?255:0;if(w){let P=[vn(+s/w,0,1),vn(+h/w,0,1),vn(+d/w,0,1),g?ef(+g,_):1];if(tf(P))return P}}return}}let i=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,r=e.match(i);if(r){let[n,a,o,s,l,u,h,c,p]=r,d=[o||" ",l||" ",h].join("");if(d===" "||d===" /"||d===",,"||d===",,,"){let f=[+a,vn(+s,0,100),vn(+u,0,100),c?ef(+c,p):1];if(tf(f))return NS(f)}}}function Ko(e){return parseInt(e.padEnd(2,e),16)/255}function ef(e,t){return vn(t?e/100:e,0,1)}function vn(e,t,i){return Math.min(Math.max(t,e),i)}function tf(e){return!e.some(Number.isNaN)}var GS={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function xr(e,t,i){return e+i*(t-e)}function On(e,t,i){return e.map((r,n)=>xr(r,t[n],i))}function US(e){return e==="rgb"||e==="hcl"||e==="lab"}var J=class bn{constructor(t,i,r,n=1,a=!0){this.r=t,this.g=i,this.b=r,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,i,r,n]))}static parse(t){if(t instanceof bn)return t;if(typeof t!="string")return;let i=jS(t);if(i)return new bn(...i,!1)}get rgb(){let{r:t,g:i,b:r,a:n}=this,a=n||1/0;return this.overwriteGetter("rgb",[t/a,i/a,r/a,n])}get hcl(){return this.overwriteGetter("hcl",RS(this.rgb))}get lab(){return this.overwriteGetter("lab",Sg(this.rgb))}overwriteGetter(t,i){return Object.defineProperty(this,t,{value:i}),i}toString(){let[t,i,r,n]=this.rgb;return"rgba(".concat([t,i,r].map(a=>Math.round(a*255)).join(","),",").concat(n,")")}static interpolate(t,i,r,n="rgb"){switch(n){case"rgb":{let[a,o,s,l]=On(t.rgb,i.rgb,r);return new bn(a,o,s,l,!1)}case"hcl":{let[a,o,s,l]=t.hcl,[u,h,c,p]=i.hcl,d,f;if(!isNaN(a)&&!isNaN(u)){let v=u-a;u>a&&v>180?v-=360:u<a&&a-u>180&&(v+=360),d=a+r*v}else isNaN(a)?isNaN(u)?d=NaN:(d=u,(s===1||s===0)&&(f=h)):(d=a,(c===1||c===0)&&(f=o));let[y,g,_,b]=OS([d,f!=null?f:xr(o,h,r),xr(s,c,r),xr(l,p,r)]);return new bn(y,g,_,b,!1)}case"lab":{let[a,o,s,l]=Mg(On(t.lab,i.lab,r));return new bn(a,o,s,l,!1)}}}};J.black=new J(0,0,0,1);J.white=new J(1,1,1,1);J.transparent=new J(0,0,0,0);J.red=new J(1,0,0,1);var Mc=class{constructor(e,t,i){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},XS=["bottom","center","top"],bh=class{constructor(e,t,i,r,n,a){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=a}},Hi=class Es{constructor(t){this.sections=t}static fromString(t){return new Es([new bh(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Es?t:Es.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}},Li=class Ia{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ia)return t;if(typeof t=="number")return new Ia([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let i of t)if(typeof i!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]];break}return new Ia(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new Ia(On(t.values,i.values,r))}},zi=class Aa{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Aa)return t;if(typeof t=="number")return new Aa([t]);if(Array.isArray(t)){for(let i of t)if(typeof i!="number")return;return new Aa(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new Aa(On(t.values,i.values,r))}},ii=class Ea{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ea)return t;if(typeof t=="string"){let r=J.parse(t);return r?new Ea([r]):void 0}if(!Array.isArray(t))return;let i=[];for(let r of t){if(typeof r!="string")return;let n=J.parse(r);if(!n)return;i.push(n)}return new Ea(i)}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r,n="rgb"){let a=[];if(t.values.length!=i.values.length)throw new Error("colorArray: Arrays have mismatched length (".concat(t.values.length," vs. ").concat(i.values.length,"), cannot interpolate."));for(let o=0;o<t.values.length;o++)a.push(J.interpolate(t.values[o],i.values[o],r,n));return new Ea(a)}},qe=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},$S=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Tr=class ks{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ks)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!==0)){for(let i=0;i<t.length;i+=2){let r=t[i],n=t[i+1];if(typeof r!="string"||!$S.has(r)||!Array.isArray(n)||n.length!==2||typeof n[0]!="number"||typeof n[1]!="number")return}return new ks(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){let n=t.values,a=i.values;if(n.length!==a.length)throw new qe("Cannot interpolate values of different length. from: ".concat(t.toString(),", to: ").concat(i.toString()));let o=[];for(let s=0;s<n.length;s+=2){if(n[s]!==a[s])throw new qe("Cannot interpolate values containing mismatched anchors. from[".concat(s,"]: ").concat(n[s],", to[").concat(s,"]: ").concat(a[s]));o.push(n[s]);let[l,u]=n[s+1],[h,c]=a[s+1];o.push([xr(l,h,r),xr(u,c,r)])}return new ks(o)}},ki=class Cg{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Cg({name:t,available:!1}):null}},Jr=class wn{constructor(t,i,r){this.from=t,this.to=i,this.transition=r}static interpolate(t,i,r){return new wn(t,i,r)}static parse(t){if(t instanceof wn)return t;if(Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number")return new wn(t[0],t[1],t[2]);if(typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number")return new wn(t.from,t.to,t.transition);if(typeof t=="string")return new wn(t,t,1)}};function Ig(e,t,i,r){return typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof i=="number"&&i>=0&&i<=255?typeof r>"u"||typeof r=="number"&&r>=0&&r<=1?null:"Invalid rgba value [".concat([e,t,i,r].join(", "),"]: 'a' must be between 0 and 1."):"Invalid rgba value [".concat((typeof r=="number"?[e,t,i,r]:[e,t,i]).join(", "),"]: 'r', 'g', and 'b' must be between 0 and 255.")}function qa(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof Jr||e instanceof J||e instanceof Mc||e instanceof Hi||e instanceof Li||e instanceof zi||e instanceof ii||e instanceof Tr||e instanceof ki)return!0;if(Array.isArray(e)){for(let t of e)if(!qa(t))return!1;return!0}else if(typeof e=="object"){for(let t in e)if(!qa(e[t]))return!1;return!0}else return!1}function at(e){if(e===null)return uo;if(typeof e=="string")return de;if(typeof e=="boolean")return ce;if(typeof e=="number")return q;if(e instanceof J)return hi;if(e instanceof Jr)return ul;if(e instanceof Mc)return hl;if(e instanceof Hi)return ho;if(e instanceof Li)return cl;if(e instanceof zi)return pl;if(e instanceof ii)return Xa;if(e instanceof Tr)return dl;if(e instanceof ki)return co;if(Array.isArray(e)){let t=e.length,i;for(let r of e){let n=at(r);if(!i)i=n;else{if(i===n)continue;i=ue;break}}return Rt(i||ue,t)}else return Gr}function Ra(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof J||e instanceof Jr||e instanceof Hi||e instanceof Li||e instanceof zi||e instanceof ii||e instanceof Tr||e instanceof ki?e.toString():JSON.stringify(e)}var Ya=class Ag{constructor(t,i){this.type=t,this.value=i}static parse(t,i){if(t.length!==2)return i.error("'literal' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(!qa(t[1]))return i.error("invalid value");let r=t[1],n=at(r),a=i.expectedType;return n.kind==="array"&&n.N===0&&a&&a.kind==="array"&&(typeof a.N!="number"||a.N===0)&&(n=a),new Ag(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Jo={string:de,number:q,boolean:ce,object:Gr},Xi=class Eg{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=1,n,a=t[0];if(a==="array"){let s;if(t.length>2){let u=t[1];if(typeof u!="string"||!(u in Jo)||u==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);s=Jo[u],r++}else s=ue;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);l=t[2],r++}n=Rt(s,l)}else{if(!Jo[a])throw new Error("Types doesn't contain name = ".concat(a));n=Jo[a]}let o=[];for(;r<t.length;r++){let s=i.parse(t[r],r,ue);if(!s)return null;o.push(s)}return new Eg(n,o)}evaluate(t){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(t);if($a(this.type,at(r))){if(i===this.args.length-1)throw new qe("Expected value to be of type ".concat(Ge(this.type),", but found ").concat(Ge(at(r))," instead."))}else return r}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},rf={"to-boolean":ce,"to-color":hi,"to-number":q,"to-string":de},In=class kg{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[0];if(!rf[r])throw new Error("Can't parse ".concat(r," as it is not part of the known types"));if((r==="to-boolean"||r==="to-string")&&t.length!==2)return i.error("Expected one argument.");let n=rf[r],a=[];for(let o=1;o<t.length;o++){let s=i.parse(t[o],o,ue);if(!s)return null;a.push(s)}return new kg(n,a)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let i,r;for(let n of this.args){if(i=n.evaluate(t),r=null,i instanceof J)return i;if(typeof i=="string"){let a=t.parseColor(i);if(a)return a}else if(Array.isArray(i)&&(i.length<3||i.length>4?r="Invalid rgba value ".concat(JSON.stringify(i),": expected an array containing either three or four numeric values."):r=Ig(i[0],i[1],i[2],i[3]),!r))return new J(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new qe(r||"Could not parse color from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"padding":{let i;for(let r of this.args){i=r.evaluate(t);let n=Li.parse(i);if(n)return n}throw new qe("Could not parse padding from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"numberArray":{let i;for(let r of this.args){i=r.evaluate(t);let n=zi.parse(i);if(n)return n}throw new qe("Could not parse numberArray from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"colorArray":{let i;for(let r of this.args){i=r.evaluate(t);let n=ii.parse(i);if(n)return n}throw new qe("Could not parse colorArray from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"variableAnchorOffsetCollection":{let i;for(let r of this.args){i=r.evaluate(t);let n=Tr.parse(i);if(n)return n}throw new qe("Could not parse variableAnchorOffsetCollection from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"number":{let i=null;for(let r of this.args){if(i=r.evaluate(t),i===null)return 0;let n=Number(i);if(!isNaN(n))return n}throw new qe("Could not convert ".concat(JSON.stringify(i)," to number."))}case"formatted":return Hi.fromString(Ra(this.args[0].evaluate(t)));case"resolvedImage":return ki.fromString(Ra(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Ra(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},qS=["Unknown","Point","LineString","Polygon"],Dg=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?qS[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=J.parse(e),this._parseColorCache.set(e,t)),t}},Lg=class zg{constructor(t,i,r=[],n,a=new kS,o=[]){this.registry=t,this.path=r,this.key=r.map(s=>"[".concat(s,"]")).join(""),this.scope=a,this.errors=o,this.expectedType=n,this._isConstant=i}parse(t,i,r,n,a={}){return i?this.concat(i,r,n)._parse(t,a):this._parse(t,a)}_parse(t,i){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);function r(n,a,o){return o==="assert"?new Xi(a,[n]):o==="coerce"?new In(a,[n]):n}if(Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let n=t[0];if(typeof n!="string")return this.error("Expression name must be a string, but found ".concat(typeof n,' instead. If you wanted a literal array, use ["literal", [...]].'),0),null;let a=this.registry[n];if(a){let o=a.parse(t,this);if(!o)return null;if(this.expectedType){let s=this.expectedType,l=o.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")o=r(o,s,i.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(l.kind)||s.kind==="colorArray"&&["value","string","array"].includes(l.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))o=r(o,s,i.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(o instanceof Ya)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let s=new Dg;try{o=new Ya(o.type,o.evaluate(s))}catch(l){return this.error(l.message),null}}return o}return this.error('Unknown expression "'.concat(n,'". If you wanted a literal array, use ["literal", [...]].'),0)}else return typeof t>"u"?this.error("'undefined' value invalid. Use null instead."):typeof t=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found ".concat(typeof t," instead."))}concat(t,i,r){let n=typeof t=="number"?this.path.concat(t):this.path,a=r?this.scope.concat(r):this.scope;return new zg(this.registry,this._isConstant,n,i||null,a,this.errors)}error(t,...i){let r="".concat(this.key).concat(i.map(n=>"[".concat(n,"]")).join(""));this.errors.push(new wi(r,t))}checkSubtype(t,i){let r=$a(t,i);return r&&this.error(r),r}},Fg=class Bg{constructor(t,i){this.type=i.type,this.bindings=[].concat(t),this.result=i}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let i of this.bindings)t(i[1]);t(this.result)}static parse(t,i){if(t.length<4)return i.error("Expected at least 3 arguments, but found ".concat(t.length-1," instead."));let r=[];for(let a=1;a<t.length-1;a+=2){let o=t[a];if(typeof o!="string")return i.error("Expected string, but found ".concat(typeof o," instead."),a);if(/[^a-zA-Z0-9_]/.test(o))return i.error("Variable names must contain only alphanumeric characters or '_'.",a);let s=i.parse(t[a+1],a+1);if(!s)return null;r.push([o,s])}let n=i.parse(t[t.length-1],t.length-1,i.expectedType,r);return n?new Bg(r,n):null}outputDefined(){return this.result.outputDefined()}},Rg=class Og{constructor(t,i){this.type=i.type,this.name=t,this.boundExpression=i}static parse(t,i){if(t.length!==2||typeof t[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");let r=t[1];return i.scope.has(r)?new Og(r,i.scope.get(r)):i.error('Unknown variable "'.concat(r,'". Make sure "').concat(r,'" has been bound in an enclosing "let" expression before using it.'),1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},YS=class Ng{constructor(t,i,r){this.type=t,this.index=i,this.input=r}static parse(t,i){if(t.length!==3)return i.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,q),n=i.parse(t[2],2,Rt(i.expectedType||ue));if(!r||!n)return null;let a=n.type;return new Ng(a.itemType,r,n)}evaluate(t){let i=this.index.evaluate(t),r=this.input.evaluate(t);if(i<0)throw new qe("Array index out of bounds: ".concat(i," < 0."));if(i>=r.length)throw new qe("Array index out of bounds: ".concat(i," > ").concat(r.length-1,"."));if(i!==Math.floor(i))throw new qe("Array index must be an integer, but found ".concat(i," instead."));return r[i]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},ZS=class Vg{constructor(t,i){this.type=ce,this.needle=t,this.haystack=i}static parse(t,i){if(t.length!==3)return i.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,ue),n=i.parse(t[2],2,ue);return!r||!n?null:Sc(r.type,[ce,de,q,uo,ue])?new Vg(r,n):i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ge(r.type)," instead"))}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!Ur(i,["boolean","string","number","null"]))throw new qe("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ge(at(i))," instead."));if(!Ur(r,["string","array"]))throw new qe("Expected second argument to be of type array or string, but found ".concat(Ge(at(r))," instead."));return r.indexOf(i)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},WS=class wh{constructor(t,i,r){this.type=q,this.needle=t,this.haystack=i,this.fromIndex=r}static parse(t,i){if(t.length<=2||t.length>=5)return i.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,ue),n=i.parse(t[2],2,ue);if(!r||!n)return null;if(!Sc(r.type,[ce,de,q,uo,ue]))return i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ge(r.type)," instead"));if(t.length===4){let a=i.parse(t[3],3,q);return a?new wh(r,n,a):null}else return new wh(r,n)}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Ur(i,["boolean","string","number","null"]))throw new qe("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ge(at(i))," instead."));let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),Ur(r,["string"])){let a=r.indexOf(i,n);return a===-1?-1:[...r.slice(0,a)].length}else{if(Ur(r,["array"]))return r.indexOf(i,n);throw new qe("Expected second argument to be of type array or string, but found ".concat(Ge(at(r))," instead."))}}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},HS=class jg{constructor(t,i,r,n,a,o){this.inputType=t,this.type=i,this.input=r,this.cases=n,this.outputs=a,this.otherwise=o}static parse(t,i){if(t.length<5)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==1)return i.error("Expected an even number of arguments.");let r,n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);let a={},o=[];for(let u=2;u<t.length-1;u+=2){let h=t[u],c=t[u+1];Array.isArray(h)||(h=[h]);let p=i.concat(u);if(h.length===0)return p.error("Expected at least one branch label.");for(let f of h){if(typeof f!="number"&&typeof f!="string")return p.error("Branch labels must be numbers or strings.");if(typeof f=="number"&&Math.abs(f)>Number.MAX_SAFE_INTEGER)return p.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof f=="number"&&Math.floor(f)!==f)return p.error("Numeric branch labels must be integer values.");if(!r)r=at(f);else if(p.checkSubtype(r,at(f)))return null;if(typeof a[String(f)]<"u")return p.error("Branch labels must be unique.");a[String(f)]=o.length}let d=i.parse(c,u,n);if(!d)return null;n=n||d.type,o.push(d)}let s=i.parse(t[1],1,ue);if(!s)return null;let l=i.parse(t[t.length-1],t.length-1,n);return!l||s.type.kind!=="value"&&i.concat(1).checkSubtype(r,s.type)?null:new jg(r,n,s,a,o,l)}evaluate(t){let i=this.input.evaluate(t);return(at(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}},KS=class Gg{constructor(t,i,r){this.type=t,this.branches=i,this.otherwise=r}static parse(t,i){if(t.length<4)return i.error("Expected at least 3 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==0)return i.error("Expected an odd number of arguments.");let r;i.expectedType&&i.expectedType.kind!=="value"&&(r=i.expectedType);let n=[];for(let o=1;o<t.length-1;o+=2){let s=i.parse(t[o],o,ce);if(!s)return null;let l=i.parse(t[o+1],o+1,r);if(!l)return null;n.push([s,l]),r=r||l.type}let a=i.parse(t[t.length-1],t.length-1,r);if(!a)return null;if(!r)throw new Error("Can't infer output type");return new Gg(r,n,a)}evaluate(t){for(let[i,r]of this.branches)if(i.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[i,r]of this.branches)t(i),t(r);t(this.otherwise)}outputDefined(){return this.branches.every(([t,i])=>i.outputDefined())&&this.otherwise.outputDefined()}},JS=class Ph{constructor(t,i,r,n){this.type=t,this.input=i,this.beginIndex=r,this.endIndex=n}static parse(t,i){if(t.length<=2||t.length>=5)return i.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,ue),n=i.parse(t[2],2,q);if(!r||!n)return null;if(!Sc(r.type,[Rt(ue),de,ue]))return i.error("Expected first argument to be of type array or string, but found ".concat(Ge(r.type)," instead"));if(t.length===4){let a=i.parse(t[3],3,q);return a?new Ph(r.type,r,n,a):null}else return new Ph(r.type,r,n)}evaluate(t){let i=this.input.evaluate(t),r=this.beginIndex.evaluate(t),n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),Ur(i,["string"]))return[...i].slice(r,n).join("");if(Ur(i,["array"]))return i.slice(r,n);throw new qe("Expected first argument to be of type array or string, but found ".concat(Ge(at(i))," instead."))}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}};function fl(e,t){let i=e.length-1,r=0,n=i,a=0,o,s;for(;r<=n;)if(a=Math.floor((r+n)/2),o=e[a],s=e[a+1],o<=t){if(a===i||t<s)return a;r=a+1}else if(o>t)n=a-1;else throw new qe("Input is not a number.");return 0}var Cc=class Ug{constructor(t,i,r){this.type=t,this.input=i,this.labels=[],this.outputs=[];for(let[n,a]of r)this.labels.push(n),this.outputs.push(a)}static parse(t,i){if(t.length-1<4)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return i.error("Expected an even number of arguments.");let r=i.parse(t[1],1,q);if(!r)return null;let n=[],a=null;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);for(let o=1;o<t.length;o+=2){let s=o===1?-1/0:t[o],l=t[o+1],u=o,h=o+1;if(typeof s!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(n.length&&n[n.length-1][0]>=s)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let c=i.parse(l,h,a);if(!c)return null;a=a||c.type,n.push([s,c])}return new Ug(a,r,n)}evaluate(t){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);let n=this.input.evaluate(t);if(n<=i[0])return r[0].evaluate(t);let a=i.length;if(n>=i[a-1])return r[a-1].evaluate(t);let o=fl(i,n);return r[o].evaluate(t)}eachChild(t){t(this.input);for(let i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function QS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nu,nf;function eM(){if(nf)return Nu;nf=1,Nu=e;function e(t,i,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(n-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=r,this.p2y=n}return e.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,i){if(i===void 0&&(i=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var a=this.sampleCurveX(r)-t;if(Math.abs(a)<i)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-a/o}var s=0,l=1;for(r=t,n=0;n<20&&(a=this.sampleCurveX(r),!(Math.abs(a-t)<i));n++)t>a?s=r:l=r,r=(l-s)*.5+s;return r},solve:function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}},Nu}var tM=eM(),iM=QS(tM),ci=class Th{constructor(t,i,r,n,a){this.type=t,this.operator=i,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(let[o,s]of a)this.labels.push(o),this.outputs.push(s)}static interpolationFactor(t,i,r,n){let a=0;if(t.name==="exponential")a=Vu(i,t.base,r,n);else if(t.name==="linear")a=Vu(i,1,r,n);else if(t.name==="cubic-bezier"){let o=t.controlPoints;a=new iM(o[0],o[1],o[2],o[3]).solve(Vu(i,1,r,n))}return a}static parse(t,i){let[r,n,a,...o]=t;if(!Array.isArray(n)||n.length===0)return i.error("Expected an interpolation type expression.",1);if(n[0]==="linear")n={name:"linear"};else if(n[0]==="exponential"){let u=n[1];if(typeof u!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:u}}else if(n[0]==="cubic-bezier"){let u=n.slice(1);if(u.length!==4||u.some(h=>typeof h!="number"||h<0||h>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:u}}else return i.error("Unknown interpolation type ".concat(String(n[0])),1,0);if(t.length-1<4)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return i.error("Expected an even number of arguments.");if(a=i.parse(a,2,q),!a)return null;let s=[],l=null;(r==="interpolate-hcl"||r==="interpolate-lab")&&i.expectedType!=Xa?l=hi:i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=0;u<o.length;u+=2){let h=o[u],c=o[u+1],p=u+3,d=u+4;if(typeof h!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(s.length&&s[s.length-1][0]>=h)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);let f=i.parse(c,d,l);if(!f)return null;l=l||f.type,s.push([h,f])}return!lr(l,q)&&!lr(l,ul)&&!lr(l,hi)&&!lr(l,cl)&&!lr(l,pl)&&!lr(l,Xa)&&!lr(l,dl)&&!lr(l,Rt(q))?i.error("Type ".concat(Ge(l)," is not interpolatable.")):new Th(l,r,n,a,s)}evaluate(t){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);let n=this.input.evaluate(t);if(n<=i[0])return r[0].evaluate(t);let a=i.length;if(n>=i[a-1])return r[a-1].evaluate(t);let o=fl(i,n),s=i[o],l=i[o+1],u=Th.interpolationFactor(this.interpolation,n,s,l),h=r[o].evaluate(t),c=r[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return xr(h,c,u);case"color":return J.interpolate(h,c,u);case"padding":return Li.interpolate(h,c,u);case"colorArray":return ii.interpolate(h,c,u);case"numberArray":return zi.interpolate(h,c,u);case"variableAnchorOffsetCollection":return Tr.interpolate(h,c,u);case"array":return On(h,c,u);case"projectionDefinition":return Jr.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return J.interpolate(h,c,u,"hcl");case"colorArray":return ii.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return J.interpolate(h,c,u,"lab");case"colorArray":return ii.interpolate(h,c,u,"lab")}}}eachChild(t){t(this.input);for(let i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Vu(e,t,i,r){let n=r-i,a=e-i;return n===0?0:t===1?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}var Ue={color:J.interpolate,number:xr,padding:Li.interpolate,numberArray:zi.interpolate,colorArray:ii.interpolate,variableAnchorOffsetCollection:Tr.interpolate,array:On},Xg=class Sh{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=null,n=i.expectedType;n&&n.kind!=="value"&&(r=n);let a=[];for(let o of t.slice(1)){let s=i.parse(o,1+a.length,r,void 0,{typeAnnotation:"omit"});if(!s)return null;r=r||s.type,a.push(s)}if(!r)throw new Error("No output type");return n&&a.some(o=>$a(n,o.type))?new Sh(ue,a):new Sh(r,a)}evaluate(t){let i=null,r=0,n;for(let a of this.args)if(r++,i=a.evaluate(t),i&&i instanceof ki&&!i.available&&(n||(n=i.name),i=null,r===this.args.length&&(i=n)),i!==null)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};function af(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function rM(e,t,i){return t===i}function nM(e,t,i){return t!==i}function aM(e,t,i){return t<i}function oM(e,t,i){return t>i}function sM(e,t,i){return t<=i}function lM(e,t,i){return t>=i}function $g(e,t,i,r){return r.compare(t,i)===0}function uM(e,t,i,r){return!$g(e,t,i,r)}function hM(e,t,i,r){return r.compare(t,i)<0}function cM(e,t,i,r){return r.compare(t,i)>0}function pM(e,t,i,r){return r.compare(t,i)<=0}function dM(e,t,i,r){return r.compare(t,i)>=0}function qn(e,t,i){let r=e!=="=="&&e!=="!=";return class qg{constructor(a,o,s){this.type=ce,this.lhs=a,this.rhs=o,this.collator=s,this.hasUntypedArgument=a.type.kind==="value"||o.type.kind==="value"}static parse(a,o){if(a.length!==3&&a.length!==4)return o.error("Expected two or three arguments.");let s=a[0],l=o.parse(a[1],1,ue);if(!l)return null;if(!af(s,l.type))return o.concat(1).error('"'.concat(s,"\" comparisons are not supported for type '").concat(Ge(l.type),"'."));let u=o.parse(a[2],2,ue);if(!u)return null;if(!af(s,u.type))return o.concat(2).error('"'.concat(s,"\" comparisons are not supported for type '").concat(Ge(u.type),"'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot compare types '".concat(Ge(l.type),"' and '").concat(Ge(u.type),"'."));r&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Xi(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Xi(l.type,[u])));let h=null;if(a.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot use collator to compare non-string types.");if(h=o.parse(a[3],3,hl),!h)return null}return new qg(l,u,h)}evaluate(a){let o=this.lhs.evaluate(a),s=this.rhs.evaluate(a);if(r&&this.hasUntypedArgument){let l=at(o),u=at(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new qe('Expected arguments for "'.concat(e,'" to be (string, string) or (number, number), but found (').concat(l.kind,", ").concat(u.kind,") instead."))}if(this.collator&&!r&&this.hasUntypedArgument){let l=at(o),u=at(s);if(l.kind!=="string"||u.kind!=="string")return t(a,o,s)}return this.collator?i(a,o,s,this.collator.evaluate(a)):t(a,o,s)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var fM=qn("==",rM,$g),mM=qn("!=",nM,uM),yM=qn("<",aM,hM),gM=qn(">",oM,cM),_M=qn("<=",sM,pM),xM=qn(">=",lM,dM),Yg=class Zg{constructor(t,i,r){this.type=hl,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=i}static parse(t,i){if(t.length!==2)return i.error("Expected one argument.");let r=t[1];if(typeof r!="object"||Array.isArray(r))return i.error("Collator options argument must be an object.");let n=i.parse(r["case-sensitive"]===void 0?!1:r["case-sensitive"],1,ce);if(!n)return null;let a=i.parse(r["diacritic-sensitive"]===void 0?!1:r["diacritic-sensitive"],1,ce);if(!a)return null;let o=null;return r.locale&&(o=i.parse(r.locale,1,de),!o)?null:new Zg(n,a,o)}evaluate(t){return new Mc(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},vM=class Wg{constructor(t,i,r,n,a){this.type=de,this.number=t,this.locale=i,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=a}static parse(t,i){if(t.length!==3)return i.error("Expected two arguments.");let r=i.parse(t[1],1,q);if(!r)return null;let n=t[2];if(typeof n!="object"||Array.isArray(n))return i.error("NumberFormat options argument must be an object.");let a=null;if(n.locale&&(a=i.parse(n.locale,1,de),!a))return null;let o=null;if(n.currency&&(o=i.parse(n.currency,1,de),!o))return null;let s=null;if(n["min-fraction-digits"]&&(s=i.parse(n["min-fraction-digits"],1,q),!s))return null;let l=null;return n["max-fraction-digits"]&&(l=i.parse(n["max-fraction-digits"],1,q),!l)?null:new Wg(r,a,o,s,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},Hg=class Kg{constructor(t){this.type=ho,this.sections=t}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[1];if(!Array.isArray(r)&&typeof r=="object")return i.error("First argument must be an image or text section.");let n=[],a=!1;for(let o=1;o<=t.length-1;++o){let s=t[o];if(a&&typeof s=="object"&&!Array.isArray(s)){a=!1;let l=null;if(s["font-scale"]&&(l=i.parse(s["font-scale"],1,q),!l))return null;let u=null;if(s["text-font"]&&(u=i.parse(s["text-font"],1,Rt(de)),!u))return null;let h=null;if(s["text-color"]&&(h=i.parse(s["text-color"],1,hi),!h))return null;let c=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!XS.includes(s["vertical-align"]))return i.error("'vertical-align' must be one of: 'bottom', 'center', 'top' but found '".concat(s["vertical-align"],"' instead."));if(c=i.parse(s["vertical-align"],1,de),!c)return null}let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=i.parse(t[o],1,ue);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,n.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Kg(n)}evaluate(t){let i=r=>{let n=r.content.evaluate(t);return at(n)===co?new bh("",n,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new bh(Ra(n),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)};return new Hi(this.sections.map(i))}eachChild(t){for(let i of this.sections)t(i.content),i.scale&&t(i.scale),i.font&&t(i.font),i.textColor&&t(i.textColor),i.verticalAlign&&t(i.verticalAlign)}outputDefined(){return!1}},bM=class Jg{constructor(t){this.type=co,this.input=t}static parse(t,i){if(t.length!==2)return i.error("Expected two arguments.");let r=i.parse(t[1],1,de);return r?new Jg(r):i.error("No image name provided.")}evaluate(t){let i=this.input.evaluate(t),r=ki.fromString(i);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(i)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}},wM=class Qg{constructor(t){this.type=q,this.input=t}static parse(t,i){if(t.length!==2)return i.error("Expected 1 argument, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1);return r?r.type.kind!=="array"&&r.type.kind!=="string"&&r.type.kind!=="value"?i.error("Expected argument of type string or array, but found ".concat(Ge(r.type)," instead.")):new Qg(r):null}evaluate(t){let i=this.input.evaluate(t);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new qe("Expected value to be of type string or array, but found ".concat(Ge(at(i))," instead."))}eachChild(t){t(this.input)}outputDefined(){return!1}},Ii=8192;function PM(e,t){let i=TM(e[0]),r=MM(e[1]),n=Math.pow(2,t.z);return[Math.round(i*n*Ii),Math.round(r*n*Ii)]}function Ic(e,t){let i=Math.pow(2,t.z),r=(e[0]/Ii+t.x)/i,n=(e[1]/Ii+t.y)/i;return[SM(r),CM(n)]}function TM(e){return(180+e)/360}function SM(e){return e*360-180}function MM(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function CM(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function po(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Za(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function IM(e,t,i){return t[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t[0])*(e[1]-t[1])/(i[1]-t[1])+t[0]}function AM(e,t,i){let r=e[0]-t[0],n=e[1]-t[1],a=e[0]-i[0],o=e[1]-i[1];return r*o-a*n===0&&r*a<=0&&n*o<=0}function ml(e,t,i,r){let n=[t[0]-e[0],t[1]-e[1]],a=[r[0]-i[0],r[1]-i[1]];return LM(a,n)===0?!1:!!(of(e,t,i,r)&&of(i,r,e,t))}function EM(e,t,i){for(let r of i)for(let n=0;n<r.length-1;++n)if(ml(e,t,r[n],r[n+1]))return!0;return!1}function Yn(e,t,i=!1){let r=!1;for(let n of t)for(let a=0;a<n.length-1;a++){if(AM(e,n[a],n[a+1]))return i;IM(e,n[a],n[a+1])&&(r=!r)}return r}function kM(e,t){for(let i of t)if(Yn(e,i))return!0;return!1}function e_(e,t){for(let i of e)if(!Yn(i,t))return!1;for(let i=0;i<e.length-1;++i)if(EM(e[i],e[i+1],t))return!1;return!0}function DM(e,t){for(let i of t)if(e_(e,i))return!0;return!1}function LM(e,t){return e[0]*t[1]-e[1]*t[0]}function of(e,t,i,r){let n=e[0]-i[0],a=e[1]-i[1],o=t[0]-i[0],s=t[1]-i[1],l=r[0]-i[0],u=r[1]-i[1],h=n*u-l*a,c=o*u-l*s;return h>0&&c<0||h<0&&c>0}function Ac(e,t,i){let r=[];for(let n=0;n<e.length;n++){let a=[];for(let o=0;o<e[n].length;o++){let s=PM(e[n][o],i);po(t,s),a.push(s)}r.push(a)}return r}function t_(e,t,i){let r=[];for(let n=0;n<e.length;n++){let a=Ac(e[n],t,i);r.push(a)}return r}function i_(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){let n=r*.5,a=e[0]-i[0]>n?-r:i[0]-e[0]>n?r:0;a===0&&(a=e[0]-i[2]>n?-r:i[2]-e[0]>n?r:0),e[0]+=a}po(t,e)}function zM(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function sf(e,t,i,r){let n=Math.pow(2,r.z)*Ii,a=[r.x*Ii,r.y*Ii],o=[];for(let s of e)for(let l of s){let u=[l.x+a[0],l.y+a[1]];i_(u,t,i,n),o.push(u)}return o}function lf(e,t,i,r){let n=Math.pow(2,r.z)*Ii,a=[r.x*Ii,r.y*Ii],o=[];for(let s of e){let l=[];for(let u of s){let h=[u.x+a[0],u.y+a[1]];po(t,h),l.push(h)}o.push(l)}if(t[2]-t[0]<=n/2){zM(t);for(let s of o)for(let l of s)i_(l,t,i,n)}return o}function FM(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=Ac(t.coordinates,r,n),o=sf(e.geometry(),i,r,n);if(!Za(i,r))return!1;for(let s of o)if(!Yn(s,a))return!1}if(t.type==="MultiPolygon"){let a=t_(t.coordinates,r,n),o=sf(e.geometry(),i,r,n);if(!Za(i,r))return!1;for(let s of o)if(!kM(s,a))return!1}return!0}function BM(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=Ac(t.coordinates,r,n),o=lf(e.geometry(),i,r,n);if(!Za(i,r))return!1;for(let s of o)if(!e_(s,a))return!1}if(t.type==="MultiPolygon"){let a=t_(t.coordinates,r,n),o=lf(e.geometry(),i,r,n);if(!Za(i,r))return!1;for(let s of o)if(!DM(s,a))return!1}return!0}var Ec=class Ds{constructor(t,i){this.type=ce,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error("'within' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(qa(t[1])){let r=t[1];if(r.type==="FeatureCollection"){let n=[];for(let a of r.features){let{type:o,coordinates:s}=a.geometry;o==="Polygon"&&n.push(s),o==="MultiPolygon"&&n.push(...s)}if(n.length){let a={type:"MultiPolygon",coordinates:n};return new Ds(r,a)}}else if(r.type==="Feature"){let n=r.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new Ds(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new Ds(r,r)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return FM(t,this.geometries);if(t.geometryType()==="LineString")return BM(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},r_=class{constructor(e=[],t=(i,r)=>i<r?-1:i>r?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,r=t[e];for(;e>0;){let n=e-1>>1,a=t[n];if(i(r,a)>=0)break;t[e]=a,e=n}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let a=(e<<1)+1,o=a+1;if(o<this.length&&i(t[o],t[a])<0&&(a=o),i(t[a],n)>=0)break;t[e]=t[a],e=a}t[e]=n}};function n_(e,t,i=0,r=e.length-1,n=RM){for(;r>i;){if(r-i>600){let l=r-i+1,u=t-i+1,h=Math.log(l),c=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1),d=Math.max(i,Math.floor(t-u*c/l+p)),f=Math.min(r,Math.floor(t+(l-u)*c/l+p));n_(e,t,d,f,n)}let a=e[t],o=i,s=r;for(fa(e,i,t),n(e[r],a)>0&&fa(e,i,r);o<s;){for(fa(e,o,s),o++,s--;n(e[o],a)<0;)o++;for(;n(e[s],a)>0;)s--}n(e[i],a)===0?fa(e,i,s):(s++,fa(e,s,r)),s<=t&&(i=s+1),t<=s&&(r=s-1)}}function fa(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function RM(e,t){return e<t?-1:e>t?1:0}function kc(e,t){if(e.length<=1)return[e];let i=[],r,n;for(let a of e){let o=NM(a);o!==0&&(a.area=Math.abs(o),n===void 0&&(n=o<0),n===o<0?(r&&i.push(r),r=[a]):r.push(a))}if(r&&i.push(r),t>1)for(let a=0;a<i.length;a++)i[a].length<=t||(n_(i[a],t,1,i[a].length-1,OM),i[a]=i[a].slice(0,t));return i}function OM(e,t){return t.area-e.area}function NM(e){let t=0;for(let i=0,r=e.length,n=r-1,a,o;i<r;n=i++)a=e[i],o=e[n],t+=(o.x-a.x)*(a.y+o.y);return t}var VM=6378.137,uf=1/298.257223563,hf=uf*(2-uf),cf=Math.PI/180,Dc=class{constructor(e){let t=cf*VM*1e3,i=Math.cos(e*cf),r=1/(1-hf*(1-i*i)),n=Math.sqrt(r);this.kx=t*n*i,this.ky=t*n*r*(1-hf)}distance(e,t){let i=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(e,t){let i=1/0,r,n,a,o;for(let s=0;s<e.length-1;s++){let l=e[s][0],u=e[s][1],h=this.wrap(e[s+1][0]-l)*this.kx,c=(e[s+1][1]-u)*this.ky,p=0;(h!==0||c!==0)&&(p=(this.wrap(t[0]-l)*this.kx*h+(t[1]-u)*this.ky*c)/(h*h+c*c),p>1?(l=e[s+1][0],u=e[s+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(t[0]-l)*this.kx,c=(t[1]-u)*this.ky;let d=h*h+c*c;d<i&&(i=d,r=l,n=u,a=s,o=p)}return{point:[r,n],index:a,t:Math.max(0,Math.min(1,o))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},Mh=100,Ch=50;function a_(e,t){return t[0]-e[0]}function js(e){return e[1]-e[0]+1}function Ki(e,t){return e[1]>=e[0]&&e[1]<t}function Ih(e,t){if(e[0]>e[1])return[null,null];let i=js(e);if(t){if(i===2)return[e,null];let n=Math.floor(i/2);return[[e[0],e[0]+n],[e[0]+n,e[1]]]}if(i===1)return[e,null];let r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function Ah(e,t){if(!Ki(t,e.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)po(i,e[r]);return i}function Eh(e){let t=[1/0,1/0,-1/0,-1/0];for(let i of e)for(let r of i)po(t,r);return t}function pf(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Lc(e,t,i){if(!pf(e)||!pf(t))return NaN;let r=0,n=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),i.distance([0,0],[r,n])}function Vr(e,t,i){let r=i.pointOnLine(t,e);return i.distance(e,r.point)}function zc(e,t,i,r,n){let a=Math.min(Vr(e,[i,r],n),Vr(t,[i,r],n)),o=Math.min(Vr(i,[e,t],n),Vr(r,[e,t],n));return Math.min(a,o)}function jM(e,t,i,r,n){if(!(Ki(t,e.length)&&Ki(r,i.length)))return 1/0;let a=1/0;for(let o=t[0];o<t[1];++o){let s=e[o],l=e[o+1];for(let u=r[0];u<r[1];++u){let h=i[u],c=i[u+1];if(ml(s,l,h,c))return 0;a=Math.min(a,zc(s,l,h,c,n))}}return a}function GM(e,t,i,r,n){if(!(Ki(t,e.length)&&Ki(r,i.length)))return NaN;let a=1/0;for(let o=t[0];o<=t[1];++o)for(let s=r[0];s<=r[1];++s)if(a=Math.min(a,n.distance(e[o],i[s])),a===0)return a;return a}function UM(e,t,i){if(Yn(e,t,!0))return 0;let r=1/0;for(let n of t){let a=n[0],o=n[n.length-1];if(a!==o&&(r=Math.min(r,Vr(e,[o,a],i)),r===0))return r;let s=i.pointOnLine(n,e);if(r=Math.min(r,i.distance(e,s.point)),r===0)return r}return r}function XM(e,t,i,r){if(!Ki(t,e.length))return NaN;for(let a=t[0];a<=t[1];++a)if(Yn(e[a],i,!0))return 0;let n=1/0;for(let a=t[0];a<t[1];++a){let o=e[a],s=e[a+1];for(let l of i)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let p=l[c],d=l[u];if(ml(o,s,p,d))return 0;n=Math.min(n,zc(o,s,p,d,r))}}return n}function df(e,t){for(let i of e)for(let r of i)if(Yn(r,t,!0))return!0;return!1}function $M(e,t,i,r=1/0){let n=Eh(e),a=Eh(t);if(r!==1/0&&Lc(n,a,i)>=r)return r;if(Za(n,a)){if(df(e,t))return 0}else if(df(t,e))return 0;let o=1/0;for(let s of e)for(let l=0,u=s.length,h=u-1;l<u;h=l++){let c=s[h],p=s[l];for(let d of t)for(let f=0,y=d.length,g=y-1;f<y;g=f++){let _=d[g],b=d[f];if(ml(c,p,_,b))return 0;o=Math.min(o,zc(c,p,_,b,i))}}return o}function ff(e,t,i,r,n,a){if(!a)return;let o=Lc(Ah(r,a),n,i);o<t&&e.push([o,a,[0,0]])}function Qo(e,t,i,r,n,a,o){if(!a||!o)return;let s=Lc(Ah(r,a),Ah(n,o),i);s<t&&e.push([s,a,o])}function Gs(e,t,i,r,n=1/0){let a=Math.min(r.distance(e[0],i[0][0]),n);if(a===0)return a;let o=new r_([[0,[0,e.length-1],[0,0]]],a_),s=Eh(i);for(;o.length>0;){let l=o.pop();if(l[0]>=a)continue;let u=l[1],h=t?Ch:Mh;if(js(u)<=h){if(!Ki(u,e.length))return NaN;if(t){let c=XM(e,u,i,r);if(isNaN(c)||c===0)return c;a=Math.min(a,c)}else for(let c=u[0];c<=u[1];++c){let p=UM(e[c],i,r);if(a=Math.min(a,p),a===0)return 0}}else{let c=Ih(u,t);ff(o,a,r,e,s,c[0]),ff(o,a,r,e,s,c[1])}}return a}function Us(e,t,i,r,n,a=1/0){let o=Math.min(a,n.distance(e[0],i[0]));if(o===0)return o;let s=new r_([[0,[0,e.length-1],[0,i.length-1]]],a_);for(;s.length>0;){let l=s.pop();if(l[0]>=o)continue;let u=l[1],h=l[2],c=t?Ch:Mh,p=r?Ch:Mh;if(js(u)<=c&&js(h)<=p){if(!Ki(u,e.length)&&Ki(h,i.length))return NaN;let d;if(t&&r)d=jM(e,u,i,h,n),o=Math.min(o,d);else if(t&&!r){let f=e.slice(u[0],u[1]+1);for(let y=h[0];y<=h[1];++y)if(d=Vr(i[y],f,n),o=Math.min(o,d),o===0)return o}else if(!t&&r){let f=i.slice(h[0],h[1]+1);for(let y=u[0];y<=u[1];++y)if(d=Vr(e[y],f,n),o=Math.min(o,d),o===0)return o}else d=GM(e,u,i,h,n),o=Math.min(o,d)}else{let d=Ih(u,t),f=Ih(h,r);Qo(s,o,n,e,i,d[0],f[0]),Qo(s,o,n,e,i,d[0],f[1]),Qo(s,o,n,e,i,d[1],f[0]),Qo(s,o,n,e,i,d[1],f[1])}}return o}function qM(e,t){let i=e.geometry(),r=i.flat().map(o=>Ic([o.x,o.y],e.canonical));if(i.length===0)return NaN;let n=new Dc(r[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,Us(r,!1,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,Us(r,!1,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Gs(r,!1,o.coordinates,n,a));break}if(a===0)return a}return a}function YM(e,t){let i=e.geometry(),r=i.flat().map(o=>Ic([o.x,o.y],e.canonical));if(i.length===0)return NaN;let n=new Dc(r[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,Us(r,!0,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,Us(r,!0,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Gs(r,!0,o.coordinates,n,a));break}if(a===0)return a}return a}function ZM(e,t){let i=e.geometry();if(i.length===0||i[0].length===0)return NaN;let r=kc(i,0).map(o=>o.map(s=>s.map(l=>Ic([l.x,l.y],e.canonical)))),n=new Dc(r[0][0][0][1]),a=1/0;for(let o of t)for(let s of r){switch(o.type){case"Point":a=Math.min(a,Gs([o.coordinates],!1,s,n,a));break;case"LineString":a=Math.min(a,Gs(o.coordinates,!0,s,n,a));break;case"Polygon":a=Math.min(a,$M(s,o.coordinates,n,a));break}if(a===0)return a}return a}function ju(e){return e.type==="MultiPolygon"?e.coordinates.map(t=>({type:"Polygon",coordinates:t})):e.type==="MultiLineString"?e.coordinates.map(t=>({type:"LineString",coordinates:t})):e.type==="MultiPoint"?e.coordinates.map(t=>({type:"Point",coordinates:t})):[e]}var Fc=class Ls{constructor(t,i){this.type=q,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error("'distance' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(qa(t[1])){let r=t[1];if(r.type==="FeatureCollection")return new Ls(r,r.features.map(n=>ju(n.geometry)).flat());if(r.type==="Feature")return new Ls(r,ju(r.geometry));if("type"in r&&"coordinates"in r)return new Ls(r,ju(r))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return qM(t,this.geometries);if(t.geometryType()==="LineString")return YM(t,this.geometries);if(t.geometryType()==="Polygon")return ZM(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Bc=class o_{constructor(t){this.type=ue,this.key=t}static parse(t,i){if(t.length!==2)return i.error("Expected 1 argument, but found ".concat(t.length-1," instead."));let r=t[1];return r==null?i.error("Global state property must be defined."):typeof r!="string"?i.error("Global state property must be string, but found ".concat(typeof t[1]," instead.")):new o_(r)}evaluate(t){var i;let r=(i=t.globals)===null||i===void 0?void 0:i.globalState;return!r||Object.keys(r).length===0?null:Ba(r,this.key)}eachChild(){}outputDefined(){return!1}},kn={"==":fM,"!=":mM,">":gM,"<":yM,">=":xM,"<=":_M,array:Xi,at:YS,boolean:Xi,case:KS,coalesce:Xg,collator:Yg,format:Hg,image:bM,in:ZS,"index-of":WS,interpolate:ci,"interpolate-hcl":ci,"interpolate-lab":ci,length:wM,let:Fg,literal:Ya,match:HS,number:Xi,"number-format":vM,object:Xi,slice:JS,step:Cc,string:Xi,"to-boolean":In,"to-color":In,"to-number":In,"to-string":In,var:Rg,within:Ec,distance:Fc,"global-state":Bc},Qr=class ka{constructor(t,i,r,n){this.name=t,this.type=i,this._evaluate=r,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,i){let r=t[0],n=ka.definitions[r];if(!n)return i.error('Unknown expression "'.concat(r,'". If you wanted a literal array, use ["literal", [...]].'),0);let a=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=o.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,h]of s){l=new Lg(i.registry,Xs,i.path,null,i.scope);let c=[],p=!1;for(let d=1;d<t.length;d++){let f=t[d],y=Array.isArray(u)?u[d-1]:u.type,g=l.parse(f,1+c.length,y);if(!g){p=!0;break}c.push(g)}if(!p){if(Array.isArray(u)&&u.length!==c.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(c.length," instead."));continue}for(let d=0;d<c.length;d++){let f=Array.isArray(u)?u[d]:u.type,y=c[d];l.concat(d+1).checkSubtype(f,y.type)}if(l.errors.length===0)return new ka(r,a,h,c)}}if(s.length===1)i.errors.push(...l.errors);else{let u=(s.length?s:o).map(([c])=>HM(c)).join(" | "),h=[];for(let c=1;c<t.length;c++){let p=i.parse(t[c],1+h.length);if(!p)return null;h.push(Ge(p.type))}i.error("Expected arguments of type ".concat(u,", but found (").concat(h.join(", "),") instead."))}return null}static register(t,i){ka.definitions=i;for(let r in i)t[r]=ka}};function mf(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);let a=n?n.evaluate(e):1,o=Ig(t,i,r,a);if(o)throw new qe(o);return new J(t/255,i/255,r/255,a,!1)}function yf(e,t){return e in t}function Gu(e,t){let i=t[e];return typeof i>"u"?null:i}function WM(e,t,i,r){for(;i<=r;){let n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}function Rr(e){return{type:e}}Qr.register(kn,{error:[DS,[de],(e,[t])=>{throw new qe(t.evaluate(e))}],typeof:[de,[ue],(e,[t])=>Ge(at(t.evaluate(e)))],"to-rgba":[Rt(q,4),[hi],(e,[t])=>{let[i,r,n,a]=t.evaluate(e).rgb;return[i*255,r*255,n*255,a]}],rgb:[hi,[q,q,q],mf],rgba:[hi,[q,q,q,q],mf],has:{type:ce,overloads:[[[de],(e,[t])=>yf(t.evaluate(e),e.properties())],[[de,Gr],(e,[t,i])=>yf(t.evaluate(e),i.evaluate(e))]]},get:{type:ue,overloads:[[[de],(e,[t])=>Gu(t.evaluate(e),e.properties())],[[de,Gr],(e,[t,i])=>Gu(t.evaluate(e),i.evaluate(e))]]},"feature-state":[ue,[de],(e,[t])=>Gu(t.evaluate(e),e.featureState||{})],properties:[Gr,[],e=>e.properties()],"geometry-type":[de,[],e=>e.geometryType()],id:[ue,[],e=>e.id()],zoom:[q,[],e=>e.globals.zoom],"heatmap-density":[q,[],e=>e.globals.heatmapDensity||0],elevation:[q,[],e=>e.globals.elevation||0],"line-progress":[q,[],e=>e.globals.lineProgress||0],accumulated:[ue,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[q,Rr(q),(e,t)=>{let i=0;for(let r of t)i+=r.evaluate(e);return i}],"*":[q,Rr(q),(e,t)=>{let i=1;for(let r of t)i*=r.evaluate(e);return i}],"-":{type:q,overloads:[[[q,q],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[q],(e,[t])=>-t.evaluate(e)]]},"/":[q,[q,q],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[q,[q,q],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[q,[],()=>Math.LN2],pi:[q,[],()=>Math.PI],e:[q,[],()=>Math.E],"^":[q,[q,q],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[q,[q],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[q,[q],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[q,[q],(e,[t])=>Math.log(t.evaluate(e))],log2:[q,[q],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[q,[q],(e,[t])=>Math.sin(t.evaluate(e))],cos:[q,[q],(e,[t])=>Math.cos(t.evaluate(e))],tan:[q,[q],(e,[t])=>Math.tan(t.evaluate(e))],asin:[q,[q],(e,[t])=>Math.asin(t.evaluate(e))],acos:[q,[q],(e,[t])=>Math.acos(t.evaluate(e))],atan:[q,[q],(e,[t])=>Math.atan(t.evaluate(e))],min:[q,Rr(q),(e,t)=>Math.min(...t.map(i=>i.evaluate(e)))],max:[q,Rr(q),(e,t)=>Math.max(...t.map(i=>i.evaluate(e)))],abs:[q,[q],(e,[t])=>Math.abs(t.evaluate(e))],round:[q,[q],(e,[t])=>{let i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[q,[q],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[q,[q],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ce,[de,ue],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[ce,[ue],(e,[t])=>e.id()===t.value],"filter-type-==":[ce,[de],(e,[t])=>e.geometryType()===t.value],"filter-<":[ce,[de,ue],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[ce,[ue],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[ce,[de,ue],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[ce,[ue],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[ce,[de,ue],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[ce,[ue],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[ce,[de,ue],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[ce,[ue],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[ce,[ue],(e,[t])=>t.value in e.properties()],"filter-has-id":[ce,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[ce,[Rt(de)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ce,[Rt(ue)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ce,[de,Rt(ue)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ce,[de,Rt(ue)],(e,[t,i])=>WM(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:ce,overloads:[[[ce,ce],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Rr(ce),(e,t)=>{for(let i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:ce,overloads:[[[ce,ce],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Rr(ce),(e,t)=>{for(let i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[ce,[ce],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ce,[de],(e,[t])=>{let i=e.globals&&e.globals.isSupportedScript;return i?i(t.evaluate(e)):!0}],upcase:[de,[de],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[de,[de],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[de,Rr(ue),(e,t)=>t.map(i=>Ra(i.evaluate(e))).join("")],"resolved-locale":[de,[hl],(e,[t])=>t.evaluate(e).resolvedLocale()]});function HM(e){return Array.isArray(e)?"(".concat(e.map(Ge).join(", "),")"):"(".concat(Ge(e.type),"...)")}function Xs(e){if(e instanceof Rg)return Xs(e.boundExpression);if(e instanceof Qr&&e.name==="error"||e instanceof Yg||e instanceof Ec||e instanceof Fc||e instanceof Bc)return!1;let t=e instanceof In||e instanceof Xi,i=!0;return e.eachChild(r=>{t?i=i&&Xs(r):i=i&&r instanceof Ya}),i?yl(e)&&gl(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function yl(e){if(e instanceof Qr&&(e.name==="get"&&e.args.length===1||e.name==="feature-state"||e.name==="has"&&e.args.length===1||e.name==="properties"||e.name==="geometry-type"||e.name==="id"||/^filter-/.test(e.name))||e instanceof Ec||e instanceof Fc)return!1;let t=!0;return e.eachChild(i=>{t&&!yl(i)&&(t=!1)}),t}function Wa(e){if(e instanceof Qr&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(i=>{t&&!Wa(i)&&(t=!1)}),t}function gl(e,t){if(e instanceof Qr&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild(r=>{i&&!gl(r,t)&&(i=!1)}),i}function kh(e){return{result:"success",value:e}}function Pn(e){return{result:"error",value:e}}function Nn(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function s_(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Rc(e){return!!e.expression&&e.expression.interpolated}function fe(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function _l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&at(e)===Gr}function KM(e){return e}function JM(e){switch(e.type){case"color":return J.parse;case"padding":return Li.parse;case"numberArray":return zi.parse;case"colorArray":return ii.parse;default:return null}}function QM(e){switch(e){case"exponential":return u_;case"interval":return tC;case"categorical":return eC;case"identity":return iC;default:throw new Error('Unknown function type "'.concat(e,'"'))}}function l_(e,t){let i=e.stops&&typeof e.stops[0][0]=="object",r=i||e.property!==void 0,n=i||!r,a=e.type||(Rc(t)?"exponential":"interval"),o=JM(t);if(o&&(e=Rn({},e),e.stops&&(e.stops=e.stops.map(h=>[h[0],o(h[1])])),e.default?e.default=o(e.default):e.default=o(t.default)),e.colorSpace&&!US(e.colorSpace))throw new Error('Unknown color space: "'.concat(e.colorSpace,'"'));let s=QM(a),l,u;if(a==="categorical"){l=Object.create(null);for(let h of e.stops)l[h[0]]=h[1];u=typeof e.stops[0][0]}if(i){let h={},c=[];for(let f=0;f<e.stops.length;f++){let y=e.stops[f],g=y[0].zoom;h[g]===void 0&&(h[g]={zoom:g,type:e.type,property:e.property,default:e.default,stops:[]},c.push(g)),h[g].stops.push([y[0].value,y[1]])}let p=[];for(let f of c)p.push([h[f].zoom,l_(h[f],t)]);let d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:ci.interpolationFactor.bind(void 0,d),zoomStops:p.map(f=>f[0]),evaluate({zoom:f},y){return u_({stops:p,base:e.base},t,f).evaluate(f,y)}}}else if(n){let h=a==="exponential"?{name:"exponential",base:e.base!==void 0?e.base:1}:null;return{kind:"camera",interpolationType:h,interpolationFactor:ci.interpolationFactor.bind(void 0,h),zoomStops:e.stops.map(c=>c[0]),evaluate:({zoom:c})=>s(e,t,c,l,u)}}else return{kind:"source",evaluate(h,c){let p=c&&c.properties?c.properties[e.property]:void 0;return p===void 0?fo(e.default,t.default):s(e,t,p,l,u)}}}function fo(e,t,i){if(e!==void 0)return e;if(t!==void 0)return t;if(i!==void 0)return i}function eC(e,t,i,r,n){let a=typeof i===n?r[i]:void 0;return fo(a,e.default,t.default)}function tC(e,t,i){if(fe(i)!=="number")return fo(e.default,t.default);let r=e.stops.length;if(r===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];let n=fl(e.stops.map(a=>a[0]),i);return e.stops[n][1]}function u_(e,t,i){let r=e.base!==void 0?e.base:1;if(fe(i)!=="number")return fo(e.default,t.default);let n=e.stops.length;if(n===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];let a=fl(e.stops.map(h=>h[0]),i),o=rC(i,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],l=e.stops[a+1][1],u=Ue[t.type]||KM;return typeof s.evaluate=="function"?{evaluate(...h){let c=s.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(!(c===void 0||p===void 0))return u(c,p,o,e.colorSpace)}}:u(s,l,o,e.colorSpace)}function iC(e,t,i){switch(t.type){case"color":i=J.parse(i);break;case"formatted":i=Hi.fromString(i.toString());break;case"resolvedImage":i=ki.fromString(i.toString());break;case"padding":i=Li.parse(i);break;case"colorArray":i=ii.parse(i);break;case"numberArray":i=zi.parse(i);break;default:fe(i)!==t.type&&(t.type!=="enum"||!t.values[i])&&(i=void 0)}return fo(i,e.default,t.default)}function rC(e,t,i,r){let n=r-i,a=e-i;return n===0?0:t===1?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}var Oc=class{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Dg,this._defaultValue=t?sC(t):null,this._enumValues=t&&t.type==="enum"?t.values:null}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{let o=this.expression.evaluate(this._evaluator);if(o==null||typeof o=="number"&&o!==o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new qe("Expected value to be one of ".concat(Object.keys(this._enumValues).map(s=>JSON.stringify(s)).join(", "),", but found ").concat(JSON.stringify(o)," instead."));return o}catch(o){return this._warningHistory[o.message]||(this._warningHistory[o.message]=!0,typeof console<"u"&&console.warn(o.message)),this._defaultValue}}};function xl(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in kn}function Nc(e,t){let i=new Lg(kn,Xs,[],t?oC(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return r?kh(new Oc(r,t)):Pn(i.errors)}var Ha=class{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Wa(t.expression),this.globalStateRefs=vl(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}evaluate(e,t,i,r,n,a){return this._styleExpression.evaluate(e,t,i,r,n,a)}},$s=class{constructor(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Wa(t.expression),this.globalStateRefs=vl(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}evaluate(e,t,i,r,n,a){return this._styleExpression.evaluate(e,t,i,r,n,a)}interpolationFactor(e,t,i){return this.interpolationType?ci.interpolationFactor(this.interpolationType,e,t,i):0}};function nC(e){return e._styleExpression!==void 0}function h_(e,t){let i=Nc(e,t);if(i.result==="error")return i;let r=i.value.expression,n=yl(r);if(!n&&!Nn(t))return Pn([new wi("","data expressions not supported")]);let a=gl(r,["zoom"]);if(!a&&!s_(t))return Pn([new wi("","zoom expressions not supported")]);let o=zs(r);if(!o&&!a)return Pn([new wi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(o instanceof wi)return Pn([o]);if(o instanceof ci&&!Rc(t))return Pn([new wi("",'"interpolate" expressions cannot be used with this property')]);if(!o)return kh(n?new Ha("constant",i.value):new Ha("source",i.value));let s=o instanceof ci?o.interpolation:void 0;return kh(n?new $s("camera",i.value,o.labels,s):new $s("composite",i.value,o.labels,s))}var c_=class p_{constructor(t,i){this._parameters=t,this._specification=i,Rn(this,l_(this._parameters,this._specification))}static deserialize(t){return new p_(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}};function aC(e,t){if(_l(e))return new c_(e,t);if(xl(e)){let i=h_(e,t);if(i.result==="error")throw new Error(i.value.map(r=>"".concat(r.key,": ").concat(r.message)).join(", "));return i.value}else{let i=e;return t.type==="color"&&typeof e=="string"?i=J.parse(e):t.type==="padding"&&(typeof e=="number"||Array.isArray(e))?i=Li.parse(e):t.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?i=zi.parse(e):t.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?i=ii.parse(e):t.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?i=Tr.parse(e):t.type==="projectionDefinition"&&typeof e=="string"&&(i=Jr.parse(e)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>i}}}function zs(e){let t=null;if(e instanceof Fg)t=zs(e.result);else if(e instanceof Xg){for(let i of e.args)if(t=zs(i),t)break}else(e instanceof Cc||e instanceof ci)&&e.input instanceof Qr&&e.input.name==="zoom"&&(t=e);return t instanceof wi||e.eachChild(i=>{let r=zs(i);r instanceof wi?t=r:!t&&r?t=new wi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new wi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function vl(e,t=new Set){return e instanceof Bc&&t.add(e.key),e.eachChild(i=>{vl(i,t)}),t}function oC(e){let t={color:hi,string:de,number:q,enum:de,boolean:ce,formatted:ho,padding:cl,numberArray:pl,colorArray:Xa,projectionDefinition:ul,resolvedImage:co,variableAnchorOffsetCollection:dl};return e.type==="array"?Rt(t[e.value]||ue,e.length):t[e.type]}function sC(e){if(e.type==="color"&&_l(e.default))return new J(0,0,0,0);switch(e.type){case"color":return J.parse(e.default)||null;case"padding":return Li.parse(e.default)||null;case"numberArray":return zi.parse(e.default)||null;case"colorArray":return ii.parse(e.default)||null;case"variableAnchorOffsetCollection":return Tr.parse(e.default)||null;case"projectionDefinition":return Jr.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function Vc(e){if(e===!0||e===!1)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case"has":return e.length>=2&&e[1]!=="$id"&&e[1]!=="$type";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!Vc(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}var lC={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ka(e){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Vc(e)||(e=qs(e));let t=Nc(e,lC);if(t.result==="error")throw new Error(t.value.map(i=>"".concat(i.key,": ").concat(i.message)).join(", "));{let i=d_(e);return{filter:(r,n,a)=>t.value.evaluate(r,n,{},a),needGeometry:i,getGlobalStateRefs:()=>vl(t.value.expression)}}}function uC(e,t){return e<t?-1:e>t?1:0}function d_(e){if(!Array.isArray(e))return!1;if(e[0]==="within"||e[0]==="distance")return!0;for(let t=1;t<e.length;t++)if(d_(e[t]))return!0;return!1}function qs(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?Uu(e[1],e[2],"=="):t==="!="?es(Uu(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Uu(e[1],e[2],t):t==="any"?hC(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(qs)):t==="none"?["all"].concat(e.slice(1).map(qs).map(es)):t==="in"?gf(e[1],e.slice(2)):t==="!in"?es(gf(e[1],e.slice(2))):t==="has"?_f(e[1]):t==="!has"?es(_f(e[1])):!0}function Uu(e,t,i){switch(e){case"$type":return["filter-type-".concat(i),t];case"$id":return["filter-id-".concat(i),t];default:return["filter-".concat(i),e,t]}}function hC(e){return["any"].concat(e.map(qs))}function gf(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(i=>typeof i!=typeof t[0])?["filter-in-large",e,["literal",t.sort(uC)]]:["filter-in-small",e,["literal",t]]}}function _f(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function es(e){return["!",e]}function cC(){let e={},t=B.$version;for(let i in B.$root){let r=B.$root[i];if(r.required){let n=null;i==="version"?n=t:r.type==="array"?n=[]:n={},n!=null&&(e[i]=n)}}return e}function f_(e){let t=e.key,i=e.value;return i?[new G(t,i,"constants have been deprecated as of v8")]:[]}function Je(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function $r(e){if(Array.isArray(e))return e.map($r);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let i in e)t[i]=$r(e[i]);return t}return Je(e)}function ti(e){let t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,l=[],u=fe(i);if(u!=="object")return[new G(t,i,"object expected, ".concat(u," found"))];for(let h in i){let c=h.split(".")[0],p=Ba(r,c)||r["*"],d;if(Ba(n,c))d=n[c];else if(Ba(r,c))d=s;else if(n["*"])d=n["*"];else if(r["*"])d=s;else{l.push(new G(t,i[h],'unknown property "'.concat(h,'"')));continue}l=l.concat(d({key:(t&&"".concat(t,"."))+h,value:i[h],valueSpec:p,style:a,styleSpec:o,object:i,objectKey:h,validateSpec:s},i))}for(let h in r)n[h]||r[h].required&&r[h].default===void 0&&i[h]===void 0&&l.push(new G(t,i,'missing required property "'.concat(h,'"')));return l}function jc(e){let t=e.value,i=e.valueSpec,r=e.validateSpec,n=e.style,a=e.styleSpec,o=e.key,s=e.arrayElementValidator||r;if(fe(t)!=="array")return[new G(o,t,"array expected, ".concat(fe(t)," found"))];if(i.length&&t.length!==i.length)return[new G(o,t,"array length ".concat(i.length," expected, length ").concat(t.length," found"))];if(i["min-length"]&&t.length<i["min-length"])return[new G(o,t,"array length at least ".concat(i["min-length"]," expected, length ").concat(t.length," found"))];let l={type:i.value,values:i.values};a.$version<7&&(l.function=i.function),fe(i.value)==="object"&&(l=i.value);let u=[];for(let h=0;h<t.length;h++)u=u.concat(s({array:t,arrayIndex:h,value:t[h],valueSpec:l,validateSpec:e.validateSpec,style:n,styleSpec:a,key:"".concat(o,"[").concat(h,"]")}));return u}function bl(e){let t=e.key,i=e.value,r=e.valueSpec,n=fe(i);return n==="number"&&i!==i&&(n="NaN"),n!=="number"?[new G(t,i,"number expected, ".concat(n," found"))]:"minimum"in r&&i<r.minimum?[new G(t,i,"".concat(i," is less than the minimum value ").concat(r.minimum))]:"maximum"in r&&i>r.maximum?[new G(t,i,"".concat(i," is greater than the maximum value ").concat(r.maximum))]:[]}function m_(e){let t=e.valueSpec,i=Je(e.value.type),r,n={},a,o,s=i!=="categorical"&&e.value.property===void 0,l=!s,u=fe(e.value.stops)==="array"&&fe(e.value.stops[0])==="array"&&fe(e.value.stops[0][0])==="object",h=ti({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:c,default:f}});return i==="identity"&&s&&h.push(new G(e.key,e.value,'missing required property "property"')),i!=="identity"&&!e.value.stops&&h.push(new G(e.key,e.value,'missing required property "stops"')),i==="exponential"&&e.valueSpec.expression&&!Rc(e.valueSpec)&&h.push(new G(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Nn(e.valueSpec)?h.push(new G(e.key,e.value,"property functions not supported")):s&&!s_(e.valueSpec)&&h.push(new G(e.key,e.value,"zoom functions not supported"))),(i==="categorical"||u)&&e.value.property===void 0&&h.push(new G(e.key,e.value,'"property" property is required')),h;function c(y){if(i==="identity")return[new G(y.key,y.value,'identity function may not have a "stops" property')];let g=[],_=y.value;return g=g.concat(jc({key:y.key,value:_,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),fe(_)==="array"&&_.length===0&&g.push(new G(y.key,_,"array must have at least one stop")),g}function p(y){let g=[],_=y.value,b=y.key;if(fe(_)!=="array")return[new G(b,_,"array expected, ".concat(fe(_)," found"))];if(_.length!==2)return[new G(b,_,"array length 2 expected, length ".concat(_.length," found"))];if(u){if(fe(_[0])!=="object")return[new G(b,_,"object expected, ".concat(fe(_[0])," found"))];if(_[0].zoom===void 0)return[new G(b,_,"object stop key must have zoom")];if(_[0].value===void 0)return[new G(b,_,"object stop key must have value")];if(o&&o>Je(_[0].zoom))return[new G(b,_[0].zoom,"stop zoom values must appear in ascending order")];Je(_[0].zoom)!==o&&(o=Je(_[0].zoom),a=void 0,n={}),g=g.concat(ti({key:"".concat(b,"[0]"),value:_[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:bl,value:d}}))}else g=g.concat(d({key:"".concat(b,"[0]"),value:_[0],validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},_));return xl($r(_[1]))?g.concat([new G("".concat(b,"[1]"),_[1],"expressions are not allowed in function stops.")]):g.concat(y.validateSpec({key:"".concat(b,"[1]"),value:_[1],valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function d(y,g){let _=fe(y.value),b=Je(y.value),v=y.value!==null?y.value:g;if(!r)r=_;else if(_!==r)return[new G(y.key,v,"".concat(_," stop domain type must match previous stop domain type ").concat(r))];if(_!=="number"&&_!=="string"&&_!=="boolean")return[new G(y.key,v,"stop domain value must be a number, string, or boolean")];if(_!=="number"&&i!=="categorical"){let w="number expected, ".concat(_," found");return Nn(t)&&i===void 0&&(w+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new G(y.key,v,w)]}return i==="categorical"&&_==="number"&&(!isFinite(b)||Math.floor(b)!==b)?[new G(y.key,v,"integer expected, found ".concat(b))]:i!=="categorical"&&_==="number"&&a!==void 0&&b<a?[new G(y.key,v,"stop domain values must appear in ascending order")]:(a=b,i==="categorical"&&b in n?[new G(y.key,v,"stop domain values must be unique")]:(n[b]=!0,[]))}function f(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function Vn(e){let t=(e.expressionContext==="property"?h_:Nc)($r(e.value),e.valueSpec);if(t.result==="error")return t.value.map(r=>new G("".concat(e.key).concat(r.key),e.value,r.message));let i=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!i.outputDefined())return[new G(e.key,e.value,'Invalid data expression for "'.concat(e.propertyKey,'". Output values must be contained as literals within the expression.'))];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!Wa(i))return[new G(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!Wa(i))return[new G(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!gl(i,["zoom","feature-state"]))return[new G(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!yl(i))return[new G(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function pC(e){let t=e.value,i=e.key,r=fe(t);return r!=="boolean"?[new G(i,t,"boolean expected, ".concat(r," found"))]:[]}function Dh(e){let t=e.key,i=e.value,r=fe(i);return r!=="string"?[new G(t,i,"color expected, ".concat(r," found"))]:J.parse(String(i))?[]:[new G(t,i,'color expected, "'.concat(i,'" found'))]}function Ja(e){let t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?r.values.indexOf(Je(i))===-1&&n.push(new G(t,i,"expected one of [".concat(r.values.join(", "),"], ").concat(JSON.stringify(i)," found"))):Object.keys(r.values).indexOf(Je(i))===-1&&n.push(new G(t,i,"expected one of [".concat(Object.keys(r.values).join(", "),"], ").concat(JSON.stringify(i)," found"))),n}function Gc(e){return Vc($r(e.value))?Vn(Rn({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):y_(e)}function y_(e){let t=e.value,i=e.key;if(fe(t)!=="array")return[new G(i,t,"array expected, ".concat(fe(t)," found"))];let r=e.styleSpec,n,a=[];if(t.length<1)return[new G(i,t,"filter array must have at least 1 element")];switch(a=a.concat(Ja({key:"".concat(i,"[0]"),value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),Je(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Je(t[1])==="$type"&&a.push(new G(i,t,'"$type" cannot be use with operator "'.concat(t[0],'"')));case"==":case"!=":t.length!==3&&a.push(new G(i,t,'filter array for operator "'.concat(t[0],'" must have 3 elements')));case"in":case"!in":t.length>=2&&(n=fe(t[1]),n!=="string"&&a.push(new G("".concat(i,"[1]"),t[1],"string expected, ".concat(n," found"))));for(let o=2;o<t.length;o++)n=fe(t[o]),Je(t[1])==="$type"?a=a.concat(Ja({key:"".concat(i,"[").concat(o,"]"),value:t[o],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&a.push(new G("".concat(i,"[").concat(o,"]"),t[o],"string, number, or boolean expected, ".concat(n," found")));break;case"any":case"all":case"none":for(let o=1;o<t.length;o++)a=a.concat(y_({key:"".concat(i,"[").concat(o,"]"),value:t[o],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=fe(t[1]),t.length!==2?a.push(new G(i,t,'filter array for "'.concat(t[0],'" operator must have 2 elements'))):n!=="string"&&a.push(new G("".concat(i,"[1]"),t[1],"string expected, ".concat(n," found")));break}return a}function g_(e,t){let i=e.key,r=e.validateSpec,n=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,l=a["".concat(t,"_").concat(e.layerType)];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return r({key:i,value:o,valueSpec:a.transition,style:n,styleSpec:a});let h=e.valueSpec||l[s];if(!h)return[new G(i,o,'unknown property "'.concat(s,'"'))];let c;if(fe(o)==="string"&&Nn(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new G(i,o,'"'.concat(s,'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": ').concat(JSON.stringify(c[1])," }`."))];let p=[];return e.layerType==="symbol"&&(s==="text-field"&&n&&!n.glyphs&&p.push(new G(i,o,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&_l($r(o))&&Je(o.type)==="identity"&&p.push(new G(i,o,'"text-font" does not support identity functions'))),p.concat(r({key:e.key,value:o,valueSpec:h,style:n,styleSpec:a,expressionContext:"property",propertyType:t,propertyKey:s}))}function __(e){return g_(e,"paint")}function x_(e){return g_(e,"layout")}function v_(e){let t=[],i=e.value,r=e.key,n=e.style,a=e.styleSpec;if(fe(i)!=="object")return[new G(r,i,"object expected, ".concat(fe(i)," found"))];!i.type&&!i.ref&&t.push(new G(r,i,'either "type" or "ref" is required'));let o=Je(i.type),s=Je(i.ref);if(i.id){let l=Je(i.id);for(let u=0;u<e.arrayIndex;u++){let h=n.layers[u];Je(h.id)===l&&t.push(new G(r,i.id,'duplicate layer id "'.concat(i.id,'", previously used at line ').concat(h.id.__line__)))}}if("ref"in i){["type","source","source-layer","filter","layout"].forEach(u=>{u in i&&t.push(new G(r,i[u],'"'.concat(u,'" is prohibited for ref layers')))});let l;n.layers.forEach(u=>{Je(u.id)===s&&(l=u)}),l?l.ref?t.push(new G(r,i.ref,"ref cannot reference another ref layer")):o=Je(l.type):t.push(new G(r,i.ref,'ref layer "'.concat(s,'" not found')))}else if(o!=="background")if(!i.source)t.push(new G(r,i,'missing required property "source"'));else{let l=n.sources&&n.sources[i.source],u=l&&Je(l.type);l?u==="vector"&&o==="raster"?t.push(new G(r,i.source,'layer "'.concat(i.id,'" requires a raster source'))):u!=="raster-dem"&&o==="hillshade"?t.push(new G(r,i.source,'layer "'.concat(i.id,'" requires a raster-dem source'))):u!=="raster-dem"&&o==="color-relief"?t.push(new G(r,i.source,'layer "'.concat(i.id,'" requires a raster-dem source'))):u==="raster"&&o!=="raster"?t.push(new G(r,i.source,'layer "'.concat(i.id,'" requires a vector source'))):u==="vector"&&!i["source-layer"]?t.push(new G(r,i,'layer "'.concat(i.id,'" must specify a "source-layer"'))):u==="raster-dem"&&o!=="hillshade"&&o!=="color-relief"?t.push(new G(r,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):o==="line"&&i.paint&&i.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&t.push(new G(r,i,'layer "'.concat(i.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):t.push(new G(r,i.source,'source "'.concat(i.source,'" not found')))}return t=t.concat(ti({key:r,value:i,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:"".concat(r,".type"),value:i.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"})},filter:Gc,layout(l){return ti({layer:i,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return x_(Rn({layerType:o},u))}}})},paint(l){return ti({layer:i,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return __(Rn({layerType:o},u))}}})}}})),t}function qr(e){let t=e.value,i=e.key,r=fe(t);return r!=="string"?[new G(i,t,"string expected, ".concat(r," found"))]:[]}function dC(e){var t;let i=(t=e.sourceName)!==null&&t!==void 0?t:"",r=e.value,n=e.styleSpec,a=n.source_raster_dem,o=e.style,s=[],l=fe(r);if(r===void 0)return s;if(l!=="object")return s.push(new G("source_raster_dem",r,"object expected, ".concat(l," found"))),s;let u=Je(r.encoding)==="custom",h=["redFactor","greenFactor","blueFactor","baseShift"],c=e.value.encoding?'"'.concat(e.value.encoding,'"'):"Default";for(let p in r)!u&&h.includes(p)?s.push(new G(p,r[p],'In "'.concat(i,'": "').concat(p,'" is only valid when "encoding" is set to "custom". ').concat(c," encoding found"))):a[p]?s=s.concat(e.validateSpec({key:p,value:r[p],valueSpec:a[p],validateSpec:e.validateSpec,style:o,styleSpec:n})):s.push(new G(p,r[p],'unknown property "'.concat(p,'"')));return s}var xf={promoteId:fC};function b_(e){let t=e.value,i=e.key,r=e.styleSpec,n=e.style,a=e.validateSpec;if(!t.type)return[new G(i,t,'"type" is required')];let o=Je(t.type),s;switch(o){case"vector":case"raster":return s=ti({key:i,value:t,valueSpec:r["source_".concat(o.replace("-","_"))],style:e.style,styleSpec:r,objectElementValidators:xf,validateSpec:a}),s;case"raster-dem":return s=dC({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:a}),s;case"geojson":if(s=ti({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:a,objectElementValidators:xf}),t.cluster)for(let l in t.clusterProperties){let[u,h]=t.clusterProperties[l],c=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...Vn({key:"".concat(i,".").concat(l,".map"),value:h,expressionContext:"cluster-map"})),s.push(...Vn({key:"".concat(i,".").concat(l,".reduce"),value:c,expressionContext:"cluster-reduce"}))}return s;case"video":return ti({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:a,styleSpec:r});case"image":return ti({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:a,styleSpec:r});case"canvas":return[new G(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ja({key:"".concat(i,".type"),value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function fC({key:e,value:t}){if(fe(t)==="string")return qr({key:e,value:t});{let i=[];for(let r in t)i.push(...qr({key:"".concat(e,".").concat(r),value:t[r]}));return i}}function w_(e){let t=e.value,i=e.styleSpec,r=i.light,n=e.style,a=[],o=fe(t);if(t===void 0)return a;if(o!=="object")return a=a.concat([new G("light",t,"object expected, ".concat(o," found"))]),a;for(let s in t){let l=s.match(/^(.*)-transition$/);l&&r[l[1]]&&r[l[1]].transition?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:n,styleSpec:i})):r[s]?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i})):a=a.concat([new G(s,t[s],'unknown property "'.concat(s,'"'))])}return a}function P_(e){let t=e.value,i=e.styleSpec,r=i.sky,n=e.style,a=fe(t);if(t===void 0)return[];if(a!=="object")return[new G("sky",t,"object expected, ".concat(a," found"))];let o=[];for(let s in t)r[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i})):o=o.concat([new G(s,t[s],'unknown property "'.concat(s,'"'))]);return o}function T_(e){let t=e.value,i=e.styleSpec,r=i.terrain,n=e.style,a=[],o=fe(t);if(t===void 0)return a;if(o!=="object")return a=a.concat([new G("terrain",t,"object expected, ".concat(o," found"))]),a;for(let s in t)r[s]?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i})):a=a.concat([new G(s,t[s],'unknown property "'.concat(s,'"'))]);return a}function mC(e){return qr(e).length===0?[]:Vn(e)}function yC(e){return qr(e).length===0?[]:Vn(e)}function gC(e){let t=e.key,i=e.value;if(fe(i)==="array"){if(i.length<1||i.length>4)return[new G(t,i,"padding requires 1 to 4 values; ".concat(i.length," values found"))];let r={type:"number"},n=[];for(let a=0;a<i.length;a++)n=n.concat(e.validateSpec({key:"".concat(t,"[").concat(a,"]"),value:i[a],validateSpec:e.validateSpec,valueSpec:r}));return n}else return bl({key:t,value:i,valueSpec:{}})}function _C(e){let t=e.key,i=e.value;if(fe(i)==="array"){let r={type:"number"};if(i.length<1)return[new G(t,i,"array length at least 1 expected, length 0 found")];let n=[];for(let a=0;a<i.length;a++)n=n.concat(e.validateSpec({key:"".concat(t,"[").concat(a,"]"),value:i[a],validateSpec:e.validateSpec,valueSpec:r}));return n}else return bl({key:t,value:i,valueSpec:{}})}function xC(e){let t=e.key,i=e.value;if(fe(i)==="array"){if(i.length<1)return[new G(t,i,"array length at least 1 expected, length 0 found")];let r=[];for(let n=0;n<i.length;n++)r=r.concat(Dh({key:"".concat(t,"[").concat(n,"]"),value:i[n]}));return r}else return Dh({key:t,value:i})}function vC(e){let t=e.key,i=e.value,r=fe(i),n=e.styleSpec;if(r!=="array"||i.length<1||i.length%2!==0)return[new G(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let a=[];for(let o=0;o<i.length;o+=2)a=a.concat(Ja({key:"".concat(t,"[").concat(o,"]"),value:i[o],valueSpec:n.layout_symbol["text-anchor"]})),a=a.concat(jc({key:"".concat(t,"[").concat(o+1,"]"),value:i[o+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return a}function S_(e){let t=[],i=e.value,r=e.key;if(Array.isArray(i)){let n=[],a=[];for(let o in i){i[o].id&&n.includes(i[o].id)&&t.push(new G(r,i,"all the sprites' ids must be unique, but ".concat(i[o].id," is duplicated"))),n.push(i[o].id),i[o].url&&a.includes(i[o].url)&&t.push(new G(r,i,"all the sprites' URLs must be unique, but ".concat(i[o].url," is duplicated"))),a.push(i[o].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(ti({key:"".concat(r,"[").concat(o,"]"),value:i[o],valueSpec:s,validateSpec:e.validateSpec}))}return t}else return qr({key:r,value:i})}function bC(e){let t=e.value,i=e.styleSpec,r=i.projection,n=e.style,a=fe(t);if(t===void 0)return[];if(a!=="object")return[new G("projection",t,"object expected, ".concat(a," found"))];let o=[];for(let s in t)r[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i})):o=o.concat([new G(s,t[s],'unknown property "'.concat(s,'"'))]);return o}function wC(e){let t=e.key,i=e.value;i=i instanceof String?i.valueOf():i;let r=fe(i);return r==="array"&&!TC(i)&&!PC(i)?[new G(t,i,"projection expected, invalid array ".concat(JSON.stringify(i)," found"))]:["array","string"].includes(r)?[]:[new G(t,i,'projection expected, invalid type "'.concat(r,'" found'))]}function PC(e){return!!["interpolate","step","literal"].includes(e[0])}function TC(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"}function SC(e){return!!e&&e.constructor===Object}function M_(e){return SC(e.value)?[]:[new G(e.key,e.value,"object expected, ".concat(fe(e.value)," found"))]}var vf={"*"(){return[]},array:jc,boolean:pC,number:bl,color:Dh,constants:f_,enum:Ja,filter:Gc,function:m_,layer:v_,object:ti,source:b_,light:w_,sky:P_,terrain:T_,projection:bC,projectionDefinition:wC,string:qr,formatted:mC,resolvedImage:yC,padding:gC,numberArray:_C,colorArray:xC,variableAnchorOffsetCollection:vC,sprite:S_,state:M_};function Ys(e){let t=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=Ys,i.expression&&_l(Je(t))?m_(e):i.expression&&xl($r(t))?Vn(e):i.type&&vf[i.type]?vf[i.type](e):ti(Rn({},e,{valueSpec:i.type?r[i.type]:i}))}function C_(e){let t=e.value,i=e.key,r=qr(e);return r.length||(t.indexOf("{fontstack}")===-1&&r.push(new G(i,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&r.push(new G(i,t,'"glyphs" url must include a "{range}" token'))),r}function ri(e,t=B){let i=[];return i=i.concat(Ys({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Ys,objectElementValidators:{glyphs:C_,"*"(){return[]}}})),e.constants&&(i=i.concat(f_({key:"constants",value:e.constants}))),I_(i)}ri.source=fi(di(b_));ri.sprite=fi(di(S_));ri.glyphs=fi(di(C_));ri.light=fi(di(w_));ri.sky=fi(di(P_));ri.terrain=fi(di(T_));ri.state=fi(di(M_));ri.layer=fi(di(v_));ri.filter=fi(di(Gc));ri.paintProperty=fi(di(__));ri.layoutProperty=fi(di(x_));function di(e){return function(t){return e(Ht(He({},t),{validateSpec:Ys}))}}function I_(e){return[].concat(e).sort((t,i)=>t.line-i.line)}function fi(e){return function(...t){return I_(e.apply(this,t))}}var rt=ri,q8=rt.source,MC=rt.light,CC=rt.sky,Y8=rt.terrain,Z8=rt.filter,IC=rt.paintProperty,AC=rt.layoutProperty;function wl(e,t){let i=!1;if(t&&t.length)for(let r of t)e.fire(new te(new Error(r.message))),i=!0;return i}var Lh=class A_{constructor(t,i,r){let n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let o=new Int32Array(this.arrayBuffer);t=o[0],i=o[1],r=o[2],this.d=i+2*r;for(let u=0;u<this.d*this.d;u++){let h=o[3+u],c=o[3+u+1];n.push(h===c?null:o.subarray(h,c))}let s=o[3+n.length],l=o[3+n.length+1];this.keys=o.subarray(s,l),this.bboxes=o.subarray(l),this.insert=this._insertReadonly}else{this.d=i+2*r;for(let o=0;o<this.d*this.d;o++)n.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=t,this.padding=r,this.scale=i/t,this.uid=0;let a=r/i*t;this.min=-a,this.max=t+a}insert(t,i,r,n,a){this._forEachCell(i,r,n,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(a)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,i,r,n,a,o){this.cells[a].push(o)}query(t,i,r,n,a){let o=this.min,s=this.max;if(t<=o&&i<=o&&s<=r&&s<=n&&!a)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(t,i,r,n,this._queryCell,l,u,a),l}}_queryCell(t,i,r,n,a,o,s,l){let u=this.cells[a];if(u!==null){let h=this.keys,c=this.bboxes;for(let p=0;p<u.length;p++){let d=u[p];if(s[d]===void 0){let f=d*4;(l?l(c[f+0],c[f+1],c[f+2],c[f+3]):t<=c[f+2]&&i<=c[f+3]&&r>=c[f+0]&&n>=c[f+1])?(s[d]=!0,o.push(h[d])):s[d]=!1}}}}_forEachCell(t,i,r,n,a,o,s,l){let u=this._convertToCellCoord(t),h=this._convertToCellCoord(i),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n);for(let d=u;d<=c;d++)for(let f=h;f<=p;f++){let y=this.d*f+d;if(!(l&&!l(this._convertFromCellCoord(d),this._convertFromCellCoord(f),this._convertFromCellCoord(d+1),this._convertFromCellCoord(f+1)))&&a.call(this,t,i,r,n,y,o,s,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,i=3+this.cells.length+1+1,r=0;for(let o=0;o<this.cells.length;o++)r+=this.cells[o].length;let n=new Int32Array(i+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=i;for(let o=0;o<t.length;o++){let s=t[o];n[3+o]=a,n.set(s,a),a+=s.length}return n[3+t.length]=a,n.set(this.keys,a),a+=this.keys.length,n[3+t.length+1]=a,n.set(this.bboxes,a),a+=this.bboxes.length,n.buffer}static serialize(t,i){let r=t.toArrayBuffer();return i&&i.push(r),{buffer:r}}static deserialize(t){return new A_(t.buffer)}},$i={};function W(e,t,i={}){if($i[e])throw new Error("".concat(e," is already registered."));Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),$i[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}W("Object",Object);W("Set",Set);W("TransferableGridIndex",Lh);W("Color",J);W("Error",Error);W("AJAXError",Vs);W("ResolvedImage",ki);W("StylePropertyFunction",c_);W("StyleExpression",Oc,{omit:["_evaluator"]});W("ZoomDependentExpression",$s);W("ZoomConstantExpression",Ha);W("CompoundExpression",Qr,{omit:["_evaluate"]});for(let e in kn)kn[e]._classRegistryKey||W("Expression_".concat(e),kn[e]);function E_(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}function Uc(e){let t=e.constructor;return e.$name||t._classRegistryKey}function EC(e){if(e===null||typeof e!="object")return!1;let t=Uc(e);return!!(t&&t!=="Object")}function k_(e){return!EC(e)&&(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||E_(e)||Zi(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function Oa(e,t){if(k_(e)){if((E_(e)||Zi(e))&&t&&t.push(e),ArrayBuffer.isView(e)){let a=e;t&&t.push(a.buffer)}return e instanceof ImageData&&t&&t.push(e.data.buffer),e}if(Array.isArray(e)){let a=[];for(let o of e)a.push(Oa(o,t));return a}if(typeof e!="object")throw new Error("can't serialize object of type ".concat(typeof e));let i=Uc(e);if(!i)throw new Error("can't serialize object of unregistered class ".concat(e.constructor.name));if(!$i[i])throw new Error("".concat(i," is not registered."));let{klass:r}=$i[i],n=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&n===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let a in e){if(!e.hasOwnProperty(a)||$i[i].omit.indexOf(a)>=0)continue;let o=e[a];n[a]=$i[i].shallow.indexOf(a)>=0?o:Oa(o,t)}e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(n.$name=i),n}function Na(e){if(k_(e))return e;if(Array.isArray(e))return e.map(Na);if(typeof e!="object")throw new Error("can't deserialize object of type ".concat(typeof e));let t=Uc(e)||"Object";if(!$i[t])throw new Error("can't deserialize unregistered class ".concat(t));let{klass:i}=$i[t];if(!i)throw new Error("can't deserialize unregistered class ".concat(t));if(i.deserialize)return i.deserialize(e);let r=Object.create(i.prototype);for(let n of Object.keys(e)){if(n==="$name")continue;let a=e[n];r[n]=$i[t].shallow.indexOf(n)>=0?a:Na(a)}return r}var zh=class{constructor(){this.first=!0}update(e,t){let i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=t),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=i,!0):!1)}},ht={"Latin-1 Supplement":e=>e>=128&&e<=255,"Hangul Jamo":e=>e>=4352&&e<=4607,Khmer:e=>e>=6016&&e<=6143,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Kanbun:e=>e>=12688&&e<=12703,"CJK Strokes":e=>e>=12736&&e<=12783,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Hangul Syllables":e=>e>=44032&&e<=55215,"Private Use Area":e=>e>=57344&&e<=63743,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function kC(e){for(let t of e)if(FC(t.charCodeAt(0)))return!0;return!1}function Xc(e){let t=e.map(i=>{try{return new RegExp("\\p{sc=".concat(i,"}"),"u").source}catch(r){return null}}).filter(i=>i);return new RegExp(t.join("|"),"u")}var DC=["Arab","Dupl","Mong","Ougr","Syrc"],W8=Xc(DC),LC=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],zC=Xc(LC);function FC(e){return e===746||e===747?!0:e<4352?!1:!!(ht["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||ht["CJK Compatibility"](e)||ht["CJK Strokes"](e)||ht["CJK Symbols and Punctuation"](e)&&!(e>=12296&&e<=12305)&&!(e>=12308&&e<=12319)&&e!==12336||ht["Enclosed CJK Letters and Months"](e)||ht["Ideographic Description Characters"](e)||ht.Kanbun(e)||ht.Katakana(e)&&e!==12540||ht["Halfwidth and Fullwidth Forms"](e)&&e!==65288&&e!==65289&&e!==65293&&!(e>=65306&&e<=65310)&&e!==65339&&e!==65341&&e!==65343&&!(e>=65371&&e<=65503)&&e!==65507&&!(e>=65512&&e<=65519)||ht["Small Form Variants"](e)&&!(e>=65112&&e<=65118)&&!(e>=65123&&e<=65126)||ht["Vertical Forms"](e)||ht["Yijing Hexagram Symbols"](e)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(e))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(e))||zC.test(String.fromCodePoint(e)))}var BC=["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"],RC=Xc(BC);function D_(e){return RC.test(String.fromCodePoint(e))}function OC(e,t){return!(!t&&D_(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||ht.Khmer(e))}function NC(e){for(let t of e)if(D_(t.charCodeAt(0)))return!0;return!1}function VC(e,t){for(let i of e)if(!OC(i.charCodeAt(0),t))return!1;return!0}var jC=class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(jn.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let i=e.pluginURL,r=new Promise(a=>{this.loadScriptResolve=a});t(i);let n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(await Promise.race([r,n]),this.isParsed()){let a={pluginStatus:"loaded",pluginURL:i};return this.setState(a),a}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error("RTL Text Plugin failed to import scripts from ".concat(i))}},jn=new jC,et=class{constructor(e,t){this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new zh,this.transition=t.transition||{},this.globalState=t.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new zh,this.transition={},this.globalState={})}isSupportedScript(e){return VC(e,jn.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}},Pl=class{constructor(e,t){this.property=e,this.value=t,this.expression=aC(t===void 0?e.specification.default:t,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}},Fh=class{constructor(e){this.property=e,this.value=new Pl(e,void 0)}transitioned(e,t){return new bf(this.property,this.value,t,H({},e.transition,this.transition),e.now)}untransitioned(){return new bf(this.property,this.value,null,{},0)}},Tl=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return At(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Fh(this._values[e].property)),this._values[e].value=new Pl(this._values[e].property,t===null?void 0:At(t))}getTransition(e){return At(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Fh(this._values[e].property)),this._values[e].transition=At(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);i!==void 0&&(e[t]=i);let r=this.getTransition(t);r!==void 0&&(e["".concat(t,"-transition")]=r)}return e}transitioned(e,t){let i=new wf(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){let e=new wf(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},bf=class{constructor(e,t,i,r,n){this.property=e,this.value=t,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){let r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),a=this.prior;if(a){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return a.possiblyEvaluate(e,t,i);{let o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,i),n,ag(o))}}else return n}},wf=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){let r=new Sl(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},GC=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return At(this._values[e].value)}setValue(e,t){this._values[e]=new Pl(this._values[e].property,t===null?void 0:At(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);i!==void 0&&(e[t]=i)}return e}possiblyEvaluate(e,t,i){let r=new Sl(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}},ui=class{constructor(e,t,i){this.property=e,this.value=t,this.parameters=i}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,t,i,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r)}},Sl=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},Z=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,i){let r=this.specification.type,n=Ue[r];return n?n(e,t,i):e}},ee=class{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r){return e.expression.kind==="constant"||e.expression.kind==="camera"?new ui(this,{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)},t):new ui(this,e.expression,t)}interpolate(e,t,i){if(e.value.kind!=="constant"||t.value.kind!=="constant")return e;if(e.value.value===void 0||t.value.value===void 0)return new ui(this,{kind:"constant",value:void 0},e.parameters);let r=this.specification.type,n=Ue[r];if(n){let a=n(e.value.value,t.value.value,i);return new ui(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,t,i,r,n,a){return e.kind==="constant"?e.value:e.evaluate(t,i,r,n,a)}},Ml=class extends ee{possiblyEvaluate(e,t,i,r){if(e.value===void 0)return new ui(this,{kind:"constant",value:void 0},t);if(e.expression.kind==="constant"){let n=e.expression.evaluate(t,null,{},i,r),a=e.property.specification.type==="resolvedImage"&&typeof n!="string"?n.name:n,o=this._calculate(a,a,a,t);return new ui(this,{kind:"constant",value:o},t)}else if(e.expression.kind==="camera"){let n=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new ui(this,{kind:"constant",value:n},t)}else return new ui(this,e.expression,t)}evaluate(e,t,i,r,n,a){if(e.kind==="source"){let o=e.evaluate(t,i,r,n,a);return this._calculate(o,o,o,t)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,r),e.evaluate({zoom:Math.floor(t.zoom)},i,r),e.evaluate({zoom:Math.floor(t.zoom)+1},i,r),t):e.value}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}},$c=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){if(e.value!==void 0)if(e.expression.kind==="constant"){let n=e.expression.evaluate(t,null,{},i,r);return this._calculate(n,n,n,t)}else return this._calculate(e.expression.evaluate(new et(Math.floor(t.zoom-1),t)),e.expression.evaluate(new et(Math.floor(t.zoom),t)),e.expression.evaluate(new et(Math.floor(t.zoom+1),t)),t)}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}},Cl=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}},ft=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let i=e[t];i.specification.overridable&&this.overridableProperties.push(t);let r=this.defaultPropertyValues[t]=new Pl(i,void 0),n=this.defaultTransitionablePropertyValues[t]=new Fh(i);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}};W("DataDrivenProperty",ee);W("DataConstantProperty",Z);W("CrossFadedDataDrivenProperty",Ml);W("CrossFadedProperty",$c);W("ColorRampProperty",Cl);var ts="-transition",mi=class extends Et{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Ka(e.filter)),t.layout&&(this._unevaluatedLayout=new GC(t.layout)),t.paint)){this._transitionablePaint=new Tl(t.paint);for(let i in e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(let i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Sl(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=Ka(e)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let i=this._unevaluatedLayout._values[t];for(let r of i.getGlobalStateRefs())e.add(r)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}setLayoutProperty(e,t,i={}){if(t!=null){let r="layers.".concat(this.id,".layout.").concat(e);if(this._validate(AC,r,e,t,i))return}if(e==="visibility"){this.visibility=t;return}this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){return e.endsWith(ts)?this._transitionablePaint.getTransition(e.slice(0,-ts.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(t!=null){let r="layers.".concat(this.id,".paint.").concat(e);if(this._validate(IC,r,e,t,i))return!1}if(e.endsWith(ts))return this._transitionablePaint.setTransition(e.slice(0,-ts.length),t||void 0),!1;{let r=this._transitionablePaint._values[e],n=r.property.specification["property-type"]==="cross-faded-data-driven",a=r.value.isDataDriven(),o=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let s=this._transitionablePaint._values[e].value;return s.isDataDriven()||a||n||this._handleOverridablePaintPropertyUpdate(e,o,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),sg(e,(t,i)=>t!==void 0&&!(i==="layout"&&!Object.keys(t).length)&&!(i==="paint"&&!Object.keys(t).length))}_validate(e,t,i,r,n={}){return n&&n.validate===!1?!1:wl(this,e.call(rt,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:B,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(!(!(t instanceof ui)||!Nn(t.property.specification))&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}return!1}},UC={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},mo=class{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},XC=128,$C=5,Ze=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*$C),XC),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function We(e,t=1){let i=0,r=0,n=e.map(o=>{let s=qC(o.type),l=i=Pf(i,Math.max(t,s)),u=o.components||1;return r=Math.max(r,s),i+=s*u,{name:o.name,type:o.type,components:u,offset:l}}),a=Pf(i,Math.max(r,t));return{members:n,size:a,alignment:t}}function qC(e){return UC[e].BYTES_PER_ELEMENT}function Pf(e,t){return Math.ceil(e/t)*t}var YC=ne(le(),1),yo=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=e*2;return this.int16[r+0]=t,this.int16[r+1]=i,e}};yo.prototype.bytesPerElement=4;W("StructArrayLayout2i4",yo);var Il=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*3;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}};Il.prototype.bytesPerElement=6;W("StructArrayLayout3i6",Il);var qc=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){let a=e*4;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,e}};qc.prototype.bytesPerElement=8;W("StructArrayLayout4i8",qc);var Yc=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*6;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,e}};Yc.prototype.bytesPerElement=12;W("StructArrayLayout2i4i12",Yc);var Zc=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*4,l=e*8;return this.int16[s+0]=t,this.int16[s+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=o,e}};Zc.prototype.bytesPerElement=8;W("StructArrayLayout2i4ub8",Zc);var Qa=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=e*2;return this.float32[r+0]=t,this.float32[r+1]=i,e}};Qa.prototype.bytesPerElement=8;W("StructArrayLayout2f8",Qa);var Wc=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,e,t,i,r,n,a,o,s,l,u)}emplace(e,t,i,r,n,a,o,s,l,u,h){let c=e*10;return this.uint16[c+0]=t,this.uint16[c+1]=i,this.uint16[c+2]=r,this.uint16[c+3]=n,this.uint16[c+4]=a,this.uint16[c+5]=o,this.uint16[c+6]=s,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,e}};Wc.prototype.bytesPerElement=20;W("StructArrayLayout10ui20",Wc);var Hc=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u,h,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,r,n,a,o,s,l,u,h,c)}emplace(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=e*12;return this.int16[d+0]=t,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,e}};Hc.prototype.bytesPerElement=24;W("StructArrayLayout4i4ui4i24",Hc);var Kc=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*3;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}};Kc.prototype.bytesPerElement=12;W("StructArrayLayout3f12",Kc);var Jc=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.uint32[i+0]=t,e}};Jc.prototype.bytesPerElement=4;W("StructArrayLayout1ul4",Jc);var Qc=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,n,a,o,s,l)}emplace(e,t,i,r,n,a,o,s,l,u){let h=e*10,c=e*5;return this.int16[h+0]=t,this.int16[h+1]=i,this.int16[h+2]=r,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=o,this.uint32[c+3]=s,this.uint16[h+8]=l,this.uint16[h+9]=u,e}};Qc.prototype.bytesPerElement=20;W("StructArrayLayout6i1ul2ui20",Qc);var ep=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*6;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,e}};ep.prototype.bytesPerElement=12;W("StructArrayLayout2i2i2i12",ep);var tp=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n)}emplace(e,t,i,r,n,a){let o=e*4,s=e*8;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.int16[s+6]=n,this.int16[s+7]=a,e}};tp.prototype.bytesPerElement=16;W("StructArrayLayout2f1f2i16",tp);var ip=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*16,l=e*4,u=e*8;return this.uint8[s+0]=t,this.uint8[s+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=o,e}};ip.prototype.bytesPerElement=16;W("StructArrayLayout2ub2f2i16",ip);var Al=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*3;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}};Al.prototype.bytesPerElement=6;W("StructArrayLayout3ui6",Al);var rp=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g)}emplace(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_){let b=e*24,v=e*12,w=e*48;return this.int16[b+0]=t,this.int16[b+1]=i,this.uint16[b+2]=r,this.uint16[b+3]=n,this.uint32[v+2]=a,this.uint32[v+3]=o,this.uint32[v+4]=s,this.uint16[b+10]=l,this.uint16[b+11]=u,this.uint16[b+12]=h,this.float32[v+7]=c,this.float32[v+8]=p,this.uint8[w+36]=d,this.uint8[w+37]=f,this.uint8[w+38]=y,this.uint32[v+10]=g,this.int16[b+22]=_,e}};rp.prototype.bytesPerElement=48;W("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",rp);var np=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v,w,P,T,C,A,k,z,L){let E=this.length;return this.resize(E+1),this.emplace(E,e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v,w,P,T,C,A,k,z,L)}emplace(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v,w,P,T,C,A,k,z,L,E){let D=e*32,x=e*16;return this.int16[D+0]=t,this.int16[D+1]=i,this.int16[D+2]=r,this.int16[D+3]=n,this.int16[D+4]=a,this.int16[D+5]=o,this.int16[D+6]=s,this.int16[D+7]=l,this.uint16[D+8]=u,this.uint16[D+9]=h,this.uint16[D+10]=c,this.uint16[D+11]=p,this.uint16[D+12]=d,this.uint16[D+13]=f,this.uint16[D+14]=y,this.uint16[D+15]=g,this.uint16[D+16]=_,this.uint16[D+17]=b,this.uint16[D+18]=v,this.uint16[D+19]=w,this.uint16[D+20]=P,this.uint16[D+21]=T,this.uint16[D+22]=C,this.uint32[x+12]=A,this.float32[x+13]=k,this.float32[x+14]=z,this.uint16[D+30]=L,this.uint16[D+31]=E,e}};np.prototype.bytesPerElement=64;W("StructArrayLayout8i15ui1ul2f2ui64",np);var El=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.float32[i+0]=t,e}};El.prototype.bytesPerElement=4;W("StructArrayLayout1f4",El);var ap=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*6,a=e*3;return this.uint16[n+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,e}};ap.prototype.bytesPerElement=12;W("StructArrayLayout1ui2f12",ap);var op=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*2,a=e*4;return this.uint32[n+0]=t,this.uint16[a+2]=i,this.uint16[a+3]=r,e}};op.prototype.bytesPerElement=8;W("StructArrayLayout1ul2ui8",op);var sp=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=e*2;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}};sp.prototype.bytesPerElement=4;W("StructArrayLayout2ui4",sp);var lp=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.uint16[i+0]=t,e}};lp.prototype.bytesPerElement=2;W("StructArrayLayout1ui2",lp);var up=class extends Ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){let a=e*4;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.float32[a+3]=n,e}};up.prototype.bytesPerElement=16;W("StructArrayLayout4f16",up);var L_=class extends mo{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new YC.default(this.anchorPointX,this.anchorPointY)}};L_.prototype.size=20;var z_=class extends Qc{get(e){return new L_(this,e)}};W("CollisionBoxArray",z_);var F_=class extends mo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};F_.prototype.size=48;var B_=class extends rp{get(e){return new F_(this,e)}};W("PlacedSymbolArray",B_);var R_=class extends mo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};R_.prototype.size=64;var O_=class extends np{get(e){return new R_(this,e)}};W("SymbolInstanceArray",O_);var N_=class extends El{getoffsetX(e){return this.float32[e*1+0]}};W("GlyphOffsetArray",N_);var V_=class extends Il{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};W("SymbolLineVertexArray",V_);var j_=class extends mo{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};j_.prototype.size=12;var G_=class extends ap{get(e){return new j_(this,e)}};W("TextAnchorOffsetArray",G_);var U_=class extends mo{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};U_.prototype.size=8;var X_=class extends op{get(e){return new U_(this,e)}};W("FeatureIndexArray",X_);var qi=class extends yo{},ZC=class extends Il{},WC=class extends qc{},HC=class extends yo{},KC=class extends yo{},JC=class extends Yc{},QC=class extends Zc{},eI=class extends Qa{},yn=class extends Wc{},tI=class extends Hc{},iI=class extends Kc{},rI=class extends Jc{},Tf=class extends ep{},nI=class extends tp{},aI=class extends ip{},oI=class extends Al{},yi=class extends Al{},Bh=class extends sp{},sI=class extends lp{},lI=We([{name:"a_pos",components:2,type:"Int16"}],4),{members:uI,size:H8,alignment:K8}=lI,Be=class Tn{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,i,r,n){let a=this.segments[this.segments.length-1];return t>Tn.MAX_VERTEX_ARRAY_LENGTH&&nt("Max vertices per segment is ".concat(Tn.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t,". Consider using the `fillLargeMeshArrays` function if you require meshes with more than ").concat(Tn.MAX_VERTEX_ARRAY_LENGTH," vertices.")),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+t>Tn.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(i,r,n):a}createNewSegment(t,i,r){let n={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return r!==void 0&&(n.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(t,i,r){return this.prepareSegment(0,t,i,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let i in t.vaos)t.vaos[i].destroy()}static simpleSegment(t,i,r,n){return new Tn([{vertexOffset:t,primitiveOffset:i,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}};Be.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;W("SegmentVector",Be);function Sf(e,t){return e=Te(Math.floor(e),0,255),t=Te(Math.floor(t),0,255),256*e+t}var Zs=We([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),hI=ne(Km(),1),$_=class q_{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,i,r,n){this.ids.push(Mf(t)),this.positions.push(i,r,n)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let i=Mf(t),r=0,n=this.ids.length-1;for(;r<n;){let o=r+n>>1;this.ids[o]>=i?n=o:r=o+1}let a=[];for(;this.ids[r]===i;){let o=this.positions[3*r],s=this.positions[3*r+1],l=this.positions[3*r+2];a.push({index:o,start:s,end:l}),r++}return a}static serialize(t,i){let r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return Rh(r,n,0,r.length-1),i&&i.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){let i=new q_;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}};function Mf(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,hI.default)(String(e))}function Rh(e,t,i,r){for(;i<r;){let n=e[i+r>>1],a=i-1,o=r+1;for(;;){do a++;while(e[a]<n);do o--;while(e[o]>n);if(a>=o)break;is(e,a,o),is(t,3*a,3*o),is(t,3*a+1,3*o+1),is(t,3*a+2,3*o+2)}o-i<r-o?(Rh(e,t,i,o),i=o+1):(Rh(e,t,o+1,r),r=o)}}function is(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}W("FeaturePositionMap",$_);var Ji=class{constructor(e,t){this.gl=e.gl,this.location=t}},ae=class extends Ji{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},X=class extends Ji{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},ie=class extends Ji{constructor(e,t){super(e,t),this.current=[0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1])&&(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},Ot=class extends Ji{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2])&&(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},wr=class extends Ji{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}},Pr=class extends Ji{constructor(e,t){super(e,t),this.current=J.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}},Cf=class extends Ji{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e.length*4);for(let i=0;i<e.length;i++)t[4*i]=e[i].r,t[4*i+1]=e[i].g,t[4*i+2]=e[i].b,t[4*i+3]=e[i].a;this.gl.uniform4fv(this.location,t)}}},If=class extends Ji{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},cI=new Float32Array(16),Vt=class extends Ji{constructor(e,t){super(e,t),this.current=cI}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);return}for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};function Oh(e){return[Sf(255*e.r,255*e.g),Sf(255*e.b,255*e.a)]}var Da=class{constructor(e,t,i){this.value=e,this.uniformNames=t.map(r=>"u_".concat(r)),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return this.type==="color"?new Pr(e,t):new X(e,t)}},Sn=class{constructor(e,t){this.uniformNames=t.map(i=>"u_".concat(i)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,i,r){let n=r==="u_pattern_to"?this.patternTo:r==="u_pattern_from"?this.patternFrom:r==="u_pixel_ratio_to"?this.pixelRatioTo:r==="u_pixel_ratio_from"?this.pixelRatioFrom:null;n&&e.set(n)}getBinding(e,t,i){return i.substr(0,9)==="u_pattern"?new wr(e,t):new X(e,t)}},Gi=class{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(n=>({name:"a_".concat(n),type:"Float32",components:i==="color"?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(e,t,i,r,n){let a=this.paintVertexArray.length,o=this.expression.evaluate(new et(0),t,{},r,[],n);this.paintVertexArray.resize(e),this._setPaintValue(a,e,o)}updatePaintArray(e,t,i,r){let n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(e,t,n)}_setPaintValue(e,t,i){if(this.type==="color"){let r=Oh(i);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},si=class{constructor(e,t,i,r,n,a){this.expression=e,this.uniformNames=t.map(o=>"u_".concat(o,"_t")),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map(o=>({name:"a_".concat(o),type:"Float32",components:i==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,i,r,n){let a=this.expression.evaluate(new et(this.zoom),t,{},r,[],n),o=this.expression.evaluate(new et(this.zoom+1),t,{},r,[],n),s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(s,e,a,o)}updatePaintArray(e,t,i,r){let n=this.expression.evaluate({zoom:this.zoom},i,r),a=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(e,t,n,a)}_setPaintValue(e,t,i,r){if(this.type==="color"){let n=Oh(i),a=Oh(r);for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,n[0],n[1],a[0],a[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let i=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=Te(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,i){return new X(e,t)}},cr=class{constructor(e,t,i,r,n,a){this.expression=e,this.type=t,this.useIntegerZoom=i,this.zoom=r,this.layerId=a,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(e,t,i){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,r,n){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],n)}_setPaintValues(e,t,i,r){if(!r||!i)return;let{min:n,mid:a,max:o}=i,s=r[n],l=r[a],u=r[o];if(!(!s||!l||!u))for(let h=e;h<t;h++)this.zoomInPaintVertexArray.emplace(h,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(h,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Zs.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Zs.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Y_=class{constructor(e,t,i){this.binders={},this._buffers=[];let r=[];for(let n in e.paint._values){if(!i(n))continue;let a=e.paint.get(n);if(!(a instanceof ui)||!Nn(a.property.specification))continue;let o=pI(n,e.type),s=a.value,l=a.property.specification.type,u=a.property.useIntegerZoom,h=a.property.specification["property-type"],c=h==="cross-faded"||h==="cross-faded-data-driven";if(s.kind==="constant")this.binders[n]=c?new Sn(s.value,o):new Da(s.value,o,l),r.push("/u_".concat(n));else if(s.kind==="source"||c){let p=Af(n,l,"source");this.binders[n]=c?new cr(s,l,u,t,p,e.id):new Gi(s,o,l,p),r.push("/a_".concat(n))}else{let p=Af(n,l,"composite");this.binders[n]=new si(s,o,l,u,t,p),r.push("/z_".concat(n))}}this.cacheKey=r.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Gi||t instanceof si?t.maxValue:0}populatePaintArrays(e,t,i,r,n){for(let a in this.binders){let o=this.binders[a];(o instanceof Gi||o instanceof si||o instanceof cr)&&o.populatePaintArray(e,t,i,r,n)}}setConstantPatternPositions(e,t){for(let i in this.binders){let r=this.binders[i];r instanceof Sn&&r.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,i,r,n){let a=!1;for(let o in e){let s=t.getPositions(o);for(let l of s){let u=i.feature(l.index);for(let h in this.binders){let c=this.binders[h];if((c instanceof Gi||c instanceof si||c instanceof cr)&&c.expression.isStateDependent===!0){let p=r.paint.get(h);c.expression=p.value,c.updatePaintArray(l.start,l.end,u,e[o],n),a=!0}}}}return a}defines(){let e=[];for(let t in this.binders){let i=this.binders[t];(i instanceof Da||i instanceof Sn)&&e.push(...i.uniformNames.map(r=>"#define HAS_UNIFORM_".concat(r)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof Gi||i instanceof si)for(let r=0;r<i.paintVertexAttributes.length;r++)e.push(i.paintVertexAttributes[r].name);else if(i instanceof cr)for(let r=0;r<Zs.members.length;r++)e.push(Zs.members[r].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof Da||i instanceof Sn||i instanceof si)for(let r of i.uniformNames)e.push(r)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let i=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Da||n instanceof Sn||n instanceof si){for(let a of n.uniformNames)if(t[a]){let o=n.getBinding(e,t[a],a);i.push({name:a,property:r,binding:o})}}}return i}setUniforms(e,t,i,r){for(let{name:n,property:a,binding:o}of t)this.binders[a].setUniform(o,r,i.get(a),n)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let i=this.binders[t];if(e&&i instanceof cr){let r=e.fromScale===2?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(i instanceof Gi||i instanceof si)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let t in this.binders){let i=this.binders[t];(i instanceof Gi||i instanceof si||i instanceof cr)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Gi||t instanceof si||t instanceof cr)&&t.destroy()}}},Yr=class{constructor(e,t,i=()=>!0){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new Y_(r,t,i);this.needsUpload=!1,this._featureMap=new $_,this._bufferOffset=0}populatePaintArrays(e,t,i,r,n,a){for(let o in this.programConfigurations)this.programConfigurations[o].populatePaintArrays(e,t,r,n,a);t.id!==void 0&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r){for(let n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(e,this._featureMap,t,n,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function pI(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}function dI(e){return{"line-pattern":{source:yn,composite:yn},"fill-pattern":{source:yn,composite:yn},"fill-extrusion-pattern":{source:yn,composite:yn}}[e]}function Af(e,t,i){let r={color:{source:Qa,composite:up},number:{source:El,composite:Qa}},n=dI(e);return n&&n[i]||r[t][i]}W("ConstantBinder",Da);W("CrossFadedConstantBinder",Sn);W("SourceExpressionBinder",Gi);W("CrossFadedCompositeBinder",cr);W("CompositeExpressionBinder",si);W("ProgramConfiguration",Y_,{omit:["_buffers"]});W("ProgramConfigurationSet",Yr);var fI=15,Nh=Math.pow(2,fI-1)-1,Ef=-Nh-1;function en(e){let t=8192/e.extent,i=e.loadGeometry();for(let r=0;r<i.length;r++){let n=i[r];for(let a=0;a<n.length;a++){let o=n[a],s=Math.round(o.x*t),l=Math.round(o.y*t);o.x=Te(s,Ef,Nh),o.y=Te(l,Ef,Nh),(s<o.x||s>o.x+1||l<o.y||l>o.y+1)&&nt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function tn(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?en(e):[]}}var kf=-32768;function mI(e,t,i,r,n){e.emplaceBack(kf+t*8+r,kf+i*8+n)}var hp=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new HC,this.indexArray=new yi,this.segments=new Be,this.programConfigurations=new Yr(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){let r=this.layers[0],n=[],a=null,o=!1,s=r.type==="heatmap";if(r.type==="circle"){let u=r;a=u.layout.get("circle-sort-key"),o=!a.isConstant(),s=s||u.paint.get("circle-pitch-alignment")==="map"}let l=s?t.subdivisionGranularity.circle:1;for(let{feature:u,id:h,index:c,sourceLayerIndex:p}of e){let d=this.layers[0]._featureFilter.needGeometry,f=tn(u,d);if(!this.layers[0]._featureFilter.filter(new et(this.zoom,{globalState:this.globalState}),f,i))continue;let y=o?a.evaluate(f,{},i):void 0,g={id:h,properties:u.properties,type:u.type,sourceLayerIndex:p,index:c,geometry:d?f.geometry:en(u),patterns:{},sortKey:y};n.push(g)}o&&n.sort((u,h)=>u.sortKey-h.sortKey);for(let u of n){let{geometry:h,index:c,sourceLayerIndex:p}=u,d=e[c].feature;this.addFeature(u,h,c,i,l),t.featureIndex.insert(d,h,c,p,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uI),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,r,n=1){let a;switch(n){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw new Error("Invalid circle bucket granularity: ".concat(n,"; valid values are 1, 3, 5, 7."))}let o=a.length;for(let s of t)for(let l of s){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,e.sortKey),p=c.vertexLength;for(let d=0;d<o;d++)for(let f=0;f<o;f++)mI(this.layoutVertexArray,u,h,a[f],a[d]);for(let d=0;d<o-1;d++)for(let f=0;f<o-1;f++){let y=p+d*o+f,g=p+(d+1)*o+f;this.indexArray.emplaceBack(y,g+1,y+1),this.indexArray.emplaceBack(y,g,g+1)}c.vertexLength+=o*o,c.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r)}};W("CircleBucket",hp,{omit:["layers"]});var rs=ne(le(),1);function Z_(e,t){for(let i=0;i<e.length;i++)if(Gn(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(Gn(e,t[i]))return!0;return!!cp(e,t)}function yI(e,t,i){return!!(Gn(e,t)||Vh(t,e,i))}function W_(e,t){if(e.length===1)return Df(t,e[0]);for(let i=0;i<t.length;i++){let r=t[i];for(let n=0;n<r.length;n++)if(Gn(e,r[n]))return!0}for(let i=0;i<e.length;i++)if(Df(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(cp(e,t[i]))return!0;return!1}function gI(e,t,i){for(let r=0;r<t.length;r++){let n=t[r];if(e.length>=3){for(let a=0;a<n.length;a++)if(Gn(e,n[a]))return!0}if(_I(e,n,i))return!0}return!1}function _I(e,t,i){if(e.length>1){if(cp(e,t))return!0;for(let r=0;r<t.length;r++)if(Vh(t[r],e,i))return!0}for(let r=0;r<e.length;r++)if(Vh(e[r],t,i))return!0;return!1}function cp(e,t){if(e.length===0||t.length===0)return!1;for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1];for(let a=0;a<t.length-1;a++){let o=t[a],s=t[a+1];if(xI(r,n,o,s))return!0}}return!1}function xI(e,t,i,r){return gr(e,i,r)!==gr(t,i,r)&&gr(e,t,i)!==gr(e,t,r)}function Vh(e,t,i){let r=i*i;if(t.length===1)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++){let a=t[n-1],o=t[n];if(vI(e,a,o)<r)return!0}return!1}function vI(e,t,i){let r=t.distSqr(i);if(r===0)return e.distSqr(t);let n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return n<0?e.distSqr(t):n>1?e.distSqr(i):e.distSqr(i.sub(t)._mult(n)._add(t))}function Df(e,t){let i=!1,r,n,a;for(let o=0;o<e.length;o++){r=e[o];for(let s=0,l=r.length-1;s<r.length;l=s++)n=r[s],a=r[l],n.y>t.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(i=!i)}return i}function Gn(e,t){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){let a=e[r],o=e[n];a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(i=!i)}return i}function bI(e,t,i,r,n){for(let o of e)if(t<=o.x&&i<=o.y&&r>=o.x&&n>=o.y)return!0;let a=[new rs.default(t,i),new rs.default(t,n),new rs.default(r,n),new rs.default(r,i)];if(e.length>2){for(let o of a)if(Gn(e,o))return!0}for(let o=0;o<e.length-1;o++){let s=e[o],l=e[o+1];if(wI(s,l,a))return!0}return!1}function wI(e,t,i){let r=i[0],n=i[2];if(e.x<r.x&&t.x<r.x||e.x>n.x&&t.x>n.x||e.y<r.y&&t.y<r.y||e.y>n.y&&t.y>n.y)return!1;let a=gr(e,t,i[0]);return a!==gr(e,t,i[1])||a!==gr(e,t,i[2])||a!==gr(e,t,i[3])}var jh=ne(le(),1);function Va(e,t,i){let r=t.paint.get(e).value;return r.kind==="constant"?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function kl(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Dl(e,t,i,r,n){if(!t[0]&&!t[1])return e;let a=jh.default.convert(t)._mult(n);i==="viewport"&&a._rotate(-r);let o=[];for(let s=0;s<e.length;s++){let l=e[s];o.push(l.sub(a))}return o}function PI(e,t){let i=[];for(let r=0;r<e.length;r++){let n=e[r],a=[];for(let o=0;o<n.length;o++){let s=n[o-1],l=n[o],u=n[o+1],h=o===0?new jh.default(0,0):l.sub(s)._unit()._perp(),c=o===n.length-1?new jh.default(0,0):u.sub(l)._unit()._perp(),p=h._add(c)._unit(),d=p.x*c.x+p.y*c.y;d!==0&&p._mult(1/d),a.push(p._mult(t)._add(l))}i.push(a)}return i}var Lf,TI=()=>Lf=Lf||new ft({"circle-sort-key":new ee(B.layout_circle["circle-sort-key"])}),zf,SI=()=>zf=zf||new ft({"circle-radius":new ee(B.paint_circle["circle-radius"]),"circle-color":new ee(B.paint_circle["circle-color"]),"circle-blur":new ee(B.paint_circle["circle-blur"]),"circle-opacity":new ee(B.paint_circle["circle-opacity"]),"circle-translate":new Z(B.paint_circle["circle-translate"]),"circle-translate-anchor":new Z(B.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Z(B.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Z(B.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ee(B.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ee(B.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ee(B.paint_circle["circle-stroke-opacity"])}),MI={get paint(){return SI()},get layout(){return TI()}},CI=ne(le(),1),II=e=>e.type==="circle",AI=class extends mi{constructor(e){super(e,MI)}createBucket(e){return new hp(e)}queryRadius(e){let t=e;return Va("circle-radius",this,t)+Va("circle-stroke-width",this,t)+kl(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){let l=Dl(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,a),u=this.paint.get("circle-radius").evaluate(t,i),h=this.paint.get("circle-stroke-width").evaluate(t,i),c=u+h,p=this.paint.get("circle-pitch-alignment")==="map",d=p?l:EI(l,n,o,s),f=p?c*a:c;for(let y of r)for(let g of y){let _=p?g:H_(g,n,o,s),b=f,v=n.projectTileCoordinates(g.x,g.y,o,s).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=v/n.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=n.cameraToCenterDistance/v),yI(d,_,b))return!0}return!1}};function H_(e,t,i,r){let n=t.projectTileCoordinates(e.x,e.y,i,r).point;return new CI.default((n.x*.5+.5)*t.width,(-n.y*.5+.5)*t.height)}function EI(e,t,i,r){return e.map(n=>H_(n,t,i,r))}var K_=class extends hp{};W("HeatmapBucket",K_,{omit:["layers"]});var Ff,kI=()=>Ff=Ff||new ft({"heatmap-radius":new ee(B.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ee(B.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Z(B.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Cl(B.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Z(B.paint_heatmap["heatmap-opacity"])}),DI={get paint(){return kI()}};function pp(e,{width:t,height:i},r,n){if(!n)n=new Uint8Array(t*i*r);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError("mismatched image size. expected: ".concat(n.length," but got: ").concat(t*i*r));return e.width=t,e.height=i,e.data=n,e}function J_(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;let n=pp({},{width:t,height:i},r);dp(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,i)},r),e.width=t,e.height=i,e.data=n.data}function dp(e,t,i,r,n,a){if(n.width===0||n.height===0)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");let o=e.data,s=t.data;if(o===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){let u=((i.y+l)*e.width+i.x)*a,h=((r.y+l)*t.width+r.x)*a;for(let c=0;c<n.width*a;c++)s[h+c]=o[u+c]}return t}var fp=class Q_{constructor(t,i){pp(this,t,1,i)}resize(t){J_(this,t,1)}clone(){return new Q_({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,n,a){dp(t,i,r,n,a,1)}},Ne=class e0{constructor(t,i){pp(this,t,4,i)}resize(t){J_(this,t,4)}replace(t,i){i?this.data.set(t):t instanceof Uint8ClampedArray?this.data=new Uint8Array(t.buffer):this.data=t}clone(){return new e0({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,n,a){dp(t,i,r,n,a,4)}setPixel(t,i,r){let n=(t*this.width+i)*4;this.data[n+0]=Math.round(r.r*255/r.a),this.data[n+1]=Math.round(r.g*255/r.a),this.data[n+2]=Math.round(r.b*255/r.a),this.data[n+3]=Math.round(r.a*255)}};W("AlphaImage",fp);W("RGBAImage",Ne);function t0(e){let t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new Ne({width:i,height:r});if(!dT(i))throw new Error("width is not a power of 2 - ".concat(i));let a=(o,s,l)=>{t[e.evaluationKey]=l;let u=e.expression.evaluate(t);n.setPixel(o/4/i,s/4,u)};if(e.clips)for(let o=0,s=0;o<r;++o,s+=i*4)for(let l=0,u=0;l<i;l++,u+=4){let h=l/(i-1),{start:c,end:p}=e.clips[o],d=c*(1-h)+p*h;a(s,u,d)}else for(let o=0,s=0;o<i;o++,s+=4){let l=o/(i-1);a(0,s,l)}return n}var eo="big-fb",LI=e=>e.type==="heatmap",zI=class extends mi{createBucket(e){return new K_(e)}constructor(e){super(e,DI),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=t0({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(eo)&&this.heatmapFbos.delete(eo)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},Bf,FI=()=>Bf=Bf||new ft({"hillshade-illumination-direction":new Z(B.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Z(B.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Z(B.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Z(B.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Z(B.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Z(B.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Z(B.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Z(B.paint_hillshade["hillshade-method"])}),BI={get paint(){return FI()}},RI=e=>e.type==="hillshade",OI=class extends mi{constructor(e){super(e,BI),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,t=this.paint.get("hillshade-illumination-altitude").values,i=this.paint.get("hillshade-highlight-color").values,r=this.paint.get("hillshade-shadow-color").values,n=Math.max(e.length,t.length,i.length,r.length);e=e.concat(Array(n-e.length).fill(e.at(-1))),t=t.concat(Array(n-t.length).fill(t.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1)));let a=t.map(Fe);return{directionRadians:e.map(Fe),altitudeRadians:a,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},Rf,NI=()=>Rf=Rf||new ft({"color-relief-opacity":new Z(B["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Cl(B["paint_color-relief"]["color-relief-color"])}),VI={get paint(){return NI()}},Qe=class{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,r)}update(e,t,i){let{width:r,height:n}=e,a=(!this.size||this.size[0]!==r||this.size[1]!==n)&&!i,{context:o}=this,{gl:s}=o;if(this.useMipmap=!!(t&&t.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!t||t.premultiply!==!1)),a)this.size=[r,n],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Zi(e)?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,e):s.texImage2D(s.TEXTURE_2D,0,this.format,r,n,0,this.format,s.UNSIGNED_BYTE,e.data);else{let{x:l,y:u}=i||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Zi(e)?s.texSubImage2D(s.TEXTURE_2D,0,l,u,s.RGBA,s.UNSIGNED_BYTE,e):s.texSubImage2D(s.TEXTURE_2D,0,l,u,r,n,s.RGBA,s.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,i){let{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),i===n.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(i=n.LINEAR),e!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},jI=class{constructor(e,t,i,r=1,n=1,a=1,o=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){nt('"'.concat(i,'" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".'));return}this.stride=t.height;let s=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=r,this.greenFactor=n,this.blueFactor=a,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let l=0;l<s;l++)this.data[this._idx(-1,l)]=this.data[this._idx(0,l)],this.data[this._idx(s,l)]=this.data[this._idx(s-1,l)],this.data[this._idx(l,-1)]=this.data[this._idx(l,0)],this.data[this._idx(l,s)]=this.data[this._idx(l,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let l=0;l<s;l++)for(let u=0;u<s;u++){let h=this.get(l,u);h>this.max&&(this.max=h),h<this.min&&(this.min=h)}}get(e,t){let i=new Uint8Array(this.data.buffer),r=this._idx(e,t)*4;return this.unpack(i[r],i[r+1],i[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}unpack(e,t,i){return e*this.redFactor+t*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return i0(e,this.getUnpackVector())}getPixels(){return new Ne({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,a=i*this.dim,o=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1;break}switch(i){case-1:a=o-1;break;case 1:o=a+1;break}let s=-t*this.dim,l=-i*this.dim;for(let u=a;u<o;u++)for(let h=r;h<n;h++)this.data[this._idx(h,u)]=e.data[this._idx(h+s,u+l)]}};function i0(e,t){let i=t[0],r=t[1],n=t[2],a=t[3],o=Math.min(i,r,n),s=Math.round((e+a)/o);return{r:Math.floor(s*o/i)%256,g:Math.floor(s*o/r)%256,b:Math.floor(s*o/n)%256}}W("DEMData",jI);var GI=e=>e.type==="color-relief",UI=class extends mi{constructor(e){super(e,VI)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof Ha&&i._styleExpression.expression instanceof ci){this.colorRampExpression=i;let a=i._styleExpression.expression;t.elevationStops=a.labels,t.colorStops=[];for(let o of t.elevationStops)t.colorStops.push(a.evaluate({globals:{elevation:o}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[J.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let r={elevationStops:[],colorStops:[]},n=(t.elevationStops.length-1)/(e-1);for(let a=0;a<t.elevationStops.length-.5;a+=n)r.elevationStops.push(t.elevationStops[Math.round(a)]),r.colorStops.push(t.colorStops[Math.round(a)]);return nt("Too many colors in specification of ".concat(this.id," color-relief layer, may not render properly.")),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let r=this._createColorRamp(t),n=new Ne({width:r.colorStops.length,height:1}),a=new Ne({width:r.colorStops.length,height:1});for(let o=0;o<r.elevationStops.length;o++){let s=i0(r.elevationStops[o],i);a.setPixel(0,o,new J(s.r/255,s.g/255,s.b/255,1)),n.setPixel(0,o,r.colorStops[o])}return this.colorRampTextures={elevationTexture:new Qe(e,a,e.gl.RGBA),colorTexture:new Qe(e,n,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}},XI=We([{name:"a_pos",components:2,type:"Int16"}],4),{members:$I,size:J8,alignment:Q8}=XI;function mp(e,t,i){let r=i.patternDependencies,n=!1;for(let a of t){let o=a.paint.get("".concat(e,"-pattern"));o.isConstant()||(n=!0);let s=o.constantOr(null);s&&(n=!0,r[s.to]=!0,r[s.from]=!0)}return n}function yp(e,t,i,r,n){let a=n.patternDependencies;for(let o of t){let s=o.paint.get("".concat(e,"-pattern")).value;if(s.kind!=="constant"){let l=s.evaluate({zoom:r-1},i,{},n.availableImages),u=s.evaluate({zoom:r},i,{},n.availableImages),h=s.evaluate({zoom:r+1},i,{},n.availableImages);l=l&&l.name?l.name:l,u=u&&u.name?u.name:u,h=h&&h.name?h.name:h,a[l]=!0,a[u]=!0,a[h]=!0,i.patterns[o.id]={min:l,mid:u,max:h}}}return i}var ns=ne(le(),1);function qI(e,t,i=2){let r=t&&t.length,n=r?t[0]*i:e.length,a=r0(e,0,n,i,!0),o=[];if(!a||a.next===a.prev)return o;let s,l,u;if(r&&(a=KI(e,t,a,i)),e.length>80*i){s=e[0],l=e[1];let h=s,c=l;for(let p=i;p<n;p+=i){let d=e[p],f=e[p+1];d<s&&(s=d),f<l&&(l=f),d>h&&(h=d),f>c&&(c=f)}u=Math.max(h-s,c-l),u=u!==0?32767/u:0}return to(a,o,i,s,l,u,0),o}function r0(e,t,i,r,n){let a;if(n===lA(e,t,i,r)>0)for(let o=t;o<i;o+=r)a=Of(o/r|0,e[o],e[o+1],a);else for(let o=i-r;o>=t;o-=r)a=Of(o/r|0,e[o],e[o+1],a);return a&&Un(a,a.next)&&(ro(a),a=a.next),a}function Zr(e,t){if(!e)return e;t||(t=e);let i=e,r;do if(r=!1,!i.steiner&&(Un(i,i.next)||Ye(i.prev,i,i.next)===0)){if(ro(i),i=t=i.prev,i===i.next)break;r=!0}else i=i.next;while(r||i!==t);return t}function to(e,t,i,r,n,a,o){if(!e)return;!o&&a&&iA(e,r,n,a);let s=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?ZI(e,r,n,a):YI(e)){t.push(l.i,e.i,u.i),ro(e),e=u.next,s=u.next;continue}if(e=u,e===s){o?o===1?(e=WI(Zr(e),t),to(e,t,i,r,n,a,2)):o===2&&HI(e,t,i,r,n,a):to(Zr(e),t,i,r,n,a,1);break}}}function YI(e){let t=e.prev,i=e,r=e.next;if(Ye(t,i,r)>=0)return!1;let n=t.x,a=i.x,o=r.x,s=t.y,l=i.y,u=r.y,h=Math.min(n,a,o),c=Math.min(s,l,u),p=Math.max(n,a,o),d=Math.max(s,l,u),f=r.next;for(;f!==t;){if(f.x>=h&&f.x<=p&&f.y>=c&&f.y<=d&&La(n,s,a,l,o,u,f.x,f.y)&&Ye(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function ZI(e,t,i,r){let n=e.prev,a=e,o=e.next;if(Ye(n,a,o)>=0)return!1;let s=n.x,l=a.x,u=o.x,h=n.y,c=a.y,p=o.y,d=Math.min(s,l,u),f=Math.min(h,c,p),y=Math.max(s,l,u),g=Math.max(h,c,p),_=Gh(d,f,t,i,r),b=Gh(y,g,t,i,r),v=e.prevZ,w=e.nextZ;for(;v&&v.z>=_&&w&&w.z<=b;){if(v.x>=d&&v.x<=y&&v.y>=f&&v.y<=g&&v!==n&&v!==o&&La(s,h,l,c,u,p,v.x,v.y)&&Ye(v.prev,v,v.next)>=0||(v=v.prevZ,w.x>=d&&w.x<=y&&w.y>=f&&w.y<=g&&w!==n&&w!==o&&La(s,h,l,c,u,p,w.x,w.y)&&Ye(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;v&&v.z>=_;){if(v.x>=d&&v.x<=y&&v.y>=f&&v.y<=g&&v!==n&&v!==o&&La(s,h,l,c,u,p,v.x,v.y)&&Ye(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;w&&w.z<=b;){if(w.x>=d&&w.x<=y&&w.y>=f&&w.y<=g&&w!==n&&w!==o&&La(s,h,l,c,u,p,w.x,w.y)&&Ye(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function WI(e,t){let i=e;do{let r=i.prev,n=i.next.next;!Un(r,n)&&a0(r,i,i.next,n)&&io(r,n)&&io(n,r)&&(t.push(r.i,i.i,n.i),ro(i),ro(i.next),i=e=n),i=i.next}while(i!==e);return Zr(i)}function HI(e,t,i,r,n,a){let o=e;do{let s=o.next.next;for(;s!==o.prev;){if(o.i!==s.i&&aA(o,s)){let l=o0(o,s);o=Zr(o,o.next),l=Zr(l,l.next),to(o,t,i,r,n,a,0),to(l,t,i,r,n,a,0);return}s=s.next}o=o.next}while(o!==e)}function KI(e,t,i,r){let n=[];for(let a=0,o=t.length;a<o;a++){let s=t[a]*r,l=a<o-1?t[a+1]*r:e.length,u=r0(e,s,l,r,!1);u===u.next&&(u.steiner=!0),n.push(nA(u))}n.sort(JI);for(let a=0;a<n.length;a++)i=QI(n[a],i);return i}function JI(e,t){let i=e.x-t.x;if(i===0&&(i=e.y-t.y,i===0)){let r=(e.next.y-e.y)/(e.next.x-e.x),n=(t.next.y-t.y)/(t.next.x-t.x);i=r-n}return i}function QI(e,t){let i=eA(e,t);if(!i)return t;let r=o0(i,e);return Zr(r,r.next),Zr(i,i.next)}function eA(e,t){let i=t,r=e.x,n=e.y,a=-1/0,o;if(Un(e,i))return i;do{if(Un(e,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){let c=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(c<=r&&c>a&&(a=c,o=i.x<i.next.x?i:i.next,c===r))return o}i=i.next}while(i!==t);if(!o)return null;let s=o,l=o.x,u=o.y,h=1/0;i=o;do{if(r>=i.x&&i.x>=l&&r!==i.x&&n0(n<u?r:a,n,l,u,n<u?a:r,n,i.x,i.y)){let c=Math.abs(n-i.y)/(r-i.x);io(i,e)&&(c<h||c===h&&(i.x>o.x||i.x===o.x&&tA(o,i)))&&(o=i,h=c)}i=i.next}while(i!==s);return o}function tA(e,t){return Ye(e.prev,e,t.prev)<0&&Ye(t.next,e,e.next)<0}function iA(e,t,i,r){let n=e;do n.z===0&&(n.z=Gh(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,rA(n)}function rA(e){let t,i=1;do{let r=e,n;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let u=0;u<i&&(s++,o=o.nextZ,!!o);u++);let l=i;for(;s>0||l>0&&o;)s!==0&&(l===0||!o||r.z<=o.z)?(n=r,r=r.nextZ,s--):(n=o,o=o.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;r=o}a.nextZ=null,i*=2}while(t>1);return e}function Gh(e,t,i,r,n){return e=(e-i)*n|0,t=(t-r)*n|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function nA(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}function n0(e,t,i,r,n,a,o,s){return(n-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(i-o)*(t-s)&&(i-o)*(a-s)>=(n-o)*(r-s)}function La(e,t,i,r,n,a,o,s){return!(e===o&&t===s)&&n0(e,t,i,r,n,a,o,s)}function aA(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!oA(e,t)&&(io(e,t)&&io(t,e)&&sA(e,t)&&(Ye(e.prev,e,t.prev)||Ye(e,t.prev,t))||Un(e,t)&&Ye(e.prev,e,e.next)>0&&Ye(t.prev,t,t.next)>0)}function Ye(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Un(e,t){return e.x===t.x&&e.y===t.y}function a0(e,t,i,r){let n=os(Ye(e,t,i)),a=os(Ye(e,t,r)),o=os(Ye(i,r,e)),s=os(Ye(i,r,t));return!!(n!==a&&o!==s||n===0&&as(e,i,t)||a===0&&as(e,r,t)||o===0&&as(i,e,r)||s===0&&as(i,t,r))}function as(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function os(e){return e>0?1:e<0?-1:0}function oA(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&a0(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}function io(e,t){return Ye(e.prev,e,e.next)<0?Ye(e,t,e.next)>=0&&Ye(e,e.prev,t)>=0:Ye(e,t,e.prev)<0||Ye(e,e.next,t)<0}function sA(e,t){let i=e,r=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==e);return r}function o0(e,t){let i=Uh(e.i,e.x,e.y),r=Uh(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function Of(e,t,i,r){let n=Uh(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function ro(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Uh(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function lA(e,t,i,r){let n=0;for(let a=t,o=i-r;a<i;a+=r)n+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return n}var Yi=class{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){let t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}},Xh=class{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}};Xh.noSubdivision=new Xh({fill:new Yi(0,0),line:new Yi(0,0),tile:new Yi(0,0),stencil:new Yi(0,0),circle:1});var gp=Xh;W("SubdivisionGranularityExpression",Yi);W("SubdivisionGranularitySetting",gp);var mr=-32768,Nr=32767,uA=class{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=8192/e,this._canonical=t}_getKey(e,t){return e=e+32768,t=t+32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let i=Math.round(e)|0,r=Math.round(t)|0,n=this._getKey(i,r);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,a),this._vertexBuffer.push(i,r),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return cA(this._vertexBuffer,e);let t=[],i=e.length;for(let r=0;r<i;r+=3){let n=[e[r+0],e[r+1],e[r+2]],a=[this._vertexBuffer[e[r+0]*2+0],this._vertexBuffer[e[r+0]*2+1],this._vertexBuffer[e[r+1]*2+0],this._vertexBuffer[e[r+1]*2+1],this._vertexBuffer[e[r+2]*2+0],this._vertexBuffer[e[r+2]*2+1]],o=1/0,s=1/0,l=-1/0,u=-1/0;for(let f=0;f<3;f++){let y=a[f*2],g=a[f*2+1];o=Math.min(o,y),l=Math.max(l,y),s=Math.min(s,g),u=Math.max(u,g)}if(o===l||s===u)continue;let h=Math.floor(o/this._granularityCellSize),c=Math.ceil(l/this._granularityCellSize),p=Math.floor(s/this._granularityCellSize),d=Math.ceil(u/this._granularityCellSize);if(h===c&&p===d){t.push(...n);continue}for(let f=p;f<d;f++){let y=this._scanlineGenerateVertexRingForCellRow(f,a,n);pA(this._vertexBuffer,y,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,i){let r=e*this._granularityCellSize,n=r+this._granularityCellSize,a=[];for(let o=0;o<3;o++){let s=t[o*2],l=t[o*2+1],u=t[(o+1)*2%6],h=t[((o+1)*2+1)%6],c=t[(o+2)*2%6],p=t[((o+2)*2+1)%6],d=u-s,f=h-l,y=d===0,g=f===0,_=(r-l)/f,b=(n-l)/f,v=Math.min(_,b),w=Math.max(_,b);if(!g&&(v>=1||w<=0)||g&&(l<r||l>n)){h>=r&&h<=n&&a.push(i[(o+1)%3]);continue}if(!g&&v>0){let C=s+d*v,A=l+f*v;a.push(this._vertexToIndex(C,A))}let P=s+d*Math.max(v,0),T=s+d*Math.min(w,1);if(y||this._generateIntraEdgeVertices(a,s,l,u,h,P,T),!g&&w<1){let C=s+d*w,A=l+f*w;a.push(this._vertexToIndex(C,A))}(g||h>=r&&h<=n)&&a.push(i[(o+1)%3]),!g&&(h<=r||h>=n)&&this._generateInterEdgeVertices(a,s,l,u,h,c,p,T,r,n)}return a}_generateIntraEdgeVertices(e,t,i,r,n,a,o){let s=r-t,l=n-i,u=l===0,h=u?Math.min(t,r):Math.min(a,o),c=u?Math.max(t,r):Math.max(a,o),p=Math.floor(h/this._granularityCellSize)+1,d=Math.ceil(c/this._granularityCellSize)-1;if(u?t<r:a<o)for(let f=p;f<=d;f++){let y=f*this._granularityCellSize,g=i+l*(y-t)/s;e.push(this._vertexToIndex(y,g))}else for(let f=d;f>=p;f--){let y=f*this._granularityCellSize,g=i+l*(y-t)/s;e.push(this._vertexToIndex(y,g))}}_generateInterEdgeVertices(e,t,i,r,n,a,o,s,l,u){let h=n-i,c=a-r,p=o-n,d=(l-n)/p,f=(u-n)/p,y=Math.min(d,f),g=Math.max(d,f),_=r+c*y,b=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,w=s<_,P=p===0;if(P&&(o===l||o===u))return;if(P||y>=1||g<=0){let C=t-a,A=i-o,k=(l-o)/A,z=(u-o)/A,L=Math.min(k,z),E=a+C*L;b=Math.floor(Math.min(E,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(E,s)/this._granularityCellSize)-1,w=s<E}let T=h>0?u:l;if(w)for(let C=b;C<=v;C++){let A=C*this._granularityCellSize;e.push(this._vertexToIndex(A,T))}else for(let C=v;C>=b;C--){let A=C*this._granularityCellSize;e.push(this._vertexToIndex(A,T))}}_generateOutline(e){let t=[];for(let i of e){let r=_p(i,this._granularity,!0),n=this._pointArrayToIndices(r),a=[];for(let o=1;o<n.length;o++)a.push(n[o-1]),a.push(n[o]);t.push(a)}return t}_handlePoles(e){let t=!1,i=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(t||i)&&this._fillPoles(e,t,i)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let i=e[t+1];i===mr&&(e[t+1]=mr+1),i===Nr&&(e[t+1]=Nr-1)}}_generatePoleQuad(e,t,i,r,n,a){r>n!=(a===mr)?(e.push(t),e.push(i),e.push(this._vertexToIndex(r,a)),e.push(i),e.push(this._vertexToIndex(n,a)),e.push(this._vertexToIndex(r,a))):(e.push(i),e.push(t),e.push(this._vertexToIndex(r,a)),e.push(this._vertexToIndex(n,a)),e.push(i),e.push(this._vertexToIndex(r,a)))}_fillPoles(e,t,i){let r=this._vertexBuffer,n=0,a=8192,o=e.length;for(let s=2;s<o;s+=3){let l=e[s-2],u=e[s-1],h=e[s],c=r[l*2],p=r[l*2+1],d=r[u*2],f=r[u*2+1],y=r[h*2],g=r[h*2+1];t&&(p===n&&f===n&&this._generatePoleQuad(e,l,u,c,d,mr),f===n&&g===n&&this._generatePoleQuad(e,u,h,d,y,mr),g===n&&p===n&&this._generatePoleQuad(e,h,l,y,c,mr)),i&&(p===a&&f===a&&this._generatePoleQuad(e,l,u,c,d,Nr),f===a&&g===a&&this._generatePoleQuad(e,u,h,d,y,Nr),g===a&&p===a&&this._generatePoleQuad(e,h,l,y,c,Nr))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:i,holeIndices:r}=hA(e);this._initializeVertices(i);let n;try{let o=qI(i,r),s=this._convertIndices(i,o);n=this._subdivideTrianglesScanline(s)}catch(o){console.error(o)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:a}}_convertIndices(e,t){let i=[];for(let r=0;r<t.length;r++){let n=e[t[r]*2],a=e[t[r]*2+1];i.push(this._vertexToIndex(n,a))}return i}_pointArrayToIndices(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i];t.push(this._vertexToIndex(r.x,r.y))}return t}};function s0(e,t,i,r=!0){return new uA(i,t).subdividePolygonInternal(e,r)}function _p(e,t,i=!1){if(!e||e.length<1)return[];if(e.length<2)return[];let r=e[0],n=e[e.length-1],a=i&&(r.x!==n.x||r.y!==n.y);if(t<2)return a?[...e,e[0]]:[...e];let o=Math.floor(8192/t),s=[];s.push(new ns.default(e[0].x,e[0].y));let l=e.length,u=a?l:l-1;for(let h=0;h<u;h++){let c=e[h],p=h<l-1?e[h+1]:e[0],d=c.x,f=c.y,y=p.x,g=p.y,_=d!==y,b=f!==g;if(!_&&!b)continue;let v=y-d,w=g-f,P=Math.abs(v),T=Math.abs(w),C=d,A=f;for(;;){let z=v>0?(Math.floor(C/o)+1)*o:(Math.ceil(C/o)-1)*o,L=w>0?(Math.floor(A/o)+1)*o:(Math.ceil(A/o)-1)*o,E=Math.abs(C-z),D=Math.abs(A-L),x=Math.abs(C-y),M=Math.abs(A-g),I=_?E/P:Number.POSITIVE_INFINITY,R=b?D/T:Number.POSITIVE_INFINITY;if((x<=E||!_)&&(M<=D||!b))break;if(I<R&&_||!b){C=z,A=A+w*I;let N=new ns.default(C,Math.round(A));(s[s.length-1].x!==N.x||s[s.length-1].y!==N.y)&&s.push(N)}else{C=C+v*R,A=L;let N=new ns.default(Math.round(C),A);(s[s.length-1].x!==N.x||s[s.length-1].y!==N.y)&&s.push(N)}}let k=new ns.default(y,g);(s[s.length-1].x!==k.x||s[s.length-1].y!==k.y)&&s.push(k)}return s}function hA(e){let t=[],i=[];for(let r of e)if(r.length!==0){r!==e[0]&&t.push(i.length/2);for(let n=0;n<r.length;n++)i.push(r[n].x),i.push(r[n].y)}return{flattened:i,holeIndices:t}}function cA(e,t){let i=[];for(let r=0;r<t.length;r+=3){let n=t[r],a=t[r+1],o=t[r+2],s=e[n*2],l=e[n*2+1],u=e[a*2],h=e[a*2+1],c=e[o*2],p=e[o*2+1],d=u-s,f=h-l,y=c-s,g=p-l;d*g-f*y>0?(i.push(n),i.push(o),i.push(a)):(i.push(n),i.push(a),i.push(o))}return i}function pA(e,t,i){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let r=0,n=e[t[0]*2];for(let l=1;l<t.length;l++){let u=e[t[l]*2];u<n&&(n=u,r=l)}let a=t.length,o=r,s=(o+1)%a;for(;;){let l=o-1>=0?o-1:a-1,u=(s+1)%a,h=e[t[l]*2],c=e[t[l]*2+1],p=e[t[u]*2],d=e[t[u]*2+1],f=e[t[o]*2],y=e[t[o]*2+1],g=e[t[s]*2],_=e[t[s]*2+1],b=!1;if(h<p)b=!0;else if(h>p)b=!1;else{let v=g-f,w=_-y,P=-v,T=y<_?1:-1,C=((h-f)*w+(c-y)*P)*T,A=((p-f)*w+(d-y)*P)*T;C>A&&(b=!0)}if(b){let v=t[l],w=t[o],P=t[s];v!==w&&v!==P&&w!==P&&i.push(P,w,v),o--,o<0&&(o=a-1)}else{let v=t[u],w=t[o],P=t[s];v!==w&&v!==P&&w!==P&&i.push(P,w,v),s++,s>=a&&(s=0)}if(l===u)break}}function l0(e,t,i,r,n,a,o,s,l){let u=n.length/2,h=o&&s&&l;if(u<Be.MAX_VERTEX_ARRAY_LENGTH){let c=t.prepareSegment(u,i,r),p=c.vertexLength;for(let y=0;y<a.length;y+=3)r.emplaceBack(p+a[y],p+a[y+1],p+a[y+2]);c.vertexLength+=u,c.primitiveLength+=a.length/3;let d,f;h&&(f=o.prepareSegment(u,i,s),d=f.vertexLength,f.vertexLength+=u);for(let y=0;y<n.length;y+=2)e(n[y],n[y+1]);if(h)for(let y=0;y<l.length;y++){let g=l[y];for(let _=1;_<g.length;_+=2)s.emplaceBack(d+g[_-1],d+g[_]);f.primitiveLength+=g.length/2}}else dA(t,i,r,n,a,e),h&&fA(o,i,s,n,l,e),t.forceNewSegmentOnNextPrepare(),o==null||o.forceNewSegmentOnNextPrepare()}function ja(e,t,i,r,n,a,o){if(a){let s=r.count;return i(t[n*2],t[n*2+1]),e[n]=r.count,r.count++,o.vertexLength++,s}else return e[n]}function dA(e,t,i,r,n,a){let o=[];for(let c=0;c<r.length/2;c++)o.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,i),h=u.vertexLength;for(let c=2;c<n.length;c+=3){let p=n[c-2],d=n[c-1],f=n[c],y=o[p]<l,g=o[d]<l,_=o[f]<l,b=(y?1:0)+(g?1:0)+(_?1:0);u.vertexLength+b>Be.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=s.count,y=!0,g=!0,_=!0,h=0);let v=ja(o,r,a,s,p,y,u),w=ja(o,r,a,s,d,g,u),P=ja(o,r,a,s,f,_,u);i.emplaceBack(h+v-l,h+w-l,h+P-l),u.primitiveLength++}}function fA(e,t,i,r,n,a){let o=[];for(let c=0;c<r.length/2;c++)o.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,i),h=u.vertexLength;for(let c=0;c<n.length;c++){let p=n[c];for(let d=1;d<n[c].length;d+=2){let f=p[d-1],y=p[d],g=o[f]<l,_=o[y]<l,b=(g?1:0)+(_?1:0);u.vertexLength+b>Be.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=s.count,g=!0,_=!0,h=0);let v=ja(o,r,a,s,f,g,u),w=ja(o,r,a,s,y,_,u);i.emplaceBack(h+v-l,h+w-l),u.primitiveLength++}}}var mA=500,u0=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new KC,this.indexArray=new yi,this.indexArray2=new Bh,this.programConfigurations=new Yr(e.layers,e.zoom),this.segments=new Be,this.segments2=new Be,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=mp("fill",this.layers,t);let r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),a=[];for(let{feature:o,id:s,index:l,sourceLayerIndex:u}of e){let h=this.layers[0]._featureFilter.needGeometry,c=tn(o,h);if(!this.layers[0]._featureFilter.filter(new et(this.zoom,{globalState:this.globalState}),c,i))continue;let p=n?r.evaluate(c,{},i,t.availableImages):void 0,d={id:s,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:h?c.geometry:en(o),patterns:{},sortKey:p};a.push(d)}n&&a.sort((o,s)=>o.sortKey-s.sortKey);for(let o of a){let{geometry:s,index:l,sourceLayerIndex:u}=o;if(this.hasPattern){let c=yp("fill",this.layers,o,this.zoom,t);this.patternFeatures.push(c)}else this.addFeature(o,s,l,i,{},t.subdivisionGranularity);let h=e[l].feature;t.featureIndex.insert(h,s,l,u,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,$I),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,i,r,n,a){for(let o of kc(t,mA)){let s=s0(o,r,a.fill.getGranularityForZoomLevel(r.z)),l=this.layoutVertexArray;l0((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,s.verticesFlattened,s.indicesTriangles,this.segments2,this.indexArray2,s.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}};W("FillBucket",u0,{omit:["layers","patternFeatures"]});var Nf,yA=()=>Nf=Nf||new ft({"fill-sort-key":new ee(B.layout_fill["fill-sort-key"])}),Vf,gA=()=>Vf=Vf||new ft({"fill-antialias":new Z(B.paint_fill["fill-antialias"]),"fill-opacity":new ee(B.paint_fill["fill-opacity"]),"fill-color":new ee(B.paint_fill["fill-color"]),"fill-outline-color":new ee(B.paint_fill["fill-outline-color"]),"fill-translate":new Z(B.paint_fill["fill-translate"]),"fill-translate-anchor":new Z(B.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ml(B.paint_fill["fill-pattern"])}),_A={get paint(){return gA()},get layout(){return yA()}},xA=e=>e.type==="fill",vA=class extends mi{constructor(e){super(e,_A)}recalculate(e,t){super.recalculate(e,t);let i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new u0(e)}queryRadius(){return kl(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:r}){let n=Dl(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r);return W_(n,t)}isTileClipped(){return!0}},bA=We([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),wA=We([{name:"a_centroid",components:2,type:"Int16"}],4),{members:PA,size:tV,alignment:iV}=bA,TA=ne(rl(),1),SA=TA.default.VectorTileFeature.types,MA=500,Xu=Math.pow(2,13);function ma(e,t,i,r,n,a,o,s){e.emplaceBack(t,i,Math.floor(r*Xu)*2+o,n*Xu*2,a*Xu*2,Math.round(s))}var h0=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new JC,this.centroidVertexArray=new qi,this.indexArray=new yi,this.programConfigurations=new Yr(e.layers,e.zoom),this.segments=new Be,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.features=[],this.hasPattern=mp("fill-extrusion",this.layers,t);for(let{feature:r,id:n,index:a,sourceLayerIndex:o}of e){let s=this.layers[0]._featureFilter.needGeometry,l=tn(r,s);if(!this.layers[0]._featureFilter.filter(new et(this.zoom,{globalState:this.globalState}),l,i))continue;let u={id:n,sourceLayerIndex:o,index:a,geometry:s?l.geometry:en(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(yp("fill-extrusion",this.layers,u,this.zoom,t)):this.addFeature(u,u.geometry,a,i,{},t.subdivisionGranularity),t.featureIndex.insert(r,u.geometry,a,o,this.index,!0)}}addFeatures(e,t,i){for(let r of this.features){let{geometry:n}=r;this.addFeature(r,n,r.index,t,i,e.subdivisionGranularity)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,PA),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,wA.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,i,r,n,a){for(let o of kc(t,MA)){let s={x:0,y:0,sampleCount:0},l=this.layoutVertexArray.length;this.processPolygon(s,r,e,o,a);let u=this.layoutVertexArray.length-l,h=Math.floor(s.x/s.sampleCount),c=Math.floor(s.y/s.sampleCount);for(let p=0;p<u;p++)this.centroidVertexArray.emplaceBack(h,c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}processPolygon(e,t,i,r,n){if(r.length<1||jf(r[0]))return;for(let h of r)h.length!==0&&CA(e,h);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=n.fill.getGranularityForZoomLevel(t.z),s=SA[i.type]==="Polygon";for(let h of r){if(h.length===0||jf(h))continue;let c=_p(h,o,s);this._generateSideFaces(c,a)}if(!s)return;let l=s0(r,t,o,!1),u=this.layoutVertexArray;l0((h,c)=>{ma(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let i=0;for(let r=1;r<e.length;r++){let n=e[r],a=e[r-1];if(IA(n,a))continue;t.segment.vertexLength+4>Be.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let o=n.sub(a)._perp()._unit(),s=a.dist(n);i+s>32768&&(i=0),ma(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,0,i),ma(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,1,i),i+=s,ma(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,0,i),ma(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,1,i);let l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}};function CA(e,t){for(let i=0;i<t.length;i++){let r=t[i];i===t.length-1&&t[0].x===r.x&&t[0].y===r.y||(e.x+=r.x,e.y+=r.y,e.sampleCount++)}}W("FillExtrusionBucket",h0,{omit:["layers","features"]});function IA(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function jf(e){return e.every(t=>t.x<0)||e.every(t=>t.x>8192)||e.every(t=>t.y<0)||e.every(t=>t.y>8192)}var Gf,AA=()=>Gf=Gf||new ft({"fill-extrusion-opacity":new Z(B["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ee(B["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Z(B["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Z(B["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ml(B["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ee(B["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ee(B["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Z(B["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),EA={get paint(){return AA()}},$h=ne(le(),1),kA=e=>e.type==="fill-extrusion",DA=class extends mi{constructor(e){super(e,EA)}createBucket(e){return new h0(e)}queryRadius(){return kl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a,pixelPosMatrix:o}){let s=Dl(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,a),l=this.paint.get("fill-extrusion-height").evaluate(t,i),u=this.paint.get("fill-extrusion-base").evaluate(t,i),h=FA(s,o,0),c=zA(r,u,l,o),p=c[0],d=c[1];return LA(p,d,h)}};function ya(e,t){return e.x*t.x+e.y*t.y}function Uf(e,t){if(e.length===1){let i=0,r=t[i++],n;for(;!n||r.equals(n);)if(n=t[i++],!n)return 1/0;for(;i<t.length;i++){let a=t[i],o=e[0],s=n.sub(r),l=a.sub(r),u=o.sub(r),h=ya(s,s),c=ya(s,l),p=ya(l,l),d=ya(u,s),f=ya(u,l),y=h*p-c*c,g=(p*d-c*f)/y,_=(h*f-c*d)/y,b=1-g-_,v=r.z*b+n.z*g+a.z*_;if(isFinite(v))return v}return 1/0}else{let i=1/0;for(let r of t)i=Math.min(i,r.z);return i}}function LA(e,t,i){let r=1/0;W_(i,t)&&(r=Uf(i,t[0]));for(let n=0;n<t.length;n++){let a=t[n],o=e[n];for(let s=0;s<a.length-1;s++){let l=a[s],u=a[s+1],h=o[s],c=o[s+1],p=[l,u,c,h,l];Z_(i,p)&&(r=Math.min(r,Uf(i,p)))}}return r===1/0?!1:r}function zA(e,t,i,r){let n=[],a=[],o=r[8]*t,s=r[9]*t,l=r[10]*t,u=r[11]*t,h=r[8]*i,c=r[9]*i,p=r[10]*i,d=r[11]*i;for(let f of e){let y=[],g=[];for(let _ of f){let b=_.x,v=_.y,w=r[0]*b+r[4]*v+r[12],P=r[1]*b+r[5]*v+r[13],T=r[2]*b+r[6]*v+r[14],C=r[3]*b+r[7]*v+r[15],A=w+o,k=P+s,z=T+l,L=C+u,E=w+h,D=P+c,x=T+p,M=C+d,I=new $h.default(A/L,k/L);I.z=z/L,y.push(I);let R=new $h.default(E/M,D/M);R.z=x/M,g.push(R)}n.push(y),a.push(g)}return[n,a]}function FA(e,t,i){let r=[];for(let n of e){let a=[n.x,n.y,i,1];Ke.transformMat4(a,a,t),r.push(new $h.default(a[0]/a[3],a[1]/a[3]))}return r}var BA=We([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:RA,size:rV,alignment:nV}=BA,OA=We([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:NA,size:aV,alignment:oV}=OA,VA=ne(rl(),1),jA=VA.default.VectorTileFeature.types,Xf=63,GA=Math.cos(75/2*(Math.PI/180)),UA=15,XA=20,$A=15,c0=1/2,$f=Math.pow(2,$A-1)/c0,p0=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new QC,this.layoutVertexArray2=new eI,this.indexArray=new yi,this.programConfigurations=new Yr(e.layers,e.zoom),this.segments=new Be,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=mp("line",this.layers,t);let r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),a=[];for(let{feature:o,id:s,index:l,sourceLayerIndex:u}of e){let h=this.layers[0]._featureFilter.needGeometry,c=tn(o,h);if(!this.layers[0]._featureFilter.filter(new et(this.zoom,{globalState:this.globalState}),c,i))continue;let p=n?r.evaluate(c,{},i):void 0,d={id:s,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:h?c.geometry:en(o),patterns:{},sortKey:p};a.push(d)}n&&a.sort((o,s)=>o.sortKey-s.sortKey);for(let o of a){let{geometry:s,index:l,sourceLayerIndex:u}=o;if(this.hasPattern){let c=yp("line",this.layers,o,this.zoom,t);this.patternFeatures.push(c)}else this.addFeature(o,s,l,i,{},t.subdivisionGranularity);let h=e[l].feature;t.featureIndex.insert(h,s,l,u,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,NA)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,RA),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let t=+e.properties.mapbox_clip_start,i=+e.properties.mapbox_clip_end;return{start:t,end:i}}}addFeature(e,t,i,r,n,a){let o=this.layers[0].layout,s=o.get("line-join").evaluate(e,{}),l=o.get("line-cap"),u=o.get("line-miter-limit"),h=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let c of t)this.addLine(c,e,s,l,u,h,r,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}addLine(e,t,i,r,n,a,o,s){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=o?s.line.getGranularityForZoomLevel(o.z):1;if(e=_p(e,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<e.length-1;v++)this.totalDistance+=e[v].dist(e[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=jA[t.type]==="Polygon",h=e.length;for(;h>=2&&e[h-1].equals(e[h-2]);)h--;let c=0;for(;c<h-1&&e[c].equals(e[c+1]);)c++;if(h<(u?3:2))return;i==="bevel"&&(n=1.05);let p=this.overscaling<=16?UA*8192/(512*this.overscaling):0,d=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),f,y,g,_,b;this.e1=this.e2=-1,u&&(f=e[h-2],b=e[c].sub(f)._unit()._perp());for(let v=c;v<h;v++){if(g=v===h-1?u?e[c+1]:void 0:e[v+1],g&&e[v].equals(g))continue;b&&(_=b),f&&(y=f),f=e[v],b=g?g.sub(f)._unit()._perp():_,_=_||b;let w=_.add(b);(w.x!==0||w.y!==0)&&w._unit();let P=_.x*b.x+_.y*b.y,T=w.x*b.x+w.y*b.y,C=T!==0?1/T:1/0,A=2*Math.sqrt(2-2*T),k=T<GA&&y&&g,z=_.x*b.y-_.y*b.x>0;if(k&&v>c){let D=f.dist(y);if(D>2*p){let x=f.sub(f.sub(y)._mult(p/D)._round());this.updateDistance(y,x),this.addCurrentVertex(x,_,0,0,d),y=x}}let L=y&&g,E=L?i:u?"butt":r;if(L&&E==="round"&&(C<a?E="miter":C<=2&&(E="fakeround")),E==="miter"&&C>n&&(E="bevel"),E==="bevel"&&(C>2&&(E="flipbevel"),C<n&&(E="miter")),y&&this.updateDistance(y,f),E==="miter")w._mult(C),this.addCurrentVertex(f,w,0,0,d);else if(E==="flipbevel"){if(C>100)w=b.mult(-1);else{let D=C*_.add(b).mag()/_.sub(b).mag();w._perp()._mult(D*(z?-1:1))}this.addCurrentVertex(f,w,0,0,d),this.addCurrentVertex(f,w.mult(-1),0,0,d)}else if(E==="bevel"||E==="fakeround"){let D=-Math.sqrt(C*C-1),x=z?D:0,M=z?0:D;if(y&&this.addCurrentVertex(f,_,x,M,d),E==="fakeround"){let I=Math.round(A*180/Math.PI/XA);for(let R=1;R<I;R++){let N=R/I;if(N!==.5){let Q=N-.5,oe=1.0904+P*(-3.2452+P*(3.55645-P*1.43519)),Le=.848013+P*(-1.06021+P*.215638);N=N+N*Q*(N-1)*(oe*Q*Q+Le)}let $=b.sub(_)._mult(N)._add(_)._unit()._mult(z?-1:1);this.addHalfVertex(f,$.x,$.y,!1,z,0,d)}}g&&this.addCurrentVertex(f,b,-x,-M,d)}else if(E==="butt")this.addCurrentVertex(f,w,0,0,d);else if(E==="square"){let D=y?1:-1;this.addCurrentVertex(f,w,D,D,d)}else E==="round"&&(y&&(this.addCurrentVertex(f,_,0,0,d),this.addCurrentVertex(f,_,1,1,d,!0)),g&&(this.addCurrentVertex(f,b,-1,-1,d,!0),this.addCurrentVertex(f,b,0,0,d)));if(k&&v<h-1){let D=f.dist(g);if(D>2*p){let x=f.add(g.sub(f)._mult(p/D)._round());this.updateDistance(f,x),this.addCurrentVertex(x,b,0,0,d),f=x}}}}addCurrentVertex(e,t,i,r,n,a=!1){let o=t.x+t.y*i,s=t.y-t.x*i,l=-t.x+t.y*r,u=-t.y-t.x*r;this.addHalfVertex(e,o,s,a,!1,i,n),this.addHalfVertex(e,l,u,a,!0,-r,n),this.distance>$f/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,r,n,a))}addHalfVertex({x:e,y:t},i,r,n,a,o,s){let l=(this.lineClips?this.scaledDistance*($f-1):this.scaledDistance)*c0;if(this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(a?1:0),Math.round(Xf*i)+128,Math.round(Xf*r)+128,(o===0?0:o<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=this.scaledDistance-this.lineClips.start,c=this.lineClips.end-this.lineClips.start,p=h/c;this.layoutVertexArray2.emplaceBack(p,this.lineClipsArray.length)}let u=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),s.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}};W("LineBucket",p0,{omit:["layers","patternFeatures"]});var qf,qA=()=>qf=qf||new ft({"line-cap":new Z(B.layout_line["line-cap"]),"line-join":new ee(B.layout_line["line-join"]),"line-miter-limit":new Z(B.layout_line["line-miter-limit"]),"line-round-limit":new Z(B.layout_line["line-round-limit"]),"line-sort-key":new ee(B.layout_line["line-sort-key"])}),Yf,YA=()=>Yf=Yf||new ft({"line-opacity":new ee(B.paint_line["line-opacity"]),"line-color":new ee(B.paint_line["line-color"]),"line-translate":new Z(B.paint_line["line-translate"]),"line-translate-anchor":new Z(B.paint_line["line-translate-anchor"]),"line-width":new ee(B.paint_line["line-width"]),"line-gap-width":new ee(B.paint_line["line-gap-width"]),"line-offset":new ee(B.paint_line["line-offset"]),"line-blur":new ee(B.paint_line["line-blur"]),"line-dasharray":new $c(B.paint_line["line-dasharray"]),"line-pattern":new Ml(B.paint_line["line-pattern"]),"line-gradient":new Cl(B.paint_line["line-gradient"])}),Zf={get paint(){return YA()},get layout(){return qA()}},ZA=class extends ee{possiblyEvaluate(e,t){return t=new et(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=H({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}},ss,WA=e=>e.type==="line",HA=class extends mi{constructor(e){super(e,Zf),this.gradientVersion=0,ss||(ss=new ZA(Zf.paint.properties["line-width"].specification),ss.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();nC(t)?this.stepInterpolant=t._styleExpression.expression instanceof Cc:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=ss.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new p0(e)}queryRadius(e){let t=e,i=Wf(Va("line-width",this,t),Va("line-gap-width",this,t)),r=Va("line-offset",this,t);return i/2+Math.abs(r)+kl(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a}){let o=Dl(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),s=a/2*Wf(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=PI(r,l*a)),gI(o,r,s)}isTileClipped(){return!0}};function Wf(e,t){return t>0?t+2*e:e}var KA=We([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),JA=We([{name:"a_projected_pos",components:3,type:"Float32"}],4),sV=We([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),QA=We([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),lV=We([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Hf=We([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),eE=We([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),uV=We([{name:"triangle",components:3,type:"Uint16"}]),hV=We([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),cV=We([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),pV=We([{type:"Float32",name:"offsetX"}]),dV=We([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),fV=We([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]),ls=ne(le(),1);function tE(e,t,i){let r=t.layout.get("text-transform").evaluate(i,{});return r==="uppercase"?e=e.toLocaleUpperCase():r==="lowercase"&&(e=e.toLocaleLowerCase()),jn.applyArabicShaping&&(e=jn.applyArabicShaping(e)),e}function iE(e,t,i){return e.sections.forEach(r=>{r.text=tE(r.text,t,i)}),e}function rE(e){let t={},i={},r=[],n=0;function a(u){r.push(e[u]),n++}function o(u,h,c){let p=i[u];return delete i[u],i[h]=p,r[p].geometry[0].pop(),r[p].geometry[0]=r[p].geometry[0].concat(c[0]),p}function s(u,h,c){let p=t[h];return delete t[h],t[u]=p,r[p].geometry[0].shift(),r[p].geometry[0]=c[0].concat(r[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return"".concat(u,":").concat(p.x,":").concat(p.y)}for(let u=0;u<e.length;u++){let h=e[u],c=h.geometry,p=h.text?h.text.toString():null;if(!p){a(u);continue}let d=l(p,c),f=l(p,c,!0);if(d in i&&f in t&&i[d]!==t[f]){let y=s(d,f,c),g=o(d,f,r[y].geometry);delete t[d],delete i[f],i[l(p,r[g].geometry,!0)]=g,r[y].geometry=null}else d in i?o(d,f,c):f in t?s(d,f,c):(a(u),t[d]=n-1,i[f]=n-1)}return r.filter(u=>u.geometry)}var nE={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"},d0=24,aE=ne(ey(),1),Kf=3;function oE(e,t,i){e===1&&i.readMessage(sE,t)}function sE(e,t,i){if(e===3){let{id:r,bitmap:n,width:a,height:o,left:s,top:l,advance:u}=i.readMessage(lE,{});t.push({id:r,bitmap:new fp({width:a+2*Kf,height:o+2*Kf},n),metrics:{width:a,height:o,left:s,top:l,advance:u}})}}function lE(e,t,i){e===1?t.id=i.readVarint():e===2?t.bitmap=i.readBytes():e===3?t.width=i.readVarint():e===4?t.height=i.readVarint():e===5?t.left=i.readSVarint():e===6?t.top=i.readSVarint():e===7&&(t.advance=i.readVarint())}function uE(e){return new aE.default(e).readFields(oE,[])}function hE(e){let{userImage:t}=e;return t&&t.render&&t.render()?(e.data.replace(new Uint8Array(t.data.buffer)),!0):!1}function f0(e){let t=0,i=0;for(let o of e)t+=o.w*o.h,i=Math.max(i,o.w);e.sort((o,s)=>s.h-o.h);let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}],n=0,a=0;for(let o of e)for(let s=r.length-1;s>=0;s--){let l=r[s];if(!(o.w>l.w||o.h>l.h)){if(o.x=l.x,o.y=l.y,a=Math.max(a,o.y+o.h),n=Math.max(n,o.x+o.w),o.w===l.w&&o.h===l.h){let u=r.pop();u&&s<r.length&&(r[s]=u)}else o.h===l.h?(l.x+=o.w,l.w-=o.w):o.w===l.w?(l.y+=o.h,l.h-=o.h):(r.push({x:l.x+o.w,y:l.y,w:l.w-o.w,h:o.h}),l.y+=o.h,l.h-=o.h);break}}return{w:n,h:a,fill:t/(n*a)||0}}var Qt=1,xp=class{constructor(e,{pixelRatio:t,version:i,stretchX:r,stretchY:n,content:a,textFitWidth:o,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=n,this.content=a,this.version=i,this.textFitWidth=o,this.textFitHeight=s}get tl(){return[this.paddedRect.x+Qt,this.paddedRect.y+Qt]}get br(){return[this.paddedRect.x+this.paddedRect.w-Qt,this.paddedRect.y+this.paddedRect.h-Qt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-Qt*2)/this.pixelRatio,(this.paddedRect.h-Qt*2)/this.pixelRatio]}},cE=class{constructor(e,t){let i={},r={};this.haveRenderCallbacks=[];let n=[];this.addImages(e,i,n),this.addImages(t,r,n);let{w:a,h:o}=f0(n),s=new Ne({width:a||1,height:o||1});for(let l in e){let u=e[l],h=i[l].paddedRect;Ne.copy(u.data,s,{x:0,y:0},{x:h.x+Qt,y:h.y+Qt},u.data)}for(let l in t){let u=t[l],h=r[l].paddedRect,c=h.x+Qt,p=h.y+Qt,d=u.data.width,f=u.data.height;Ne.copy(u.data,s,{x:0,y:0},{x:c,y:p},u.data),Ne.copy(u.data,s,{x:0,y:f-1},{x:c,y:p-1},{width:d,height:1}),Ne.copy(u.data,s,{x:0,y:0},{x:c,y:p+f},{width:d,height:1}),Ne.copy(u.data,s,{x:d-1,y:0},{x:c-1,y:p},{width:1,height:f}),Ne.copy(u.data,s,{x:0,y:0},{x:c+d,y:p},{width:1,height:f})}this.image=s,this.iconPositions=i,this.patternPositions=r}addImages(e,t,i){for(let r in e){let n=e[r],a={x:0,y:0,w:n.data.width+2*Qt,h:n.data.height+2*Qt};i.push(a),t[r]=new xp(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let i in e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}patchUpdatedImage(e,t,i){if(!e||!t||e.version===t.version)return;e.version=t.version;let[r,n]=e.tl;i.update(t.data,void 0,{x:r,y:n})}};W("ImagePosition",xp);W("ImageAtlas",cE);var m0=(e=>(e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e))(m0||{});function y0(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0;break}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0;break}return{horizontalAlign:t,verticalAlign:i}}var pE=ne(rl(),1),dE=255,Fs=128,Jf=dE*Fs;function Qf(e,t){let{expression:i}=t;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new et(e+1))};if(i.kind==="source")return{kind:"source"};{let{zoomStops:r,interpolationType:n}=i,a=0;for(;a<r.length&&r[a]<=e;)a++;a=Math.max(0,a-1);let o=a;for(;o<r.length&&r[o]<e+1;)o++;o=Math.min(r.length-1,o);let s=r[a],l=r[o];if(i.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:n};let u=i.evaluate(new et(s)),h=i.evaluate(new et(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:h,interpolationType:n}}}function vp(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return e.kind==="source"?r/Fs:e.kind==="composite"?Ue.number(r/Fs,n/Fs,i):t}function Ll(e,t){let i=0,r=0;if(e.kind==="constant")r=e.layoutSize;else if(e.kind!=="source"){let{interpolationType:n,minZoom:a,maxZoom:o}=e,s=n?Te(ci.interpolationFactor(n,t,a,o),0,1):0;e.kind==="camera"?r=Ue.number(e.minSize,e.maxSize,s):i=s}return{uSizeT:i,uSize:r}}function Ws(e,t,i){let r="never",n=e.get(t);return n?r=n:e.get(i)&&(r="always"),r}var fE=pE.default.VectorTileFeature.types,mE=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function us(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=s?Math.min(Jf,Math.round(s[0])):0,f=s?Math.min(Jf,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(r*32),Math.round(n*32),a,o,(d<<1)+(l?1:0),f,u*16,h*16,c*256,p*256)}function no(e,t,i){e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i)}function yE(e){for(let t of e.sections)if(NC(t.text))return!0;return!1}var qh=class{constructor(e){this.layoutVertexArray=new tI,this.indexArray=new yi,this.programConfigurations=e,this.segments=new Be,this.dynamicLayoutVertexArray=new iI,this.opacityVertexArray=new rI,this.hasVisibleVertices=!1,this.placedSymbolArray=new B_}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,KA.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,JA.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,mE,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};W("SymbolBuffers",qh);var Yh=class{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new Be,this.collisionVertexArray=new aI}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,QA.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};W("CollisionBuffers",Yh);var Xn=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(o=>o.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Qf(this.zoom,t["text-size"]),this.iconSizeData=Qf(this.zoom,t["icon-size"]);let i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.canOverlap=Ws(i,"text-overlap","text-allow-overlap")!=="never"||Ws(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!r.isConstant();let a=n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(o=>m0[o])),this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.sourceID=e.sourceID}createArrays(){this.text=new qh(new Yr(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new qh(new Yr(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new N_,this.lineVertexArray=new V_,this.symbolInstances=new O_,this.textAnchorOffsets=new G_}calculateGlyphDependencies(e,t,i,r,n){for(let a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,(i||r)&&n){let o=nE[e.charAt(a)];o&&(t[o.charCodeAt(0)]=!0)}}populate(e,t,i){let r=this.layers[0],n=r.layout,a=n.get("text-font"),o=n.get("text-field"),s=n.get("icon-image"),l=(o.value.kind!=="constant"||o.value.value instanceof Hi&&!o.value.value.isEmpty()||o.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),u=s.value.kind!=="constant"||!!s.value.value||Object.keys(s.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=t.iconDependencies,p=t.glyphDependencies,d=t.availableImages,f=new et(this.zoom,{globalState:this.globalState});for(let{feature:y,id:g,index:_,sourceLayerIndex:b}of e){let v=r._featureFilter.needGeometry,w=tn(y,v);if(!r._featureFilter.filter(f,w,i))continue;v||(w.geometry=en(y));let P;if(l){let k=r.getValueAndResolveTokens("text-field",w,i,d),z=Hi.factory(k),L=this.hasRTLText=this.hasRTLText||yE(z);(!L||jn.getRTLTextPluginStatus()==="unavailable"||L&&jn.isParsed())&&(P=iE(z,r,w))}let T;if(u){let k=r.getValueAndResolveTokens("icon-image",w,i,d);k instanceof ki?T=k:T=ki.fromString(k)}if(!P&&!T)continue;let C=this.sortFeaturesByKey?h.evaluate(w,{},i):void 0,A={id:g,text:P,icon:T,index:_,sourceLayerIndex:b,geometry:w.geometry,properties:y.properties,type:fE[y.type],sortKey:C};if(this.features.push(A),T&&(c[T.name]=!0),P){let k=a.evaluate(w,{},i).join(","),z=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let L of P.sections)if(L.image)c[L.image.name]=!0;else{let E=kC(P.toString()),D=L.fontStack||k,x=p[D]=p[D]||{};this.calculateGlyphDependencies(L.text,x,z,this.allowVerticalPlacement,E)}}}n.get("symbol-placement")==="line"&&(this.features=rE(this.features)),this.sortFeaturesByKey&&this.features.sort((y,g)=>y.sortKey-g.sortKey)}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let i=this.lineVertexArray.length;if(e.segment!==void 0){let r=e.dist(t[e.segment+1]),n=e.dist(t[e.segment]),a={};for(let o=e.segment+1;o<t.length;o++)a[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:r},o<t.length-1&&(r+=t[o+1].dist(t[o]));for(let o=e.segment||0;o>=0;o--)a[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:n},o>0&&(n+=t[o-1].dist(t[o]));for(let o=0;o<t.length;o++){let s=a[o];this.lineVertexArray.emplaceBack(s.x,s.y,s.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,r,n,a,o,s,l,u,h,c){let p=e.indexArray,d=e.layoutVertexArray,f=e.segments.prepareSegment(4*t.length,d,p,this.canOverlap?a.sortKey:void 0),y=this.glyphOffsetArray.length,g=f.vertexLength,_=this.allowVerticalPlacement&&o===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<t.length;v++){let{tl:w,tr:P,bl:T,br:C,tex:A,pixelOffsetTL:k,pixelOffsetBR:z,minFontScaleX:L,minFontScaleY:E,glyphOffset:D,isSDF:x,sectionIndex:M}=t[v],I=f.vertexLength,R=D[1];us(d,s.x,s.y,w.x,R+w.y,A.x,A.y,i,x,k.x,k.y,L,E),us(d,s.x,s.y,P.x,R+P.y,A.x+A.w,A.y,i,x,z.x,k.y,L,E),us(d,s.x,s.y,T.x,R+T.y,A.x,A.y+A.h,i,x,k.x,z.y,L,E),us(d,s.x,s.y,C.x,R+C.y,A.x+A.w,A.y+A.h,i,x,z.x,z.y,L,E),no(e.dynamicLayoutVertexArray,s,_),p.emplaceBack(I,I+2,I+1),p.emplaceBack(I+1,I+2,I+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(D[0]),(v===t.length-1||M!==t[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,a,a.index,{},c,b&&b[M])}e.placedSymbolArray.emplaceBack(s.x,s.y,y,this.glyphOffsetArray.length-y,g,l,u,s.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],o,0,!1,0,h)}_addCollisionDebugVertex(e,t,i,r,n,a){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,r,n,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,i,r,n,a,o){let s=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),l=s.vertexLength,u=n.layoutVertexArray,h=n.collisionVertexArray,c=o.anchorX,p=o.anchorY;this._addCollisionDebugVertex(u,h,a,c,p,new ls.default(e,t)),this._addCollisionDebugVertex(u,h,a,c,p,new ls.default(i,t)),this._addCollisionDebugVertex(u,h,a,c,p,new ls.default(i,r)),this._addCollisionDebugVertex(u,h,a,c,p,new ls.default(e,r)),s.vertexLength+=4;let d=n.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),s.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,r){for(let n=e;n<t;n++){let a=this.collisionBoxArray.get(n),o=a.x1,s=a.y1,l=a.x2,u=a.y2;this.addCollisionDebugVertices(o,s,l,u,r?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Yh(Tf,Hf.members,Bh),this.iconCollisionBox=new Yh(Tf,Hf.members,Bh);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,i,r,n,a,o,s,l){let u={};for(let h=t;h<i;h++){let c=e.get(h);u.textBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.textFeatureIndex=c.featureIndex;break}for(let h=r;h<n;h++){let c=e.get(h);u.verticalTextBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalTextFeatureIndex=c.featureIndex;break}for(let h=a;h<o;h++){let c=e.get(h);u.iconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.iconFeatureIndex=c.featureIndex;break}for(let h=s;h<l;h++){let c=e.get(h);u.verticalIconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalIconFeatureIndex=c.featureIndex;break}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+i.numGlyphs*4;for(let n=i.vertexStartIndex;n<r;n+=4)e.indexArray.emplaceBack(n,n+2,n+1),e.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),i=Math.cos(e),r=[],n=[],a=[];for(let o=0;o<this.symbolInstances.length;++o){a.push(o);let s=this.symbolInstances.get(o);r.push(Math.round(t*s.anchorX+i*s.anchorY)|0),n.push(s.featureIndex)}return a.sort((o,s)=>r[o]-r[s]||n[s]-n[o]),a}addToSortKeyRanges(e,t){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let t of this.symbolInstanceIndexes){let i=this.symbolInstances.get(t);this.featureSortOrder.push(i.featureIndex),[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((r,n,a)=>{r>=0&&a.indexOf(r)===n&&this.addIndicesForPlacedSymbol(this.text,r)}),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};W("SymbolBucket",Xn,{omit:["layers","collisionBoxArray","features","compareText"]});Xn.MAX_GLYPHS=65535;Xn.addDynamicAttributes=no;function gE(e,t){return t.replace(/{([^{}]+)}/g,(i,r)=>e&&r in e?String(e[r]):"")}var em,_E=()=>em=em||new ft({"symbol-placement":new Z(B.layout_symbol["symbol-placement"]),"symbol-spacing":new Z(B.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Z(B.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ee(B.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Z(B.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Z(B.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Z(B.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Z(B.layout_symbol["icon-ignore-placement"]),"icon-optional":new Z(B.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Z(B.layout_symbol["icon-rotation-alignment"]),"icon-size":new ee(B.layout_symbol["icon-size"]),"icon-text-fit":new Z(B.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Z(B.layout_symbol["icon-text-fit-padding"]),"icon-image":new ee(B.layout_symbol["icon-image"]),"icon-rotate":new ee(B.layout_symbol["icon-rotate"]),"icon-padding":new ee(B.layout_symbol["icon-padding"]),"icon-keep-upright":new Z(B.layout_symbol["icon-keep-upright"]),"icon-offset":new ee(B.layout_symbol["icon-offset"]),"icon-anchor":new ee(B.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Z(B.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Z(B.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Z(B.layout_symbol["text-rotation-alignment"]),"text-field":new ee(B.layout_symbol["text-field"]),"text-font":new ee(B.layout_symbol["text-font"]),"text-size":new ee(B.layout_symbol["text-size"]),"text-max-width":new ee(B.layout_symbol["text-max-width"]),"text-line-height":new Z(B.layout_symbol["text-line-height"]),"text-letter-spacing":new ee(B.layout_symbol["text-letter-spacing"]),"text-justify":new ee(B.layout_symbol["text-justify"]),"text-radial-offset":new ee(B.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Z(B.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ee(B.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ee(B.layout_symbol["text-anchor"]),"text-max-angle":new Z(B.layout_symbol["text-max-angle"]),"text-writing-mode":new Z(B.layout_symbol["text-writing-mode"]),"text-rotate":new ee(B.layout_symbol["text-rotate"]),"text-padding":new Z(B.layout_symbol["text-padding"]),"text-keep-upright":new Z(B.layout_symbol["text-keep-upright"]),"text-transform":new ee(B.layout_symbol["text-transform"]),"text-offset":new ee(B.layout_symbol["text-offset"]),"text-allow-overlap":new Z(B.layout_symbol["text-allow-overlap"]),"text-overlap":new Z(B.layout_symbol["text-overlap"]),"text-ignore-placement":new Z(B.layout_symbol["text-ignore-placement"]),"text-optional":new Z(B.layout_symbol["text-optional"])}),tm,xE=()=>tm=tm||new ft({"icon-opacity":new ee(B.paint_symbol["icon-opacity"]),"icon-color":new ee(B.paint_symbol["icon-color"]),"icon-halo-color":new ee(B.paint_symbol["icon-halo-color"]),"icon-halo-width":new ee(B.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ee(B.paint_symbol["icon-halo-blur"]),"icon-translate":new Z(B.paint_symbol["icon-translate"]),"icon-translate-anchor":new Z(B.paint_symbol["icon-translate-anchor"]),"text-opacity":new ee(B.paint_symbol["text-opacity"]),"text-color":new ee(B.paint_symbol["text-color"],{runtimeType:hi,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new ee(B.paint_symbol["text-halo-color"]),"text-halo-width":new ee(B.paint_symbol["text-halo-width"]),"text-halo-blur":new ee(B.paint_symbol["text-halo-blur"]),"text-translate":new Z(B.paint_symbol["text-translate"]),"text-translate-anchor":new Z(B.paint_symbol["text-translate-anchor"])}),$u={get paint(){return xE()},get layout(){return _E()}},g0=class{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:uo,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let t=this.defaultValue.value;e(t._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};W("FormatSectionOverride",g0,{omit:["defaultValue"]});var vE=e=>e.type==="symbol",bE=class Zh extends mi{constructor(t){super(t,$u)}recalculate(t,i){if(super.recalculate(t,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let r=this.layout.get("text-writing-mode");if(r){let n=[];for(let a of r)n.indexOf(a)<0&&n.push(a);this.layout._values["text-writing-mode"]=n}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,i,r,n){let a=this.layout.get(t).evaluate(i,{},r,n),o=this._unevaluatedLayout._values[t];return!o.isDataDriven()&&!xl(o.value)&&a?gE(i.properties,a):a}createBucket(t){return new Xn(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of $u.paint.overridableProperties){if(!Zh.hasPaintOverride(this.layout,t))continue;let i=this.paint.get(t),r=new g0(i),n=new Oc(r,i.property.specification),a=null;i.value.kind==="constant"||i.value.kind==="source"?a=new Ha("source",n):a=new $s("composite",n,i.value.zoomStops),this.paint._values[t]=new ui(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(t,i,r){return!this.layout||i.isDataDriven()||r.isDataDriven()?!1:Zh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,i){let r=t.get("text-field"),n=$u.paint.properties[i],a=!1,o=s=>{for(let l of s)if(n.overrides&&n.overrides.hasOverride(l)){a=!0;return}};if(r.value.kind==="constant"&&r.value.value instanceof Hi)o(r.value.value.sections);else if(r.value.kind==="source"){let s=u=>{if(!a)if(u instanceof Ya&&at(u.value)===ho){let h=u.value;o(h.sections)}else u instanceof Hg?o(u.sections):u.eachChild(s)},l=r.value;l._styleExpression&&s(l._styleExpression.expression)}return a}},im,wE=()=>im=im||new ft({"background-color":new Z(B.paint_background["background-color"]),"background-pattern":new $c(B.paint_background["background-pattern"]),"background-opacity":new Z(B.paint_background["background-opacity"])}),PE={get paint(){return wE()}},TE=e=>e.type==="background",SE=class extends mi{constructor(e){super(e,PE)}},rm,ME=()=>rm=rm||new ft({"raster-opacity":new Z(B.paint_raster["raster-opacity"]),"raster-hue-rotate":new Z(B.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Z(B.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Z(B.paint_raster["raster-brightness-max"]),"raster-saturation":new Z(B.paint_raster["raster-saturation"]),"raster-contrast":new Z(B.paint_raster["raster-contrast"]),"raster-resampling":new Z(B.paint_raster["raster-resampling"]),"raster-fade-duration":new Z(B.paint_raster["raster-fade-duration"])}),CE={get paint(){return ME()}},IE=e=>e.type==="raster",AE=class extends mi{constructor(e){super(e,CE)}};function EE(e){let t=[],i=e.id;return i===void 0&&t.push({message:"layers.".concat(i,': missing required property "id"')}),e.render===void 0&&t.push({message:"layers.".concat(i,': missing required method "render"')}),e.renderingMode&&e.renderingMode!=="2d"&&e.renderingMode!=="3d"&&t.push({message:"layers.".concat(i,': property "renderingMode" must be either "2d" or "3d"')}),t}var kE=e=>e.type==="custom",DE=class extends mi{constructor(e){super(e,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function qu(e){if(e.type==="custom")return new DE(e);switch(e.type){case"background":return new SE(e);case"circle":return new AI(e);case"color-relief":return new UI(e);case"fill":return new vA(e);case"fill-extrusion":return new DA(e);case"heatmap":return new zI(e);case"hillshade":return new OI(e);case"line":return new HA(e);case"raster":return new AE(e);case"symbol":return new bE(e)}}function Bs(e){let t=[];if(typeof e=="string")t.push({id:"default",url:e});else if(e&&e.length>0){let i=[];for(let{id:r,url:n}of e){let a="".concat(r).concat(n);i.indexOf(a)===-1&&(i.push(a),t.push({id:r,url:n}))}}return t}function nm(e,t,i){try{let r=new URL(e);return r.pathname+="".concat(t).concat(i),r.toString()}catch(r){throw new Error('Invalid sprite URL "'.concat(e,'", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically'))}}async function LE(e,t,i,r){let n=Bs(e),a=i>1?"@2x":"",o={},s={};for(let{id:l,url:u}of n){let h=t.transformRequest(nm(u,a,".json"),"SpriteJSON");o[l]=ll(h,r);let c=t.transformRequest(nm(u,a,".png"),"SpriteImage");s[l]=Ci.getImage(c,r)}return await Promise.all([...Object.values(o),...Object.values(s)]),zE(o,s)}async function zE(e,t){let i={};for(let r in e){i[r]={};let n=me.getImageCanvasContext((await t[r]).data),a=(await e[r]).data;for(let o in a){let{width:s,height:l,x:u,y:h,sdf:c,pixelRatio:p,stretchX:d,stretchY:f,content:y,textFitWidth:g,textFitHeight:_}=a[o],b={width:s,height:l,x:u,y:h,context:n};i[r][o]={data:null,pixelRatio:p,sdf:c,stretchX:d,stretchY:f,content:y,textFitWidth:g,textFitHeight:_,spriteData:b}}}return i}var hs=1,FE=class extends Et{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new Ne({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:t,promiseResolve:i}of this.requestors)i(this._getImagesForIds(t));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let i=t.spriteData;t.data=new Ne({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw new Error("Image id ".concat(e," already exist, use updateImage instead"));this._validate(e,t)&&(this.images[e]=t)}_validate(e,t){let i=!0,r=t.data||t.spriteData;return this._validateStretch(t.stretchX,r&&r.width)||(this.fire(new te(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),i=!1),this._validateStretch(t.stretchY,r&&r.height)||(this.fire(new te(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),i=!1),this._validateContent(t.content,t)||(this.fire(new te(new Error('Image "'.concat(e,'" has invalid "content" value')))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(let r of e){if(r[0]<i||r[1]<r[0]||t<r[1])return!1;i=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let i=t.spriteData,r=i&&i.width||t.data.width,n=i&&i.height||t.data.height;return!(e[0]<0||r<e[0]||e[1]<0||n<e[1]||e[2]<0||r<e[2]||e[3]<0||n<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i=!0){let r=this.getImage(e);if(i&&(r.data.width!==t.data.width||r.data.height!==t.data.height))throw new Error("size mismatch between old image (".concat(r.data.width,"x").concat(r.data.height,") and new image (").concat(t.data.width,"x").concat(t.data.height,")."));t.version=r.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){let t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((t,i)=>{let r=!0;if(!this.isLoaded())for(let n of e)this.images[n]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){let t={};for(let i of e){let r=this.getImage(i);r||(this.fire(new U("styleimagemissing",{id:i})),r=this.getImage(i)),r?t[i]={data:r.data.clone(),pixelRatio:r.pixelRatio,sdf:r.sdf,version:r.version,stretchX:r.stretchX,stretchY:r.stretchY,content:r.content,textFitWidth:r.textFitWidth,textFitHeight:r.textFitHeight,hasRenderCallback:!!(r.userImage&&r.userImage.render)}:nt('Image "'.concat(i,'" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.'))}return t}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let t=this.patterns[e],i=this.getImage(e);if(!i)return null;if(t&&t.position.version===i.version)return t.position;if(t)t.position.version=i.version;else{let r=i.data.width+hs*2,n=i.data.height+hs*2,a={w:r,h:n,x:0,y:0},o=new xp(a,i);this.patterns[e]={bin:a,position:o}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Qe(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let n in this.patterns)e.push(this.patterns[n].bin);let{w:t,h:i}=f0(e),r=this.atlasImage;r.resize({width:t||1,height:i||1});for(let n in this.patterns){let{bin:a}=this.patterns[n],o=a.x+hs,s=a.y+hs,l=this.getImage(n).data,u=l.width,h=l.height;Ne.copy(l,r,{x:0,y:0},{x:o,y:s},{width:u,height:h}),Ne.copy(l,r,{x:0,y:h-1},{x:o,y:s-1},{width:u,height:1}),Ne.copy(l,r,{x:0,y:0},{x:o,y:s+h},{width:u,height:1}),Ne.copy(l,r,{x:u-1,y:0},{x:o-1,y:s},{width:1,height:h}),Ne.copy(l,r,{x:0,y:0},{x:o+u,y:s},{width:1,height:h})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this.callbackDispatchedThisFrame[t])continue;this.callbackDispatchedThisFrame[t]=!0;let i=this.getImage(t);i||nt('Image with ID: "'.concat(t,'" was not found')),hE(i)&&this.updateImage(t,i)}}};async function BE(e,t,i,r){let n=t*256,a=n+255,o=r.transformRequest(i.replace("{fontstack}",e).replace("{range}","".concat(n,"-").concat(a)),"Glyphs"),s=await zT(o,new AbortController);if(!s||!s.data)throw new Error("Could not load glyph range. range: ".concat(t,", ").concat(n,"-").concat(a));let l={};for(let u of uE(s.data))l[u.id]=u;return l}var RE=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:a="normal",fontStyle:o="normal",lang:s=null}={}){this.buffer=t,this.cutoff=r,this.radius=i,this.lang=s;let l=this.size=e+t*4,u=this._createCanvas(l),h=this.ctx=u.getContext("2d",{willReadFrequently:!0});h.font="".concat(o," ").concat(a," ").concat(e,"px ").concat(n),h.textBaseline="alphabetic",h.textAlign="left",h.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(i),s=0,l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-n))),u=Math.min(this.size-this.buffer,o+Math.ceil(r)),h=l+2*this.buffer,c=u+2*this.buffer,p=Math.max(h*c,0),d=new Uint8ClampedArray(p),f={data:d,width:h,height:c,glyphWidth:l,glyphHeight:u,glyphTop:o,glyphLeft:s,glyphAdvance:t};if(l===0||u===0)return f;let{ctx:y,buffer:g,gridInner:_,gridOuter:b}=this;this.lang&&(y.lang=this.lang),y.clearRect(g,g,l,u),y.fillText(e,g,g+o);let v=y.getImageData(g,g,l,u);b.fill(1e20,0,p),_.fill(0,0,p);for(let w=0;w<u;w++)for(let P=0;P<l;P++){let T=v.data[4*(w*l+P)+3]/255;if(T===0)continue;let C=(w+g)*h+P+g;if(T===1)b[C]=0,_[C]=1e20;else{let A=.5-T;b[C]=A>0?A*A:0,_[C]=A<0?A*A:0}}am(b,0,0,h,c,h,this.f,this.v,this.z),am(_,g,g,l,u,h,this.f,this.v,this.z);for(let w=0;w<p;w++){let P=Math.sqrt(b[w])-Math.sqrt(_[w]);d[w]=Math.round(255-255*(P/this.radius+this.cutoff))}return f}};function am(e,t,i,r,n,a,o,s,l){for(let u=t;u<t+r;u++)om(e,i*a+u,a,n,o,s,l);for(let u=i;u<i+n;u++)om(e,u*a+t,1,r,o,s,l)}function om(e,t,i,r,n,a,o){a[0]=0,o[0]=-1e20,o[1]=1e20,n[0]=e[t];for(let s=1,l=0,u=0;s<r;s++){n[s]=e[t+s*i];let h=s*s;do{let c=a[l];u=(n[s]-n[c]+h-c*c)/(s-c)/2}while(u<=o[l]&&--l>-1);l++,a[l]=s,o[l]=u,o[l+1]=1e20}for(let s=0,l=0;s<r;s++){for(;o[l+1]<s;)l++;let u=a[l],h=s-u;e[t+s*i]=n[u]+h*h}}var Wh=class Hh{constructor(t,i){this.requestManager=t,this.localIdeographFontFamily=i,this.entries={}}setURL(t){this.url=t}async getGlyphs(t){let i=[];for(let a in t)for(let o of t[a])i.push(this._getAndCacheGlyphsPromise(a,o));let r=await Promise.all(i),n={};for(let{stack:a,id:o,glyph:s}of r)n[a]||(n[a]={}),n[a][o]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return n}async _getAndCacheGlyphsPromise(t,i){let r=this.entries[t];r||(r=this.entries[t]={glyphs:{},requests:{},ranges:{}});let n=r.glyphs[i];if(n!==void 0)return{stack:t,id:i,glyph:n};if(n=this._tinySDF(r,t,i),n)return r.glyphs[i]=n,{stack:t,id:i,glyph:n};let a=Math.floor(i/256);if(a*256>65535)throw new Error("glyphs > 65535 not supported");if(r.ranges[a])return{stack:t,id:i,glyph:n};if(!this.url)throw new Error("glyphsUrl is not set");if(!r.requests[a]){let s=Hh.loadGlyphRange(t,a,this.url,this.requestManager);r.requests[a]=s}let o=await r.requests[a];for(let s in o)this._doesCharSupportLocalGlyph(+s)||(r.glyphs[+s]=o[+s]);return r.ranges[a]=!0,{stack:t,id:i,glyph:o[i]||null}}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(t))||ht["CJK Unified Ideographs"](t)||ht["Hangul Syllables"](t)||ht.Hiragana(t)||ht.Katakana(t)||ht["CJK Symbols and Punctuation"](t)||ht["Halfwidth and Fullwidth Forms"](t))}_tinySDF(t,i,r){let n=this.localIdeographFontFamily;if(!n||!this._doesCharSupportLocalGlyph(r))return;let a=2,o=t.tinySDF;if(!o){let l="400";/bold/i.test(i)?l="900":/medium/i.test(i)?l="500":/light/i.test(i)&&(l="200"),o=t.tinySDF=new Hh.TinySDF({fontSize:24*a,buffer:3*a,radius:8*a,cutoff:.25,fontFamily:n,fontWeight:l})}let s=o.draw(String.fromCharCode(r));return{id:r,bitmap:new fp({width:s.width||30*a,height:s.height||30*a},s.data),metrics:{width:s.glyphWidth/a||24,height:s.glyphHeight/a||24,left:s.glyphLeft/a+.5||0,top:s.glyphTop/a-27.5||-8,advance:s.glyphAdvance/a||24,isDoubleResolution:!0}}}};Wh.loadGlyphRange=BE,Wh.TinySDF=RE;var OE=Wh,NE=class{constructor(){this.specification=B.light.position}possiblyEvaluate(e,t){return yT(e.expression.evaluate(t))}interpolate(e,t,i){return{x:Ue.number(e.x,t.x,i),y:Ue.number(e.y,t.y,i),z:Ue.number(e.z,t.z,i)}}},sm="-transition",Yu,VE=class extends Et{constructor(e){super(),Yu=Yu||new ft({anchor:new Z(B.light.anchor),position:new NE,color:new Z(B.light.color),intensity:new Z(B.light.intensity)}),this._transitionable=new Tl(Yu),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t={}){if(!this._validate(MC,e,t))for(let i in e){let r=e[i];i.endsWith(sm)?this._transitionable.setTransition(i.slice(0,-sm.length),r):this._transitionable.setValue(i,r)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return i&&i.validate===!1?!1:wl(this,e.call(rt,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:B}))}},jE=new ft({"sky-color":new Z(B.sky["sky-color"]),"horizon-color":new Z(B.sky["horizon-color"]),"fog-color":new Z(B.sky["fog-color"]),"fog-ground-blend":new Z(B.sky["fog-ground-blend"]),"horizon-fog-blend":new Z(B.sky["horizon-fog-blend"]),"sky-horizon-blend":new Z(B.sky["sky-horizon-blend"]),"atmosphere-blend":new Z(B.sky["atmosphere-blend"])}),lm="-transition",GE=class extends Et{constructor(e){super(),this._transitionable=new Tl(jE),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new et(0))}setSky(e,t={}){if(!this._validate(CC,e,t)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let i in e){let r=e[i];i.endsWith(lm)?this._transitionable.setTransition(i.slice(0,-lm.length),r):this._transitionable.setValue(i,r)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i={}){return(i==null?void 0:i.validate)===!1?!1:wl(this,e.call(rt,H({value:t,style:{glyphs:!0,sprite:!0},styleSpec:B})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},UE=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let i=e.join(",")+String(t);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(e,t)),this.dashEntry[i]}getDashRanges(e,t,i){let r=e.length%2===1,n=[],a=r?-e[e.length-1]*i:0,o=e[0]*i,s=!0;n.push({left:a,right:o,isDash:s,zeroLength:e[0]===0});let l=e[0];for(let u=1;u<e.length;u++){s=!s;let h=e[u];a=l*i,l+=h,o=l*i,n.push({left:a,right:o,isDash:s,zeroLength:h===0})}return n}addRoundDash(e,t,i){let r=t/2;for(let n=-i;n<=i;n++){let a=this.nextRow+i+n,o=this.width*a,s=0,l=e[s];for(let u=0;u<this.width;u++){u/l.right>1&&(l=e[++s]);let h=Math.abs(u-l.left),c=Math.abs(u-l.right),p=Math.min(h,c),d,f=n/i*(r+1);if(l.isDash){let y=r-Math.abs(f);d=Math.sqrt(p*p+y*y)}else d=r-Math.sqrt(p*p+f*f);this.data[o+u]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let o=e.length-1;o>=0;--o){let s=e[o],l=e[o+1];s.zeroLength?e.splice(o,1):l&&l.isDash===s.isDash&&(l.left=s.left,e.splice(o,1))}let t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);let r=this.width*this.nextRow,n=0,a=e[n];for(let o=0;o<this.width;o++){o/a.right>1&&(a=e[++n]);let s=Math.abs(o-a.left),l=Math.abs(o-a.right),u=Math.min(s,l),h=a.isDash?u:-u;this.data[r+o]=Math.max(0,Math.min(255,h+128))}}addDash(e,t){let i=t?7:0,r=2*i+1;if(this.nextRow+r>this.height)return nt("LineAtlas out of space"),null;let n=0;for(let o=0;o<e.length;o++)n+=e[o];if(n!==0){let o=this.width/n,s=this.getDashRanges(e,this.width,o);t?this.addRoundDash(s,o,i):this.addRegularDash(s)}let a={y:(this.nextRow+i+.5)/this.height,height:2*i/this.height,width:n};return this.nextRow+=r,this.dirty=!0,a}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}},XE=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},$E={once:!0},qE=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new XE(()=>this.process()),this.subscription=xh(this.target,"message",i=>this.receive(i),!1),this.globalScope=Bn(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise((i,r)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=t?xh(t.signal,"abort",()=>{a==null||a.unsubscribe(),delete this.resolveRejects[n];let l={id:n,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l)},$E):null;this.resolveRejects[n]={resolve:l=>{a==null||a.unsubscribe(),i(l)},reject:l=>{a==null||a.unsubscribe(),r(l)}};let o=[],s=Ht(He({},e),{id:n,sourceMapId:this.mapId,origin:location.origin,data:Oa(e.data,o)});this.target.postMessage(s,{transfer:o})})}receive(e){let t=e.data,i=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[i];let r=this.abortControllers[i];delete this.abortControllers[i],r&&r.abort();return}if(Bn(self)||t.mustQueue){this.tasks[i]=t,this.taskQueue.push(i),this.invoker.trigger();return}this.processTask(i,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}async processTask(e,t){if(t.type==="<response>"){let n=this.resolveRejects[e];if(delete this.resolveRejects[e],!n)return;t.error?n.reject(Na(t.error)):n.resolve(Na(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,new Error("Could not find a registered handler for ".concat(t.type,", map ID: ").concat(this.mapId,", available handlers: ").concat(Object.keys(this.messageHandlers).join(", "))));return}let i=Na(t.data),r=new AbortController;this.abortControllers[e]=r;try{let n=await this.messageHandlers[t.type](t.sourceMapId,i,r);this.completeTask(e,null,n)}catch(n){this.completeTask(e,n)}}completeTask(e,t,i){let r=[];delete this.abortControllers[e];let n={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Oa(t):null,data:Oa(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},YE='(()=>{var Uy=Object.create;var ss=Object.defineProperty;var $y=Object.getOwnPropertyDescriptor;var jy=Object.getOwnPropertyNames;var qy=Object.getPrototypeOf,Wy=Object.prototype.hasOwnProperty;var ve=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xy=(t,e)=>{for(var r in e)ss(t,r,{get:e[r],enumerable:!0})},Hy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of jy(e))!Wy.call(t,i)&&i!==r&&ss(t,i,{get:()=>e[i],enumerable:!(n=$y(e,i))||n.enumerable});return t};var Y=(t,e,r)=>(r=t!=null?Uy(qy(t)):{},Hy(e||!t||!t.__esModule?ss(r,"default",{value:t,enumerable:!0}):r,t));var ye=ve((p0,au)=>{"use strict";au.exports=hr;function hr(t,e){this.x=t,this.y=e}hr.prototype={clone:function(){return new hr(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};hr.convert=function(t){return t instanceof hr?t:Array.isArray(t)?new hr(t[0],t[1]):t}});var uu=ve((f0,lu)=>{"use strict";lu.exports=su;function su(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}su.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(e===void 0&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-i/o}var a=0,s=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:s=r,r=(s-a)*.5+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}}});var op=ve((Ov,el)=>{function Sg(t,e){var r,n,i,o,a,s,l,u,c,p;for(r=t.length&3,n=t.length-r,i=e,a=3432918353,l=461845907,p=0;p<n;)c=t.charCodeAt(p)&255|(t.charCodeAt(++p)&255)<<8|(t.charCodeAt(++p)&255)<<16|(t.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c,i=i<<13|i>>>19,o=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(c=0,r){case 3:c^=(t.charCodeAt(p+2)&255)<<16;case 2:c^=(t.charCodeAt(p+1)&255)<<8;case 1:c^=t.charCodeAt(p)&255,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c}return i^=t.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}typeof el<"u"&&(el.exports=Sg)});var ap=ve((Gv,tl)=>{function wg(t,e){for(var r=t.length,n=e^r,i=0,o;r>=4;)o=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^o,r-=4,++i;switch(r){case 3:n^=(t.charCodeAt(i+2)&255)<<16;case 2:n^=(t.charCodeAt(i+1)&255)<<8;case 1:n^=t.charCodeAt(i)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}typeof tl!==void 0&&(tl.exports=wg)});var rl=ve((Nv,ta)=>{var sp=op(),Ag=ap();ta.exports=sp;ta.exports.murmur3=sp;ta.exports.murmur2=Ag});var dl=ve((LS,jp)=>{"use strict";var cb=ye();jp.exports=Rr;function Rr(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(pb,this,e)}function pb(t,e,r){t==1?e.id=r.readVarint():t==2?fb(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function fb(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}Rr.types=["Unknown","Point","LineString","Polygon"];Rr.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=[],s;t.pos<e;){if(n<=0){var l=t.readVarint();r=l&7,n=l>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(s&&a.push(s),s=[]),s.push(new cb(i,o));else if(r===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+r)}return s&&a.push(s),a};Rr.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=c&7,n=c>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error("unknown command "+r)}return[a,l,s,u]};Rr.prototype.toGeoJSON=function(t,e,r){var n=this.extent*Math.pow(2,r),i=this.extent*t,o=this.extent*e,a=this.loadGeometry(),s=Rr.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var h=y[m],g=180-(h.y+o)*360/n;y[m]=[(h.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(g*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(l=0;l<a.length;l++)p[l]=a[l][0];a=p,c(a);break;case 2:for(l=0;l<a.length;l++)c(a[l]);break;case 3:for(a=yb(a),l=0;l<a.length;l++)for(u=0;u<a[l].length;u++)c(a[l][u]);break}a.length===1?a=a[0]:s="Multi"+s;var f={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(f.id=this.id),f};function yb(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=mb(t[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[t[o]]):n.push(t[o]))}return n&&r.push(n),r}function mb(t){for(var e=0,r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}});var gl=ve((FS,Wp)=>{"use strict";var hb=dl();Wp.exports=qp;function qp(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(db,this,e),this.length=this._features.length}function db(t,e,r){t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(gb(r))}function gb(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}qp.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new hb(this._pbf,e,this.extent,this._keys,this._values)}});var Hp=ve((DS,Xp)=>{"use strict";var bb=gl();Xp.exports=xb;function xb(t,e){this.layers=t.readFields(vb,{},e)}function vb(t,e,r){if(t===3){var n=new bb(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var Rt=ve((VS,xa)=>{xa.exports.VectorTile=Hp();xa.exports.VectorTileFeature=dl();xa.exports.VectorTileLayer=gl()});var df=ve(Sl=>{Sl.read=function(t,e,r,n,i){var o,a,s=i*8-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=r?i-1:0,f=r?-1:1,y=t[e+p];for(p+=f,o=y&(1<<-c)-1,y>>=-c,c+=s;c>0;o=o*256+t[e+p],p+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+t[e+p],p+=f,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(y?-1:1)*a*Math.pow(2,o-n)};Sl.write=function(t,e,r,n,i,o){var a,s,l,u=o*8-i-1,c=(1<<u)-1,p=c>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:o-1,m=n?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?e+=f/l:e+=f*Math.pow(2,1-p),e*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(e*l-1)*Math.pow(2,i),a=a+p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[r+y]=s&255,y+=m,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+y]=a&255,y+=m,a/=256,u-=8);t[r+y-m]|=h*128}});var mi=ve((fA,Pf)=>{"use strict";Pf.exports=J;var Aa=df();function J(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}J.Varint=0;J.Fixed64=1;J.Bytes=2;J.Fixed32=5;var wl=65536*65536,gf=1/wl,Ob=12,vf=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");J.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_a(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=xf(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_a(this.buf,this.pos)+_a(this.buf,this.pos+4)*wl;return this.pos+=8,t},readSFixed64:function(){var t=_a(this.buf,this.pos)+xf(this.buf,this.pos+4)*wl;return this.pos+=8,t},readFloat:function(){var t=Aa.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Aa.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,Gb(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Ob&&vf?ex(this.buf,e,t):Qb(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==J.Bytes)return t.push(this.readVarint(e));var r=mt(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==J.Bytes)return t.push(this.readSVarint());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==J.Bytes)return t.push(this.readBoolean());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==J.Bytes)return t.push(this.readFloat());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==J.Bytes)return t.push(this.readDouble());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed32());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed32());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed64());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed64());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===J.Varint)for(;this.buf[this.pos++]>127;);else if(e===J.Bytes)this.pos=this.readVarint()+this.pos;else if(e===J.Fixed32)this.pos+=4;else if(e===J.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Gr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Gr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Gr(this.buf,t&-1,this.pos),Gr(this.buf,Math.floor(t*gf),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Gr(this.buf,t&-1,this.pos),Gr(this.buf,Math.floor(t*gf),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Nb(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(!!t)},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=tx(this.buf,t,this.pos);var r=this.pos-e;r>=128&&bf(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Aa.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Aa.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&bf(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,J.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,jb,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,qb,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Hb,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Wb,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Xb,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Zb,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Jb,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Yb,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Kb,e)},writeBytesField:function(t,e){this.writeTag(t,J.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,J.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,J.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,J.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};function Gb(t,e,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return Or(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function mt(t){return t.type===J.Bytes?t.readVarint()+t.pos:t.pos+1}function Or(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Nb(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),Ub(r,n,e),$b(n,e)}function Ub(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function $b(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function bf(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function jb(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function qb(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Wb(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Xb(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Hb(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function Zb(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function Jb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Yb(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function Kb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function _a(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Gr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function xf(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Qb(t,e,r){for(var n="",i=e;i<r;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=t[i+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(a=(o&15)<<12|(l&63)<<6|u&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(l=t[i+1],u=t[i+2],c=t[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(a=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function ex(t,e,r){return vf.decode(t.subarray(e,r))}function tx(t,e,r){for(var n=0,i,o;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):o=i;continue}else o&&(t[r++]=239,t[r++]=191,t[r++]=189,o=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=i&63|128)}return r}});var gy=ve((iT,dy)=>{dy.exports=Ha;function Ha(t,e){var r=t&&t.type,n;if(r==="FeatureCollection")for(n=0;n<t.features.length;n++)Ha(t.features[n],e);else if(r==="GeometryCollection")for(n=0;n<t.geometries.length;n++)Ha(t.geometries[n],e);else if(r==="Feature")Ha(t.geometry,e);else if(r==="Polygon")my(t.coordinates,e);else if(r==="MultiPolygon")for(n=0;n<t.coordinates.length;n++)my(t.coordinates[n],e);return t}function my(t,e){if(t.length!==0){hy(t[0],e);for(var r=1;r<t.length;r++)hy(t[r],!e)}}function hy(t,e){for(var r=0,n=0,i=0,o=t.length,a=o-1;i<o;a=i++){var s=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+s;n+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+n>=0!=!!e&&t.reverse()}});var Py=ve((sT,vy)=>{"use strict";var Ux=ye(),$x=Rt().VectorTileFeature;vy.exports=xy;function xy(t,e){this.options=e||{},this.features=t,this.length=t.length}xy.prototype.feature=function(t){return new Ja(this.features[t],this.options.extent)};function Ja(t,e){this.id=typeof t.id=="number"?t.id:void 0,this.type=t.type,this.rawGeometry=t.type===1?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}Ja.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new Ux(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};Ja.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]};Ja.prototype.toGeoJSON=$x.prototype.toGeoJSON});var Ay=ve((lT,Fi)=>{var jx=mi(),wy=Py();Fi.exports=Ul;Fi.exports.fromVectorTileJs=Ul;Fi.exports.fromGeojsonVt=qx;Fi.exports.GeoJSONWrapper=wy;function Ul(t){var e=new jx;return Wx(t,e),e.finish()}function qx(t,e){e=e||{};var r={};for(var n in t)r[n]=new wy(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Ul({layers:r})}function Wx(t,e){for(var r in t.layers)e.writeMessage(3,Xx,t.layers[r])}function Xx(t,e){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r,n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,Hx,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)e.writeMessage(4,Yx,o[r])}function Hx(t,e){var r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,Zx,t),e.writeVarintField(3,r.type),e.writeMessage(4,Jx,r)}function Zx(t,e){var r=t.feature,n=t.keys,i=t.values,o=t.keycache,a=t.valuecache;for(var s in r.properties){var l=r.properties[s],u=o[s];if(l!==null){typeof u>"u"&&(n.push(s),u=n.length-1,o[s]=u),e.writeVarint(u);var c=typeof l;c!=="string"&&c!=="boolean"&&c!=="number"&&(l=JSON.stringify(l));var p=c+":"+l,f=a[p];typeof f>"u"&&(i.push(l),f=i.length-1,a[p]=f),e.writeVarint(f)}}}function Nl(t,e){return(e<<3)+(t&7)}function Sy(t){return t<<1^t>>31}function Jx(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;s<a;s++){var l=r[s],u=1;n===1&&(u=l.length),e.writeVarint(Nl(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&e.writeVarint(Nl(2,c-1));var f=l[p].x-i,y=l[p].y-o;e.writeVarint(Sy(f)),e.writeVarint(Sy(y)),i+=f,o+=y}n===3&&e.writeVarint(Nl(7,1))}}function Yx(t,e){var r=typeof t;r==="string"?e.writeStringField(1,t):r==="boolean"?e.writeBooleanField(7,t):r==="number"&&(t%1!==0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}});var km=Y(ye(),1),Pu=Y(uu(),1);var ls;function cu(){return ls==null&&(ls=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ls}var qi;function pu(){if(qi==null&&(qi=!1,cu())){let r=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(r){for(let i=0;i<25;i++){let o=i*4;r.fillStyle=`rgb(${o},${o+1},${o+2})`,r.fillRect(i%5,Math.floor(i/5),1,1)}let n=r.getImageData(0,0,5,5).data;for(let i=0;i<100;i++)if(i%4!==3&&n[i]!==i){qi=!0;break}}}return qi||!1}var Jr=1e-6,Yr=typeof Float32Array<"u"?Float32Array:Array,Kr=Math.random;var d0=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Wi={};Xy(Wi,{add:()=>em,ceil:()=>tm,clone:()=>Jy,copy:()=>Ky,create:()=>fu,cross:()=>fm,dist:()=>Am,distance:()=>du,div:()=>wm,divide:()=>hu,dot:()=>pm,equals:()=>vm,exactEquals:()=>xm,floor:()=>rm,forEach:()=>Cm,fromValues:()=>Yy,inverse:()=>um,len:()=>Im,length:()=>bu,lerp:()=>ym,max:()=>im,min:()=>nm,mul:()=>Sm,multiply:()=>mu,negate:()=>lm,normalize:()=>cm,random:()=>mm,round:()=>om,scale:()=>am,scaleAndAdd:()=>sm,set:()=>Qy,sqrDist:()=>_m,sqrLen:()=>Tm,squaredDistance:()=>gu,squaredLength:()=>xu,str:()=>bm,sub:()=>Pm,subtract:()=>yu,transformMat4:()=>hm,transformQuat:()=>dm,zero:()=>gm});function fu(){var t=new Yr(4);return Yr!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Jy(t){var e=new Yr(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Yy(t,e,r,n){var i=new Yr(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function Ky(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Qy(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function em(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function yu(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function mu(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function hu(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function tm(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function rm(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function nm(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function im(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function om(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function am(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function sm(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}function du(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.hypot(r,n,i,o)}function gu(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o}function bu(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function xu(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function lm(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function um(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function cm(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a,t}function pm(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function fm(t,e,r,n){var i=r[0]*n[1]-r[1]*n[0],o=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],l=r[1]*n[3]-r[3]*n[1],u=r[2]*n[3]-r[3]*n[2],c=e[0],p=e[1],f=e[2],y=e[3];return t[0]=p*u-f*l+y*s,t[1]=-(c*u)+f*a-y*o,t[2]=c*l-p*a+y*i,t[3]=-(c*s)+p*o-f*i,t}function ym(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t}function mm(t,e){e=e||1;var r,n,i,o,a,s;do r=Kr()*2-1,n=Kr()*2-1,a=r*r+n*n;while(a>=1);do i=Kr()*2-1,o=Kr()*2-1,s=i*i+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return t[0]=e*r,t[1]=e*n,t[2]=e*i*l,t[3]=e*o*l,t}function hm(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function dm(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,p=u*i+l*n-a*o,f=u*o+a*i-s*n,y=-a*n-s*i-l*o;return t[0]=c*u+y*-a+p*-l-f*-s,t[1]=p*u+y*-s+f*-a-c*-l,t[2]=f*u+y*-l+c*-s-p*-a,t[3]=e[3],t}function gm(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function bm(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function xm(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function vm(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(r-a)<=Jr*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=Jr*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=Jr*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=Jr*Math.max(1,Math.abs(o),Math.abs(u))}var Pm=yu,Sm=mu,wm=hu,Am=du,_m=gu,Im=bu,Tm=xu,Cm=(function(){var t=fu();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),i?l=Math.min(i*r+n,e.length):l=e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}})();function Su(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Em(t,e,r,n){let i=new Pu.default(t,e,r,n);return o=>i.solve(o)}var A0=Em(.25,.1,.25,1);function it(t,e,r){return Math.min(r,Math.max(e,t))}function wu(t,e,r){let n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function de(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}function Au(t){return Math.log(t)/Math.LN2%1===0}function tn(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function _u(t,e,r){let n={};for(let i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function nt(t){return Array.isArray(t)?t.map(nt):typeof t=="object"&&t?tn(t,nt):t}var vu={};function ce(t){vu[t]||(typeof console<"u"&&console.warn(t),vu[t]=!0)}function ot(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function at(t){return typeof WorkerGlobalScope<"u"&&typeof t<"u"&&t instanceof WorkerGlobalScope}function vt(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function Mm(t,e,r,n,i){let o=Math.max(-e,0)*4,l=(Math.max(0,r)-r)*n*4+o,u=n*4,c=Math.max(0,e),p=Math.max(0,r),f=Math.min(t.width,e+n),y=Math.min(t.height,r+i);return{rect:{x:c,y:p,width:f-c,height:y-p},layout:[{offset:l,stride:u}]}}async function Lm(t,e,r,n,i){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(t,{timestamp:0});try{let a=o?.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error(`Unrecognized format ${a}`);let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,Mm(t,e,r,n,i)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{o.close()}}var Qr,en;function Fm(t,e,r,n,i){let o=t.width,a=t.height;(!Qr||!en)&&(Qr=new OffscreenCanvas(o,a),en=Qr.getContext("2d",{willReadFrequently:!0})),Qr.width=o,Qr.height=a,en.drawImage(t,0,0,o,a);let s=en.getImageData(e,r,n,i);return en.clearRect(0,0,o,a),s.data}async function Iu(t,e,r,n,i){if(pu())try{return await Lm(t,e,r,n,i)}catch{}return Fm(t,e,r,n,i)}function us(t,e,r,n){return t.addEventListener(e,r,n),{unsubscribe:()=>{t.removeEventListener(e,r,n)}}}function cs(t){return t*Math.PI/180}var Xi=25,Hi=0;var $t=class t{constructor(e,r,n){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],r=a[1],n=a[2],this.d=r+2*n;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=n,this.scale=r/e,this.uid=0;let o=n/r*e;this.min=-o,this.max=e+o}insert(e,r,n,i,o){this._forEachCell(r,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,n,i,o,a){this.cells[o].push(a)}query(e,r,n,i,o){let a=this.min,s=this.max;if(e<=a&&r<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(e,r,n,i,this._queryCell,l,u,o),l}}_queryCell(e,r,n,i,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let f=0;f<u.length;f++){let y=u[f];if(s[y]===void 0){let m=y*4;(l?l(p[m+0],p[m+1],p[m+2],p[m+3]):e<=p[m+2]&&r<=p[m+3]&&n>=p[m+0]&&i>=p[m+1])?(s[y]=!0,a.push(c[y])):s[y]=!1}}}}_forEachCell(e,r,n,i,o,a,s,l){let u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),f=this._convertToCellCoord(i);for(let y=u;y<=p;y++)for(let m=c;m<=f;m++){let h=this.d*m+y;if(!(l&&!l(this._convertFromCellCoord(y),this._convertFromCellCoord(m),this._convertFromCellCoord(y+1),this._convertFromCellCoord(m+1)))&&o.call(this,e,r,n,i,h,a,s,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,n=0;for(let a=0;a<this.cells.length;a++)n+=this.cells[a].length;let i=new Int32Array(r+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=r;for(let a=0;a<e.length;a++){let s=e[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+e.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+e.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(e,r){let n=e.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(e){return new t(e.buffer)}};var Dm=8,Vm={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Bm={"*":{type:"source"}},Rm=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],zm={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Om={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Gm={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Nm={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},Um={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},$m={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},jm={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},qm=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],Wm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Xm={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Hm={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Zm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Jm={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ym={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Km={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},eh={type:"array",value:"*"},th={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},rh={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},nh={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},ih={type:"array",value:"*",minimum:1},oh={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},ah={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sh={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},lh={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},uh=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],ch={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},ph={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},fh={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},yh={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},mh={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},hh={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},dh={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},gh={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},bh={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},xh={"*":{type:"string"}},P={$version:Dm,$root:Vm,sources:Bm,source:Rm,source_vector:zm,source_raster:Om,source_raster_dem:Gm,source_geojson:Nm,source_video:Um,source_image:$m,layer:jm,layout:qm,layout_background:Wm,layout_fill:Xm,layout_circle:Hm,layout_heatmap:Zm,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Jm,layout_symbol:Ym,layout_raster:Km,layout_hillshade:Qm,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:eh,filter_operator:th,geometry_type:rh,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:nh,expression:ih,light:oh,sky:ah,terrain:sh,projection:lh,paint:uh,paint_fill:ch,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:ph,paint_circle:fh,paint_heatmap:yh,paint_symbol:mh,paint_raster:hh,paint_hillshade:dh,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:gh,transition:bh,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:xh},vh=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var C=class{constructor(e,r,n,i){this.message=(e?`${e}: `:"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function xr(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}var Be=class extends Error{constructor(e,r){super(r),this.message=r,this.key=e}},vs=class t{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(e){return new t(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},wr={kind:"null"},k={kind:"number"},$={kind:"string"},U={kind:"boolean"},ze={kind:"color"},yo={kind:"projectionDefinition"},Wt={kind:"object"},N={kind:"value"},Ph={kind:"error"},mo={kind:"collator"},Ar={kind:"formatted"},ho={kind:"padding"},an={kind:"colorArray"},go={kind:"numberArray"},vn={kind:"resolvedImage"},bo={kind:"variableAnchorOffsetCollection"};function Ce(t,e){return{kind:"array",itemType:t,N:e}}function ie(t){if(t.kind==="array"){let e=ie(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}else return t.kind}var Sh=[wr,k,$,U,ze,yo,Ar,Wt,Ce(N),ho,go,an,vn,bo];function sn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!sn(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of Sh)if(!sn(r,e))return null}}return`Expected ${ie(t)} but found ${ie(e)} instead.`}function zs(t,e){return e.some(r=>r.kind===t.kind)}function Xt(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function Pt(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var Xu=.96422,Hu=1,Zu=.82521,Ju=4/29,br=6/29,Yu=3*br*br,wh=br*br*br,Ah=Math.PI/180,_h=180/Math.PI;function Ku(t){return t=t%360,t<0&&(t+=360),t}function Qu([t,e,r,n]){t=ps(t),e=ps(e),r=ps(r);let i,o,a=fs((.2225045*t+.7168786*e+.0606169*r)/Hu);t===e&&e===r?i=o=a:(i=fs((.4360747*t+.3850649*e+.1430804*r)/Xu),o=fs((.0139322*t+.0971045*e+.7141733*r)/Zu));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function ps(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fs(t){return t>wh?Math.pow(t,1/3):t/Yu+Ju}function ec([t,e,r,n]){let i=(t+16)/116,o=isNaN(e)?i:i+e/500,a=isNaN(r)?i:i-r/200;return i=Hu*ms(i),o=Xu*ms(o),a=Zu*ms(a),[ys(3.1338561*o-1.6168667*i-.4906146*a),ys(-.9787684*o+1.9161415*i+.033454*a),ys(.0719453*o-.2289914*i+1.4052427*a),n]}function ys(t){return t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055,t<0?0:t>1?1:t}function ms(t){return t>br?t*t*t:Yu*(t-Ju)}function Ih(t){let[e,r,n,i]=Qu(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?Ku(Math.atan2(n,r)*_h):NaN,o,e,i]}function Th([t,e,r,n]){return t=isNaN(t)?0:t*Ah,ec([r,Math.cos(t)*e,Math.sin(t)*e,n])}function Ch([t,e,r,n]){t=Ku(t),e/=100,r/=100;function i(o){let a=(o+t/30)%12,s=e*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4),n]}var kh=Object.hasOwn||function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};function nn(t,e){return kh(t,e)?t[e]:void 0}function Eh(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=nn(Mh,t);if(e){let[i,o,a]=e;return[i/255,o/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let o=t.length<6?1:2,a=1;return[Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+o)||"ff")]}if(t.startsWith("rgb")){let i=/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,o=t.match(i);if(o){let[a,s,l,u,c,p,f,y,m,h,g,d]=o,x=[u||" ",f||" ",h].join("");if(x===" "||x===" /"||x===",,"||x===",,,"){let b=[l,p,m].join(""),v=b==="%%%"?100:b===""?255:0;if(v){let S=[dr(+s/v,0,1),dr(+c/v,0,1),dr(+y/v,0,1),g?Tu(+g,d):1];if(Cu(S))return S}}return}}let r=/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,n=t.match(r);if(n){let[i,o,a,s,l,u,c,p,f]=n,y=[a||" ",l||" ",c].join("");if(y===" "||y===" /"||y===",,"||y===",,,"){let m=[+o,dr(+s,0,100),dr(+u,0,100),p?Tu(+p,f):1];if(Cu(m))return Ch(m)}}}function Zi(t){return parseInt(t.padEnd(2,t),16)/255}function Tu(t,e){return dr(e?t/100:t,0,1)}function dr(t,e,r){return Math.min(Math.max(e,t),r)}function Cu(t){return!t.some(Number.isNaN)}var Mh={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function wt(t,e,r){return t+r*(e-t)}function vr(t,e,r){return t.map((n,i)=>wt(n,e[i],r))}function Lh(t){return t==="rgb"||t==="hcl"||t==="lab"}var H=class t{constructor(e,r,n,i=1,o=!0){this.r=e,this.g=r,this.b=n,this.a=i,o||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,r,n,i]))}static parse(e){if(e instanceof t)return e;if(typeof e!="string")return;let r=Eh(e);if(r)return new t(...r,!1)}get rgb(){let{r:e,g:r,b:n,a:i}=this,o=i||1/0;return this.overwriteGetter("rgb",[e/o,r/o,n/o,i])}get hcl(){return this.overwriteGetter("hcl",Ih(this.rgb))}get lab(){return this.overwriteGetter("lab",Qu(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return`rgba(${[e,r,n].map(o=>Math.round(o*255)).join(",")},${i})`}static interpolate(e,r,n,i="rgb"){switch(i){case"rgb":{let[o,a,s,l]=vr(e.rgb,r.rgb,n);return new t(o,a,s,l,!1)}case"hcl":{let[o,a,s,l]=e.hcl,[u,c,p,f]=r.hcl,y,m;if(!isNaN(o)&&!isNaN(u)){let b=u-o;u>o&&b>180?b-=360:u<o&&o-u>180&&(b+=360),y=o+n*b}else isNaN(o)?isNaN(u)?y=NaN:(y=u,(s===1||s===0)&&(m=c)):(y=o,(p===1||p===0)&&(m=a));let[h,g,d,x]=Th([y,m??wt(a,c,n),wt(s,p,n),wt(l,f,n)]);return new t(h,g,d,x,!1)}case"lab":{let[o,a,s,l]=ec(vr(e.lab,r.lab,n));return new t(o,a,s,l,!1)}}}};H.black=new H(0,0,0,1);H.white=new H(1,1,1,1);H.transparent=new H(0,0,0,0);H.red=new H(1,0,0,1);var ln=class{constructor(e,r,n){e?this.sensitivity=r?"variant":"case":this.sensitivity=r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Fh=["bottom","center","top"],un=class{constructor(e,r,n,i,o,a){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o,this.verticalAlign=a}},Ee=class t{constructor(e){this.sections=e}static fromString(e){return new t([new un(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof t?e:t.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Oe=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(vr(e.values,r.values,n))}},Ge=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(vr(e.values,r.values,n))}},Pe=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="string"){let n=H.parse(e);return n?new t([n]):void 0}if(!Array.isArray(e))return;let r=[];for(let n of e){if(typeof n!="string")return;let i=H.parse(n);if(!i)return;r.push(i)}return new t(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n,i="rgb"){let o=[];if(e.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let a=0;a<e.values.length;a++)o.push(H.interpolate(e.values[a],r.values[a],n,i));return new t(o)}},ne=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},Dh=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Me=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let r=0;r<e.length;r+=2){let n=e[r],i=e[r+1];if(typeof n!="string"||!Dh.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){let i=e.values,o=r.values;if(i.length!==o.length)throw new ne(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${r.toString()}`);let a=[];for(let s=0;s<i.length;s+=2){if(i[s]!==o[s])throw new ne(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${i[s]}, to[${s}]: ${o[s]}`);a.push(i[s]);let[l,u]=i[s+1],[c,p]=o[s+1];a.push([wt(l,c,n),wt(u,p,n)])}return new t(a)}},Se=class t{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new t({name:e,available:!1}):null}},At=class t{constructor(e,r,n){this.from=e,this.to=r,this.transition=n}static interpolate(e,r,n){return new t(e,r,n)}static parse(e){if(e instanceof t)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new t(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new t(e.from,e.to,e.transition);if(typeof e=="string")return new t(e,e,1)}};function tc(t,e,r,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,r,n]:[t,e,r]).join(", ")}]: \'r\', \'g\', and \'b\' must be between 0 and 255.`}function cn(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof At||t instanceof H||t instanceof ln||t instanceof Ee||t instanceof Oe||t instanceof Ge||t instanceof Pe||t instanceof Me||t instanceof Se)return!0;if(Array.isArray(t)){for(let e of t)if(!cn(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!cn(t[e]))return!1;return!0}else return!1}function ue(t){if(t===null)return wr;if(typeof t=="string")return $;if(typeof t=="boolean")return U;if(typeof t=="number")return k;if(t instanceof H)return ze;if(t instanceof At)return yo;if(t instanceof ln)return mo;if(t instanceof Ee)return Ar;if(t instanceof Oe)return ho;if(t instanceof Ge)return go;if(t instanceof Pe)return an;if(t instanceof Me)return bo;if(t instanceof Se)return vn;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=ue(n);if(!r)r=i;else{if(r===i)continue;r=N;break}}return Ce(r||N,e)}else return Wt}function on(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof H||t instanceof At||t instanceof Ee||t instanceof Oe||t instanceof Ge||t instanceof Pe||t instanceof Me||t instanceof Se?t.toString():JSON.stringify(t)}var _t=class t{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`\'literal\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!cn(e[1]))return r.error("invalid value");let n=e[1],i=ue(n),o=r.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new t(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Ji={string:$,number:k,boolean:U,object:Wt},$e=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=1,i,o=e[0];if(o==="array"){let s;if(e.length>2){let u=e[1];if(typeof u!="string"||!(u in Ji)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=Ji[u],n++}else s=N;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=e[2],n++}i=Ce(s,l)}else{if(!Ji[o])throw new Error(`Types doesn\'t contain name = ${o}`);i=Ji[o]}let a=[];for(;n<e.length;n++){let s=r.parse(e[n],n,N);if(!s)return null;a.push(s)}return new t(i,a)}evaluate(e){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(e);if(sn(this.type,ue(n))){if(r===this.args.length-1)throw new ne(`Expected value to be of type ${ie(this.type)}, but found ${ie(ue(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},ku={"to-boolean":U,"to-color":ze,"to-number":k,"to-string":$},St=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[0];if(!ku[n])throw new Error(`Can\'t parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=ku[n],o=[];for(let a=1;a<e.length;a++){let s=r.parse(e[a],a,N);if(!s)return null;o.push(s)}return new t(i,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,n;for(let i of this.args){if(r=i.evaluate(e),n=null,r instanceof H)return r;if(typeof r=="string"){let o=e.parseColor(r);if(o)return o}else if(Array.isArray(r)&&(r.length<3||r.length>4?n=`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:n=tc(r[0],r[1],r[2],r[3]),!n))return new H(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ne(n||`Could not parse color from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"padding":{let r;for(let n of this.args){r=n.evaluate(e);let i=Oe.parse(r);if(i)return i}throw new ne(`Could not parse padding from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"numberArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ge.parse(r);if(i)return i}throw new ne(`Could not parse numberArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"colorArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=Pe.parse(r);if(i)return i}throw new ne(`Could not parse colorArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=Me.parse(r);if(i)return i}throw new ne(`Could not parse variableAnchorOffsetCollection from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(e),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new ne(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Ee.fromString(on(this.args[0].evaluate(e)));case"resolvedImage":return Se.fromString(on(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return on(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Vh=["Unknown","Point","LineString","Polygon"],eo=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Vh[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache.get(e);return r||(r=H.parse(e),this._parseColorCache.set(e,r)),r}},to=class t{constructor(e,r,n=[],i,o=new vs,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>`[${s}]`).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=r}parse(e,r,n,i,o={}){return r?this.concat(r,n,i)._parse(e,o):this._parse(e,o)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,o,a){return a==="assert"?new $e(o,[i]):a==="coerce"?new St(o,[i]):i}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let i=e[0];if(typeof i!="string")return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let o=this.registry[i];if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=n(a,s,r.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(l.kind)||s.kind==="colorArray"&&["value","string","array"].includes(l.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof _t)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new eo;try{a=new _t(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,n){let i=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new t(this.registry,this._isConstant,i,r||null,o,this.errors)}error(e,...r){let n=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new Be(n,e))}checkSubtype(e,r){let n=sn(e,r);return n&&this.error(n),n}},ro=class t{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return r.error(`Expected string, but found ${typeof a} instead.`,o);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or \'_\'.",o);let s=r.parse(e[o+1],o+1);if(!s)return null;n.push([a,s])}let i=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return i?new t(n,i):null}outputDefined(){return this.result.outputDefined()}},no=class t{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("\'var\' expression requires exactly one string literal argument.");let n=e[1];return r.scope.has(n)?new t(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Ps=class t{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,k),i=r.parse(e[2],2,Ce(r.expectedType||N));if(!n||!i)return null;let o=i.type;return new t(o.itemType,n,i)}evaluate(e){let r=this.index.evaluate(e),n=this.input.evaluate(e);if(r<0)throw new ne(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new ne(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new ne(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Ss=class t{constructor(e,r){this.type=U,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,N),i=r.parse(e[2],2,N);return!n||!i?null:zs(n.type,[U,$,k,wr,N])?new t(n,i):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(n.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!Xt(r,["boolean","string","number","null"]))throw new ne(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ue(r))} instead.`);if(!Xt(n,["string","array"]))throw new ne(`Expected second argument to be of type array or string, but found ${ie(ue(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},ws=class t{constructor(e,r,n){this.type=k,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,N),i=r.parse(e[2],2,N);if(!n||!i)return null;if(!zs(n.type,[U,$,k,wr,N]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(n.type)} instead`);if(e.length===4){let o=r.parse(e[3],3,k);return o?new t(n,i,o):null}else return new t(n,i)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!Xt(r,["boolean","string","number","null"]))throw new ne(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ue(r))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),Xt(n,["string"])){let o=n.indexOf(r,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(Xt(n,["array"]))return n.indexOf(r,i);throw new ne(`Expected second argument to be of type array or string, but found ${ie(ue(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},As=class t{constructor(e,r,n,i,o,a){this.inputType=e,this.type=r,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let o={},a=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let f=r.concat(u);if(c.length===0)return f.error("Expected at least one branch label.");for(let m of c){if(typeof m!="number"&&typeof m!="string")return f.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return f.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof m=="number"&&Math.floor(m)!==m)return f.error("Numeric branch labels must be integer values.");if(!n)n=ue(m);else if(f.checkSubtype(n,ue(m)))return null;if(typeof o[String(m)]<"u")return f.error("Branch labels must be unique.");o[String(m)]=a.length}let y=r.parse(p,u,i);if(!y)return null;i=i||y.type,a.push(y)}let s=r.parse(e[1],1,N);if(!s)return null;let l=r.parse(e[e.length-1],e.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new t(n,i,s,o,a,l)}evaluate(e){let r=this.input.evaluate(e);return(ue(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},_s=class t{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let a=1;a<e.length-1;a+=2){let s=r.parse(e[a],a,U);if(!s)return null;let l=r.parse(e[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=r.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can\'t infer output type");return new t(n,i,o)}evaluate(e){for(let[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},Is=class t{constructor(e,r,n,i){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,N),i=r.parse(e[2],2,k);if(!n||!i)return null;if(!zs(n.type,[Ce(N),$,N]))return r.error(`Expected first argument to be of type array or string, but found ${ie(n.type)} instead`);if(e.length===4){let o=r.parse(e[3],3,k);return o?new t(n.type,n,i,o):null}else return new t(n.type,n,i)}evaluate(e){let r=this.input.evaluate(e),n=this.beginIndex.evaluate(e),i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),Xt(r,["string"]))return[...r].slice(n,i).join("");if(Xt(r,["array"]))return r.slice(n,i);throw new ne(`Expected first argument to be of type array or string, but found ${ie(ue(r))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function xo(t,e){let r=t.length-1,n=0,i=r,o=0,a,s;for(;n<=i;)if(o=Math.floor((n+i)/2),a=t[o],s=t[o+1],a<=e){if(o===r||e<s)return o;n=o+1}else if(a>e)i=o-1;else throw new ne("Input is not a number.");return 0}var Pr=class t{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(e[1],1,k);if(!n)return null;let i=[],o=null;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);for(let a=1;a<e.length;a+=2){let s=a===1?-1/0:e[a],l=e[a+1],u=a,c=a+1;if(typeof s!="number")return r.error(\'Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',u);if(i.length&&i[i.length-1][0]>=s)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let p=r.parse(l,c,o);if(!p)return null;o=o||p.type,i.push([s,p])}return new t(o,n,i)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=xo(r,i);return n[a].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Bh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hs,Eu;function Rh(){if(Eu)return hs;Eu=1,hs=t;function t(e,r,n,i){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(i-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=n,this.p2y=i}return t.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,r){if(r===void 0&&(r=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,i=0;i<8;i++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<r)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n=n-o/a}var s=0,l=1;for(n=e,i=0;i<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<r));i++)e>o?s=n:l=n,n=(l-s)*.5+s;return n},solve:function(e,r){return this.sampleCurveY(this.solveCurveX(e,r))}},hs}var zh=Rh(),Oh=Bh(zh),ke=class t{constructor(e,r,n,i,o){this.type=e,this.operator=r,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(e,r,n,i){let o=0;if(e.name==="exponential")o=ds(r,e.base,n,i);else if(e.name==="linear")o=ds(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new Oh(a[0],a[1],a[2],a[3]).solve(ds(r,1,n,i))}return o}static parse(e,r){let[n,i,o,...a]=e;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(i[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,k),!o)return null;let s=[],l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&r.expectedType!=an?l=ze:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],f=u+3,y=u+4;if(typeof c!="number")return r.error(\'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',f);if(s.length&&s[s.length-1][0]>=c)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',f);let m=r.parse(p,y,l);if(!m)return null;l=l||m.type,s.push([c,m])}return!Pt(l,k)&&!Pt(l,yo)&&!Pt(l,ze)&&!Pt(l,ho)&&!Pt(l,go)&&!Pt(l,an)&&!Pt(l,bo)&&!Pt(l,Ce(k))?r.error(`Type ${ie(l)} is not interpolatable.`):new t(l,n,i,o,s)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=xo(r,i),s=r[a],l=r[a+1],u=t.interpolationFactor(this.interpolation,i,s,l),c=n[a].evaluate(e),p=n[a+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return wt(c,p,u);case"color":return H.interpolate(c,p,u);case"padding":return Oe.interpolate(c,p,u);case"colorArray":return Pe.interpolate(c,p,u);case"numberArray":return Ge.interpolate(c,p,u);case"variableAnchorOffsetCollection":return Me.interpolate(c,p,u);case"array":return vr(c,p,u);case"projectionDefinition":return At.interpolate(c,p,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return H.interpolate(c,p,u,"hcl");case"colorArray":return Pe.interpolate(c,p,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return H.interpolate(c,p,u,"lab");case"colorArray":return Pe.interpolate(c,p,u,"lab")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function ds(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var lt={color:H.interpolate,number:wt,padding:Oe.interpolate,numberArray:Ge.interpolate,colorArray:Pe.interpolate,variableAnchorOffsetCollection:Me.interpolate,array:vr},io=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of e.slice(1)){let l=r.parse(s,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return i&&o.some(s=>sn(i,s.type))?new t(N,o):new t(n,o)}evaluate(e){let r=null,n=0,i;for(let o of this.args)if(n++,r=o.evaluate(e),r&&r instanceof Se&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function Mu(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Gh(t,e,r){return e===r}function Nh(t,e,r){return e!==r}function Uh(t,e,r){return e<r}function $h(t,e,r){return e>r}function jh(t,e,r){return e<=r}function qh(t,e,r){return e>=r}function rc(t,e,r,n){return n.compare(e,r)===0}function Wh(t,e,r,n){return!rc(t,e,r,n)}function Xh(t,e,r,n){return n.compare(e,r)<0}function Hh(t,e,r,n){return n.compare(e,r)>0}function Zh(t,e,r,n){return n.compare(e,r)<=0}function Jh(t,e,r,n){return n.compare(e,r)>=0}function _r(t,e,r){let n=t!=="=="&&t!=="!=";return class nc{constructor(o,a,s){this.type=U,this.lhs=o,this.rhs=a,this.collator=s,this.hasUntypedArgument=o.type.kind==="value"||a.type.kind==="value"}static parse(o,a){if(o.length!==3&&o.length!==4)return a.error("Expected two or three arguments.");let s=o[0],l=a.parse(o[1],1,N);if(!l)return null;if(!Mu(s,l.type))return a.concat(1).error(`"${s}" comparisons are not supported for type \'${ie(l.type)}\'.`);let u=a.parse(o[2],2,N);if(!u)return null;if(!Mu(s,u.type))return a.concat(2).error(`"${s}" comparisons are not supported for type \'${ie(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error(`Cannot compare types \'${ie(l.type)}\' and \'${ie(u.type)}\'.`);n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new $e(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new $e(l.type,[u])));let c=null;if(o.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(c=a.parse(o[3],3,mo),!c)return null}return new nc(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new ne(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!=="string"||u.kind!=="string")return e(o,a,s)}return this.collator?r(o,a,s,this.collator.evaluate(o)):e(o,a,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}var Yh=_r("==",Gh,rc),Kh=_r("!=",Nh,Wh),Qh=_r("<",Uh,Xh),ed=_r(">",$h,Hh),td=_r("<=",jh,Zh),rd=_r(">=",qh,Jh),oo=class t{constructor(e,r,n){this.type=mo,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,U);if(!i)return null;let o=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,U);if(!o)return null;let a=null;return n.locale&&(a=r.parse(n.locale,1,$),!a)?null:new t(i,o,a)}evaluate(e){return new ln(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},Ts=class t{constructor(e,r,n,i,o){this.type=$,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let n=r.parse(e[1],1,k);if(!n)return null;let i=e[2];if(typeof i!="object"||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=r.parse(i.locale,1,$),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,$),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,k),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,k),!l)?null:new t(n,o,a,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},pn=class t{constructor(e){this.type=Ar,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");let i=[],o=!1;for(let a=1;a<=e.length-1;++a){let s=e[a];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let l=null;if(s["font-scale"]&&(l=r.parse(s["font-scale"],1,k),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Ce($)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,ze),!c))return null;let p=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!Fh.includes(s["vertical-align"]))return r.error(`\'vertical-align\' must be one of: \'bottom\', \'center\', \'top\' but found \'${s["vertical-align"]}\' instead.`);if(p=r.parse(s["vertical-align"],1,$),!p)return null}let f=i[i.length-1];f.scale=l,f.font=u,f.textColor=c,f.verticalAlign=p}else{let l=r.parse(e[a],1,N);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");o=!0,i.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new t(i)}evaluate(e){let r=n=>{let i=n.content.evaluate(e);return ue(i)===vn?new un("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new un(on(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new Ee(this.sections.map(r))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}},Cs=class t{constructor(e){this.type=vn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,$);return n?new t(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Se.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},ks=class t{constructor(e){this.type=k,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${ie(n.type)} instead.`):new t(n):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ne(`Expected value to be of type string or array, but found ${ie(ue(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},He=8192;function nd(t,e){let r=id(t[0]),n=ad(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*He),Math.round(n*i*He)]}function Os(t,e){let r=Math.pow(2,e.z),n=(t[0]/He+e.x)/r,i=(t[1]/He+e.y)/r;return[od(n),sd(i)]}function id(t){return(180+t)/360}function od(t){return t*360-180}function ad(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function sd(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function Pn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function fn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ld(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function ud(t,e,r){let n=t[0]-e[0],i=t[1]-e[1],o=t[0]-r[0],a=t[1]-r[1];return n*a-o*i===0&&n*o<=0&&i*a<=0}function vo(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return yd(o,i)===0?!1:!!(Lu(t,e,r,n)&&Lu(r,n,t,e))}function cd(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(vo(t,e,n[i],n[i+1]))return!0;return!1}function Ir(t,e,r=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(ud(t,i[o],i[o+1]))return r;ld(t,i[o],i[o+1])&&(n=!n)}return n}function pd(t,e){for(let r of e)if(Ir(t,r))return!0;return!1}function ic(t,e){for(let r of t)if(!Ir(r,e))return!1;for(let r=0;r<t.length-1;++r)if(cd(t[r],t[r+1],e))return!1;return!0}function fd(t,e){for(let r of e)if(ic(t,r))return!0;return!1}function yd(t,e){return t[0]*e[1]-t[1]*e[0]}function Lu(t,e,r,n){let i=t[0]-r[0],o=t[1]-r[1],a=e[0]-r[0],s=e[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function Gs(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=[];for(let a=0;a<t[i].length;a++){let s=nd(t[i][a],r);Pn(e,s),o.push(s)}n.push(o)}return n}function oc(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=Gs(t[i],e,r);n.push(o)}return n}function ac(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){let i=n*.5,o=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;o===0&&(o=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=o}Pn(e,t)}function md(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function Fu(t,e,r,n){let i=Math.pow(2,n.z)*He,o=[n.x*He,n.y*He],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];ac(u,e,r,i),a.push(u)}return a}function Du(t,e,r,n){let i=Math.pow(2,n.z)*He,o=[n.x*He,n.y*He],a=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Pn(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){md(e);for(let s of a)for(let l of s)ac(l,e,r,i)}return a}function hd(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=Gs(e.coordinates,n,i),a=Fu(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!Ir(s,o))return!1}if(e.type==="MultiPolygon"){let o=oc(e.coordinates,n,i),a=Fu(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!pd(s,o))return!1}return!0}function dd(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=Gs(e.coordinates,n,i),a=Du(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!ic(s,o))return!1}if(e.type==="MultiPolygon"){let o=oc(e.coordinates,n,i),a=Du(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!fd(s,o))return!1}return!0}var yn=class t{constructor(e,r){this.type=U,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'within\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(cn(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let i=[];for(let o of n.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&i.push(s),a==="MultiPolygon"&&i.push(...s)}if(i.length){let o={type:"MultiPolygon",coordinates:i};return new t(n,o)}}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new t(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new t(n,n)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return hd(e,this.geometries);if(e.geometryType()==="LineString")return dd(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},ao=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};function sc(t,e,r=0,n=t.length-1,i=gd){for(;n>r;){if(n-r>600){let l=n-r+1,u=e-r+1,c=Math.log(l),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(l-p)/l)*(u-l/2<0?-1:1),y=Math.max(r,Math.floor(e-u*p/l+f)),m=Math.min(n,Math.floor(e+(l-u)*p/l+f));sc(t,e,y,m,i)}let o=t[e],a=r,s=n;for(rn(t,r,e),i(t[n],o)>0&&rn(t,r,n);a<s;){for(rn(t,a,s),a++,s--;i(t[a],o)<0;)a++;for(;i(t[s],o)>0;)s--}i(t[r],o)===0?rn(t,r,s):(s++,rn(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}}function rn(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function gd(t,e){return t<e?-1:t>e?1:0}function Yt(t,e){if(t.length<=1)return[t];let n=[],i,o;for(let a of t){let s=xd(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[a]):i.push(a))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(sc(n[a],e,1,n[a].length-1,bd),n[a]=n[a].slice(0,e));return n}function bd(t,e){return e.area-t.area}function xd(t){let e=0;for(let r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}var vd=6378.137,Vu=1/298.257223563,Bu=Vu*(2-Vu),Ru=Math.PI/180,mn=class{constructor(e){let r=Ru*vd*1e3,n=Math.cos(e*Ru),i=1/(1-Bu*(1-n*n)),o=Math.sqrt(i);this.kx=r*o*n,this.ky=r*o*i*(1-Bu)}distance(e,r){let n=this.wrap(e[0]-r[0])*this.kx,i=(e[1]-r[1])*this.ky;return Math.sqrt(n*n+i*i)}pointOnLine(e,r){let n=1/0,i,o,a,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,f=(e[l+1][1]-c)*this.ky,y=0;(p!==0||f!==0)&&(y=(this.wrap(r[0]-u)*this.kx*p+(r[1]-c)*this.ky*f)/(p*p+f*f),y>1?(u=e[l+1][0],c=e[l+1][1]):y>0&&(u+=p/this.kx*y,c+=f/this.ky*y)),p=this.wrap(r[0]-u)*this.kx,f=(r[1]-c)*this.ky;let m=p*p+f*f;m<n&&(n=m,i=u,o=c,a=l,s=y)}return{point:[i,o],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},Es=100,Ms=50;function lc(t,e){return e[0]-t[0]}function so(t){return t[1]-t[0]+1}function st(t,e){return t[1]>=t[0]&&t[1]<e}function Ls(t,e){if(t[0]>t[1])return[null,null];let r=so(t);if(e){if(r===2)return[t,null];let i=Math.floor(r/2);return[[t[0],t[0]+i],[t[0]+i,t[1]]]}if(r===1)return[t,null];let n=Math.floor(r/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function Fs(t,e){if(!st(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)Pn(r,t[n]);return r}function Ds(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)Pn(e,n);return e}function zu(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Ns(t,e,r){if(!zu(t)||!zu(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function qt(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function Us(t,e,r,n,i){let o=Math.min(qt(t,[r,n],i),qt(e,[r,n],i)),a=Math.min(qt(r,[t,e],i),qt(n,[t,e],i));return Math.min(o,a)}function Pd(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let l=t[s],u=t[s+1];for(let c=n[0];c<n[1];++c){let p=r[c],f=r[c+1];if(vo(l,u,p,f))return 0;a=Math.min(a,Us(l,u,p,f,i))}}return a}function Sd(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let l=n[0];l<=n[1];++l)if(a=Math.min(a,i.distance(t[s],r[l])),a===0)return a;return a}function wd(t,e,r){if(Ir(t,e,!0))return 0;let n=1/0;for(let i of e){let o=i[0],a=i[i.length-1];if(o!==a&&(n=Math.min(n,qt(t,[a,o],r)),n===0))return n;let s=r.pointOnLine(i,t);if(n=Math.min(n,r.distance(t,s.point)),n===0)return n}return n}function Ad(t,e,r,n){if(!st(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Ir(t[o],r,!0))return 0;let i=1/0;for(let o=e[0];o<e[1];++o){let a=t[o],s=t[o+1];for(let l of r)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let f=l[p],y=l[u];if(vo(a,s,f,y))return 0;i=Math.min(i,Us(a,s,f,y,n))}}return i}function Ou(t,e){for(let r of t)for(let n of r)if(Ir(n,e,!0))return!0;return!1}function _d(t,e,r,n=1/0){let i=Ds(t),o=Ds(e);if(n!==1/0&&Ns(i,o,r)>=n)return n;if(fn(i,o)){if(Ou(t,e))return 0}else if(Ou(e,t))return 0;let a=1/0;for(let s of t)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],f=s[l];for(let y of e)for(let m=0,h=y.length,g=h-1;m<h;g=m++){let d=y[g],x=y[m];if(vo(p,f,d,x))return 0;a=Math.min(a,Us(p,f,d,x,r))}}return a}function Gu(t,e,r,n,i,o){if(!o)return;let a=Ns(Fs(n,o),i,r);a<e&&t.push([a,o,[0,0]])}function Yi(t,e,r,n,i,o,a){if(!o||!a)return;let s=Ns(Fs(n,o),Fs(i,a),r);s<e&&t.push([s,o,a])}function lo(t,e,r,n,i=1/0){let o=Math.min(n.distance(t[0],r[0][0]),i);if(o===0)return o;let a=new ao([[0,[0,t.length-1],[0,0]]],lc),s=Ds(r);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?Ms:Es;if(so(u)<=c){if(!st(u,t.length))return NaN;if(e){let p=Ad(t,u,r,n);if(isNaN(p)||p===0)return p;o=Math.min(o,p)}else for(let p=u[0];p<=u[1];++p){let f=wd(t[p],r,n);if(o=Math.min(o,f),o===0)return 0}}else{let p=Ls(u,e);Gu(a,o,n,t,s,p[0]),Gu(a,o,n,t,s,p[1])}}return o}function uo(t,e,r,n,i,o=1/0){let a=Math.min(o,i.distance(t[0],r[0]));if(a===0)return a;let s=new ao([[0,[0,t.length-1],[0,r.length-1]]],lc);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?Ms:Es,f=n?Ms:Es;if(so(u)<=p&&so(c)<=f){if(!st(u,t.length)&&st(c,r.length))return NaN;let y;if(e&&n)y=Pd(t,u,r,c,i),a=Math.min(a,y);else if(e&&!n){let m=t.slice(u[0],u[1]+1);for(let h=c[0];h<=c[1];++h)if(y=qt(r[h],m,i),a=Math.min(a,y),a===0)return a}else if(!e&&n){let m=r.slice(c[0],c[1]+1);for(let h=u[0];h<=u[1];++h)if(y=qt(t[h],m,i),a=Math.min(a,y),a===0)return a}else y=Sd(t,u,r,c,i),a=Math.min(a,y)}else{let y=Ls(u,e),m=Ls(c,n);Yi(s,a,i,t,r,y[0],m[0]),Yi(s,a,i,t,r,y[0],m[1]),Yi(s,a,i,t,r,y[1],m[0]),Yi(s,a,i,t,r,y[1],m[1])}}return a}function Id(t,e){let r=t.geometry(),n=r.flat().map(a=>Os([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new mn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,uo(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,uo(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,lo(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function Td(t,e){let r=t.geometry(),n=r.flat().map(a=>Os([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new mn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,uo(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,uo(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,lo(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function Cd(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=Yt(r,0).map(a=>a.map(s=>s.map(l=>Os([l.x,l.y],t.canonical)))),i=new mn(n[0][0][0][1]),o=1/0;for(let a of e)for(let s of n){switch(a.type){case"Point":o=Math.min(o,lo([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,lo(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,_d(s,a.coordinates,i,o));break}if(o===0)return o}return o}function gs(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var hn=class t{constructor(e,r){this.type=k,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'distance\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(cn(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>gs(i.geometry)).flat());if(n.type==="Feature")return new t(n,gs(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,gs(n))}return r.error("\'distance\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Id(e,this.geometries);if(e.geometryType()==="LineString")return Td(e,this.geometries);if(e.geometryType()==="Polygon")return Cd(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},dn=class t{constructor(e){this.type=N,this.key=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=e[1];return n==null?r.error("Global state property must be defined."):typeof n!="string"?r.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new t(n)}evaluate(e){var r;let n=(r=e.globals)===null||r===void 0?void 0:r.globalState;return!n||Object.keys(n).length===0?null:nn(n,this.key)}eachChild(){}outputDefined(){return!1}},Kt={"==":Yh,"!=":Kh,">":ed,"<":Qh,">=":rd,"<=":td,array:$e,at:Ps,boolean:$e,case:_s,coalesce:io,collator:oo,format:pn,image:Cs,in:Ss,"index-of":ws,interpolate:ke,"interpolate-hcl":ke,"interpolate-lab":ke,length:ks,let:ro,literal:_t,match:As,number:$e,"number-format":Ts,object:$e,slice:Is,step:Pr,string:$e,"to-boolean":St,"to-color":St,"to-number":St,"to-string":St,var:no,within:yn,distance:hn,"global-state":dn},Ze=class t{constructor(e,r,n,i){this.name=e,this.type=r,this._evaluate=n,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let n=e[0],i=t.definitions[n];if(!i)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new to(r.registry,co,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<e.length;y++){let m=e[y],h=Array.isArray(u)?u[y-1]:u.type,g=l.parse(m,1+p.length,h);if(!g){f=!0;break}p.push(g)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error(`Expected ${u.length} arguments, but found ${p.length} instead.`);continue}for(let y=0;y<p.length;y++){let m=Array.isArray(u)?u[y]:u.type,h=p[y];l.concat(y+1).checkSubtype(m,h.type)}if(l.errors.length===0)return new t(n,o,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:a).map(([f])=>Ed(f)).join(" | "),p=[];for(let f=1;f<e.length;f++){let y=r.parse(e[f],1+p.length);if(!y)return null;p.push(ie(y.type))}r.error(`Expected arguments of type ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function Nu(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);let o=i?i.evaluate(t):1,a=tc(e,r,n,o);if(a)throw new ne(a);return new H(e/255,r/255,n/255,o,!1)}function Uu(t,e){return t in e}function bs(t,e){let r=e[t];return typeof r>"u"?null:r}function kd(t,e,r,n){for(;r<=n;){let i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}function jt(t){return{type:t}}Ze.register(Kt,{error:[Ph,[$],(t,[e])=>{throw new ne(e.evaluate(t))}],typeof:[$,[N],(t,[e])=>ie(ue(e.evaluate(t)))],"to-rgba":[Ce(k,4),[ze],(t,[e])=>{let[r,n,i,o]=e.evaluate(t).rgb;return[r*255,n*255,i*255,o]}],rgb:[ze,[k,k,k],Nu],rgba:[ze,[k,k,k,k],Nu],has:{type:U,overloads:[[[$],(t,[e])=>Uu(e.evaluate(t),t.properties())],[[$,Wt],(t,[e,r])=>Uu(e.evaluate(t),r.evaluate(t))]]},get:{type:N,overloads:[[[$],(t,[e])=>bs(e.evaluate(t),t.properties())],[[$,Wt],(t,[e,r])=>bs(e.evaluate(t),r.evaluate(t))]]},"feature-state":[N,[$],(t,[e])=>bs(e.evaluate(t),t.featureState||{})],properties:[Wt,[],t=>t.properties()],"geometry-type":[$,[],t=>t.geometryType()],id:[N,[],t=>t.id()],zoom:[k,[],t=>t.globals.zoom],"heatmap-density":[k,[],t=>t.globals.heatmapDensity||0],elevation:[k,[],t=>t.globals.elevation||0],"line-progress":[k,[],t=>t.globals.lineProgress||0],accumulated:[N,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[k,jt(k),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[k,jt(k),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:k,overloads:[[[k,k],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[k],(t,[e])=>-e.evaluate(t)]]},"/":[k,[k,k],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[k,[k,k],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[k,[],()=>Math.LN2],pi:[k,[],()=>Math.PI],e:[k,[],()=>Math.E],"^":[k,[k,k],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[k,[k],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[k,[k],(t,[e])=>Math.log(e.evaluate(t))],log2:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[k,[k],(t,[e])=>Math.sin(e.evaluate(t))],cos:[k,[k],(t,[e])=>Math.cos(e.evaluate(t))],tan:[k,[k],(t,[e])=>Math.tan(e.evaluate(t))],asin:[k,[k],(t,[e])=>Math.asin(e.evaluate(t))],acos:[k,[k],(t,[e])=>Math.acos(e.evaluate(t))],atan:[k,[k],(t,[e])=>Math.atan(e.evaluate(t))],min:[k,jt(k),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[k,jt(k),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[k,[k],(t,[e])=>Math.abs(e.evaluate(t))],round:[k,[k],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[k,[k],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[k,[k],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[U,[$,N],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[U,[N],(t,[e])=>t.id()===e.value],"filter-type-==":[U,[$],(t,[e])=>t.geometryType()===e.value],"filter-<":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[N],(t,[e])=>e.value in t.properties()],"filter-has-id":[U,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[U,[Ce($)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Ce(N)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[$,Ce(N)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[$,Ce(N)],(t,[e,r])=>kd(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[jt(U),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[jt(U),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[U,[U],(t,[e])=>!e.evaluate(t)],"is-supported-script":[U,[$],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[$,[$],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[$,[$],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[$,jt(N),(t,e)=>e.map(r=>on(r.evaluate(t))).join("")],"resolved-locale":[$,[mo],(t,[e])=>e.evaluate(t).resolvedLocale()]});function Ed(t){return Array.isArray(t)?`(${t.map(ie).join(", ")})`:`(${ie(t.type)}...)`}function co(t){if(t instanceof no)return co(t.boundExpression);if(t instanceof Ze&&t.name==="error")return!1;if(t instanceof oo)return!1;if(t instanceof yn)return!1;if(t instanceof hn)return!1;if(t instanceof dn)return!1;let e=t instanceof St||t instanceof $e,r=!0;return t.eachChild(n=>{e?r=r&&co(n):r=r&&n instanceof _t}),r?Po(t)&&So(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Po(t){if(t instanceof Ze){if(t.name==="get"&&t.args.length===1)return!1;if(t.name==="feature-state")return!1;if(t.name==="has"&&t.args.length===1)return!1;if(t.name==="properties"||t.name==="geometry-type"||t.name==="id")return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof yn||t instanceof hn)return!1;let e=!0;return t.eachChild(r=>{e&&!Po(r)&&(e=!1)}),e}function gn(t){if(t instanceof Ze&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!gn(r)&&(e=!1)}),e}function So(t,e){if(t instanceof Ze&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!So(n,e)&&(r=!1)}),r}function Vs(t){return{result:"success",value:t}}function gr(t){return{result:"error",value:t}}function It(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function uc(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function $s(t){return!!t.expression&&t.expression.interpolated}function j(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function wo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&ue(t)===Wt}function Md(t){return t}function Ld(t){switch(t.type){case"color":return H.parse;case"padding":return Oe.parse;case"numberArray":return Ge.parse;case"colorArray":return Pe.parse;default:return null}}function Fd(t){switch(t){case"exponential":return pc;case"interval":return Vd;case"categorical":return Dd;case"identity":return Bd;default:throw new Error(`Unknown function type "${t}"`)}}function cc(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",n=r||t.property!==void 0,i=r||!n,o=t.type||($s(e)?"exponential":"interval"),a=Ld(e);if(a&&(t=xr({},t),t.stops&&(t.stops=t.stops.map(c=>[c[0],a(c[1])])),t.default?t.default=a(t.default):t.default=a(e.default)),t.colorSpace&&!Lh(t.colorSpace))throw new Error(`Unknown color space: "${t.colorSpace}"`);let s=Fd(o),l,u;if(o==="categorical"){l=Object.create(null);for(let c of t.stops)l[c[0]]=c[1];u=typeof t.stops[0][0]}if(r){let c={},p=[];for(let m=0;m<t.stops.length;m++){let h=t.stops[m],g=h[0].zoom;c[g]===void 0&&(c[g]={zoom:g,type:t.type,property:t.property,default:t.default,stops:[]},p.push(g)),c[g].stops.push([h[0].value,h[1]])}let f=[];for(let m of p)f.push([c[m].zoom,cc(c[m],e)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:ke.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},h){return pc({stops:f,base:t.base},e,m).evaluate(m,h)}}}else if(i){let c=o==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:ke.interpolationFactor.bind(void 0,c),zoomStops:t.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(t,e,p,l,u)}}else return{kind:"source",evaluate(c,p){let f=p&&p.properties?p.properties[t.property]:void 0;return f===void 0?Sn(t.default,e.default):s(t,e,f,l,u)}}}function Sn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Dd(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return Sn(o,t.default,e.default)}function Vd(t,e,r){if(j(r)!=="number")return Sn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let i=xo(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function pc(t,e,r){let n=t.base!==void 0?t.base:1;if(j(r)!=="number")return Sn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let o=xo(t.stops.map(c=>c[0]),r),a=Rd(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=lt[e.type]||Md;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),f=l.evaluate.apply(void 0,c);if(!(p===void 0||f===void 0))return u(p,f,a,t.colorSpace)}}:u(s,l,a,t.colorSpace)}function Bd(t,e,r){switch(e.type){case"color":r=H.parse(r);break;case"formatted":r=Ee.fromString(r.toString());break;case"resolvedImage":r=Se.fromString(r.toString());break;case"padding":r=Oe.parse(r);break;case"colorArray":r=Pe.parse(r);break;case"numberArray":r=Ge.parse(r);break;default:j(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return Sn(r,t.default,e.default)}function Rd(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var Ht=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new eo,this._defaultValue=r?Od(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,i,o,a){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ne(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(s)} instead.`);return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function wn(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Kt}function Qt(t,e){let r=new to(Kt,co,[],e?zd(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Vs(new Ht(n,e)):gr(r.errors)}var Je=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!gn(r.expression),this.globalStateRefs=Ao(r.expression)}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}},Tt=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!gn(r.expression),this.globalStateRefs=Ao(r.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}interpolationFactor(e,r,n){return this.interpolationType?ke.interpolationFactor(this.interpolationType,e,r,n):0}};function fc(t){return t._styleExpression!==void 0}function yc(t,e){let r=Qt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=Po(n);if(!i&&!It(e))return gr([new Be("","data expressions not supported")]);let o=So(n,["zoom"]);if(!o&&!uc(e))return gr([new Be("","zoom expressions not supported")]);let a=Qi(n);if(!a&&!o)return gr([new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Be)return gr([a]);if(a instanceof ke&&!$s(e))return gr([new Be("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return Vs(i?new Je("constant",r.value):new Je("source",r.value));let s=a instanceof ke?a.interpolation:void 0;return Vs(i?new Tt("camera",r.value,a.labels,s):new Tt("composite",r.value,a.labels,s))}var bn=class t{constructor(e,r){this._parameters=e,this._specification=r,xr(this,cc(this._parameters,this._specification))}static deserialize(e){return new t(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function mc(t,e){if(wo(t))return new bn(t,e);if(wn(t)){let r=yc(t,e);if(r.result==="error")throw new Error(r.value.map(n=>`${n.key}: ${n.message}`).join(", "));return r.value}else{let r=t;return e.type==="color"&&typeof t=="string"?r=H.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=Oe.parse(t):e.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?r=Ge.parse(t):e.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?r=Pe.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?r=Me.parse(t):e.type==="projectionDefinition"&&typeof t=="string"&&(r=At.parse(t)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}function Qi(t){let e=null;if(t instanceof ro)e=Qi(t.result);else if(t instanceof io){for(let r of t.args)if(e=Qi(r),e)break}else(t instanceof Pr||t instanceof ke)&&t.input instanceof Ze&&t.input.name==="zoom"&&(e=t);return e instanceof Be||t.eachChild(r=>{let n=Qi(r);n instanceof Be?e=n:!e&&n?e=new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&n&&e!==n&&(e=new Be("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function Ao(t,e=new Set){return t instanceof dn&&e.add(t.key),t.eachChild(r=>{Ao(r,e)}),e}function zd(t){let e={color:ze,string:$,number:k,enum:$,boolean:U,formatted:Ar,padding:ho,numberArray:go,colorArray:an,projectionDefinition:yo,resolvedImage:vn,variableAnchorOffsetCollection:bo};return t.type==="array"?Ce(e[t.value]||N,t.length):e[t.type]}function Od(t){if(t.type==="color"&&wo(t.default))return new H(0,0,0,0);switch(t.type){case"color":return H.parse(t.default)||null;case"padding":return Oe.parse(t.default)||null;case"numberArray":return Ge.parse(t.default)||null;case"colorArray":return Pe.parse(t.default)||null;case"variableAnchorOffsetCollection":return Me.parse(t.default)||null;case"projectionDefinition":return At.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function js(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let e of t.slice(1))if(!js(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var Gd={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ct(t){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};js(t)||(t=po(t));let e=Qt(t,Gd);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=hc(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r,getGlobalStateRefs:()=>Ao(e.value.expression)}}}function Nd(t,e){return t<e?-1:t>e?1:0}function hc(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(hc(t[e]))return!0;return!1}function po(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?xs(t[1],t[2],"=="):e==="!="?Ki(xs(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?xs(t[1],t[2],e):e==="any"?Ud(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(po)):e==="none"?["all"].concat(t.slice(1).map(po).map(Ki)):e==="in"?$u(t[1],t.slice(2)):e==="!in"?Ki($u(t[1],t.slice(2))):e==="has"?ju(t[1]):e==="!has"?Ki(ju(t[1])):!0}function xs(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Ud(t){return["any"].concat(t.map(po))}function $u(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Nd)]]:["filter-in-small",t,["literal",e]]}}function ju(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ki(t){return["!",t]}function Bs(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t===void 0||t===null)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(let o of t)i+=`${Bs(o)},`;return`${i}]`}let r=Object.keys(t).sort(),n="{";for(let i=0;i<r.length;i++)n+=`${JSON.stringify(r[i])}:${Bs(t[r[i]])},`;return`${n}}`}function $d(t){let e="";for(let r of vh)e+=`/${Bs(t[r])}`;return e}function dc(t,e){let r={};for(let i=0;i<t.length;i++){let o=e&&e[t[i].id]||$d(t[i]);e&&(e[t[i].id]=o);let a=r[o];a||(a=r[o]=[]),a.push(t[i])}let n=[];for(let i in r)n.push(r[i]);return n}function gc(t){let e=t.key,r=t.value;return r?[new C(e,r,"constants have been deprecated as of v8")]:[]}function le(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Zt(t){if(Array.isArray(t))return t.map(Zt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Zt(t[r]);return e}return le(t)}function Re(t){let e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=t.validateSpec,l=[],u=j(r);if(u!=="object")return[new C(e,r,`object expected, ${u} found`)];for(let c in r){let p=c.split(".")[0],f=nn(n,p)||n["*"],y;if(nn(i,p))y=i[p];else if(nn(n,p))y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new C(e,r[c],`unknown property "${c}"`));continue}l=l.concat(y({key:(e&&`${e}.`)+c,value:r[c],valueSpec:f,style:o,styleSpec:a,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new C(e,r,`missing required property "${c}"`));return l}function qs(t){let e=t.value,r=t.valueSpec,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.key,s=t.arrayElementValidator||n;if(j(e)!=="array")return[new C(a,e,`array expected, ${j(e)} found`)];if(r.length&&e.length!==r.length)return[new C(a,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new C(a,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),j(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<e.length;c++)u=u.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:l,validateSpec:t.validateSpec,style:i,styleSpec:o,key:`${a}[${c}]`}));return u}function _o(t){let e=t.key,r=t.value,n=t.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new C(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new C(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new C(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function bc(t){let e=t.valueSpec,r=le(t.value.type),n,i={},o,a,s=r!=="categorical"&&t.value.property===void 0,l=!s,u=j(t.value.stops)==="array"&&j(t.value.stops[0])==="array"&&j(t.value.stops[0][0])==="object",c=Re({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:p,default:m}});return r==="identity"&&s&&c.push(new C(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&c.push(new C(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!$s(t.valueSpec)&&c.push(new C(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!It(t.valueSpec)?c.push(new C(t.key,t.value,"property functions not supported")):s&&!uc(t.valueSpec)&&c.push(new C(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new C(t.key,t.value,\'"property" property is required\')),c;function p(h){if(r==="identity")return[new C(h.key,h.value,\'identity function may not have a "stops" property\')];let g=[],d=h.value;return g=g.concat(qs({key:h.key,value:d,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:f})),j(d)==="array"&&d.length===0&&g.push(new C(h.key,d,"array must have at least one stop")),g}function f(h){let g=[],d=h.value,x=h.key;if(j(d)!=="array")return[new C(x,d,`array expected, ${j(d)} found`)];if(d.length!==2)return[new C(x,d,`array length 2 expected, length ${d.length} found`)];if(u){if(j(d[0])!=="object")return[new C(x,d,`object expected, ${j(d[0])} found`)];if(d[0].zoom===void 0)return[new C(x,d,"object stop key must have zoom")];if(d[0].value===void 0)return[new C(x,d,"object stop key must have value")];if(a&&a>le(d[0].zoom))return[new C(x,d[0].zoom,"stop zoom values must appear in ascending order")];le(d[0].zoom)!==a&&(a=le(d[0].zoom),o=void 0,i={}),g=g.concat(Re({key:`${x}[0]`,value:d[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:_o,value:y}}))}else g=g.concat(y({key:`${x}[0]`,value:d[0],validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},d));return wn(Zt(d[1]))?g.concat([new C(`${x}[1]`,d[1],"expressions are not allowed in function stops.")]):g.concat(h.validateSpec({key:`${x}[1]`,value:d[1],valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,g){let d=j(h.value),x=le(h.value),b=h.value!==null?h.value:g;if(!n)n=d;else if(d!==n)return[new C(h.key,b,`${d} stop domain type must match previous stop domain type ${n}`)];if(d!=="number"&&d!=="string"&&d!=="boolean")return[new C(h.key,b,"stop domain value must be a number, string, or boolean")];if(d!=="number"&&r!=="categorical"){let v=`number expected, ${d} found`;return It(e)&&r===void 0&&(v+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new C(h.key,b,v)]}return r==="categorical"&&d==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new C(h.key,b,`integer expected, found ${x}`)]:r!=="categorical"&&d==="number"&&o!==void 0&&x<o?[new C(h.key,b,"stop domain values must appear in ascending order")]:(o=x,r==="categorical"&&x in i?[new C(h.key,b,"stop domain values must be unique")]:(i[x]=!0,[]))}function m(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function Sr(t){let e=(t.expressionContext==="property"?yc:Qt)(Zt(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new C(`${t.key}${n.key}`,t.value,n.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new C(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!gn(r))return[new C(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!gn(r))return[new C(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!So(r,["zoom","feature-state"]))return[new C(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Po(r))return[new C(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function jd(t){let e=t.value,r=t.key,n=j(e);return n!=="boolean"?[new C(r,e,`boolean expected, ${n} found`)]:[]}function Rs(t){let e=t.key,r=t.value,n=j(r);return n!=="string"?[new C(e,r,`color expected, ${n} found`)]:H.parse(String(r))?[]:[new C(e,r,`color expected, "${r}" found`)]}function xn(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(le(r))===-1&&i.push(new C(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(le(r))===-1&&i.push(new C(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Ws(t){return js(Zt(t.value))?Sr(xr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xc(t)}function xc(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new C(r,e,`array expected, ${j(e)} found`)];let n=t.styleSpec,i,o=[];if(e.length<1)return[new C(r,e,"filter array must have at least 1 element")];switch(o=o.concat(xn({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),le(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&le(e[1])==="$type"&&o.push(new C(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new C(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=j(e[1]),i!=="string"&&o.push(new C(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=j(e[a]),le(e[1])==="$type"?o=o.concat(xn({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new C(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(xc({key:`${r}[${a}]`,value:e[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=j(e[1]),e.length!==2?o.push(new C(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):i!=="string"&&o.push(new C(`${r}[1]`,e[1],`string expected, ${i} found`));break}return o}function vc(t,e){let r=t.key,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=t.valueSpec||l[s];if(!c)return[new C(r,a,`unknown property "${s}"`)];let p;if(j(a)==="string"&&It(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new C(r,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \\`{ "type": "identity", "property": ${JSON.stringify(p[1])} }\\`.`)];let f=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new C(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&wo(Zt(a))&&le(a.type)==="identity"&&f.push(new C(r,a,\'"text-font" does not support identity functions\'))),f.concat(n({key:t.key,value:a,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function Pc(t){return vc(t,"paint")}function Sc(t){return vc(t,"layout")}function wc(t){let e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;if(j(r)!=="object")return[new C(n,r,`object expected, ${j(r)} found`)];!r.type&&!r.ref&&e.push(new C(n,r,\'either "type" or "ref" is required\'));let a=le(r.type),s=le(r.ref);if(r.id){let l=le(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];le(c.id)===l&&e.push(new C(n,r.id,`duplicate layer id "${r.id}", previously used at line ${c.id.__line__}`))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&e.push(new C(n,r[u],`"${u}" is prohibited for ref layers`))});let l;i.layers.forEach(u=>{le(u.id)===s&&(l=u)}),l?l.ref?e.push(new C(n,r.ref,"ref cannot reference another ref layer")):a=le(l.type):e.push(new C(n,r.ref,`ref layer "${s}" not found`))}else if(a!=="background")if(!r.source)e.push(new C(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&le(l.type);l?u==="vector"&&a==="raster"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster source`)):u!=="raster-dem"&&a==="hillshade"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u!=="raster-dem"&&a==="color-relief"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&a!=="raster"?e.push(new C(n,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new C(n,r,`layer "${r.id}" must specify a "source-layer"`)):u==="raster-dem"&&a!=="hillshade"&&a!=="color-relief"?e.push(new C(n,r.source,"raster-dem source can only be used with layer type \'hillshade\' or \'color-relief\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new C(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new C(n,r.source,`source "${r.source}" not found`))}return e=e.concat(Re({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${n}.type`,value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Ws,layout(l){return Re({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Sc(xr({layerType:a},u))}}})},paint(l){return Re({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Pc(xr({layerType:a},u))}}})}}})),e}function Jt(t){let e=t.value,r=t.key,n=j(e);return n!=="string"?[new C(r,e,`string expected, ${n} found`)]:[]}function qd(t){var e;let r=(e=t.sourceName)!==null&&e!==void 0?e:"",n=t.value,i=t.styleSpec,o=i.source_raster_dem,a=t.style,s=[],l=j(n);if(n===void 0)return s;if(l!=="object")return s.push(new C("source_raster_dem",n,`object expected, ${l} found`)),s;let c=le(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],f=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let y in n)!c&&p.includes(y)?s.push(new C(y,n[y],`In "${r}": "${y}" is only valid when "encoding" is set to "custom". ${f} encoding found`)):o[y]?s=s.concat(t.validateSpec({key:y,value:n[y],valueSpec:o[y],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new C(y,n[y],`unknown property "${y}"`));return s}var qu={promoteId:Wd};function Ac(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new C(r,e,\'"type" is required\')];let a=le(e.type),s;switch(a){case"vector":case"raster":return s=Re({key:r,value:e,valueSpec:n[`source_${a.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:qu,validateSpec:o}),s;case"raster-dem":return s=qd({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=Re({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:qu}),e.cluster)for(let l in e.clusterProperties){let[u,c]=e.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...Sr({key:`${r}.${l}.map`,value:c,expressionContext:"cluster-map"})),s.push(...Sr({key:`${r}.${l}.reduce`,value:p,expressionContext:"cluster-reduce"}))}return s;case"video":return Re({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return Re({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new C(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return xn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Wd({key:t,value:e}){if(j(e)==="string")return Jt({key:t,value:e});{let r=[];for(let n in e)r.push(...Jt({key:`${t}.${n}`,value:e[n]}));return r}}function _c(t){let e=t.value,r=t.styleSpec,n=r.light,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new C("light",e,`object expected, ${a} found`)]),o;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r})):n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new C(s,e[s],`unknown property "${s}"`)])}return o}function Ic(t){let e=t.value,r=t.styleSpec,n=r.sky,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new C("sky",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new C(s,e[s],`unknown property "${s}"`)]);return a}function Tc(t){let e=t.value,r=t.styleSpec,n=r.terrain,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new C("terrain",e,`object expected, ${a} found`)]),o;for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new C(s,e[s],`unknown property "${s}"`)]);return o}function Xd(t){return Jt(t).length===0?[]:Sr(t)}function Hd(t){return Jt(t).length===0?[]:Sr(t)}function Zd(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new C(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return _o({key:e,value:r,valueSpec:{}})}function Jd(t){let e=t.key,r=t.value;if(j(r)==="array"){let i={type:"number"};if(r.length<1)return[new C(e,r,"array length at least 1 expected, length 0 found")];let o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return _o({key:e,value:r,valueSpec:{}})}function Yd(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1)return[new C(e,r,"array length at least 1 expected, length 0 found")];let i=[];for(let o=0;o<r.length;o++)i=i.concat(Rs({key:`${e}[${o}]`,value:r[o]}));return i}else return Rs({key:e,value:r})}function Kd(t){let e=t.key,r=t.value,n=j(r),i=t.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new C(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(xn({key:`${e}[${a}]`,value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(qs({key:`${e}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function Cc(t){let e=[],r=t.value,n=t.key;if(Array.isArray(r)){let i=[],o=[];for(let a in r){r[a].id&&i.includes(r[a].id)&&e.push(new C(n,r,`all the sprites\' ids must be unique, but ${r[a].id} is duplicated`)),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new C(n,r,`all the sprites\' URLs must be unique, but ${r[a].url} is duplicated`)),o.push(r[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Re({key:`${n}[${a}]`,value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return Jt({key:n,value:r})}function Qd(t){let e=t.value,r=t.styleSpec,n=r.projection,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new C("projection",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new C(s,e[s],`unknown property "${s}"`)]);return a}function eg(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let n=j(r);return n==="array"&&!rg(r)&&!tg(r)?[new C(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(n)?[]:[new C(e,r,`projection expected, invalid type "${n}" found`)]}function tg(t){return!!["interpolate","step","literal"].includes(t[0])}function rg(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function ng(t){return!!t&&t.constructor===Object}function kc(t){return ng(t.value)?[]:[new C(t.key,t.value,`object expected, ${j(t.value)} found`)]}var Wu={"*"(){return[]},array:qs,boolean:jd,number:_o,color:Rs,constants:gc,enum:xn,filter:Ws,function:bc,layer:wc,object:Re,source:Ac,light:_c,sky:Ic,terrain:Tc,projection:Qd,projectionDefinition:eg,string:Jt,formatted:Xd,resolvedImage:Hd,padding:Zd,numberArray:Jd,colorArray:Yd,variableAnchorOffsetCollection:Kd,sprite:Cc,state:kc};function fo(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=fo,r.expression&&wo(le(e))?bc(t):r.expression&&wn(Zt(e))?Sr(t):r.type&&Wu[r.type]?Wu[r.type](t):Re(xr({},t,{valueSpec:r.type?n[r.type]:r}))}function Ec(t){let e=t.value,r=t.key,n=Jt(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new C(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&n.push(new C(r,e,\'"glyphs" url must include a "{range}" token\'))),n}function Le(t,e=P){let r=[];return r=r.concat(fo({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:fo,objectElementValidators:{glyphs:Ec,"*"(){return[]}}})),t.constants&&(r=r.concat(gc({key:"constants",value:t.constants}))),Mc(r)}Le.source=qe(je(Ac));Le.sprite=qe(je(Cc));Le.glyphs=qe(je(Ec));Le.light=qe(je(_c));Le.sky=qe(je(Ic));Le.terrain=qe(je(Tc));Le.state=qe(je(kc));Le.layer=qe(je(wc));Le.filter=qe(je(Ws));Le.paintProperty=qe(je(Pc));Le.layoutProperty=qe(je(Sc));function je(t){return function(e){return t({...e,validateSpec:fo})}}function Mc(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function qe(t){return function(...e){return Mc(t.apply(this,e))}}var Lc="AbortError";function Fc(t){return t.message===Lc}function Xs(){return new Error(Lc)}var Io={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Dc(t){return Io.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function Vc(t,e){Io.REGISTERED_PROTOCOLS[t]=e}function Bc(t){delete Io.REGISTERED_PROTOCOLS[t]}var Rc="global-dispatcher",er=class extends Error{constructor(e,r,n,i){super(`AJAXError: ${r} (${e}): ${n}`),this.status=e,this.statusText=r,this.url=n,this.body=i}},Oc=()=>at(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ig=t=>/^file:/.test(t)||/^file:/.test(Oc())&&!/^\\w+:/.test(t);async function og(t,e){let r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:Oc(),signal:e.signal});t.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let n;try{n=await fetch(r)}catch(a){throw new er(0,a.message,t.url,new Blob)}if(!n.ok){let a=await n.blob();throw new er(n.status,n.statusText,t.url,a)}let i;t.type==="arrayBuffer"||t.type==="image"?i=n.arrayBuffer():t.type==="json"?i=n.json():i=n.text();let o=await i;if(e.signal.aborted)throw Xs();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function ag(t,e){return new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(i.responseType="arraybuffer");for(let o in t.headers)i.setRequestHeader(o,t.headers[o]);t.type==="json"&&(i.responseType="text",t.headers?.Accept||i.setRequestHeader("Accept","application/json")),i.withCredentials=t.credentials==="include",i.onerror=()=>{n(new Error(i.statusText))},i.onload=()=>{if(!e.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let o=i.response;if(t.type==="json")try{o=JSON.parse(i.response)}catch(a){n(a);return}r({data:o,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let o=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new er(i.status,i.statusText,t.url,o))}},e.signal.addEventListener("abort",()=>{i.abort(),n(Xs())}),i.send(t.body)})}var Gc=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=Dc(t.url);if(r)return r(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:Rc},e)}if(!ig(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return og(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:Rc},e)}return ag(t,e)},Nc=(t,e)=>Gc(de(t,{type:"json"}),e),Uc=(t,e)=>Gc(de(t,{type:"arrayBuffer"}),e);var ut={};function I(t,e,r={}){if(ut[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ut[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}I("Object",Object);I("Set",Set);I("TransferableGridIndex",$t);I("Color",H);I("Error",Error);I("AJAXError",er);I("ResolvedImage",Se);I("StylePropertyFunction",bn);I("StyleExpression",Ht,{omit:["_evaluator"]});I("ZoomDependentExpression",Tt);I("ZoomConstantExpression",Je);I("CompoundExpression",Ze,{omit:["_evaluate"]});for(let t in Kt)Kt[t]._classRegistryKey||I(`Expression_${t}`,Kt[t]);function $c(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function Hs(t){let e=t.constructor;return t.$name||e._classRegistryKey}function sg(t){if(t===null||typeof t!="object")return!1;let e=Hs(t);return!!(e&&e!=="Object")}function jc(t){return!sg(t)&&(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||$c(t)||vt(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function Tr(t,e){if(jc(t)){if(($c(t)||vt(t))&&e&&e.push(t),ArrayBuffer.isView(t)){let o=t;e&&e.push(o.buffer)}return t instanceof ImageData&&e&&e.push(t.data.buffer),t}if(Array.isArray(t)){let o=[];for(let a of t)o.push(Tr(a,e));return o}if(typeof t!="object")throw new Error(`can\'t serialize object of type ${typeof t}`);let r=Hs(t);if(!r)throw new Error(`can\'t serialize object of unregistered class ${t.constructor.name}`);if(!ut[r])throw new Error(`${r} is not registered.`);let{klass:n}=ut[r],i=n.serialize?n.serialize(t,e):{};if(n.serialize){if(e&&i===e[e.length-1])throw new Error("statically serialized object won\'t survive transfer of $name property")}else{for(let o in t){if(!t.hasOwnProperty(o)||ut[r].omit.indexOf(o)>=0)continue;let a=t[o];i[o]=ut[r].shallow.indexOf(o)>=0?a:Tr(a,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(i.$name=r),i}function Cr(t){if(jc(t))return t;if(Array.isArray(t))return t.map(Cr);if(typeof t!="object")throw new Error(`can\'t deserialize object of type ${typeof t}`);let e=Hs(t)||"Object";if(!ut[e])throw new Error(`can\'t deserialize unregistered class ${e}`);let{klass:r}=ut[e];if(!r)throw new Error(`can\'t deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);let n=Object.create(r.prototype);for(let i of Object.keys(t)){if(i==="$name")continue;let o=t[i];n[i]=ut[e].shallow.indexOf(i)>=0?o:Cr(o)}return n}var To=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};var lg={once:!0},Co=class{constructor(e,r){this.target=e,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new To(()=>this.process()),this.subscription=us(this.target,"message",n=>this.receive(n),!1),this.globalScope=at(self)?e:window}registerMessageHandler(e,r){this.messageHandlers[e]=r}sendAsync(e,r){return new Promise((n,i)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=r?us(r.signal,"abort",()=>{a?.unsubscribe(),delete this.resolveRejects[o];let u={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(u)},lg):null;this.resolveRejects[o]={resolve:u=>{a?.unsubscribe(),n(u)},reject:u=>{a?.unsubscribe(),i(u)}};let s=[],l={...e,id:o,sourceMapId:this.mapId,origin:location.origin,data:Tr(e.data,s)};this.target.postMessage(l,{transfer:s})})}receive(e){let r=e.data,n=r.id;if(!(r.origin!=="file://"&&location.origin!=="file://"&&r.origin!=="resource://android"&&location.origin!=="resource://android"&&r.origin!==location.origin)&&!(r.targetMapId&&this.mapId!==r.targetMapId)){if(r.type==="<cancel>"){delete this.tasks[n];let i=this.abortControllers[n];delete this.abortControllers[n],i&&i.abort();return}if(at(self)||r.mustQueue){this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger();return}this.processTask(n,r)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),r=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),r&&this.processTask(e,r)}async processTask(e,r){if(r.type==="<response>"){let o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;r.error?o.reject(Cr(r.error)):o.resolve(Cr(r.data));return}if(!this.messageHandlers[r.type]){this.completeTask(e,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));return}let n=Cr(r.data),i=new AbortController;this.abortControllers[e]=i;try{let o=await this.messageHandlers[r.type](r.sourceMapId,n,i);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,r,n){let i=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:r?Tr(r):null,data:Tr(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function qc(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function Zs(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var ko=class{constructor(e,r={}){de(this,r),this.type=e}},An=class extends ko{constructor(e,r={}){super("error",de({error:e},r))}},Eo=class{on(e,r){return this._listeners=this._listeners||{},qc(e,r,this._listeners),{unsubscribe:()=>{this.off(e,r)}}}off(e,r){return Zs(e,r,this._listeners),Zs(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},qc(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new ko(e,r||{}));let n=e.type;if(this.listens(n)){e.target=this;let i=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let s of i)s.call(this,e);let o=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let s of o)Zs(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(de(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof An&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}};var ct=Le,K0=ct.source,Q0=ct.light,ev=ct.sky,tv=ct.terrain,rv=ct.filter,Wc=ct.paintProperty,Xc=ct.layoutProperty;function Hc(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new An(new Error(n.message))),r=!0;return r}var _n=class{constructor(){this.first=!0}update(e,r){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=n,!0):!1)}};var q={"Latin-1 Supplement":t=>t>=128&&t<=255,"Hangul Jamo":t=>t>=4352&&t<=4607,Khmer:t=>t>=6016&&t<=6143,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Kanbun:t=>t>=12688&&t<=12703,"CJK Strokes":t=>t>=12736&&t<=12783,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Hangul Syllables":t=>t>=44032&&t<=55215,"Private Use Area":t=>t>=57344&&t<=63743,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function In(t){for(let e of t)if(Mo(e.charCodeAt(0)))return!0;return!1}function Zc(t){for(let e of t)if(!pg(e.charCodeAt(0)))return!1;return!0}function Js(t){let e=t.map(r=>{try{return new RegExp(`\\\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(e.join("|"),"u")}var ug=["Arab","Dupl","Mong","Ougr","Syrc"],cg=Js(ug);function pg(t){return!cg.test(String.fromCodePoint(t))}var fg=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],Jc=Js(fg);function Yc(t){return t<11904?!1:q["CJK Compatibility Forms"](t)||q["CJK Compatibility"](t)||q["CJK Strokes"](t)||q["CJK Symbols and Punctuation"](t)||q["Enclosed CJK Letters and Months"](t)||q["Halfwidth and Fullwidth Forms"](t)||q["Ideographic Description Characters"](t)||q["Vertical Forms"](t)?!0:Jc.test(String.fromCodePoint(t))}function Mo(t){return t===746||t===747?!0:t<4352?!1:!!(q["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||q["CJK Compatibility"](t)||q["CJK Strokes"](t)||q["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||q["Enclosed CJK Letters and Months"](t)||q["Ideographic Description Characters"](t)||q.Kanbun(t)||q.Katakana(t)&&t!==12540||q["Halfwidth and Fullwidth Forms"](t)&&t!==65288&&t!==65289&&t!==65293&&!(t>=65306&&t<=65310)&&t!==65339&&t!==65341&&t!==65343&&!(t>=65371&&t<=65503)&&t!==65507&&!(t>=65512&&t<=65519)||q["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||q["Vertical Forms"](t)||q["Yijing Hexagram Symbols"](t)||/\\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\\p{sc=Hang}/u.test(String.fromCodePoint(t))||Jc.test(String.fromCodePoint(t)))}function yg(t){return!!(q["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||q["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||q["Letterlike Symbols"](t)||q["Number Forms"](t)||q["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||q["Control Pictures"](t)&&t!==9251||q["Optical Character Recognition"](t)||q["Enclosed Alphanumerics"](t)||q["Geometric Shapes"](t)||q["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||q["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||q["CJK Symbols and Punctuation"](t)||q.Katakana(t)||q["Private Use Area"](t)||q["CJK Compatibility Forms"](t)||q["Small Form Variants"](t)||q["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}function Ys(t){return!(Mo(t)||yg(t))}function Kc(t){return/\\p{sc=Arab}/u.test(String.fromCodePoint(t))}var mg=["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"],hg=Js(mg);function Qc(t){return hg.test(String.fromCodePoint(t))}function dg(t,e){return!(!e&&Qc(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||q.Khmer(t))}function ep(t){for(let e of t)if(Qc(e.charCodeAt(0)))return!0;return!1}function tp(t,e){for(let r of t)if(!dg(r.charCodeAt(0),e))return!1;return!0}var Ks=class{constructor(){this.TIMEOUT=5e3;this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null;this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(we.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,r){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let n=e.pluginURL,i=new Promise(s=>{this.loadScriptResolve=s});r(n);let o=new Promise(s=>setTimeout(()=>s(),this.TIMEOUT));if(await Promise.race([i,o]),this.isParsed()){let s={pluginStatus:"loaded",pluginURL:n};return this.setState(s),s}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)}},we=new Ks;var W=class{constructor(e,r){this.zoom=e,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new _n,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new _n,this.transition={},this.globalState={})}isSupportedScript(e){return tp(e,we.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,r=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}};var kr=class{constructor(e,r){this.property=e,this.value=r,this.expression=mc(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}},Tn=class{constructor(e){this.property=e,this.value=new kr(e,void 0)}transitioned(e,r){return new Fo(this.property,this.value,r,de({},e.transition,this.transition),e.now)}untransitioned(){return new Fo(this.property,this.value,null,{},0)}},Lo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return nt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Tn(this._values[e].property)),this._values[e].value=new kr(this._values[e].property,r===null?void 0:nt(r))}getTransition(e){return nt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Tn(this._values[e].property)),this._values[e].transition=nt(r)||void 0}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n);let i=this.getTransition(r);i!==void 0&&(e[`${r}-transition`]=i)}return e}transitioned(e,r){let n=new Do(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(e,r._values[i]);return n}untransitioned(){let e=new Do(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},Fo=class{constructor(e,r,n,i,o){this.property=e,this.value=r,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(e,r,n){let i=e.now||0,o=this.value.possiblyEvaluate(e,r,n),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(e,r,n);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,r,n),o,Su(s))}}else return o}},Do=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){let i=new kt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},Vo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return nt(this._values[e].value)}setValue(e,r){this._values[e]=new kr(this._values[e].property,r===null?void 0:nt(r))}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n)}return e}possiblyEvaluate(e,r,n){let i=new kt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},ge=class{constructor(e,r,n){this.property=e,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,n,i){return this.property.evaluate(this.value,this.parameters,e,r,n,i)}},kt=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},E=class{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,n){let i=this.specification.type,o=lt[i];return o?o(e,r,n):e}},F=class{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,n,i){return e.expression.kind==="constant"||e.expression.kind==="camera"?new ge(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new ge(this,e.expression,r)}interpolate(e,r,n){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new ge(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=lt[i];if(o){let a=o(e.value.value,r.value.value,n);return new ge(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,r,n,i,o,a){return e.kind==="constant"?e.value:e.evaluate(r,n,i,o,a)}},pt=class extends F{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new ge(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i),s=e.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,r);return new ge(this,{kind:"constant",value:l},r)}else if(e.expression.kind==="camera"){let o=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new ge(this,{kind:"constant",value:o},r)}else return new ge(this,e.expression,r)}evaluate(e,r,n,i,o,a){if(e.kind==="source"){let s=e.evaluate(r,n,i,o,a);return this._calculate(s,s,s,r)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},n,i),e.evaluate({zoom:Math.floor(r.zoom)},n,i),e.evaluate({zoom:Math.floor(r.zoom)+1},n,i),r):e.value}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},tr=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){if(e.value!==void 0)if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i);return this._calculate(o,o,o,r)}else return this._calculate(e.expression.evaluate(new W(Math.floor(r.zoom-1),r)),e.expression.evaluate(new W(Math.floor(r.zoom),r)),e.expression.evaluate(new W(Math.floor(r.zoom+1),r)),r)}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},ft=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){return!!e.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},ee=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in e){let n=e[r];n.specification.overridable&&this.overridableProperties.push(r);let i=this.defaultPropertyValues[r]=new kr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new Tn(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};I("DataDrivenProperty",F);I("DataConstantProperty",E);I("CrossFadedDataDrivenProperty",pt);I("CrossFadedProperty",tr);I("ColorRampProperty",ft);var Bo="-transition",oe=class extends Eo{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Ct(e.filter)),r.layout&&(this._unevaluatedLayout=new Vo(r.layout)),r.paint)){this._transitionablePaint=new Lo(r.paint);for(let n in e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(let n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new kt(r.paint)}}setFilter(e){this.filter=e,this._featureFilter=Ct(e)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;if(this._unevaluatedLayout)for(let r in this._unevaluatedLayout._values){let n=this._unevaluatedLayout._values[r];for(let i of n.getGlobalStateRefs())e.add(i)}for(let r of this._featureFilter.getGlobalStateRefs())e.add(r);return e}setLayoutProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.layout.${e}`;if(this._validate(Xc,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(Bo)?this._transitionablePaint.getTransition(e.slice(0,-Bo.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.paint.${e}`;if(this._validate(Wc,i,e,r,n))return!1}if(e.endsWith(Bo))return this._transitionablePaint.setTransition(e.slice(0,-Bo.length),r||void 0),!1;{let i=this._transitionablePaint._values[e],o=i.property.specification["property-type"]==="cross-faded-data-driven",a=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);let l=this._transitionablePaint._values[e].value;return l.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(e,s,l)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,n){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),_u(e,(r,n)=>r!==void 0&&!(n==="layout"&&!Object.keys(r).length)&&!(n==="paint"&&!Object.keys(r).length))}_validate(e,r,n,i,o={}){return o&&o.validate===!1?!1:Hc(this,e.call(ct,{key:r,layerType:this.type,objectKey:n,value:i,styleSpec:P,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let r=this.paint.get(e);if(!(!(r instanceof ge)||!It(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};var gg={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Et=class{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},bg=128,xg=5,te=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*xg),bg),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function Q(t,e=1){let r=0,n=0,i=t.map(a=>{let s=vg(a.type),l=r=rp(r,Math.max(e,s)),u=a.components||1;return n=Math.max(n,s),r+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=rp(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function vg(t){return gg[t].BYTES_PER_ELEMENT}function rp(t,e){return Math.ceil(t/e)*e}var np=Y(ye(),1),rr=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.int16[i+0]=r,this.int16[i+1]=n,e}};rr.prototype.bytesPerElement=4;I("StructArrayLayout2i4",rr);var Cn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.int16[o+0]=r,this.int16[o+1]=n,this.int16[o+2]=i,e}};Cn.prototype.bytesPerElement=6;I("StructArrayLayout3i6",Cn);var Ro=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.int16[a+0]=r,this.int16[a+1]=n,this.int16[a+2]=i,this.int16[a+3]=o,e}};Ro.prototype.bytesPerElement=8;I("StructArrayLayout4i8",Ro);var kn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};kn.prototype.bytesPerElement=12;I("StructArrayLayout2i4i12",kn);var En=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*4,u=e*8;return this.int16[l+0]=r,this.int16[l+1]=n,this.uint8[u+4]=i,this.uint8[u+5]=o,this.uint8[u+6]=a,this.uint8[u+7]=s,e}};En.prototype.bytesPerElement=8;I("StructArrayLayout2i4ub8",En);var Mt=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.float32[i+0]=r,this.float32[i+1]=n,e}};Mt.prototype.bytesPerElement=8;I("StructArrayLayout2f8",Mt);var Mn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,r,n,i,o,a,s,l,u,c)}emplace(e,r,n,i,o,a,s,l,u,c,p){let f=e*10;return this.uint16[f+0]=r,this.uint16[f+1]=n,this.uint16[f+2]=i,this.uint16[f+3]=o,this.uint16[f+4]=a,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=u,this.uint16[f+8]=c,this.uint16[f+9]=p,e}};Mn.prototype.bytesPerElement=20;I("StructArrayLayout10ui20",Mn);var Ln=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f){let y=this.length;return this.resize(y+1),this.emplace(y,e,r,n,i,o,a,s,l,u,c,p,f)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y){let m=e*12;return this.int16[m+0]=r,this.int16[m+1]=n,this.int16[m+2]=i,this.int16[m+3]=o,this.uint16[m+4]=a,this.uint16[m+5]=s,this.uint16[m+6]=l,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=p,this.int16[m+10]=f,this.int16[m+11]=y,e}};Ln.prototype.bytesPerElement=24;I("StructArrayLayout4i4ui4i24",Ln);var Fn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.float32[o+0]=r,this.float32[o+1]=n,this.float32[o+2]=i,e}};Fn.prototype.bytesPerElement=12;I("StructArrayLayout3f12",Fn);var Dn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint32[n+0]=r,e}};Dn.prototype.bytesPerElement=4;I("StructArrayLayout1ul4",Dn);var Vn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,r,n,i,o,a,s,l,u)}emplace(e,r,n,i,o,a,s,l,u,c){let p=e*10,f=e*5;return this.int16[p+0]=r,this.int16[p+1]=n,this.int16[p+2]=i,this.int16[p+3]=o,this.int16[p+4]=a,this.int16[p+5]=s,this.uint32[f+3]=l,this.uint16[p+8]=u,this.uint16[p+9]=c,e}};Vn.prototype.bytesPerElement=20;I("StructArrayLayout6i1ul2ui20",Vn);var Bn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};Bn.prototype.bytesPerElement=12;I("StructArrayLayout2i2i2i12",Bn);var zo=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,n,i,o)}emplace(e,r,n,i,o,a){let s=e*4,l=e*8;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=i,this.int16[l+6]=o,this.int16[l+7]=a,e}};zo.prototype.bytesPerElement=16;I("StructArrayLayout2f1f2i16",zo);var Rn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*16,u=e*4,c=e*8;return this.uint8[l+0]=r,this.uint8[l+1]=n,this.float32[u+1]=i,this.float32[u+2]=o,this.int16[c+6]=a,this.int16[c+7]=s,e}};Rn.prototype.bytesPerElement=16;I("StructArrayLayout2ub2f2i16",Rn);var zn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.uint16[o+0]=r,this.uint16[o+1]=n,this.uint16[o+2]=i,e}};zn.prototype.bytesPerElement=6;I("StructArrayLayout3ui6",zn);var On=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d){let x=this.length;return this.resize(x+1),this.emplace(x,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x){let b=e*24,v=e*12,S=e*48;return this.int16[b+0]=r,this.int16[b+1]=n,this.uint16[b+2]=i,this.uint16[b+3]=o,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=l,this.uint16[b+10]=u,this.uint16[b+11]=c,this.uint16[b+12]=p,this.float32[v+7]=f,this.float32[v+8]=y,this.uint8[S+36]=m,this.uint8[S+37]=h,this.uint8[S+38]=g,this.uint32[v+10]=d,this.int16[b+22]=x,e}};On.prototype.bytesPerElement=48;I("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",On);var Gn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T,M,D,V,z){let L=this.length;return this.resize(L+1),this.emplace(L,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T,M,D,V,z)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T,M,D,V,z,L){let _=e*32,B=e*16;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=i,this.int16[_+3]=o,this.int16[_+4]=a,this.int16[_+5]=s,this.int16[_+6]=l,this.int16[_+7]=u,this.uint16[_+8]=c,this.uint16[_+9]=p,this.uint16[_+10]=f,this.uint16[_+11]=y,this.uint16[_+12]=m,this.uint16[_+13]=h,this.uint16[_+14]=g,this.uint16[_+15]=d,this.uint16[_+16]=x,this.uint16[_+17]=b,this.uint16[_+18]=v,this.uint16[_+19]=S,this.uint16[_+20]=A,this.uint16[_+21]=w,this.uint16[_+22]=T,this.uint32[B+12]=M,this.float32[B+13]=D,this.float32[B+14]=V,this.uint16[_+30]=z,this.uint16[_+31]=L,e}};Gn.prototype.bytesPerElement=64;I("StructArrayLayout8i15ui1ul2f2ui64",Gn);var nr=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.float32[n+0]=r,e}};nr.prototype.bytesPerElement=4;I("StructArrayLayout1f4",nr);var Nn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*6,a=e*3;return this.uint16[o+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,e}};Nn.prototype.bytesPerElement=12;I("StructArrayLayout1ui2f12",Nn);var Un=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*2,a=e*4;return this.uint32[o+0]=r,this.uint16[a+2]=n,this.uint16[a+3]=i,e}};Un.prototype.bytesPerElement=8;I("StructArrayLayout1ul2ui8",Un);var $n=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.uint16[i+0]=r,this.uint16[i+1]=n,e}};$n.prototype.bytesPerElement=4;I("StructArrayLayout2ui4",$n);var Oo=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint16[n+0]=r,e}};Oo.prototype.bytesPerElement=2;I("StructArrayLayout1ui2",Oo);var Er=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.float32[a+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,this.float32[a+3]=o,e}};Er.prototype.bytesPerElement=16;I("StructArrayLayout4f16",Er);var Go=class extends Et{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new np.default(this.anchorPointX,this.anchorPointY)}};Go.prototype.size=20;var jn=class extends Vn{get(e){return new Go(this,e)}};I("CollisionBoxArray",jn);var No=class extends Et{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};No.prototype.size=48;var qn=class extends On{get(e){return new No(this,e)}};I("PlacedSymbolArray",qn);var Uo=class extends Et{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};Uo.prototype.size=64;var Wn=class extends Gn{get(e){return new Uo(this,e)}};I("SymbolInstanceArray",Wn);var Xn=class extends nr{getoffsetX(e){return this.float32[e*1+0]}};I("GlyphOffsetArray",Xn);var Hn=class extends Cn{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};I("SymbolLineVertexArray",Hn);var $o=class extends Et{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};$o.prototype.size=12;var Zn=class extends Nn{get(e){return new $o(this,e)}};I("TextAnchorOffsetArray",Zn);var jo=class extends Et{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};jo.prototype.size=8;var Jn=class extends Un{get(e){return new jo(this,e)}};I("FeatureIndexArray",Jn);var qo=class extends rr{};var Wo=class extends rr{},Xo=class extends rr{},Ho=class extends kn{};var Zo=class extends En{},Jo=class extends Mt{},yt=class extends Mn{},Yo=class extends Ln{},Ko=class extends Fn{},Qo=class extends Dn{},Yn=class extends Bn{};var ea=class extends Rn{};var Fe=class extends zn{},Lt=class extends $n{};var Pg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:ip,size:kv,alignment:Ev}=Pg;var pe=class t{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1;this.segments=e}prepareSegment(e,r,n,i){let o=this.segments[this.segments.length-1];return e>t.MAX_VERTEX_ARRAY_LENGTH&&ce(`Max vertices per segment is ${t.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${t.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!o||o.vertexLength+e>t.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i?this.createNewSegment(r,n,i):o}createNewSegment(e,r,n){let i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return n!==void 0&&(i.sortKey=n),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(e,r,n){return this.prepareSegment(0,e,r,n)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,n,i){return new t([{vertexOffset:e,primitiveOffset:r,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};pe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;I("SegmentVector",pe);function Qs(t,e){return t=it(Math.floor(t),0,255),e=it(Math.floor(e),0,255),256*t+e}var Kn=Q([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var up=Y(rl(),1);var Qn=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(lp(e)),this.positions.push(r,n,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=lp(e),n=0,i=this.ids.length-1;for(;n<i;){let a=n+i>>1;this.ids[a]>=r?i=a:n=a+1}let o=[];for(;this.ids[n]===r;){let a=this.positions[3*n],s=this.positions[3*n+1],l=this.positions[3*n+2];o.push({index:a,start:s,end:l}),n++}return o}static serialize(e,r){let n=new Float64Array(e.ids),i=new Uint32Array(e.positions);return nl(n,i,0,n.length-1),r&&r.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(e){let r=new t;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function lp(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,up.default)(String(t))}function nl(t,e,r,n){for(;r<n;){let i=t[r+n>>1],o=r-1,a=n+1;for(;;){do o++;while(t[o]<i);do a--;while(t[a]>i);if(o>=a)break;ra(t,o,a),ra(e,3*o,3*a),ra(e,3*o+1,3*a+1),ra(e,3*o+2,3*a+2)}a-r<n-a?(nl(t,e,r,a),r=a+1):(nl(t,e,a+1,n),n=a)}}function ra(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}I("FeaturePositionMap",Qn);var ei=class{constructor(e,r){this.gl=e.gl,this.location=r}};var Mr=class extends ei{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};var na=class extends ei{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}},ia=class extends ei{constructor(e,r){super(e,r),this.current=H.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}};var qv=new Float32Array(16);function il(t){return[Qs(255*t.r,255*t.g),Qs(255*t.b,255*t.a)]}var ir=class{constructor(e,r,n){this.value=e,this.uniformNames=r.map(i=>`u_${i}`),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new ia(e,r):new Mr(e,r)}},Ft=class{constructor(e,r){this.uniformNames=r.map(n=>`u_${n}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,r,n){return n.substr(0,9)==="u_pattern"?new na(e,r):new Mr(e,r)}},We=class{constructor(e,r,n,i){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:`a_${o}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,r,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new W(0),r,{},i,[],o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(e,r,o)}_setPaintValue(e,r,n){if(this.type==="color"){let i=il(n);for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=e;i<r;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},De=class{constructor(e,r,n,i,o,a){this.expression=e,this.uniformNames=r.map(s=>`u_${s}_t`),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:`a_${s}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,r,n,i,o){let a=this.expression.evaluate(new W(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new W(this.zoom+1),r,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,a,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:this.zoom},n,i),a=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(e,r,o,a)}_setPaintValue(e,r,n,i){if(this.type==="color"){let o=il(n),a=il(i);for(let s=e;s<r;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,n,i);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){let n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,i=it(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,r,n){return new Mr(e,r)}},Ye=class{constructor(e,r,n,i,o,a){this.expression=e,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(e,r,n){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(e,r,n,i,o){this._setPaintValues(e,r,n.patterns&&n.patterns[this.layerId],o)}_setPaintValues(e,r,n,i){if(!i||!n)return;let{min:o,mid:a,max:s}=n,l=i[o],u=i[a],c=i[s];if(!(!l||!u||!c))for(let p=e;p<r;p++)this.zoomInPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],u.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],u.pixelRatio,c.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Kn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Kn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},oa=class{constructor(e,r,n){this.binders={},this._buffers=[];let i=[];for(let o in e.paint._values){if(!n(o))continue;let a=e.paint.get(o);if(!(a instanceof ge)||!It(a.property.specification))continue;let s=_g(o,e.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],f=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=f?new Ft(l.value,s):new ir(l.value,s,u),i.push(`/u_${o}`);else if(l.kind==="source"||f){let y=cp(o,u,"source");this.binders[o]=f?new Ye(l,u,c,r,y,e.id):new We(l,s,u,y),i.push(`/a_${o}`)}else{let y=cp(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push(`/z_${o}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){let r=this.binders[e];return r instanceof We||r instanceof De?r.maxValue:0}populatePaintArrays(e,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof We||s instanceof De||s instanceof Ye)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof Ft&&i.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,n,i,o){let a=!1;for(let s in e){let l=r.getPositions(s);for(let u of l){let c=n.feature(u.index);for(let p in this.binders){let f=this.binders[p];if((f instanceof We||f instanceof De||f instanceof Ye)&&f.expression.isStateDependent===!0){let y=i.paint.get(p);f.expression=y.value,f.updatePaintArray(u.start,u.end,c,e[s],o),a=!0}}}}return a}defines(){let e=[];for(let r in this.binders){let n=this.binders[r];(n instanceof ir||n instanceof Ft)&&e.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return e}getBinderAttributes(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof We||n instanceof De)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof Ye)for(let i=0;i<Kn.members.length;i++)e.push(Kn.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof ir||n instanceof Ft||n instanceof De)for(let i of n.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){let n=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof ir||o instanceof Ft||o instanceof De){for(let a of o.uniformNames)if(r[a]){let s=o.getBinding(e,r[a],a);n.push({name:a,property:i,binding:s})}}}return n}setUniforms(e,r,n,i){for(let{name:o,property:a,binding:s}of r)this.binders[a].setUniform(s,i,n.get(a),o)}updatePaintBuffers(e){this._buffers=[];for(let r in this.binders){let n=this.binders[r];if(e&&n instanceof Ye){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof We||n instanceof De)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let r in this.binders){let n=this.binders[r];(n instanceof We||n instanceof De||n instanceof Ye)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let r=this.binders[e];(r instanceof We||r instanceof De||r instanceof Ye)&&r.destroy()}}},Ae=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new oa(i,r,n);this.needsUpload=!1,this._featureMap=new Qn,this._bufferOffset=0}populatePaintArrays(e,r,n,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,r,i,o,a);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,n,i){for(let o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,r,o,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function _g(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Ig(t){return{"line-pattern":{source:yt,composite:yt},"fill-pattern":{source:yt,composite:yt},"fill-extrusion-pattern":{source:yt,composite:yt}}[t]}function cp(t,e,r){let n={color:{source:Mt,composite:Er},number:{source:nr,composite:Mt}},i=Ig(t);return i&&i[r]||n[e][r]}I("ConstantBinder",ir);I("CrossFadedConstantBinder",Ft);I("SourceExpressionBinder",We);I("CrossFadedCompositeBinder",Ye);I("CompositeExpressionBinder",De);I("ProgramConfiguration",oa,{omit:["_buffers"]});I("ProgramConfigurationSet",Ae);var Tg=15,ol=Math.pow(2,Tg-1)-1,pp=-ol-1;function _e(t){let e=8192/t.extent,r=t.loadGeometry();for(let n=0;n<r.length;n++){let i=r[n];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=it(s,pp,ol),a.y=it(l,pp,ol),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ne(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?_e(t):[]}}var fp=-32768;function Cg(t,e,r,n,i){t.emplaceBack(fp+e*8+n,fp+r*8+i)}var or=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Wo,this.indexArray=new Fe,this.segments=new pe,this.programConfigurations=new Ae(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){let i=this.layers[0],o=[],a=null,s=!1,l=i.type==="heatmap";if(i.type==="circle"){let c=i;a=c.layout.get("circle-sort-key"),s=!a.isConstant(),l=l||c.paint.get("circle-pitch-alignment")==="map"}let u=l?r.subdivisionGranularity.circle:1;for(let{feature:c,id:p,index:f,sourceLayerIndex:y}of e){let m=this.layers[0]._featureFilter.needGeometry,h=Ne(c,m);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),h,n))continue;let g=s?a.evaluate(h,{},n):void 0,d={id:p,properties:c.properties,type:c.type,sourceLayerIndex:y,index:f,geometry:m?h.geometry:_e(c),patterns:{},sortKey:g};o.push(d)}s&&o.sort((c,p)=>c.sortKey-p.sortKey);for(let c of o){let{geometry:p,index:f,sourceLayerIndex:y}=c,m=e[f].feature;this.addFeature(c,p,f,n,u),r.featureIndex.insert(m,p,f,y,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ip),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,n,i,o=1){let a;switch(o){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${o}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let l of r)for(let u of l){let c=u.x,p=u.y;if(c<0||c>=8192||p<0||p>=8192)continue;let f=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),y=f.vertexLength;for(let m=0;m<s;m++)for(let h=0;h<s;h++)Cg(this.layoutVertexArray,c,p,a[h],a[m]);for(let m=0;m<s-1;m++)for(let h=0;h<s-1;h++){let g=y+m*s+h,d=y+(m+1)*s+h;this.indexArray.emplaceBack(g,d+1,g+1),this.indexArray.emplaceBack(g,d,d+1)}f.vertexLength+=s*s,f.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};I("CircleBucket",or,{omit:["layers"]});var ti=Y(ye(),1);function mp(t,e){for(let r=0;r<t.length;r++)if(Lr(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Lr(t,e[r]))return!0;return!!sl(t,e)}function hp(t,e,r){return!!(Lr(t,e)||al(e,t,r))}function aa(t,e){if(t.length===1)return yp(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(Lr(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(yp(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(sl(t,e[r]))return!0;return!1}function dp(t,e,r){for(let n=0;n<e.length;n++){let i=e[n];if(t.length>=3){for(let o=0;o<i.length;o++)if(Lr(t,i[o]))return!0}if(kg(t,i,r))return!0}return!1}function kg(t,e,r){if(t.length>1){if(sl(t,e))return!0;for(let n=0;n<e.length;n++)if(al(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(al(t[n],e,r))return!0;return!1}function sl(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1];for(let o=0;o<e.length-1;o++){let a=e[o],s=e[o+1];if(Eg(n,i,a,s))return!0}}return!1}function Eg(t,e,r,n){return ot(t,r,n)!==ot(e,r,n)&&ot(t,e,r)!==ot(t,e,n)}function al(t,e,r){let n=r*r;if(e.length===1)return t.distSqr(e[0])<n;for(let i=1;i<e.length;i++){let o=e[i-1],a=e[i];if(ll(t,o,a)<n)return!0}return!1}function ll(t,e,r){let n=e.distSqr(r);if(n===0)return t.distSqr(e);let i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return i<0?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function yp(t,e){let r=!1,n,i,o;for(let a=0;a<t.length;a++){n=t[a];for(let s=0,l=n.length-1;s<n.length;l=s++)i=n[s],o=n[l],i.y>e.y!=o.y>e.y&&e.x<(o.x-i.x)*(e.y-i.y)/(o.y-i.y)+i.x&&(r=!r)}return r}function Lr(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){let o=t[n],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function gp(t,e,r,n,i){for(let a of t)if(e<=a.x&&r<=a.y&&n>=a.x&&i>=a.y)return!0;let o=[new ti.default(e,r),new ti.default(e,i),new ti.default(n,i),new ti.default(n,r)];if(t.length>2){for(let a of o)if(Lr(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(Mg(s,l,o))return!0}return!1}function Mg(t,e,r){let n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;let o=ot(t,e,r[0]);return o!==ot(t,e,r[1])||o!==ot(t,e,r[2])||o!==ot(t,e,r[3])}var sa=Y(ye(),1);function ar(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Dt(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Vt(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=sa.default.convert(e)._mult(i);r==="viewport"&&o._rotate(-n);let a=[];for(let s=0;s<t.length;s++){let l=t[s];a.push(l.sub(o))}return a}function bp(t,e){let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],u=i[a+1],c=a===0?new sa.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new sa.default(0,0):u.sub(l)._unit()._perp(),f=c._add(p)._unit(),y=f.x*p.x+f.y*p.y;y!==0&&f._mult(1/y),o.push(f._mult(e)._add(l))}r.push(o)}return r}var xp,Lg=()=>xp=xp||new ee({"circle-sort-key":new F(P.layout_circle["circle-sort-key"])}),vp,Fg=()=>vp=vp||new ee({"circle-radius":new F(P.paint_circle["circle-radius"]),"circle-color":new F(P.paint_circle["circle-color"]),"circle-blur":new F(P.paint_circle["circle-blur"]),"circle-opacity":new F(P.paint_circle["circle-opacity"]),"circle-translate":new E(P.paint_circle["circle-translate"]),"circle-translate-anchor":new E(P.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new E(P.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new E(P.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new F(P.paint_circle["circle-stroke-width"]),"circle-stroke-color":new F(P.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new F(P.paint_circle["circle-stroke-opacity"])}),Pp={get paint(){return Fg()},get layout(){return Lg()}};var Sp=Y(ye(),1);var la=class extends oe{constructor(e){super(e,Pp)}createBucket(e){return new or(e)}queryRadius(e){let r=e;return ar("circle-radius",this,r)+ar("circle-stroke-width",this,r)+Dt(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:l}){let u=Vt(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-o.bearingInRadians,a),c=this.paint.get("circle-radius").evaluate(r,n),p=this.paint.get("circle-stroke-width").evaluate(r,n),f=c+p,y=this.paint.get("circle-pitch-alignment")==="map",m=y?u:Dg(u,o,s,l),h=y?f*a:f;for(let g of i)for(let d of g){let x=y?d:wp(d,o,s,l),b=h,v=o.projectTileCoordinates(d.x,d.y,s,l).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=v/o.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=o.cameraToCenterDistance/v),hp(m,x,b))return!0}return!1}};function wp(t,e,r,n){let i=e.projectTileCoordinates(t.x,t.y,r,n).point;return new Sp.default((i.x*.5+.5)*e.width,(-i.y*.5+.5)*e.height)}function Dg(t,e,r,n){return t.map(i=>wp(i,e,r,n))}var ri=class extends or{};I("HeatmapBucket",ri,{omit:["layers"]});var Ap,Vg=()=>Ap=Ap||new ee({"heatmap-radius":new F(P.paint_heatmap["heatmap-radius"]),"heatmap-weight":new F(P.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new E(P.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ft(P.paint_heatmap["heatmap-color"]),"heatmap-opacity":new E(P.paint_heatmap["heatmap-opacity"])}),_p={get paint(){return Vg()}};function ul(t,{width:e,height:r},n,i){if(!i)i=new Uint8Array(e*r*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*r*n}`);return t.width=e,t.height=r,t.data=i,t}function Ip(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=ul({},{width:e,height:r},n);cl(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function cl(t,e,r,n,i,o){if(i.width===0||i.height===0)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");let a=t.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let u=((r.y+l)*t.width+r.x)*o,c=((n.y+l)*e.width+n.x)*o;for(let p=0;p<i.width*o;p++)s[c+p]=a[u+p]}return e}var sr=class t{constructor(e,r){ul(this,e,1,r)}resize(e){Ip(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){cl(e,r,n,i,o,1)}},fe=class t{constructor(e,r){ul(this,e,4,r)}resize(e){Ip(this,e,4)}replace(e,r){r?this.data.set(e):e instanceof Uint8ClampedArray?this.data=new Uint8Array(e.buffer):this.data=e}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){cl(e,r,n,i,o,4)}setPixel(e,r,n){let i=(e*this.width+r)*4;this.data[i+0]=Math.round(n.r*255/n.a),this.data[i+1]=Math.round(n.g*255/n.a),this.data[i+2]=Math.round(n.b*255/n.a),this.data[i+3]=Math.round(n.a*255)}};I("AlphaImage",sr);I("RGBAImage",fe);function Tp(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new fe({width:r,height:n});if(!Au(r))throw new Error(`width is not a power of 2 - ${r}`);let o=(a,s,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);i.setPixel(a/4/r,s/4,u)};if(t.clips)for(let a=0,s=0;a<n;++a,s+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let c=l/(r-1),{start:p,end:f}=t.clips[a],y=p*(1-c)+f*c;o(s,u,y)}else for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1);o(0,s,l)}return i}var Cp="big-fb";var ua=class extends oe{createBucket(e){return new ri(e)}constructor(e){super(e,_p),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Tp({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Cp)&&this.heatmapFbos.delete(Cp)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var kp,Bg=()=>kp=kp||new ee({"hillshade-illumination-direction":new E(P.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new E(P.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new E(P.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new E(P.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new E(P.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new E(P.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new E(P.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new E(P.paint_hillshade["hillshade-method"])}),Ep={get paint(){return Bg()}};var ca=class extends oe{constructor(e){super(e,Ep),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,n=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,o=Math.max(e.length,r.length,n.length,i.length);e=e.concat(Array(o-e.length).fill(e.at(-1))),r=r.concat(Array(o-r.length).fill(r.at(-1))),n=n.concat(Array(o-n.length).fill(n.at(-1))),i=i.concat(Array(o-i.length).fill(i.at(-1)));let a=r.map(cs);return{directionRadians:e.map(cs),altitudeRadians:a,shadowColor:i,highlightColor:n}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Mp,Rg=()=>Mp=Mp||new ee({"color-relief-opacity":new E(P["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new ft(P["paint_color-relief"]["color-relief-color"])}),Lp={get paint(){return Rg()}};var ni=class{constructor(e,r,n,i){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(r,i)}update(e,r,n){let{width:i,height:o}=e,a=(!this.size||this.size[0]!==i||this.size[1]!==o)&&!n,{context:s}=this,{gl:l}=s;if(this.useMipmap=!!(r&&r.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!r||r.premultiply!==!1)),a)this.size=[i,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||vt(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,i,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{let{x:u,y:c}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||vt(e)?l.texSubImage2D(l.TEXTURE_2D,0,u,c,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,u,c,i,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,r,n){let{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_2D,this.texture),n===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(n=o.LINEAR),e!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,n||e),this.filter=e),r!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,r),this.wrap=r)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}};var ii=class{constructor(e,r,n,i=1,o=1,a=1,s=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n)){ce(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=r.height;let l=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let c=0;c<l;c++){let p=this.get(u,c);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(e,r){let n=new Uint8Array(this.data.buffer),i=this._idx(e,r)*4;return this.unpack(n[i],n[i+1],n[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,n){return e*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}pack(e){return pl(e,this.getUnpackVector())}getPixels(){return new fe({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=r*this.dim,o=r*this.dim+this.dim,a=n*this.dim,s=n*this.dim+this.dim;switch(r){case-1:i=o-1;break;case 1:o=i+1;break}switch(n){case-1:a=s-1;break;case 1:s=a+1;break}let l=-r*this.dim,u=-n*this.dim;for(let c=a;c<s;c++)for(let p=i;p<o;p++)this.data[this._idx(p,c)]=e.data[this._idx(p+l,c+u)]}};function pl(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],a=Math.min(r,n,i),s=Math.round((t+o)/a);return{r:Math.floor(s*a/r)%256,g:Math.floor(s*a/n)%256,b:Math.floor(s*a/i)%256}}I("DEMData",ii);var pa=class extends oe{constructor(e){super(e,Lp)}_createColorRamp(e){let r={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values["color-relief-color"].value.expression;if(n instanceof Je&&n._styleExpression.expression instanceof ke){this.colorRampExpression=n;let a=n._styleExpression.expression;r.elevationStops=a.labels,r.colorStops=[];for(let s of r.elevationStops)r.colorStops.push(a.evaluate({globals:{elevation:s}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[H.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=e)return r;let i={elevationStops:[],colorStops:[]},o=(r.elevationStops.length-1)/(e-1);for(let a=0;a<r.elevationStops.length-.5;a+=o)i.elevationStops.push(r.elevationStops[Math.round(a)]),i.colorStops.push(r.colorStops[Math.round(a)]);return ce(`Too many colors in specification of ${this.id} color-relief layer, may not render properly.`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,r,n){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(r),o=new fe({width:i.colorStops.length,height:1}),a=new fe({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let l=pl(i.elevationStops[s],n);a.setPixel(0,s,new H(l.r/255,l.g/255,l.b/255,1)),o.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new ni(e,a,e.gl.RGBA),colorTexture:new ni(e,o,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}};var zg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Fp,size:U1,alignment:$1}=zg;function Fr(t,e,r){let n=r.patternDependencies,i=!1;for(let o of e){let a=o.paint.get(`${t}-pattern`);a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Dr(t,e,r,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get(`${t}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},r,{},i.availableImages),c=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,r.patterns[a.id]={min:u,mid:c,max:p}}}return r}var ci=Y(ye(),1);function ml(t,e,r=2){let n=e&&e.length,i=n?e[0]*r:t.length,o=Vp(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;let s,l,u;if(n&&(o=$g(t,e,o,r)),t.length>80*r){s=t[0],l=t[1];let c=s,p=l;for(let f=r;f<i;f+=r){let y=t[f],m=t[f+1];y<s&&(s=y),m<l&&(l=m),y>c&&(c=y),m>p&&(p=m)}u=Math.max(c-s,p-l),u=u!==0?32767/u:0}return ai(o,a,r,s,l,u,0),a}function Vp(t,e,r,n,i){let o;if(i===eb(t,e,r,n)>0)for(let a=e;a<r;a+=n)o=Dp(a/n|0,t[a],t[a+1],o);else for(let a=r-n;a>=e;a-=n)o=Dp(a/n|0,t[a],t[a+1],o);return o&&Vr(o,o.next)&&(li(o),o=o.next),o}function lr(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(Vr(r,r.next)||se(r.prev,r,r.next)===0)){if(li(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function ai(t,e,r,n,i,o,a){if(!t)return;!a&&o&&Hg(t,n,i,o);let s=t;for(;t.prev!==t.next;){let l=t.prev,u=t.next;if(o?Gg(t,n,i,o):Og(t)){e.push(l.i,t.i,u.i),li(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=Ng(lr(t),e),ai(t,e,r,n,i,o,2)):a===2&&Ug(t,e,r,n,i,o):ai(lr(t),e,r,n,i,o,1);break}}}function Og(t){let e=t.prev,r=t,n=t.next;if(se(e,r,n)>=0)return!1;let i=e.x,o=r.x,a=n.x,s=e.y,l=r.y,u=n.y,c=Math.min(i,o,a),p=Math.min(s,l,u),f=Math.max(i,o,a),y=Math.max(s,l,u),m=n.next;for(;m!==e;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&oi(i,s,o,l,a,u,m.x,m.y)&&se(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Gg(t,e,r,n){let i=t.prev,o=t,a=t.next;if(se(i,o,a)>=0)return!1;let s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=Math.min(s,l,u),m=Math.min(c,p,f),h=Math.max(s,l,u),g=Math.max(c,p,f),d=fl(y,m,e,r,n),x=fl(h,g,e,r,n),b=t.prevZ,v=t.nextZ;for(;b&&b.z>=d&&v&&v.z<=x;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==a&&oi(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&oi(s,c,l,p,u,f,v.x,v.y)&&se(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=d;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==a&&oi(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&oi(s,c,l,p,u,f,v.x,v.y)&&se(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ng(t,e){let r=t;do{let n=r.prev,i=r.next.next;!Vr(n,i)&&Rp(n,r,r.next,i)&&si(n,i)&&si(i,n)&&(e.push(n.i,r.i,i.i),li(r),li(r.next),r=t=i),r=r.next}while(r!==t);return lr(r)}function Ug(t,e,r,n,i,o){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&Yg(a,s)){let l=zp(a,s);a=lr(a,a.next),l=lr(l,l.next),ai(a,e,r,n,i,o,0),ai(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function $g(t,e,r,n){let i=[];for(let o=0,a=e.length;o<a;o++){let s=e[o]*n,l=o<a-1?e[o+1]*n:t.length,u=Vp(t,s,l,n,!1);u===u.next&&(u.steiner=!0),i.push(Jg(u))}i.sort(jg);for(let o=0;o<i.length;o++)r=qg(i[o],r);return r}function jg(t,e){let r=t.x-e.x;if(r===0&&(r=t.y-e.y,r===0)){let n=(t.next.y-t.y)/(t.next.x-t.x),i=(e.next.y-e.y)/(e.next.x-e.x);r=n-i}return r}function qg(t,e){let r=Wg(t,e);if(!r)return e;let n=zp(r,t);return lr(n,n.next),lr(r,r.next)}function Wg(t,e){let r=e,n=t.x,i=t.y,o=-1/0,a;if(Vr(t,r))return r;do{if(Vr(t,r.next))return r.next;if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){let p=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(p<=n&&p>o&&(o=p,a=r.x<r.next.x?r:r.next,p===n))return a}r=r.next}while(r!==e);if(!a)return null;let s=a,l=a.x,u=a.y,c=1/0;r=a;do{if(n>=r.x&&r.x>=l&&n!==r.x&&Bp(i<u?n:o,i,l,u,i<u?o:n,i,r.x,r.y)){let p=Math.abs(i-r.y)/(n-r.x);si(r,t)&&(p<c||p===c&&(r.x>a.x||r.x===a.x&&Xg(a,r)))&&(a=r,c=p)}r=r.next}while(r!==s);return a}function Xg(t,e){return se(t.prev,t,e.prev)<0&&se(e.next,t,t.next)<0}function Hg(t,e,r,n){let i=t;do i.z===0&&(i.z=fl(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Zg(i)}function Zg(t){let e,r=1;do{let n=t,i;t=null;let o=null;for(e=0;n;){e++;let a=n,s=0;for(let u=0;u<r&&(s++,a=a.nextZ,!!a);u++);let l=r;for(;s>0||l>0&&a;)s!==0&&(l===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,s--):(i=a,a=a.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=a}o.nextZ=null,r*=2}while(e>1);return t}function fl(t,e,r,n,i){return t=(t-r)*i|0,e=(e-n)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Jg(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function Bp(t,e,r,n,i,o,a,s){return(i-a)*(e-s)>=(t-a)*(o-s)&&(t-a)*(n-s)>=(r-a)*(e-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function oi(t,e,r,n,i,o,a,s){return!(t===a&&e===s)&&Bp(t,e,r,n,i,o,a,s)}function Yg(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Kg(t,e)&&(si(t,e)&&si(e,t)&&Qg(t,e)&&(se(t.prev,t,e.prev)||se(t,e.prev,e))||Vr(t,e)&&se(t.prev,t,t.next)>0&&se(e.prev,e,e.next)>0)}function se(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Vr(t,e){return t.x===e.x&&t.y===e.y}function Rp(t,e,r,n){let i=ya(se(t,e,r)),o=ya(se(t,e,n)),a=ya(se(r,n,t)),s=ya(se(r,n,e));return!!(i!==o&&a!==s||i===0&&fa(t,r,e)||o===0&&fa(t,n,e)||a===0&&fa(r,t,n)||s===0&&fa(r,e,n))}function fa(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ya(t){return t>0?1:t<0?-1:0}function Kg(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Rp(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function si(t,e){return se(t.prev,t,t.next)<0?se(t,e,t.next)>=0&&se(t,t.prev,e)>=0:se(t,e,t.prev)<0||se(t,t.next,e)<0}function Qg(t,e){let r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==t);return n}function zp(t,e){let r=yl(t.i,t.x,t.y),n=yl(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Dp(t,e,r,n){let i=yl(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function li(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function yl(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function eb(t,e,r,n){let i=0;for(let o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}var Bt=class{constructor(e,r){if(r>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=r}getGranularityForZoomLevel(e){let r=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/r),this._minGranularity,1)}},ha=class ha{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};ha.noSubdivision=new ha({fill:new Bt(0,0),line:new Bt(0,0),tile:new Bt(0,0),stencil:new Bt(0,0),circle:1});var ma=ha;I("SubdivisionGranularityExpression",Bt);I("SubdivisionGranularitySetting",ma);var Br=-32768,ui=32767,hl=class{constructor(e,r){this._vertexBuffer=[];this._vertexDictionary=new Map;this._used=!1;this._granularity=e,this._granularityCellSize=8192/e,this._canonical=r}_getKey(e,r){return e=e+32768,r=r+32768,e<<16|r<<0}_vertexToIndex(e,r){if(e<-32768||r<-32768||e>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let n=Math.round(e)|0,i=Math.round(r)|0,o=this._getKey(n,i);if(this._vertexDictionary.has(o))return this._vertexDictionary.get(o);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(o,a),this._vertexBuffer.push(n,i),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return rb(this._vertexBuffer,e);let r=[],n=e.length;for(let i=0;i<n;i+=3){let o=[e[i+0],e[i+1],e[i+2]],a=[this._vertexBuffer[e[i+0]*2+0],this._vertexBuffer[e[i+0]*2+1],this._vertexBuffer[e[i+1]*2+0],this._vertexBuffer[e[i+1]*2+1],this._vertexBuffer[e[i+2]*2+0],this._vertexBuffer[e[i+2]*2+1]],s=1/0,l=1/0,u=-1/0,c=-1/0;for(let h=0;h<3;h++){let g=a[h*2],d=a[h*2+1];s=Math.min(s,g),u=Math.max(u,g),l=Math.min(l,d),c=Math.max(c,d)}if(s===u||l===c)continue;let p=Math.floor(s/this._granularityCellSize),f=Math.ceil(u/this._granularityCellSize),y=Math.floor(l/this._granularityCellSize),m=Math.ceil(c/this._granularityCellSize);if(p===f&&y===m){r.push(...o);continue}for(let h=y;h<m;h++){let g=this._scanlineGenerateVertexRingForCellRow(h,a,o);nb(this._vertexBuffer,g,r)}}return r}_scanlineGenerateVertexRingForCellRow(e,r,n){let i=e*this._granularityCellSize,o=i+this._granularityCellSize,a=[];for(let s=0;s<3;s++){let l=r[s*2],u=r[s*2+1],c=r[(s+1)*2%6],p=r[((s+1)*2+1)%6],f=r[(s+2)*2%6],y=r[((s+2)*2+1)%6],m=c-l,h=p-u,g=m===0,d=h===0,x=(i-u)/h,b=(o-u)/h,v=Math.min(x,b),S=Math.max(x,b);if(!d&&(v>=1||S<=0)||d&&(u<i||u>o)){p>=i&&p<=o&&a.push(n[(s+1)%3]);continue}if(!d&&v>0){let T=l+m*v,M=u+h*v;a.push(this._vertexToIndex(T,M))}let A=l+m*Math.max(v,0),w=l+m*Math.min(S,1);if(g||this._generateIntraEdgeVertices(a,l,u,c,p,A,w),!d&&S<1){let T=l+m*S,M=u+h*S;a.push(this._vertexToIndex(T,M))}(d||p>=i&&p<=o)&&a.push(n[(s+1)%3]),!d&&(p<=i||p>=o)&&this._generateInterEdgeVertices(a,l,u,c,p,f,y,w,i,o)}return a}_generateIntraEdgeVertices(e,r,n,i,o,a,s){let l=i-r,u=o-n,c=u===0,p=c?Math.min(r,i):Math.min(a,s),f=c?Math.max(r,i):Math.max(a,s),y=Math.floor(p/this._granularityCellSize)+1,m=Math.ceil(f/this._granularityCellSize)-1;if(c?r<i:a<s)for(let g=y;g<=m;g++){let d=g*this._granularityCellSize,x=n+u*(d-r)/l;e.push(this._vertexToIndex(d,x))}else for(let g=m;g>=y;g--){let d=g*this._granularityCellSize,x=n+u*(d-r)/l;e.push(this._vertexToIndex(d,x))}}_generateInterEdgeVertices(e,r,n,i,o,a,s,l,u,c){let p=o-n,f=a-i,y=s-o,m=(u-o)/y,h=(c-o)/y,g=Math.min(m,h),d=Math.max(m,h),x=i+f*g,b=Math.floor(Math.min(x,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(x,l)/this._granularityCellSize)-1,S=l<x,A=y===0;if(A&&(s===u||s===c))return;if(A||g>=1||d<=0){let T=r-a,M=n-s,D=(u-s)/M,V=(c-s)/M,z=Math.min(D,V),L=a+T*z;b=Math.floor(Math.min(L,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(L,l)/this._granularityCellSize)-1,S=l<L}let w=p>0?c:u;if(S)for(let T=b;T<=v;T++){let M=T*this._granularityCellSize;e.push(this._vertexToIndex(M,w))}else for(let T=v;T>=b;T--){let M=T*this._granularityCellSize;e.push(this._vertexToIndex(M,w))}}_generateOutline(e){let r=[];for(let n of e){let i=Ke(n,this._granularity,!0),o=this._pointArrayToIndices(i),a=[];for(let s=1;s<o.length;s++)a.push(o[s-1]),a.push(o[s]);r.push(a)}return r}_handlePoles(e){let r=!1,n=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(r||n)&&this._fillPoles(e,r,n)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let r=0;r<e.length;r+=2){let n=e[r+1];n===Br&&(e[r+1]=Br+1),n===ui&&(e[r+1]=ui-1)}}_generatePoleQuad(e,r,n,i,o,a){i>o!=(a===Br)?(e.push(r),e.push(n),e.push(this._vertexToIndex(i,a)),e.push(n),e.push(this._vertexToIndex(o,a)),e.push(this._vertexToIndex(i,a))):(e.push(n),e.push(r),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(o,a)),e.push(n),e.push(this._vertexToIndex(i,a)))}_fillPoles(e,r,n){let i=this._vertexBuffer,o=0,a=8192,s=e.length;for(let l=2;l<s;l+=3){let u=e[l-2],c=e[l-1],p=e[l],f=i[u*2],y=i[u*2+1],m=i[c*2],h=i[c*2+1],g=i[p*2],d=i[p*2+1];r&&(y===o&&h===o&&this._generatePoleQuad(e,u,c,f,m,Br),h===o&&d===o&&this._generatePoleQuad(e,c,p,m,g,Br),d===o&&y===o&&this._generatePoleQuad(e,p,u,g,f,Br)),n&&(y===a&&h===a&&this._generatePoleQuad(e,u,c,f,m,ui),h===a&&d===a&&this._generatePoleQuad(e,c,p,m,g,ui),d===a&&y===a&&this._generatePoleQuad(e,p,u,g,f,ui))}}_initializeVertices(e){for(let r=0;r<e.length;r+=2)this._vertexToIndex(e[r],e[r+1])}subdividePolygonInternal(e,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:n,holeIndices:i}=tb(e);this._initializeVertices(n);let o;try{let s=ml(n,i),l=this._convertIndices(n,s);o=this._subdivideTrianglesScanline(l)}catch(s){console.error(s)}let a=[];return r&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(o),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:a}}_convertIndices(e,r){let n=[];for(let i=0;i<r.length;i++){let o=e[r[i]*2],a=e[r[i]*2+1];n.push(this._vertexToIndex(o,a))}return n}_pointArrayToIndices(e){let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(this._vertexToIndex(i.x,i.y))}return r}};function da(t,e,r,n=!0){return new hl(r,e).subdividePolygonInternal(t,n)}function Ke(t,e,r=!1){if(!t||t.length<1)return[];if(t.length<2)return[];let n=t[0],i=t[t.length-1],o=r&&(n.x!==i.x||n.y!==i.y);if(e<2)return o?[...t,t[0]]:[...t];let a=Math.floor(8192/e),s=[];s.push(new ci.default(t[0].x,t[0].y));let l=t.length,u=o?l:l-1;for(let c=0;c<u;c++){let p=t[c],f=c<l-1?t[c+1]:t[0],y=p.x,m=p.y,h=f.x,g=f.y,d=y!==h,x=m!==g;if(!d&&!x)continue;let b=h-y,v=g-m,S=Math.abs(b),A=Math.abs(v),w=y,T=m;for(;;){let D=b>0?(Math.floor(w/a)+1)*a:(Math.ceil(w/a)-1)*a,V=v>0?(Math.floor(T/a)+1)*a:(Math.ceil(T/a)-1)*a,z=Math.abs(w-D),L=Math.abs(T-V),_=Math.abs(w-h),B=Math.abs(T-g),G=d?z/S:Number.POSITIVE_INFINITY,O=x?L/A:Number.POSITIVE_INFINITY;if((_<=z||!d)&&(B<=L||!x))break;if(G<O&&d||!x){w=D,T=T+v*G;let R=new ci.default(w,Math.round(T));(s[s.length-1].x!==R.x||s[s.length-1].y!==R.y)&&s.push(R)}else{w=w+b*O,T=V;let R=new ci.default(Math.round(w),T);(s[s.length-1].x!==R.x||s[s.length-1].y!==R.y)&&s.push(R)}}let M=new ci.default(h,g);(s[s.length-1].x!==M.x||s[s.length-1].y!==M.y)&&s.push(M)}return s}function tb(t){let e=[],r=[];for(let n of t)if(n.length!==0){n!==t[0]&&e.push(r.length/2);for(let i=0;i<n.length;i++)r.push(n[i].x),r.push(n[i].y)}return{flattened:r,holeIndices:e}}function rb(t,e){let r=[];for(let n=0;n<e.length;n+=3){let i=e[n],o=e[n+1],a=e[n+2],s=t[i*2],l=t[i*2+1],u=t[o*2],c=t[o*2+1],p=t[a*2],f=t[a*2+1],y=u-s,m=c-l,h=p-s,g=f-l;y*g-m*h>0?(r.push(i),r.push(a),r.push(o)):(r.push(i),r.push(o),r.push(a))}return r}function nb(t,e,r){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let n=0,i=t[e[0]*2];for(let l=1;l<e.length;l++){let u=t[e[l]*2];u<i&&(i=u,n=l)}let o=e.length,a=n,s=(a+1)%o;for(;;){let l=a-1>=0?a-1:o-1,u=(s+1)%o,c=t[e[l]*2],p=t[e[l]*2+1],f=t[e[u]*2],y=t[e[u]*2+1],m=t[e[a]*2],h=t[e[a]*2+1],g=t[e[s]*2],d=t[e[s]*2+1],x=!1;if(c<f)x=!0;else if(c>f)x=!1;else{let b=g-m,S=d-h,A=-b,w=h<d?1:-1,T=((c-m)*S+(p-h)*A)*w,M=((f-m)*S+(y-h)*A)*w;T>M&&(x=!0)}if(x){let b=e[l],v=e[a],S=e[s];b!==v&&b!==S&&v!==S&&r.push(S,v,b),a--,a<0&&(a=o-1)}else{let b=e[u],v=e[a],S=e[s];b!==v&&b!==S&&v!==S&&r.push(S,v,b),s++,s>=o&&(s=0)}if(l===u)break}}function ga(t,e,r,n,i,o,a,s,l){let u=i.length/2,c=a&&s&&l;if(u<pe.MAX_VERTEX_ARRAY_LENGTH){let p=e.prepareSegment(u,r,n),f=p.vertexLength;for(let h=0;h<o.length;h+=3)n.emplaceBack(f+o[h],f+o[h+1],f+o[h+2]);p.vertexLength+=u,p.primitiveLength+=o.length/3;let y,m;c&&(m=a.prepareSegment(u,r,s),y=m.vertexLength,m.vertexLength+=u);for(let h=0;h<i.length;h+=2)t(i[h],i[h+1]);if(c)for(let h=0;h<l.length;h++){let g=l[h];for(let d=1;d<g.length;d+=2)s.emplaceBack(y+g[d-1],y+g[d]);m.primitiveLength+=g.length/2}}else ib(e,r,n,i,o,t),c&&ob(a,r,s,i,l,t),e.forceNewSegmentOnNextPrepare(),a?.forceNewSegmentOnNextPrepare()}function pi(t,e,r,n,i,o,a){if(o){let s=n.count;return r(e[i*2],e[i*2+1]),t[i]=n.count,n.count++,a.vertexLength++,s}else return t[i]}function ib(t,e,r,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(let p=2;p<i.length;p+=3){let f=i[p-2],y=i[p-1],m=i[p],h=a[f]<l,g=a[y]<l,d=a[m]<l,x=(h?1:0)+(g?1:0)+(d?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,h=!0,g=!0,d=!0,c=0);let b=pi(a,n,o,s,f,h,u),v=pi(a,n,o,s,y,g,u),S=pi(a,n,o,s,m,d,u);r.emplaceBack(c+b-l,c+v-l,c+S-l),u.primitiveLength++}}function ob(t,e,r,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(let p=0;p<i.length;p++){let f=i[p];for(let y=1;y<i[p].length;y+=2){let m=f[y-1],h=f[y],g=a[m]<l,d=a[h]<l,x=(g?1:0)+(d?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,g=!0,d=!0,c=0);let b=pi(a,n,o,s,m,g,u),v=pi(a,n,o,s,h,d,u);r.emplaceBack(c+b-l,c+v-l),u.primitiveLength++}}}var ab=500,ur=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Xo,this.indexArray=new Fe,this.indexArray2=new Lt,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.segments2=new pe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Fr("fill",this.layers,r);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),f,n))continue;let y=o?i.evaluate(f,{},n,r.availableImages):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:_e(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Dr("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{},r.subdivisionGranularity);let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fp),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,n,i,o,a){for(let s of Yt(r,ab)){let l=da(s,i,a.fill.getGranularityForZoomLevel(i.z)),u=this.layoutVertexArray;ga((c,p)=>{u.emplaceBack(c,p)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles,this.segments2,this.indexArray2,l.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};I("FillBucket",ur,{omit:["layers","patternFeatures"]});var Op,sb=()=>Op=Op||new ee({"fill-sort-key":new F(P.layout_fill["fill-sort-key"])}),Gp,lb=()=>Gp=Gp||new ee({"fill-antialias":new E(P.paint_fill["fill-antialias"]),"fill-opacity":new F(P.paint_fill["fill-opacity"]),"fill-color":new F(P.paint_fill["fill-color"]),"fill-outline-color":new F(P.paint_fill["fill-outline-color"]),"fill-translate":new E(P.paint_fill["fill-translate"]),"fill-translate-anchor":new E(P.paint_fill["fill-translate-anchor"]),"fill-pattern":new pt(P.paint_fill["fill-pattern"])}),Np={get paint(){return lb()},get layout(){return sb()}};var ba=class extends oe{constructor(e){super(e,Np)}recalculate(e,r){super.recalculate(e,r);let n=this.paint._values["fill-outline-color"];n.value.kind==="constant"&&n.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new ur(e)}queryRadius(){return Dt(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:r,transform:n,pixelsToTileUnits:i}){let o=Vt(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-n.bearingInRadians,i);return aa(o,r)}isTileClipped(){return!0}};var ub=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Up=Q([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:$p,size:kS,alignment:ES}=ub;var Jp=Y(Rt(),1);var Pb=Jp.default.VectorTileFeature.types,Sb=500,bl=Math.pow(2,13);function fi(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*bl)*2+a,i*bl*2,o*bl*2,Math.round(s))}var cr=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ho,this.centroidVertexArray=new qo,this.indexArray=new Fe,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=Fr("fill-extrusion",this.layers,r);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of e){let l=this.layers[0]._featureFilter.needGeometry,u=Ne(i,l);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:_e(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Dr("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{},r.subdivisionGranularity),r.featureIndex.insert(i,c.geometry,a,s,this.index,!0)}}addFeatures(e,r,n){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,r,n,e.subdivisionGranularity)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,$p),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Up.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,n,i,o,a){for(let s of Yt(r,Sb)){let l={x:0,y:0,sampleCount:0},u=this.layoutVertexArray.length;this.processPolygon(l,i,e,s,a);let c=this.layoutVertexArray.length-u,p=Math.floor(l.x/l.sampleCount),f=Math.floor(l.y/l.sampleCount);for(let y=0;y<c;y++)this.centroidVertexArray.emplaceBack(p,f)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}processPolygon(e,r,n,i,o){if(i.length<1||Zp(i[0]))return;for(let p of i)p.length!==0&&wb(e,p);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=o.fill.getGranularityForZoomLevel(r.z),l=Pb[n.type]==="Polygon";for(let p of i){if(p.length===0||Zp(p))continue;let f=Ke(p,s,l);this._generateSideFaces(f,a)}if(!l)return;let u=da(i,r,s,!1),c=this.layoutVertexArray;ga((p,f)=>{fi(c,p,f,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,u.verticesFlattened,u.indicesTriangles)}_generateSideFaces(e,r){let n=0;for(let i=1;i<e.length;i++){let o=e[i],a=e[i-1];if(Ab(o,a))continue;r.segment.vertexLength+4>pe.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=o.sub(a)._perp()._unit(),l=a.dist(o);n+l>32768&&(n=0),fi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,n),fi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,n),n+=l,fi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,n),fi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,n);let u=r.segment.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}};function wb(t,e){for(let r=0;r<e.length;r++){let n=e[r];r===e.length-1&&e[0].x===n.x&&e[0].y===n.y||(t.x+=n.x,t.y+=n.y,t.sampleCount++)}}I("FillExtrusionBucket",cr,{omit:["layers","features"]});function Ab(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Zp(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var Yp,_b=()=>Yp=Yp||new ee({"fill-extrusion-opacity":new E(P["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new F(P["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new E(P["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new E(P["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new pt(P["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new F(P["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new F(P["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new E(P["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),Kp={get paint(){return _b()}};var va=Y(ye(),1);var Pa=class extends oe{constructor(e){super(e,Kp)}createBucket(e){return new cr(e)}queryRadius(){return Dt(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){let l=Vt(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),u=this.paint.get("fill-extrusion-height").evaluate(r,n),c=this.paint.get("fill-extrusion-base").evaluate(r,n),p=Cb(l,s,0),f=Tb(i,c,u,s),y=f[0],m=f[1];return Ib(y,m,p)}};function yi(t,e){return t.x*e.x+t.y*e.y}function Qp(t,e){if(t.length===1){let r=0,n=e[r++],i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){let o=e[r],a=t[0],s=i.sub(n),l=o.sub(n),u=a.sub(n),c=yi(s,s),p=yi(s,l),f=yi(l,l),y=yi(u,s),m=yi(u,l),h=c*f-p*p,g=(f*y-p*m)/h,d=(c*m-p*y)/h,x=1-g-d,b=n.z*x+i.z*g+o.z*d;if(isFinite(b))return b}return 1/0}else{let r=1/0;for(let n of e)r=Math.min(r,n.z);return r}}function Ib(t,e,r){let n=1/0;aa(r,e)&&(n=Qp(r,e[0]));for(let i=0;i<e.length;i++){let o=e[i],a=t[i];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=a[s],p=a[s+1],f=[l,u,p,c,l];mp(r,f)&&(n=Math.min(n,Qp(r,f)))}}return n===1/0?!1:n}function Tb(t,e,r,n){let i=[],o=[],a=n[8]*e,s=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*r,p=n[9]*r,f=n[10]*r,y=n[11]*r;for(let m of t){let h=[],g=[];for(let d of m){let x=d.x,b=d.y,v=n[0]*x+n[4]*b+n[12],S=n[1]*x+n[5]*b+n[13],A=n[2]*x+n[6]*b+n[14],w=n[3]*x+n[7]*b+n[15],T=v+a,M=S+s,D=A+l,V=w+u,z=v+c,L=S+p,_=A+f,B=w+y,G=new va.default(T/V,M/V);G.z=D/V,h.push(G);let O=new va.default(z/B,L/B);O.z=_/B,g.push(O)}i.push(h),o.push(g)}return[i,o]}function Cb(t,e,r){let n=[];for(let i of t){let o=[i.x,i.y,r,1];Wi.transformMat4(o,o,e),n.push(new va.default(o[0]/o[3],o[1]/o[3]))}return n}var kb=Q([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ef,size:fw,alignment:yw}=kb;var Eb=Q([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:tf,size:dw,alignment:gw}=Eb;var of=Y(Rt(),1);var Mb=of.default.VectorTileFeature.types,rf=63,Lb=Math.cos(75/2*(Math.PI/180)),Fb=15,Db=20,Vb=15,af=1/2,nf=Math.pow(2,Vb-1)/af,pr=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Zo,this.layoutVertexArray2=new Jo,this.indexArray=new Fe,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Fr("line",this.layers,r);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),f,n))continue;let y=o?i.evaluate(f,{},n):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:_e(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Dr("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{},r.subdivisionGranularity);let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,tf)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ef),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let r=+e.properties.mapbox_clip_start,n=+e.properties.mapbox_clip_end;return{start:r,end:n}}}addFeature(e,r,n,i,o,a){let s=this.layers[0].layout,l=s.get("line-join").evaluate(e,{}),u=s.get("line-cap"),c=s.get("line-miter-limit"),p=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let f of r)this.addLine(f,e,l,u,c,p,i,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}addLine(e,r,n,i,o,a,s,l){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let u=s?l.line.getGranularityForZoomLevel(s.z):1;if(e=Ke(e,u),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<e.length-1;v++)this.totalDistance+=e[v].dist(e[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c=Mb[r.type]==="Polygon",p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let f=0;for(;f<p-1&&e[f].equals(e[f+1]);)f++;if(p<(c?3:2))return;n==="bevel"&&(o=1.05);let y=this.overscaling<=16?Fb*8192/(512*this.overscaling):0,m=this.segments.prepareSegment(p*10,this.layoutVertexArray,this.indexArray),h,g,d,x,b;this.e1=this.e2=-1,c&&(h=e[p-2],b=e[f].sub(h)._unit()._perp());for(let v=f;v<p;v++){if(d=v===p-1?c?e[f+1]:void 0:e[v+1],d&&e[v].equals(d))continue;b&&(x=b),h&&(g=h),h=e[v],b=d?d.sub(h)._unit()._perp():x,x=x||b;let S=x.add(b);(S.x!==0||S.y!==0)&&S._unit();let A=x.x*b.x+x.y*b.y,w=S.x*b.x+S.y*b.y,T=w!==0?1/w:1/0,M=2*Math.sqrt(2-2*w),D=w<Lb&&g&&d,V=x.x*b.y-x.y*b.x>0;if(D&&v>f){let _=h.dist(g);if(_>2*y){let B=h.sub(h.sub(g)._mult(y/_)._round());this.updateDistance(g,B),this.addCurrentVertex(B,x,0,0,m),g=B}}let z=g&&d,L=z?n:c?"butt":i;if(z&&L==="round"&&(T<a?L="miter":T<=2&&(L="fakeround")),L==="miter"&&T>o&&(L="bevel"),L==="bevel"&&(T>2&&(L="flipbevel"),T<o&&(L="miter")),g&&this.updateDistance(g,h),L==="miter")S._mult(T),this.addCurrentVertex(h,S,0,0,m);else if(L==="flipbevel"){if(T>100)S=b.mult(-1);else{let _=T*x.add(b).mag()/x.sub(b).mag();S._perp()._mult(_*(V?-1:1))}this.addCurrentVertex(h,S,0,0,m),this.addCurrentVertex(h,S.mult(-1),0,0,m)}else if(L==="bevel"||L==="fakeround"){let _=-Math.sqrt(T*T-1),B=V?_:0,G=V?0:_;if(g&&this.addCurrentVertex(h,x,B,G,m),L==="fakeround"){let O=Math.round(M*180/Math.PI/Db);for(let R=1;R<O;R++){let K=R/O;if(K!==.5){let re=K-.5,me=1.0904+A*(-3.2452+A*(3.55645-A*1.43519)),Ut=.848013+A*(-1.06021+A*.215638);K=K+K*re*(K-1)*(me*re*re+Ut)}let X=b.sub(x)._mult(K)._add(x)._unit()._mult(V?-1:1);this.addHalfVertex(h,X.x,X.y,!1,V,0,m)}}d&&this.addCurrentVertex(h,b,-B,-G,m)}else if(L==="butt")this.addCurrentVertex(h,S,0,0,m);else if(L==="square"){let _=g?1:-1;this.addCurrentVertex(h,S,_,_,m)}else L==="round"&&(g&&(this.addCurrentVertex(h,x,0,0,m),this.addCurrentVertex(h,x,1,1,m,!0)),d&&(this.addCurrentVertex(h,b,-1,-1,m,!0),this.addCurrentVertex(h,b,0,0,m)));if(D&&v<p-1){let _=h.dist(d);if(_>2*y){let B=h.add(d.sub(h)._mult(y/_)._round());this.updateDistance(h,B),this.addCurrentVertex(B,b,0,0,m),h=B}}}}addCurrentVertex(e,r,n,i,o,a=!1){let s=r.x+r.y*n,l=r.y-r.x*n,u=-r.x+r.y*i,c=-r.y-r.x*i;this.addHalfVertex(e,s,l,a,!1,n,o),this.addHalfVertex(e,u,c,a,!0,-i,o),this.distance>nf/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,n,i,o,a))}addHalfVertex({x:e,y:r},n,i,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(nf-1):this.scaledDistance)*af;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(rf*n)+128,Math.round(rf*i)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let f=this.scaledDistance-this.lineClips.start,y=this.lineClips.end-this.lineClips.start,m=f/y;this.layoutVertexArray2.emplaceBack(m,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,p,this.e2),l.primitiveLength++),a?this.e2=p:this.e1=p}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}};I("LineBucket",pr,{omit:["layers","patternFeatures"]});var sf,Bb=()=>sf=sf||new ee({"line-cap":new E(P.layout_line["line-cap"]),"line-join":new F(P.layout_line["line-join"]),"line-miter-limit":new E(P.layout_line["line-miter-limit"]),"line-round-limit":new E(P.layout_line["line-round-limit"]),"line-sort-key":new F(P.layout_line["line-sort-key"])}),lf,Rb=()=>lf=lf||new ee({"line-opacity":new F(P.paint_line["line-opacity"]),"line-color":new F(P.paint_line["line-color"]),"line-translate":new E(P.paint_line["line-translate"]),"line-translate-anchor":new E(P.paint_line["line-translate-anchor"]),"line-width":new F(P.paint_line["line-width"]),"line-gap-width":new F(P.paint_line["line-gap-width"]),"line-offset":new F(P.paint_line["line-offset"]),"line-blur":new F(P.paint_line["line-blur"]),"line-dasharray":new tr(P.paint_line["line-dasharray"]),"line-pattern":new pt(P.paint_line["line-pattern"]),"line-gradient":new ft(P.paint_line["line-gradient"])}),xl={get paint(){return Rb()},get layout(){return Bb()}};var vl=class extends F{possiblyEvaluate(e,r){return r=new W(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,n,i){return r=de({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,i)}},Sa;var wa=class extends oe{constructor(e){super(e,xl),this.gradientVersion=0,Sa||(Sa=new vl(xl.paint.properties["line-width"].specification),Sa.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();fc(r)?this.stepInterpolant=r._styleExpression.expression instanceof Pr:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=Sa.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new pr(e)}queryRadius(e){let r=e,n=uf(ar("line-width",this,r),ar("line-gap-width",this,r)),i=ar("line-offset",this,r);return n/2+Math.abs(i)+Dt(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a}){let s=Vt(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*uf(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),u=this.paint.get("line-offset").evaluate(r,n);return u&&(i=bp(i,u*a)),dp(s,i,l)}isTileClipped(){return!0}};function uf(t,e){return e>0?e+2*t:t}var cf=Q([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),pf=Q([{name:"a_projected_pos",components:3,type:"Float32"}],4),Zw=Q([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),ff=Q([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),Jw=Q([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Pl=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Yw=Q([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Kw=Q([{name:"triangle",components:3,type:"Uint16"}]),Qw=Q([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),eA=Q([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),tA=Q([{type:"Float32",name:"offsetX"}]),rA=Q([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),nA=Q([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var vi=Y(ye(),1);function zb(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),we.applyArabicShaping&&(t=we.applyArabicShaping(t)),t}function yf(t,e,r){return t.sections.forEach(n=>{n.text=zb(n.text,e,r)}),t}function mf(t){let e={},r={},n=[],i=0;function o(u){n.push(t[u]),i++}function a(u,c,p){let f=r[u];return delete r[u],r[c]=f,n[f].geometry[0].pop(),n[f].geometry[0]=n[f].geometry[0].concat(p[0]),f}function s(u,c,p){let f=e[c];return delete e[c],e[u]=f,n[f].geometry[0].shift(),n[f].geometry[0]=p[0].concat(n[f].geometry[0]),f}function l(u,c,p){let f=p?c[0][c[0].length-1]:c[0][0];return`${u}:${f.x}:${f.y}`}for(let u=0;u<t.length;u++){let c=t[u],p=c.geometry,f=c.text?c.text.toString():null;if(!f){o(u);continue}let y=l(f,p),m=l(f,p,!0);if(y in r&&m in e&&r[y]!==e[m]){let h=s(y,m,p),g=a(y,m,n[h].geometry);delete e[y],delete r[m],r[l(f,n[g].geometry,!0)]=g,n[h].geometry=null}else y in r?a(y,m,p):m in e?s(y,m,p):(o(u),e[y]=i-1,r[m]=i-1)}return n.filter(u=>u.geometry)}var zr={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function hf(t){let e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;(!n||!Ys(n)||zr[t[r+1]])&&(!i||!Ys(i)||zr[t[r-1]])&&zr[t[r]]?e+=zr[t[r]]:e+=t[r]}return e}var ae=24;var rx=Y(mi(),1),nx=3;var Ia=nx;function hi(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,l)=>l.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],o=0,a=0;for(let s of t)for(let l=i.length-1;l>=0;l--){let u=i[l];if(!(s.w>u.w||s.h>u.h)){if(s.x=u.x,s.y=u.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===u.w&&s.h===u.h){let c=i.pop();c&&l<i.length&&(i[l]=c)}else s.h===u.h?(u.x+=s.w,u.w-=s.w):s.w===u.w?(u.y+=s.h,u.h-=s.h):(i.push({x:u.x+s.w,y:u.y,w:u.w-s.w,h:s.h}),u.y+=s.h,u.h-=s.h);break}}return{w:o,h:a,fill:e/(o*a)||0}}var he=1;var Ta=class{constructor(e,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a,textFitWidth:s,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n,this.textFitWidth=s,this.textFitHeight=l}get tl(){return[this.paddedRect.x+he,this.paddedRect.y+he]}get br(){return[this.paddedRect.x+this.paddedRect.w-he,this.paddedRect.y+this.paddedRect.h-he]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-he*2)/this.pixelRatio,(this.paddedRect.h-he*2)/this.pixelRatio]}},di=class{constructor(e,r){let n={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,n,o),this.addImages(r,i,o);let{w:a,h:s}=hi(o),l=new fe({width:a||1,height:s||1});for(let u in e){let c=e[u],p=n[u].paddedRect;fe.copy(c.data,l,{x:0,y:0},{x:p.x+he,y:p.y+he},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+he,y=p.y+he,m=c.data.width,h=c.data.height;fe.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),fe.copy(c.data,l,{x:0,y:h-1},{x:f,y:y-1},{width:m,height:1}),fe.copy(c.data,l,{x:0,y:0},{x:f,y:y+h},{width:m,height:1}),fe.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:h}),fe.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:h})}this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(e,r,n){for(let i in e){let o=e[i],a={x:0,y:0,w:o.data.width+2*he,h:o.data.height+2*he};n.push(a),r[i]=new Ta(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),r)}patchUpdatedImage(e,r,n){if(!e||!r||e.version===r.version)return;e.version=r.version;let[i,o]=e.tl;n.update(r.data,void 0,{x:i,y:o})}};I("ImagePosition",Ta);I("ImageAtlas",di);var Ea=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(Ea||{}),bi=-17;function ix(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}var Sf=57344,wf=63743,Ca=class t{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(e,r,n){let i=new t;return i.scale=e||1,i.fontStack=r,i.verticalAlign=n||"bottom",i}static forImage(e,r){let n=new t;return n.imageName=e,n.verticalAlign=r||"bottom",n}},gi=class t{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){let n=new t;for(let i=0;i<e.sections.length;i++){let o=e.sections[i];o.image?n.addImageSection(o):n.addTextSection(o,r)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=hf(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&ka[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&ka[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){let n=new t;return n.text=this.text.substring(e,r),n.sectionIndex=this.sectionIndex.slice(e,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,n=0;for(let i=0;i<this.length();i++){let o=this.getSection(i);if(o.imageName){let a=e[o.imageName];if(!a)continue;let s=a.displaySize;r=Math.max(r,s[0]),n=Math.max(n,s[1])}}return{maxImageWidth:r,maxImageHeight:n}}addTextSection(e,r){this.text+=e.text,this.sections.push(Ca.forText(e.scale,e.fontStack||r,e.verticalAlign));let n=this.sections.length-1;for(let i=0;i<e.text.length;++i)this.sectionIndex.push(n)}addImageSection(e){let r=e.image?e.image.name:"";if(r.length===0){ce("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){ce(`Reached maximum number of images ${wf-Sf+2}`);return}this.text+=String.fromCharCode(n),this.sections.push(Ca.forImage(r,e.verticalAlign)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=wf?null:++this.imageSectionID:(this.imageSectionID=Sf,this.imageSectionID)}};function ox(t,e){let r=[],n=t.text,i=0;for(let o of e)r.push(t.substring(i,o)),i=o;return i<n.length&&r.push(t.substring(i,n.length)),r}function xi(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=gi.fromFeature(t,i);p===2&&h.verticalizePunctuation();let g,{processBidirectionalText:d,processStyledBidirectionalText:x}=we;if(d&&h.sections.length===1){g=[];let S=d(h.toString(),Al(h,u,o,e,n,y));for(let A of S){let w=new gi;w.text=A,w.sections=h.sections;for(let T=0;T<A.length;T++)w.sectionIndex.push(0);g.push(w)}}else if(x){g=[];let S=x(h.text,h.sectionIndex,Al(h,u,o,e,n,y));for(let A of S){let w=new gi;w.text=A[0],w.sectionIndex=A[1],w.sections=h.sections,g.push(w)}}else g=ox(h,Al(h,u,o,e,n,y));let b=[],v={positionedLines:b,text:h.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return yx(v,e,r,n,g,a,s,l,p,u,f,m),ix(b)?!1:v}var ka={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ax={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},sx={40:!0};function If(t,e,r,n,i,o){if(e.imageName){let a=n[e.imageName];return a?a.displaySize[0]*e.scale*ae/o+i:0}else{let a=r[e.fontStack],s=a&&a[t];return s?s.metrics.advance*e.scale+i:0}}function lx(t,e,r,n,i,o){let a=0;for(let l=0;l<t.length();l++){let u=t.getSection(l);a+=If(t.getCharCode(l),u,n,i,e,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function Af(t,e,r,n){let i=Math.pow(t-e,2);return n?t<e?i/2:i*2:i+Math.abs(r)*r}function ux(t,e,r){let n=0;return t===10&&(n-=1e4),r&&(n+=150),(t===40||t===65288)&&(n+=50),(e===41||e===65289)&&(n+=50),n}function _f(t,e,r,n,i,o){let a=null,s=Af(e,r,i,o);for(let l of n){let u=e-l.x,c=Af(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:t,x:e,priorBreak:a,badness:s}}function Tf(t){return t?Tf(t.priorBreak).concat(t.index):[]}function Al(t,e,r,n,i,o){if(!t)return[];let a=[],s=lx(t,e,r,n,i,o),l=t.text.indexOf("\\u200B")>=0,u=0;for(let c=0;c<t.length();c++){let p=t.getSection(c),f=t.getCharCode(c);if(ka[f]||(u+=If(f,p,n,i,e,o)),c<t.length()-1){let y=Yc(f);(ax[f]||y||p.imageName||c!==t.length()-2&&sx[t.getCharCode(c+1)])&&a.push(_f(c+1,u,s,a,ux(f,t.getCharCode(c+1),y&&l),!1))}}return Tf(_f(t.length(),u,s,a,0,!0))}function Cf(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0;break}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0;break}return{horizontalAlign:e,verticalAlign:r}}function cx(t,e,r){let n=e.getMaxScale()*ae,{maxImageWidth:i,maxImageHeight:o}=e.getMaxImageSize(t),a=Math.max(n,o*r);return{verticalLineContentWidth:Math.max(n,i*r),horizontalLineContentHeight:a}}function kf(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function px(t,e,r,n){if(t&&t.rect)return t;let i=e[r.fontStack],o=i&&i[n];return o?{rect:null,metrics:o.metrics}:null}function fx(t,e,r){return!(t===1||!e&&!Mo(r)||e&&(ka[r]||Kc(r)))}function yx(t,e,r,n,i,o,a,s,l,u,c,p){let f=0,y=0,m=0,h=0,g=s==="right"?1:s==="left"?0:.5,d=ae/p,x=0;for(let S of i){S.trim();let A=S.getMaxScale(),w={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=w;let T=w.positionedGlyphs,M=0;if(!S.length()){y+=o,++x;continue}let D=cx(n,S,d);for(let L=0;L<S.length();L++){let _=S.getSection(L),B=S.getSectionIndex(L),G=S.getCharCode(L),O=fx(l,c,G),R;if(_.imageName){if(t.iconsInText=!0,_.scale=_.scale*d,R=hx(_,O,A,D,n),!R)continue;M=Math.max(M,R.imageOffset)}else if(R=mx(_,G,O,D,e,r),!R)continue;let{rect:K,metrics:X,baselineOffset:re}=R;if(T.push({glyph:G,imageName:_.imageName,x:f,y:y+re+bi,vertical:O,scale:_.scale,fontStack:_.fontStack,sectionIndex:B,metrics:X,rect:K}),!O)f+=X.advance*_.scale+u;else{t.verticalizable=!0;let me=_.imageName?X.advance:ae;f+=me*_.scale+u}}if(T.length!==0){let L=f-u;m=Math.max(L,m),dx(T,0,T.length-1,g)}f=0;let V=(A-1)*ae;w.lineOffset=Math.max(M,V);let z=o*A+M;y+=z,h=Math.max(z,h),++x}let{horizontalAlign:b,verticalAlign:v}=Cf(a);gx(t.positionedLines,g,b,v,m,h,o,y,i.length),t.top+=-v*y,t.bottom=t.top+y,t.left+=-b*m,t.right=t.left+m}function mx(t,e,r,n,i,o){let a=o[t.fontStack],s=a&&a[e],l=px(s,i,t,e);if(l===null)return null;let u;if(r)u=n.verticalLineContentWidth-t.scale*ae;else{let c=kf(t.verticalAlign);u=(n.horizontalLineContentHeight-t.scale*ae)*c}return{rect:l.rect,metrics:l.metrics,baselineOffset:u}}function hx(t,e,r,n,i){let o=i[t.imageName];if(!o)return null;let a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:he,top:-Ia,advance:e?s[1]:s[0]},u;if(e)u=n.verticalLineContentWidth-s[1]*t.scale;else{let p=kf(t.verticalAlign);u=(n.horizontalLineContentHeight-s[1]*t.scale)*p}let c=(e?s[0]:s[1])*t.scale-ae*r;return{rect:a,metrics:l,baselineOffset:u,imageOffset:c}}function dx(t,e,r,n){if(n===0)return;let i=t[r],o=i.metrics.advance*i.scale,a=(t[r].x+o)*n;for(let s=e;s<=r;s++)t[s].x-=a}function gx(t,e,r,n,i,o,a,s,l){let u=(e-r)*i,c=0;o!==a?c=-s*n-bi:c=-n*l*a+.5*a;for(let p of t)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function Ef(t,e,r){let{horizontalAlign:n,verticalAlign:i}=Cf(r),o=e[0],a=e[1],s=o-t.displaySize[0]*n,l=s+t.displaySize[0],u=a-t.displaySize[1]*i,c=u+t.displaySize[1];return{image:t,top:u,bottom:c,left:s,right:l}}function Ma(t){let e=t.left,r=t.top,n=t.right-e,i=t.bottom-r,o=t.image.content[2]-t.image.content[0],a=t.image.content[3]-t.image.content[1],s=t.image.textFitWidth??"stretchOrShrink",l=t.image.textFitHeight??"stretchOrShrink",u=o/a;if(l==="proportional"){if(s==="stretchOnly"&&n/i<u||s==="proportional"){let c=Math.ceil(i*u);e*=c/n,n=c}}else if(s==="proportional"&&l==="stretchOnly"&&u!==0&&n/i>u){let c=Math.ceil(n/u);r*=c/i,i=c}return{x1:e,y1:r,x2:e+n,y2:r+i}}function _l(t,e,r,n,i,o){let a=t.image,s;if(a.content){let g=a.content,d=a.pixelRatio||1;s=[g[0]/d,g[1]/d,a.displaySize[0]-g[2]/d,a.displaySize[1]-g[3]/d]}let l=e.left*o,u=e.right*o,c,p,f,y;r==="width"||r==="both"?(y=i[0]+l-n[3],p=i[0]+u+n[1]):(y=i[0]+(l+u-a.displaySize[0])/2,p=y+a.displaySize[0]);let m=e.top*o,h=e.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+h+n[2]):(c=i[1]+(m+h-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var Mf=Y(Rt(),1);var Nr=255,zt=128,Qe=Nr*zt;function Il(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new W(t+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:n,interpolationType:i}=r,o=0;for(;o<n.length&&n[o]<=t;)o++;o=Math.max(0,o-1);let a=o;for(;a<n.length&&n[a]<t+1;)a++;a=Math.min(n.length-1,a);let s=n[o],l=n[a];if(r.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let u=r.evaluate(new W(s)),c=r.evaluate(new W(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function Tl(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var bx=Mf.default.VectorTileFeature.types,xx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function La(t,e,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(Qe,Math.round(s[0])):0,m=s?Math.min(Qe,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(n*32),Math.round(i*32),o,a,(y<<1)+(l?1:0),m,u*16,c*16,p*256,f*256)}function Lf(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function vx(t){for(let e of t.sections)if(ep(e.text))return!0;return!1}var Pi=class{constructor(e){this.layoutVertexArray=new Yo,this.indexArray=new Fe,this.programConfigurations=e,this.segments=new pe,this.dynamicLayoutVertexArray=new Ko,this.opacityVertexArray=new Qo,this.hasVisibleVertices=!1,this.placedSymbolArray=new qn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,cf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,pf.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,xx,!0),this.opacityVertexBuffer.itemSize=1),(n||i)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};I("SymbolBuffers",Pi);var Si=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new pe,this.collisionVertexArray=new ea}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,ff.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};I("CollisionBuffers",Si);var Xe=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(l=>l.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Il(this.zoom,n["text-size"]),this.iconSizeData=Il(this.zoom,n["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=Tl(i,"text-overlap","text-allow-overlap")!=="never"||Tl(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>Ea[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new Pi(new Ae(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Pi(new Ae(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Xn,this.lineVertexArray=new Hn,this.symbolInstances=new Wn,this.textAnchorOffsets=new Zn}calculateGlyphDependencies(e,r,n,i,o){for(let a=0;a<e.length;a++)if(r[e.charCodeAt(a)]=!0,(n||i)&&o){let s=zr[e.charAt(a)];s&&(r[s.charCodeAt(0)]=!0)}}populate(e,r,n){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=(s.value.kind!=="constant"||s.value.value instanceof Ee&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=r.iconDependencies,y=r.glyphDependencies,m=r.availableImages,h=new W(this.zoom,{globalState:this.globalState});for(let{feature:g,id:d,index:x,sourceLayerIndex:b}of e){let v=i._featureFilter.needGeometry,S=Ne(g,v);if(!i._featureFilter.filter(h,S,n))continue;v||(S.geometry=_e(g));let A;if(u){let D=i.getValueAndResolveTokens("text-field",S,n,m),V=Ee.factory(D),z=this.hasRTLText=this.hasRTLText||vx(V);(!z||we.getRTLTextPluginStatus()==="unavailable"||z&&we.isParsed())&&(A=yf(V,i,S))}let w;if(c){let D=i.getValueAndResolveTokens("icon-image",S,n,m);D instanceof Se?w=D:w=Se.fromString(D)}if(!A&&!w)continue;let T=this.sortFeaturesByKey?p.evaluate(S,{},n):void 0,M={id:d,text:A,icon:w,index:x,sourceLayerIndex:b,geometry:S.geometry,properties:g.properties,type:bx[g.type],sortKey:T};if(this.features.push(M),w&&(f[w.name]=!0),A){let D=a.evaluate(S,{},n).join(","),V=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let z of A.sections)if(z.image)f[z.image.name]=!0;else{let L=In(A.toString()),_=z.fontStack||D,B=y[_]=y[_]||{};this.calculateGlyphDependencies(z.text,B,V,this.allowVerticalPlacement,L)}}}o.get("symbol-placement")==="line"&&(this.features=mf(this.features)),this.sortFeaturesByKey&&this.features.sort((g,d)=>g.sortKey-d.sortKey)}update(e,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){let n=this.lineVertexArray.length;if(e.segment!==void 0){let i=e.dist(r[e.segment+1]),o=e.dist(r[e.segment]),a={};for(let s=e.segment+1;s<r.length;s++)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:i},s<r.length-1&&(i+=r[s+1].dist(r[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=r[s-1].dist(r[s]));for(let s=0;s<r.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,r,n,i,o,a,s,l,u,c,p,f){let y=e.indexArray,m=e.layoutVertexArray,h=e.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,d=h.vertexLength,x=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<r.length;v++){let{tl:S,tr:A,bl:w,br:T,tex:M,pixelOffsetTL:D,pixelOffsetBR:V,minFontScaleX:z,minFontScaleY:L,glyphOffset:_,isSDF:B,sectionIndex:G}=r[v],O=h.vertexLength,R=_[1];La(m,l.x,l.y,S.x,R+S.y,M.x,M.y,n,B,D.x,D.y,z,L),La(m,l.x,l.y,A.x,R+A.y,M.x+M.w,M.y,n,B,V.x,D.y,z,L),La(m,l.x,l.y,w.x,R+w.y,M.x,M.y+M.h,n,B,D.x,V.y,z,L),La(m,l.x,l.y,T.x,R+T.y,M.x+M.w,M.y+M.h,n,B,V.x,V.y,z,L),Lf(e.dynamicLayoutVertexArray,l,x),y.emplaceBack(O,O+2,O+1),y.emplaceBack(O+1,O+2,O+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(_[0]),(v===r.length-1||G!==r[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,b&&b[G])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,d,u,c,l.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],s,0,!1,0,p)}_addCollisionDebugVertex(e,r,n,i,o,a){return r.emplaceBack(0,0),e.emplaceBack(n.x,n.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,r,n,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,f=s.anchorX,y=s.anchorY;this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(e,r)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(e,i)),l.vertexLength+=4;let m=o.indexArray;m.emplaceBack(u,u+1),m.emplaceBack(u+1,u+2),m.emplaceBack(u+2,u+3),m.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(e,r,n,i){for(let o=e;o<r;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,u=a.x2,c=a.y2;this.addCollisionDebugVertices(s,l,u,c,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Si(Yn,Pl.members,Lt),this.iconCollisionBox=new Si(Yn,Pl.members,Lt);for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,n,i,o,a,s,l,u){let c={};for(let p=r;p<n;p++){let f=e.get(p);c.textBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.textFeatureIndex=f.featureIndex;break}for(let p=i;p<o;p++){let f=e.get(p);c.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalTextFeatureIndex=f.featureIndex;break}for(let p=a;p<s;p++){let f=e.get(p);c.iconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.iconFeatureIndex=f.featureIndex;break}for(let p=l;p<u;p++){let f=e.get(p);c.verticalIconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalIconFeatureIndex=f.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){let n=e.placedSymbolArray.get(r),i=n.vertexStartIndex+n.numGlyphs*4;for(let o=n.vertexStartIndex;o<i;o+=4)e.indexArray.emplaceBack(o,o+2,o+1),e.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(e),n=Math.cos(e),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(r*l.anchorX+n*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||o[l]-o[s]),a}addToSortKeyRanges(e,r){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};I("SymbolBucket",Xe,{omit:["layers","collisionBoxArray","features","compareText"]});Xe.MAX_GLYPHS=65535;Xe.addDynamicAttributes=Lf;function Ff(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>t&&n in t?String(t[n]):"")}var Df,Px=()=>Df=Df||new ee({"symbol-placement":new E(P.layout_symbol["symbol-placement"]),"symbol-spacing":new E(P.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new E(P.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new F(P.layout_symbol["symbol-sort-key"]),"symbol-z-order":new E(P.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new E(P.layout_symbol["icon-allow-overlap"]),"icon-overlap":new E(P.layout_symbol["icon-overlap"]),"icon-ignore-placement":new E(P.layout_symbol["icon-ignore-placement"]),"icon-optional":new E(P.layout_symbol["icon-optional"]),"icon-rotation-alignment":new E(P.layout_symbol["icon-rotation-alignment"]),"icon-size":new F(P.layout_symbol["icon-size"]),"icon-text-fit":new E(P.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new E(P.layout_symbol["icon-text-fit-padding"]),"icon-image":new F(P.layout_symbol["icon-image"]),"icon-rotate":new F(P.layout_symbol["icon-rotate"]),"icon-padding":new F(P.layout_symbol["icon-padding"]),"icon-keep-upright":new E(P.layout_symbol["icon-keep-upright"]),"icon-offset":new F(P.layout_symbol["icon-offset"]),"icon-anchor":new F(P.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new E(P.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new E(P.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new E(P.layout_symbol["text-rotation-alignment"]),"text-field":new F(P.layout_symbol["text-field"]),"text-font":new F(P.layout_symbol["text-font"]),"text-size":new F(P.layout_symbol["text-size"]),"text-max-width":new F(P.layout_symbol["text-max-width"]),"text-line-height":new E(P.layout_symbol["text-line-height"]),"text-letter-spacing":new F(P.layout_symbol["text-letter-spacing"]),"text-justify":new F(P.layout_symbol["text-justify"]),"text-radial-offset":new F(P.layout_symbol["text-radial-offset"]),"text-variable-anchor":new E(P.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new F(P.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new F(P.layout_symbol["text-anchor"]),"text-max-angle":new E(P.layout_symbol["text-max-angle"]),"text-writing-mode":new E(P.layout_symbol["text-writing-mode"]),"text-rotate":new F(P.layout_symbol["text-rotate"]),"text-padding":new E(P.layout_symbol["text-padding"]),"text-keep-upright":new E(P.layout_symbol["text-keep-upright"]),"text-transform":new F(P.layout_symbol["text-transform"]),"text-offset":new F(P.layout_symbol["text-offset"]),"text-allow-overlap":new E(P.layout_symbol["text-allow-overlap"]),"text-overlap":new E(P.layout_symbol["text-overlap"]),"text-ignore-placement":new E(P.layout_symbol["text-ignore-placement"]),"text-optional":new E(P.layout_symbol["text-optional"])}),Vf,Sx=()=>Vf=Vf||new ee({"icon-opacity":new F(P.paint_symbol["icon-opacity"]),"icon-color":new F(P.paint_symbol["icon-color"]),"icon-halo-color":new F(P.paint_symbol["icon-halo-color"]),"icon-halo-width":new F(P.paint_symbol["icon-halo-width"]),"icon-halo-blur":new F(P.paint_symbol["icon-halo-blur"]),"icon-translate":new E(P.paint_symbol["icon-translate"]),"icon-translate-anchor":new E(P.paint_symbol["icon-translate-anchor"]),"text-opacity":new F(P.paint_symbol["text-opacity"]),"text-color":new F(P.paint_symbol["text-color"],{runtimeType:ze,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new F(P.paint_symbol["text-halo-color"]),"text-halo-width":new F(P.paint_symbol["text-halo-width"]),"text-halo-blur":new F(P.paint_symbol["text-halo-blur"]),"text-translate":new E(P.paint_symbol["text-translate"]),"text-translate-anchor":new E(P.paint_symbol["text-translate-anchor"])}),Fa={get paint(){return Sx()},get layout(){return Px()}};var wi=class{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:wr,this.defaultValue=e}evaluate(e){if(e.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let r=this.defaultValue.value;e(r._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};I("FormatSectionOverride",wi,{omit:["defaultValue"]});var Da=class t extends oe{constructor(e){super(e,Fa)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let i=[];for(let o of n)i.indexOf(o)<0&&i.push(o);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,n,i){let o=this.layout.get(e).evaluate(r,{},n,i),a=this._unevaluatedLayout._values[e];return!a.isDataDriven()&&!wn(a.value)&&o?Ff(r.properties,o):o}createBucket(e){return new Xe(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Fa.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new wi(r),i=new Ht(n,r.property.specification),o=null;r.value.kind==="constant"||r.value.kind==="source"?o=new Je("source",i):o=new Tt("composite",i,r.value.zoomStops),this.paint._values[e]=new ge(r.property,o,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,n){return!this.layout||r.isDataDriven()||n.isDataDriven()?!1:t.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let n=e.get("text-field"),i=Fa.paint.properties[r],o=!1,a=s=>{for(let l of s)if(i.overrides&&i.overrides.hasOverride(l)){o=!0;return}};if(n.value.kind==="constant"&&n.value.value instanceof Ee)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof _t&&ue(u.value)===Ar){let c=u.value;a(c.sections)}else u instanceof pn?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};function Bf(t,e,r,n=1){let i=t.get("icon-padding").evaluate(e,{},r),o=i&&i.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}var Rf,wx=()=>Rf=Rf||new ee({"background-color":new E(P.paint_background["background-color"]),"background-pattern":new tr(P.paint_background["background-pattern"]),"background-opacity":new E(P.paint_background["background-opacity"])}),zf={get paint(){return wx()}};var Va=class extends oe{constructor(e){super(e,zf)}};var Of,Ax=()=>Of=Of||new ee({"raster-opacity":new E(P.paint_raster["raster-opacity"]),"raster-hue-rotate":new E(P.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new E(P.paint_raster["raster-brightness-min"]),"raster-brightness-max":new E(P.paint_raster["raster-brightness-max"]),"raster-saturation":new E(P.paint_raster["raster-saturation"]),"raster-contrast":new E(P.paint_raster["raster-contrast"]),"raster-resampling":new E(P.paint_raster["raster-resampling"]),"raster-fade-duration":new E(P.paint_raster["raster-fade-duration"])}),Gf={get paint(){return Ax()}};var Ba=class extends oe{constructor(e){super(e,Gf)}};var Ra=class extends oe{constructor(r){super(r,{});this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)};this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)};this.implementation=r}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function Nf(t){if(t.type==="custom")return new Ra(t);switch(t.type){case"background":return new Va(t);case"circle":return new la(t);case"color-relief":return new pa(t);case"fill":return new ba(t);case"fill-extrusion":return new Pa(t);case"heatmap":return new ua(t);case"hillshade":return new ca(t);case"line":return new wa(t);case"raster":return new Ba(t);case"symbol":return new Da(t)}}var za=class{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(e,r){for(let i of e){this._layerConfigs[i.id]=i;let o=this._layers[i.id]=Nf(i);o._featureFilter=Ct(o.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(let i of r)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];this.familiesBySource={};let n=dc(Object.values(this._layerConfigs),this.keyCache);for(let i of n){let o=i.map(p=>this._layers[p.id]),a=o[0];if(a.visibility==="none")continue;let s=a.source||"",l=this.familiesBySource[s];l||(l=this.familiesBySource[s]={});let u=a.sourceLayer||"_geojsonTileLayer",c=l[u];c||(c=l[u]=[]),c.push(o)}}};var fy=Y(Rt(),1),yy=Y(mi(),1);var Ur=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){let n=e[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}};var $f=Y(Rt(),1),jf=Y(mi(),1);var Oa=class{constructor(e,r,n,i,o){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=n,e._y=i,this.properties=e.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let r in this)r==="_geometry"||r==="_vectorTileFeature"||(e[r]=this[r]);return e}};var Ai=Y(ye(),1),fr=class t{constructor(){this.minX=1/0;this.maxX=-1/0;this.minY=1/0;this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let r=new t;return r.extend(e(new Ai.default(this.minX,this.minY))),r.extend(e(new Ai.default(this.maxX,this.minY))),r.extend(e(new Ai.default(this.minX,this.maxY))),r.extend(e(new Ai.default(this.maxX,this.maxY))),r}static fromPoints(e){let r=new t;for(let n of e)r.extend(n);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}};var _i=class{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new $t(8192,16,0),this.grid3D=new $t(8192,16,0),this.featureIndexArray=new Jn,this.promoteId=r}insert(e,r,n,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,i,o);let l=a?this.grid3D:this.grid;for(let u=0;u<r.length;u++){let c=r[u],p=[1/0,1/0,-1/0,-1/0];for(let f=0;f<c.length;f++){let y=c[f];p[0]=Math.min(p[0],y.x),p[1]=Math.min(p[1],y.y),p[2]=Math.max(p[2],y.x),p[3]=Math.max(p[3],y.y)}p[0]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new $f.default.VectorTile(new jf.default(this.rawTileData)).layers,this.sourceLayerCoder=new Ur(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,n,i){this.loadVTLayers();let o=e.params,a=8192/e.tileSize/e.scale,s=Ct(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=fr.fromPoints(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=fr.fromPoints(e.cameraQueryGeometry).expandBy(u),y=this.grid3D.query(f.minX,f.minY,f.maxX,f.maxY,(g,d,x,b)=>gp(e.cameraQueryGeometry,g-u,d-u,x+u,b+u));for(let g of y)p.push(g);p.sort(_x);let m={},h;for(let g=0;g<p.length;g++){let d=p[g];if(d===h)continue;h=d;let x=this.featureIndexArray.get(d),b=null;this.loadMatchingFeature(m,x.bucketIndex,x.sourceLayerIndex,x.featureIndex,s,o.layers,o.availableImages,r,n,i,(v,S,A)=>(b||(b=_e(v)),S.queryIntersectsFeature({queryGeometry:l,feature:v,featureState:A,geometry:b,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return m}loadMatchingFeature(e,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!f.some(d=>a.has(d)))return;let y=this.sourceLayerCoder.decode(n),h=this.vtLayers[y].feature(i);if(o.needGeometry){let d=Ne(h,!0);if(!o.filter(new W(this.tileID.overscaledZ),d,this.tileID.canonical))return}else if(!o.filter(new W(this.tileID.overscaledZ),h))return;let g=this.getId(h,y);for(let d=0;d<f.length;d++){let x=f[d];if(a&&!a.has(x))continue;let b=l[x];if(!b)continue;let v={};g&&c&&(v=c.getState(b.sourceLayer||"_geojsonTileLayer",g));let S=de({},u[x]);S.paint=Uf(S.paint,b.paint,h,v,s),S.layout=Uf(S.layout,b.layout,h,v,s);let A=!p||p(h,b,v);if(!A)continue;let w=new Oa(h,this.z,this.x,this.y,g);w.layer=S;let T=e[x];T===void 0&&(T=e[x]=[]),T.push({featureIndex:i,feature:w,intersectionZ:A})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=Ct(o);for(let p of e)this.loadMatchingFeature(u,n,i,p,c,a,s,l,r);return u}hasLayer(e){for(let r of this.bucketLayerIDs)for(let n of r)if(e===n)return!0;return!1}getId(e,r){let n=e.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[r];n=e.properties[i],typeof n=="boolean"&&(n=Number(n)),n===void 0&&e.properties?.cluster&&this.promoteId&&(n=Number(e.properties.cluster_id))}return n}};I("FeatureIndex",_i,{omit:["rawTileData","sourceLayerCoder"]});function Uf(t,e,r,n,i){return tn(t,(o,a)=>{let s=e instanceof kt?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function _x(t,e){return e-t}var qf=Y(ye(),1);var et=class t extends qf.default{constructor(e,r,n,i){super(e,r),this.angle=n,i!==void 0&&(this.segment=i)}clone(){return new t(this.x,this.y,this.angle,this.segment)}};I("Anchor",et);function Cl(t,e,r,n,i){if(e.segment===void 0||r===0)return!0;let o=e,a=e.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;let l=[],u=0;for(;s<r/2;){let c=t[a-1],p=t[a],f=t[a+1];if(!f)return!1;let y=c.angleTo(p)-p.angleTo(f);for(y=Math.abs((y+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:s,angleDelta:y}),u+=y;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=p.dist(f)}return!0}function Wf(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Xf(t,e,r){return t?3/5*e*r:0}function Hf(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Zf(t,e,r,n,i,o){let a=Xf(r,i,o),s=Hf(r,n)*o,l=0,u=Wf(t)/2;for(let c=0;c<t.length-1;c++){let p=t[c],f=t[c+1],y=p.dist(f);if(l+y>u){let m=(u-l)/y,h=lt.number(p.x,f.x,m),g=lt.number(p.y,f.y,m),d=new et(h,g,f.angleTo(p),c);return d._round(),!a||Cl(t,d,s,a,e)?d:void 0}l+=y}}function Jf(t,e,r,n,i,o,a,s,l){let u=Xf(n,o,a),c=Hf(n,i),p=c*a,f=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-p<e/4&&(e=p+e/4);let y=o*2,m=f?e/2*s%e:(c/2+y)*a*s%e;return Yf(t,m,e,u,r,p,f,!1,l)}function Yf(t,e,r,n,i,o,a,s,l){let u=o/2,c=Wf(t),p=0,f=e-r,y=[];for(let m=0;m<t.length-1;m++){let h=t[m],g=t[m+1],d=h.dist(g),x=g.angleTo(h);for(;f+r<p+d;){f+=r;let b=(f-p)/d,v=lt.number(h.x,g.x,b),S=lt.number(h.y,g.y,b);if(v>=0&&v<l&&S>=0&&S<l&&f-u>=0&&f+u<=c){let A=new et(v,S,x,m);A._round(),(!n||Cl(t,A,o,n,i))&&y.push(A)}}p+=d}return!s&&!y.length&&!a&&(y=Yf(t,p/2,r,n,i,o,a,!0,l)),y}var ht=Y(ye(),1);function Kf(t,e,r,n,i){let o=[];for(let a=0;a<t.length;a++){let s=t[a],l;for(let u=0;u<s.length-1;u++){let c=s[u],p=s[u+1];c.x<e&&p.x<e||(c.x<e?c=new ht.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new ht.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round()),!(c.y<r&&p.y<r)&&(c.y<r?c=new ht.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new ht.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round()),!(c.x>=n&&p.x>=n)&&(c.x>=n?c=new ht.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new ht.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round()),!(c.y>=i&&p.y>=i)&&(c.y>=i?c=new ht.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new ht.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round()),(!l||!c.equals(l[l.length-1]))&&(l=[c],o.push(l)),l.push(p)))))}}return o}var be=Y(ye(),1);var $r=he;function kl(t,e,r,n){let i=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*$r,l=o.paddedRect.h-2*$r,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},c=o.stretchX||[[0,s]],p=o.stretchY||[[0,l]],f=(_,B)=>_+B[1]-B[0],y=c.reduce(f,0),m=p.reduce(f,0),h=s-y,g=l-m,d=0,x=y,b=0,v=m,S=0,A=h,w=0,T=g;if(o.content&&n){let _=o.content,B=_[2]-_[0],G=_[3]-_[1];(o.textFitWidth||o.textFitHeight)&&(u=Ma(t)),d=Ga(c,0,_[0]),b=Ga(p,0,_[1]),x=Ga(c,_[0],_[2]),v=Ga(p,_[1],_[3]),S=_[0]-d,w=_[1]-b,A=B-x,T=G-v}let M=u.x1,D=u.y1,V=u.x2-M,z=u.y2-D,L=(_,B,G,O)=>{let R=Na(_.stretch-d,x,V,M),K=Ua(_.fixed-S,A,_.stretch,y),X=Na(B.stretch-b,v,z,D),re=Ua(B.fixed-w,T,B.stretch,m),me=Na(G.stretch-d,x,V,M),Ut=Ua(G.fixed-S,A,G.stretch,y),tt=Na(O.stretch-b,v,z,D),gt=Ua(O.fixed-w,T,O.stretch,m),Gi=new be.default(R,X),Ni=new be.default(me,X),Ui=new be.default(me,tt),$i=new be.default(R,tt),is=new be.default(K/a,re/a),Ie=new be.default(Ut/a,gt/a),bt=e*Math.PI/180;if(bt){let xt=Math.sin(bt),Zr=Math.cos(bt),Ve=[Zr,-xt,xt,Zr];Gi._matMult(Ve),Ni._matMult(Ve),$i._matMult(Ve),Ui._matMult(Ve)}let Hr=_.stretch+_.fixed,os=G.stretch+G.fixed,ji=B.stretch+B.fixed,as=O.stretch+O.fixed,Te={x:o.paddedRect.x+$r+Hr,y:o.paddedRect.y+$r+ji,w:os-Hr,h:as-ji},xe=A/a/V,rt=T/a/z;return{tl:Gi,tr:Ni,bl:$i,br:Ui,tex:Te,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:is,pixelOffsetBR:Ie,minFontScaleX:xe,minFontScaleY:rt,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(L({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let _=Qf(c,h,y),B=Qf(p,g,m);for(let G=0;G<_.length-1;G++){let O=_[G],R=_[G+1];for(let K=0;K<B.length-1;K++){let X=B[K],re=B[K+1];i.push(L(O,X,R,re))}}}return i}function Ga(t,e,r){let n=0;for(let i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function Qf(t,e,r){let n=[{fixed:-$r,stretch:0}];for(let[i,o]of t){let a=n[n.length-1];n.push({fixed:i-a.stretch,stretch:a.stretch}),n.push({fixed:i-a.stretch,stretch:a.stretch+(o-i)})}return n.push({fixed:e+$r,stretch:r}),n}function Na(t,e,r,n){return t/e*r+n}function Ua(t,e,r,n){return t-e*r/n}function ey(t,e,r,n,i,o,a,s){let l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(let c of e.positionedLines)for(let p of c.positionedGlyphs){if(!p.rect)continue;let f=p.rect||{},m=Ia+1,h=!0,g=1,d=0,x=(i||s)&&p.vertical,b=p.metrics.advance*p.scale/2;if(s&&e.verticalizable){let X=(p.scale-1)*ae,re=(ae-p.metrics.width*p.scale)/2;d=c.lineOffset/2-(p.imageName?-re:X)}if(p.imageName){let X=a[p.imageName];h=X.sdf,g=X.pixelRatio,m=he/g}let v=i?[p.x+b,p.y]:[0,0],S=i?[0,0]:[p.x+b+r[0],p.y+r[1]-d],A=[0,0];x&&(A=S,S=[0,0]);let w=p.metrics.isDoubleResolution?2:1,T=(p.metrics.left-m)*p.scale-b+S[0],M=(-p.metrics.top-m)*p.scale+S[1],D=T+f.w/w*p.scale/g,V=M+f.h/w*p.scale/g,z=new be.default(T,M),L=new be.default(D,M),_=new be.default(T,V),B=new be.default(D,V);if(x){let X=new be.default(-b,b-bi),re=-Math.PI/2,me=ae/2-b,Ut=p.imageName?me:0,tt=new be.default(5-bi-me,-Ut),gt=new be.default(...A);z._rotateAround(re,X)._add(tt)._add(gt),L._rotateAround(re,X)._add(tt)._add(gt),_._rotateAround(re,X)._add(tt)._add(gt),B._rotateAround(re,X)._add(tt)._add(gt)}if(l){let X=Math.sin(l),re=Math.cos(l),me=[re,-X,X,re];z._matMult(me),L._matMult(me),_._matMult(me),B._matMult(me)}let G=new be.default(0,0),O=new be.default(0,0);u.push({tl:z,tr:L,bl:_,br:B,tex:f,writingMode:e.writingMode,glyphOffset:v,sectionIndex:p.sectionIndex,isSDF:h,pixelOffsetTL:G,pixelOffsetBR:O,minFontScaleX:0,minFontScaleY:0})}return u}var Ii=Y(ye(),1);var yr=class{constructor(e,r,n,i,o,a,s,l,u,c){if(this.boxStartIndex=e.length,u){let p=a.top,f=a.bottom,y=a.collisionPadding;y&&(p-=y[1],f+=y[3]);let m=f-p;m>0&&(m=Math.max(10,m),this.circleDiameter=m)}else{let p=a.image?.content&&(a.image.textFitWidth||a.image.textFitHeight)?Ma(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};p.y1=p.y1*s-l[0],p.y2=p.y2*s+l[2],p.x1=p.x1*s-l[3],p.x2=p.x2*s+l[1];let f=a.collisionPadding;if(f&&(p.x1-=f[0]*s,p.y1-=f[1]*s,p.x2+=f[2]*s,p.y2+=f[3]*s),c){let y=new Ii.default(p.x1,p.y1),m=new Ii.default(p.x2,p.y1),h=new Ii.default(p.x1,p.y2),g=new Ii.default(p.x2,p.y2),d=c*Math.PI/180;y._rotate(d),m._rotate(d),h._rotate(d),g._rotate(d),p.x1=Math.min(y.x,m.x,h.x,g.x),p.x2=Math.max(y.x,m.x,h.x,g.x),p.y1=Math.min(y.y,m.y,h.y,g.y),p.y2=Math.max(y.y,m.y,h.y,g.y)}e.emplaceBack(r.x,r.y,p.x1,p.y1,p.x2,p.y2,n,i,o)}this.boxEndIndex=e.length}};var Ti=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};var El=Y(ye(),1);function ty(t,e=1,r=!1){let n=fr.fromPoints(t[0]),i=Math.min(n.width(),n.height()),o=i/2,a=new Ti([],Ix),{minX:s,minY:l,maxX:u,maxY:c}=n;if(i===0)return new El.default(s,l);for(let y=s;y<u;y+=i)for(let m=l;m<c;m+=i)a.push(new jr(y+o,m+o,o,t));let p=Cx(t),f=a.length;for(;a.length;){let y=a.pop();(y.d>p.d||!p.d)&&(p=y,r&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,f)),!(y.max-p.d<=e)&&(o=y.h/2,a.push(new jr(y.p.x-o,y.p.y-o,o,t)),a.push(new jr(y.p.x+o,y.p.y-o,o,t)),a.push(new jr(y.p.x-o,y.p.y+o,o,t)),a.push(new jr(y.p.x+o,y.p.y+o,o,t)),f+=4)}return r&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function Ix(t,e){return e.max-t.max}function jr(t,e,r,n){this.p=new El.default(t,e),this.h=r,this.d=Tx(this.p,n),this.max=this.d+this.h*Math.SQRT2}function Tx(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){let o=e[i];for(let a=0,s=o.length,l=s-1;a<s;l=a++){let u=o[a],c=o[l];u.y>t.y!=c.y>t.y&&t.x<(c.x-u.x)*(t.y-u.y)/(c.y-u.y)+u.x&&(r=!r),n=Math.min(n,ll(t,u,c))}}return(r?1:-1)*Math.sqrt(n)}function Cx(t){let e=0,r=0,n=0,i=t[0];for(let o=0,a=i.length,s=a-1;o<a;s=o++){let l=i[o],u=i[s],c=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*c,n+=(l.y+u.y)*c,e+=c*3}return new jr(r/e,n/e,0,t)}var Dl=Y(rl(),1);var Ml=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(Ml||{}),Ot=7,$a=Number.POSITIVE_INFINITY;function Ll(t,e){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.SQRT2;switch(i){case"top-right":case"top-left":s=l-Ot;break;case"bottom-right":case"bottom-left":s=-l+Ot;break;case"bottom":s=-o+Ot;break;case"top":s=o-Ot;break}switch(i){case"top-right":case"bottom-right":a=-l;break;case"top-left":case"bottom-left":a=l;break;case"left":a=o;break;case"right":a=-o;break}return[a,s]}function n(i,o,a){let s=0,l=0;switch(o=Math.abs(o),a=Math.abs(a),i){case"top-right":case"top-left":case"top":l=a-Ot;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+Ot;break}switch(i){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o;break}return[s,l]}return e[1]!==$a?n(t,e[0],e[1]):r(t,e[0])}function Fl(t,e,r){let n=t.layout,i=n.get("text-variable-anchor-offset")?.evaluate(e,{},r);if(i){let a=i.values,s=[];for(let l=0;l<a.length;l+=2){let u=s[l]=a[l],c=a[l+1].map(p=>p*ae);u.startsWith("top")?c[1]-=Ot:u.startsWith("bottom")&&(c[1]+=Ot),s[l+1]=c}return new Me(s)}let o=n.get("text-variable-anchor");if(o){let a;t._unevaluatedLayout.getValue("text-radial-offset")!==void 0?a=[n.get("text-radial-offset").evaluate(e,{},r)*ae,$a]:a=n.get("text-offset").evaluate(e,{},r).map(u=>u*ae);let l=[];for(let u of o)l.push(u,Ll(u,a));return new Me(l)}return null}function iy(t){t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=8192/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],n=r.layout,i=r._unevaluatedLayout._values,o={layoutIconSize:i["icon-size"].possiblyEvaluate(new W(t.bucket.zoom+1),t.canonical),layoutTextSize:i["text-size"].possiblyEvaluate(new W(t.bucket.zoom+1),t.canonical),textMaxSize:i["text-size"].possiblyEvaluate(new W(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.textSizeData;o.compositeTextSizes=[i["text-size"].possiblyEvaluate(new W(c),t.canonical),i["text-size"].possiblyEvaluate(new W(p),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.iconSizeData;o.compositeIconSizes=[i["icon-size"].possiblyEvaluate(new W(c),t.canonical),i["icon-size"].possiblyEvaluate(new W(p),t.canonical)]}let a=n.get("text-line-height")*ae,s=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",l=n.get("text-keep-upright"),u=n.get("text-size");for(let c of t.bucket.features){let p=n.get("text-font").evaluate(c,{},t.canonical).join(","),f=u.evaluate(c,{},t.canonical),y=o.layoutTextSize.evaluate(c,{},t.canonical),m=o.layoutIconSize.evaluate(c,{},t.canonical),h={horizontal:{},vertical:void 0},g=c.text,d=[0,0];if(g){let S=g.toString(),A=n.get("text-letter-spacing").evaluate(c,{},t.canonical)*ae,w=Zc(S)?A:0,T=n.get("text-anchor").evaluate(c,{},t.canonical),M=Fl(r,c,t.canonical);if(!M){let _=n.get("text-radial-offset").evaluate(c,{},t.canonical);_?d=Ll(T,[_*ae,$a]):d=n.get("text-offset").evaluate(c,{},t.canonical).map(B=>B*ae)}let D=s?"center":n.get("text-justify").evaluate(c,{},t.canonical),z=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(c,{},t.canonical)*ae:1/0,L=()=>{t.bucket.allowVerticalPlacement&&In(S)&&(h.vertical=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,"left",w,d,2,!0,y,f))};if(!s&&M){let _=new Set;if(D==="auto")for(let G=0;G<M.values.length;G+=2)_.add(ry(M.values[G]));else _.add(D);let B=!1;for(let G of _)if(!h.horizontal[G])if(B)h.horizontal[G]=h.horizontal[0];else{let O=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,"center",G,w,d,1,!1,y,f);O&&(h.horizontal[G]=O,B=O.positionedLines.length===1)}L()}else{D==="auto"&&(D=ry(T));let _=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,1,!1,y,f);_&&(h.horizontal[D]=_),L(),In(S)&&s&&l&&(h.vertical=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,2,!1,y,f))}}let x,b=!1;if(c.icon&&c.icon.name){let S=t.imageMap[c.icon.name];S&&(x=Ef(t.imagePositions[c.icon.name],n.get("icon-offset").evaluate(c,{},t.canonical),n.get("icon-anchor").evaluate(c,{},t.canonical)),b=!!S.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=b:t.bucket.sdfIcons!==b&&ce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(S.pixelRatio!==t.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let v=oy(h.horizontal)||h.vertical;t.bucket.iconsInText=v?v.iconsInText:!1,(v||x)&&kx(t.bucket,c,h,x,t.imageMap,o,y,m,d,b,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function ry(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function kx(t,e,r,n,i,o,a,s,l,u,c,p){let f=o.textMaxSize.evaluate(e,{});f===void 0&&(f=a);let y=t.layers[0].layout,m=y.get("icon-offset").evaluate(e,{},c),h=oy(r.horizontal),g=24,d=a/g,x=t.tilePixelRatio*d,b=t.tilePixelRatio*f/g,v=t.tilePixelRatio*s,S=t.tilePixelRatio*y.get("symbol-spacing"),A=y.get("text-padding")*t.tilePixelRatio,w=Bf(y,e,c,t.tilePixelRatio),T=y.get("text-max-angle")/180*Math.PI,M=y.get("text-rotation-alignment")!=="viewport"&&y.get("symbol-placement")!=="point",D=y.get("icon-rotation-alignment")==="map"&&y.get("symbol-placement")!=="point",V=y.get("symbol-placement"),z=S/2,L=y.get("icon-text-fit"),_;n&&L!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(_=_l(n,r.vertical,L,y.get("icon-text-fit-padding"),m,d)),h&&(n=_l(n,h,L,y.get("icon-text-fit-padding"),m,d)));let B=c?p.line.getGranularityForZoomLevel(c.z):1,G=(O,R)=>{R.x<0||R.x>=8192||R.y<0||R.y>=8192||Mx(t,R,O,r,n,i,_,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,x,[A,A,A,A],M,l,v,w,D,m,e,o,u,c,a)};if(V==="line")for(let O of Kf(e.geometry,0,0,8192,8192)){let R=Ke(O,B),K=Jf(R,S,T,r.vertical||h,n,g,b,t.overscaling,8192);for(let X of K){let re=h;(!re||!Lx(t,re.text,z,X))&&G(R,X)}}else if(V==="line-center"){for(let O of e.geometry)if(O.length>1){let R=Ke(O,B),K=Zf(R,T,r.vertical||h,n,g,b);K&&G(R,K)}}else if(e.type==="Polygon")for(let O of Yt(e.geometry,0)){let R=ty(O,16),K=Ke(O[0],B,!0);G(K,new et(R.x,R.y,0))}else if(e.type==="LineString")for(let O of e.geometry){let R=Ke(O,B);G(R,new et(R[0].x,R[0].y,0))}else if(e.type==="Point")for(let O of e.geometry)for(let R of O)G([R],new et(R.x,R.y,0))}function Ex(t,e){let r=t.length,n=e?.values;if(n?.length>0)for(let i=0;i<n.length;i+=2){let o=Ml[n[i]],a=n[i+1];t.emplaceBack(o,a[0],a[1])}return[r,t.length]}function ny(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=ey(e,r,s,i,o,a,n,t.allowVerticalPlacement),g=t.textSizeData,d=null;g.kind==="source"?(d=[zt*i.layout.get("text-size").evaluate(a,{})],d[0]>Qe&&ce(`${t.layerIds[0]}: Value for "text-size" is >= ${Nr}. Reduce your "text-size".`)):g.kind==="composite"&&(d=[zt*y.compositeTextSizes[0].evaluate(a,{},m),zt*y.compositeTextSizes[1].evaluate(a,{},m)],(d[0]>Qe||d[1]>Qe)&&ce(`${t.layerIds[0]}: Value for "text-size" is >= ${Nr}. Reduce your "text-size".`)),t.addSymbols(t.text,h,d,s,o,a,u,e,l.lineStartIndex,l.lineLength,f,m);for(let x of c)p[x]=t.text.placedSymbolArray.length-1;return h.length*4}function oy(t){for(let e in t)return t[e];return null}function Mx(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T){let M=t.addToLineVertexArray(e,r),D,V,z,L,_=0,B=0,G=0,O=0,R=-1,K=-1,X={},re=(0,Dl.default)("");if(t.allowVerticalPlacement&&n.vertical){let xe=s.layout.get("text-rotate").evaluate(v,{},w)+90,rt=n.vertical;z=new yr(l,e,u,c,p,rt,f,y,m,xe),a&&(L=new yr(l,e,u,c,p,a,g,d,m,xe))}if(i){let Te=s.layout.get("icon-rotate").evaluate(v,{}),xe=s.layout.get("icon-text-fit")!=="none",rt=kl(i,Te,A,xe),xt=a?kl(a,Te,A,xe):void 0;V=new yr(l,e,u,c,p,i,g,d,!1,Te),_=rt.length*4;let Zr=t.iconSizeData,Ve=null;Zr.kind==="source"?(Ve=[zt*s.layout.get("icon-size").evaluate(v,{})],Ve[0]>Qe&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Nr}. Reduce your "icon-size".`)):Zr.kind==="composite"&&(Ve=[zt*S.compositeIconSizes[0].evaluate(v,{},w),zt*S.compositeIconSizes[1].evaluate(v,{},w)],(Ve[0]>Qe||Ve[1]>Qe)&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Nr}. Reduce your "icon-size".`)),t.addSymbols(t.icon,rt,Ve,b,x,v,0,e,M.lineStartIndex,M.lineLength,-1,w),R=t.icon.placedSymbolArray.length-1,xt&&(B=xt.length*4,t.addSymbols(t.icon,xt,Ve,b,x,v,2,e,M.lineStartIndex,M.lineLength,-1,w),K=t.icon.placedSymbolArray.length-1)}let me=Object.keys(n.horizontal);for(let Te of me){let xe=n.horizontal[Te];if(!D){re=(0,Dl.default)(xe.text);let xt=s.layout.get("text-rotate").evaluate(v,{},w);D=new yr(l,e,u,c,p,xe,f,y,m,xt)}let rt=xe.positionedLines.length===1;if(G+=ny(t,e,xe,o,s,m,v,h,M,n.vertical?1:3,rt?me:[Te],X,R,S,w),rt)break}n.vertical&&(O+=ny(t,e,n.vertical,o,s,m,v,h,M,2,["vertical"],X,K,S,w));let Ut=D?D.boxStartIndex:t.collisionBoxArray.length,tt=D?D.boxEndIndex:t.collisionBoxArray.length,gt=z?z.boxStartIndex:t.collisionBoxArray.length,Gi=z?z.boxEndIndex:t.collisionBoxArray.length,Ni=V?V.boxStartIndex:t.collisionBoxArray.length,Ui=V?V.boxEndIndex:t.collisionBoxArray.length,$i=L?L.boxStartIndex:t.collisionBoxArray.length,is=L?L.boxEndIndex:t.collisionBoxArray.length,Ie=-1,bt=(Te,xe)=>Te&&Te.circleDiameter?Math.max(Te.circleDiameter,xe):xe;Ie=bt(D,Ie),Ie=bt(z,Ie),Ie=bt(V,Ie),Ie=bt(L,Ie);let Hr=Ie>-1?1:0;Hr&&(Ie*=T/ae),t.glyphOffsetArray.length>=Xe.MAX_GLYPHS&&ce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),v.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey);let os=Fl(s,v,w),[ji,as]=Ex(t.textAnchorOffsets,os);t.symbolInstances.emplaceBack(e.x,e.y,X.right>=0?X.right:-1,X.center>=0?X.center:-1,X.left>=0?X.left:-1,X.vertical||-1,R,K,re,Ut,tt,gt,Gi,Ni,Ui,$i,is,u,G,O,_,B,Hr,0,f,Ie,ji,as)}function Lx(t,e,r,n){let i=t.compareText;if(!(e in i))i[e]=[];else{let o=i[e];for(let a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}return i[e].push(n),!1}var ja=1,Ci=class{constructor(e){let r={},n=[];for(let s in e){let l=e[s],u=r[s]={};for(let c in l){let p=l[+c];if(!p||p.bitmap.width===0||p.bitmap.height===0)continue;let f={x:0,y:0,w:p.bitmap.width+2*ja,h:p.bitmap.height+2*ja};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=hi(n),a=new sr({width:i||1,height:o||1});for(let s in e){let l=e[s];for(let u in l){let c=l[+u];if(!c||c.bitmap.width===0||c.bitmap.height===0)continue;let p=r[s][u].rect;sr.copy(c.bitmap,a,{x:0,y:0},{x:p.x+ja,y:p.y+ja},c.bitmap)}}this.image=a,this.positions=r}};I("GlyphAtlas",Ci);function sy(t,e,r){e=Math.pow(2,r)-e-1;var n=ay(t*256,e*256,r),i=ay((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function ay(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),i=t*n-2*Math.PI*6378137/2,o=e*n-2*Math.PI*6378137/2;return[i,o]}var py=Y(ye(),1);var Vl=63710088e-1,ki=class t{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new t(wu(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,n=this.lat*r,i=e.lat*r,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-this.lng)*r);return Vl*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof t)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new t(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new t(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};var ly=2*Math.PI*Vl;function uy(t){return ly*Math.cos(t*Math.PI/180)}function Fx(t){return(180+t)/360}function Dx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Vx(t,e){return t/uy(e)}function Bx(t){return t*360-180}function Bl(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Rx(t,e){return t*uy(Bl(e))}function zx(t){return 1/Math.cos(t*Math.PI/180)}var Ei=class t{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=ki.convert(e);return new t(Fx(n.lng),Dx(n.lat),Vx(r,n.lat))}toLngLat(){return new ki(Bx(this.x),Bl(this.y))}toAltitude(){return Rx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ly*zx(Bl(this.y))}};function cy(t,e,r){return!(t<Hi||t>Xi||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}var qa=class{constructor(e,r,n){if(!cy(e,r,n))throw new Error(`x=${r}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} ${Hi}<=z<=${Xi} `);this.z=e,this.x=r,this.y=n,this.key=Mi(0,e,e,r,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,n){let i=sy(this.x,this.y,this.z),o=Ox(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){let r=Math.pow(2,this.z);return new py.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}},Rl=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Mi(e,r.z,r.z,r.x,r.y)}},Li=class t{constructor(e,r,n,i,o){this.terrainRttPosMatrix32f=null;if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=r,this.canonical=new qa(n,+i,+o),this.key=Mi(r,e,n,i,o)}clone(){return new t(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new t(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new t(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?Mi(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Mi(this.wrap*+r,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new t(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=this.canonical.x*2,i=this.canonical.y*2;return[new t(r,this.wrap,r,n,i),new t(r,this.wrap,r,n+1,i),new t(r,this.wrap,r,n,i+1),new t(r,this.wrap,r,n+1,i+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new t(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new t(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Rl(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Ei(e.x-this.wrap,e.y))}};function Mi(t,e,r,n,i){t*=2,t<0&&(t=t*-1-1);let o=1<<r;return(o*o*t+o*i+n).toString(36)+r.toString(36)+e.toString(36)}function Ox(t,e,r){let n="",i;for(let o=t;o>0;o--)i=1<<o-1,n+=(e&i?1:0)+(r&i?2:0);return n}I("CanonicalTileID",qa);I("OverscaledTileID",Li,{omit:["terrainRttPosMatrix32f"]});var Wa=class{constructor(e){this.tileID=new Li(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[],this.globalState=e.globalState}async parse(e,r,n,i,o){this.status="parsing",this.data=e,this.collisionBoxArray=new jn;let a=new Ur(Object.keys(e.layers).sort()),s=new _i(this.tileID,this.promoteId);s.bucketLayerIDs=[];let l={},u={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n,subdivisionGranularity:o},c=r.familiesBySource[this.source];for(let A in c){let w=e.layers[A];if(!w)continue;w.version===1&&ce(`Vector tile source "${this.source}" layer "${A}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let T=a.encode(A),M=[];for(let D=0;D<w.length;D++){let V=w.feature(D),z=s.getId(V,A);M.push({feature:V,id:z,index:D,sourceLayerIndex:T})}for(let D of c[A]){let V=D[0];if(V.source!==this.source&&ce(`layer.source = ${V.source} does not equal this.source = ${this.source}`),V.minzoom&&this.zoom<Math.floor(V.minzoom)||V.maxzoom&&this.zoom>=V.maxzoom||V.visibility==="none")continue;zl(D,this.zoom,n),(l[V.id]=V.createBucket({index:s.bucketLayerIDs.length,layers:D,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:T,sourceID:this.source,globalState:this.globalState})).populate(M,u,this.tileID.canonical),s.bucketLayerIDs.push(D.map(L=>L.id))}}let p=tn(u.glyphDependencies,A=>Object.keys(A).map(Number));this.inFlightDependencies.forEach(A=>A?.abort()),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){let A=new AbortController;this.inFlightDependencies.push(A),f=i.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},A)}let y=Object.keys(u.iconDependencies),m=Promise.resolve({});if(y.length){let A=new AbortController;this.inFlightDependencies.push(A),m=i.sendAsync({type:"GI",data:{icons:y,source:this.source,tileID:this.tileID,type:"icons"}},A)}let h=Object.keys(u.patternDependencies),g=Promise.resolve({});if(h.length){let A=new AbortController;this.inFlightDependencies.push(A),g=i.sendAsync({type:"GI",data:{icons:h,source:this.source,tileID:this.tileID,type:"patterns"}},A)}let[d,x,b]=await Promise.all([f,m,g]),v=new Ci(d),S=new di(x,b);for(let A in l){let w=l[A];w instanceof Xe?(zl(w.layers,this.zoom,n),iy({bucket:w,glyphMap:d,glyphPositions:v.positions,imageMap:x,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:u.subdivisionGranularity})):w.hasPattern&&(w instanceof pr||w instanceof ur||w instanceof cr)&&(zl(w.layers,this.zoom,n),w.addFeatures(u,this.tileID.canonical,S.patternPositions))}return this.status="done",{buckets:Object.values(l).filter(A=>!A.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:v.image,imageAtlas:S,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?x:null,glyphPositions:this.returnDependencies?v.positions:null}}};function zl(t,e,r){let n=new W(e);for(let i of t)i.recalculate(n,r)}var Gx=60,XI=1e3/Gx;var qr=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return e.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}};var Wr=class{constructor(e,r,n){this.actor=e,this.layerIndex=r,this.availableImages=n,this.fetching={},this.loading={},this.loaded={}}async loadVectorTile(e,r){let n=await Uc(e.request,r);try{return{vectorTile:new fy.default.VectorTile(new yy.default(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires}}catch(i){let o=new Uint8Array(n.data),a=o[0]===31&&o[1]===139,s=`Unable to parse the tile at ${e.request.url}, `;throw a?s+="please make sure the data is not gzipped and that you have configured the relevant header in the server":s+=`got error: ${i.message}`,new Error(s)}}async loadTile(e){let r=e.uid,n=e&&e.request&&e.request.collectResourceTiming?new qr(e.request):!1,i=new Wa(e);this.loading[r]=i;let o=new AbortController;i.abort=o;try{let a=await this.loadVectorTile(e,o);if(delete this.loading[r],!a)return null;let s=a.rawData,l={};a.expires&&(l.expires=a.expires),a.cacheControl&&(l.cacheControl=a.cacheControl);let u={};if(n){let p=n.finish();p&&(u.resourceTiming=JSON.parse(JSON.stringify(p)))}i.vectorTile=a.vectorTile;let c=i.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);this.loaded[r]=i,this.fetching[r]={rawTileData:s,cacheControl:l,resourceTiming:u};try{let p=await c;return de({rawTileData:s.slice(0)},p,l,u)}finally{delete this.fetching[r]}}catch(a){throw delete this.loading[r],i.status="done",this.loaded[r]=i,a}}async reloadTile(e){let r=e.uid;if(!this.loaded||!this.loaded[r])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let n=this.loaded[r];if(n.showCollisionBoxes=e.showCollisionBoxes,n.globalState=e.globalState,n.status==="parsing"){let i=await n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity),o;if(this.fetching[r]){let{rawTileData:a,cacheControl:s,resourceTiming:l}=this.fetching[r];delete this.fetching[r],o=de({rawTileData:a.slice(0)},i,s,l)}else o=i;return o}if(n.status==="done"&&n.vectorTile)return n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity)}async abortTile(e){let r=this.loading,n=e.uid;r&&r[n]&&r[n].abort&&(r[n].abort.abort(),delete r[n])}async removeTile(e){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]}};var Xa=class{constructor(){this.loaded={}}async loadTile(e){let{uid:r,encoding:n,rawImageData:i,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=e,u=i.width+2,c=i.height+2,p=vt(i)?new fe({width:u,height:c},await Iu(i,-1,-1,u,c)):i,f=new ii(r,p,n,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=f,f}removeTile(e){let r=this.loaded,n=e.uid;r&&r[n]&&delete r[n]}};var Gy=Y(gy(),1);var Ol=Y(ye(),1),by=Y(Rt(),1);var Nx=by.default.VectorTileFeature.prototype.toGeoJSON,Gl=class{constructor(e){this._feature=e,this.extent=8192,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(this._feature.type===1){let e=[];for(let r of this._feature.geometry)e.push([new Ol.default(r[0],r[1])]);return e}else{let e=[];for(let r of this._feature.geometry){let n=[];for(let i of r)n.push(new Ol.default(i[0],i[1]));e.push(n)}return e}}toGeoJSON(e,r,n){return Nx.call(this,e,r,n)}},Za=class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=e.length,this._features=e}feature(e){return new Gl(this._features[e])}};var Ny=Y(Ay(),1);var _y=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],$l=1,Di=8,Bi=class t{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,n]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(i!==$l)throw new Error(`Got v${i} data when expected v${$l}.`);let o=_y[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new t(s,a,o,e)}constructor(e,r=64,n=Float64Array,i){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=_y.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,Di,e),this.coords=new this.ArrayType(this.data,Di+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(Di+a+s+l),this.ids=new this.IndexArrayType(this.data,Di,e),this.coords=new this.ArrayType(this.data,Di+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,($l<<4)+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return ql(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,l=[0,o.length-1,0],u=[];for(;l.length;){let c=l.pop()||0,p=l.pop()||0,f=l.pop()||0;if(p-f<=s){for(let g=f;g<=p;g++){let d=a[2*g],x=a[2*g+1];d>=e&&d<=n&&x>=r&&x<=i&&u.push(o[g])}continue}let y=f+p>>1,m=a[2*y],h=a[2*y+1];m>=e&&m<=n&&h>=r&&h<=i&&u.push(o[y]),(c===0?e<=m:r<=h)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=h)&&(l.push(y+1),l.push(p),l.push(1-c))}return u}within(e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:o,nodeSize:a}=this,s=[0,i.length-1,0],l=[],u=n*n;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,f=s.pop()||0;if(p-f<=a){for(let g=f;g<=p;g++)Iy(o[2*g],o[2*g+1],e,r)<=u&&l.push(i[g]);continue}let y=f+p>>1,m=o[2*y],h=o[2*y+1];Iy(m,h,e,r)<=u&&l.push(i[y]),(c===0?e-n<=m:r-n<=h)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?e+n>=m:r+n>=h)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function ql(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;Ty(t,e,a,n,i,o),ql(t,e,r,n,a-1,1-o),ql(t,e,r,a+1,i,1-o)}function Ty(t,e,r,n,i,o){for(;i>n;){if(i-n>600){let u=i-n+1,c=r-n+1,p=Math.log(u),f=.5*Math.exp(2*p/3),y=.5*Math.sqrt(p*f*(u-f)/u)*(c-u/2<0?-1:1),m=Math.max(n,Math.floor(r-c*f/u+y)),h=Math.min(i,Math.floor(r+(u-c)*f/u+y));Ty(t,e,r,m,h,o)}let a=e[2*r+o],s=n,l=i;for(Vi(t,e,n,r),e[2*i+o]>a&&Vi(t,e,n,i);s<l;){for(Vi(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?Vi(t,e,n,l):(l++,Vi(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Vi(t,e,r,n){jl(t,r,n),jl(e,2*r,2*n),jl(e,2*r+1,2*n+1)}function jl(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function Iy(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var Kx={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Cy=Math.fround||(t=>(e=>(t[0]=+e,t[0])))(new Float32Array(1)),mr=2,Nt=3,Wl=4,Gt=5,Ey=6,Ri=class{constructor(e){this.options=Object.assign(Object.create(Kx),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:r,minZoom:n,maxZoom:i}=this.options;r&&console.time("total time");let o=`prepare ${e.length} points`;r&&console.time(o),this.points=e;let a=[];for(let l=0;l<e.length;l++){let u=e[l];if(!u.geometry)continue;let[c,p]=u.geometry.coordinates,f=Cy(Ya(c)),y=Cy(Ka(p));a.push(f,y,1/0,l,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this._createTree(a);r&&console.timeEnd(o);for(let l=i;l>=n;l--){let u=+Date.now();s=this.trees[l]=this._createTree(this._cluster(s,l)),r&&console.log("z%d: %d clusters in %dms",l,s.numItems,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(e,r){let n=((e[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,e[1])),o=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,o=180;else if(n>o){let p=this.getClusters([n,i,180,a],r),f=this.getClusters([-180,i,o,a],r);return p.concat(f)}let s=this.trees[this._limitZoom(r)],l=s.range(Ya(n),Ka(a),Ya(o),Ka(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+Gt]>1?ky(u,f,this.clusterProps):this.points[u[f+Nt]])}return c}getChildren(e){let r=this._getOriginId(e),n=this._getOriginZoom(e),i="No cluster with the specified id.",o=this.trees[n];if(!o)throw new Error(i);let a=o.data;if(r*this.stride>=a.length)throw new Error(i);let s=this.options.radius/(this.options.extent*Math.pow(2,n-1)),l=a[r*this.stride],u=a[r*this.stride+1],c=o.within(l,u,s),p=[];for(let f of c){let y=f*this.stride;a[y+Wl]===e&&p.push(a[y+Gt]>1?ky(a,y,this.clusterProps):this.points[a[y+Nt]])}if(p.length===0)throw new Error(i);return p}getLeaves(e,r,n){r=r||10,n=n||0;let i=[];return this._appendLeaves(i,e,r,n,0),i}getTile(e,r,n){let i=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:a,radius:s}=this.options,l=s/a,u=(n-l)/o,c=(n+1+l)/o,p={features:[]};return this._addTileFeatures(i.range((r-l)/o,u,(r+1+l)/o,c),i.data,r,n,o,p),r===0&&this._addTileFeatures(i.range(1-l/o,u,1,c),i.data,o,n,o,p),r===o-1&&this._addTileFeatures(i.range(0,u,l/o,c),i.data,-1,n,o,p),p.features.length?p:null}getClusterExpansionZoom(e){let r=this._getOriginZoom(e)-1;for(;r<=this.options.maxZoom;){let n=this.getChildren(e);if(r++,n.length!==1)break;e=n[0].properties.cluster_id}return r}_appendLeaves(e,r,n,i,o){let a=this.getChildren(r);for(let s of a){let l=s.properties;if(l&&l.cluster?o+l.point_count<=i?o+=l.point_count:o=this._appendLeaves(e,l.cluster_id,n,i,o):o<i?o++:e.push(s),e.length===n)break}return o}_createTree(e){let r=new Bi(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<e.length;n+=this.stride)r.add(e[n],e[n+1]);return r.finish(),r.data=e,r}_addTileFeatures(e,r,n,i,o,a){for(let s of e){let l=s*this.stride,u=r[l+Gt]>1,c,p,f;if(u)c=My(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let h=this.points[r[l+Nt]];c=h.properties;let[g,d]=h.geometry.coordinates;p=Ya(g),f=Ka(d)}let y={type:1,geometry:[[Math.round(this.options.extent*(p*o-n)),Math.round(this.options.extent*(f*o-i))]],tags:c},m;u||this.options.generateId?m=r[l+Nt]:m=this.points[r[l+Nt]].id,m!==void 0&&(y.id=m),a.features.push(y)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,r){let{radius:n,extent:i,reduce:o,minPoints:a}=this.options,s=n/(i*Math.pow(2,r)),l=e.data,u=[],c=this.stride;for(let p=0;p<l.length;p+=c){if(l[p+mr]<=r)continue;l[p+mr]=r;let f=l[p],y=l[p+1],m=e.within(l[p],l[p+1],s),h=l[p+Gt],g=h;for(let d of m){let x=d*c;l[x+mr]>r&&(g+=l[x+Gt])}if(g>h&&g>=a){let d=f*h,x=y*h,b,v=-1,S=((p/c|0)<<5)+(r+1)+this.points.length;for(let A of m){let w=A*c;if(l[w+mr]<=r)continue;l[w+mr]=r;let T=l[w+Gt];d+=l[w]*T,x+=l[w+1]*T,l[w+Wl]=S,o&&(b||(b=this._map(l,p,!0),v=this.clusterProps.length,this.clusterProps.push(b)),o(b,this._map(l,w)))}l[p+Wl]=S,u.push(d/g,x/g,1/0,S,-1,g),o&&u.push(v)}else{for(let d=0;d<c;d++)u.push(l[p+d]);if(g>1)for(let d of m){let x=d*c;if(!(l[x+mr]<=r)){l[x+mr]=r;for(let b=0;b<c;b++)u.push(l[x+b])}}}}return u}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,r,n){if(e[r+Gt]>1){let a=this.clusterProps[e[r+Ey]];return n?Object.assign({},a):a}let i=this.points[e[r+Nt]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function ky(t,e,r){return{type:"Feature",id:t[e+Nt],properties:My(t,e,r),geometry:{type:"Point",coordinates:[Qx(t[e]),e0(t[e+1])]}}}function My(t,e,r){let n=t[e+Gt],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?`${Math.round(n/100)/10}k`:n,o=t[e+Ey],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Nt],point_count:n,point_count_abbreviated:i})}function Ya(t){return t/360+.5}function Ka(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Qx(t){return(t-.5)*360}function e0(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function zi(t,e,r,n){let i=n,o=e+(r-e>>1),a=r-e,s,l=t[e],u=t[e+1],c=t[r],p=t[r+1];for(let f=e+3;f<r;f+=3){let y=t0(t[f],t[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){let m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-e>3&&zi(t,e,s,n),t[s+2]=i,r-s>3&&zi(t,s,r,n))}function t0(t,e,r,n,i,o){let a=i-r,s=o-n;if(a!==0||s!==0){let l=((t-r)*a+(e-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return a=t-r,s=e-n,a*a+s*s}function dt(t,e,r,n){let i={id:t??null,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(e==="Point"||e==="MultiPoint"||e==="LineString")Qa(i,r);else if(e==="Polygon")Qa(i,r[0]);else if(e==="MultiLineString")for(let o of r)Qa(i,o);else if(e==="MultiPolygon")for(let o of r)Qa(i,o[0]);return i}function Qa(t,e){for(let r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function Zl(t,e){let r=[];if(t.type==="FeatureCollection")for(let n=0;n<t.features.length;n++)es(r,t.features[n],e,n);else t.type==="Feature"?es(r,t,e):es(r,{geometry:t},e);return r}function es(t,e,r,n){if(!e.geometry)return;let i=e.geometry.coordinates;if(i&&i.length===0)return;let o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),o==="Point")Ly(i,s);else if(o==="MultiPoint")for(let u of i)Ly(u,s);else if(o==="LineString")Hl(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(let u of i)s=[],Hl(u,s,a,!1),t.push(dt(l,"LineString",s,e.properties));return}else Xl(i,s,a,!1);else if(o==="Polygon")Xl(i,s,a,!0);else if(o==="MultiPolygon")for(let u of i){let c=[];Xl(u,c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(let u of e.geometry.geometries)es(t,{id:l,geometry:u,properties:e.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");t.push(dt(l,o,s,e.properties))}function Ly(t,e){e.push(Fy(t[0]),Dy(t[1]),0)}function Hl(t,e,r,n){let i,o,a=0;for(let l=0;l<t.length;l++){let u=Fy(t[l][0]),c=Dy(t[l][1]);e.push(u,c,0),l>0&&(n?a+=(i*c-u*o)/2:a+=Math.sqrt(Math.pow(u-i,2)+Math.pow(c-o,2))),i=u,o=c}let s=e.length-3;e[2]=1,zi(e,0,s,r),e[s+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Xl(t,e,r,n){for(let i=0;i<t.length;i++){let o=[];Hl(t[i],o,r,n),e.push(o)}}function Fy(t){return t/360+.5}function Dy(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Ue(t,e,r,n,i,o,a,s){if(r/=e,n/=e,o>=r&&a<n)return t;if(a<r||o>=n)return null;let l=[];for(let u of t){let c=u.geometry,p=u.type,f=i===0?u.minX:u.minY,y=i===0?u.maxX:u.maxY;if(f>=r&&y<n){l.push(u);continue}else if(y<r||f>=n)continue;let m=[];if(p==="Point"||p==="MultiPoint")r0(c,m,r,n,i);else if(p==="LineString")By(c,m,r,n,i,!1,s.lineMetrics);else if(p==="MultiLineString")Jl(c,m,r,n,i,!1);else if(p==="Polygon")Jl(c,m,r,n,i,!0);else if(p==="MultiPolygon")for(let h of c){let g=[];Jl(h,g,r,n,i,!0),g.length&&m.push(g)}if(m.length){if(s.lineMetrics&&p==="LineString"){for(let h of m)l.push(dt(u.id,p,h,u.tags));continue}(p==="LineString"||p==="MultiLineString")&&(m.length===1?(p="LineString",m=m[0]):p="MultiLineString"),(p==="Point"||p==="MultiPoint")&&(p=m.length===3?"Point":"MultiPoint"),l.push(dt(u.id,p,m,u.tags))}}return l.length?l:null}function r0(t,e,r,n,i){for(let o=0;o<t.length;o+=3){let a=t[o+i];a>=r&&a<=n&&Xr(e,t[o],t[o+1],t[o+2])}}function By(t,e,r,n,i,o,a){let s=Vy(t),l=i===0?n0:i0,u=t.start,c,p;for(let d=0;d<t.length-3;d+=3){let x=t[d],b=t[d+1],v=t[d+2],S=t[d+3],A=t[d+4],w=i===0?x:b,T=i===0?S:A,M=!1;a&&(c=Math.sqrt(Math.pow(x-S,2)+Math.pow(b-A,2))),w<r?T>r&&(p=l(s,x,b,S,A,r),a&&(s.start=u+c*p)):w>n?T<n&&(p=l(s,x,b,S,A,n),a&&(s.start=u+c*p)):Xr(s,x,b,v),T<r&&w>=r&&(p=l(s,x,b,S,A,r),M=!0),T>n&&w<=n&&(p=l(s,x,b,S,A,n),M=!0),!o&&M&&(a&&(s.end=u+c*p),e.push(s),s=Vy(t)),a&&(u+=c)}let f=t.length-3,y=t[f],m=t[f+1],h=t[f+2],g=i===0?y:m;g>=r&&g<=n&&Xr(s,y,m,h),f=s.length-3,o&&f>=3&&(s[f]!==s[0]||s[f+1]!==s[1])&&Xr(s,s[0],s[1],s[2]),s.length&&e.push(s)}function Vy(t){let e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Jl(t,e,r,n,i,o){for(let a of t)By(a,e,r,n,i,o,!1)}function Xr(t,e,r,n){t.push(e,r,n)}function n0(t,e,r,n,i,o){let a=(o-e)/(n-e);return Xr(t,o,r+(i-r)*a,1),a}function i0(t,e,r,n,i,o){let a=(o-r)/(i-r);return Xr(t,e+(n-e)*a,o,1),a}function Kl(t,e){let r=e.buffer/e.extent,n=t,i=Ue(t,1,-1-r,r,0,-1,2,e),o=Ue(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=Ue(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=Ry(i,1).concat(n)),o&&(n=n.concat(Ry(o,-1)))),n}function Ry(t,e){let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Yl(i.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(let s of i.geometry)a.push(Yl(s,e))}else if(o==="MultiPolygon"){a=[];for(let s of i.geometry){let l=[];for(let u of s)l.push(Yl(u,e));a.push(l)}}r.push(dt(i.id,o,a,i.tags))}return r}function Yl(t,e){let r=[];r.size=t.size,t.start!==void 0&&(r.start=t.start,r.end=t.end);for(let n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function ts(t,e){if(t.transformed)return t;let r=1<<t.z,n=t.x,i=t.y;for(let o of t.features){let a=o.geometry,s=o.type;if(o.geometry=[],s===1)for(let l=0;l<a.length;l+=2)o.geometry.push(zy(a[l],a[l+1],e,r,n,i));else for(let l=0;l<a.length;l++){let u=[];for(let c=0;c<a[l].length;c+=2)u.push(zy(a[l][c],a[l][c+1],e,r,n,i));o.geometry.push(u)}}return t.transformed=!0,t}function zy(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function eu(t,e,r,n,i){let o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let s of t)o0(a,s,o,i);return a}function o0(t,e,r,n){let i=e.geometry,o=e.type,a=[];if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),o==="Point"||o==="MultiPoint")for(let s=0;s<i.length;s+=3)a.push(i[s],i[s+1]),t.numPoints++,t.numSimplified++;else if(o==="LineString")Ql(a,i,t,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(let s=0;s<i.length;s++)Ql(a,i[s],t,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(let s=0;s<i.length;s++){let l=i[s];for(let u=0;u<l.length;u++)Ql(a,l[u],t,r,!0,u===0)}if(a.length){let s=e.tags||null;if(o==="LineString"&&n.lineMetrics){s={};for(let u in e.tags)s[u]=e.tags[u];s.mapbox_clip_start=i.start/i.size,s.mapbox_clip_end=i.end/i.size}let l={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:s};e.id!==null&&(l.id=e.id),t.features.push(l)}}function Ql(t,e,r,n,i,o){let a=n*n;if(n>0&&e.size<(i?a:n)){r.numPoints+=e.length/3;return}let s=[];for(let l=0;l<e.length;l+=3)(n===0||e[l+2]>a)&&(r.numSimplified++,s.push(e[l],e[l+1])),r.numPoints++;i&&a0(s,o),t.push(s)}function a0(t,e){let r=0;for(let n=0,i=t.length,o=i-2;n<i;o=n,n+=2)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===e)for(let n=0,i=t.length;n<i/2;n+=2){let o=t[n],a=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=o,t[i-1-n]=a}}var s0={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ru=class{constructor(e,r){r=this.options=l0(Object.create(s0),r);let n=r.debug;if(n&&console.time("preprocess data"),r.maxZoom<0||r.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=Zl(e,r);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",r.indexMaxZoom,r.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=Kl(i,r),i.length&&this.splitTile(i,0,0,0),n&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,r,n,i,o,a,s){let l=[e,r,n,i],u=this.options,c=u.debug;for(;l.length;){i=l.pop(),n=l.pop(),r=l.pop(),e=l.pop();let p=1<<r,f=tu(r,n,i),y=this.tiles[f];if(!y&&(c>1&&console.time("creation"),y=this.tiles[f]=eu(e,r,n,i,u),this.tileCoords.push({z:r,x:n,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,i,y.numFeatures,y.numPoints,y.numSimplified),console.timeEnd("creation"));let T=`z${r}`;this.stats[T]=(this.stats[T]||0)+1,this.total++}if(y.source=e,o==null){if(r===u.indexMaxZoom||y.numPoints<=u.indexMaxPoints)continue}else{if(r===u.maxZoom||r===o)continue;if(o!=null){let T=o-r;if(n!==a>>T||i!==s>>T)continue}}if(y.source=null,e.length===0)continue;c>1&&console.time("clipping");let m=.5*u.buffer/u.extent,h=.5-m,g=.5+m,d=1+m,x=null,b=null,v=null,S=null,A=Ue(e,p,n-m,n+g,0,y.minX,y.maxX,u),w=Ue(e,p,n+h,n+d,0,y.minX,y.maxX,u);e=null,A&&(x=Ue(A,p,i-m,i+g,1,y.minY,y.maxY,u),b=Ue(A,p,i+h,i+d,1,y.minY,y.maxY,u),A=null),w&&(v=Ue(w,p,i-m,i+g,1,y.minY,y.maxY,u),S=Ue(w,p,i+h,i+d,1,y.minY,y.maxY,u),w=null),c>1&&console.timeEnd("clipping"),l.push(x||[],r+1,n*2,i*2),l.push(b||[],r+1,n*2,i*2+1),l.push(v||[],r+1,n*2+1,i*2),l.push(S||[],r+1,n*2+1,i*2+1)}}getTile(e,r,n){e=+e,r=+r,n=+n;let i=this.options,{extent:o,debug:a}=i;if(e<0||e>24)return null;let s=1<<e;r=r+s&s-1;let l=tu(e,r,n);if(this.tiles[l])return ts(this.tiles[l],o);a>1&&console.log("drilling down to z%d-%d-%d",e,r,n);let u=e,c=r,p=n,f;for(;!f&&u>0;)u--,c=c>>1,p=p>>1,f=this.tiles[tu(u,c,p)];return!f||!f.source?null:(a>1&&(console.log("found parent tile z%d-%d-%d",u,c,p),console.time("drilling down")),this.splitTile(f.source,u,c,p,e,r,n),a>1&&console.timeEnd("drilling down"),this.tiles[l]?ts(this.tiles[l],o):null)}};function tu(t,e,r){return((1<<t)*r+e)*32+t}function l0(t,e){for(let r in e)t[r]=e[r];return t}function nu(t,e){return new ru(t,e)}function Oi(t,e){return e?t.properties[e]:t.id}function iu(t,e){if(t==null)return!0;if(t.type==="Feature")return Oi(t,e)!=null;if(t.type==="FeatureCollection"){let r=new Set;for(let n of t.features){let i=Oi(n,e);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function ou(t,e){let r=new Map;if(t!=null)if(t.type==="Feature")r.set(Oi(t,e),t);else for(let n of t.features)r.set(Oi(n,e),n);return r}function Oy(t,e,r){if(e.removeAll&&t.clear(),e.remove)for(let n of e.remove)t.delete(n);if(e.add)for(let n of e.add){let i=Oi(n,r);i!=null&&t.set(i,n)}if(e.update)for(let n of e.update){let i=t.get(n.id);if(i==null)continue;let o=n.newGeometry||n.removeAllProperties,a=!n.removeAllProperties&&(n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0);if((o||a)&&(i={...i},t.set(n.id,i),a&&(i.properties={...i.properties})),n.newGeometry&&(i.geometry=n.newGeometry),n.removeAllProperties)i.properties={};else if(n.removeProperties?.length>0)for(let s of n.removeProperties)Object.prototype.hasOwnProperty.call(i.properties,s)&&delete i.properties[s];if(n.addOrUpdateProperties?.length>0)for(let{key:s,value:l}of n.addOrUpdateProperties)i.properties[s]=l}}var rs=class extends Wr{constructor(){super(...arguments);this._dataUpdateable=new Map}async loadVectorTile(r,n){let i=r.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let o=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!o)return null;let a=new Za(o.features),s=(0,Ny.default)(a);return(s.byteOffset!==0||s.byteLength!==s.buffer.byteLength)&&(s=new Uint8Array(s)),{vectorTile:a,rawData:s.buffer}}async loadData(r){this._pendingRequest?.abort();let n=r&&r.request&&r.request.collectResourceTiming?new qr(r.request):!1;this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(r,this._pendingRequest),this._geoJSONIndex=r.cluster?new Ri(u0(r)).load((await this._pendingData).features):nu(await this._pendingData,r.geojsonVtOptions),this.loaded={};let i={};if(n){let o=n.finish();o&&(i.resourceTiming={},i.resourceTiming[r.source]=JSON.parse(JSON.stringify(o)))}return i}catch(i){if(delete this._pendingRequest,Fc(i))return{abandoned:!0};throw i}}async getData(){return this._pendingData}reloadTile(r){let n=this.loaded,i=r.uid;return n&&n[i]?super.reloadTile(r):this.loadTile(r)}async loadAndProcessGeoJSON(r,n){let i=await this.loadGeoJSON(r,n);if(delete this._pendingRequest,typeof i!="object")throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`);if((0,Gy.default)(i,!0),r.filter){let o=Qt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(o.result==="error")throw new Error(o.value.map(s=>`${s.key}: ${s.message}`).join(", "));i={type:"FeatureCollection",features:i.features.filter(s=>o.value.evaluate({zoom:0},s))}}return i}async loadGeoJSON(r,n){let{promoteId:i}=r;if(r.request){let o=await Nc(r.request,n);return this._dataUpdateable=iu(o.data,i)?ou(o.data,i):void 0,o.data}if(typeof r.data=="string")try{let o=JSON.parse(r.data);return this._dataUpdateable=iu(o,i)?ou(o,i):void 0,o}catch{throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`)}if(!r.dataDiff)throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${r.source}`);return Oy(this._dataUpdateable,r.dataDiff,i),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}async removeSource(r){this._pendingRequest&&this._pendingRequest.abort()}getClusterExpansionZoom(r){return this._geoJSONIndex.getClusterExpansionZoom(r.clusterId)}getClusterChildren(r){return this._geoJSONIndex.getChildren(r.clusterId)}getClusterLeaves(r){return this._geoJSONIndex.getLeaves(r.clusterId,r.limit,r.offset)}};function u0({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;let r={},n={},i={accumulated:null,zoom:0},o={properties:null},a=Object.keys(e);for(let s of a){let[l,u]=e[s],c=Qt(u),p=Qt(typeof l=="string"?[l,["accumulated"],["get",s]]:l);r[s]=c.value,n[s]=p.value}return t.map=s=>{o.properties=s;let l={};for(let u of a)l[u]=r[u].evaluate(i,o);return l},t.reduce=(s,l)=>{o.properties=l;for(let u of a)i.accumulated=s[u],s[u]=n[u].evaluate(i,o)},t}var ns=class{constructor(e){this.self=e,this.actor=new Co(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(r,n)=>{if(this.externalWorkerSourceTypes[r])throw new Error(`Worker source with name "${r}" already registered.`);this.externalWorkerSourceTypes[r]=n},this.self.addProtocol=Vc,this.self.removeProtocol=Bc,this.self.registerRTLTextPlugin=r=>{we.setMethods(r)},this.actor.registerMessageHandler("LDT",(r,n)=>this._getDEMWorkerSource(r,n.source).loadTile(n)),this.actor.registerMessageHandler("RDT",async(r,n)=>{this._getDEMWorkerSource(r,n.source).removeTile(n)}),this.actor.registerMessageHandler("GCEZ",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterExpansionZoom(n)),this.actor.registerMessageHandler("GCC",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterChildren(n)),this.actor.registerMessageHandler("GCL",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterLeaves(n)),this.actor.registerMessageHandler("LD",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadData(n)),this.actor.registerMessageHandler("GD",(r,n)=>this._getWorkerSource(r,n.type,n.source).getData()),this.actor.registerMessageHandler("LT",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadTile(n)),this.actor.registerMessageHandler("RT",(r,n)=>this._getWorkerSource(r,n.type,n.source).reloadTile(n)),this.actor.registerMessageHandler("AT",(r,n)=>this._getWorkerSource(r,n.type,n.source).abortTile(n)),this.actor.registerMessageHandler("RMT",(r,n)=>this._getWorkerSource(r,n.type,n.source).removeTile(n)),this.actor.registerMessageHandler("RS",async(r,n)=>{if(!this.workerSources[r]||!this.workerSources[r][n.type]||!this.workerSources[r][n.type][n.source])return;let i=this.workerSources[r][n.type][n.source];delete this.workerSources[r][n.type][n.source],i.removeSource!==void 0&&i.removeSource(n)}),this.actor.registerMessageHandler("RM",async r=>{delete this.layerIndexes[r],delete this.availableImages[r],delete this.workerSources[r],delete this.demWorkerSources[r]}),this.actor.registerMessageHandler("SR",async(r,n)=>{this.referrer=n}),this.actor.registerMessageHandler("SRPS",(r,n)=>this._syncRTLPluginState(r,n)),this.actor.registerMessageHandler("IS",async(r,n)=>{this.self.importScripts(n)}),this.actor.registerMessageHandler("SI",(r,n)=>this._setImages(r,n)),this.actor.registerMessageHandler("UL",async(r,n)=>{this._getLayerIndex(r).update(n.layers,n.removedIds)}),this.actor.registerMessageHandler("SL",async(r,n)=>{this._getLayerIndex(r).replace(n)})}async _setImages(e,r){this.availableImages[e]=r;for(let n in this.workerSources[e]){let i=this.workerSources[e][n];for(let o in i)i[o].availableImages=r}}async _syncRTLPluginState(e,r){return await we.syncState(r,this.self.importScripts)}_getAvailableImages(e){let r=this.availableImages[e];return r||(r=[]),r}_getLayerIndex(e){let r=this.layerIndexes[e];return r||(r=this.layerIndexes[e]=new za),r}_getWorkerSource(e,r,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][r]||(this.workerSources[e][r]={}),!this.workerSources[e][r][n]){let i={sendAsync:(o,a)=>(o.targetMapId=e,this.actor.sendAsync(o,a))};switch(r){case"vector":this.workerSources[e][r][n]=new Wr(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][r][n]=new rs(i,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][r][n]=new this.externalWorkerSourceTypes[r](i,this._getLayerIndex(e),this._getAvailableImages(e));break}}return this.workerSources[e][r][n]}_getDEMWorkerSource(e,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]=new Xa),this.demWorkerSources[e][r]}};at(self)&&(self.worker=new ns(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n',ZE=()=>br.WORKER_URL?br.WORKER_URL:URL.createObjectURL(new Blob([YE],{type:"text/javascript"}));function WE(){return new Worker(ZE())}var HE="maplibre_preloaded_worker_pool",_0=class x0{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<x0.workerCount;)this.workers.push(WE());return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[HE]}numActive(){return Object.keys(this.active).length}},KE=Math.floor(me.hardwareConcurrency/2);_0.workerCount=_T(globalThis)?Math.max(Math.min(KE,3),1):1;var Zu;function v0(){return Zu||(Zu=new _0),Zu}var b0=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t;let i=this.workerPool.acquire(t);for(let r=0;r<i.length;r++){let n=i[r],a=new qE(n,t);a.name="Worker ".concat(r),this.actors.push(a)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){let i=[];for(let r of this.actors)i.push(r.sendAsync({type:e,data:t}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(t=>{t.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let i of this.actors)i.registerMessageHandler(e,t)}},cs;function JE(){return cs||(cs=new b0(v0(),vh),cs.registerMessageHandler("GR",(e,t,i)=>sl(t,i))),cs}function QE(e,t){let i=O.create();return O.translate(i,i,[1,1,0]),O.scale(i,i,[e.width*.5,e.height*.5,1]),e.calculatePosMatrix?O.multiply(i,i,e.calculatePosMatrix(t.toUnwrapped())):i}function e3(e,t,i){if(e)for(let r of e){let n=t[r];if(n&&n.source===i&&n.type==="fill-extrusion")return!0}else for(let r in t){let n=t[r];if(n.source===i&&n.type==="fill-extrusion")return!0}return!1}function t3(e,t,i,r,n,a,o){var p;let s=e3((p=n==null?void 0:n.layers)!=null?p:null,t,e.id),l=a.maxPitchScaleFactor(),u=e.tilesIn(r,l,s);u.sort(w0);let h=[];for(let d of u)h.push({wrappedTileID:d.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(t,i,e._state,d.queryGeometry,d.cameraQueryGeometry,d.scale,n,a,l,QE(e.transform,d.tileID),o?(f,y)=>o(d.tileID,f,y):void 0)});let c=n3(h);return a3(c,e)}function i3(e,t,i,r,n,a,o){let s={},l=a.queryRenderedSymbols(r),u=[];for(let h of Object.keys(l).map(Number))u.push(o[h]);u.sort(w0);for(let h of u){let c=h.featureIndex.lookupSymbolFeatures(l[h.bucketInstanceId],t,h.bucketIndex,h.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(let p in c){let d=s[p]=s[p]||[],f=c[p];f.sort((y,g)=>{let _=h.featureSortOrder;if(_){let b=_.indexOf(y.featureIndex);return _.indexOf(g.featureIndex)-b}else return g.featureIndex-y.featureIndex});for(let y of f)d.push(y)}}return o3(s,e,i)}function r3(e,t){let i=e.getRenderableIds().map(a=>e.getTileByID(a)),r=[],n={};for(let a=0;a<i.length;a++){let o=i[a],s=o.tileID.canonical.key;n[s]||(n[s]=!0,o.querySourceFeatures(r,t))}return r}function w0(e,t){let i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function n3(e){let t={},i={};for(let r of e){let n=r.queryResults,a=r.wrappedTileID,o=i[a]=i[a]||{};for(let s in n){let l=n[s],u=o[s]=o[s]||{},h=t[s]=t[s]||[];for(let c of l)u[c.featureIndex]||(u[c.featureIndex]=!0,h.push(c))}}return t}function a3(e,t){for(let i in e)for(let r of e[i])P0(r,t);return e}function o3(e,t,i){for(let r in e)for(let n of e[r]){let a=t[r],o=i[a.source];P0(n,o)}return e}function P0(e,t){let i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}async function T0(e,t,i){let r=e;if(e.url?r=(await ll(t.transformRequest(e.url,"Source"),i)).data:await me.frameAsync(i),!r)return null;let n=lo(H(r,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in r&&r.vector_layers&&(n.vectorLayerIds=r.vector_layers.map(a=>a.id)),n}var Pi=63710088e-1,re=class za{constructor(t,i){if(isNaN(t)||isNaN(i))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(i,")"));if(this.lng=+t,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new za(jr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(t){let i=Math.PI/180,r=this.lat*i,n=t.lat*i,a=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*i);return Pi*Math.acos(Math.min(a,1))}static convert(t){if(t instanceof za)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new za(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new za(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}},Di=class pr{constructor(t,i){t&&(i?this.setSouthWest(t).setNorthEast(i):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof re?new re(t.lng,t.lat):re.convert(t),this}setSouthWest(t){return this._sw=t instanceof re?new re(t.lng,t.lat):re.convert(t),this}extend(t){let i=this._sw,r=this._ne,n,a;if(t instanceof re)n=t,a=t;else if(t instanceof pr){if(n=t._sw,a=t._ne,!n||!a)return this}else{if(Array.isArray(t))if(t.length===4||t.every(Array.isArray)){let o=t;return this.extend(pr.convert(o))}else{let o=t;return this.extend(re.convert(o))}else if(t&&("lng"in t||"lon"in t)&&"lat"in t)return this.extend(re.convert(t));return this}return!i&&!r?(this._sw=new re(n.lng,n.lat),this._ne=new re(a.lng,a.lat)):(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)),this}getCenter(){return new re((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new re(this.getWest(),this.getNorth())}getSouthEast(){return new re(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return"LngLatBounds(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:i,lat:r}=re.convert(t),n=this._sw.lat<=r&&r<=this._ne.lat,a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),n&&a}static convert(t){return t instanceof pr||!t?t:new pr(t)}static fromLngLat(t,i=0){let r=360*i/40075017,n=r/Math.cos(Math.PI/180*t.lat);return new pr(new re(t.lng-n,t.lat-r),new re(t.lng+n,t.lat+r))}adjustAntiMeridian(){let t=new re(this._sw.lng,this._sw.lat),i=new re(this._ne.lng,this._ne.lat);return t.lng>i.lng?new pr(t,new re(i.lng+360,i.lat)):new pr(t,i)}},S0=2*Math.PI*Pi;function M0(e){return S0*Math.cos(e*Math.PI/180)}function $n(e){return(180+e)/360}function Wr(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Xr(e,t){return e/M0(t)}function s3(e){return e*360-180}function Kh(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function Jh(e,t){return e*M0(Kh(t))}function l3(e){return 1/Math.cos(e*Math.PI/180)}var De=class C0{constructor(t,i,r=0){this.x=+t,this.y=+i,this.z=+r}static fromLngLat(t,i=0){let r=re.convert(t);return new C0($n(r.lng),Wr(r.lat),Xr(i,r.lat))}toLngLat(){return new re(s3(this.x),Kh(this.y))}toAltitude(){return Jh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/S0*l3(Kh(this.y))}},I0=class{constructor(e,t,i){this.bounds=Di.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t=Math.pow(2,e.z),i={minX:Math.floor($n(this.bounds.getWest())*t),minY:Math.floor(Wr(this.bounds.getNorth())*t),maxX:Math.ceil($n(this.bounds.getEast())*t),maxY:Math.ceil(Wr(this.bounds.getSouth())*t)};return e.x>=i.minX&&e.x<i.maxX&&e.y>=i.minY&&e.y<i.maxY}},u3=class extends Et{constructor(e,t,i,r){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,H(this,lo(t,["url","scheme","tileSize","promoteId"])),this._options=H({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}async load(){this._loaded=!1,this.fire(new U("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await T0(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(H(this,e),e.bounds&&(this.tileBounds=new I0(e.bounds,this.minzoom,this.maxzoom)),this.fire(new U("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new U("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new te(e))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return H({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getActor(),r="LT";else if(e.state==="loading")return new Promise((n,a)=>{e.reloadPromise={resolve:n,reject:a}});e.abortController=new AbortController;try{let n=await e.actor.sendAsync({type:r,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,n)}catch(n){if(delete e.abortController,e.aborted)return;if(n&&n.status!==404)throw n;this._afterTileLoadWorkerResponse(e,null)}}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){let i=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(i.resolve).catch(i.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},A0=class extends Et{constructor(e,t,i,r){super(),this.id=e,this.dispatcher=i,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=H({type:"raster"},t),H(this,lo(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new U("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let t=await T0(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(H(this,t),t.bounds&&(this.tileBounds=new I0(t.bounds,this.minzoom,this.maxzoom)),this.fire(new U("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new U("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this.fire(new te(t))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return H({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let i=await Ci.getImage(this.map._requestManager.transformRequest(t,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(i&&i.data){this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let r=this.map.painter.context,n=r.gl,a=i.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new Qe(r,a,n.RGBA,{useMipmap:!0}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(i){if(delete e.abortController,e.aborted)e.state="unloaded";else if(i)throw e.state="errored",i}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}};function h3(e,t,i){t=Math.pow(2,i)-t-1;var r=um(e*256,t*256,i),n=um((e+1)*256,(t+1)*256,i);return r[0]+","+r[1]+","+n[0]+","+n[1]}function um(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i),n=e*r-2*Math.PI*6378137/2,a=t*r-2*Math.PI*6378137/2;return[n,a]}var c3=ne(le(),1);function p3(e,t,i){return!(e<bc||e>al||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}function d3(e,t){let{x:i,y:r}=De.fromLngLat(t);return!(e<bc||e>al||r<0||r>=1||i<0||i>=1)}var zl=class{constructor(e,t,i){if(!p3(e,t,i))throw new Error("x=".concat(t,", y=").concat(i,", z=").concat(e," outside of bounds. 0<=x<").concat(Math.pow(2,e),", 0<=y<").concat(Math.pow(2,e)," ").concat(bc,"<=z<=").concat(al," "));this.z=e,this.x=t,this.y=i,this.key=Dn(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i){let r=h3(this.x,this.y,this.z),n=f3(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=Math.pow(2,this.z);return new c3.default((e.x*t-this.x)*8192,(e.y*t-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},Hs=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Dn(e,t.z,t.z,t.x,t.y)}},gt=class li{constructor(t,i,r,n,a){if(this.terrainRttPosMatrix32f=null,t<r)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(t,"; z = ").concat(r));this.overscaledZ=t,this.wrap=i,this.canonical=new zl(r,+n,+a),this.key=Dn(i,t,r,n,a)}clone(){return new li(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let i=this.canonical.z-t;return t>this.canonical.z?new li(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new li(t,this.wrap,t,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(t,i){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-t;return t>this.canonical.z?Dn(this.wrap*+i,t,this.canonical.z,this.canonical.x,this.canonical.y):Dn(this.wrap*+i,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let i=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>i&&t.canonical.y===this.canonical.y>>i}children(t){if(this.overscaledZ>=t)return[new li(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=this.canonical.x*2,n=this.canonical.y*2;return[new li(i,this.wrap,i,r,n),new li(i,this.wrap,i,r+1,n),new li(i,this.wrap,i,r,n+1),new li(i,this.wrap,i,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new li(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new li(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Hs(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(t){return this.canonical.getTilePoint(new De(t.x-this.wrap,t.y))}};function Dn(e,t,i,r,n){e*=2,e<0&&(e=e*-1-1);let a=1<<i;return(a*a*e+a*n+r).toString(36)+i.toString(36)+t.toString(36)}function f3(e,t,i){let r="",n;for(let a=e;a>0;a--)n=1<<a-1,r+=(t&n?1:0)+(i&n?2:0);return r}W("CanonicalTileID",zl);W("OverscaledTileID",gt,{omit:["terrainRttPosMatrix32f"]});var m3=class extends A0{constructor(e,t,i,r){super(e,t,i,r),this.type="raster-dem",this.maxzoom=22,this._options=H({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(t,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let r=await Ci.getImage(i,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(r&&r.data){let n=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let a=Zi(n)&&iy()?n:await this.readImageNow(n),o={type:this.type,uid:e.uid,source:this.id,rawImageData:a,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let s=await e.actor.sendAsync({type:"LDT",data:o});e.dem=s,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(r){if(delete e.abortController,e.aborted)e.state="unloaded";else if(r)throw e.state="errored",r}}async readImageNow(e){if(typeof VideoFrame<"u"&&ob()){let t=e.width+2,i=e.height+2;try{return new Ne({width:t,height:i},await wT(e,-1,-1,t,i))}catch(r){}}return me.getImageData(e,1)}_getNeighboringTiles(e){let t=e.canonical,i=Math.pow(2,t.z),r=(t.x-1+i)%i,n=t.x===0?e.wrap-1:e.wrap,a=(t.x+1+i)%i,o=t.x+1===i?e.wrap+1:e.wrap,s={};return s[new gt(e.overscaledZ,n,t.z,r,t.y).key]={backfilled:!1},s[new gt(e.overscaledZ,o,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(s[new gt(e.overscaledZ,n,t.z,r,t.y-1).key]={backfilled:!1},s[new gt(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},s[new gt(e.overscaledZ,o,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<i&&(s[new gt(e.overscaledZ,n,t.z,r,t.y+1).key]={backfilled:!1},s[new gt(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},s[new gt(e.overscaledZ,o,t.z,a,t.y+1).key]={backfilled:!1}),s}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}},y3=class extends Et{constructor(e,t,i,r){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=i.getActor(),this.setEventedParent(r),this._data=t.data,this._options=H({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,t.clusterMaxZoom!==void 0&&this.maxzoom<=t.clusterMaxZoom&&nt('The maxzoom value "'.concat(this.maxzoom,'" is expected to be greater than the clusterMaxZoom value "').concat(t.clusterMaxZoom,'".')),this.workerOptions=H({source:this.id,cluster:t.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(t.buffer!==void 0?t.buffer:128),tolerance:this._pixelsToTileUnits(t.tolerance!==void 0?t.tolerance:.375),extent:8192,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:8192,radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(8192/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||nt("Integer expected for option 'clusterMaxZoom': provided value \"".concat(e,'" rounded to "').concat(t,'"')),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}async getData(){let e=H({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(t=>t.coordinates).flat(1/0):e.coordinates.flat(1/0)}async getBounds(){let e=new Di,t=await this.getData(),i;switch(t.type){case"FeatureCollection":i=t.features.map(r=>this.getCoordinatesFromGeometry(r.geometry)).flat(1/0);break;case"Feature":i=this.getCoordinatesFromGeometry(t.geometry);break;default:i=this.getCoordinatesFromGeometry(t);break}if(i.length==0)return e;for(let r=0;r<i.length-1;r+=2)e.extend([i[r],i[r+1]]);return e}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom))),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}async _updateWorkerData(e){let t=H({type:this.type},this.workerOptions);e?t.dataDiff=e:typeof this._data=="string"?(t.request=this.map._requestManager.transformRequest(me.resolveURL(this._data),"Source"),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new U("dataloading",{dataType:"source"}));try{let i=await this.actor.sendAsync({type:"LD",data:t});if(this._pendingLoads--,this._removed||i.abandoned){this.fire(new U("dataabort",{dataType:"source"}));return}let r=null;i.resourceTiming&&i.resourceTiming[this.id]&&(r=i.resourceTiming[this.id].slice(0));let n={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&H(n,{resourceTiming:r}),this.fire(new U("data",Ht(He({},n),{sourceDataType:"metadata"}))),this.fire(new U("data",Ht(He({},n),{sourceDataType:"content"})))}catch(i){if(this._pendingLoads--,this._removed){this.fire(new U("dataabort",{dataType:"source"}));return}this.fire(new te(i))}}loaded(){return this._pendingLoads===0}async loadTile(e){let t=e.actor?"RT":"LT";e.actor=this.actor;let i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};e.abortController=new AbortController;let r=await this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t==="RT")}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return H({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},ps=ne(le(),1),Ai=class Qh{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){let i=new Qh;return i.extend(t(new ps.default(this.minX,this.minY))),i.extend(t(new ps.default(this.maxX,this.minY))),i.extend(t(new ps.default(this.minX,this.maxY))),i.extend(t(new ps.default(this.maxX,this.maxY))),i}static fromPoints(t){let i=new Qh;for(let r of t)i.extend(r);return i}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}},go=class extends Et{constructor(e,t,i,r){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}async load(e){this._loaded=!1,this.fire(new U("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let t=await Ci.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,this.fire(new te(t))}}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new U("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let t=e.map(De.fromLngLat);return this.tileID=g3(t),this.terrainTileRanges=this._getOverlappingTileRanges(t),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t.map(i=>this.tileID.getTilePoint(i)._round()),this.flippedWindingOrder=_3(this.tileCoords),this.fire(new U("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,t=e.gl;this.texture||(this.texture=new Qe(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let n=this.tiles[r];n.state!=="loaded"&&(n.state="loaded",n.texture=this.texture,i=!0)}i&&this.fire(new U("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:t,minY:i,maxX:r,maxY:n}=Ai.fromPoints(e),a={};for(let o=0;o<=al;o++){let s=Math.pow(2,o),l=Math.floor(t*s),u=Math.floor(i*s),h=Math.floor(r*s),c=Math.floor(n*s);a[o]={minTileX:l,minTileY:u,maxTileX:h,maxTileY:c}}return a}};function g3(e){let t=Ai.fromPoints(e),i=t.width(),r=t.height(),n=Math.max(i,r),a=Math.max(0,Math.floor(-Math.log(n)/Math.LN2)),o=Math.pow(2,a);return new zl(a,Math.floor((t.minX+t.maxX)/2*o),Math.floor((t.minY+t.maxY)/2*o))}function _3(e){let t=e[1].x-e[0].x,i=e[1].y-e[0].y,r=e[2].x-e[0].x,n=e[2].y-e[0].y;return t*n-i*r<0}var x3=class extends go{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{let t=await FT(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new te(t))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new te(new G("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(t.start(0)," and ").concat(t.end(0),"-second mark.")))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new Qe(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let n=this.tiles[r];n.state!=="loaded"&&(n.state="loaded",n.texture=this.texture,i=!0)}i&&this.fire(new U("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},v3=class extends go{constructor(e,t,i,r){super(e,t,i,r),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(n=>!Array.isArray(n)||n.length!==2||n.some(a=>typeof a!="number")))&&this.fire(new te(new G("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new te(new G("sources.".concat(e),null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new te(new G("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas!="string"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new te(new G("sources.".concat(e),null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new te(new G("sources.".concat(e),null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate!==void 0?t.animate:!0}async load(){if(this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()){this.fire(new te(new Error("Canvas dimensions cannot be less than or equal to zero.")));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading()}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let t=this.map.painter.context,i=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Qe(t,this.canvas,i.RGBA,{premultiply:!0});let r=!1;for(let n in this.tiles){let a=this.tiles[n];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,r=!0)}r&&this.fire(new U("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},b3={},w3=(e,t,i,r)=>{let n=P3(t.type),a=new n(e,t,i,r);if(a.id!==e)throw new Error("Expected Source id to be ".concat(e," instead of ").concat(a.id));return a},P3=e=>{switch(e){case"geojson":return y3;case"image":return go;case"raster":return A0;case"raster-dem":return m3;case"vector":return u3;case"video":return x3;case"canvas":return v3}return b3[e]};function T3(e,t){let i={};if(!t)return i;for(let r of e){let n=r.layerIds.map(a=>t.getLayer(a)).filter(Boolean);if(n.length!==0){r.layers=n,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(a=>n.filter(o=>o.id===a)[0]));for(let a of n)i[a.id]=r}}return i}var S3=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(e," can't be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[e]}},M3=ne(rl(),1),C3=ne(ey(),1),E0=class{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=i,e._y=r,this.properties=e.properties,this.id=n}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t==="_geometry"||t==="_vectorTileFeature"||(e[t]=this[t]);return e}},I3=class{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Lh(8192,16,0),this.grid3D=new Lh(8192,16,0),this.featureIndexArray=new X_,this.promoteId=t}insert(e,t,i,r,n,a){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);let s=a?this.grid3D:this.grid;for(let l=0;l<t.length;l++){let u=t[l],h=[1/0,1/0,-1/0,-1/0];for(let c=0;c<u.length;c++){let p=u[c];h[0]=Math.min(h[0],p.x),h[1]=Math.min(h[1],p.y),h[2]=Math.max(h[2],p.x),h[3]=Math.max(h[3],p.y)}h[0]<8192&&h[1]<8192&&h[2]>=0&&h[3]>=0&&s.insert(o,h[0],h[1],h[2],h[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new M3.default.VectorTile(new C3.default(this.rawTileData)).layers,this.sourceLayerCoder=new S3(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,i,r){this.loadVTLayers();let n=e.params,a=8192/e.tileSize/e.scale,o=Ka(n.filter),s=e.queryGeometry,l=e.queryPadding*a,u=Ai.fromPoints(s),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=Ai.fromPoints(e.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,g,_,b)=>bI(e.cameraQueryGeometry,y-l,g-l,_+l,b+l));for(let y of p)h.push(y);h.sort(A3);let d={},f;for(let y=0;y<h.length;y++){let g=h[y];if(g===f)continue;f=g;let _=this.featureIndexArray.get(g),b=null;this.loadMatchingFeature(d,_.bucketIndex,_.sourceLayerIndex,_.featureIndex,o,n.layers,n.availableImages,t,i,r,(v,w,P)=>(b||(b=en(v)),w.queryIntersectsFeature({queryGeometry:s,feature:v,featureState:P,geometry:b,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return d}loadMatchingFeature(e,t,i,r,n,a,o,s,l,u,h){let c=this.bucketLayerIDs[t];if(a&&!c.some(y=>a.has(y)))return;let p=this.sourceLayerCoder.decode(i),d=this.vtLayers[p].feature(r);if(n.needGeometry){let y=tn(d,!0);if(!n.filter(new et(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new et(this.tileID.overscaledZ),d))return;let f=this.getId(d,p);for(let y=0;y<c.length;y++){let g=c[y];if(a&&!a.has(g))continue;let _=s[g];if(!_)continue;let b={};f&&u&&(b=u.getState(_.sourceLayer||"_geojsonTileLayer",f));let v=H({},l[g]);v.paint=hm(v.paint,_.paint,d,b,o),v.layout=hm(v.layout,_.layout,d,b,o);let w=!h||h(d,_,b);if(!w)continue;let P=new E0(d,this.z,this.x,this.y,f);P.layer=v;let T=e[g];T===void 0&&(T=e[g]=[]),T.push({featureIndex:r,feature:P,intersectionZ:w})}}lookupSymbolFeatures(e,t,i,r,n,a,o,s){let l={};this.loadVTLayers();let u=Ka(n);for(let h of e)this.loadMatchingFeature(l,i,r,h,u,a,o,s,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let i of t)if(e===i)return!0;return!1}getId(e,t){var r;let i=e.id;if(this.promoteId){let n=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];i=e.properties[n],typeof i=="boolean"&&(i=Number(i)),i===void 0&&((r=e.properties)!=null&&r.cluster)&&this.promoteId&&(i=Number(e.properties.cluster_id))}return i}};W("FeatureIndex",I3,{omit:["rawTileData","sourceLayerCoder"]});function hm(e,t,i,r,n){return vc(e,(a,o)=>{let s=t instanceof Sl?t.get(o):null;return s&&s.evaluate?s.evaluate(i,r,n):s})}function A3(e,t){return t-e}var ec="RTLPluginLoaded",E3=class extends Et{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=JE()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(e,t=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=me.resolveURL(e),!this.url)throw new Error("requested url ".concat(e," is invalid"));if(this.status==="unavailable")if(t)this.status="deferred",this._syncState(this.status);else return this._requestImport();else if(this.status==="requested")return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new U(ec))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}},Wu=null;function tc(){return Wu||(Wu=new E3),Wu}var k3=3e4,k0=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=og(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,t,i){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e){this.collisionBoxArray=new z_;return}e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=T3(e.buckets,t==null?void 0:t.style),this.hasSymbolBuckets=!1;for(let r in this.buckets){let n=this.buckets[r];if(n instanceof Xn)if(this.hasSymbolBuckets=!0,i)n.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let r in this.buckets){let n=this.buckets[r];if(n instanceof Xn&&n.hasRTLText){this.hasRTLText=!0,tc().lazyLoad();break}}this.queryPadding=0;for(let r in this.buckets){let n=this.buckets[r];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(r).queryRadius(n))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Qe(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Qe(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,r,n,a,o,s,l,u,h){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:a,tileSize:this.tileSize,pixelPosMatrix:u,transform:s,params:o,queryPadding:this.queryPadding*l,getElevation:h},e,t,i)}querySourceFeatures(e,t){let i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;let r=i.loadVTLayers(),n=t&&t.sourceLayer?t.sourceLayer:"",a=r._geojsonTileLayer||r[n];if(!a)return;let o=Ka(t&&t.filter),{z:s,x:l,y:u}=this.tileID.canonical,h={z:s,x:l,y:u};for(let c=0;c<a.length;c++){let p=a.feature(c);if(o.needGeometry){let y=tn(p,!0);if(!o.filter(new et(this.tileID.overscaledZ),y,this.tileID.canonical))continue}else if(!o.filter(new et(this.tileID.overscaledZ),p))continue;let d=i.getId(p,n),f=new E0(p,s,l,u,d);f.tile=h,e.push(f)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let i=gT(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+i["max-age"]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let i=Date.now(),r=!1;if(this.expirationTime>i)r=!1;else if(!t)r=!0;else if(this.expirationTime<t)r=!0;else{let n=this.expirationTime-t;n?this.expirationTime=i+Math.max(n,k3):r=!0}r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let i=this.latestFeatureIndex.loadVTLayers();for(let r in this.buckets){if(!t.style.hasLayer(r))continue;let n=this.buckets[r],a=n.layers[0].sourceLayer||"_geojsonTileLayer",o=i[a],s=e[a];if(!o||!s||Object.keys(s).length===0)continue;n.update(s,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});let l=t&&t.style&&t.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<me.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=me.now()+e}setDependencies(e,t){let i={};for(let r of t)i[r]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let r=this.dependencies[i];if(r){for(let n of t)if(r[n])return!0}}return!1}},D3=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){let r=e.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let n={value:t,timeout:void 0};if(i!==void 0&&(n.timeout=setTimeout(()=>{this.remove(e,n)},i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){let a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let i=e.wrapped().key,r=t===void 0?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(e){let t=[];for(let i in this.data)for(let r of this.data[i])e(r.value)||t.push(r);for(let i of t)this.remove(i.value.tileID,i)}},cm=ne(le(),1),L3=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,i){let r=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},H(this.stateChanges[e][r],i),this.deletedStates[e]===null){this.deletedStates[e]={};for(let n in this.state[e])n!==r&&(this.deletedStates[e][n]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][r]===null){this.deletedStates[e][r]={};for(let n in this.state[e][r])i[n]||(this.deletedStates[e][r][n]=null)}else for(let n in i)this.deletedStates[e]&&this.deletedStates[e][r]&&this.deletedStates[e][r][n]===null&&delete this.deletedStates[e][r][n]}removeFeatureState(e,t,i){if(this.deletedStates[e]===null)return;let r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&t!==void 0)this.deletedStates[e][r]!==null&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(t!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][r]){this.deletedStates[e][r]={};for(i in this.stateChanges[e][r])this.deletedStates[e][r][i]=null}else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,t){let i=String(t),r=this.state[e]||{},n=this.stateChanges[e]||{},a=H({},r[i],n[i]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let o=this.deletedStates[e][t];if(o===null)return{};for(let s in o)delete a[s]}return a}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,t){let i={};for(let r in this.stateChanges){this.state[r]=this.state[r]||{};let n={};for(let a in this.stateChanges[r])this.state[r][a]||(this.state[r][a]={}),H(this.state[r][a],this.stateChanges[r][a]),n[a]=this.state[r][a];i[r]=n}for(let r in this.deletedStates){this.state[r]=this.state[r]||{};let n={};if(this.deletedStates[r]===null)for(let a in this.state[r])n[a]={},this.state[r][a]={};else for(let a in this.deletedStates[r]){if(this.deletedStates[r][a]===null)this.state[r][a]={};else for(let o of Object.keys(this.deletedStates[r][a]))delete this.state[r][a][o];n[a]=this.state[r][a]}i[r]=i[r]||{},H(i[r],n)}if(this.stateChanges={},this.deletedStates={},Object.keys(i).length!==0)for(let r in e)e[r].setFeatureState(i,t)}},z3=ne(le(),1),Ln=89.25;function F3(e,t,i){let r=1/(1<<i.z);return new De(e/8192*r+i.x*r,t/8192*r+i.y*r)}function Si(e,t){let i=Te(t.lat,-Ei,Ei);return new z3.default($n(t.lng)*e,Wr(i)*e)}function ao(e,t){return new De(t.x/e,t.y/e).toLngLat()}function Rs(e){return e.cameraToCenterDistance*Math.min(Math.tan(Fe(90-e.pitch))*.85,Math.tan(Fe(Ln-e.pitch)))}function Hu(e,t){let i=e.canonical,r=t/wt(i.z),n=i.x+Math.pow(2,i.z)*e.wrap,a=O.identity(new Float64Array(16));return O.translate(a,a,[n*r,i.y*r,0]),O.scale(a,a,[r/8192,r/8192,1]),a}function ic(e,t,i,r,n){let a=De.fromLngLat(e,t),o=Xr(1,e.lat),s=n*o,l=s*Math.cos(Fe(i)),u=Math.sqrt(s*s-l*l),h=u*Math.sin(Fe(-r)),c=u*Math.cos(Fe(-r));return new De(a.x+h,a.y+c,a.z+l)}function B3(e,t,i){let r=t.intersectsFrustum(e);if(!i||r===0)return r;let n=t.intersectsPlane(i);return n===0?0:r===2&&n===2?2:1}function pm(e,t,i){let r=0,n=(i-t)/10;for(let a=0;a<10;a++){let o=t+(a+.5)/10*(i-t);r+=n*Math.pow(Math.cos(o),e)}return r}function rc(e,t){return function(i,r,n,a,o){let s=2*((e-1)/Pt(Math.cos(Fe(Ln-o))/Math.cos(Fe(Ln)))-1),l=Math.acos(n/a),u=2*pm(s-1,0,Fe(o/2)),h=Math.min(Fe(Ln),l+Fe(o/2)),c=Math.min(h,l-Fe(o/2)),p=pm(s-1,c,h),d=Math.atan(r/n),f=Math.hypot(r,n),y=i;return y=y+Pt(a/f/Math.max(.5,Math.cos(Fe(o/2)))),y+=s*Pt(Math.cos(d))/2,y-=Pt(Math.max(1,p/u/t))/2,y}}var R3=9.314,O3=3,N3=rc(R3,O3);function Fl(e,t){let i=(t.roundZoom?Math.round:Math.floor)(e.zoom+Pt(e.tileSize/t.tileSize));return Math.max(0,i)}function Bl(e,t){let i=e.getCameraFrustum(),r=e.getClippingPlane(),n=e.screenPointToMercatorCoordinate(e.getCameraPoint()),a=De.fromLngLat(e.center,e.elevation);n.z=a.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;let o=e.getCoveringTilesDetailsProvider(),s=o.allowVariableZoom(e,t),l=Fl(e,t),u=t.minzoom||0,h=t.maxzoom!==void 0?t.maxzoom:e.maxZoom,c=Math.min(Math.max(0,l),h),p=Math.pow(2,c),d=[p*n.x,p*n.y,0],f=[p*a.x,p*a.y,0],y=Math.hypot(a.x-n.x,a.y-n.y),g=Math.abs(a.z-n.z),_=Math.hypot(y,g),b=P=>({zoom:0,x:0,y:0,wrap:P,fullyVisible:!1}),v=[],w=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let P=1;P<=3;P++)v.push(b(-P)),v.push(b(P));for(v.push(b(0));v.length>0;){let P=v.pop(),T=P.x,C=P.y,A=P.fullyVisible,k={x:T,y:C,z:P.zoom},z=o.getTileBoundingVolume(k,P.wrap,e.elevation,t);if(!A){let x=B3(i,z,r);if(x===0)continue;A=x===2}let L=o.distanceToTile2d(n.x,n.y,k,z),E=l;s&&(E=(t.calculateTileZoom||N3)(e.zoom+Pt(e.tileSize/t.tileSize),L,g,_,e.fov)),E=(t.roundZoom?Math.round:Math.floor)(E),E=Math.max(0,E);let D=Math.min(E,h);if(P.wrap=o.getWrap(a,k,P.wrap),P.zoom>=D){if(P.zoom<u)continue;let x=c-P.zoom,M=d[0]-.5-(T<<x),I=d[1]-.5-(C<<x),R=t.reparseOverscaled?Math.max(P.zoom,E):P.zoom;w.push({tileID:new gt(P.zoom===h?R:P.zoom,P.wrap,P.zoom,T,C),distanceSq:It.sqrLen([f[0]-.5-T,f[1]-.5-C]),tileDistanceToCamera:Math.sqrt(M*M+I*I)});continue}for(let x=0;x<4;x++){let M=(T<<1)+x%2,I=(C<<1)+(x>>1),R=P.zoom+1;v.push({zoom:R,x:M,y:I,wrap:P.wrap,fullyVisible:A})}}return w.sort((P,T)=>P.distanceSq-T.distanceSq).map(P=>P.tileID)}var dm=ne(le(),1),V3=Ai.fromPoints([new dm.default(0,0),new dm.default(8192,8192)]),oo=class Fa extends Et{constructor(t,i,r){super(),this.id=t,this.dispatcher=r,this.on("data",n=>this._dataHandler(n)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=w3(t,i,r,this),this._tiles={},this._cache=new D3(0,n=>this._unloadTile(n)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new L3,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let t in this._tiles){let i=this._tiles[t];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(t,i,r){try{await this._source.loadTile(t),this._tileLoaded(t,i,r)}catch(n){t.state="errored",n.status!==404?this._source.fire(new te(n,{tile:t})):this.update(this.transform,this.terrain)}}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new U("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let i in this._tiles){let r=this._tiles[i];r.upload(t),r.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(fm).map(t=>t.key)}getRenderableIds(t){let i=[];for(let r in this._tiles)this._isIdRenderable(r,t)&&i.push(this._tiles[r]);return t?i.sort((r,n)=>{let a=r.tileID,o=n.tileID,s=new cm.default(a.canonical.x,a.canonical.y)._rotate(-this.transform.bearingInRadians),l=new cm.default(o.canonical.x,o.canonical.y)._rotate(-this.transform.bearingInRadians);return a.overscaledZ-o.overscaledZ||l.y-s.y||l.x-s.x}).map(r=>r.tileID.key):i.map(r=>r.tileID).sort(fm).map(r=>r.key)}hasRenderableParent(t){let i=this.findLoadedParent(t,0);return i?this._isIdRenderable(i.tileID.key):!1}_isIdRenderable(t,i){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(i||!this._tiles[t].holdingForFade())}reload(t){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let i in this._tiles)t?this._reloadTile(i,"expired"):this._tiles[i].state!=="errored"&&this._reloadTile(i,"reloading")}async _reloadTile(t,i){let r=this._tiles[t];r&&(r.state!=="loading"&&(r.state=i),await this._loadTile(r,t,i))}_tileLoaded(t,i,r){t.timeAdded=me.now(),r==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new U("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){let i=this.getRenderableIds();for(let n=0;n<i.length;n++){let a=i[n];if(t.neighboringTiles&&t.neighboringTiles[a]){let o=this.getTileByID(a);r(t,o),r(o,t)}}function r(n,a){n.needsHillshadePrepare=!0,n.needsTerrainPrepare=!0;let o=a.tileID.canonical.x-n.tileID.canonical.x,s=a.tileID.canonical.y-n.tileID.canonical.y,l=Math.pow(2,n.tileID.canonical.z),u=a.tileID.key;o===0&&s===0||Math.abs(s)>1||(Math.abs(o)>1&&(Math.abs(o+l)===1?o+=l:Math.abs(o-l)===1&&(o-=l)),!(!a.dem||!n.dem)&&(n.dem.backfillBorder(a.dem,o,s),n.neighboringTiles&&n.neighboringTiles[u]&&(n.neighboringTiles[u].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,i,r,n){for(let a in this._tiles){let o=this._tiles[a];if(n[a]||!o.hasData()||o.tileID.overscaledZ<=i||o.tileID.overscaledZ>r)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>i+1;){let u=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[u.key],o&&o.hasData()&&(s=u)}let l=s;for(;l.overscaledZ>i;)if(l=l.scaledTo(l.overscaledZ-1),t[l.key]||t[l.canonical.key]){n[s.key]=s;break}}}findLoadedParent(t,i){if(t.key in this._loadedParentTiles){let r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=i?r:null}for(let r=t.overscaledZ-1;r>=i;r--){let n=t.scaledTo(r),a=this._getLoadedTile(n);if(a)return a}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){let i=this._tiles[t.key];return i&&i.hasData()?i:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){let i=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=i*r,a=this._maxTileCacheZoomLevels===null?br.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,o=Math.floor(n*a),s=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(s)}handleWrapJump(t){let i=this._prevLng===void 0?t:this._prevLng,r=(t-i)/360,n=Math.round(r);if(this._prevLng=t,n){let a={};for(let o in this._tiles){let s=this._tiles[o];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+n),a[s.tileID.key]=s}this._tiles=a;for(let o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(let o in this._tiles){let s=this._tiles[o];this._setTileReloadTimer(o,s)}}}_updateCoveredAndRetainedTiles(t,i,r,n,a,o){let s={},l={},u=Object.keys(t),h=me.now();for(let c of u){let p=t[c],d=this._tiles[c];if(!d||d.fadeEndTime!==0&&d.fadeEndTime<=h)continue;let f=this.findLoadedParent(p,i),y=this.findLoadedSibling(p),g=f||y||null;g&&(this._addTile(g.tileID),s[g.tileID.key]=g.tileID),l[c]=p}this._retainLoadedChildren(l,n,r,t);for(let c in s)t[c]||(this._coveredTiles[c]=!0,t[c]=s[c]);if(o){let c={},p={};for(let d of a)this._tiles[d.key].hasData()?c[d.key]=d:p[d.key]=d;for(let d in p){let f=p[d].children(this._source.maxzoom);this._tiles[f[0].key]&&this._tiles[f[1].key]&&this._tiles[f[2].key]&&this._tiles[f[3].key]&&(c[f[0].key]=t[f[0].key]=f[0],c[f[1].key]=t[f[1].key]=f[1],c[f[2].key]=t[f[2].key]=f[2],c[f[3].key]=t[f[3].key]=f[3],delete p[d])}for(let d in p){let f=p[d],y=this.findLoadedParent(f,this._source.minzoom),g=this.findLoadedSibling(f),_=y||g||null;if(_){c[_.tileID.key]=t[_.tileID.key]=_.tileID;for(let b in c)c[b].isChildOf(_.tileID)&&delete c[b]}}for(let d in this._tiles)c[d]||(this._coveredTiles[d]=!0)}}update(t,i){if(!this._sourceLoaded||this._paused)return;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};let r;!this.used&&!this.usedForTerrain?r=[]:this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(h=>new gt(h.canonical.z,h.wrap,h.canonical.z,h.canonical.x,h.canonical.y)):(r=Bl(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this.usedForTerrain?!1:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter(h=>this._source.hasTile(h))));let n=Fl(t,this._source),a=Math.max(n-Fa.maxOverzooming,this._source.minzoom),o=Math.max(n+Fa.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let h={};for(let c of r)if(c.canonical.z>this._source.minzoom){let p=c.scaledTo(c.canonical.z-1);h[p.key]=p;let d=c.scaledTo(Math.max(this._source.minzoom,Math.min(c.canonical.z,5)));h[d.key]=d}r=r.concat(Object.values(h))}let s=r.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new U("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let l=this._updateRetainedTiles(r,n);mm(this._source.type)&&this._updateCoveredAndRetainedTiles(l,a,o,n,r,i);for(let h in l)this._tiles[h].clearFadeHold();let u=cT(this._tiles,l);for(let h of u){let c=this._tiles[h];c.hasSymbolBuckets&&!c.holdingForFade()?c.setHoldDuration(this.map._fadeDuration):(!c.hasSymbolBuckets||c.symbolFadeFinished())&&this._removeTile(h)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,i){var l;let r={},n={},a=Math.max(i-Fa.maxOverzooming,this._source.minzoom),o=Math.max(i+Fa.maxUnderzooming,this._source.minzoom),s={};for(let u of t){let h=this._addTile(u);r[u.key]=u,!h.hasData()&&i<this._source.maxzoom&&(s[u.key]=u)}this._retainLoadedChildren(s,i,o,r);for(let u of t){let h=this._tiles[u.key];if(h.hasData())continue;if(i+1>this._source.maxzoom){let p=u.children(this._source.maxzoom)[0],d=this.getTile(p);if(d&&d.hasData()){r[p.key]=p;continue}}else{let p=u.children(this._source.maxzoom);if(r[p[0].key]&&r[p[1].key]&&r[p[2].key]&&r[p[3].key])continue}let c=h.wasRequested();for(let p=u.overscaledZ-1;p>=a;--p){let d=u.scaledTo(p);if(n[d.key])break;if(n[d.key]=!0,h=this.getTile(d),!h&&c&&(h=this._addTile(d)),h){let f=h.hasData();if((f||!((l=this.map)!=null&&l.cancelPendingTileRequestsWhileZooming)||c)&&(r[d.key]=d),c=h.wasRequested(),f)break}}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let t in this._tiles){let i=[],r,n=this._tiles[t].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}i.push(n.key);let a=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(a),r)break;n=a}for(let a of i)this._loadedParentTiles[a]=r}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let t in this._tiles){let i=this._tiles[t].tileID,r=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=r}}_addTile(t){let i=this._tiles[t.key];if(i)return i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));let r=i;return i||(i=new k0(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state)),i.uses++,this._tiles[t.key]=i,r||this._source.fire(new U("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,i){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);let r=i.getExpiryTimeout();r&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},r))}refreshTiles(t){for(let i in this._tiles)!this._isIdRenderable(i)&&this._tiles[i].state!="errored"||t.some(r=>r.equals(this._tiles[i].tileID.canonical))&&this._reloadTile(i,"expired")}_removeTile(t){let i=this._tiles[t];i&&(i.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),!(i.uses>0)&&(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(t){let i=t.sourceDataType;t.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&i==="content"&&(this.reload(t.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,i,r){let n=[],a=this.transform;if(!a)return n;let o=a.getCoveringTilesDetailsProvider().allowWorldCopies(),s=r?a.getCameraQueryGeometry(t):t,l=d=>a.screenPointToMercatorCoordinate(d,this.terrain),u=this.transformBbox(t,l,!o),h=this.transformBbox(s,l,!o),c=this.getIds(),p=Ai.fromPoints(h);for(let d=0;d<c.length;d++){let f=this._tiles[c[d]];if(f.holdingForFade())continue;let y=o?[f.tileID]:[f.tileID.unwrapTo(-1),f.tileID.unwrapTo(0)],g=Math.pow(2,a.zoom-f.tileID.overscaledZ),_=i*f.queryPadding*8192/f.tileSize/g;for(let b of y){let v=p.map(w=>b.getTilePoint(new De(w.x,w.y)));if(v.expandBy(_),v.intersects(V3)){let w=u.map(T=>b.getTilePoint(T)),P=h.map(T=>b.getTilePoint(T));n.push({tile:f,tileID:o?b:b.unwrapTo(0),queryGeometry:w,cameraQueryGeometry:P,scale:g})}}}return n}transformBbox(t,i,r){let n=t.map(i);if(r){let a=Ai.fromPoints(t);a.shrinkBy(Math.min(a.width(),a.height())*.001);let o=a.map(i);Ai.fromPoints(n).covers(o)||(n=n.map(s=>s.x>.5?new De(s.x-1,s.y,s.z):s))}return n}getVisibleCoordinates(t){let i=this.getRenderableIds(t).map(r=>this._tiles[r].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(mm(this._source.type)){let t=me.now();for(let i in this._tiles)if(this._tiles[i].fadeEndTime>=t)return!0}return!1}setFeatureState(t,i,r){t=t||"_geojsonTileLayer",this._state.updateState(t,i,r)}removeFeatureState(t,i,r){t=t||"_geojsonTileLayer",this._state.removeFeatureState(t,i,r)}getFeatureState(t,i){return t=t||"_geojsonTileLayer",this._state.getState(t,i)}setDependencies(t,i,r){let n=this._tiles[t];n&&n.setDependencies(i,r)}reloadTilesForDependencies(t,i){for(let r in this._tiles)this._tiles[r].hasDependency(t,i)&&this._reloadTile(r,"reloading");this._cache.filter(r=>!r.hasDependency(t,i))}};oo.maxOverzooming=10;oo.maxUnderzooming=3;function fm(e,t){let i=Math.abs(e.wrap*2)-+(e.wrap<0),r=Math.abs(t.wrap*2)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function mm(e){return e==="raster"||e==="image"||e==="video"}var xi=ne(le(),1),ur=ne(le(),1);function j3(e,t,i,r,n){let a=[];for(let o=0;o<e.length;o++){let s=e[o],l;for(let u=0;u<s.length-1;u++){let h=s[u],c=s[u+1];h.x<t&&c.x<t||(h.x<t?h=new ur.default(t,h.y+(c.y-h.y)*((t-h.x)/(c.x-h.x)))._round():c.x<t&&(c=new ur.default(t,h.y+(c.y-h.y)*((t-h.x)/(c.x-h.x)))._round()),!(h.y<i&&c.y<i)&&(h.y<i?h=new ur.default(h.x+(c.x-h.x)*((i-h.y)/(c.y-h.y)),i)._round():c.y<i&&(c=new ur.default(h.x+(c.x-h.x)*((i-h.y)/(c.y-h.y)),i)._round()),!(h.x>=r&&c.x>=r)&&(h.x>=r?h=new ur.default(r,h.y+(c.y-h.y)*((r-h.x)/(c.x-h.x)))._round():c.x>=r&&(c=new ur.default(r,h.y+(c.y-h.y)*((r-h.x)/(c.x-h.x)))._round()),!(h.y>=n&&c.y>=n)&&(h.y>=n?h=new ur.default(h.x+(c.x-h.x)*((n-h.y)/(c.y-h.y)),n)._round():c.y>=n&&(c=new ur.default(h.x+(c.x-h.x)*((n-h.y)/(c.y-h.y)),n)._round()),(!l||!h.equals(l[l.length-1]))&&(l=[h],a.push(l)),l.push(c)))))}}return a}var G3=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=Te(e,0,1);let t=1,i=this._distances[t],r=e*this.paddedLength+this.padding;for(;i<r&&t<this._distances.length;)i=this._distances[++t];let n=t-1,a=this._distances[n],o=i-a,s=o>0?(r-a)/o:0;return this.points[n].mult(1-s).add(this.points[t].mult(s))}};function ds(e,t){let i=!0;return e==="always"||(e==="never"||t==="never")&&(i=!1),i}var ym=class{constructor(e,t,i){let r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let a=0;a<this.xCellCount*this.yCellCount;a++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}_insertBoxCell(e,t,i,r,n,a){this.boxCells[n].push(a)}_insertCircleCell(e,t,i,r,n,a){this.circleCells[n].push(a)}_query(e,t,i,r,n,a,o){if(i<0||e>this.width||r<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:e,y1:t,x2:i,y2:r}];for(let l=0;l<this.boxKeys.length;l++)s.push({key:this.boxKeys[l],x1:this.bboxes[l*4],y1:this.bboxes[l*4+1],x2:this.bboxes[l*4+2],y2:this.bboxes[l*4+3]});for(let l=0;l<this.circleKeys.length;l++){let u=this.circles[l*3],h=this.circles[l*3+1],c=this.circles[l*3+2];s.push({key:this.circleKeys[l],x1:u-c,y1:h-c,x2:u+c,y2:h+c})}}else{let l={hitTest:n,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,i,r,this._queryCell,s,l,o)}return s}query(e,t,i,r){return this._query(e,t,i,r,!1,null)}hitTest(e,t,i,r,n,a){return this._query(e,t,i,r,!0,n,a).length>0}hitTestCircle(e,t,i,r,n){let a=e-i,o=e+i,s=t-i,l=t+i;if(o<0||a>this.width||l<0||s>this.height)return!1;let u=[],h={hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(a,s,o,l,this._queryCellCircle,u,h,n),u.length>0}_queryCell(e,t,i,r,n,a,o,s){let{seenUids:l,hitTest:u,overlapMode:h}=o,c=this.boxCells[n];if(c!==null){let d=this.bboxes;for(let f of c)if(!l.box[f]){l.box[f]=!0;let y=f*4,g=this.boxKeys[f];if(e<=d[y+2]&&t<=d[y+3]&&i>=d[y+0]&&r>=d[y+1]&&(!s||s(g))&&(!u||!ds(h,g.overlapMode))&&(a.push({key:g,x1:d[y],y1:d[y+1],x2:d[y+2],y2:d[y+3]}),u))return!0}}let p=this.circleCells[n];if(p!==null){let d=this.circles;for(let f of p)if(!l.circle[f]){l.circle[f]=!0;let y=f*3,g=this.circleKeys[f];if(this._circleAndRectCollide(d[y],d[y+1],d[y+2],e,t,i,r)&&(!s||s(g))&&(!u||!ds(h,g.overlapMode))){let _=d[y],b=d[y+1],v=d[y+2];if(a.push({key:g,x1:_-v,y1:b-v,x2:_+v,y2:b+v}),u)return!0}}}return!1}_queryCellCircle(e,t,i,r,n,a,o,s){let{circle:l,seenUids:u,overlapMode:h}=o,c=this.boxCells[n];if(c!==null){let d=this.bboxes;for(let f of c)if(!u.box[f]){u.box[f]=!0;let y=f*4,g=this.boxKeys[f];if(this._circleAndRectCollide(l.x,l.y,l.radius,d[y+0],d[y+1],d[y+2],d[y+3])&&(!s||s(g))&&!ds(h,g.overlapMode))return a.push(!0),!0}}let p=this.circleCells[n];if(p!==null){let d=this.circles;for(let f of p)if(!u.circle[f]){u.circle[f]=!0;let y=f*3,g=this.circleKeys[f];if(this._circlesCollide(d[y],d[y+1],d[y+2],l.x,l.y,l.radius)&&(!s||s(g))&&!ds(h,g.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,i,r,n,a,o,s){let l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),h=this._convertToXCellCoord(i),c=this._convertToYCellCoord(r);for(let p=l;p<=h;p++)for(let d=u;d<=c;d++){let f=this.xCellCount*d+p;if(n.call(this,e,t,i,r,f,a,o,s))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,r,n,a){let o=r-e,s=n-t,l=i+a;return l*l>o*o+s*s}_circleAndRectCollide(e,t,i,r,n,a,o){let s=(a-r)/2,l=Math.abs(e-(r+s));if(l>s+i)return!1;let u=(o-n)/2,h=Math.abs(t-(n+u));if(h>u+i)return!1;if(l<=s||h<=u)return!0;let c=l-s,p=h-u;return c*c+p*p<=i*i}},so=ne(le(),1);function bp(e,t,i){let r=O.create();if(!e){let{vecSouth:n,vecEast:a}=wp(t),o=Ga.create();o[0]=a[0],o[1]=a[1],o[2]=n[0],o[3]=n[1],Ga.invert(o,o),r[0]=o[0],r[1]=o[1],r[4]=o[2],r[5]=o[3]}return O.scale(r,r,[1/i,1/i,1]),r}function U3(e,t,i,r){if(e){let n=O.create();if(!t){let{vecSouth:a,vecEast:o}=wp(i);n[0]=o[0],n[1]=o[1],n[4]=a[0],n[5]=a[1]}return O.scale(n,n,[r,r,1]),n}else return i.pixelsToClipSpaceMatrix}function wp(e){let t=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),r=Math.cos(e.pitchInRadians),n=Math.cos(e.bearingInRadians),a=Math.sin(e.bearingInRadians),o=It.create();o[0]=-n*r*i-a*t,o[1]=-a*r*i+n*t;let s=It.length(o);s<1e-9?It.zero(o):It.scale(o,o,1/s);let l=It.create();l[0]=n*r*t-a*i,l[1]=a*r*t+n*i;let u=It.length(l);return u<1e-9?It.zero(l):It.scale(l,l,1/u),{vecEast:l,vecSouth:o}}function Pp(e,t,i,r){let n;r?(n=[e,t,r(e,t),1],Ke.transformMat4(n,n,i)):(n=[e,t,0,1],Tp(n,n,i));let a=n[3];return{point:new so.default(n[0]/a,n[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function D0(e,t){return .5+.5*(e/t)}function X3(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function $3(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=i?e.textSizeData:e.iconSizeData,f=Ll(d,t.transform.zoom),y=[256/t.width*2+1,256/t.height*2+1],g=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;g.clear();let _=e.lineVertexArray,b=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,v=t.transform.width/t.transform.height,w=!1;for(let P=0;P<b.length;P++){let T=b.get(P);if(T.hidden||T.writingMode===2&&!w){zn(T.numGlyphs,g);continue}w=!1;let C=new so.default(T.anchorX,T.anchorY),A={getElevation:p,pitchedLabelPlaneMatrix:r,lineVertexArray:_,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:C,unwrappedTileID:l,width:u,height:h,translation:c},k=F0(T.anchorX,T.anchorY,A);if(!X3(k.point,y)){zn(T.numGlyphs,g);continue}let z=k.signedDistanceFromCamera,L=D0(t.transform.cameraToCenterDistance,z),E=vp(d,f,T),D=a?E*t.transform.getPitchedTextCorrection(T.anchorX,T.anchorY,l)/L:E*L,x=_m({projectionContext:A,pitchedLabelPlaneMatrixInverse:n,symbol:T,fontSize:D,flip:!1,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:s});w=x.useVertical,(x.notEnoughRoom||w||x.needsFlipping&&_m({projectionContext:A,pitchedLabelPlaneMatrixInverse:n,symbol:T,fontSize:D,flip:!0,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:s}).notEnoughRoom)&&zn(T.numGlyphs,g)}i?e.text.dynamicLayoutVertexBuffer.updateData(g):e.icon.dynamicLayoutVertexBuffer.updateData(g)}function L0(e,t,i,r,n,a,o,s){let l=a.glyphStartIndex+a.numGlyphs,u=a.lineStartIndex,h=a.lineStartIndex+a.lineLength,c=t.getoffsetX(a.glyphStartIndex),p=t.getoffsetX(l-1),d=Ks(e*c,i,r,n,a.segment,u,h,s,o);if(!d)return null;let f=Ks(e*p,i,r,n,a.segment,u,h,s,o);return!f||s.projectionCache.anyProjectionOccluded?null:{first:d,last:f}}function gm(e,t,i,r){if(e===1){let n=Math.abs(i.y-t.y),a=Math.abs(i.x-t.x)*r;if(n>a)return{useVertical:!0}}return(e===2?t.y<i.y:t.x>i.x)?{needsFlipping:!0}:null}function _m(e){let{projectionContext:t,pitchedLabelPlaneMatrixInverse:i,symbol:r,fontSize:n,flip:a,keepUpright:o,glyphOffsetArray:s,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:h}=e,c=n/24,p=r.lineOffsetX*c,d=r.lineOffsetY*c,f;if(r.numGlyphs>1){let y=r.glyphStartIndex+r.numGlyphs,g=r.lineStartIndex,_=r.lineStartIndex+r.lineLength,b=L0(c,s,p,d,a,r,h,t);if(!b)return{notEnoughRoom:!0};let v=fs(b.first.point.x,b.first.point.y,t,i),w=fs(b.last.point.x,b.last.point.y,t,i);if(o&&!a){let P=gm(r.writingMode,v,w,u);if(P)return P}f=[b.first];for(let P=r.glyphStartIndex+1;P<y-1;P++){let T=Ks(c*s.getoffsetX(P),p,d,a,r.segment,g,_,t,h);if(!T)return{notEnoughRoom:!0};f.push(T)}f.push(b.last)}else{if(o&&!a){let g=Hr(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,_=r.lineStartIndex+r.segment+1,b=new so.default(t.lineVertexArray.getx(_),t.lineVertexArray.gety(_)),v=Hr(b.x,b.y,t),w=v.signedDistanceFromCamera>0?v.point:z0(t.tileAnchorPoint,b,g,1,t),P=fs(g.x,g.y,t,i),T=fs(w.x,w.y,t,i),C=gm(r.writingMode,P,T,u);if(C)return C}let y=Ks(c*s.getoffsetX(r.glyphStartIndex),p,d,a,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,t,h);if(!y||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[y]}for(let y of f)no(l,y.point,y.angle);return{}}function z0(e,t,i,r,n){let a=e.add(e.sub(t)._unit()),o=Hr(a.x,a.y,n).point,s=i.sub(o);return i.add(s._mult(r/s.mag()))}function nc(e,t,i){let r=t.projectionCache;if(r.projections[e])return r.projections[e];let n=new so.default(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),a=Hr(n.x,n.y,t);if(a.signedDistanceFromCamera>0)return r.projections[e]=a.point,r.anyProjectionOccluded=r.anyProjectionOccluded||a.isOccluded,a.point;let o=e-i.direction,s=i.distanceFromAnchor===0?t.tileAnchorPoint:new so.default(t.lineVertexArray.getx(o),t.lineVertexArray.gety(o)),l=i.absOffsetX-i.distanceFromAnchor+1;return z0(s,n,i.previousVertex,l,t)}function Hr(e,t,i){let r=e+i.translation[0],n=t+i.translation[1],a;return i.pitchWithMap?(a=Pp(r,n,i.pitchedLabelPlaneMatrix,i.getElevation),a.isOccluded=!1):(a=i.transform.projectTileCoordinates(r,n,i.unwrappedTileID,i.getElevation),a.point.x=(a.point.x*.5+.5)*i.width,a.point.y=(-a.point.y*.5+.5)*i.height),a}function fs(e,t,i,r){if(i.pitchWithMap){let n=[e,t,0,1];return Ke.transformMat4(n,n,r),i.transform.projectTileCoordinates(n[0]/n[3],n[1]/n[3],i.unwrappedTileID,i.getElevation).point}else return{x:e/i.width*2-1,y:t/i.height*2-1}}function F0(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function ac(e,t,i){return e._unit()._perp()._mult(t*i)}function q3(e,t,i,r,n,a,o,s,l){if(s.projectionCache.offsets[e])return s.projectionCache.offsets[e];let u=i.add(t);if(e+l.direction<r||e+l.direction>=n)return s.projectionCache.offsets[e]=u,u;let h=nc(e+l.direction,s,l),c=ac(h.sub(i),o,l.direction),p=i.add(c),d=h.add(c);return s.projectionCache.offsets[e]=mT(a,u,p,d)||u,s.projectionCache.offsets[e]}function Ks(e,t,i,r,n,a,o,s,l){let u=r?e-t:e+t,h=u>0?1:-1,c=0;r&&(h*=-1,c=Math.PI),h<0&&(c+=Math.PI);let p=h>0?a+n:a+n+1,d;s.projectionCache.cachedAnchorPoint?d=s.projectionCache.cachedAnchorPoint:(d=Hr(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=d);let f=d,y=d,g,_,b=0,v=0,w=Math.abs(u),P=[],T;do{if(p+=h,p<a||p>=o)return null;b+=v,y=f,_=g;let z={absOffsetX:w,direction:h,distanceFromAnchor:b,previousVertex:y};if(f=nc(p,s,z),i===0)P.push(y),T=f.sub(y);else{let L,E=f.sub(y);if(E.mag()===0){let D=nc(p+h,s,z);L=ac(D.sub(f),i,h)}else L=ac(E,i,h);_||(_=y.add(L)),g=q3(p,L,f,a,o,_,i,s,z),P.push(_),T=g.sub(_)}v=T.mag()}while(b+v<=w);let C=(w-b)/v,A=T._mult(C)._add(_||y),k=c+Math.atan2(f.y-y.y,f.x-y.x);return P.push(A),{point:A,angle:l?k:0,path:P}}var Y3=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function zn(e,t){for(let i=0;i<e;i++){let r=t.length;t.resize(r+4),t.float32.set(Y3,r*3)}}function Tp(e,t,i){let r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15],e}function Z3(e,t){let i=O.create();return O.invert(i,t.pitchedLabelPlaneMatrix),e.map(r=>{let n=Pp(r.x,r.y,i,t.getElevation),a=t.transform.projectTileCoordinates(n.point.x,n.point.y,t.unwrappedTileID,t.getElevation);return a.point.x=(a.point.x*.5+.5)*t.width,a.point.y=(-a.point.y*.5+.5)*t.height,a})}function W3(e){let t=0,i=0,r=0,n=0;for(let a=0;a<e.length;a++)e[a].isOccluded?(r=a+1,n=0):(n++,n>i&&(i=n,t=r));return e.slice(t,t+i)}var Ae=100,H3=class{constructor(e,t=new ym(e.width+2*Ae,e.height+2*Ae,25),i=new ym(e.width+2*Ae,e.height+2*Ae,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Ae,this.screenBottomBoundary=e.height+Ae,this.gridRightBoundary=e.width+2*Ae,this.gridBottomBoundary=e.height+2*Ae,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,r,n,a,o,s,l,u,h,c){let p=e.anchorPointX+s[0],d=e.anchorPointY+s[1],f=this.projectAndGetPerspectiveRatio(p,d,n,u,c),y=i*f.perspectiveRatio,g;if(!a&&!o){let C=f.x+(h?h.x*y:0),A=f.y+(h?h.y*y:0);g={allPointsOccluded:!1,box:[C+e.x1*y,A+e.y1*y,C+e.x2*y,A+e.y2*y]}}else g=this._projectCollisionBox(e,y,r,n,a,o,s,f,u,h,c);let[_,b,v,w]=g.box,P=a?g.allPointsOccluded:f.isOccluded,T=P;return T||(T=f.perspectiveRatio<this.perspectiveRatioCutoff),T||(T=!this.isInsideGrid(_,b,v,w)),T||t!=="always"&&this.grid.hitTest(_,b,v,w,t,l)?{box:[_,b,v,w],placeable:!1,offscreen:!1,occluded:P}:{box:[_,b,v,w],placeable:!0,offscreen:this.isOffscreen(_,b,v,w),occluded:P}}placeCollisionCircles(e,t,i,r,n,a,o,s,l,u,h,c,p,d){let f=[],y=new xi.default(t.anchorX,t.anchorY),g=this.getPerspectiveRatio(y.x,y.y,a,d),_=(l?n*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,a)/g:n*g)/d0,b={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},v=t.lineOffsetX*_,w=t.lineOffsetY*_,P={getElevation:d,pitchedLabelPlaneMatrix:o,lineVertexArray:i,pitchWithMap:l,projectionCache:b,transform:this.transform,tileAnchorPoint:y,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:p},T=L0(_,r,v,w,!1,t,!1,P),C=!1,A=!1,k=!0;if(T){let z=h*.5*g+c,L=new xi.default(-Ae,-Ae),E=new xi.default(this.screenRightBoundary,this.screenBottomBoundary),D=new G3,x=T.first,M=T.last,I=[];for(let $=x.path.length-1;$>=1;$--)I.push(x.path[$]);for(let $=1;$<M.path.length;$++)I.push(M.path[$]);let R=z*2.5;if(l){let $=this.projectPathToScreenSpace(I,P);$.some(Q=>Q.signedDistanceFromCamera<=0)?I=[]:I=$.map(Q=>Q.point)}let N=[];if(I.length>0){let $=I[0].clone(),Q=I[0].clone();for(let oe=1;oe<I.length;oe++)$.x=Math.min($.x,I[oe].x),$.y=Math.min($.y,I[oe].y),Q.x=Math.max(Q.x,I[oe].x),Q.y=Math.max(Q.y,I[oe].y);$.x>=L.x&&Q.x<=E.x&&$.y>=L.y&&Q.y<=E.y?N=[I]:Q.x<L.x||$.x>E.x||Q.y<L.y||$.y>E.y?N=[]:N=j3([I],L.x,L.y,E.x,E.y)}for(let $ of N){D.reset($,z*.25);let Q=0;D.length<=.5*z?Q=1:Q=Math.ceil(D.paddedLength/R)+1;for(let oe=0;oe<Q;oe++){let Le=oe/Math.max(Q-1,1),Ce=D.lerp(Le),ze=Ce.x+Ae,$e=Ce.y+Ae;f.push(ze,$e,z,0);let Lt=ze-z,Xt=$e-z,$t=ze+z,qt=$e+z;if(k=k&&this.isOffscreen(Lt,Xt,$t,qt),A=A||this.isInsideGrid(Lt,Xt,$t,qt),e!=="always"&&this.grid.hitTestCircle(ze,$e,z,e,u)&&(C=!0,!s))return{circles:[],offscreen:!1,collisionDetected:C}}}}return{circles:!s&&C||!A||g<this.perspectiveRatioCutoff?[]:f,offscreen:k,collisionDetected:C}}projectPathToScreenSpace(e,t){let i=Z3(e,t);return W3(i)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],i=new Ai;for(let h of e){let c=new xi.default(h.x+Ae,h.y+Ae);i.extend(c),t.push(c)}let{minX:r,minY:n,maxX:a,maxY:o}=i,s=this.grid.query(r,n,a,o).concat(this.ignoredGrid.query(r,n,a,o)),l={},u={};for(let h of s){let c=h.key;if(l[c.bucketInstanceId]===void 0&&(l[c.bucketInstanceId]={}),l[c.bucketInstanceId][c.featureIndex])continue;let p=[new xi.default(h.x1,h.y1),new xi.default(h.x2,h.y1),new xi.default(h.x2,h.y2),new xi.default(h.x1,h.y2)];Z_(t,p)&&(l[c.bucketInstanceId][c.featureIndex]=!0,u[c.bucketInstanceId]===void 0&&(u[c.bucketInstanceId]=[]),u[c.bucketInstanceId].push(c.featureIndex))}return u}insertCollisionBox(e,t,i,r,n,a){let o=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:n,collisionGroupID:a,overlapMode:t};o.insert(s,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,n,a){let o=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:n,collisionGroupID:a,overlapMode:t};for(let l=0;l<e.length;l+=4)o.insertCircle(s,e[l],e[l+1],e[l+2])}projectAndGetPerspectiveRatio(e,t,i,r,n){if(n){let a;r?(a=[e,t,r(e,t),1],Ke.transformMat4(a,a,n)):(a=[e,t,0,1],Tp(a,a,n));let o=a[3];return{x:(a[0]/o+1)/2*this.transform.width+Ae,y:(-a[1]/o+1)/2*this.transform.height+Ae,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/o),isOccluded:!1,signedDistanceFromCamera:o}}else{let a=this.transform.projectTileCoordinates(e,t,i,r);return{x:(a.point.x+1)/2*this.transform.width+Ae,y:(-a.point.y+1)/2*this.transform.height+Ae,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera),isOccluded:a.isOccluded,signedDistanceFromCamera:a.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,r){let n=this.transform.projectTileCoordinates(e,t,i,r);return .5+.5*(this.transform.cameraToCenterDistance/n.signedDistanceFromCamera)}isOffscreen(e,t,i,r){return i<Ae||e>=this.screenRightBoundary||r<Ae||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=O.identity([]);return O.translate(e,e,[-Ae,-Ae,0]),e}_projectCollisionBox(e,t,i,r,n,a,o,s,l,u,h){let c=1,p=0,d=0,f=1,y=e.anchorPointX+o[0],g=e.anchorPointY+o[1];if(a&&!n){let D=this.projectAndGetPerspectiveRatio(y+1,g,r,l,h),x=D.x-s.x,M=D.y-s.y,I=Math.atan(M/x)+(x<0?Math.PI:0),R=Math.sin(I),N=Math.cos(I);c=N,p=R,d=-R,f=N}else if(!a&&n){let D=wp(this.transform);c=D.vecEast[0],p=D.vecEast[1],d=D.vecSouth[0],f=D.vecSouth[1]}let _=s.x,b=s.y,v=t;if(n){_=y,b=g;let D=this.transform.zoom-i.overscaledZ;if(v=Math.pow(2,-D),v*=this.transform.getPitchedTextCorrection(y,g,r),!u){let x=s.signedDistanceFromCamera/this.transform.cameraToCenterDistance,M=Te(.5+.5*x,0,4);v*=M}}u&&(_+=c*u.x*v+d*u.y*v,b+=p*u.x*v+f*u.y*v);let w=e.x1*v,P=e.x2*v,T=(w+P)/2,C=e.y1*v,A=e.y2*v,k=(C+A)/2,z=[{offsetX:w,offsetY:C},{offsetX:T,offsetY:C},{offsetX:P,offsetY:C},{offsetX:P,offsetY:k},{offsetX:P,offsetY:A},{offsetX:T,offsetY:A},{offsetX:w,offsetY:A},{offsetX:w,offsetY:k}],L=[];for(let{offsetX:D,offsetY:x}of z)L.push(new xi.default(_+c*D+d*x,b+p*D+f*x));let E=!1;if(n){let D=L.map(x=>this.projectAndGetPerspectiveRatio(x.x,x.y,r,l,h));E=D.some(x=>!x.isOccluded),L=D.map(x=>new xi.default(x.x,x.y))}else E=!0;return{box:hT(L),allPointsOccluded:!E}}},K3=ne(le(),1),J3=class B0 extends K3.default{constructor(t,i,r,n){super(t,i),this.angle=r,n!==void 0&&(this.segment=n)}clone(){return new B0(this.x,this.y,this.angle,this.segment)}};W("Anchor",J3);var mV=ne(le(),1),yV=ne(le(),1),gV=ne(le(),1),_V=ne(Km(),1),oc=(e=>(e[e.center=1]="center",e[e.left=2]="left",e[e.right=3]="right",e[e.top=4]="top",e[e.bottom=5]="bottom",e[e["top-left"]=6]="top-left",e[e["top-right"]=7]="top-right",e[e["bottom-left"]=8]="bottom-left",e[e["bottom-right"]=9]="bottom-right",e))(oc||{}),xV=Number.POSITIVE_INFINITY;function Q3(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}var R0=ne(le(),1),xm=class{constructor(e,t,i,r){e?this.opacity=Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):this.opacity=r&&i?1:0,this.placed=i}isHidden(){return this.opacity===0&&!this.placed}},ga=class{constructor(e,t,i,r,n){this.text=new xm(e?e.text:null,t,i,n),this.icon=new xm(e?e.icon:null,t,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},vm=class{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}},ek=class{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}},tk=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:i=>i.collisionGroupID===t}}return this.collisionGroups[e]}};function bm(e,t,i,r,n){let{horizontalAlign:a,verticalAlign:o}=y0(e),s=-(a-.5)*t,l=-(o-.5)*i;return new R0.default(s+r[0]*n,l+r[1]*n)}var ik=class{constructor(e,t,i,r,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new H3(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new tk(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;return t?(i,r)=>t.getElevation(e,i,r):null}getBucketParts(e,t,i,r){let n=i.getBucket(t),a=i.latestFeatureIndex;if(!n||!a||t.id!==n.layerIds[0])return;let o=i.collisionBoxArray,s=n.layers[0].layout,l=n.layers[0].paint,u=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),h=i.tileSize/8192,c=i.tileID.toUnwrapped(),p=s.get("text-rotation-alignment")==="map",d=Nt(i,1,this.transform.zoom),f=vr(this.collisionIndex.transform,i,l.get("text-translate"),l.get("text-translate-anchor")),y=vr(this.collisionIndex.transform,i,l.get("icon-translate"),l.get("icon-translate-anchor")),g=bp(p,this.transform,d);this.retainedQueryData[n.bucketInstanceId]=new ek(n.bucketInstanceId,a,n.sourceLayerIndex,n.index,i.tileID);let _={bucket:n,layout:s,translationText:f,translationIcon:y,unwrappedTileID:c,pitchedLabelPlaneMatrix:g,scale:u,textPixelRatio:h,holdingForFade:i.holdingForFade(),collisionBoxArray:o,partiallyEvaluatedTextSize:Ll(n.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(r)for(let b of n.sortKeyRanges){let{sortKey:v,symbolInstanceStart:w,symbolInstanceEnd:P}=b;e.push({sortKey:v,symbolInstanceStart:w,symbolInstanceEnd:P,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v){let w=oc[e.textAnchor],P=[e.textOffset0,e.textOffset1],T=bm(w,i,r,P,n),C=this.collisionIndex.placeCollisionBox(t,c,s,l,u,o,a,y,h.predicate,b,T,v);if(!(_&&!this.collisionIndex.placeCollisionBox(_,c,s,l,u,o,a,g,h.predicate,b,T,v).placeable)&&C.placeable){let A;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(A=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:P,width:i,height:r,anchor:w,textBoxScale:n,prevAnchor:A},this.markUsedJustification(d,w,p,f),d.allowVerticalPlacement&&(this.markUsedOrientation(d,f,p),this.placedOrientations[p.crossTileID]=f),{shift:T,placedGlyphBoxes:C}}}placeLayerBucketPart(e,t,i){let{bucket:r,layout:n,translationText:a,translationIcon:o,unwrappedTileID:s,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:h,collisionBoxArray:c,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,f=n.get("text-optional"),y=n.get("icon-optional"),g=Ws(n,"text-overlap","text-allow-overlap"),_=g==="always",b=Ws(n,"icon-overlap","icon-allow-overlap"),v=b==="always",w=n.get("text-rotation-alignment")==="map",P=n.get("text-pitch-alignment")==="map",T=n.get("icon-text-fit")!=="none",C=n.get("symbol-z-order")==="viewport-y",A=_&&(v||!r.hasIconData()||y),k=v&&(_||!r.hasTextData()||f);!r.collisionArrays&&c&&r.deserializeCollisionBoxes(c);let z=this.retainedQueryData[r.bucketInstanceId].tileID,L=this._getTerrainElevationFunc(z),E=this.transform.getFastPathSimpleProjectionMatrix(z),D=(x,M,I)=>{var Er,Oi;if(t[x.crossTileID])return;if(h){this.placements[x.crossTileID]=new vm(!1,!1,!1);return}let R=!1,N=!1,$=!0,Q=null,oe={box:null,placeable:!1,offscreen:null,occluded:!1},Le={box:null,placeable:!1,offscreen:null},Ce=null,ze=null,$e=null,Lt=0,Xt=0,$t=0;M.textFeatureIndex?Lt=M.textFeatureIndex:x.useRuntimeCollisionCircles&&(Lt=x.featureIndex),M.verticalTextFeatureIndex&&(Xt=M.verticalTextFeatureIndex);let qt=M.textBox;if(qt){let Yt=pt=>{let xt=1;if(r.allowVerticalPlacement&&!pt&&this.prevPlacement){let Wt=this.prevPlacement.placedOrientations[x.crossTileID];Wt&&(this.placedOrientations[x.crossTileID]=Wt,xt=Wt,this.markUsedOrientation(r,xt,x))}return xt},zt=(pt,xt)=>{if(r.allowVerticalPlacement&&x.numVerticalGlyphVertices>0&&M.verticalTextBox){for(let Wt of r.writingModes)if(Wt===2?(oe=xt(),Le=oe):oe=pt(),oe&&oe.placeable)break}else oe=pt()},kr=x.textAnchorOffsetStartIndex,Zt=x.textAnchorOffsetEndIndex;if(Zt===kr){let pt=(xt,Wt)=>{let mt=this.collisionIndex.placeCollisionBox(xt,g,u,z,s,P,w,a,d.predicate,L,void 0,E);return mt&&mt.placeable&&(this.markUsedOrientation(r,Wt,x),this.placedOrientations[x.crossTileID]=Wt),mt};zt(()=>pt(qt,1),()=>{let xt=M.verticalTextBox;return r.allowVerticalPlacement&&x.numVerticalGlyphVertices>0&&xt?pt(xt,2):{box:null,offscreen:null}}),Yt(oe&&oe.placeable)}else{let pt=oc[(Oi=(Er=this.prevPlacement)==null?void 0:Er.variableOffsets[x.crossTileID])==null?void 0:Oi.anchor],xt=(mt,_u,b1)=>{let w1=mt.x2-mt.x1,P1=mt.y2-mt.y1,T1=x.textBoxScale,S1=T&&b==="never"?_u:null,Dr=null,yd=g==="never"?1:2,gd="never";pt&&yd++;for(let _d=0;_d<yd;_d++){for(let xu=kr;xu<Zt;xu++){let xd=r.textAnchorOffsets.get(xu);if(pt&&xd.textAnchor!==pt)continue;let vu=this.attemptAnchorPlacement(xd,mt,w1,P1,T1,w,P,u,z,s,d,gd,x,r,b1,a,o,S1,L);if(vu&&(Dr=vu.placedGlyphBoxes,Dr&&Dr.placeable))return R=!0,Q=vu.shift,Dr}pt?pt=null:gd=g}return i&&!Dr&&(Dr={box:this.collisionIndex.placeCollisionBox(qt,"always",u,z,s,P,w,a,d.predicate,L,void 0,E).box,offscreen:!1,placeable:!1,occluded:!1}),Dr};zt(()=>xt(qt,M.iconBox,1),()=>{let mt=M.verticalTextBox,_u=oe&&oe.placeable;return r.allowVerticalPlacement&&!_u&&x.numVerticalGlyphVertices>0&&mt?xt(mt,M.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),oe&&(R=oe.placeable,$=oe.offscreen);let Wt=Yt(oe&&oe.placeable);if(!R&&this.prevPlacement){let mt=this.prevPlacement.variableOffsets[x.crossTileID];mt&&(this.variableOffsets[x.crossTileID]=mt,this.markUsedJustification(r,mt.anchor,x,Wt))}}}if(Ce=oe,R=Ce&&Ce.placeable,$=Ce&&Ce.offscreen,x.useRuntimeCollisionCircles){let Yt=r.text.placedSymbolArray.get(x.centerJustifiedTextSymbolIndex),zt=vp(r.textSizeData,p,Yt),kr=n.get("text-padding"),Zt=x.collisionCircleDiameter;ze=this.collisionIndex.placeCollisionCircles(g,Yt,r.lineVertexArray,r.glyphOffsetArray,zt,s,l,i,P,d.predicate,Zt,kr,a,L),ze.circles.length&&ze.collisionDetected&&!i&&nt("Collisions detected, but collision boxes are not shown"),R=_||ze.circles.length>0&&!ze.collisionDetected,$=$&&ze.offscreen}if(M.iconFeatureIndex&&($t=M.iconFeatureIndex),M.iconBox){let Yt=zt=>this.collisionIndex.placeCollisionBox(zt,b,u,z,s,P,w,o,d.predicate,L,T&&Q?Q:void 0,E);Le&&Le.placeable&&M.verticalIconBox?($e=Yt(M.verticalIconBox),N=$e.placeable):($e=Yt(M.iconBox),N=$e.placeable),$=$&&$e.offscreen}let or=f||x.numHorizontalGlyphVertices===0&&x.numVerticalGlyphVertices===0,_t=y||x.numIconVertices===0;!or&&!_t?N=R=N&&R:_t?or||(N=N&&R):R=N&&R;let Oo=R&&Ce.placeable,mn=N&&$e.placeable;if(Oo&&(Le&&Le.placeable&&Xt?this.collisionIndex.insertCollisionBox(Ce.box,g,n.get("text-ignore-placement"),r.bucketInstanceId,Xt,d.ID):this.collisionIndex.insertCollisionBox(Ce.box,g,n.get("text-ignore-placement"),r.bucketInstanceId,Lt,d.ID)),mn&&this.collisionIndex.insertCollisionBox($e.box,b,n.get("icon-ignore-placement"),r.bucketInstanceId,$t,d.ID),ze&&R&&this.collisionIndex.insertCollisionCircles(ze.circles,g,n.get("text-ignore-placement"),r.bucketInstanceId,Lt,d.ID),i&&this.storeCollisionData(r.bucketInstanceId,I,M,Ce,$e,ze),x.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(r.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");let Ar=(R||A)&&!(Ce!=null&&Ce.occluded),Ri=(N||k)&&!($e!=null&&$e.occluded);this.placements[x.crossTileID]=new vm(Ar,Ri,$||r.justReloaded),t[x.crossTileID]=!0};if(C){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let x=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let M=x.length-1;M>=0;--M){let I=x[M];D(r.symbolInstances.get(I),r.collisionArrays[I],I)}}else for(let x=e.symbolInstanceStart;x<e.symbolInstanceEnd;x++)D(r.symbolInstances.get(x),r.collisionArrays[x],x);r.justReloaded=!1}storeCollisionData(e,t,i,r,n,a){if(i.textBox||i.iconBox){let o;this.collisionBoxArrays.has(e)?o=this.collisionBoxArrays.get(e):(o=new Map,this.collisionBoxArrays.set(e,o));let s;o.has(t)?s=o.get(t):(s={text:null,icon:null},o.set(t,s)),i.textBox&&(s.text=r.box),i.iconBox&&(s.icon=n.box)}if(a){let o=this.collisionCircleArrays[e];o===void 0&&(o=this.collisionCircleArrays[e]=[]);for(let s=0;s<a.circles.length;s+=4)o.push(a.circles[s+0]-Ae),o.push(a.circles[s+1]-Ae),o.push(a.circles[s+2]),o.push(a.collisionDetected?1:0)}}markUsedJustification(e,t,i,r){let n={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex},a;r===2?a=i.verticalPlacedTextSymbolIndex:a=n[Q3(t)];let o=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let s of o)s>=0&&(a>=0&&s!==a?e.text.placedSymbolArray.get(s).crossTileID=0:e.text.placedSymbolArray.get(s).crossTileID=i.crossTileID)}markUsedOrientation(e,t,i){let r=t===1||t===3?t:0,n=t===2?t:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let o of a)e.text.placedSymbolArray.get(o).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=n)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let s in this.placements){let l=this.placements[s],u=n[s];u?(this.opacities[s]=new ga(u,r,l.text,l.icon),i=i||l.text!==u.text.placed||l.icon!==u.icon.placed):(this.opacities[s]=new ga(null,r,l.text,l.icon,l.skipFade),i=i||l.text||l.icon)}for(let s in n){let l=n[s];if(!this.opacities[s]){let u=new ga(l,r,!1,!1);u.isHidden()||(this.opacities[s]=u,i=i||l.text.placed||l.icon.placed)}}for(let s in a)!this.variableOffsets[s]&&this.opacities[s]&&!this.opacities[s].isHidden()&&(this.variableOffsets[s]=a[s]);for(let s in o)!this.placedOrientations[s]&&this.opacities[s]&&!this.opacities[s].isHidden()&&(this.placedOrientations[s]=o[s]);if(t&&t.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let i={};for(let r of t){let n=r.getBucket(e);n&&r.latestFeatureIndex&&e.id===n.layerIds[0]&&this.updateBucketOpacities(n,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(e,t,i,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let n=e.layers[0],a=n.layout,o=new ga(null,0,!1,!1,!0),s=a.get("text-allow-overlap"),l=a.get("icon-allow-overlap"),u=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h=a.get("text-rotation-alignment")==="map",c=a.get("text-pitch-alignment")==="map",p=a.get("icon-text-fit")!=="none",d=new ga(null,0,s&&(l||!e.hasIconData()||a.get("icon-optional")),l&&(s||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);let f=(g,_,b)=>{for(let v=0;v<_/4;v++)g.opacityVertexArray.emplaceBack(b);g.hasVisibleVertices=g.hasVisibleVertices||b!==_a},y=this.collisionBoxArrays.get(e.bucketInstanceId);for(let g=0;g<e.symbolInstances.length;g++){let _=e.symbolInstances.get(g),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:v,crossTileID:w}=_,P=i[w],T=this.opacities[w];P?T=o:T||(T=d,this.opacities[w]=T),i[w]=!0;let C=b>0||v>0,A=_.numIconVertices>0,k=this.placedOrientations[_.crossTileID],z=k===2,L=k===1||k===3;if(C){let D=Pm(T.text),x=z?_a:D;f(e.text,b,x);let M=L?_a:D;f(e.text,v,M);let I=T.text.isHidden();[_.rightJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.leftJustifiedTextSymbolIndex].forEach($=>{$>=0&&(e.text.placedSymbolArray.get($).hidden=I||z?1:0)}),_.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(_.verticalPlacedTextSymbolIndex).hidden=I||L?1:0);let R=this.variableOffsets[_.crossTileID];R&&this.markUsedJustification(e,R.anchor,_,k);let N=this.placedOrientations[_.crossTileID];N&&(this.markUsedJustification(e,"left",_,N),this.markUsedOrientation(e,N,_))}if(A){let D=Pm(T.icon),x=!(p&&_.verticalPlacedIconSymbolIndex&&z);if(_.placedIconSymbolIndex>=0){let M=x?D:_a;f(e.icon,_.numIconVertices,M),e.icon.placedSymbolArray.get(_.placedIconSymbolIndex).hidden=T.icon.isHidden()}if(_.verticalPlacedIconSymbolIndex>=0){let M=x?_a:D;f(e.icon,_.numVerticalIconVertices,M),e.icon.placedSymbolArray.get(_.verticalPlacedIconSymbolIndex).hidden=T.icon.isHidden()}}let E=y&&y.has(g)?y.get(g):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let D=e.collisionArrays[g];if(D){let x=new R0.default(0,0);if(D.textBox||D.verticalTextBox){let M=!0;if(u){let I=this.variableOffsets[w];I?(x=bm(I.anchor,I.width,I.height,I.textOffset,I.textBoxScale),h&&x._rotate(c?-this.transform.bearingInRadians:this.transform.bearingInRadians)):M=!1}if(D.textBox||D.verticalTextBox){let I;D.textBox&&(I=z),D.verticalTextBox&&(I=L),wm(e.textCollisionBox.collisionVertexArray,T.text.placed,!M||I,E.text,x.x,x.y)}}if(D.iconBox||D.verticalIconBox){let M=!!(!L&&D.verticalIconBox),I;D.iconBox&&(I=M),D.verticalIconBox&&(I=!M),wm(e.iconCollisionBox.collisionVertexArray,T.icon.placed,I,E.icon,p?x.x:0,p?x.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error("bucket.text.opacityVertexArray.length (= ".concat(e.text.opacityVertexArray.length,") !== bucket.text.layoutVertexArray.length (= ").concat(e.text.layoutVertexArray.length,") / 4"));if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error("bucket.icon.opacityVertexArray.length (= ".concat(e.icon.opacityVertexArray.length,") !== bucket.icon.layoutVertexArray.length (= ").concat(e.icon.layoutVertexArray.length,") / 4"));e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}};function wm(e,t,i,r,n,a){(!r||r.length===0)&&(r=[0,0,0,0]);let o=r[0]-Ae,s=r[1]-Ae,l=r[2]-Ae,u=r[3]-Ae;e.emplaceBack(t?1:0,i?1:0,n||0,a||0,o,s),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,l,s),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,l,u),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,o,u)}var rk=Math.pow(2,25),nk=Math.pow(2,24),ak=Math.pow(2,17),ok=Math.pow(2,16),sk=Math.pow(2,9),lk=Math.pow(2,8),uk=Math.pow(2,1);function Pm(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=e.placed?1:0,i=Math.floor(e.opacity*127);return i*rk+t*nk+i*ak+t*ok+i*sk+t*lk+i*uk+t}var _a=0,hk=class{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,r,n){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let o=e[this._currentTileIndex];if(t.getBucketParts(a,r,o,this._sortAcrossTiles),this._currentTileIndex++,n())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((o,s)=>o.sortKey-s.sortKey));this._currentPartIndex<a.length;){let o=a[this._currentPartIndex];if(t.placeLayerBucketPart(o,this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0}return!1}},ck=class{constructor(e,t,i,r,n,a,o,s){this.placement=new ik(e,t,a,o,s),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){let r=me.now(),n=()=>this._forceFullPlacement?!1:me.now()-r>2;for(;this._currentPlacementIndex>=0;){let a=e[this._currentPlacementIndex],o=t[a],s=this.placement.collisionIndex.transform.zoom;if(o.type==="symbol"&&(!o.minzoom||o.minzoom<=s)&&(!o.maxzoom||o.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new hk(o)),this._inProgressLayer.continuePlacement(i[o.source],this.placement,this._showCollisionBoxes,o,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}},Tm=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Ku=1,xa=8,pk=class O0{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[i,r]=new Uint8Array(t,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");let n=r>>4;if(n!==Ku)throw new Error("Got v".concat(n," data when expected v").concat(Ku,"."));let a=Tm[r&15];if(!a)throw new Error("Unrecognized array type.");let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new O0(s,o,a,t)}constructor(t,i=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error("Unpexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let a=Tm.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(a<0)throw new Error("Unexpected typed array class: ".concat(r,"."));n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,xa,t),this.coords=new this.ArrayType(this.data,xa+s+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(xa+o+s+l),this.ids=new this.IndexArrayType(this.data,xa,t),this.coords=new this.ArrayType(this.data,xa+s+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Ku<<4)+a]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=t)}add(t,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=i,r}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error("Added ".concat(t," items when expected ").concat(this.numItems,"."));return sc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,i,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:a,coords:o,nodeSize:s}=this,l=[0,a.length-1,0],u=[];for(;l.length;){let h=l.pop()||0,c=l.pop()||0,p=l.pop()||0;if(c-p<=s){for(let g=p;g<=c;g++){let _=o[2*g],b=o[2*g+1];_>=t&&_<=r&&b>=i&&b<=n&&u.push(a[g])}continue}let d=p+c>>1,f=o[2*d],y=o[2*d+1];f>=t&&f<=r&&y>=i&&y<=n&&u.push(a[d]),(h===0?t<=f:i<=y)&&(l.push(p),l.push(d-1),l.push(1-h)),(h===0?r>=f:n>=y)&&(l.push(d+1),l.push(c),l.push(1-h))}return u}within(t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:n,coords:a,nodeSize:o}=this,s=[0,n.length-1,0],l=[],u=r*r;for(;s.length;){let h=s.pop()||0,c=s.pop()||0,p=s.pop()||0;if(c-p<=o){for(let g=p;g<=c;g++)Sm(a[2*g],a[2*g+1],t,i)<=u&&l.push(n[g]);continue}let d=p+c>>1,f=a[2*d],y=a[2*d+1];Sm(f,y,t,i)<=u&&l.push(n[d]),(h===0?t-r<=f:i-r<=y)&&(s.push(p),s.push(d-1),s.push(1-h)),(h===0?t+r>=f:i+r>=y)&&(s.push(d+1),s.push(c),s.push(1-h))}return l}};function sc(e,t,i,r,n,a){if(n-r<=i)return;let o=r+n>>1;N0(e,t,o,r,n,a),sc(e,t,i,r,o-1,1-a),sc(e,t,i,o+1,n,1-a)}function N0(e,t,i,r,n,a){for(;n>r;){if(n-r>600){let u=n-r+1,h=i-r+1,c=Math.log(u),p=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1),f=Math.max(r,Math.floor(i-h*p/u+d)),y=Math.min(n,Math.floor(i+(u-h)*p/u+d));N0(e,t,i,f,y,a)}let o=t[2*i+a],s=r,l=n;for(va(e,t,r,i),t[2*n+a]>o&&va(e,t,r,n);s<l;){for(va(e,t,s,l),s++,l--;t[2*s+a]<o;)s++;for(;t[2*l+a]>o;)l--}t[2*r+a]===o?va(e,t,r,l):(l++,va(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function va(e,t,i,r){Ju(e,i,r),Ju(t,2*i,2*r),Ju(t,2*i+1,2*r+1)}function Ju(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function Sm(e,t,i,r){let n=e-i,a=t-r;return n*n+a*a}var ba=512/8192/2,dk=128,fk=class{constructor(e,t,i){this.tileID=e,this.bucketInstanceId=i,this._symbolsByKey={};let r=new Map;for(let n=0;n<t.length;n++){let a=t.get(n),o=a.key,s=r.get(o);s?s.push(a):r.set(o,[a])}for(let[n,a]of r){let o=a.map(u=>({x:Math.floor(u.anchorX*ba),y:Math.floor(u.anchorY*ba)})),s=a.map(u=>u.crossTileID),l={positions:o,crossTileIDs:s};if(l.positions.length>dk){let u=new pk(l.positions.length,16,Uint16Array);for(let{x:h,y:c}of l.positions)u.add(h,c);u.finish(),delete l.positions,l.index=u}this._symbolsByKey[n]=l}}getScaledCoordinates(e,t){let{x:i,y:r,z:n}=this.tileID.canonical,{x:a,y:o,z:s}=t.canonical,l=s-n,u=ba/Math.pow(2,l),h=(a*8192+e.anchorX)*u,c=(o*8192+e.anchorY)*u,p=i*8192*ba,d=r*8192*ba;return{x:Math.floor(h-p),y:Math.floor(c-d)}}findMatches(e,t,i){let r=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let n=0;n<e.length;n++){let a=e.get(n);if(a.crossTileID)continue;let o=this._symbolsByKey[a.key];if(!o)continue;let s=this.getScaledCoordinates(a,t);if(o.index){let l=o.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(let u of l){let h=o.crossTileIDs[u];if(!i[h]){i[h]=!0,a.crossTileID=h;break}}}else if(o.positions)for(let l=0;l<o.positions.length;l++){let u=o.positions[l],h=o.crossTileIDs[l];if(Math.abs(u.x-s.x)<=r&&Math.abs(u.y-s.y)<=r&&!i[h]){i[h]=!0,a.crossTileID=h;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},mk=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},yk=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let i in this.indexes){let r=this.indexes[i],n={};for(let a in r){let o=r[a];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+t),n[o.tileID.key]=o}this.indexes[i]=n}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let n=0;n<t.symbolInstances.length;n++){let a=t.symbolInstances.get(n);a.crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let r=this.usedCrossTileIDs[e.overscaledZ];for(let n in this.indexes){let a=this.indexes[n];if(Number(n)>e.overscaledZ)for(let o in a){let s=a[o];s.tileID.isChildOf(e)&&s.findMatches(t.symbolInstances,e,r)}else{let o=e.scaledTo(Number(n)),s=a[o.key];s&&s.findMatches(t.symbolInstances,e,r)}}for(let n=0;n<t.symbolInstances.length;n++){let a=t.symbolInstances.get(n);a.crossTileID||(a.crossTileID=i.generate(),r[a.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new fk(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let r of i)delete this.usedCrossTileIDs[e][r]}removeStaleBuckets(e){let t=!1;for(let i in this.indexes){let r=this.indexes[i];for(let n in r)e[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],t=!0)}return t}},V0=class{constructor(){this.layerIndexes={},this.crossTileIDs=new mk,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new yk);let n=!1,a={};r.handleWrapJump(i);for(let o of t){let s=o.getBucket(e);!s||e.id!==s.layerIds[0]||(s.bucketInstanceId||(s.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(o.tileID,s,this.crossTileIDs)&&(n=!0),a[s.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(n=!0),n}pruneUnusedLayers(e){let t={};e.forEach(i=>{t[i]=!0});for(let i in this.layerIndexes)t[i]||delete this.layerIndexes[i]}},gk="#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;",_k="#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;",xk="uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",vk="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}",bk="uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",wk="uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}",Pk="in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Tk="uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}",Mm="void main() {fragColor=vec4(1.0);}",Sk="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}",Mk="uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Ck="uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}",Ik="uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}",Ak="uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}",Ek="in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}",kk="in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}",Dk="in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}",Lk="in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}",zk="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(textureSize(u_elevation_stops,0)[0]);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int num_elevation_stops=textureSize(u_elevation_stops,0)[0];int r=(num_elevation_stops-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(textureSize(u_color_stops,0)[0]);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Fk="uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}",Bk="uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}",Rk="in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}",Ok="in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}",Nk="#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Vk="uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}",jk="in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Gk="uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}",Uk="uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Xk="uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}",$k="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",qk="uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}",Yk="in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Zk="uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}",Wk="uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Hk="uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}",Kk="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Jk="uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}",Qk="uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;switch(u_method){case BASIC:\nbasic_hillshade(deriv);break;case COMBINED:\ncombined_hillshade(deriv);break;case IGOR:\nigor_hillshade(deriv);break;case MULTIDIRECTIONAL:\nmultidirectional_hillshade(deriv);break;case STANDARD:\ndefault:\nstandard_hillshade(deriv);break;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",eD="uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}",tD="uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",iD="\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}",rD="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",nD="\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}",aD="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",oD="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}",sD="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",lD="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}",uD="uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",hD="uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}",cD="uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",pD="in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}",dD="#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",fD="in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}",mD="#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",yD="in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}",gD="in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}",_D="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",xD="uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}",vD="in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}",bD="in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}",wD="in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}",PD="in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}",TD="in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}",SD="float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}",MD="#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}",CD="in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}",ID="in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}",AD="uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}",ED="in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}",Mi={prelude:xe(gk,_k),projectionMercator:xe("",SD),projectionGlobe:xe("",MD),background:xe(xk,vk),backgroundPattern:xe(bk,wk),circle:xe(Pk,Tk),clippingMask:xe(Mm,Sk),heatmap:xe(Mk,Ck),heatmapTexture:xe(Ik,Ak),collisionBox:xe(Ek,kk),collisionCircle:xe(Dk,Lk),colorRelief:xe(zk,Fk),debug:xe(Bk,Rk),depth:xe(Mm,Ok),fill:xe(Nk,Vk),fillOutline:xe(jk,Gk),fillOutlinePattern:xe(Uk,Xk),fillPattern:xe($k,qk),fillExtrusion:xe(Yk,Zk),fillExtrusionPattern:xe(Wk,Hk),hillshadePrepare:xe(Kk,Jk),hillshade:xe(Qk,eD),line:xe(tD,iD),lineGradient:xe(rD,nD),linePattern:xe(aD,oD),lineSDF:xe(sD,lD),raster:xe(uD,hD),symbolIcon:xe(cD,pD),symbolSDF:xe(dD,fD),symbolTextAndIcon:xe(mD,yD),terrain:xe(xD,vD),terrainDepth:xe(gD,bD),terrainCoords:xe(_D,wD),projectionErrorMeasurement:xe(TD,PD),atmosphere:xe(CD,ID),sky:xe(AD,ED)};function xe(e,t){let i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=a?a.concat(n):n,s={};return e=e.replace(i,(l,u,h,c,p)=>(s[p]=!0,u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\nin ").concat(h," ").concat(c," ").concat(p,";\n#else\nuniform ").concat(h," ").concat(c," u_").concat(p,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(p,"\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"))),t=t.replace(i,(l,u,h,c,p)=>{let d=c==="float"?"vec2":"vec4",f=p.match(/color/)?"color":d;return s[p]?u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\nuniform lowp float u_").concat(p,"_t;\nin ").concat(h," ").concat(d," a_").concat(p,";\nout ").concat(h," ").concat(c," ").concat(p,";\n#else\nuniform ").concat(h," ").concat(c," u_").concat(p,";\n#endif\n"):f==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(p," = a_").concat(p,";\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(p," = unpack_mix_").concat(f,"(a_").concat(p,", u_").concat(p,"_t);\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"):u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\nuniform lowp float u_").concat(p,"_t;\nin ").concat(h," ").concat(d," a_").concat(p,";\n#else\nuniform ").concat(h," ").concat(c," u_").concat(p,";\n#endif\n"):f==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(h," ").concat(c," ").concat(p," = a_").concat(p,";\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(h," ").concat(c," ").concat(p," = unpack_mix_").concat(f,"(a_").concat(p,", u_").concat(p,"_t);\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n")}),{fragmentSource:e,vertexSource:t,staticAttributes:r,staticUniforms:o}}function kD(e){return e.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}function DD(e){return e.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}var Zn=class{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}},_r=We([{name:"a_pos",type:"Int16",components:2}]),j0="#define PROJECTION_MERCATOR",G0="mercator",lc=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return G0}get shaderDefine(){return j0}get shaderPreludeCode(){return Mi.projectionMercator}get vertexShaderPreludeCode(){return Mi.projectionMercator.vertexSource}get subdivisionGranularity(){return gp.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,t,i,r,n){if(this._cachedMesh)return this._cachedMesh;let a=new qi;a.emplaceBack(0,0),a.emplaceBack(8192,0),a.emplaceBack(0,8192),a.emplaceBack(8192,8192);let o=e.createVertexBuffer(a,_r.members),s=Be.simpleSegment(0,0,4,2),l=new yi;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let u=e.createIndexBuffer(l);return this._cachedMesh=new Zn(o,u,s),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}},Ft=ne(le(),1),Or=ne(le(),1),LD=ne(le(),1),Cm=class U0{constructor(t=0,i=0,r=0,n=0){if(isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=i,this.left=r,this.right=n}interpolate(t,i,r){return i.top!=null&&t.top!=null&&(this.top=Ue.number(t.top,i.top,r)),i.bottom!=null&&t.bottom!=null&&(this.bottom=Ue.number(t.bottom,i.bottom,r)),i.left!=null&&t.left!=null&&(this.left=Ue.number(t.left,i.left,r)),i.right!=null&&t.right!=null&&(this.right=Ue.number(t.right,i.right,r)),this}getCenter(t,i){let r=Te((this.left+t-this.right)/2,0,t),n=Te((this.top+i-this.bottom)/2,0,i);return new LD.default(r,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new U0(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function Js(e,t){if(!e.renderWorldCopies||e.lngRange)return;let i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function Im(e){return Math.max(0,Math.floor(e))}var Sp=class{constructor(e,t,i,r,n,a){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=a===void 0?!0:!!a,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=r!=null?r:0,this._maxPitch=n!=null?n:60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new re(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Im(this._zoom),this._scale=wt(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Cm,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,i){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=Im(this._zoom),this._scale=wt(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new Cm(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!i&&e.autoCalculateNearFarZ,t&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Or.default(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=jr(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=Ga.create(),Ga.rotate(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=Te(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Mn(this._fovInRadians)}setFov(e){e=Te(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Fe(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.getConstrained(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=wt(t),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this._constrain(),this._calcMatrices()}getMaxBounds(){return!this._latRange||this._latRange.length!==2||!this._lngRange||this._lngRange.length!==2?null:new Di([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-Ei,Ei])}getConstrained(e,t){return this._callbacks.getConstrained(e,t)}getCameraQueryGeometry(e,t){if(t.length===1)return[t[0],e];{let{minX:i,minY:r,maxX:n,maxY:a}=Ai.fromPoints(t).extend(e);return[new Or.default(i,r),new Or.default(n,r),new Or.default(n,a),new Or.default(i,a),new Or.default(i,r)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:i}=this.getConstrained(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=O.identity(new Float64Array(16));O.scale(e,e,[this._width/2,-this._height/2,1]),O.translate(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=O.identity(new Float64Array(16)),O.scale(e,e,[1,-1,1]),O.translate(e,e,[-1,-1,0]),O.scale(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,i,r){let n=i!==void 0?i:this.bearing,a=r=r!==void 0?r:this.pitch,o=De.fromLngLat(e,t),s=-Math.cos(Fe(a)),l=Math.sin(Fe(a)),u=l*Math.sin(Fe(n)),h=-l*Math.cos(Fe(n)),c=this.elevation,p=t-c,d;s*p>=0||Math.abs(s)<.1?(d=1e4,c=t+d*s):d=-p/s;let f=Jh(1,o.y),y,g,_=0,b=10;do{if(_+=1,_>b)break;g=d/f;let P=u*g,T=h*g;y=new De(o.x+P,o.y+T),f=1/y.meterInMercatorCoordinateUnits()}while(Math.abs(d-g*f)>1e-12);let v=y.toLngLat(),w=Pt(this.height/2/Math.tan(this.fovInRadians/2)/g/this.tileSize);return{center:v,elevation:c,zoom:w}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=Xr(1,this.center.lat)*this.worldSize,i=this.cameraToCenterDistance/t,r=De.fromLngLat(this.center,this.elevation),n=ic(this.center,this.elevation,this.pitch,this.bearing,i);this._elevation=e;let a=this.calculateCenterFromCameraLngLatAlt(n.toLngLat(),Jh(n.z,r.y),this.bearing,this.pitch);this._elevation=a.elevation,this._center=a.center,this.setZoom(a.zoom)}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Or.default(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let e=Xr(1,this.center.lat)*this.worldSize,t=this.cameraToCenterDistance/e;return ic(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/t,e.canonical.y/t,1/t/8192,1/t/8192]}},X0=class $0{constructor(t,i){this.min=t,this.max=i,this.center=V.scale([],V.add([],this.min,this.max),.5)}quadrant(t){let i=[t%2===0,t<2],r=V.clone(this.min),n=V.clone(this.max);for(let a=0;a<i.length;a++)r[a]=i[a]?this.min[a]:this.center[a],n[a]=i[a]?this.center[a]:this.max[a];return n[2]=this.max[2],new $0(r,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let i=!0;for(let r=0;r<t.planes.length;r++){let n=this.intersectsPlane(t.planes[r]);if(n===0)return 0;n===1&&(i=!1)}return i?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let i=t[3],r=t[3];for(let n=0;n<3;n++)t[n]>0?(i+=t[n]*this.min[n],r+=t[n]*this.max[n]):(r+=t[n]*this.min[n],i+=t[n]*this.max[n]);return i>=0?2:r<0?0:1}},zD=class{distanceToTile2d(e,t,i,r){let n=r.distanceX([e,t]),a=r.distanceY([e,t]);return Math.hypot(n,a)}getWrap(e,t,i){return i}getTileBoundingVolume(e,t,i,r){var s,l;let n=0,a=0;if(r!=null&&r.terrain){let u=new gt(e.z,t,e.z,e.x,e.y),h=r.terrain.getMinMaxElevation(u);n=(s=h.minElevation)!=null?s:Math.min(0,i),a=(l=h.maxElevation)!=null?l:Math.max(0,i)}let o=1<<e.z;return new X0([t+e.x/o,e.y/o,n],[t+(e.x+1)/o,(e.y+1)/o,a])}allowVariableZoom(e,t){let i=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,r=Te(78.5-i/2,0,60);return!!t.terrain||e.pitch>r}allowWorldCopies(){return!0}prepareNextFrame(){}},q0=class Y0{constructor(t,i,r){this.points=t,this.planes=i,this.aabb=r}static fromInvProjectionMatrix(t,i=1,r=0,n,a){let o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]],s=a?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=Math.pow(2,r),u=o.map(d=>FD(d,t,i,l));n&&BD(u,s[0],n,a);let h=s.map(d=>{let f=V.sub([],u[d[0]],u[d[1]]),y=V.sub([],u[d[2]],u[d[1]]),g=V.normalize([],V.cross([],f,y)),_=-V.dot(g,u[d[1]]);return g.concat(_)}),c=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],p=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let d of u)for(let f=0;f<3;f++)c[f]=Math.min(c[f],d[f]),p[f]=Math.max(p[f],d[f]);return new Y0(u,h,new X0(c,p))}};function FD(e,t,i,r){let n=Ke.transformMat4([],e,t),a=1/n[3]/i*r;return Ke.mul(n,n,[a,a,1/n[3],a])}function BD(e,t,i,r){let n=r?4:0,a=r?0:4,o=0,s=[],l=[];for(let c=0;c<4;c++){let p=V.sub([],e[c+a],e[c+n]),d=V.length(p);V.scale(p,p,1/d),s.push(d),l.push(p)}for(let c=0;c<4;c++){let p=uT(e[c+n],l[c],i);p!==null&&p>=0?o=Math.max(o,p):o=Math.max(o,s[c])}let u=RD(e,t),h=OD(i,u);if(h!==null){let c=h/V.dot(l[0],u);o=Math.min(o,c)}for(let c=0;c<4;c++){let p=Math.min(o,s[c]),d=[e[c+n][0]+l[c][0]*p,e[c+n][1]+l[c][1]*p,e[c+n][2]+l[c][2]*p,1];e[c+a]=d}}function RD(e,t){let i=V.sub([],e[t[0]],e[t[1]]),r=V.sub([],e[t[2]],e[t[1]]),n=[0,0,0,0];return V.normalize(n,V.cross([],i,r)),n[3]=-V.dot(n,e[t[0]]),n}function OD(e,t){let i=V.len(e),r=Ke.scale([],e,1/i),n=V.sub([],t,V.scale([],r,V.dot(t,r))),a=V.len(n);if(a>0){let o=Math.sqrt(1-r[3]*r[3]),s=V.scale([],r,-r[3]),l=V.add([],s,V.scale([],n,o/a));return gh(t,l)}else return null}var Qs=class Z0{constructor(t,i,r,n,a){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new Sp({calcMatrices:()=>{this._calcMatrices()},getConstrained:(o,s)=>this.getConstrained(o,s)},t,i,r,n,a),this._coveringTilesDetailsProvider=new zD}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,i){}clone(){let t=new Z0;return t.apply(this),t}apply(t,i,r){this._helper.apply(t,i,r)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let i=[new Hs(0,t)];if(this._helper._renderWorldCopies){let r=this.screenPointToMercatorCoordinate(new Ft.default(0,0)),n=this.screenPointToMercatorCoordinate(new Ft.default(this._helper._width,0)),a=this.screenPointToMercatorCoordinate(new Ft.default(this._helper._width,this._helper._height)),o=this.screenPointToMercatorCoordinate(new Ft.default(0,this._helper._height)),s=Math.floor(Math.min(r.x,n.x,a.x,o.x)),l=Math.floor(Math.max(r.x,n.x,a.x,o.x)),u=1;for(let h=s-u;h<=l+u;h++)h!==0&&i.push(new Hs(h,t))}return i}getCameraFrustum(){return q0.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let i=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t,i){let r=Xr(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(i,r),a=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),o=De.fromLngLat(t),s=new De(o.x-(n.x-a.x),o.y-(n.y-a.y));this.setCenter(s==null?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,i){return i?this.coordinatePoint(De.fromLngLat(t),i.getElevationForLngLatZoom(t,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(De.fromLngLat(t))}screenPointToLocation(t,i){var r;return(r=this.screenPointToMercatorCoordinate(t,i))==null?void 0:r.toLngLat()}screenPointToMercatorCoordinate(t,i){if(i){let r=i.pointCoordinate(t);if(r!=null)return r}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,i){let r=i||0,n=[t.x,t.y,0,1],a=[t.x,t.y,1,1];Ke.transformMat4(n,n,this._pixelMatrixInverse),Ke.transformMat4(a,a,this._pixelMatrixInverse);let o=n[3],s=a[3],l=n[0]/o,u=a[0]/s,h=n[1]/o,c=a[1]/s,p=n[2]/o,d=a[2]/s,f=p===d?0:(r-p)/(d-p);return new De(Ue.number(l,u,f)/this.worldSize,Ue.number(h,c,f)/this.worldSize,r)}coordinatePoint(t,i=0,r=this._pixelMatrix){let n=[t.x*this.worldSize,t.y*this.worldSize,i,1];return Ke.transformMat4(n,n,r),new Ft.default(n[0]/n[3],n[1]/n[3])}getBounds(){let t=Math.max(0,this._helper._height/2-Rs(this));return new Di().extend(this.screenPointToLocation(new Ft.default(0,t))).extend(this.screenPointToLocation(new Ft.default(this._helper._width,t))).extend(this.screenPointToLocation(new Ft.default(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new Ft.default(0,this._helper._height)))}isPointOnMapSurface(t,i){return i?i.pointCoordinate(t)!=null:t.y>this.height/2-Rs(this)}calculatePosMatrix(t,i=!1,r){var l;let n=(l=t.key)!=null?l:Dn(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),a=i?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(n)){let u=a.get(n);return r?u.f32:u.f64}let o=Hu(t,this.worldSize);O.multiply(o,i?this._alignedProjMatrix:this._viewProjMatrix,o);let s={f64:o,f32:new Float32Array(o)};return a.set(n,s),r?s.f32:s.f64}calculateFogMatrix(t){let i=t.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);let n=Hu(t,this.worldSize);return O.multiply(n,this._fogMatrix,n),r.set(i,new Float32Array(n)),r.get(i)}getConstrained(t,i){i=Te(+i,this.minZoom,this.maxZoom);let r={center:new re(t.lng,t.lat),zoom:i},n=this._helper._lngRange;if(!this._helper._renderWorldCopies&&n===null){let v=179.9999999999;n=[-v,v]}let a=this.tileSize*wt(r.zoom),o=0,s=a,l=0,u=a,h=0,c=0,{x:p,y:d}=this.size;if(this._helper._latRange){let v=this._helper._latRange;o=Wr(v[1])*a,s=Wr(v[0])*a,s-o<d&&(h=d/(s-o))}n&&(l=jr($n(n[0])*a,0,a),u=jr($n(n[1])*a,0,a),u<l&&(u+=a),u-l<p&&(c=p/(u-l)));let{x:f,y}=Si(a,t),g,_,b=Math.max(c||0,h||0);if(b){let v=new Ft.default(c?(u+l)/2:f,h?(s+o)/2:y);return r.center=ao(a,v).wrap(),r.zoom+=Pt(b),r}if(this._helper._latRange){let v=d/2;y-v<o&&(_=o+v),y+v>s&&(_=s-v)}if(n){let v=(l+u)/2,w=f;this._helper._renderWorldCopies&&(w=jr(f,v-a/2,v+a/2));let P=p/2;w-P<l&&(g=l+P),w+P>u&&(g=u-P)}if(g!==void 0||_!==void 0){let v=new Ft.default(g!=null?g:f,_!=null?_:y);r.center=ao(a,v).wrap()}return r}calculateCenterFromCameraLngLatAlt(t,i,r,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,n)}_calculateNearFarZIfNeeded(t,i,r){if(!this._helper.autoCalculateNearFarZ)return;let n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=t-n*this._helper._pixelPerMeter/Math.cos(i),o=n<0?a:t,s=Math.PI/2+this.pitchInRadians,l=Fe(this.fov)*(Math.abs(Math.cos(Fe(this.roll)))*this.height+Math.abs(Math.sin(Fe(this.roll)))*this.width)/this.height*(.5+r.y/this.height),u=Math.sin(l)*o/Math.sin(Te(Math.PI-s-l,.01,Math.PI-.01)),h=Rs(this),c=Math.atan(h/this._helper.cameraToCenterDistance),p=Fe(90-Ln),d=c>p?2*c*(.5+r.y/(h*2)):p,f=Math.sin(d)*o/Math.sin(Te(Math.PI-s-d,.01,Math.PI-.01)),y=Math.min(u,f);this._helper._farZ=(Math.cos(Math.PI/2-i)*y+o)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let t=this.centerOffset,i=Si(this.worldSize,this.center),r=i.x,n=i.y;this._helper._pixelPerMeter=Xr(1,this.center.lat)*this.worldSize;let a=Fe(Math.min(this.pitch,Ln)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(a));this._calculateNearFarZIfNeeded(o,a,t);let s;s=new Float64Array(16),O.perspective(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),O.invert(this._invProjMatrix,s),s[8]=-t.x*2/this._helper._width,s[9]=t.y*2/this._helper._height,this._projectionMatrix=O.clone(s),O.scale(s,s,[1,-1,1]),O.translate(s,s,[0,0,-this._helper.cameraToCenterDistance]),O.rotateZ(s,s,-this.rollInRadians),O.rotateX(s,s,this.pitchInRadians),O.rotateZ(s,s,-this.bearingInRadians),O.translate(s,s,[-r,-n,0]),this._mercatorMatrix=O.scale([],s,[this.worldSize,this.worldSize,this.worldSize]),O.scale(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=O.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),O.translate(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=O.invert([],s);let l=[0,0,-1,1];Ke.transformMat4(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),O.perspective(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=-t.x*2/this.width,this._fogMatrix[9]=t.y*2/this.height,O.scale(this._fogMatrix,this._fogMatrix,[1,-1,1]),O.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),O.rotateZ(this._fogMatrix,this._fogMatrix,-this.rollInRadians),O.rotateX(this._fogMatrix,this._fogMatrix,this.pitchInRadians),O.rotateZ(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),O.translate(this._fogMatrix,this._fogMatrix,[-r,-n,0]),O.scale(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),O.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=O.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);let u=this._helper._width%2/2,h=this._helper._height%2/2,c=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),d=r-Math.round(r)+c*u+p*h,f=n-Math.round(n)+c*h+p*u,y=new Float64Array(s);if(O.translate(y,y,[d>.5?d-1:d,f>.5?f-1:f,0]),this._alignedProjMatrix=y,s=O.invert(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new Ft.default(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return Ke.transformMat4(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=Xr(1,this.center.lat)*this.worldSize,i=this._helper.cameraToCenterDistance/t;return ic(this.center,this.elevation,this.pitch,this.bearing,i).toLngLat()}lngLatToCameraDepth(t,i){let r=De.fromLngLat(t),n=[r.x*this.worldSize,r.y*this.worldSize,i,1];return Ke.transformMat4(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){let{overscaledTileID:i,aligned:r,applyTerrainMatrix:n}=t,a=this._helper.getMercatorTileCoordinates(i),o=i?this.calculatePosMatrix(i,r,!0):null,s;return i&&i.terrainRttPosMatrix32f&&n?s=i.terrainRttPosMatrix32f:o?s=o:s=ng(),{mainMatrix:s,tileMercatorCoords:a,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,i,r){return 1}transformLightDirection(t){return V.clone(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,i,r,n){let a=this.calculatePosMatrix(r),o;n?(o=[t,i,n(t,i),1],Ke.transformMat4(o,o,a)):(o=[t,i,0,1],Tp(o,o,a));let s=o[3];return{point:new Ft.default(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(t){for(let i of t)this.calculatePosMatrix(i)}getMatrixForModel(t,i){let r=De.fromLngLat(t,i),n=r.meterInMercatorCoordinateUnits(),a=_n();return O.translate(a,a,[r.x,r.y,r.z]),O.rotateZ(a,a,Math.PI),O.rotateX(a,a,Math.PI/2),O.scale(a,a,[-n,n,n]),a}getProjectionDataForCustomLayer(t=!0){let i=new gt(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:t}),n=Hu(i,this.worldSize);O.multiply(n,this._viewProjMatrix,n),r.tileMercatorCoords=[0,0,1,1];let a=[8192,8192,this.worldSize/this._helper.pixelsPerMeter],o=yr();return O.scale(o,n,a),r.fallbackMatrix=o,r.mainMatrix=o,r}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}},ms=ne(le(),1);function W0(){nt("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function H0(e){if(e.useSlerp)if(e.k<1){let t=Wd(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),i=Wd(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),r=new Float64Array(4);nl.slerp(r,t,i,e.k);let n=PT(r);e.tr.setRoll(n.roll),e.tr.setPitch(n.pitch),e.tr.setBearing(n.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(Ue.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(Ue.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(Ue.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function K0(e,t,i,r,n){let a=n.padding,o=Si(n.worldSize,i.getNorthWest()),s=Si(n.worldSize,i.getNorthEast()),l=Si(n.worldSize,i.getSouthEast()),u=Si(n.worldSize,i.getSouthWest()),h=Fe(-r),c=o.rotate(h),p=s.rotate(h),d=l.rotate(h),f=u.rotate(h),y=new ms.default(Math.max(c.x,p.x,f.x,d.x),Math.max(c.y,p.y,f.y,d.y)),g=new ms.default(Math.min(c.x,p.x,f.x,d.x),Math.min(c.y,p.y,f.y,d.y)),_=y.sub(g),b=n.width-(a.left+a.right+t.left+t.right),v=n.height-(a.top+a.bottom+t.top+t.bottom),w=b/_.x,P=v/_.y;if(P<0||w<0){W0();return}let T=Math.min(Pt(n.scale*Math.min(w,P)),e.maxZoom),C=ms.default.convert(e.offset),A=(t.left-t.right)/2,k=(t.top-t.bottom)/2,z=new ms.default(A,k).rotate(Fe(r)),L=C.add(z).mult(n.scale/wt(T));return{center:ao(n.worldSize,o.add(l).div(2).sub(L)),zoom:T,bearing:r}}var el=class{get useGlobeControls(){return!1}handlePanInertia(e,t){return{easingOffset:e,easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around)}cameraForBoxAndBearing(e,t,i,r,n){return K0(e,t,i,r,n)}handleJumpToCenterZoom(e,t){let i=typeof t.zoom<"u"?+t.zoom:e.zoom;e.zoom!==i&&e.setZoom(+t.zoom),t.center!==void 0&&e.setCenter(re.convert(t.center))}handleEaseTo(e,t){let i=e.zoom,r=e.padding,n={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a=t.roll===void 0?e.roll:t.roll,o=t.pitch===void 0?e.pitch:t.pitch,s=t.bearing===void 0?e.bearing:t.bearing,l={roll:a,pitch:o,bearing:s},u=typeof t.zoom<"u",h=!e.isPaddingEqual(t.padding),c=!1,p=u?+t.zoom:e.zoom,d=e.centerPoint.add(t.offsetAsPoint),f=e.screenPointToLocation(d),{center:y,zoom:g}=e.getConstrained(re.convert(t.center||f),p!=null?p:i);Js(e,y);let _=Si(e.worldSize,f),b=Si(e.worldSize,y).sub(_),v=wt(g-i);return c=g!==i,{easeFunc:w=>{if(c&&e.setZoom(Ue.number(i,g,w)),lg(n,l)||H0({startEulerAngles:n,endEulerAngles:l,tr:e,k:w,useSlerp:n.roll!=l.roll}),h&&(e.interpolatePadding(r,t.padding,w),d=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let P=wt(e.zoom-i),T=g>i?Math.min(2,v):Math.max(.5,v),C=Math.pow(T,1-w),A=ao(e.worldSize,_.add(b.mult(w*C)).mult(P));e.setLocationAtPoint(e.renderWorldCopies?A.wrap():A,d)}},isZooming:c,elevationCenter:y}}handleFlyTo(e,t){let i=typeof t.zoom<"u",r=e.zoom,n=e.getConstrained(re.convert(t.center||t.locationAtOffset),i?+t.zoom:r),a=n.center,o=n.zoom;Js(e,a);let s=Si(e.worldSize,t.locationAtOffset),l=Si(e.worldSize,a).sub(s),u=l.mag(),h=wt(o-r),c=typeof t.minZoom<"u",p;if(c){let d=Math.min(+t.minZoom,r,o),f=e.getConstrained(a,d).zoom;p=wt(f-r)}return{easeFunc:(d,f,y,g)=>{e.setZoom(d===1?o:r+Pt(f));let _=d===1?a:ao(e.worldSize,s.add(l.mult(y)).mult(f));e.setLocationAtPoint(e.renderWorldCopies?_.wrap():_,g)},scaleOfZoom:h,targetCenter:a,scaleOfMinZoom:p,pixelPathLength:u}}},ND=0,J0=1,VD=771,Ve=class{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}};Ve.Replace=[J0,ND];Ve.disabled=new Ve(Ve.Replace,J.transparent,[!1,!1,!1,!1]);Ve.unblended=new Ve(Ve.Replace,J.transparent,[!0,!0,!0,!0]);Ve.alphaBlended=new Ve([J0,VD],J.transparent,[!0,!0,!0,!0]);var be=class{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}};be.disabled=new be(!1,1029,2305);be.backCCW=new be(!0,1029,2305);be.frontCCW=new be(!0,1028,2305);var he=class{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}};he.ReadOnly=!1;he.ReadWrite=!0;he.disabled=new he(519,he.ReadOnly,[0,1]);var Pe=class{constructor(e,t,i,r,n,a){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=a}};Pe.disabled=new Pe({func:519,mask:0},0,0,7680,7680,7680);var jD=(e,t)=>({u_input:new X(e,t.u_input),u_output_expected:new X(e,t.u_output_expected)}),GD=(e,t)=>({u_input:e,u_output_expected:t}),Qu=new WeakMap;function Wi(e){var t;if(Qu.has(e))return Qu.get(e);{let i=(t=e.getParameter(e.VERSION))==null?void 0:t.startsWith("WebGL 2.0");return Qu.set(e,i),i}}var UD=class Q0{constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;let i=t.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;let n=new qi;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);let a=new yi;a.emplaceBack(0,1,2),this._fullscreenTriangle=new Zn(i.createVertexBuffer(n,_r.members),i.createIndexBuffer(a),Be.simpleSegment(0,0,n.length,a.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);let o=r.createTexture();r.bindTexture(r.TEXTURE_2D,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(o),Wi(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}get awaitingQuery(){return!!this._readbackQueue}destroy(){let t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,i){let r=this._updateCount;return this._readbackQueue?r>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():r>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,i),this._updateCount++,this._measuredError}_bindFramebuffer(){let t=this._cachedRenderContext.context,i=t.gl;t.activeTexture.set(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,i){let r=this._cachedRenderContext.context,n=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:J.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,n.TRIANGLES,he.disabled,Pe.disabled,Ve.unblended,be.disabled,GD(t,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Wi(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);let a=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:a}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Wi(t)){let i=t.clientWaitSync(this._readbackQueue.sync,0,0);if(i===t.WAIT_FAILED){nt("WebGL2 clientWaitSync failed."),this._readbackQueue=null,this._lastReadbackFrame=this._updateCount;return}if(i===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Q0._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let i=0;return i+=t[0]/256,i+=t[1]/65536,i+=t[2]/16777216,t[3]<127&&(i=-i),i/128}},ys=8192/128;function XD(e,t){let i=$D(t,"16bit"),r=qi.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),n=yi.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new Zn(e.createVertexBuffer(r,_r.members),e.createIndexBuffer(n),Be.simpleSegment(0,0,r.length,n.length))}function $D(e,t){let i=e.granularity!==void 0?Math.max(e.granularity,1):1,r=i+(e.generateBorders?2:0),n=i+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),a=r+1,o=n+1,s=e.generateBorders?-1:0,l=e.generateBorders||e.extendToNorthPole?-1:0,u=i+(e.generateBorders?1:0),h=i+(e.generateBorders||e.extendToSouthPole?1:0),c=a*o,p=r*n*6,d=a*o>65536;if(d&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let f=d||t==="32bit",y=new Int16Array(c*2),g=0;for(let v=l;v<=h;v++)for(let w=s;w<=u;w++){let P=w/i*8192;w===-1&&(P=-ys),w===i+1&&(P=8192+ys);let T=v/i*8192;v===-1&&(T=e.extendToNorthPole?mr:-ys),v===i+1&&(T=e.extendToSouthPole?Nr:8192+ys),y[g++]=P,y[g++]=T}let _=f?new Uint32Array(p):new Uint16Array(p),b=0;for(let v=0;v<n;v++)for(let w=0;w<r;w++){let P=w+v*a,T=w+1+v*a,C=w+(v+1)*a,A=w+1+(v+1)*a;_[b++]=P,_[b++]=C,_[b++]=T,_[b++]=T,_[b++]=C,_[b++]=A}return{vertices:y.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:f}}var qD="#define GLOBE",YD="globe",Am={errorTransitionTimeSeconds:.5},eh=new gp({fill:new Yi(128,2),line:new Yi(512,0),tile:new Yi(128,32),stencil:new Yi(128,1),circle:3}),ex=class{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return YD}get shaderDefine(){return qD}get shaderPreludeCode(){return Mi.projectionGlobe}get vertexShaderPreludeCode(){return Mi.projectionMercator.vertexSource}get subdivisionGranularity(){return eh}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new UD(e));let t=Wr(this._errorQueryLatitudeDegrees),i=2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5,r=this._errorMeasurement.updateErrorLoop(t,i),n=me.now();r!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=r,this._errorMeasurementLastChangeTime=n);let a=(n-this._errorMeasurementLastChangeTime)/1e3,o=Math.min(Math.max(a/Am.errorTransitionTimeSeconds,0),1),s=-this._errorMeasurementLastValue;this._errorCorrectionUsable=An(this._errorCorrectionPreviousValue,s,ag(o))}_getMeshKey(e){return"".concat(e.granularity.toString(36),"_").concat(e.generateBorders?"b":"").concat(e.extendToNorthPole?"n":"").concat(e.extendToSouthPole?"s":"")}getMeshFromTileID(e,t,i,r,n){let a=(n==="stencil"?eh.stencil:eh.tile).getGranularityForZoomLevel(t.z),o=t.y===0&&r,s=t.y===(1<<t.z)-1&&r;return this._getMesh(e,{granularity:a,generateBorders:i,extendToNorthPole:o,extendToSouthPole:s})}_getMesh(e,t){let i=this._getMeshKey(t);if(i in this._tileMeshCache)return this._tileMeshCache[i];let r=XD(e,t);return this._tileMeshCache[i]=r,r}recalculate(e){}hasTransition(){let e=me.now(),t=!1;return t=t||(e-this._errorMeasurementLastChangeTime)/1e3<Am.errorTransitionTimeSeconds+.2,t=t||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,t}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}},ZD=new ft({type:new Z(B.projection.type)}),Em=class extends Et{constructor(e){super(),this._transitionable=new Tl(ZD),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new et(0)),this._mercatorProjection=new lc,this._verticalPerspectiveProjection=new ex}get transitionState(){let e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof Jr){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,i,r,n){return this.currentProjection.getMeshFromTileID(e,t,i,r,n)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}},vi=ne(le(),1);function tx(e){let t=Rl(e.worldSize,e.center.lat);return 2*Math.PI*t}function WD(e,t,i){let r=yt(t),n=yt(i),a=V.dot(r,n),o=Math.acos(a),s=tx(e);return o/(2*Math.PI)*s}function HD(e,t){let i=Fn(e*Math.PI*2+Math.PI,Math.PI*2),r=2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5;return[i,r]}function KD(e,t){let i=Math.cos(t),r=new Float64Array(3);return r[0]=Math.sin(e)*i,r[1]=Math.sin(t),r[2]=Math.cos(e)*i,r}function dr(e,t,i,r,n){let a=1/(1<<n),o=e/8192*a+i*a,s=t/8192*a+r*a,l=Fn(o*Math.PI*2+Math.PI,Math.PI*2),u=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-Math.PI*.5,h=Math.cos(u),c=new Float64Array(3);return c[0]=Math.sin(l)*h,c[1]=Math.sin(u),c[2]=Math.cos(l)*h,c}function yt(e){return KD(e.lng*Math.PI/180,e.lat*Math.PI/180)}function Rl(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function km(e){let t=Math.asin(e[1])/Math.PI*180,i=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(i>1e-6){let r=e[0]/i,n=e[2]/i,a=Math.acos(n),o=(r>0?a:-a)/Math.PI*180;return new re(jr(o,-180,180),t)}else return new re(0,t)}function JD(e){let t=it();t[0]=e[0]*-e[3],t[1]=e[1]*-e[3],t[2]=e[2]*-e[3];let i=Math.sqrt(1-e[3]*e[3]);return{center:t,radius:i}}function QD(e,t,i){let r=it();V.sub(r,i,e);let n=it();return V.scaleAndAdd(n,e,r,t/V.len(r)),n}function tl(e){return Math.cos(e*Math.PI/180)}function dt(e,t){let i=tl(e),r=tl(t);return Pt(r/i)}function eL(e,t){return 360/tx({worldSize:e,center:{lat:t}})}function Dm(e,t){let i=e.rotate(t.bearingInRadians),r=t.zoom+dt(t.center.lat,0),n=An(1/tl(t.center.lat),1/tl(Math.min(Math.abs(t.center.lat),60)),As(r,7,3,0,1)),a=eL(t.worldSize,t.center.lat);return new re(t.center.lng-i.x*a*n,Te(t.center.lat+i.y*a,-Ei,Ei))}function th(e){let t=.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function Lm(e,t,i,r){let n=e.lat+i*r;if(Math.abs(i)>1){let a=e.lat+i,o=(Math.sign(a)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,s=Math.abs(e.lat+i)*Math.PI/180,l=th(o+r*(s-o)),u=th(o),h=th(s),c=(l-u)/(h-u),p=e.lng+t*c;return new re(p,n)}else{let a=e.lng+t*r;return new re(a,n)}}var tL=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,i,r){let n="".concat(e.z,"_").concat(e.x,"_").concat(e.y,"_").concat(r!=null&&r.terrain?"t":""),a=this._cache.get(n);if(a)return a;let o=this._cachePrevious.get(n);if(o)return this._cache.set(n,o),o;let s=this._boundingVolumeFactory(e,t,i,r);return this._cache.set(n,s),this._hadAnyChanges=!0,s}},ih=class uc{constructor(t,i,r,n){this.min=r,this.max=n,this.points=t,this.planes=i}static fromAabb(t,i){let r=[];for(let n=0;n<8;n++)r.push([(n>>0&1)===1?i[0]:t[0],(n>>1&1)===1?i[1]:t[1],(n>>2&1)===1?i[2]:t[2]]);return new uc(r,[[-1,0,0,i[0]],[1,0,0,-t[0]],[0,-1,0,i[1]],[0,1,0,-t[1]],[0,0,-1,i[2]],[0,0,1,-t[2]]],t,i)}static fromCenterSizeAngles(t,i,r){let n=nl.fromEuler([],r[0],r[1],r[2]),a=V.transformQuat([],[i[0],0,0],n),o=V.transformQuat([],[0,i[1],0],n),s=V.transformQuat([],[0,0,i[2]],n),l=[...t],u=[...t];for(let c=0;c<8;c++)for(let p=0;p<3;p++){let d=t[p]+a[p]*((c>>0&1)===1?1:-1)+o[p]*((c>>1&1)===1?1:-1)+s[p]*((c>>2&1)===1?1:-1);l[p]=Math.min(l[p],d),u[p]=Math.max(u[p],d)}let h=[];for(let c=0;c<8;c++){let p=[...t];V.add(p,p,V.scale([],a,(c>>0&1)===1?1:-1)),V.add(p,p,V.scale([],o,(c>>1&1)===1?1:-1)),V.add(p,p,V.scale([],s,(c>>2&1)===1?1:-1)),h.push(p)}return new uc(h,[[...a,-V.dot(a,h[0])],[...o,-V.dot(o,h[0])],[...s,-V.dot(s,h[0])],[-a[0],-a[1],-a[2],-V.dot(a,h[7])],[-o[0],-o[1],-o[2],-V.dot(o,h[7])],[-s[0],-s[1],-s[2],-V.dot(s,h[7])]],l,u)}intersectsFrustum(t){let i=!0,r=this.points.length,n=this.planes.length,a=t.planes.length,o=t.points.length;for(let s=0;s<a;s++){let l=t.planes[s],u=0;for(let h=0;h<r;h++){let c=this.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0;u<r&&(i=!1)}if(i)return 2;for(let s=0;s<n;s++){let l=this.planes[s],u=0;for(let h=0;h<o;h++){let c=t.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0}return 1}intersectsPlane(t){let i=this.points.length,r=0;for(let n=0;n<i;n++){let a=this.points[n];t[0]*a[0]+t[1]*a[1]+t[2]*a[2]+t[3]>=0&&r++}return r===i?2:r===0?0:1}};function Os(e,t,i){let r=e-t;return r<0?-r:Math.max(0,r-i)}function rh(e,t,i,r,n){let a=e-i,o;return a<0?o=Math.min(-a,1+a-n):a>1?o=Math.min(Math.max(a-n,0),1-a):o=0,Math.max(o,Os(t,r,n))}var iL=class{constructor(){this._boundingVolumeCache=new tL(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,i,r){let n=1<<i.z,a=1/n,o=i.x/n,s=i.y/n,l=1,u=.5*l,h=2*l;return h=Math.min(h,rh(e,t,o,s,a)),h=Math.min(h,rh(e,t,o+u,-s-a,a)),h=Math.min(h,rh(e,t,o+u,l+l-s-a,a)),h}getWrap(e,t,i){let r=1<<t.z,n=1/r,a=t.x/r,o=Os(e.x,a,n),s=Os(e.x,a-1,n),l=Os(e.x,a+1,n),u=Math.min(o,s,l);return u===l?1:u===s?-1:0}allowVariableZoom(e,t){return Fl(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,i,r){return this._boundingVolumeCache.getTileBoundingVolume(e,t,i,r)}_computeTileBoundingVolume(e,t,i,r){var o,s;let n=0,a=0;if(r!=null&&r.terrain){let l=new gt(e.z,t,e.z,e.x,e.y),u=r.terrain.getMinMaxElevation(l);n=(o=u.minElevation)!=null?o:Math.min(0,i),a=(s=u.maxElevation)!=null?s:Math.max(0,i)}if(n/=Pi,a/=Pi,n+=1,a+=1,e.z<=0)return ih.fromAabb([-a,-a,-a],[a,a,a]);if(e.z===1)return ih.fromAabb([e.x===0?-a:0,e.y===0?0:-a,-a],[e.x===0?0:a,e.y===0?a:0,a]);{let l=[dr(0,0,e.x,e.y,e.z),dr(8192,0,e.x,e.y,e.z),dr(8192,8192,e.x,e.y,e.z),dr(0,8192,e.x,e.y,e.z)],u=[];for(let z of l)u.push(V.scale([],z,a));if(a!==n)for(let z of l)u.push(V.scale([],z,n));e.y===0&&u.push([0,1,0]),e.y===(1<<e.z)-1&&u.push([0,-1,0]);let h=[1,1,1],c=[-1,-1,-1];for(let z of u)for(let L=0;L<3;L++)h[L]=Math.min(h[L],z[L]),c[L]=Math.max(c[L],z[L]);let p=dr(8192/2,8192/2,e.x,e.y,e.z),d=V.cross([],[0,1,0],p);V.normalize(d,d);let f=V.cross([],p,d);V.normalize(f,f);let y=V.cross([],l[2],l[1]);V.normalize(y,y);let g=V.cross([],l[0],l[3]);V.normalize(g,g),u.push(V.scale([],p,a)),e.y>=(1<<e.z)/2&&u.push(V.scale([],dr(8192/2,0,e.x,e.y,e.z),a)),e.y<(1<<e.z)/2&&u.push(V.scale([],dr(8192/2,8192,e.x,e.y,e.z),a));let _=zm(p,u),b=zm(f,u),v=[-p[0],-p[1],-p[2],_.max],w=[p[0],p[1],p[2],-_.min],P=[-f[0],-f[1],-f[2],b.max],T=[f[0],f[1],f[2],-b.min],C=[...y,0],A=[...g,0],k=[];return e.y===0?k.push(Kt(A,C,v),Kt(A,C,w)):k.push(Kt(P,C,v),Kt(P,C,w),Kt(P,A,v),Kt(P,A,w)),e.y===(1<<e.z)-1?k.push(Kt(A,C,v),Kt(A,C,w)):k.push(Kt(T,C,v),Kt(T,C,w),Kt(T,A,v),Kt(T,A,w)),new ih(k,[v,w,P,T,C,A],h,c)}}};function zm(e,t){let i=1/0,r=-1/0;for(let n of t){let a=V.dot(e,n);i=Math.min(i,a),r=Math.max(r,a)}return{min:i,max:r}}var ix=class rx{constructor(){this._cachedClippingPlane=da(),this._projectionMatrix=_n(),this._globeViewProjMatrix32f=ng(),this._globeViewProjMatrixNoCorrection=_n(),this._globeViewProjMatrixNoCorrectionInverted=_n(),this._globeProjMatrixInverted=_n(),this._cameraPosition=it(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new Sp({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,i)=>this.getConstrained(t,i)}),this._coveringTilesDetailsProvider=new iL}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i){this._helper.resize(t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}clone(){let t=new rx;return t.apply(this),t}apply(t,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=it();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:i,applyGlobeMatrix:r}=t,n=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:n,clippingPlane:this._cachedClippingPlane,projectionTransition:r?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){let i=this.pitchInRadians,r=this.cameraToCenterDistance/t,n=1,a=Math.sin(i)*r,o=Math.cos(i)*r+n,s=Math.sqrt(a*a+o*o),l=n/s*n,u=-a,h=o,c=Math.sqrt(u*u+h*h);u/=c,h/=c;let p=[0,u,h];V.rotateZ(p,p,[0,0,0],-this.bearingInRadians),V.rotateX(p,p,[0,0,0],-1*this.center.lat*Math.PI/180),V.rotateY(p,p,[0,0,0],this.center.lng*Math.PI/180);let d=1/V.length(p);return V.scale(p,p,d),[...p,-l*d]}isLocationOccluded(t){return!this.isSurfacePointVisible(yt(t))}transformLightDirection(t){let i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,n=Math.cos(r),a=[Math.sin(i)*n,Math.sin(r),Math.cos(i)*n],o=[a[2],0,-a[0]],s=[0,0,0];V.cross(s,o,a),V.normalize(o,o),V.normalize(s,s);let l=[o[0]*t[0]+s[0]*t[1]+a[0]*t[2],o[1]*t[0]+s[1]*t[1]+a[1]*t[2],o[2]*t[0]+s[2]*t[1]+a[2]*t[2]],u=[0,0,0];return V.normalize(u,l),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,i,r){let n=F3(t,i,r.canonical),a=HD(n.x,n.y);return this.getCircleRadiusCorrection()/Math.cos(a[1])}projectTileCoordinates(t,i,r,n){let a=r.canonical,o=dr(t,i,a.x,a.y,a.z),s=1+(n?n(t,i):0)/Pi,l=[o[0]*s,o[1]*s,o[2]*s,1];Ke.transformMat4(l,l,this._globeViewProjMatrixNoCorrection);let u=this._cachedClippingPlane,h=u[0]*o[0]+u[1]*o[1]+u[2]*o[2]+u[3]<0;return{point:new vi.default(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:h}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=Rl(this.worldSize,this.center.lat),i=yr(),r=yr();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+t*2),O.perspective(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let n=this.centerOffset;i[8]=-n.x*2/this._helper._width,i[9]=n.y*2/this._helper._height,this._projectionMatrix=O.clone(i),this._globeProjMatrixInverted=yr(),O.invert(this._globeProjMatrixInverted,i),O.translate(i,i,[0,0,-this.cameraToCenterDistance]),O.rotateZ(i,i,this.rollInRadians),O.rotateX(i,i,-this.pitchInRadians),O.rotateZ(i,i,this.bearingInRadians),O.translate(i,i,[0,0,-t]);let a=it();a[0]=t,a[1]=t,a[2]=t,O.rotateX(r,i,this.center.lat*Math.PI/180),O.rotateY(r,r,-this.center.lng*Math.PI/180),O.scale(r,r,a),this._globeViewProjMatrixNoCorrection=r,O.rotateX(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),O.rotateY(i,i,-this.center.lng*Math.PI/180),O.scale(i,i,a),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=yr(),O.invert(this._globeViewProjMatrixNoCorrectionInverted,r);let o=it();this._cameraPosition=it(),this._cameraPosition[2]=this.cameraToCenterDistance/t,V.rotateZ(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),V.rotateX(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),V.rotateZ(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),V.add(this._cameraPosition,this._cameraPosition,[0,0,1]),V.rotateX(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),V.rotateY(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let s=O.clone(this._globeViewProjMatrixNoCorrectionInverted);O.scale(s,s,[1,1,-1]),this._cachedFrustum=q0.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){nt("calculateFogMatrix is not supported on globe projection.");let i=yr();return O.identity(i),i}getVisibleUnwrappedCoordinates(t){return[new Hs(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&nt("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){if(!this._globeViewProjMatrixNoCorrection)return 1;let r=yt(t);V.scale(r,r,1+i/Pi);let n=da();return Ke.transformMat4(n,[r[0],r[1],r[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(t){}getBounds(){let t=this.width*.5,i=this.height*.5,r=[new vi.default(0,0),new vi.default(t,0),new vi.default(this.width,0),new vi.default(this.width,i),new vi.default(this.width,this.height),new vi.default(t,this.height),new vi.default(0,this.height),new vi.default(0,i)],n=[];for(let c of r)n.push(this.unprojectScreenPoint(c));let a=0,o=0,s=0,l=0,u=this.center;for(let c of n){let p=Bt(u.lng,c.lng),d=Bt(u.lat,c.lat);p<o&&(o=p),p>a&&(a=p),d<l&&(l=d),d>s&&(s=d)}let h=[u.lng+o,u.lat+l,u.lng+a,u.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new Di(h)}getConstrained(t,i){let r=Te(t.lat,-Ei,Ei),n=Te(+i,this.minZoom+dt(0,r),this.maxZoom);return{center:new re(t.lng,r),zoom:n}}calculateCenterFromCameraLngLatAlt(t,i,r,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,n)}setLocationAtPoint(t,i){let r=this.unprojectScreenPoint(i),n=yt(r),a=yt(t),o=it();V.zero(o);let s=it();V.rotateY(s,n,o,-this.center.lng*Math.PI/180),V.rotateX(s,s,o,this.center.lat*Math.PI/180);let l=a[0]*a[0]+a[2]*a[2],u=s[0]*s[0];if(l<u)return;let h=Math.sqrt(l-u),c=-h,p=Yo(a[0],a[2],s[0],h),d=Yo(a[0],a[2],s[0],c),f=it();V.rotateY(f,a,o,-p);let y=Yo(f[1],f[2],s[1],s[2]),g=it();V.rotateY(g,a,o,-d);let _=Yo(g[1],g[2],s[1],s[2]),b=Math.PI*.5,v=y>=-b&&y<=b,w=_>=-b&&_<=b,P,T;if(v&&w){let z=this.center.lng*Math.PI/180,L=this.center.lat*Math.PI/180,E=Zo(p,z),D=Zo(y,L),x=Zo(d,z),M=Zo(_,L);E+D<x+M?(P=p,T=y):(P=d,T=_)}else if(v)P=p,T=y;else if(w)P=d,T=_;else return;let C=P/Math.PI*180,A=T/Math.PI*180,k=this.center.lat;this.setCenter(new re(C,Te(A,-90,90))),this.setZoom(this.zoom+dt(k,this.center.lat))}locationToScreenPoint(t,i){let r=yt(t);if(i){let n=i.getElevationForLngLatZoom(t,this._helper._tileZoom);V.scale(r,r,1+n/Pi)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(t){let i=da();return Ke.transformMat4(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new vi.default((i[0]*.5+.5)*this.width,(-i[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(t,i){if(i){let r=i.pointCoordinate(t);if(r)return r}return De.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,i){var r;return(r=this.screenPointToMercatorCoordinate(t,i))==null?void 0:r.toLngLat()}isPointOnMapSurface(t,i){let r=this._cameraPosition,n=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(r,n)}getRayDirectionFromPixel(t){let i=da();i[0]=t.x/this.width*2-1,i[1]=(t.y/this.height*2-1)*-1,i[2]=1,i[3]=1,Ke.transformMat4(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];let r=it();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];let n=it();return V.normalize(n,r),n}isSurfacePointVisible(t){let i=this._cachedClippingPlane;return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let i=da();return Ke.transformMat4(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(t,i){let r=V.dot(t,i),n=1,a=it(),o=it();V.scale(o,i,r),V.sub(a,t,o);let s=n-V.dot(a,a);if(s<0)return null;let l=V.dot(t,t)-n,u=-r+(r<0?1:-1)*Math.sqrt(s),h=l/u,c=u,p=Math.min(h,c),d=Math.max(h,c);return{tMin:p,tMax:d}}unprojectScreenPoint(t){let i=this._cameraPosition,r=this.getRayDirectionFromPixel(t),n=this.rayPlanetIntersection(i,r);if(n){let p=it();V.add(p,i,[r[0]*n.tMin,r[1]*n.tMin,r[2]*n.tMin]);let d=it();return V.normalize(d,p),km(d)}let a=this._cachedClippingPlane,o=a[0]*r[0]+a[1]*r[1]+a[2]*r[2],s=-gh(a,i)/o,l=2,u=it();if(s>0)V.add(u,i,[r[0]*s,r[1]*s,r[2]*s]);else{let p=it();V.add(p,i,[r[0]*l,r[1]*l,r[2]*l]);let d=gh(this._cachedClippingPlane,p);V.sub(u,p,[this._cachedClippingPlane[0]*d,this._cachedClippingPlane[1]*d,this._cachedClippingPlane[2]*d])}let h=JD(a),c=QD(h.center,h.radius,u);return km(c)}getMatrixForModel(t,i){let r=re.convert(t),n=1/Pi,a=_n();return O.rotateY(a,a,r.lng/180*Math.PI),O.rotateX(a,a,-r.lat/180*Math.PI),O.translate(a,a,[0,0,1+i/Pi]),O.rotateX(a,a,Math.PI*.5),O.scale(a,a,[n,n,n]),a}getProjectionDataForCustomLayer(t=!0){let i=this.getProjectionData({overscaledTileID:new gt(0,0,0,0,0),applyGlobeMatrix:t});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(t){}},Fm=class nx{constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Sp({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,i)=>this.getConstrained(t,i)}),this._globeness=1,this._mercatorTransform=new Qs,this._verticalPerspectiveTransform=new ix}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,i){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=i,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}clone(){let t=new nx;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this),t}apply(t){this._helper.apply(t),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let i=this._mercatorTransform.getProjectionData(t),r=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:i.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return An(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return An(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,i,r){let n=this._mercatorTransform.getPitchedTextCorrection(t,i,r),a=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,i,r);return An(n,a,this._globeness)}projectTileCoordinates(t,i,r,n){return this.currentTransform.projectTileCoordinates(t,i,r,n)}_calcMatrices(){!this._helper._width||!this._helper._height||(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){return this.currentTransform.lngLatToCameraDepth(t,i)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}getConstrained(t,i){return this.currentTransform.getConstrained(t,i)}calculateCenterFromCameraLngLatAlt(t,i,r,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,n)}setLocationAtPoint(t,i){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(t,i),this.apply(this._mercatorTransform);return}this._verticalPerspectiveTransform.setLocationAtPoint(t,i),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(t,i){return this.currentTransform.locationToScreenPoint(t,i)}screenPointToMercatorCoordinate(t,i){return this.currentTransform.screenPointToMercatorCoordinate(t,i)}screenPointToLocation(t,i){return this.currentTransform.screenPointToLocation(t,i)}isPointOnMapSurface(t,i){return this.currentTransform.isPointOnMapSurface(t,i)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,i){return this.currentTransform.getMatrixForModel(t,i)}getProjectionDataForCustomLayer(t=!0){let i=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return i;let r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return r.fallbackMatrix=i.mainMatrix,r}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}},nh=ne(le(),1),ax=class Ui{get useGlobeControls(){return!0}handlePanInertia(t,i){let r=Dm(t,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new nh.default(0,0)}}handleMapControlsRollPitchBearingZoom(t,i){let r=t.around,n=i.screenPointToLocation(r);t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta);let a=i.zoom;t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta);let o=i.zoom-a;if(o===0)return;let s=.3,l=.5,u=45,h=85,c=.25,p=.75,d=.35,f=.9,y=.5,g=.25,_=Bt(i.center.lng,n.lng),b=_/(Math.abs(_/180)+1),v=Bt(i.center.lat,n.lat),w=i.getRayDirectionFromPixel(r),P=i.cameraPosition,T=V.dot(P,w)*-1,C=it();V.add(C,P,[w[0]*T,w[1]*T,w[2]*T]);let A=V.length(C)-1,k=Math.exp(-Math.max(A-s,0)*l),z=Rl(i.worldSize,i.center.lat)/Math.min(i.width,i.height),L=As(z,f,y,1,g),E=(1-wt(-o))*Math.min(k,L),D=i.center.lat,x=i.zoom,M=new re(i.center.lng+b*E,Te(i.center.lat+v*E,-Ei,Ei));i.setLocationAtPoint(n,r);let I=i.center,R=As(Math.abs(_),u,h,0,1),N=As(z,p,d,0,1),$=Math.pow(Math.max(R,N),c),Q=Bt(I.lng,M.lng),oe=Bt(I.lat,M.lat);i.setCenter(new re(I.lng+Q*$,I.lat+oe*$).wrap()),i.setZoom(x+dt(D,i.center.lat))}handleMapControlsPan(t,i,r){if(!t.panDelta)return;let n=i.center.lat,a=i.zoom;i.setCenter(Dm(t.panDelta,i).wrap()),i.setZoom(a+dt(n,i.center.lat))}cameraForBoxAndBearing(t,i,r,n,a){let o=K0(t,i,r,n,a),s=i.left/a.width*2-1,l=(a.width-i.right)/a.width*2-1,u=i.top/a.height*-2+1,h=(a.height-i.bottom)/a.height*-2+1,c=Bt(r.getWest(),r.getEast())<0,p=c?r.getEast():r.getWest(),d=c?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),y=Math.min(r.getNorth(),r.getSouth()),g=p+Bt(p,d)*.5,_=f+Bt(f,y)*.5,b=a.clone();b.setCenter(o.center),b.setBearing(o.bearing),b.setPitch(0),b.setRoll(0),b.setZoom(o.zoom);let v=b.modelViewProjectionMatrix,w=[yt(r.getNorthWest()),yt(r.getNorthEast()),yt(r.getSouthWest()),yt(r.getSouthEast()),yt(new re(d,_)),yt(new re(p,_)),yt(new re(g,f)),yt(new re(g,y))],P=yt(o.center),T=Number.POSITIVE_INFINITY;for(let C of w)s<0&&(T=Ui.getLesserNonNegativeNonNull(T,Ui.solveVectorScale(C,P,v,"x",s))),l>0&&(T=Ui.getLesserNonNegativeNonNull(T,Ui.solveVectorScale(C,P,v,"x",l))),u>0&&(T=Ui.getLesserNonNegativeNonNull(T,Ui.solveVectorScale(C,P,v,"y",u))),h<0&&(T=Ui.getLesserNonNegativeNonNull(T,Ui.solveVectorScale(C,P,v,"y",h)));if(!Number.isFinite(T)||T===0){W0();return}return o.zoom=b.zoom+Pt(T),o}handleJumpToCenterZoom(t,i){let r=t.center.lat,n=t.getConstrained(i.center?re.convert(i.center):t.center,t.zoom).center;t.setCenter(n.wrap());let a=typeof i.zoom<"u"?+i.zoom:t.zoom+dt(r,n.lat);t.zoom!==a&&t.setZoom(a)}handleEaseTo(t,i){let r=t.zoom,n=t.center,a=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s=i.roll===void 0?t.roll:i.roll,l=i.pitch===void 0?t.pitch:i.pitch,u=i.bearing===void 0?t.bearing:i.bearing,h={roll:s,pitch:l,bearing:u},c=typeof i.zoom<"u",p=!t.isPaddingEqual(i.padding),d=!1,f=i.center?re.convert(i.center):n,y=t.getConstrained(f,r).center;Js(t,y);let g=t.clone();g.setCenter(y),g.setZoom(c?+i.zoom:r+dt(n.lat,f.lat)),g.setBearing(i.bearing);let _=new nh.default(Te(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),Te(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));g.setLocationAtPoint(y,_);let b=(i.offset&&i.offsetAsPoint.mag())>0?g.center:y,v=c?+i.zoom:r+dt(n.lat,b.lat),w=r+dt(n.lat,0),P=v+dt(b.lat,0),T=Bt(n.lng,b.lng),C=Bt(n.lat,b.lat),A=wt(P-w);return d=v!==r,{easeFunc:k=>{if(lg(o,h)||H0({startEulerAngles:o,endEulerAngles:h,tr:t,k,useSlerp:o.roll!=h.roll}),p&&t.interpolatePadding(a,i.padding,k),i.around)nt("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(i.around,i.aroundPoint);else{let z=P>w?Math.min(2,A):Math.max(.5,A),L=Math.pow(z,1-k),E=k*L,D=Lm(n,T,C,E);t.setCenter(D.wrap())}if(d){let z=Ue.number(w,P,k)+dt(0,t.center.lat);t.setZoom(z)}},isZooming:d,elevationCenter:b}}handleFlyTo(t,i){let r=typeof i.zoom<"u",n=t.center,a=t.zoom,o=t.padding,s=!t.isPaddingEqual(i.padding),l=t.getConstrained(re.convert(i.center||i.locationAtOffset),a).center,u=r?+i.zoom:t.zoom+dt(t.center.lat,l.lat),h=t.clone();h.setCenter(l),h.setZoom(u),h.setBearing(i.bearing);let c=new nh.default(Te(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),Te(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));h.setLocationAtPoint(l,c);let p=h.center;Js(t,p);let d=WD(t,n,p),f=a+dt(n.lat,0),y=u+dt(p.lat,0),g=wt(y-f),_=typeof i.minZoom=="number",b;if(_){let P=+i.minZoom+dt(p.lat,0),T=Math.min(P,f,y)+dt(0,p.lat),C=t.getConstrained(p,T).zoom+dt(p.lat,0);b=wt(C-f)}let v=Bt(n.lng,p.lng),w=Bt(n.lat,p.lat);return{easeFunc:(P,T,C,A)=>{let k=Lm(n,v,w,C);s&&t.interpolatePadding(o,i.padding,P);let z=P===1?p:k;t.setCenter(z.wrap());let L=f+Pt(T);t.setZoom(P===1?u:L+dt(0,z.lat))},scaleOfZoom:g,targetCenter:p,scaleOfMinZoom:b,pixelPathLength:d}}static solveVectorScale(t,i,r,n,a){let o=a,s=n==="x"?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],l=[r[3],r[7],r[11],r[15]],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],h=t[0]*l[0]+t[1]*l[1]+t[2]*l[2],c=i[0]*s[0]+i[1]*s[1]+i[2]*s[2],p=i[0]*l[0]+i[1]*l[1]+i[2]*l[2],d=(c+s[3]-o*p-o*l[3])/(c-u-o*p+o*h);return c+o*h===u+o*p||l[3]*(u-c)+s[3]*(p-h)+u*p===c*h?null:d}static getLesserNonNegativeNonNull(t,i){return i!==null&&i>=0&&i<t?i:t}},Bm=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new el,this._verticalPerspectiveCameraHelper=new ax}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,i){this.currentHelper.handleMapControlsPan(e,t,i)}cameraForBoxAndBearing(e,t,i,r,n){return this.currentHelper.cameraForBoxAndBearing(e,t,i,r,n)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};function rL(e){if(Array.isArray(e)){let t=new Em({type:e});return{projection:t,transform:new Fm,cameraHelper:new Bm(t)}}switch(e){case"mercator":return{projection:new lc,transform:new Qs,cameraHelper:new el};case"globe":{let t=new Em({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:t,transform:new Fm,cameraHelper:new Bm(t)}}case"vertical-perspective":return{projection:new ex,transform:new ix,cameraHelper:new ax};default:return nt("Unknown projection name: ".concat(e,". Falling back to mercator projection.")),{projection:new lc,transform:new Qs,cameraHelper:new el}}}var gs=(e,t)=>wl(e,t&&t.filter(i=>i.identifier!=="source.canvas")),nL=cC(),Rm=class extends Et{constructor(e,t={}){super(),this._rtlPluginLoaded=()=>{for(let i in this.sourceCaches){let r=this.sourceCaches[i].getSource().type;(r==="vector"||r==="geojson")&&this.sourceCaches[i].reload()}},this.map=e,this.dispatcher=new b0(v0(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(i,r)=>this.getGlyphs(i,r)),this.dispatcher.registerMessageHandler("GI",(i,r)=>this.getImages(i,r)),this.imageManager=new FE,this.imageManager.setEventedParent(this),this.glyphManager=new OE(e._requestManager,t.localIdeographFontFamily),this.lineAtlas=new UE(256,512),this.crossTileSymbolIndex=new V0,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new zh,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",wc()),tc().on(ec,this._rtlPluginLoaded),this.on("data",i=>{if(i.dataType!=="source"||i.sourceDataType!=="metadata")return;let r=this.sourceCaches[i.sourceId];if(!r)return;let n=r.getSource();if(!(!n||!n.vectorLayerIds))for(let a in this._layers){let o=this._layers[a];o.source===n.id&&this._validateLayer(o)}})}setGlobalStateProperty(e,t){var n,a,o;this._checkLoaded();let i=t===null?(o=(a=(n=this.stylesheet.state)==null?void 0:n[e])==null?void 0:a.default)!=null?o:null:t;if(bi(i,this._globalState[e]))return this;this._globalState[e]=i;let r=this._findGlobalStateAffectedSources([e]);for(let s in this.sourceCaches)r.has(s)&&(this._reloadSource(s),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t=[];for(let r in e)!bi(this._globalState[r],e[r].default)&&(t.push(r),this._globalState[r]=e[r].default);let i=this._findGlobalStateAffectedSources(t);for(let r in this.sourceCaches)i.has(r)&&(this._reloadSource(r),this._changed=!0)}_findGlobalStateAffectedSources(e){if(e.length===0)return new Set;let t=new Set;for(let i in this._layers){let r=this._layers[i],n=r.getLayoutAffectingGlobalStateRefs();for(let a of e)n.has(a)&&t.add(r.source)}return t}loadURL(e,t={},i){this.fire(new U("dataloading",{dataType:"style"})),t.validate=typeof t.validate=="boolean"?t.validate:!0;let r=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;ll(r,this._loadStyleRequest).then(a=>{this._loadStyleRequest=null,this._load(a.data,t,i)}).catch(a=>{this._loadStyleRequest=null,a&&!n.signal.aborted&&this.fire(new te(a))})}loadJSON(e,t={},i){this.fire(new U("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,me.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,t.validate=t.validate!==!1,this._load(e,t,i)}).catch(()=>{})}loadEmpty(){this.fire(new U("dataloading",{dataType:"style"})),this._load(nL,{validate:!1})}_load(e,t,i){var n,a,o;let r=t.transformStyle?t.transformStyle(i,e):e;if(!(t.validate&&gs(this,rt(r)))){this._loaded=!0,this.stylesheet=r;for(let s in r.sources)this.addSource(s,r.sources[s],{validate:!1});r.sprite?this._loadSprite(r.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(r.glyphs),this._createLayers(),this.light=new VE(this.stylesheet.light),this._setProjectionInternal(((n=this.stylesheet.projection)==null?void 0:n.type)||"mercator"),this.sky=new GE(this.stylesheet.sky),this.map.setTerrain((a=this.stylesheet.terrain)!=null?a:null),this.setGlobalState((o=this.stylesheet.state)!=null?o:null),this.fire(new U("data",{dataType:"style"})),this.fire(new U("style.load"))}}_createLayers(){let e=Kd(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(t=>t.id),this._layers={},this._serializedLayers=null;for(let t of e){let i=qu(t);i.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=i}}_loadSprite(e,t=!1,i=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController;let r;LE(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(n=>{if(this._spriteRequest=null,n)for(let a in n){this._spritesImagesIds[a]=[];let o=this._spritesImagesIds[a]?this._spritesImagesIds[a].filter(s=>!(s in n)):[];for(let s of o)this.imageManager.removeImage(s),this._changedImages[s]=!0;for(let s in n[a]){let l=a==="default"?s:"".concat(a,":").concat(s);this._spritesImagesIds[a].push(l),l in this.imageManager.images?this.imageManager.updateImage(l,n[a][s],!1):this.imageManager.addImage(l,n[a][s]),t&&(this._changedImages[l]=!0)}}}).catch(n=>{this._spriteRequest=null,r=n,this.fire(new te(r))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),t&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new U("data",{dataType:"style"})),i&&i(r)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new U("data",{dataType:"style"}))}_validateLayer(e){let t=this.sourceCaches[e.source];if(!t)return;let i=e.sourceLayer;if(!i)return;let r=t.getSource();(r.type==="geojson"||r.vectorLayerIds&&r.vectorLayerIds.indexOf(i)===-1)&&this.fire(new te(new Error('Source layer "'.concat(i,'" does not exist on source "').concat(r.id,'" as specified by style layer "').concat(e.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,t=!1){let i=this._serializedAllLayers();if(!e||e.length===0)return Object.values(t?At(i):i);let r=[];for(let n of e)if(i[n]){let a=t?At(i[n]):i[n];r.push(a)}return r}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let i of t){let r=this._layers[i];r.type!=="custom"&&(e[i]=r.serialize())}return e}hasTransitions(){var e,t,i;if((e=this.light)!=null&&e.hasTransition()||(t=this.sky)!=null&&t.hasTransition()||(i=this.projection)!=null&&i.hasTransition())return!0;for(let r in this.sourceCaches)if(this.sourceCaches[r].hasTransition())return!0;for(let r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t=this._changed;if(t){let r=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(r.length||n.length)&&this._updateWorkerLayers(r,n);for(let a in this._updatedSources){let o=this._updatedSources[a];if(o==="reload")this._reloadSource(a);else if(o==="clear")this._clearSource(a);else throw new Error("Invalid action ".concat(o))}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let a in this._updatedPaintProps)this._layers[a].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let i={};for(let r in this.sourceCaches){let n=this.sourceCaches[r];i[r]=n.used,n.used=!1}for(let r of this._order){let n=this._layers[r];n.recalculate(e,this._availableImages),!n.isHidden(e.zoom)&&n.source&&(this.sourceCaches[n.source].used=!0)}for(let r in i){let n=this.sourceCaches[r];!!i[r]!=!!n.used&&n.fire(new U("data",{sourceDataType:"visibility",dataType:"source",sourceId:r}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new U("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){var a;this._checkLoaded();let i=this.serialize();if(e=t.transformStyle?t.transformStyle(i,e):e,((a=t.validate)!=null?a:!0)&&gs(this,rt(e)))return!1;e=At(e),e.layers=Kd(e.layers);let r=ES(i,e),n=this._getOperationsToPerform(r);if(n.unimplemented.length>0)throw new Error("Unimplemented: ".concat(n.unimplemented.join(", "),"."));if(n.operations.length===0)return!1;for(let o of n.operations)o();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let t=[],i=[];for(let r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,r.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,r.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,r.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,r.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,r.args));break;case"addSource":t.push(()=>this.addSource.apply(this,r.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,r.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,r.args));break;case"setLight":t.push(()=>this.setLight.apply(this,r.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,r.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,r.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,r.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,r.args));break;case"setSky":t.push(()=>this.setSky.apply(this,r.args));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,r.args));break;case"setTransition":t.push(()=>{});break;default:i.push(r.command);break}return{operations:t,unimplemented:i}}addImage(e,t){if(this.getImage(e))return this.fire(new te(new Error('An image named "'.concat(e,'" already exists.'))));this.imageManager.addImage(e,t),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new te(new Error('An image named "'.concat(e,'" does not exist.'))));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new U("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,i={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error('Source "'.concat(e,'" already exists.'));if(!t.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(t).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(t.type)>=0&&this._validate(rt.source,"sources.".concat(e),t,null,i))return;this.map&&this.map._collectResourceTiming&&(t.collectResourceTiming=!0);let r=this.sourceCaches[e]=new oo(e,t,this.dispatcher);r.style=this,r.setEventedParent(this,()=>({isSourceLoaded:r.loaded(),source:r.serialize(),sourceId:e})),r.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let i in this._layers)if(this._layers[i].source===e)return this.fire(new te(new Error('Source "'.concat(e,'" cannot be removed while layer "').concat(i,'" is using it.'))));let t=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],t.fire(new U("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID=".concat(e));let i=this.sourceCaches[e].getSource();if(i.type!=="geojson")throw new Error("geojsonSource.type is ".concat(i.type,", which is !== 'geojson"));i.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,t,i={}){this._checkLoaded();let r=e.id;if(this.getLayer(r)){this.fire(new te(new Error('Layer "'.concat(r,'" already exists on this map.'))));return}let n;if(e.type==="custom"){if(gs(this,EE(e)))return;n=qu(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(r,e.source),e=At(e),e=H(e,{source:r})),this._validate(rt.layer,"layers.".concat(r),e,{arrayIndex:-1},i))return;n=qu(e),this._validateLayer(n),n.setEventedParent(this,{layer:{id:r}})}let a=t?this._order.indexOf(t):this._order.length;if(t&&a===-1){this.fire(new te(new Error('Cannot add layer "'.concat(r,'" before non-existing layer "').concat(t,'".'))));return}if(this._order.splice(a,0,r),this._layerOrderChanged=!0,this._layers[r]=n,this._removedLayers[r]&&n.source&&n.type!=="custom"){let o=this._removedLayers[r];delete this._removedLayers[r],o.type!==n.type?this._updatedSources[n.source]="clear":(this._updatedSources[n.source]="reload",this.sourceCaches[n.source].pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new te(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be moved."))));return}if(e===t)return;let i=this._order.indexOf(e);this._order.splice(i,1);let r=t?this._order.indexOf(t):this._order.length;if(t&&r===-1){this.fire(new te(new Error('Cannot move layer "'.concat(e,'" before non-existing layer "').concat(t,'".'))));return}this._order.splice(r,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t){this.fire(new te(new Error('Cannot remove non-existing layer "'.concat(e,'".'))));return}t.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,i){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new te(new Error('Cannot set the zoom range of non-existing layer "'.concat(e,'".'))));return}r.minzoom===t&&r.maxzoom===i||(t!=null&&(r.minzoom=t),i!=null&&(r.maxzoom=i),this._updateLayer(r))}setFilter(e,t,i={}){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new te(new Error('Cannot filter non-existing layer "'.concat(e,'".'))));return}if(!bi(r.filter,t)){if(t==null){r.setFilter(void 0),this._updateLayer(r);return}this._validate(rt.filter,"layers.".concat(r.id,".filter"),t,null,i)||(r.setFilter(At(t)),this._updateLayer(r))}}getFilter(e){return At(this.getLayer(e).filter)}setLayoutProperty(e,t,i,r={}){this._checkLoaded();let n=this.getLayer(e);if(!n){this.fire(new te(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}bi(n.getLayoutProperty(t),i)||(n.setLayoutProperty(t,i,r),this._updateLayer(n))}getLayoutProperty(e,t){let i=this.getLayer(e);if(!i){this.fire(new te(new Error('Cannot get style of non-existing layer "'.concat(e,'".'))));return}return i.getLayoutProperty(t)}setPaintProperty(e,t,i,r={}){this._checkLoaded();let n=this.getLayer(e);if(!n){this.fire(new te(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}bi(n.getPaintProperty(t),i)||(n.setPaintProperty(t,i,r)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null)}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let i=e.source,r=e.sourceLayer,n=this.sourceCaches[i];if(n===void 0){this.fire(new te(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let a=n.getSource().type;if(a==="geojson"&&r){this.fire(new te(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(a==="vector"&&!r){this.fire(new te(new Error("The sourceLayer parameter must be provided for vector source types.")));return}e.id===void 0&&this.fire(new te(new Error("The feature id parameter must be provided."))),n.setFeatureState(r,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let i=e.source,r=this.sourceCaches[i];if(r===void 0){this.fire(new te(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let n=r.getSource().type,a=n==="vector"?e.sourceLayer:void 0;if(n==="vector"&&!a){this.fire(new te(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(t&&typeof e.id!="string"&&typeof e.id!="number"){this.fire(new te(new Error("A feature id is required to remove its specific state property.")));return}r.removeFeatureState(a,e.id,t)}getFeatureState(e){this._checkLoaded();let t=e.source,i=e.sourceLayer,r=this.sourceCaches[t];if(r===void 0){this.fire(new te(new Error("The source '".concat(t,"' does not exist in the map's style."))));return}if(r.getSource().type==="vector"&&!i){this.fire(new te(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return e.id===void 0&&this.fire(new te(new Error("The feature id parameter must be provided."))),r.getFeatureState(i,e.id)}getTransition(){return H({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=vc(this.sourceCaches,n=>n.serialize()),t=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,r=this.stylesheet;return sg({version:r.version,name:r.name,metadata:r.metadata,light:r.light,sky:r.sky,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,transition:r.transition,projection:r.projection,sources:e,layers:t,terrain:i},n=>n!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=a=>this._layers[a].type==="fill-extrusion",i={},r=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o)){i[o]=a;for(let s of e){let l=s[o];if(l)for(let u of l)r.push(u)}}}r.sort((a,o)=>o.intersectionZ-a.intersectionZ);let n=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o))for(let s=r.length-1;s>=0;s--){let l=r[s].feature;if(i[l.layer.id]<a)break;n.push(l),r.pop()}else for(let s of e){let l=s[o];if(l)for(let u of l)n.push(u.feature)}}return n}queryRenderedFeatures(e,t,i){t&&t.filter&&this._validate(rt.filter,"queryRenderedFeatures.filter",t.filter,null,t);let r={};if(t&&t.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new te(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(let l of t.layers){let u=this._layers[l];if(!u)return this.fire(new te(new Error("The layer '".concat(l,"' does not exist in the map's style and cannot be queried for features.")))),[];r[u.source]=!0}}let n=[];t.availableImages=this._availableImages;let a=this._serializedAllLayers(),o=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,s=Ht(He({},t),{layers:o});for(let l in this.sourceCaches)t.layers&&!r[l]||n.push(t3(this.sourceCaches[l],this._layers,a,e,s,i,this.map.terrain?(u,h,c)=>this.map.terrain.getElevation(u,h,c):void 0));return this.placement&&n.push(i3(this._layers,a,this.sourceCaches,e,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(n)}querySourceFeatures(e,t){t&&t.filter&&this._validate(rt.filter,"querySourceFeatures.filter",t.filter,null,t);let i=this.sourceCaches[e];return i?r3(i,t):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let i=this.light.getLight(),r=!1;for(let a in e)if(!bi(e[a],i[a])){r=!0;break}if(!r)return;let n={now:me.now(),transition:H({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(n)}getProjection(){var e;return(e=this.stylesheet)==null?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return(e=this.stylesheet)==null?void 0:e.sky}setSky(e,t={}){this._checkLoaded();let i=this.getSky(),r=!1;if(!e&&!i)return;if(e&&!i)r=!0;else if(!e&&i)r=!0;else for(let a in e)if(!bi(e[a],i[a])){r=!0;break}if(!r)return;let n={now:me.now(),transition:H({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,t),this.sky.updateTransitions(n)}_setProjectionInternal(e){let t=rL(e);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let i in this.sourceCaches)this.sourceCaches[i].reload()}_validate(e,t,i,r,n={}){return n&&n.validate===!1?!1:gs(this,e.call(rt,H({key:t,style:this.serialize(),value:i,styleSpec:B},r)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),tc().off(ec,this._rtlPluginLoaded);for(let t in this._layers)this._layers[t].setEventedParent(null);for(let t in this.sourceCaches){let i=this.sourceCaches[t];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let t in this.sourceCaches)this.sourceCaches[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,t,i,r,n=!1){let a=!1,o=!1,s={};for(let l of this._order){let u=this._layers[l];if(u.type!=="symbol")continue;if(!s[u.source]){let c=this.sourceCaches[u.source];s[u.source]=c.getRenderableIds(!0).map(p=>c.getTileByID(p)).sort((p,d)=>d.tileID.overscaledZ-p.tileID.overscaledZ||(p.tileID.isLessThan(d.tileID)?-1:1))}let h=this.crossTileSymbolIndex.addLayer(u,s[u.source],e.center.lng);a=a||h}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),n=n||this._layerOrderChanged||i===0,(n||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(me.now(),e.zoom))&&(this.pauseablePlacement=new ck(e,this.map.terrain,this._order,n,t,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(me.now()),o=!0),a&&this.pauseablePlacement.placement.setStale()),o||a)for(let l of this._order){let u=this._layers[l];u.type==="symbol"&&this.placement.updateLayerOpacities(u,s[u.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(me.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}async getImages(e,t){let i=await this.imageManager.getImages(t.icons);this._updateTilesForChangedImages();let r=this.sourceCaches[t.source];return r&&r.setDependencies(t.tileID.key,t.type,t.icons),i}async getGlyphs(e,t){let i=await this.glyphManager.getGlyphs(t.stacks),r=this.sourceCaches[t.source];return r&&r.setDependencies(t.tileID.key,t.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),!(e&&this._validate(rt.glyphs,"glyphs",e,null,t))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,t,i={},r){this._checkLoaded();let n=[{id:e,url:t}],a=[...Bs(this.stylesheet.sprite),...n];this._validate(rt.sprite,"sprite",a,null,i)||(this.stylesheet.sprite=a,this._loadSprite(n,!0,r))}removeSprite(e){this._checkLoaded();let t=Bs(this.stylesheet.sprite);if(!t.find(i=>i.id===e)){this.fire(new te(new Error('Sprite "'.concat(e,"\" doesn't exists on this map."))));return}if(this._spritesImagesIds[e])for(let i of this._spritesImagesIds[e])this.imageManager.removeImage(i),this._changedImages[i]=!0;t.splice(t.findIndex(i=>i.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new U("data",{dataType:"style"}))}getSprite(){return Bs(this.stylesheet.sprite)}setSprite(e,t={},i){this._checkLoaded(),!(e&&this._validate(rt.sprite,"sprite",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}},aL=We([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),oL=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,r,n,a,o,s,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==r.length;for(let h=0;!u&&h<r.length;h++)this.boundPaintVertexBuffers[h]!==r[h]&&(u=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,r,n,a,o,s,l):(e.bindVertexArray.set(this.vao),o&&o.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(e,t,i,r,n,a,o,s){let l=e.numAttributes,u=this.context,h=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=s,t.enableAttributes(h,e);for(let c of i)c.enableAttributes(h,e);a&&a.enableAttributes(h,e),o&&o.enableAttributes(h,e),s&&s.enableAttributes(h,e),t.bind(),t.setVertexAttribPointers(h,e,n);for(let c of i)c.bind(),c.setVertexAttribPointers(h,e,n);a&&(a.bind(),a.setVertexAttribPointers(h,e,n)),r&&r.bind(),o&&(o.bind(),o.setVertexAttribPointers(h,e,n)),s&&(s.bind(),s.setVertexAttribPointers(h,e,n)),u.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}},sL=(e,t)=>({u_depth:new ae(e,t.u_depth),u_terrain:new ae(e,t.u_terrain),u_terrain_dim:new X(e,t.u_terrain_dim),u_terrain_matrix:new Vt(e,t.u_terrain_matrix),u_terrain_unpack:new wr(e,t.u_terrain_unpack),u_terrain_exaggeration:new X(e,t.u_terrain_exaggeration)}),lL=(e,t)=>({u_texture:new ae(e,t.u_texture),u_ele_delta:new X(e,t.u_ele_delta),u_fog_matrix:new Vt(e,t.u_fog_matrix),u_fog_color:new Pr(e,t.u_fog_color),u_fog_ground_blend:new X(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new X(e,t.u_fog_ground_blend_opacity),u_horizon_color:new Pr(e,t.u_horizon_color),u_horizon_fog_blend:new X(e,t.u_horizon_fog_blend),u_is_globe_mode:new X(e,t.u_is_globe_mode)}),uL=(e,t)=>({u_ele_delta:new X(e,t.u_ele_delta)}),hL=(e,t)=>({u_texture:new ae(e,t.u_texture),u_terrain_coords_id:new X(e,t.u_terrain_coords_id),u_ele_delta:new X(e,t.u_ele_delta)}),cL=(e,t,i,r,n)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:i?i.properties.get("fog-color"):J.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:n?0:i?i.calculateFogBlendOpacity(r):0,u_horizon_color:i?i.properties.get("horizon-color"):J.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:n?1:0}),pL=e=>({u_ele_delta:e}),dL=(e,t)=>({u_terrain_coords_id:e/255,u_texture:0,u_ele_delta:t}),fL=(e,t)=>({u_projection_matrix:new Vt(e,t.u_projection_matrix),u_projection_tile_mercator_coords:new wr(e,t.u_projection_tile_mercator_coords),u_projection_clipping_plane:new wr(e,t.u_projection_clipping_plane),u_projection_transition:new X(e,t.u_projection_transition),u_projection_fallback_matrix:new Vt(e,t.u_projection_fallback_matrix)}),mL={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function _s(e){let t=[];for(let i=0;i<e.length;i++){if(e[i]===null)continue;let r=e[i].split(" ");t.push(r.pop())}return t}var yL=class{constructor(e,t,i,r,n,a,o,s,l=[]){let u=e.gl;this.program=u.createProgram();let h=_s(t.staticAttributes),c=i?i.getBinderAttributes():[],p=h.concat(c),d=Mi.prelude.staticUniforms?_s(Mi.prelude.staticUniforms):[],f=o.staticUniforms?_s(o.staticUniforms):[],y=t.staticUniforms?_s(t.staticUniforms):[],g=i?i.getBinderUniforms():[],_=d.concat(f).concat(y).concat(g),b=[];for(let k of _)b.indexOf(k)<0&&b.push(k);let v=i?i.defines():[];Wi(u)&&v.unshift("#version 300 es"),n&&v.push("#define OVERDRAW_INSPECTOR;"),a&&v.push("#define TERRAIN3D;"),s&&v.push(s),l&&v.push(...l);let w=v.concat(Mi.prelude.fragmentSource,o.fragmentSource,t.fragmentSource).join("\n"),P=v.concat(Mi.prelude.vertexSource,o.vertexSource,t.vertexSource).join("\n");Wi(u)||(w=DD(w),P=kD(P));let T=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(T,w),u.compileShader(T),!u.getShaderParameter(T,u.COMPILE_STATUS))throw new Error("Could not compile fragment shader: ".concat(u.getShaderInfoLog(T)));u.attachShader(this.program,T);let C=u.createShader(u.VERTEX_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(C,P),u.compileShader(C),!u.getShaderParameter(C,u.COMPILE_STATUS))throw new Error("Could not compile vertex shader: ".concat(u.getShaderInfoLog(C)));u.attachShader(this.program,C),this.attributes={};let A={};this.numAttributes=p.length;for(let k=0;k<this.numAttributes;k++)p[k]&&(u.bindAttribLocation(this.program,k,p[k]),this.attributes[p[k]]=k);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw new Error("Program failed to link: ".concat(u.getProgramInfoLog(this.program)));u.deleteShader(C),u.deleteShader(T);for(let k=0;k<b.length;k++){let z=b[k];if(z&&!A[z]){let L=u.getUniformLocation(this.program,z);L&&(A[z]=L)}}this.fixedUniforms=r(e,A),this.terrainUniforms=sL(e,A),this.projectionUniforms=fL(e,A),this.binderUniforms=i?i.getUniforms(e,A):[]}draw(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b){let v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(n),e.setCullFace(a),s){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture);for(let P in this.terrainUniforms)this.terrainUniforms[P].set(s[P])}if(l)for(let P in l){let T=mL[P];this.projectionUniforms[T].set(l[P])}if(o)for(let P in this.fixedUniforms)this.fixedUniforms[P].set(o[P]);y&&y.setUniforms(e,this.binderUniforms,d,{zoom:f});let w=0;switch(t){case v.LINES:w=2;break;case v.TRIANGLES:w=3;break;case v.LINE_STRIP:w=1;break}for(let P of p.get()){let T=P.vaos||(P.vaos={});(T[u]||(T[u]=new oL)).bind(e,this,h,y?y.getPaintVertexBuffers():[],c,P.vertexOffset,g,_,b),v.drawElements(t,P.primitiveLength*w,v.UNSIGNED_SHORT,P.primitiveOffset*w*2)}}};function ox(e,t,i){let r=1/Nt(i,1,t.transform.tileZoom),n=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,t.transform.tileZoom)/n,o=a*(i.tileID.canonical.x+i.tileID.wrap*n),s=a*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[o&65535,s&65535]}}function gL(e,t,i,r){let n=i.imageManager.getPattern(e.from.toString()),a=i.imageManager.getPattern(e.to.toString()),{width:o,height:s}=i.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),u=r.tileSize*Math.pow(2,i.transform.tileZoom)/l,h=u*(r.tileID.canonical.x+r.tileID.wrap*l),c=u*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[o,s],u_mix:t.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/Nt(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,c>>16],u_pixel_coord_lower:[h&65535,c&65535]}}var _L=(e,t)=>({u_lightpos:new Ot(e,t.u_lightpos),u_lightpos_globe:new Ot(e,t.u_lightpos_globe),u_lightintensity:new X(e,t.u_lightintensity),u_lightcolor:new Ot(e,t.u_lightcolor),u_vertical_gradient:new X(e,t.u_vertical_gradient),u_opacity:new X(e,t.u_opacity),u_fill_translate:new ie(e,t.u_fill_translate)}),xL=(e,t)=>({u_lightpos:new Ot(e,t.u_lightpos),u_lightpos_globe:new Ot(e,t.u_lightpos_globe),u_lightintensity:new X(e,t.u_lightintensity),u_lightcolor:new Ot(e,t.u_lightcolor),u_vertical_gradient:new X(e,t.u_vertical_gradient),u_height_factor:new X(e,t.u_height_factor),u_opacity:new X(e,t.u_opacity),u_fill_translate:new ie(e,t.u_fill_translate),u_image:new ae(e,t.u_image),u_texsize:new ie(e,t.u_texsize),u_pixel_coord_upper:new ie(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ie(e,t.u_pixel_coord_lower),u_scale:new Ot(e,t.u_scale),u_fade:new X(e,t.u_fade)}),sx=(e,t,i,r)=>{let n=e.style.light,a=n.properties.get("position"),o=[a.x,a.y,a.z],s=Ua.create();n.properties.get("anchor")==="viewport"&&Ua.fromRotation(s,e.transform.bearingInRadians),V.transformMat3(o,o,s);let l=e.transform.transformLightDirection(o),u=n.properties.get("color");return{u_lightpos:o,u_lightpos_globe:l,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+t,u_opacity:i,u_fill_translate:r}},vL=(e,t,i,r,n,a,o)=>H(sx(e,t,i,r),ox(a,e,o),{u_height_factor:-Math.pow(2,n.overscaledZ)/o.tileSize/8}),bL=(e,t)=>({u_fill_translate:new ie(e,t.u_fill_translate)}),wL=(e,t)=>({u_image:new ae(e,t.u_image),u_texsize:new ie(e,t.u_texsize),u_pixel_coord_upper:new ie(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ie(e,t.u_pixel_coord_lower),u_scale:new Ot(e,t.u_scale),u_fade:new X(e,t.u_fade),u_fill_translate:new ie(e,t.u_fill_translate)}),PL=(e,t)=>({u_world:new ie(e,t.u_world),u_fill_translate:new ie(e,t.u_fill_translate)}),TL=(e,t)=>({u_world:new ie(e,t.u_world),u_image:new ae(e,t.u_image),u_texsize:new ie(e,t.u_texsize),u_pixel_coord_upper:new ie(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ie(e,t.u_pixel_coord_lower),u_scale:new Ot(e,t.u_scale),u_fade:new X(e,t.u_fade),u_fill_translate:new ie(e,t.u_fill_translate)}),lx=(e,t,i,r)=>H(ox(t,e,i),{u_fill_translate:r}),SL=e=>({u_fill_translate:e}),ML=(e,t)=>({u_world:e,u_fill_translate:t}),CL=(e,t,i,r,n)=>H(lx(e,t,i,n),{u_world:r}),IL=(e,t)=>({u_camera_to_center_distance:new X(e,t.u_camera_to_center_distance),u_scale_with_map:new ae(e,t.u_scale_with_map),u_pitch_with_map:new ae(e,t.u_pitch_with_map),u_extrude_scale:new ie(e,t.u_extrude_scale),u_device_pixel_ratio:new X(e,t.u_device_pixel_ratio),u_globe_extrude_scale:new X(e,t.u_globe_extrude_scale),u_translate:new ie(e,t.u_translate)}),AL=(e,t,i,r,n)=>{let a=e.transform,o,s,l=0;if(i.paint.get("circle-pitch-alignment")==="map"){let u=Nt(t,1,a.zoom);o=!0,s=[u,u],l=u/(8192*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n}else o=!1,s=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+o,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:s,u_globe_extrude_scale:l,u_translate:r}},EL=(e,t)=>({u_pixel_extrude_scale:new ie(e,t.u_pixel_extrude_scale)}),kL=(e,t)=>({u_viewport_size:new ie(e,t.u_viewport_size)}),DL=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),LL=e=>({u_viewport_size:[e.width,e.height]}),zL=(e,t)=>({u_color:new Pr(e,t.u_color),u_overlay:new ae(e,t.u_overlay),u_overlay_scale:new X(e,t.u_overlay_scale)}),Om=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),FL=(e,t)=>({u_extrude_scale:new X(e,t.u_extrude_scale),u_intensity:new X(e,t.u_intensity),u_globe_extrude_scale:new X(e,t.u_globe_extrude_scale)}),BL=(e,t)=>({u_matrix:new Vt(e,t.u_matrix),u_world:new ie(e,t.u_world),u_image:new ae(e,t.u_image),u_color_ramp:new ae(e,t.u_color_ramp),u_opacity:new X(e,t.u_opacity)}),ux=(e,t,i,r)=>{let n=Nt(e,1,t)/(8192*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*r;return{u_extrude_scale:Nt(e,1,t),u_intensity:i,u_globe_extrude_scale:n}},hx=(e,t,i,r)=>{let n=O.create();O.ortho(n,0,e.width,e.height,0,0,1);let a=e.context.gl;return{u_matrix:n,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:i,u_color_ramp:r,u_opacity:t.paint.get("heatmap-opacity")}},RL=(e,t)=>({u_image:new ae(e,t.u_image),u_latrange:new ie(e,t.u_latrange),u_exaggeration:new X(e,t.u_exaggeration),u_altitudes:new If(e,t.u_altitudes),u_azimuths:new If(e,t.u_azimuths),u_accent:new Pr(e,t.u_accent),u_method:new ae(e,t.u_method),u_shadows:new Cf(e,t.u_shadows),u_highlights:new Cf(e,t.u_highlights)}),OL=(e,t)=>({u_matrix:new Vt(e,t.u_matrix),u_image:new ae(e,t.u_image),u_dimension:new ie(e,t.u_dimension),u_zoom:new X(e,t.u_zoom),u_unpack:new wr(e,t.u_unpack)}),NL=(e,t,i)=>{let r=i.paint.get("hillshade-accent-color"),n;switch(i.paint.get("hillshade-method")){case"basic":n=4;break;case"combined":n=1;break;case"igor":n=2;break;case"multidirectional":n=3;break;default:n=0;break}let a=i.getIlluminationProperties();for(let o=0;o<a.directionRadians.length;o++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(a.directionRadians[o]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:jL(e,t.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:a.altitudeRadians,u_azimuths:a.directionRadians,u_accent:r,u_method:n,u_highlights:a.highlightColor,u_shadows:a.shadowColor}},VL=(e,t)=>{let i=t.stride,r=O.create();return O.ortho(r,0,8192,-8192,0,0,1),O.translate(r,r,[0,-8192,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function jL(e,t){let i=Math.pow(2,t.canonical.z),r=t.canonical.y;return[new De(0,r/i).toLngLat().lat,new De(0,(r+1)/i).toLngLat().lat]}var GL=(e,t)=>({u_image:new ae(e,t.u_image),u_unpack:new wr(e,t.u_unpack),u_dimension:new ie(e,t.u_dimension),u_elevation_stops:new ae(e,t.u_elevation_stops),u_color_stops:new ae(e,t.u_color_stops),u_opacity:new X(e,t.u_opacity)}),UL=(e,t)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_opacity:e.paint.get("color-relief-opacity")}),XL=(e,t)=>({u_translation:new ie(e,t.u_translation),u_ratio:new X(e,t.u_ratio),u_device_pixel_ratio:new X(e,t.u_device_pixel_ratio),u_units_to_pixels:new ie(e,t.u_units_to_pixels)}),$L=(e,t)=>({u_translation:new ie(e,t.u_translation),u_ratio:new X(e,t.u_ratio),u_device_pixel_ratio:new X(e,t.u_device_pixel_ratio),u_units_to_pixels:new ie(e,t.u_units_to_pixels),u_image:new ae(e,t.u_image),u_image_height:new X(e,t.u_image_height)}),qL=(e,t)=>({u_translation:new ie(e,t.u_translation),u_texsize:new ie(e,t.u_texsize),u_ratio:new X(e,t.u_ratio),u_device_pixel_ratio:new X(e,t.u_device_pixel_ratio),u_image:new ae(e,t.u_image),u_units_to_pixels:new ie(e,t.u_units_to_pixels),u_scale:new Ot(e,t.u_scale),u_fade:new X(e,t.u_fade)}),YL=(e,t)=>({u_translation:new ie(e,t.u_translation),u_ratio:new X(e,t.u_ratio),u_device_pixel_ratio:new X(e,t.u_device_pixel_ratio),u_units_to_pixels:new ie(e,t.u_units_to_pixels),u_patternscale_a:new ie(e,t.u_patternscale_a),u_patternscale_b:new ie(e,t.u_patternscale_b),u_sdfgamma:new X(e,t.u_sdfgamma),u_image:new ae(e,t.u_image),u_tex_y_a:new X(e,t.u_tex_y_a),u_tex_y_b:new X(e,t.u_tex_y_b),u_mix:new X(e,t.u_mix)}),Mp=(e,t,i,r)=>{let n=e.transform;return{u_translation:px(e,t,i),u_ratio:r/Nt(t,1,n.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},ZL=(e,t,i,r,n)=>H(Mp(e,t,i,r),{u_image:0,u_image_height:n}),WL=(e,t,i,r,n)=>{let a=e.transform,o=cx(t,a);return{u_translation:px(e,t,i),u_texsize:t.imageAtlasTexture.size,u_ratio:r/Nt(t,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[o,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},HL=(e,t,i,r,n,a)=>{let o=e.transform,s=e.lineAtlas,l=cx(t,o),u=i.layout.get("line-cap")==="round",h=s.getDash(n.from,u),c=s.getDash(n.to,u),p=h.width*a.fromScale,d=c.width*a.toScale;return H(Mp(e,t,i,r),{u_patternscale_a:[l/p,-h.height/2],u_patternscale_b:[l/d,-c.height/2],u_sdfgamma:s.width/(Math.min(p,d)*256*e.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:c.y,u_mix:a.t})};function cx(e,t){return 1/Nt(e,1,t.tileZoom)}function px(e,t,i){return vr(e.transform,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}var KL=(e,t)=>({u_tl_parent:new ie(e,t.u_tl_parent),u_scale_parent:new X(e,t.u_scale_parent),u_buffer_scale:new X(e,t.u_buffer_scale),u_fade_t:new X(e,t.u_fade_t),u_opacity:new X(e,t.u_opacity),u_image0:new ae(e,t.u_image0),u_image1:new ae(e,t.u_image1),u_brightness_low:new X(e,t.u_brightness_low),u_brightness_high:new X(e,t.u_brightness_high),u_saturation_factor:new X(e,t.u_saturation_factor),u_contrast_factor:new X(e,t.u_contrast_factor),u_spin_weights:new Ot(e,t.u_spin_weights),u_coords_top:new wr(e,t.u_coords_top),u_coords_bottom:new wr(e,t.u_coords_bottom)}),JL=(e,t,i,r,n)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:tz(r.paint.get("raster-saturation")),u_contrast_factor:ez(r.paint.get("raster-contrast")),u_spin_weights:QL(r.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]});function QL(e){e*=Math.PI/180;let t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}function ez(e){return e>0?1/(1-e):1+e}function tz(e){return e>0?1-1/(1.001-e):-e}var iz=(e,t)=>({u_is_size_zoom_constant:new ae(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new ae(e,t.u_is_size_feature_constant),u_size_t:new X(e,t.u_size_t),u_size:new X(e,t.u_size),u_camera_to_center_distance:new X(e,t.u_camera_to_center_distance),u_pitch:new X(e,t.u_pitch),u_rotate_symbol:new ae(e,t.u_rotate_symbol),u_aspect_ratio:new X(e,t.u_aspect_ratio),u_fade_change:new X(e,t.u_fade_change),u_label_plane_matrix:new Vt(e,t.u_label_plane_matrix),u_coord_matrix:new Vt(e,t.u_coord_matrix),u_is_text:new ae(e,t.u_is_text),u_pitch_with_map:new ae(e,t.u_pitch_with_map),u_is_along_line:new ae(e,t.u_is_along_line),u_is_variable_anchor:new ae(e,t.u_is_variable_anchor),u_texsize:new ie(e,t.u_texsize),u_texture:new ae(e,t.u_texture),u_translation:new ie(e,t.u_translation),u_pitched_scale:new X(e,t.u_pitched_scale)}),rz=(e,t)=>({u_is_size_zoom_constant:new ae(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new ae(e,t.u_is_size_feature_constant),u_size_t:new X(e,t.u_size_t),u_size:new X(e,t.u_size),u_camera_to_center_distance:new X(e,t.u_camera_to_center_distance),u_pitch:new X(e,t.u_pitch),u_rotate_symbol:new ae(e,t.u_rotate_symbol),u_aspect_ratio:new X(e,t.u_aspect_ratio),u_fade_change:new X(e,t.u_fade_change),u_label_plane_matrix:new Vt(e,t.u_label_plane_matrix),u_coord_matrix:new Vt(e,t.u_coord_matrix),u_is_text:new ae(e,t.u_is_text),u_pitch_with_map:new ae(e,t.u_pitch_with_map),u_is_along_line:new ae(e,t.u_is_along_line),u_is_variable_anchor:new ae(e,t.u_is_variable_anchor),u_texsize:new ie(e,t.u_texsize),u_texture:new ae(e,t.u_texture),u_gamma_scale:new X(e,t.u_gamma_scale),u_device_pixel_ratio:new X(e,t.u_device_pixel_ratio),u_is_halo:new ae(e,t.u_is_halo),u_translation:new ie(e,t.u_translation),u_pitched_scale:new X(e,t.u_pitched_scale)}),nz=(e,t)=>({u_is_size_zoom_constant:new ae(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new ae(e,t.u_is_size_feature_constant),u_size_t:new X(e,t.u_size_t),u_size:new X(e,t.u_size),u_camera_to_center_distance:new X(e,t.u_camera_to_center_distance),u_pitch:new X(e,t.u_pitch),u_rotate_symbol:new ae(e,t.u_rotate_symbol),u_aspect_ratio:new X(e,t.u_aspect_ratio),u_fade_change:new X(e,t.u_fade_change),u_label_plane_matrix:new Vt(e,t.u_label_plane_matrix),u_coord_matrix:new Vt(e,t.u_coord_matrix),u_is_text:new ae(e,t.u_is_text),u_pitch_with_map:new ae(e,t.u_pitch_with_map),u_is_along_line:new ae(e,t.u_is_along_line),u_is_variable_anchor:new ae(e,t.u_is_variable_anchor),u_texsize:new ie(e,t.u_texsize),u_texsize_icon:new ie(e,t.u_texsize_icon),u_texture:new ae(e,t.u_texture),u_texture_icon:new ae(e,t.u_texture_icon),u_gamma_scale:new X(e,t.u_gamma_scale),u_device_pixel_ratio:new X(e,t.u_device_pixel_ratio),u_is_halo:new ae(e,t.u_is_halo),u_translation:new ie(e,t.u_translation),u_pitched_scale:new X(e,t.u_pitched_scale)}),dx=(e,t,i,r,n,a,o,s,l,u,h,c,p)=>{let d=o.transform;return{u_is_size_zoom_constant:+(e==="constant"||e==="source"),u_is_size_feature_constant:+(e==="constant"||e==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:d.cameraToCenterDistance,u_pitch:d.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:d.width/d.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+h,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:a,u_texsize:c,u_texture:0,u_translation:u,u_pitched_scale:p}},fx=(e,t,i,r,n,a,o,s,l,u,h,c,p,d)=>{let f=o.transform;return H(dx(e,t,i,r,n,a,o,s,l,u,h,c,d),{u_gamma_scale:r?Math.cos(f.pitch*Math.PI/180)*f.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+p})},az=(e,t,i,r,n,a,o,s,l,u,h,c,p)=>H(fx(e,t,i,r,n,a,o,s,l,u,!0,h,!0,p),{u_texsize_icon:c,u_texture_icon:1}),oz=(e,t)=>({u_opacity:new X(e,t.u_opacity),u_color:new Pr(e,t.u_color)}),sz=(e,t)=>({u_opacity:new X(e,t.u_opacity),u_image:new ae(e,t.u_image),u_pattern_tl_a:new ie(e,t.u_pattern_tl_a),u_pattern_br_a:new ie(e,t.u_pattern_br_a),u_pattern_tl_b:new ie(e,t.u_pattern_tl_b),u_pattern_br_b:new ie(e,t.u_pattern_br_b),u_texsize:new ie(e,t.u_texsize),u_mix:new X(e,t.u_mix),u_pattern_size_a:new ie(e,t.u_pattern_size_a),u_pattern_size_b:new ie(e,t.u_pattern_size_b),u_scale_a:new X(e,t.u_scale_a),u_scale_b:new X(e,t.u_scale_b),u_pixel_coord_upper:new ie(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ie(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new X(e,t.u_tile_units_to_pixels)}),lz=(e,t)=>({u_opacity:e,u_color:t}),uz=(e,t,i,r,n)=>H(gL(i,n,t,r),{u_opacity:e}),hz=(e,t)=>({u_sun_pos:new Ot(e,t.u_sun_pos),u_atmosphere_blend:new X(e,t.u_atmosphere_blend),u_globe_position:new Ot(e,t.u_globe_position),u_globe_radius:new X(e,t.u_globe_radius),u_inv_proj_matrix:new Vt(e,t.u_inv_proj_matrix)}),cz=(e,t,i,r,n)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:n}),pz=(e,t)=>({u_sky_color:new Pr(e,t.u_sky_color),u_horizon_color:new Pr(e,t.u_horizon_color),u_horizon:new ie(e,t.u_horizon),u_horizon_normal:new ie(e,t.u_horizon_normal),u_sky_horizon_blend:new X(e,t.u_sky_horizon_blend),u_sky_blend:new X(e,t.u_sky_blend)}),dz=(e,t,i)=>{let r=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),a=Rs(t),o=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-a*n)*i,(t.height/2+a*r)*i],u_horizon_normal:[-n,r],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:o}},Nm=(e,t)=>{},fz={fillExtrusion:_L,fillExtrusionPattern:xL,fill:bL,fillPattern:wL,fillOutline:PL,fillOutlinePattern:TL,circle:IL,collisionBox:EL,collisionCircle:kL,debug:zL,depth:Nm,clippingMask:Nm,heatmap:FL,heatmapTexture:BL,hillshade:RL,hillshadePrepare:OL,colorRelief:GL,line:XL,lineGradient:$L,linePattern:qL,lineSDF:YL,raster:KL,symbolIcon:iz,symbolSDF:rz,symbolTextAndIcon:nz,background:oz,backgroundPattern:sz,terrain:lL,terrainDepth:uL,terrainCoords:hL,projectionErrorMeasurement:jD,atmosphere:hz,sky:pz},mz=class{constructor(e,t,i){this.context=e;let r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},yz={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},gz=class{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;let n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error("Length of new data is ".concat(e.length,", which doesn't match current length of ").concat(this.length));let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i<this.attributes.length;i++){let r=this.attributes[i],n=t.attributes[r.name];n!==void 0&&e.enableVertexAttribArray(n)}}setVertexAttribPointers(e,t,i){for(let r=0;r<this.attributes.length;r++){let n=this.attributes[r],a=t.attributes[n.name];a!==void 0&&e.vertexAttribPointer(a,n.components,e[yz[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},Se=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},_z=class extends Se{getDefault(){return J.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},xz=class extends Se{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},vz=class extends Se{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},bz=class extends Se{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},wz=class extends Se{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},Pz=class extends Se{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},Tz=class extends Se{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;e.func===t.func&&e.ref===t.ref&&e.mask===t.mask&&!this.dirty||(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},Sz=class extends Se{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&!this.dirty||(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},Mz=class extends Se{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}},Cz=class extends Se{getDefault(){return[0,1]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},Iz=class extends Se{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}},Az=class extends Se{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},Ez=class extends Se{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}},kz=class extends Se{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},Dz=class extends Se{getDefault(){return J.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},Lz=class extends Se{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},zz=class extends Se{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}},Fz=class extends Se{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},Bz=class extends Se{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},Rz=class extends Se{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},Oz=class extends Se{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},Nz=class extends Se{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},Vz=class extends Se{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},jz=class extends Se{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},Gz=class extends Se{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}},Uz=class extends Se{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},Xz=class extends Se{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},$z=class extends Se{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;let t=this.gl;Wi(t)?t.bindVertexArray(e):(i=t.getExtension("OES_vertex_array_object"))==null||i.bindVertexArrayOES(e),this.current=e,this.dirty=!1}},qz=class extends Se{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},Yz=class extends Se{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},Zz=class extends Se{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},Cp=class extends Se{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},Wz=class extends Cp{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},Hz=class extends Cp{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},Kz=class extends Cp{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},mx="Framebuffer is not complete";function Jz(e){return e.message===mx}function Qz(){return new Error(mx)}var eF=class{constructor(e,t,i,r,n){this.context=e,this.width=t,this.height=i;let a=e.gl,o=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new Wz(e,o),r)this.depthAttachment=n?new Kz(e,o):new Hz(e,o);else if(n)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw Qz()}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}e.deleteFramebuffer(this.framebuffer)}},tF=class{constructor(e){var t,i;if(this.gl=e,this.clearColor=new _z(this),this.clearDepth=new xz(this),this.clearStencil=new vz(this),this.colorMask=new bz(this),this.depthMask=new wz(this),this.stencilMask=new Pz(this),this.stencilFunc=new Tz(this),this.stencilOp=new Sz(this),this.stencilTest=new Mz(this),this.depthRange=new Cz(this),this.depthTest=new Iz(this),this.depthFunc=new Az(this),this.blend=new Ez(this),this.blendFunc=new kz(this),this.blendColor=new Dz(this),this.blendEquation=new Lz(this),this.cullFace=new zz(this),this.cullFaceSide=new Fz(this),this.frontFace=new Bz(this),this.program=new Rz(this),this.activeTexture=new Oz(this),this.viewport=new Nz(this),this.bindFramebuffer=new Vz(this),this.bindRenderbuffer=new jz(this),this.bindTexture=new Gz(this),this.bindVertexBuffer=new Uz(this),this.bindElementBuffer=new Xz(this),this.bindVertexArray=new $z(this),this.pixelStoreUnpack=new qz(this),this.pixelStoreUnpackPremultiplyAlpha=new Yz(this),this.pixelStoreUnpackFlipY=new Zz(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),Wi(e)){this.HALF_FLOAT=e.HALF_FLOAT;let r=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(t=e.RGBA16F)!=null?t:r==null?void 0:r.RGBA16F_EXT,this.RGB16F=(i=e.RGB16F)!=null?i:r==null?void 0:r.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let r=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=r==null?void 0:r.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new mz(this,e,t)}createVertexBuffer(e,t,i){return new gz(this,e,t,i)}createRenderbuffer(e,t,i){let r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,i,r){return new eF(this,e,t,i,r)}clear({color:e,depth:t,stencil:i}){let r=this.gl,n=0;e&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),typeof t<"u"&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),typeof i<"u"&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(n)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){bi(e.blendFunction,Ve.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return Wi(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return Wi(this.gl)?this.gl.deleteVertexArray(e):(t=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}},Ip=ne(le(),1),xs;function Vm(e,t,i,r,n){let a=e.context,o=e.transform,s=a.gl,l=e.useProgram("collisionBox"),u=[],h=0,c=0;for(let _=0;_<r.length;_++){let b=r[_],v=t.getTile(b).getBucket(i);if(!v)continue;let w=n?v.textCollisionBox:v.iconCollisionBox,P=v.collisionCircleArray;P.length>0&&(u.push({circleArray:P,circleOffset:c,coord:b}),h+=P.length/4,c=h),w&&l.draw(a,s.LINES,he.disabled,Pe.disabled,e.colorModeForRenderPass(),be.disabled,DL(e.transform),e.style.map.terrain&&e.style.map.terrain.getTerrainData(b),o.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,null,e.transform.zoom,null,null,w.collisionVertexBuffer)}if(!n||!u.length)return;let p=e.useProgram("collisionCircle"),d=new nI;d.resize(h*4),d._trim();let f=0;for(let _ of u)for(let b=0;b<_.circleArray.length/4;b++){let v=b*4,w=_.circleArray[v+0],P=_.circleArray[v+1],T=_.circleArray[v+2],C=_.circleArray[v+3];d.emplace(f++,w,P,T,C,0),d.emplace(f++,w,P,T,C,1),d.emplace(f++,w,P,T,C,2),d.emplace(f++,w,P,T,C,3)}(!xs||xs.length<h*2)&&(xs=iF(h));let y=a.createIndexBuffer(xs,!0),g=a.createVertexBuffer(d,eE.members,!0);for(let _ of u){let b=LL(e.transform);p.draw(a,s.TRIANGLES,he.disabled,Pe.disabled,e.colorModeForRenderPass(),be.disabled,b,e.style.map.terrain&&e.style.map.terrain.getTerrainData(_.coord),null,i.id,g,y,Be.simpleSegment(0,_.circleOffset*2,_.circleArray.length,_.circleArray.length/2),null,e.transform.zoom,null,null,null)}g.destroy(),y.destroy()}function iF(e){let t=e*2,i=new oI;i.resize(t),i._trim();for(let r=0;r<t;r++){let n=r*6;i.uint16[n+0]=r*4+0,i.uint16[n+1]=r*4+1,i.uint16[n+2]=r*4+2,i.uint16[n+3]=r*4+2,i.uint16[n+4]=r*4+3,i.uint16[n+5]=r*4+0}return i}var rF=O.identity(new Float32Array(16));function nF(e,t,i,r,n,a){if(e.renderPass!=="translucent")return;let{isRenderingToTexture:o}=a,s=Pe.disabled,l=e.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&oF(r,e,i,t,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),n),i.paint.get("icon-opacity").constantOr(1)!==0&&jm(e,t,i,r,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),s,l,o),i.paint.get("text-opacity").constantOr(1)!==0&&jm(e,t,i,r,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),s,l,o),t.map.showCollisionBoxes&&(Vm(e,t,i,r,!0),Vm(e,t,i,r,!1))}function aF(e,t,i,r,n,a){let{horizontalAlign:o,verticalAlign:s}=y0(e),l=-(o-.5)*t,u=-(s-.5)*i;return new Ip.default((l/n+r[0])*a,(u/n+r[1])*a)}function oF(e,t,i,r,n,a,o,s,l){let u=t.transform,h=t.style.map.terrain,c=n==="map",p=a==="map";for(let d of e){let f=r.getTile(d),y=f.getBucket(i);if(!y||!y.text||!y.text.segments.get().length)continue;let g=y.textSizeData,_=Ll(g,u.zoom),b=Nt(f,1,t.transform.zoom),v=bp(c,t.transform,b),w=i.layout.get("icon-text-fit")!=="none"&&y.hasIconData();if(_){let P=Math.pow(2,u.zoom-f.tileID.overscaledZ),T=h?(A,k)=>h.getElevation(d,A,k):null,C=vr(u,f,o,s);lF(y,c,p,l,u,v,P,_,w,C,d.toUnwrapped(),T)}}}function sF(e,t,i,r,n,a){let o=t.tileAnchorPoint.add(new Ip.default(t.translation[0],t.translation[1]));if(t.pitchWithMap){let s=r.mult(a);i||(s=s.rotate(-n));let l=o.add(s);return Pp(l.x,l.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}else if(i){let s=Hr(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),l=Math.atan(s.y/s.x)+(s.x<0?Math.PI:0);return e.add(r.rotate(l))}else return e.add(r)}function lF(e,t,i,r,n,a,o,s,l,u,h,c){let p=e.text.placedSymbolArray,d=e.text.dynamicLayoutVertexArray,f=e.icon.dynamicLayoutVertexArray,y={};d.clear();for(let g=0;g<p.length;g++){let _=p.get(g),b=e.allowVerticalPlacement&&!_.placedOrientation,v=!_.hidden&&_.crossTileID&&!b?r[_.crossTileID]:null;if(!v)zn(_.numGlyphs,d);else{let w=new Ip.default(_.anchorX,_.anchorY),P={getElevation:c,width:n.width,height:n.height,pitchedLabelPlaneMatrix:a,lineVertexArray:null,pitchWithMap:i,transform:n,projectionCache:null,tileAnchorPoint:w,translation:u,unwrappedTileID:h},T=i?F0(w.x,w.y,P):Hr(w.x,w.y,P),C=D0(n.cameraToCenterDistance,T.signedDistanceFromCamera),A=vp(e.textSizeData,s,_)*C/d0;i&&(A*=e.tilePixelRatio/o);let{width:k,height:z,anchor:L,textOffset:E,textBoxScale:D}=v,x=aF(L,k,z,E,D,A),M=n.getPitchedTextCorrection(w.x+u[0],w.y+u[1],h),I=sF(T.point,P,t,x,-n.bearingInRadians,M),R=e.allowVerticalPlacement&&_.placedOrientation===2?Math.PI/2:0;for(let N=0;N<_.numGlyphs;N++)no(d,I,R);l&&_.associatedIconIndex>=0&&(y[_.associatedIconIndex]={shiftedAnchor:I,angle:R})}}if(l){f.clear();let g=e.icon.placedSymbolArray;for(let _=0;_<g.length;_++){let b=g.get(_);if(b.hidden)zn(b.numGlyphs,f);else{let v=y[_];if(!v)zn(b.numGlyphs,f);else for(let w=0;w<b.numGlyphs;w++)no(f,v.shiftedAnchor,v.angle)}}e.icon.dynamicLayoutVertexBuffer.updateData(f)}e.text.dynamicLayoutVertexBuffer.updateData(d)}function uF(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function jm(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=e.context,f=d.gl,y=e.transform,g=s==="map",_=l==="map",b=s!=="viewport"&&i.layout.get("symbol-placement")!=="point",v=g&&!_&&!b,w=!i.layout.get("symbol-sort-key").isConstant(),P=!1,T=e.getDepthModeForSublayer(0,he.ReadOnly),C=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),A=[],k=y.getCircleRadiusCorrection();for(let z of r){let L=t.getTile(z),E=L.getBucket(i);if(!E)continue;let D=n?E.text:E.icon;if(!D||!D.segments.get().length||!D.hasVisibleVertices)continue;let x=D.programConfigurations.get(i.id),M=n||E.sdfIcons,I=n?E.textSizeData:E.iconSizeData,R=_||y.pitch!==0,N=e.useProgram(uF(M,n,E),x),$=Ll(I,y.zoom),Q=e.style.map.terrain&&e.style.map.terrain.getTerrainData(z),oe,Le=[0,0],Ce,ze,$e=null,Lt;if(n){if(Ce=L.glyphAtlasTexture,ze=f.LINEAR,oe=L.glyphAtlasTexture.size,E.iconsInText){Le=L.imageAtlasTexture.size,$e=L.imageAtlasTexture;let Zt=I.kind==="composite"||I.kind==="camera";Lt=R||e.options.rotating||e.options.zooming||Zt?f.LINEAR:f.NEAREST}}else{let Zt=i.layout.get("icon-size").constantOr(0)!==1||E.iconsNeedLinear;Ce=L.imageAtlasTexture,ze=M||e.options.rotating||e.options.zooming||Zt||R?f.LINEAR:f.NEAREST,oe=L.imageAtlasTexture.size}let Xt=Nt(L,1,e.transform.zoom),$t=bp(g,e.transform,Xt),qt=O.create();O.invert(qt,$t);let or=U3(_,g,e.transform,Xt),_t=vr(y,L,a,o),Oo=y.getProjectionData({overscaledTileID:z,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),mn=C&&E.hasTextData(),Ar=i.layout.get("icon-text-fit")!=="none"&&mn&&E.hasIconData();if(b){let Zt=e.style.map.terrain?(xt,Wt)=>e.style.map.terrain.getElevation(z,xt,Wt):null,pt=i.layout.get("text-rotation-alignment")==="map";$3(E,e,n,$t,qt,_,u,pt,z.toUnwrapped(),y.width,y.height,_t,Zt)}let Ri=n&&C||Ar,Er=_?$t:e.transform.clipSpaceToPixelsMatrix,Oi=b||Ri?rF:Er,Yt=M&&i.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1)!==0,zt;M?E.iconsInText?zt=az(I.kind,$,v,_,b,Ri,e,Oi,or,_t,oe,Le,k):zt=fx(I.kind,$,v,_,b,Ri,e,Oi,or,_t,n,oe,!0,k):zt=dx(I.kind,$,v,_,b,Ri,e,Oi,or,_t,n,oe,k);let kr={program:N,buffers:D,uniformValues:zt,projectionData:Oo,atlasTexture:Ce,atlasTextureIcon:$e,atlasInterpolation:ze,atlasInterpolationIcon:Lt,isSDF:M,hasHalo:Yt};if(w&&E.canOverlap){P=!0;let Zt=D.segments.get();for(let pt of Zt)A.push({segments:new Be([pt]),sortKey:pt.sortKey,state:kr,terrainData:Q})}else A.push({segments:D.segments,sortKey:0,state:kr,terrainData:Q})}P&&A.sort((z,L)=>z.sortKey-L.sortKey);for(let z of A){let L=z.state;if(d.activeTexture.set(f.TEXTURE0),L.atlasTexture.bind(L.atlasInterpolation,f.CLAMP_TO_EDGE),L.atlasTextureIcon&&(d.activeTexture.set(f.TEXTURE1),L.atlasTextureIcon&&L.atlasTextureIcon.bind(L.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),L.isSDF){let E=L.uniformValues;L.hasHalo&&(E.u_is_halo=1,Gm(L.buffers,z.segments,i,e,L.program,T,h,c,E,L.projectionData,z.terrainData)),E.u_is_halo=0}Gm(L.buffers,z.segments,i,e,L.program,T,h,c,L.uniformValues,L.projectionData,z.terrainData)}}function Gm(e,t,i,r,n,a,o,s,l,u,h){let c=r.context,p=c.gl;n.draw(c,p.TRIANGLES,a,o,s,be.backCCW,l,h,u,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function hF(e,t,i,r,n){if(e.renderPass!=="translucent")return;let{isRenderingToTexture:a}=n,o=i.paint.get("circle-opacity"),s=i.paint.get("circle-stroke-width"),l=i.paint.get("circle-stroke-opacity"),u=!i.layout.get("circle-sort-key").isConstant();if(o.constantOr(1)===0&&(s.constantOr(1)===0||l.constantOr(1)===0))return;let h=e.context,c=h.gl,p=e.transform,d=e.getDepthModeForSublayer(0,he.ReadOnly),f=Pe.disabled,y=e.colorModeForRenderPass(),g=[],_=p.getCircleRadiusCorrection();for(let b=0;b<r.length;b++){let v=r[b],w=t.getTile(v),P=w.getBucket(i);if(!P)continue;let T=i.paint.get("circle-translate"),C=i.paint.get("circle-translate-anchor"),A=vr(p,w,T,C),k=P.programConfigurations.get(i.id),z=e.useProgram("circle",k),L=P.layoutVertexBuffer,E=P.indexBuffer,D=e.style.map.terrain&&e.style.map.terrain.getTerrainData(v),x=AL(e,w,i,A,_),M=p.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),I={programConfiguration:k,program:z,layoutVertexBuffer:L,indexBuffer:E,uniformValues:x,terrainData:D,projectionData:M};if(u){let R=P.segments.get();for(let N of R)g.push({segments:new Be([N]),sortKey:N.sortKey,state:I})}else g.push({segments:P.segments,sortKey:0,state:I})}u&&g.sort((b,v)=>b.sortKey-v.sortKey);for(let b of g){let{programConfiguration:v,program:w,layoutVertexBuffer:P,indexBuffer:T,uniformValues:C,terrainData:A,projectionData:k}=b.state,z=b.segments;w.draw(h,c.TRIANGLES,d,f,y,be.backCCW,C,A,k,i.id,P,T,z,i.paint,e.transform.zoom,v)}}function cF(e,t,i,r,n){if(i.paint.get("heatmap-opacity")===0)return;let a=e.context,{isRenderingToTexture:o,isRenderingGlobe:s}=n;if(e.style.map.terrain){for(let l of r){let u=t.getTile(l);t.hasRenderableParent(l)||(e.renderPass==="offscreen"?fF(e,u,i,l,s):e.renderPass==="translucent"&&mF(e,i,l,o,s))}a.viewport.set([0,0,e.width,e.height])}else e.renderPass==="offscreen"?pF(e,t,i,r):e.renderPass==="translucent"&&dF(e,i)}function pF(e,t,i,r){let n=e.context,a=n.gl,o=e.transform,s=Pe.disabled,l=new Ve([a.ONE,a.ONE],J.transparent,[!0,!0,!0,!0]);yF(n,e,i),n.clear({color:J.transparent});for(let u=0;u<r.length;u++){let h=r[u];if(t.hasRenderableParent(h))continue;let c=t.getTile(h),p=c.getBucket(i);if(!p)continue;let d=p.programConfigurations.get(i.id),f=e.useProgram("heatmap",d),y=o.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=o.getCircleRadiusCorrection();f.draw(n,a.TRIANGLES,he.disabled,s,l,be.backCCW,ux(c,o.zoom,i.paint.get("heatmap-intensity"),g),null,y,i.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,i.paint,o.zoom,d)}n.viewport.set([0,0,e.width,e.height])}function dF(e,t){let i=e.context,r=i.gl;i.setColorMode(e.colorModeForRenderPass());let n=t.heatmapFbos.get(eo);n&&(i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),i.activeTexture.set(r.TEXTURE1),gx(i,t).bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(i,r.TRIANGLES,he.disabled,Pe.disabled,e.colorModeForRenderPass(),be.disabled,hx(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}function fF(e,t,i,r,n){let a=e.context,o=a.gl,s=Pe.disabled,l=new Ve([o.ONE,o.ONE],J.transparent,[!0,!0,!0,!0]),u=t.getBucket(i);if(!u)return;let h=r.key,c=i.heatmapFbos.get(h);c||(c=yx(a,t.tileSize,t.tileSize),i.heatmapFbos.set(h,c)),a.bindFramebuffer.set(c.framebuffer),a.viewport.set([0,0,t.tileSize,t.tileSize]),a.clear({color:J.transparent});let p=u.programConfigurations.get(i.id),d=e.useProgram("heatmap",p,!n),f=e.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),y=e.style.map.terrain.getTerrainData(r);d.draw(a,o.TRIANGLES,he.disabled,s,l,be.disabled,ux(t,e.transform.zoom,i.paint.get("heatmap-intensity"),1),y,f,i.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,i.paint,e.transform.zoom,p)}function mF(e,t,i,r,n){let a=e.context,o=a.gl,s=e.transform;a.setColorMode(e.colorModeForRenderPass());let l=gx(a,t),u=i.key,h=t.heatmapFbos.get(u);if(!h)return;a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,h.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),l.bind(o.LINEAR,o.CLAMP_TO_EDGE);let c=s.getProjectionData({overscaledTileID:i,applyTerrainMatrix:n,applyGlobeMatrix:!r});e.useProgram("heatmapTexture").draw(a,o.TRIANGLES,he.disabled,Pe.disabled,e.colorModeForRenderPass(),be.disabled,hx(e,t,0,1),null,c,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),h.destroy(),t.heatmapFbos.delete(u)}function yF(e,t,i){let r=e.gl;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let n=i.heatmapFbos.get(eo);n?(r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),e.bindFramebuffer.set(n.framebuffer)):(n=yx(e,t.width/4,t.height/4),i.heatmapFbos.set(eo,n))}function yx(e,t,i){var l,u;let r=e.gl,n=r.createTexture();r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR);let a=(l=e.HALF_FLOAT)!=null?l:r.UNSIGNED_BYTE,o=(u=e.RGBA16F)!=null?u:r.RGBA;r.texImage2D(r.TEXTURE_2D,0,o,t,i,0,r.RGBA,a,null);let s=e.createFramebuffer(t,i,!1,!1);return s.colorAttachment.set(n),s}function gx(e,t){return t.colorRampTexture||(t.colorRampTexture=new Qe(e,t.colorRamp,e.gl.RGBA)),t.colorRampTexture}function gF(e,t,i,r,n){if(e.renderPass!=="translucent")return;let{isRenderingToTexture:a}=n,o=i.paint.get("line-opacity"),s=i.paint.get("line-width");if(o.constantOr(1)===0||s.constantOr(1)===0)return;let l=e.getDepthModeForSublayer(0,he.ReadOnly),u=e.colorModeForRenderPass(),h=i.paint.get("line-dasharray"),c=i.paint.get("line-pattern"),p=c.constantOr(1),d=i.paint.get("line-gradient"),f=i.getCrossfadeParameters(),y=p?"linePattern":h?"lineSDF":d?"lineGradient":"line",g=e.context,_=g.gl,b=e.transform,v=!0;for(let w of r){let P=t.getTile(w);if(p&&!P.patternsLoaded())continue;let T=P.getBucket(i);if(!T)continue;let C=T.programConfigurations.get(i.id),A=e.context.program.get(),k=e.useProgram(y,C),z=v||k.program!==A,L=e.style.map.terrain&&e.style.map.terrain.getTerrainData(w),E=c.constantOr(null);if(E&&P.imageAtlas){let R=P.imageAtlas,N=R.patternPositions[E.to.toString()],$=R.patternPositions[E.from.toString()];N&&$&&C.setConstantPatternPositions(N,$)}let D=b.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),x=b.getPixelScale(),M=p?WL(e,P,i,x,f):h?HL(e,P,i,x,h,f):d?ZL(e,P,i,x,T.lineClipsArray.length):Mp(e,P,i,x);if(p)g.activeTexture.set(_.TEXTURE0),P.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),C.updatePaintBuffers(f);else if(h&&(z||e.lineAtlas.dirty))g.activeTexture.set(_.TEXTURE0),e.lineAtlas.bind(g);else if(d){let R=T.gradients[i.id],N=R.texture;if(i.gradientVersion!==R.version){let $=256;if(i.stepInterpolant){let Q=t.getSource().maxzoom,oe=w.canonical.z===Q?Math.ceil(1<<e.transform.maxZoom-w.canonical.z):1,Le=T.maxLineLength/8192*1024*oe;$=Te(fT(Le),256,g.maxTextureSize)}R.gradient=t0({expression:i.gradientExpression(),evaluationKey:"lineProgress",resolution:$,image:R.gradient||void 0,clips:T.lineClipsArray}),R.texture?R.texture.update(R.gradient):R.texture=new Qe(g,R.gradient,_.RGBA),R.version=i.gradientVersion,N=R.texture}g.activeTexture.set(_.TEXTURE0),N.bind(i.stepInterpolant?_.NEAREST:_.LINEAR,_.CLAMP_TO_EDGE)}let I=e.stencilModeForClipping(w);k.draw(g,_.TRIANGLES,l,I,u,be.disabled,M,L,D,i.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,i.paint,e.transform.zoom,C,T.layoutVertexBuffer2),v=!1}}function _x(e,t,i,r,n){if(!i||!r||!r.imageAtlas)return;let a=r.imageAtlas.patternPositions,o=a[i.to.toString()],s=a[i.from.toString()];if(!o&&s&&(o=s),!s&&o&&(s=o),!o||!s){let l=n.getPaintProperty(t);o=a[l],s=a[l]}o&&s&&e.setConstantPatternPositions(o,s)}function _F(e,t,i,r,n){let a=i.paint.get("fill-color"),o=i.paint.get("fill-opacity");if(o.constantOr(1)===0)return;let{isRenderingToTexture:s}=n,l=e.colorModeForRenderPass(),u=i.paint.get("fill-pattern"),h=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&a.constantOr(J.transparent).a===1&&o.constantOr(0)===1?"opaque":"translucent";if(e.renderPass===h){let c=e.getDepthModeForSublayer(1,e.renderPass==="opaque"?he.ReadWrite:he.ReadOnly);Um(e,t,i,r,c,l,!1,s)}if(e.renderPass==="translucent"&&i.paint.get("fill-antialias")){let c=e.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,he.ReadOnly);Um(e,t,i,r,c,l,!0,s)}}function Um(e,t,i,r,n,a,o,s){let l=e.context.gl,u="fill-pattern",h=i.paint.get(u),c=h&&h.constantOr(1),p=i.getCrossfadeParameters(),d,f,y,g,_,b=e.transform,v=i.paint.get("fill-translate"),w=i.paint.get("fill-translate-anchor");o?(f=c&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=l.LINES):(f=c?"fillPattern":"fill",d=l.TRIANGLES);let P=h.constantOr(null);for(let T of r){let C=t.getTile(T);if(c&&!C.patternsLoaded())continue;let A=C.getBucket(i);if(!A)continue;let k=A.programConfigurations.get(i.id),z=e.useProgram(f,k),L=e.style.map.terrain&&e.style.map.terrain.getTerrainData(T);c&&(e.context.activeTexture.set(l.TEXTURE0),C.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),k.updatePaintBuffers(p)),_x(k,u,P,C,i);let E=b.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),D=vr(b,C,v,w);if(!o)g=A.indexBuffer,_=A.segments,y=c?lx(e,p,C,D):SL(D);else{g=A.indexBuffer2,_=A.segments2;let M=[l.drawingBufferWidth,l.drawingBufferHeight];y=f==="fillOutlinePattern"&&c?CL(e,p,C,M,D):ML(M,D)}let x=e.stencilModeForClipping(T);z.draw(e.context,d,n,x,a,be.backCCW,y,L,E,i.id,A.layoutVertexBuffer,g,_,i.paint,e.transform.zoom,k)}}function xF(e,t,i,r,n){let a=i.paint.get("fill-extrusion-opacity");if(a===0)return;let{isRenderingToTexture:o}=n;if(e.renderPass==="translucent"){let s=new he(e.context.gl.LEQUAL,he.ReadWrite,e.depthRangeFor3D);if(a===1&&!i.paint.get("fill-extrusion-pattern").constantOr(1)){let l=e.colorModeForRenderPass();ah(e,t,i,r,s,Pe.disabled,l,o)}else ah(e,t,i,r,s,Pe.disabled,Ve.disabled,o),ah(e,t,i,r,s,e.stencilModeFor3D(),e.colorModeForRenderPass(),o)}}function ah(e,t,i,r,n,a,o,s){let l=e.context,u=l.gl,h="fill-extrusion-pattern",c=i.paint.get(h),p=c.constantOr(1),d=i.getCrossfadeParameters(),f=i.paint.get("fill-extrusion-opacity"),y=c.constantOr(null),g=e.transform;for(let _ of r){let b=t.getTile(_),v=b.getBucket(i);if(!v)continue;let w=e.style.map.terrain&&e.style.map.terrain.getTerrainData(_),P=v.programConfigurations.get(i.id),T=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",P);p&&(e.context.activeTexture.set(u.TEXTURE0),b.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),P.updatePaintBuffers(d));let C=g.getProjectionData({overscaledTileID:_,applyGlobeMatrix:!s,applyTerrainMatrix:!0});_x(P,h,y,b,i);let A=vr(g,b,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),k=i.paint.get("fill-extrusion-vertical-gradient"),z=p?vL(e,k,f,A,_,d,b):sx(e,k,f,A);T.draw(l,l.gl.TRIANGLES,n,a,o,be.backCCW,z,w,C,i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,i.paint,e.transform.zoom,P,e.style.map.terrain&&v.centroidVertexBuffer)}}function vF(e,t,i,r,n){if(e.renderPass!=="offscreen"&&e.renderPass!=="translucent")return;let{isRenderingToTexture:a}=n,o=e.context,s=e.style.projection.useSubdivision,l=e.getDepthModeForSublayer(0,he.ReadOnly),u=e.colorModeForRenderPass();if(e.renderPass==="offscreen")bF(e,t,r,i,l,Pe.disabled,u),o.viewport.set([0,0,e.width,e.height]);else if(e.renderPass==="translucent")if(s){let[h,c,p]=e.stencilConfigForOverlapTwoPass(r);oh(e,t,i,p,h,l,u,!1,a),oh(e,t,i,p,c,l,u,!0,a)}else{let[h,c]=e.getStencilConfigForOverlapAndUpdateStencilID(r);oh(e,t,i,c,h,l,u,!1,a)}}function oh(e,t,i,r,n,a,o,s,l){var g;let u=e.style.projection,h=e.context,c=e.transform,p=h.gl,d=["#define NUM_ILLUMINATION_SOURCES ".concat(i.paint.get("hillshade-highlight-color").values.length)],f=e.useProgram("hillshade",null,!1,d),y=!e.options.moving;for(let _ of r){let b=t.getTile(_),v=b.fbo;if(!v)continue;let w=u.getMeshFromTileID(h,_.canonical,s,!0,"raster"),P=(g=e.style.map.terrain)==null?void 0:g.getTerrainData(_);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,v.colorAttachment.get());let T=c.getProjectionData({overscaledTileID:_,aligned:y,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(h,p.TRIANGLES,a,n[_.overscaledZ],o,be.backCCW,NL(e,b,i),P,T,i.id,w.vertexBuffer,w.indexBuffer,w.segments)}}function bF(e,t,i,r,n,a,o){let s=e.context,l=s.gl;for(let u of i){let h=t.getTile(u),c=h.dem;if(!c||!c.data||!h.needsHillshadePrepare)continue;let p=c.dim,d=c.stride,f=c.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),h.demTexture=h.demTexture||e.getTileTexture(d),h.demTexture){let g=h.demTexture;g.update(f,{premultiply:!1}),g.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else h.demTexture=new Qe(s,f,l.RGBA,{premultiply:!1}),h.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let y=h.fbo;if(!y){let g=new Qe(s,{width:p,height:p,data:null},l.RGBA);g.bind(l.LINEAR,l.CLAMP_TO_EDGE),y=h.fbo=s.createFramebuffer(p,p,!0,!1),y.colorAttachment.set(g.texture)}s.bindFramebuffer.set(y.framebuffer),s.viewport.set([0,0,p,p]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,a,o,be.disabled,VL(h.tileID,c),null,null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),h.needsHillshadePrepare=!1}}function wF(e,t,i,r,n){if(e.renderPass!=="translucent"||!r.length)return;let{isRenderingToTexture:a}=n,o=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,he.ReadOnly),l=e.colorModeForRenderPass();if(o){let[u,h,c]=e.stencilConfigForOverlapTwoPass(r);sh(e,t,i,c,u,s,l,!1,a),sh(e,t,i,c,h,s,l,!0,a)}else{let[u,h]=e.getStencilConfigForOverlapAndUpdateStencilID(r);sh(e,t,i,h,u,s,l,!1,a)}}function sh(e,t,i,r,n,a,o,s,l){var g;let u=e.style.projection,h=e.context,c=e.transform,p=h.gl,d=e.useProgram("colorRelief"),f=!e.options.moving,y=!0;for(let _ of r){let b=t.getTile(_),v=b.dem;if(y){let k=p.getParameter(p.MAX_TEXTURE_SIZE),{elevationTexture:z,colorTexture:L}=i.getColorRampTextures(h,k,v.getUnpackVector());h.activeTexture.set(p.TEXTURE1),z.bind(p.NEAREST,p.CLAMP_TO_EDGE),h.activeTexture.set(p.TEXTURE4),L.bind(p.LINEAR,p.CLAMP_TO_EDGE),y=!1}if(!v||!v.data)continue;let w=v.stride,P=v.getPixels();if(h.activeTexture.set(p.TEXTURE0),h.pixelStoreUnpackPremultiplyAlpha.set(!1),b.demTexture=b.demTexture||e.getTileTexture(w),b.demTexture){let k=b.demTexture;k.update(P,{premultiply:!1}),k.bind(p.LINEAR,p.CLAMP_TO_EDGE)}else b.demTexture=new Qe(h,P,p.RGBA,{premultiply:!1}),b.demTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE);let T=u.getMeshFromTileID(h,_.canonical,s,!0,"raster"),C=(g=e.style.map.terrain)==null?void 0:g.getTerrainData(_),A=c.getProjectionData({overscaledTileID:_,aligned:f,applyGlobeMatrix:!l,applyTerrainMatrix:!0});d.draw(h,p.TRIANGLES,a,n[_.overscaledZ],o,be.backCCW,UL(i,b.dem),C,A,i.id,T.vertexBuffer,T.indexBuffer,T.segments)}}var vs=ne(le(),1),lh=[new vs.default(0,0),new vs.default(8192,0),new vs.default(8192,8192),new vs.default(0,8192)];function PF(e,t,i,r,n){if(e.renderPass!=="translucent"||i.paint.get("raster-opacity")===0||!r.length)return;let{isRenderingToTexture:a}=n,o=t.getSource(),s=e.style.projection.useSubdivision;if(o instanceof go)bs(e,t,i,r,null,!1,!1,o.tileCoords,o.flippedWindingOrder,a);else if(s){let[l,u,h]=e.stencilConfigForOverlapTwoPass(r);bs(e,t,i,h,l,!1,!0,lh,!1,a),bs(e,t,i,h,u,!0,!0,lh,!1,a)}else{let[l,u]=e.getStencilConfigForOverlapAndUpdateStencilID(r);bs(e,t,i,u,l,!1,!0,lh,!1,a)}}function bs(e,t,i,r,n,a,o,s,l=!1,u=!1){let h=r[r.length-1].overscaledZ,c=e.context,p=c.gl,d=e.useProgram("raster"),f=e.transform,y=e.style.projection,g=e.colorModeForRenderPass(),_=!e.options.moving;for(let b of r){let v=e.getDepthModeForSublayer(b.overscaledZ-h,i.paint.get("raster-opacity")===1?he.ReadWrite:he.ReadOnly,p.LESS),w=t.getTile(b);w.registerFadeDuration(i.paint.get("raster-fade-duration"));let P=t.findLoadedParent(b,0),T=t.findLoadedSibling(b),C=TF(w,P||T||null,t,i,e.transform,e.style.map.terrain),A,k,z=i.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;c.activeTexture.set(p.TEXTURE0),w.texture.bind(z,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),c.activeTexture.set(p.TEXTURE1),P?(P.texture.bind(z,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),A=Math.pow(2,P.tileID.overscaledZ-w.tileID.overscaledZ),k=[w.tileID.canonical.x*A%1,w.tileID.canonical.y*A%1]):w.texture.bind(z,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),w.texture.useMipmap&&c.extTextureFilterAnisotropic&&e.transform.pitch>20&&p.texParameterf(p.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax);let L=e.style.map.terrain&&e.style.map.terrain.getTerrainData(b),E=f.getProjectionData({overscaledTileID:b,aligned:_,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),D=JL(k||[0,0],A||1,C,i,s),x=y.getMeshFromTileID(c,b.canonical,a,o,"raster"),M=n?n[b.overscaledZ]:Pe.disabled;d.draw(c,p.TRIANGLES,v,M,g,l?be.frontCCW:be.backCCW,D,L,E,i.id,x.vertexBuffer,x.indexBuffer,x.segments)}}function TF(e,t,i,r,n,a){let o=r.paint.get("raster-fade-duration");if(!a&&o>0){let s=me.now(),l=(s-e.timeAdded)/o,u=t?(s-t.timeAdded)/o:-1,h=i.getSource(),c=Fl(n,{tileSize:h.tileSize,roundZoom:h.roundZoom}),p=!t||Math.abs(t.tileID.overscaledZ-c)>Math.abs(e.tileID.overscaledZ-c),d=p&&e.refreshedUponExpiration?1:Te(p?l:1-u,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),t?{opacity:1,mix:1-d}:{opacity:d,mix:0}}else return{opacity:1,mix:0}}function SF(e,t,i,r,n){let a=i.paint.get("background-color"),o=i.paint.get("background-opacity");if(o===0)return;let{isRenderingToTexture:s}=n,l=e.context,u=l.gl,h=e.style.projection,c=e.transform,p=c.tileSize,d=i.paint.get("background-pattern");if(e.isPatternMissing(d))return;let f=!d&&a.a===1&&o===1&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==f)return;let y=Pe.disabled,g=e.getDepthModeForSublayer(0,f==="opaque"?he.ReadWrite:he.ReadOnly),_=e.colorModeForRenderPass(),b=e.useProgram(d?"backgroundPattern":"background"),v=r||Bl(c,{tileSize:p,terrain:e.style.map.terrain});d&&(l.activeTexture.set(u.TEXTURE0),e.imageManager.bind(e.context));let w=i.getCrossfadeParameters();for(let P of v){let T=c.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),C=d?uz(o,e,d,{tileID:P,tileSize:p},w):lz(o,a),A=e.style.map.terrain&&e.style.map.terrain.getTerrainData(P),k=h.getMeshFromTileID(l,P.canonical,!1,!0,"raster");b.draw(l,u.TRIANGLES,g,y,_,be.backCCW,C,A,T,i.id,k.vertexBuffer,k.indexBuffer,k.segments)}}var MF=new J(1,0,0,1),CF=new J(0,1,0,1),IF=new J(0,0,1,1),AF=new J(1,0,1,1),EF=new J(0,1,1,1);function kF(e){let t=e.transform.padding,i=3;Xm(e,e.transform.height-(t.top||0),i,MF),Xm(e,t.bottom||0,i,CF),$m(e,t.left||0,i,IF),$m(e,e.transform.width-(t.right||0),i,AF);let r=e.transform.centerPoint;DF(e,r.x,e.transform.height-r.y,EF)}function DF(e,t,i,r){il(e,t-2/2,i-20/2,2,20,r),il(e,t-20/2,i-2/2,20,2,r)}function Xm(e,t,i,r){il(e,0,t+i/2,e.transform.width,i,r)}function $m(e,t,i,r){il(e,t-i/2,0,i,e.transform.height,r)}function il(e,t,i,r,n,a){let o=e.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,i*e.pixelRatio,r*e.pixelRatio,n*e.pixelRatio),o.clear({color:a}),s.disable(s.SCISSOR_TEST)}function LF(e,t,i){for(let r=0;r<i.length;r++)zF(e,t,i[r])}function zF(e,t,i){let r=e.context,n=r.gl,a=e.useProgram("debug"),o=he.disabled,s=Pe.disabled,l=e.colorModeForRenderPass(),u="$debug",h=e.style.map.terrain&&e.style.map.terrain.getTerrainData(i);r.activeTexture.set(n.TEXTURE0);let c=t.getTileByID(i.key).latestRawTileData,p=c&&c.byteLength||0,d=Math.floor(p/1024),f=t.getTile(i).tileSize,y=512/Math.min(f,512)*(i.overscaledZ/e.transform.zoom)*.5,g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=" => ".concat(i.overscaledZ));let _="".concat(g," ").concat(d,"kB");FF(e,_);let b=e.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(r,n.TRIANGLES,o,s,Ve.alphaBlended,be.disabled,Om(J.transparent,y),null,b,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(r,n.LINE_STRIP,o,s,l,be.disabled,Om(J.red),h,b,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function FF(e,t){e.initDebugOverlayCanvas();let i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}function BF(e,t){let i=null,r=Object.values(e._layers).flatMap(s=>s.source&&!s.isHidden(t)?[e.sourceCaches[s.source]]:[]),n=r.filter(s=>s.getSource().type==="vector"),a=r.filter(s=>s.getSource().type!=="vector"),o=s=>{(!i||i.getSource().maxzoom<s.getSource().maxzoom)&&(i=s)};return n.forEach(s=>o(s)),i||a.forEach(s=>o(s)),i}function RF(e,t,i,r){let{isRenderingGlobe:n}=r,a=e.context,o=i.implementation,s=e.style.projection,l=e.transform,u=l.getProjectionDataForCustomLayer(n),h={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:"const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n".concat(s.shaderPreludeCode.vertexSource),define:s.shaderDefine},defaultProjectionData:u},c=o.renderingMode?o.renderingMode:"2d";if(e.renderPass==="offscreen"){let p=o.prerender;p&&(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),p.call(o,a.gl,h),a.setDirty(),e.setBaseState())}else if(e.renderPass==="translucent"){e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(Pe.disabled);let p=c==="3d"?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,he.ReadOnly);a.setDepthMode(p),o.render(a.gl,h),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}}function OF(e,t){let i=e.context,r=i.gl,n=e.transform,a=Ve.unblended,o=new he(r.LEQUAL,he.ReadWrite,[0,1]),s=t.sourceCache.getRenderableTiles(),l=e.useProgram("terrainDepth");i.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:J.transparent,depth:1});for(let u of s){let h=t.getTerrainMesh(u.tileID),c=t.getTerrainData(u.tileID),p=n.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d=pL(t.getMeshFrameDelta(n.zoom));l.draw(i,r.TRIANGLES,o,Pe.disabled,a,be.backCCW,d,c,p,"terrain",h.vertexBuffer,h.indexBuffer,h.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}function NF(e,t){let i=e.context,r=i.gl,n=e.transform,a=Ve.unblended,o=new he(r.LEQUAL,he.ReadWrite,[0,1]),s=t.getCoordsTexture(),l=t.sourceCache.getRenderableTiles(),u=e.useProgram("terrainCoords");i.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:J.transparent,depth:1}),t.coordsIndex=[];for(let h of l){let c=t.getTerrainMesh(h.tileID),p=t.getTerrainData(h.tileID);i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,s.texture);let d=dL(255-t.coordsIndex.length,t.getMeshFrameDelta(n.zoom)),f=n.getProjectionData({overscaledTileID:h.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(i,r.TRIANGLES,o,Pe.disabled,a,be.backCCW,d,p,f,"terrain",c.vertexBuffer,c.indexBuffer,c.segments),t.coordsIndex.push(h.tileID.key)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}function qm(e,t,i,r){let{isRenderingGlobe:n}=r,a=e.context,o=a.gl,s=e.transform,l=e.colorModeForRenderPass(),u=e.getDepthModeFor3D(),h=e.useProgram("terrain");a.bindFramebuffer.set(null),a.viewport.set([0,0,e.width,e.height]);for(let c of i){let p=t.getTerrainMesh(c.tileID),d=e.renderToTexture.getTexture(c),f=t.getTerrainData(c.tileID);a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,d.texture);let y=t.getMeshFrameDelta(s.zoom),g=s.calculateFogMatrix(c.tileID.toUnwrapped()),_=cL(y,g,e.style.sky,s.pitch,n),b=s.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(a,o.TRIANGLES,u,Pe.disabled,l,be.backCCW,_,f,b,"terrain",p.vertexBuffer,p.indexBuffer,p.segments)}}function xx(e,t){if(!t.mesh){let i=new qi;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);let r=new yi;r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),t.mesh=new Zn(e.createVertexBuffer(i,_r.members),e.createIndexBuffer(r),Be.simpleSegment(0,0,i.length,r.length))}return t.mesh}function VF(e,t){let i=e.context,r=i.gl,n=dz(t,e.style.map.transform,e.pixelRatio),a=new he(r.LEQUAL,he.ReadWrite,[0,1]),o=Pe.disabled,s=e.colorModeForRenderPass(),l=e.useProgram("sky"),u=xx(i,t);l.draw(i,r.TRIANGLES,a,o,s,be.disabled,n,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)}function jF(e,t){let i=e.properties.get("position"),r=[-i.x,-i.y,-i.z],n=O.identity(new Float64Array(16));return e.properties.get("anchor")==="map"&&(O.rotateZ(n,n,t.rollInRadians),O.rotateX(n,n,-t.pitchInRadians),O.rotateZ(n,n,t.bearingInRadians),O.rotateX(n,n,t.center.lat*Math.PI/180),O.rotateY(n,n,-t.center.lng*Math.PI/180)),V.transformMat4(r,r,n),r}function GF(e,t,i){let r=e.context,n=r.gl,a=e.useProgram("atmosphere"),o=new he(n.LEQUAL,he.ReadOnly,[0,1]),s=e.transform,l=jF(i,e.transform),u=s.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=t.properties.get("atmosphere-blend")*u.projectionTransition;if(h===0)return;let c=Rl(s.worldSize,s.center.lat),p=s.inverseProjectionMatrix,d=new Float64Array(4);d[3]=1,Ke.transformMat4(d,d,s.modelViewProjectionMatrix),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1,Ke.transformMat4(d,d,p),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1;let f=[d[0],d[1],d[2]],y=cz(l,h,f,c,p),g=xx(r,t);a.draw(r,n.TRIANGLES,o,Pe.disabled,Ve.alphaBlended,be.disabled,y,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}var UF=class{constructor(e,t){this.context=new tF(e),this.transform=t,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:O.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=oo.maxUnderzooming+oo.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new V0}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let r of this.style._order)this.style._layers[r].resize()}setup(){let e=this.context,t=new qi;t.emplaceBack(0,0),t.emplaceBack(8192,0),t.emplaceBack(0,8192),t.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(t,_r.members),this.tileExtentSegments=Be.simpleSegment(0,0,4,2);let i=new qi;i.emplaceBack(0,0),i.emplaceBack(8192,0),i.emplaceBack(0,8192),i.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(i,_r.members),this.debugSegments=Be.simpleSegment(0,0,4,5);let r=new WC;r.emplaceBack(0,0,0,0),r.emplaceBack(8192,0,8192,0),r.emplaceBack(0,8192,0,8192),r.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=e.createVertexBuffer(r,aL.members),this.rasterBoundsSegments=Be.simpleSegment(0,0,4,2);let n=new qi;n.emplaceBack(0,0),n.emplaceBack(8192,0),n.emplaceBack(0,8192),n.emplaceBack(8192,8192),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(n,_r.members),this.rasterBoundsSegmentsPosOnly=Be.simpleSegment(0,0,4,5);let a=new qi;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,_r.members),this.viewportSegments=Be.simpleSegment(0,0,4,2);let o=new sI;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);let s=new yi;s.emplaceBack(1,0,2),s.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let l=this.context.gl;this.stencilClearMode=new Pe({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.tileExtentMesh=new Zn(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=O.create();O.ortho(i,0,this.width,this.height,0,0,1),O.scale(i,i,[t.drawingBufferWidth,t.drawingBufferHeight,0]);let r={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i};this.useProgram("clippingMask",null,!0).draw(e,t.TRIANGLES,he.disabled,this.stencilClearMode,Ve.disabled,be.disabled,null,null,r,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let r=this.context;r.setColorMode(Ve.disabled),r.setDepthMode(he.disabled);let n={};for(let a of t)n[a.key]=this.nextStencilID++;this._renderTileMasks(n,t,i,!0),this._renderTileMasks(n,t,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,i,r){let n=this.context,a=n.gl,o=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(let u of t){let h=e[u.key],c=this.style.map.terrain&&this.style.map.terrain.getTerrainData(u),p=o.getMeshFromTileID(this.context,u.canonical,r,!0,"stencil"),d=s.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!i,applyTerrainMatrix:!0});l.draw(n,a.TRIANGLES,he.disabled,new Pe({func:a.ALWAYS,mask:0},h,255,a.KEEP,a.KEEP,a.REPLACE),Ve.disabled,i?be.disabled:be.backCCW,null,c,d,"$clipping",p.vertexBuffer,p.indexBuffer,p.segments)}}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,i=this.style.projection,r=this.transform,n=this.useProgram("depth"),a=this.getDepthModeFor3D(),o=Bl(r,{tileSize:r.tileSize});for(let s of o){let l=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),u=i.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),h=r.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(e,t.TRIANGLES,a,Pe.disabled,Ve.disabled,be.backCCW,null,l,h,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new Pe({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new Pe({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,i=e.sort((a,o)=>o.overscaledZ-a.overscaledZ),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let a={};for(let o=0;o<n;o++)a[o+r]=new Pe({func:t.GEQUAL,mask:255},o+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[a,i]}return[{[r]:Pe.disabled},i]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,i=e.sort((a,o)=>o.overscaledZ-a.overscaledZ),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){let a={},o={};for(let s=0;s<n;s++)a[s+r]=new Pe({func:t.GREATER,mask:255},n+1+s,255,t.KEEP,t.KEEP,t.REPLACE),o[s+r]=new Pe({func:t.GREATER,mask:255},1+s,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=n*2+1,[a,o,i]}else return this.nextStencilID=3,[{[r]:new Pe({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new Pe({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Ve([e.CONSTANT_COLOR,e.ONE],new J(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ve.unblended:Ve.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return he.disabled;let r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new he(i||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new he(this.context.gl.LEQUAL,he.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,t){var u,h;this.style=e,this.options=t,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(me.now()),this.imageManager.beginFrame();let i=this.style._order,r=this.style.sourceCaches,n={},a={},o={},s={isRenderingToTexture:!1,isRenderingGlobe:((u=e.projection)==null?void 0:u.transitionState)>0};for(let c in r){let p=r[c];p.used&&p.prepare(this.context),n[c]=p.getVisibleCoordinates(!1),a[c]=n[c].slice().reverse(),o[c]=p.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let c=0;c<i.length;c++){let p=i[c];if(this.style._layers[p].is3D()){this.opaquePassCutoff=c;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let c of i){let p=this.style._layers[c];if(!p.hasOffscreenPass()||p.isHidden(this.transform.zoom))continue;let d=a[p.source];p.type!=="custom"&&!d.length||this.renderLayer(this,r[p.source],p,d,s)}if((h=this.style.projection)==null||h.updateGPUdependent({context:this.context,useProgram:c=>this.useProgram(c)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?J.black:J.transparent,depth:1}),this.clearStencil(),this.style.sky&&VF(this,this.style.sky),this._showOverdrawInspector=t.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){let c=this.style._layers[i[this.currentLayer]],p=r[c.source],d=n[c.source];this._renderTileClippingMasks(c,d,!1),this.renderLayer(this,p,c,d,s)}this.renderPass="translucent";let l=!1;for(this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){let c=this.style._layers[i[this.currentLayer]],p=r[c.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(c,s))continue;!this.opaquePassEnabledForLayer()&&!l&&(l=!0,s.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let d=(c.type==="symbol"?o:a)[c.source];this._renderTileClippingMasks(c,n[c.source],!!this.renderToTexture),this.renderLayer(this,p,c,d,s)}if(s.isRenderingGlobe&&GF(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let c=BF(this.style,this.transform.zoom);c&&LF(this,c,c.getVisibleCoordinates())}this.options.showPadding&&kF(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let t=this.terrainFacilitator.matrix,i=this.transform.modelViewProjectionMatrix,r=this.terrainFacilitator.dirty;r||(r=e?!O.exactEquals(t,i):!O.equals(t,i)),r||(r=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),r&&(O.copy(t,i),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,OF(this,this.style.map.terrain),NF(this,this.style.map.terrain))}renderLayer(e,t,i,r,n){i.isHidden(this.transform.zoom)||i.type!=="background"&&i.type!=="custom"&&!(r||[]).length||(this.id=i.id,vE(i)?nF(e,t,i,r,this.style.placement.variableOffsets,n):II(i)?hF(e,t,i,r,n):LI(i)?cF(e,t,i,r,n):WA(i)?gF(e,t,i,r,n):xA(i)?_F(e,t,i,r,n):kA(i)?xF(e,t,i,r,n):RI(i)?vF(e,t,i,r,n):GI(i)?wF(e,t,i,r,n):IE(i)?PF(e,t,i,r,n):TE(i)?SF(e,t,i,r,n):kE(i)&&RF(e,t,i,n))}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1,r=[]){this.cache=this.cache||{};let n=!!this.style.map.terrain,a=this.style.projection,o=i?Mi.projectionMercator:a.shaderPreludeCode,s=i?j0:a.shaderDefine,l="/".concat(i?G0:a.shaderVariantName),u=t?t.cacheKey:"",h=this._showOverdrawInspector?"/overdraw":"",c=n?"/terrain":"",p=r?"/".concat(r.join("/")):"",d=e+u+l+h+c+p;return this.cache[d]||(this.cache[d]=new yL(this.context,Mi[e],t,fz[e],this._showOverdrawInspector,n,o,s,r)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new Qe(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}};function vx(e,t){let i=!1,r=null,n=null,a,o=()=>{r=null,i&&(e.apply(n,a),r=setTimeout(o,t),i=!1)};return(...s)=>(i=!0,n=this,a=s,r||o(),r)}var XF=class{constructor(e){this._getCurrentHash=()=>{let t=window.location.hash.replace("#","");if(this._hashName){let i;return t.split("&").map(r=>r.split("=")).forEach(r=>{r[0]===this._hashName&&(i=r)}),(i&&i[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let i=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getCurrentHash();if(t.length===0)return;let i=t.join("/"),r=i;r.split("&").length>0&&(r=r.split("&")[0]),this._hashName&&(r="".concat(this._hashName,"=").concat(i));let n=window.location.hash.replace(r,"");n.startsWith("#&")?n=n.slice(0,1)+n.slice(2):n==="#"&&(n="");let a=window.location.href.replace(/(#.+)?$/,n);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=vx(this._updateHashUnthrottled,30*1e3/100),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),i=Math.round(this._map.getZoom()*100)/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),a=Math.round(t.lng*n)/n,o=Math.round(t.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch(),u="";if(e?u+="/".concat(a,"/").concat(o,"/").concat(i):u+="".concat(i,"/").concat(o,"/").concat(a),(s||l)&&(u+="/".concat(Math.round(s*10)/10)),l&&(u+="/".concat(Math.round(l))),this._hashName){let h=this._hashName,c=!1,p=window.location.hash.slice(1).split("&").map(d=>{let f=d.split("=")[0];return f===h?(c=!0,"".concat(f,"=").concat(u)):d}).filter(d=>d);return c||p.push("".concat(h,"=").concat(u)),"#".concat(p.join("&"))}return"#".concat(u)}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new re(+e[2],+e[1])}catch(n){return!1}let t=+e[0],i=+(e[3]||0),r=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&i>=-180&&i<=180&&r>=this._map.getMinPitch()&&r<=this._map.getMaxPitch()}},$F=ne(le(),1),_o={linearity:.3,easing:xc(0,0,.3,1)},qF=H({deceleration:2500,maxSpeed:1400},_o),YF=H({deceleration:20,maxSpeed:1400},_o),ZF=H({deceleration:1e3,maxSpeed:360},_o),WF=H({deceleration:1e3,maxSpeed:90},_o),HF=H({deceleration:1e3,maxSpeed:360},_o),KF=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:me.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=me.now(),i=160;for(;e.length>0&&t-e[0].time>i;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let t={zoom:0,bearing:0,pitch:0,roll:0,pan:new $F.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:n}of this._inertiaBuffer)t.zoom+=n.zoomDelta||0,t.bearing+=n.bearingDelta||0,t.pitch+=n.pitchDelta||0,t.roll+=n.rollDelta||0,n.panDelta&&t.pan._add(n.panDelta),n.around&&(t.around=n.around),n.pinchAround&&(t.pinchAround=n.pinchAround);let i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(t.pan.mag()){let n=Pa(t.pan.mag(),i,H({},qF,e||{})),a=t.pan.mult(n.amount/t.pan.mag()),o=this._map.cameraHelper.handlePanInertia(a,this._map.transform);r.center=o.easingCenter,r.offset=o.easingOffset,wa(r,n)}if(t.zoom){let n=Pa(t.zoom,i,YF);r.zoom=this._map.transform.zoom+n.amount,wa(r,n)}if(t.bearing){let n=Pa(t.bearing,i,ZF);r.bearing=this._map.transform.bearing+Te(n.amount,-179,179),wa(r,n)}if(t.pitch){let n=Pa(t.pitch,i,WF);r.pitch=this._map.transform.pitch+n.amount,wa(r,n)}if(t.roll){let n=Pa(t.roll,i,HF);r.roll=this._map.transform.roll+Te(n.amount,-179,179),wa(r,n)}if(r.zoom||r.bearing){let n=t.pinchAround===void 0?t.around:t.pinchAround;r.around=n?this._map.unproject(n):this._map.getCenter()}return this.clear(),H(r,{noMoveStart:!0})}};function wa(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function Pa(e,t,i){let{maxSpeed:r,linearity:n,deceleration:a}=i,o=Te(e*n/(t/1e3),-r,r),s=Math.abs(o)/(a*n);return{easing:i.easing,duration:s*1e3,amount:o*(s/2)}}var JF=ne(le(),1),ei=class extends U{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,r={}){i=i instanceof MouseEvent?i:new MouseEvent(e,i);let n=ye.mousePos(t.getCanvas(),i),a=t.unproject(n);super(e,H({point:n,lngLat:a,originalEvent:i},r)),this._defaultPrevented=!1,this.target=t}},ws=class extends U{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){let r=e==="touchend"?i.changedTouches:i.touches,n=ye.touchPos(t.getCanvasContainer(),r),a=n.map(l=>t.unproject(l)),o=n.reduce((l,u,h,c)=>l.add(u.div(c.length)),new JF.default(0,0)),s=t.unproject(o);super(e,{points:n,point:o,lngLats:a,lngLat:s,originalEvent:i}),this._defaultPrevented=!1}},QF=class extends U{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}},eB=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new QF(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new ei(e.type,this._map,e))}mouseup(e){this._map.fire(new ei(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new ei(e.type,this._map,e))}dblclick(e){return this._firePreventable(new ei(e.type,this._map,e))}mouseover(e){this._map.fire(new ei(e.type,this._map,e))}mouseout(e){this._map.fire(new ei(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ws(e.type,this._map,e))}touchmove(e){this._map.fire(new ws(e.type,this._map,e))}touchend(e){this._map.fire(new ws(e.type,this._map,e))}touchcancel(e){this._map.fire(new ws(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},tB=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new ei(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ei("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new ei(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},iB=ne(le(),1),xo=class{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(iB.default.convert(e),this._map.terrain)}},rB=class{constructor(e,t){this._map=e,this._tr=new xo(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(ye.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=ye.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let n=Math.min(r.x,i.x),a=Math.max(r.x,i.x),o=Math.min(r.y,i.y),s=Math.max(r.y,i.y);ye.setTransform(this._box,"translate(".concat(n,"px,").concat(o,"px)")),this._box.style.width="".concat(a-n,"px"),this._box.style.height="".concat(s-o,"px")}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let i=this._startPos,r=t;if(this.reset(),ye.suppressClick(),i.x===r.x&&i.y===r.y)this._fireEvent("boxzoomcancel",e);else return this._map.fire(new U("boxzoomend",{originalEvent:e})),{cameraAnimation:n=>n.fitScreenCoordinates(i,r,this._tr.bearing,{linear:!0})}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(ye.remove(this._box),this._box=null),ye.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new U(e,{originalEvent:t}))}},nB=ne(le(),1);function hc(e,t){if(e.length!==t.length)throw new Error("The number of touches and points are not equal - touches ".concat(e.length,", points ").concat(t.length));let i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}function aB(e){let t=new nB.default(0,0);for(let i of e)t._add(i);return t.div(e.length)}var bx=500,oB=500,Ap=30,sB=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=aB(t),this.touches=hc(i,t)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let r=hc(i,t);for(let n in this.touches){let a=this.touches[n],o=r[n];(!o||o.dist(a)>Ap)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>oB)&&(this.aborted=!0),i.length===0){let r=!this.aborted&&this.centroid;if(this.reset(),r)return r}}},cc=class{constructor(e){this.singleTap=new sB(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){let r=this.singleTap.touchend(e,t,i);if(r){let n=e.timeStamp-this.lastTime<bx,a=!this.lastTap||this.lastTap.dist(r)<Ap;if((!n||!a)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}},lB=class{constructor(e){this._tr=new xo(e),this._zoomIn=new cc({numTouches:1,numTaps:2}),this._zoomOut=new cc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){let r=this._zoomIn.touchend(e,t,i),n=this._zoomOut.touchend(e,t,i),a=this._tr;if(r)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:o=>o.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(r)},{originalEvent:e})};if(n)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:o=>o.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(n)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},uB=ne(le(),1),Ol=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let r=Array.isArray(t)?t[0]:t;if(!(!this._moved&&r.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(i,r)}dragEnd(e){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(e)&&(this._moved&&ye.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}},hB=0,cB=2,pB={[hB]:1,[cB]:2};function dB(e,t){let i=pB[t];return e.buttons===void 0||(e.buttons&i)!==i}var Nl=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=ye.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!dB(e,this._eventButton)}isValidEndEvent(e){return ye.mouseButton(e)===this._eventButton}};var Ep=0,kp=2,Vl=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=t=>{t.preventDefault()}};function fB({enable:e,clickTolerance:t}){let i=new Nl({checkCorrectEvent:r=>ye.mouseButton(r)===Ep&&!r.ctrlKey});return new Ol({clickTolerance:t,move:(r,n)=>({around:n,panDelta:n.sub(r)}),activateOnStart:!0,moveStateManager:i,enable:e,assignEvents:Vl})}function mB({enable:e,clickTolerance:t,aroundCenter:i=!0,minPixelCenterThreshold:r=100,rotateDegreesPerPixelMoved:n=.8},a){let o=new Nl({checkCorrectEvent:s=>ye.mouseButton(s)===Ep&&s.ctrlKey||ye.mouseButton(s)===kp&&!s.ctrlKey});return new Ol({clickTolerance:t,move:(s,l)=>{let u=a();if(i&&Math.abs(u.y-s.y)>r)return{bearingDelta:TT(new uB.default(s.x,l.y),l,u)};let h=(l.x-s.x)*n;return i&&l.y<u.y&&(h=-h),{bearingDelta:h}},moveStateManager:o,enable:e,assignEvents:Vl})}function yB({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:i=-.5}){let r=new Nl({checkCorrectEvent:n=>ye.mouseButton(n)===Ep&&n.ctrlKey||ye.mouseButton(n)===kp});return new Ol({clickTolerance:t,move:(n,a)=>({pitchDelta:(a.y-n.y)*i}),moveStateManager:r,enable:e,assignEvents:Vl})}function gB({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},r){let n=new Nl({checkCorrectEvent:a=>ye.mouseButton(a)===kp&&a.ctrlKey});return new Ol({clickTolerance:t,move:(a,o)=>{let s=r(),l=(o.x-a.x)*i;return o.y<s.y&&(l=-l),{rollDelta:l}},moveStateManager:n,enable:e,assignEvents:Vl})}var uh=ne(le(),1),_B=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new uh.default(0,0)}_shouldBePrevented(e){let t=this._map.cooperativeGestures.isEnabled()?2:1;return e<t}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active){if(this._shouldBePrevented(i.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,t,i)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,i){i.length>0&&(this._active=!0);let r=hc(i,t),n=new uh.default(0,0),a=new uh.default(0,0),o=0;for(let l in r){let u=r[l],h=this._touches[l];h&&(n._add(u),a._add(u.sub(h)),o++,r[l]=u)}if(this._touches=r,this._shouldBePrevented(o)||!a.mag())return;let s=a.div(o);return this._sum._add(s),this._sum.mag()<this._clickTolerance?void 0:{around:n.div(o),panDelta:s}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},Dp=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();let[r,n]=this._firstTwoTouches,a=Ps(i,t,r),o=Ps(i,t,n);if(!a||!o)return;let s=this._aroundCenter?null:a.add(o).div(2);return this._move([a,o],s,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[r,n]=this._firstTwoTouches,a=Ps(i,t,r),o=Ps(i,t,n);a&&o||(this._active&&ye.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function Ps(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}var xB=.1;function Ym(e,t){return Math.log(e/t)/Math.LN2}var vB=class extends Dp{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let i=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(Ym(this._distance,this._startDistance))<xB))return this._active=!0,{zoomDelta:Ym(this._distance,i),pinchAround:t}}},bB=25;function Zm(e,t){return e.angleWith(t)*180/Math.PI}var wB=class extends Dp{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,i){let r=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Zm(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=Math.PI*this._minDiameter,i=bB/t*360,r=Zm(e,this._startVector);return Math.abs(r)<i}};function hh(e){return Math.abs(e.y)>Math.abs(e.x)}var PB=100,TB=class extends Dp{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,hh(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,i){if(this._valid!==void 0)return this._valid;let r=2,n=e.mag()>=r,a=t.mag()>=r;if(!n&&!a)return;if(!n||!a)return this._firstMove===void 0&&(this._firstMove=i),i-this._firstMove<PB?void 0:!1;let o=e.y>0==t.y>0;return hh(e)&&hh(t)&&o}},SB={panStep:100,bearingStep:15,pitchStep:10},MB=class{constructor(e){this._tr=new xo(e);let t=SB;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,n=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:o=>{let s=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:CB,zoom:t?Math.round(s.zoom)+t*(e.shiftKey?2:1):s.zoom,bearing:s.bearing+i*this._bearingStep,pitch:s.pitch+r*this._pitchStep,offset:[-n*this._panStep,-a*this._panStep],center:s.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function CB(e){return e*(2-e)}var Wm=4.000244140625,IB=1/100,AB=1/450,EB=2,kB=5,DB=class{constructor(e,t){this._onTimeout=i=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)},this._map=e,this._tr=new xo(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=IB,this._wheelZoomRate=AB}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,i=me.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,t!==0&&t%Wm===0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t=t/4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=ye.mousePos(this._map.getCanvas(),e),i=this._tr;this._aroundCenter?this._aroundPoint=i.transform.locationToScreenPoint(re.convert(i.center)):this._aroundPoint=t,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let o=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=o),typeof this._targetZoom=="number"&&(this._targetZoom+=o)}if(this._delta!==0){let o=this._type==="wheel"&&Math.abs(this._delta)>Wm?this._wheelZoomRate:this._defaultZoomRate,s=EB/(1+Math.exp(-Math.abs(this._delta*o)));this._delta<0&&s!==0&&(s=1/s);let l=typeof this._targetZoom!="number"?e.scale:wt(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),Pt(l*s)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,i=this._startZoom,r=this._easing,n=!1,a;if(this._type==="wheel"&&i&&r){let o=me.now()-this._lastWheelEventTime,s=Math.min((o+kB)/200,1),l=r(s);a=Ue.number(i,t,l),s<1?this._frameId||(this._frameId=!0):n=!0}else a=t,n=!0;return this._active=!0,n&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=a,{noInertia:!0,needsRenderFrame:!n,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=_h;if(this._prevEase){let i=this._prevEase,r=(me.now()-i.start)/i.duration,n=i.easing(r+.01)-i.easing(r),a=.27/Math.sqrt(n*n+1e-4)*.01,o=Math.sqrt(.27*.27-a*a);t=xc(a,o,.25,1)}return this._prevEase={start:me.now(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},LB=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},zB=class{constructor(e){this._tr=new xo(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},FB=class{constructor(){this._tap=new cc({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,i);else{let r=t[0],n=e.timeStamp-this._tapTime<bx,a=this._tapPoint.dist(r)<Ap;!n||!a?this.reset():i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier)}}touchmove(e,t,i){if(!this._tapTime)this._tap.touchmove(e,t,i);else if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}touchend(e,t,i){if(this._tapTime)this._swipePoint&&i.length===0&&this.reset();else{let r=this._tap.touchend(e,t,i);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},BB=class{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},RB=class{constructor(e,t,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},OB=class{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},NB=class{constructor(e,t){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=ye.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t,this._container.appendChild(r);let n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ye.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new U("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},VB=ne(le(),1),Ts=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate,jB=class extends U{};function ch(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var GB=class{constructor(e,t){this.handleWindowEvent=r=>{this.handleEvent(r,"".concat(r.type,"Window"))},this.handleEvent=(r,n)=>{if(r.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let a=r.type==="renderFrame"?void 0:r,o={needsRenderFrame:!1},s={},l={};for(let{handlerName:c,handler:p,allowed:d}of this._handlers){if(!p.isEnabled())continue;let f;if(this._blockedByActive(l,d,c))p.reset();else if(p[n||r.type]){if(MT(r,n||r.type)){let y=ye.mousePos(this._map.getCanvas(),r);f=p[n||r.type](r,y)}else if(ST(r,n||r.type)){let y=r.touches,g=this._getMapTouches(y),_=ye.touchPos(this._map.getCanvas(),g);f=p[n||r.type](r,_,g)}else CT(n||r.type)||(f=p[n||r.type](r));this.mergeHandlerResult(o,s,f,c,a),f&&f.needsRenderFrame&&this._triggerRenderFrame()}(f||p.isActive())&&(l[c]=p)}let u={};for(let c in this._previousActiveHandlers)l[c]||(u[c]=a);this._previousActiveHandlers=l,(Object.keys(u).length||ch(o))&&(this._changes.push([o,s,u]),this._triggerRenderFrame()),(Object.keys(l).length||ch(o))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:h}=o;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new KF(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(t);let i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(let[r,n,a]of this._listeners)ye.addEventListener(r,n,r===document?this.handleWindowEvent:this.handleEvent,a)}destroy(){for(let[e,t,i]of this._listeners)ye.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new eB(t,e));let r=t.boxZoom=new rB(t,e);this._add("boxZoom",r),e.interactive&&e.boxZoom&&r.enable();let n=t.cooperativeGestures=new NB(t,e.cooperativeGestures);this._add("cooperativeGestures",n),e.cooperativeGestures&&n.enable();let a=new lB(t),o=new zB(t);t.doubleClickZoom=new LB(o,a),this._add("tapZoom",a),this._add("clickZoom",o),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let s=new FB;this._add("tapDragZoom",s);let l=t.touchPitch=new TB(t);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let u=()=>t.project(t.getCenter()),h=mB(e,u),c=yB(e),p=gB(e,u);t.dragRotate=new RB(e,h,c,p),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",c,["mouseRotate","mouseRoll"]),this._add("mouseRoll",p,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let d=fB(e),f=new _B(e,t);t.dragPan=new BB(i,d,f),this._add("mousePan",d),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let y=new wB,g=new vB;t.touchZoomRotate=new OB(i,g,y,s),this._add("touchRotate",y,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate);let _=t.scrollZoom=new DB(t,()=>this._triggerRenderFrame());this._add("scrollZoom",_,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let b=t.keyboard=new MB(t);this._add("keyboard",b),e.interactive&&e.keyboard&&t.keyboard.enable(),this._add("blockableMapEvent",new tB(t))}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ts(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e){let r=i.target;this._el.contains(r)&&t.push(i)}return t}mergeHandlerResult(e,t,i,r,n){if(!i)return;H(e,i);let a={handlerName:r,originalEvent:i.originalEvent||n};i.zoomDelta!==void 0&&(t.zoom=a),i.panDelta!==void 0&&(t.drag=a),i.rollDelta!==void 0&&(t.roll=a),i.pitchDelta!==void 0&&(t.pitch=a),i.bearingDelta!==void 0&&(t.rotate=a)}_applyChanges(){let e={},t={},i={};for(let[r,n,a]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new VB.default(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),r.rollDelta&&(e.rollDelta=(e.rollDelta||0)+r.rollDelta),r.around!==void 0&&(e.around=r.around),r.pinchAround!==void 0&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),H(t,n),H(i,a);this._updateMapTransform(e,t,i),this._changes=[]}_updateMapTransform(e,t,i){let r=this._map,n=r._getTransformForUpdate(),a=r.terrain;if(!ch(e)&&!(a&&this._terrainMovement))return this._fireEvents(t,i,!0);r._stop(!0);let{panDelta:o,zoomDelta:s,bearingDelta:l,pitchDelta:u,rollDelta:h,around:c,pinchAround:p}=e;p!==void 0&&(c=p),c=c||r.transform.centerPoint,a&&!n.isPointOnMapSurface(c)&&(c=n.centerPoint);let d={panDelta:o,zoomDelta:s,rollDelta:h,pitchDelta:u,bearingDelta:l,around:c};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(c)&&(c=n.centerPoint);let f=c.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(o?c.sub(o):c);a?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),!this._terrainMovement&&(t.drag||t.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(d,n,f)):t.drag&&this._terrainMovement?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(o))):this._map.cameraHelper.handleMapControlsPan(d,n,f)):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),this._map.cameraHelper.handleMapControlsPan(d,n,f)),r._applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_fireEvents(e,t,i){let r=Ts(this._eventsInProgress),n=Ts(e),a={};for(let h in e){let{originalEvent:c}=e[h];this._eventsInProgress[h]||(a["".concat(h,"start")]=c),this._eventsInProgress[h]=e[h]}!r&&n&&this._fireEvent("movestart",n.originalEvent);for(let h in a)this._fireEvent(h,a[h]);n&&this._fireEvent("move",n.originalEvent);for(let h in e){let{originalEvent:c}=e[h];this._fireEvent(h,c)}let o={},s;for(let h in this._eventsInProgress){let{handlerName:c,originalEvent:p}=this._eventsInProgress[h];this._handlersById[c].isActive()||(delete this._eventsInProgress[h],s=t[c]||p,o["".concat(h,"end")]=s)}for(let h in o)this._fireEvent(h,o[h]);let l=Ts(this._eventsInProgress),u=(r||n)&&!l;if(u&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let h=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&h.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(h)}if(i&&u){this._updatingCamera=!0;let h=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),c=p=>p!==0&&-this._bearingSnap<p&&p<this._bearingSnap;h&&(h.essential||!me.prefersReducedMotion)?(c(h.bearing||this._map.getBearing())&&(h.bearing=0),h.freezeElevation=!0,this._map.easeTo(h,{originalEvent:s})):(this._map.fire(new U("moveend",{originalEvent:s})),c(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new U(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new jB("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},Ta=ne(le(),1),UB=class extends Et{constructor(e,t,i){super(),this._renderFrameCallback=()=>{let r=Math.min((me.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(r)),r<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this.cameraHelper=t,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){e.apply(this.transform),this.transform=e,this.cameraHelper=t}getCenter(){return new re(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,i){return e=Ta.default.convert(e).mult(-1),this.panTo(this.transform.center,H({offset:e},t),i)}panTo(e,t,i){return this.easeTo(H({center:e},t),i)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,i){return this.easeTo(H({zoom:e},t),i)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new U("movestart",t)).fire(new U("move",t)).fire(new U("moveend",t))),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,i){return this.easeTo(H({bearing:e},t),i)}resetNorth(e,t){return this.rotateTo(0,H({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(H({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=Di.convert(e).adjustAntiMeridian();let i=t&&t.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,t,i,r){let n={top:0,bottom:0,right:0,left:0};if(r=H({padding:n,offset:[0,0],maxZoom:this.transform.maxZoom},r),typeof r.padding=="number"){let l=r.padding;r.padding={top:l,bottom:l,right:l,left:l}}let a=H(n,r.padding);r.padding=a;let o=this.transform,s=new Di(e,t);return this.cameraHelper.cameraForBoxAndBearing(r,a,s,i,o)}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,t,i,r,n){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(Ta.default.convert(e)),this.transform.screenPointToLocation(Ta.default.convert(t)),i,r),r,n)}_fitInternal(e,t,i){return e?(t=H(e,t),delete t.padding,t.linear?this.easeTo(t,i):this.flyTo(t,i)):this}jumpTo(e,t){this.stop();let i=this._getTransformForUpdate(),r=!1,n=!1,a=!1,o=i.zoom;this.cameraHelper.handleJumpToCenterZoom(i,e);let s=i.zoom!==o;return"elevation"in e&&i.elevation!==+e.elevation&&i.setElevation(+e.elevation),"bearing"in e&&i.bearing!==+e.bearing&&(r=!0,i.setBearing(+e.bearing)),"pitch"in e&&i.pitch!==+e.pitch&&(n=!0,i.setPitch(+e.pitch)),"roll"in e&&i.roll!==+e.roll&&(a=!0,i.setRoll(+e.roll)),e.padding!=null&&!i.isPaddingEqual(e.padding)&&i.setPadding(e.padding),this._applyUpdatedTransform(i),this.fire(new U("movestart",t)).fire(new U("move",t)),s&&this.fire(new U("zoomstart",t)).fire(new U("zoom",t)).fire(new U("zoomend",t)),r&&this.fire(new U("rotatestart",t)).fire(new U("rotate",t)).fire(new U("rotateend",t)),n&&this.fire(new U("pitchstart",t)).fire(new U("pitch",t)).fire(new U("pitchend",t)),a&&this.fire(new U("rollstart",t)).fire(new U("roll",t)).fire(new U("rollend",t)),this.fire(new U("moveend",t))}calculateCameraOptionsFromTo(e,t,i,r=0){let n=De.fromLngLat(e,t),a=De.fromLngLat(i,r),o=a.x-n.x,s=a.y-n.y,l=a.z-n.z,u=Math.hypot(o,s,l);if(u===0)throw new Error("Can't calculate camera options with same From and To");let h=Math.hypot(o,s),c=Pt(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=Math.atan2(o,-s)*180/Math.PI,d=Math.acos(h/u)*180/Math.PI;return d=l<0?90-d:90+d,{center:a.toLngLat(),elevation:r,zoom:c,pitch:d,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,n){let a=this.transform.calculateCenterFromCameraLngLatAlt(e,t,i,r);return{center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:i,pitch:r,roll:n}}easeTo(e,t){this._stop(!1,e.easeId),e=H({offset:[0,0],duration:500,easing:_h},e),(e.animate===!1||!e.essential&&me.prefersReducedMotion)&&(e.duration=0);let i=this._getTransformForUpdate(),r=this.getBearing(),n=i.pitch,a=i.roll,o="bearing"in e?this._normalizeBearing(e.bearing,r):r,s="pitch"in e?+e.pitch:n,l="roll"in e?this._normalizeBearing(e.roll,a):a,u="padding"in e?e.padding:i.padding,h=Ta.default.convert(e.offset),c,p;e.around&&(c=re.convert(e.around),p=i.locationToScreenPoint(c));let d={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(i,{bearing:o,pitch:s,roll:l,padding:u,around:c,aroundPoint:p,offsetAsPoint:h,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||r!==o,this._pitching=this._pitching||s!==n,this._rolling=this._rolling||l!==a,this._padding=!i.isPaddingEqual(u),this._zooming=this._zooming||f.isZooming,this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,d),this.terrain&&this._prepareElevation(f.elevationCenter),this._ease(y=>{f.easeFunc(y),this.terrain&&!e.freezeElevation&&this._updateElevation(y),this._applyUpdatedTransform(i),this._fireMoveEvents(t)},y=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,y)},e),this}_prepareEase(e,t,i={}){this._moving=!0,!t&&!i.moving&&this.fire(new U("movestart",e)),this._zooming&&!i.zooming&&this.fire(new U("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new U("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new U("pitchstart",e)),this._rolling&&!i.rolling&&this.fire(new U("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&t!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,r=(t-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-r),this._elevationTarget=t}this.transform.setElevation(Ue.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){return{}}_applyUpdatedTransform(e){let t=[];if(t.push(r=>this._elevateCameraIfInsideTerrain(r)),this.transformCameraUpdate&&t.push(r=>this.transformCameraUpdate(r)),!t.length)return;let i=e.clone();for(let r of t){let n=i.clone(),{center:a,zoom:o,roll:s,pitch:l,bearing:u,elevation:h}=r(n);a&&n.setCenter(a),h!==void 0&&n.setElevation(h),o!==void 0&&n.setZoom(o),s!==void 0&&n.setRoll(s),l!==void 0&&n.setPitch(l),u!==void 0&&n.setBearing(u),i.apply(n)}this.transform.apply(i)}_fireMoveEvents(e){this.fire(new U("move",e)),this._zooming&&this.fire(new U("zoom",e)),this._rotating&&this.fire(new U("rotate",e)),this._pitching&&this.fire(new U("pitch",e)),this._rolling&&this.fire(new U("roll",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let i=this._zooming,r=this._rotating,n=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new U("zoomend",e)),r&&this.fire(new U("rotateend",e)),n&&this.fire(new U("pitchend",e)),a&&this.fire(new U("rollend",e)),this.fire(new U("moveend",e))}flyTo(e,t){if(!e.essential&&me.prefersReducedMotion){let E=lo(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(E,t)}this.stop(),e=H({offset:[0,0],speed:1.2,curve:1.42,easing:_h},e);let i=this._getTransformForUpdate(),r=i.bearing,n=i.pitch,a=i.roll,o=i.padding,s="bearing"in e?this._normalizeBearing(e.bearing,r):r,l="pitch"in e?+e.pitch:n,u="roll"in e?this._normalizeBearing(e.roll,a):a,h="padding"in e?e.padding:i.padding,c=Ta.default.convert(e.offset),p=i.centerPoint.add(c),d=i.screenPointToLocation(p),f=this.cameraHelper.handleFlyTo(i,{bearing:s,pitch:l,roll:u,padding:h,locationAtOffset:d,offsetAsPoint:c,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),y=e.curve,g=Math.max(i.width,i.height),_=g/f.scaleOfZoom,b=f.pixelPathLength;if(typeof f.scaleOfMinZoom=="number"){let E=g/f.scaleOfMinZoom;y=Math.sqrt(E/b*2)}let v=y*y;function w(E){let D=(_*_-g*g+(E?-1:1)*v*v*b*b)/(2*(E?_:g)*v*b);return Math.log(Math.sqrt(D*D+1)-D)}function P(E){return(Math.exp(E)-Math.exp(-E))/2}function T(E){return(Math.exp(E)+Math.exp(-E))/2}function C(E){return P(E)/T(E)}let A=w(!1),k=function(E){return T(A)/T(A+y*E)},z=function(E){return g*((T(A)*C(A+y*E)-P(A))/v)/b},L=(w(!0)-A)/y;if(Math.abs(b)<2e-6||!isFinite(L)){if(Math.abs(g-_)<1e-6)return this.easeTo(e,t);let E=_<g?-1:1;L=Math.abs(Math.log(_/g))/y,z=()=>0,k=D=>Math.exp(E*y*D)}if("duration"in e)e.duration=+e.duration;else{let E="screenSpeed"in e?+e.screenSpeed/y:+e.speed;e.duration=1e3*L/E}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=r!==s,this._pitching=l!==n,this._rolling=u!==a,this._padding=!i.isPaddingEqual(h),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(f.targetCenter),this._ease(E=>{let D=E*L,x=1/k(D),M=z(D);this._rotating&&i.setBearing(Ue.number(r,s,E)),this._pitching&&i.setPitch(Ue.number(n,l,E)),this._rolling&&i.setRoll(Ue.number(a,u,E)),this._padding&&(i.interpolatePadding(o,h,E),p=i.centerPoint.add(c)),f.easeFunc(E,x,M,p),this.terrain&&!e.freezeElevation&&this._updateElevation(E),this._applyUpdatedTransform(i),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,t)}return e||((i=this.handlers)==null||i.stop(!1)),this}_ease(e,t,i){i.animate===!1||i.duration===0?(e(1),t()):(this._easeStart=me.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=jr(e,-180,180);let i=Math.abs(e-t);return Math.abs(e-360-t)<i&&(e-=360),Math.abs(e+360-t)<i&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(re.convert(e),this.transform.tileZoom):null}},hr=ne(le(),1),wx={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},XB=class{constructor(e=wx){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&(t.sourceDataType==="metadata"||t.sourceDataType==="visibility"||t.dataType==="style"||t.type==="terrain")&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=ye.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ye.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ye.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){ye.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let i=this._map._getUIString("AttributionControl.".concat(t));e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(r=>typeof r!="string"?"":r)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let r=this._map.style.stylesheet;this.styleOwner=r.owner,this.styleId=r.id}let t=this._map.style.sourceCaches;for(let r in t){let n=t[r];if(n.used||n.usedForTerrain){let a=n.getSource();a.attribution&&e.indexOf(a.attribution)<0&&e.push(a.attribution)}}e=e.filter(r=>String(r).trim()),e.sort((r,n)=>r.length-n.length),e=e.filter((r,n)=>{for(let a=n+1;a<e.length;a++)if(e[a].indexOf(r)>=0)return!1;return!0});let i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=ye.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},$B=class{constructor(e={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let i=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&i.classList.add("maplibregl-compact"):i.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=ye.create("div","maplibregl-ctrl");let t=ye.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ye.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},qB=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(let r of i)if(r.id===e){r.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];for(let i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}},pc=(e=>(e.create="create",e.load="load",e.fullLoad="fullLoad",e))(pc||{}),Ss=null,Sa=[],YB=60,ph=1e3/YB,dh="loadTime",fh="fullLoadTime",Ma={mark(e){performance.mark(e)},frame(e){let t=e;if(Ss!=null){let i=t-Ss;Sa.push(i)}Ss=t},clearMetrics(){Ss=null,Sa=[],performance.clearMeasures(dh),performance.clearMeasures(fh);for(let e in pc)performance.clearMarks(pc[e])},getPerformanceMetrics(){performance.measure(dh,"create","load"),performance.measure(fh,"create","fullLoad");let e=performance.getEntriesByName(dh)[0].duration,t=performance.getEntriesByName(fh)[0].duration,i=Sa.length,r=1/(Sa.reduce((o,s)=>o+s,0)/i/1e3),n=Sa.filter(o=>o>ph).reduce((o,s)=>o+(s-ph)/ph,0),a=n/(i+n)*100;return{loadTime:e,fullLoadTime:t,fps:r,percentDroppedFrames:a,totalFrames:i}}},ZB=We([{name:"a_pos3d",type:"Int16",components:3}]),WB=class extends Et{constructor(e){super(),this._lastTilesetChange=me.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,t){this.sourceCache.update(e,t),this._renderableTilesKeys=[];let i={};for(let r of Bl(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))i[r.key]=!0,this._renderableTilesKeys.push(r.key),this._tiles[r.key]||(r.terrainRttPosMatrix32f=new Float64Array(16),O.ortho(r.terrainRttPosMatrix32f,0,8192,8192,0,0,1),this._tiles[r.key]=new k0(r,this.tileSize),this._lastTilesetChange=me.now());for(let r in this._tiles)i[r]||delete this._tiles[r]}freeRtt(e){for(let t in this._tiles){let i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t={};for(let i of this._renderableTilesKeys){let r=this._tiles[i].tileID,n=e.clone(),a=yr();if(r.canonical.equals(e.canonical))O.ortho(a,0,8192,8192,0,0,1);else if(r.canonical.isChildOf(e.canonical)){let o=r.canonical.z-e.canonical.z,s=r.canonical.x-(r.canonical.x>>o<<o),l=r.canonical.y-(r.canonical.y>>o<<o),u=8192>>o;O.ortho(a,0,u,u,0,0,1),O.translate(a,a,[-s*u,-l*u,0])}else if(e.canonical.isChildOf(r.canonical)){let o=e.canonical.z-r.canonical.z,s=e.canonical.x-(e.canonical.x>>o<<o),l=e.canonical.y-(e.canonical.y>>o<<o),u=8192>>o;O.ortho(a,0,8192,8192,0,0,1),O.translate(a,a,[s*u,l*u,0]),O.scale(a,a,[1/2**o,1/2**o,0])}else continue;n.terrainRttPosMatrix32f=new Float32Array(a),t[i]=n}return t}_getTerrainCoordsForTileRanges(e,t){let i={};for(let r of this._renderableTilesKeys){let n=this._tiles[r].tileID;if(!this._isWithinTileRanges(n,t))continue;let a=e.clone(),o=yr();if(n.canonical.z===e.canonical.z){let s=e.canonical.x-n.canonical.x,l=e.canonical.y-n.canonical.y;O.ortho(o,0,8192,8192,0,0,1),O.translate(o,o,[s*8192,l*8192,0])}else if(n.canonical.z>e.canonical.z){let s=n.canonical.z-e.canonical.z,l=n.canonical.x-(n.canonical.x>>s<<s),u=n.canonical.y-(n.canonical.y>>s<<s),h=e.canonical.x-(n.canonical.x>>s),c=e.canonical.y-(n.canonical.y>>s),p=8192>>s;O.ortho(o,0,p,p,0,0,1),O.translate(o,o,[-l*p+h*8192,-u*p+c*8192,0])}else{let s=e.canonical.z-n.canonical.z,l=e.canonical.x-(e.canonical.x>>s<<s),u=e.canonical.y-(e.canonical.y>>s<<s),h=(e.canonical.x>>s)-n.canonical.x,c=(e.canonical.y>>s)-n.canonical.y,p=8192<<s;O.ortho(o,0,p,p,0,0,1),O.translate(o,o,[l*8192+h*p,u*8192+c*p,0])}a.terrainRttPosMatrix32f=new Float32Array(o),i[r]=a}return i}getSourceTile(e,t){let i=this.sourceCache._source,r=e.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(r).key);let n=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if(!(n&&n.dem)&&t)for(;r>=i.minzoom&&!(n&&n.dem);)n=this.sourceCache.getTileByID(e.scaledTo(r--).key);return n}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){return t[e.canonical.z]&&e.canonical.x>=t[e.canonical.z].minTileX&&e.canonical.x<=t[e.canonical.z].maxTileX&&e.canonical.y>=t[e.canonical.z].minTileY&&e.canonical.y<=t[e.canonical.z].maxTileY}},HB=class{constructor(e,t,i){this._meshCache={},this.painter=e,this.sourceCache=new WB(t),this.options=i,this.exaggeration=typeof i.exaggeration=="number"?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,t,i,r=8192){var p;if(!(t>=0&&t<r&&i>=0&&i<r))return 0;let n=this.getTerrainData(e),a=(p=n.tile)==null?void 0:p.dem;if(!a)return 0;let o=It.transformMat4([],[t/r*8192,i/r*8192],n.u_terrain_matrix),s=[o[0]*a.dim,o[1]*a.dim],l=Math.floor(s[0]),u=Math.floor(s[1]),h=s[0]-l,c=s[1]-u;return a.get(l,u)*(1-h)*(1-c)+a.get(l+1,u)*h*(1-c)+a.get(l,u+1)*(1-h)*c+a.get(l+1,u+1)*h*c}getElevationForLngLatZoom(e,t){if(!d3(t,e.wrap()))return 0;let{tileID:i,mercatorX:r,mercatorY:n}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(i,r%8192,n%8192,8192)}getElevation(e,t,i,r=8192){return this.getDEMElevation(e,t,i,r)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let r=this.painter.context,n=new Ne({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Qe(r,n,r.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Qe(r,new Ne({width:1,height:1}),r.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=O.identity([])}let t=this.sourceCache.getSourceTile(e,!0);if(t&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let r=this.painter.context;t.demTexture=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new Qe(r,t.dem.getPixels(),r.gl.RGBA,{premultiply:!1}),t.demTexture.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let i=t&&t+t.tileID.key+e.key;if(i&&!this._demMatrixCache[i]){let r=this.sourceCache.sourceCache._source.maxzoom,n=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=r?n=e.canonical.z-r:nt("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=e.canonical.x-(e.canonical.x>>n<<n),o=e.canonical.y-(e.canonical.y>>n<<n),s=O.fromScaling(new Float64Array(16),[1/(8192<<n),1/(8192<<n),0]);O.translate(s,s,[a*8192,o*8192,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:t&&t.dem&&t.dem.dim||1,u_terrain_matrix:i?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:t&&t.dem&&t.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t&&t.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(e){let t=this.painter,i=t.width/devicePixelRatio,r=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==i||this._fbo.height!==r)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Qe(t.context,{width:i,height:r,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Qe(t.context,{width:i,height:r,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(i,r,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,i,r))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let t=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let n=0,a=0;n<this._coordsTextureSize;n++)for(let o=0;o<this._coordsTextureSize;o++,a+=4)t[a+0]=o&255,t[a+1]=n&255,t[a+2]=o>>8<<4|n>>8,t[a+3]=0;let i=new Ne({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(t.buffer)),r=new Qe(e,i,e.gl.RGBA,{premultiply:!1});return r.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=r,r}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let t=new Uint8Array(4),i=this.painter.context,r=i.gl,n=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),o=Math.round(this.painter.height/devicePixelRatio);i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),r.readPixels(n,o-a-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null);let s=t[0]+(t[2]>>4<<8),l=t[1]+((t[2]&15)<<8),u=this.coordsIndex[255-t[3]],h=u&&this.sourceCache.getTileByID(u);if(!h)return null;let c=this._coordsTextureSize,p=(1<<h.tileID.canonical.z)*c;return new De((h.tileID.canonical.x*c+s)/p+h.tileID.wrap,(h.tileID.canonical.y*c+l)/p,this.getElevation(h.tileID,s,l,c))}depthAtPoint(e){let t=new Uint8Array(4),i=this.painter.context,r=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),r.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/(256*256*256)+t[1]/(256*256)+t[2]/256+t[3])/256}getTerrainMesh(e){var T;let t=((T=this.painter.style.projection)==null?void 0:T.transitionState)>0,i=t&&e.canonical.y===0,r=t&&e.canonical.y===(1<<e.canonical.z)-1,n="m_".concat(i?"n":"","_").concat(r?"s":"");if(this._meshCache[n])return this._meshCache[n];let a=this.painter.context,o=new ZC,s=new yi,l=this.meshSize,u=8192/l,h=l*l;for(let C=0;C<=l;C++)for(let A=0;A<=l;A++)o.emplaceBack(A*u,C*u,0);for(let C=0;C<h;C+=l+1)for(let A=0;A<l;A++)s.emplaceBack(A+C,l+A+C+1,l+A+C+2),s.emplaceBack(A+C,l+A+C+2,A+C+1);let c=o.length,p=0,d=c+(l+1),f=(l+1)*l,y=i?mr:0,g=i?0:1,_=r?Nr:8192,b=r?0:1;for(let C=0;C<=l;C++)o.emplaceBack(C*u,y,g);for(let C=0;C<=l;C++)o.emplaceBack(C*u,_,b);for(let C=0;C<l;C++)s.emplaceBack(f+C,d+C,d+C+1),s.emplaceBack(f+C,d+C+1,f+C+1),s.emplaceBack(p+C,c+C+1,c+C),s.emplaceBack(p+C,p+C+1,c+C+1);let v=o.length,w=v+(l+1)*2;for(let C of[0,1])for(let A=0;A<=l;A++)for(let k of[0,1])o.emplaceBack(C*8192,A*u,k);for(let C=0;C<l*2;C+=2)s.emplaceBack(v+C,v+C+1,v+C+3),s.emplaceBack(v+C,v+C+3,v+C+2),s.emplaceBack(w+C,w+C+3,w+C+1),s.emplaceBack(w+C,w+C+2,w+C+3);let P=new Zn(a.createVertexBuffer(o,ZB.members),a.createIndexBuffer(s),Be.simpleSegment(0,0,o.length,s.length));return this._meshCache[n]=P,P}getMeshFrameDelta(e){return 2*Math.PI*Pi/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,t){var r;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return(r=this.getMinMaxElevation(i).minElevation)!=null?r:0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,i={minElevation:null,maxElevation:null};return t&&t.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,t){let i=De.fromLngLat(e.wrap()),r=(1<<t)*8192,n=i.x*r,a=i.y*r,o=Math.floor(n/8192),s=Math.floor(a/8192);return{tileID:new gt(t,0,t,o,s),mercatorX:n,mercatorY:a}}},KB=class{constructor(e,t,i){this._context=e,this._size=t,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let t=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new Qe(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),t.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),t.colorAttachment.set(i.texture),{id:e,fbo:t,texture:i,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(t=>e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return this._objects.length<this._size?!1:this._objects.some(e=>!e.inUse)===!1}},gn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},JB=class{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new KB(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t)),this._coordsAscending={};for(let i in e.sourceCaches){this._coordsAscending[i]={};let r=e.sourceCaches[i].getVisibleCoordinates(),n=e.sourceCaches[i].getSource(),a=n instanceof go?n.terrainTileRanges:null;for(let o of r){let s=this.terrain.sourceCache.getTerrainCoords(o,a);for(let l in s)this._coordsAscending[i][l]||(this._coordsAscending[i][l]=[]),this._coordsAscending[i][l].push(s[l])}}this._coordsAscendingStr={};for(let i of e._order){let r=e._layers[i],n=r.source;if(gn[r.type]&&!this._coordsAscendingStr[n]){this._coordsAscendingStr[n]={};for(let a in this._coordsAscending[n])this._coordsAscendingStr[n][a]=this._coordsAscending[n][a].map(o=>o.key).sort().join()}}for(let i of this._renderableTiles)for(let r in this._coordsAscendingStr){let n=this._coordsAscendingStr[r][i.tileID.key];n&&n!==i.rttCoords[r]&&(i.rtt=[])}}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let i=Ht(He({},t),{isRenderingToTexture:!0}),r=e.type,n=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(gn[r]&&((!this._prevType||!gn[this._prevType])&&this._stacks.push([]),this._prevType=r,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(gn[this._prevType]||gn[r]&&a){this._prevType=r;let o=this._stacks.length-1,s=this._stacks[o]||[];for(let l of this._renderableTiles){if(this.pool.isFull()&&(qm(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(l),l.rtt[o]){let h=this.pool.getObjectForId(l.rtt[o].id);if(h.stamp===l.rtt[o].stamp){this.pool.useObject(h);continue}}let u=this.pool.getOrCreateFreeObject();this.pool.useObject(u),this.pool.stampObject(u),l.rtt[o]={id:u.id,stamp:u.stamp},n.context.bindFramebuffer.set(u.fbo.framebuffer),n.context.clear({color:J.transparent,stencil:0}),n.currentStencilSource=void 0;for(let h=0;h<s.length;h++){let c=n.style._layers[s[h]],p=c.source?this._coordsAscending[c.source][l.tileID.key]:[l.tileID];n.context.viewport.set([0,0,u.fbo.width,u.fbo.height]),n._renderTileClippingMasks(c,p,!0),n.renderLayer(n,n.style.sourceCaches[c.source],c,p,i),c.source&&(l.rttCoords[c.source]=this._coordsAscendingStr[c.source][l.tileID.key])}}return qm(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects(),gn[r]}return!1}},QB={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},eR=ty.version,Ns=-2,Px=22,fr=0,Tx=60,Ms=180,Hm={hash:!1,interactive:!0,bearingSnap:7,attributionControl:wx,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:Ns,maxZoom:Px,minPitch:fr,maxPitch:Tx,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:br.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},vV=class extends UB{constructor(e){var o,s;Ma.mark("create");let t=Ht(He(He({},Hm),e),{canvasContextAttributes:He(He({},Hm.canvasContextAttributes),e.canvasContextAttributes)});if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<fr)throw new Error("minPitch must be greater than or equal to ".concat(fr));if(t.maxPitch!=null&&t.maxPitch>Ms)throw new Error("maxPitch must be less than or equal to ".concat(Ms));let i=new Qs,r=new el;if(t.minZoom!==void 0&&i.setMinZoom(t.minZoom),t.maxZoom!==void 0&&i.setMaxZoom(t.maxZoom),t.minPitch!==void 0&&i.setMinPitch(t.minPitch),t.maxPitch!==void 0&&i.setMaxPitch(t.maxPitch),t.renderWorldCopies!==void 0&&i.setRenderWorldCopies(t.renderWorldCopies),super(i,r,{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new qB,this._controls=[],this._mapId=og(),this._contextLost=l=>{l.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new U("webglcontextlost",{originalEvent:l}))},this._contextRestored=l=>{this._setupPainter(),this.resize(),this._update(),this.fire(new U("webglcontextrestored",{originalEvent:l}))},this._onMapScroll=l=>{if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes=He({},t.canvasContextAttributes),this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._centerClampedToGround=t.centerClampedToGround,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=He(He({},QB),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Ci.addThrottleControl(()=>this.isMoving()),this._requestManager=new RT(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error("Container '".concat(t.container,"' not found."))}else if(t.container instanceof HTMLElement)this._container=t.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let l=!1,u=vx(h=>{this._trackResize&&!this._removed&&(this.resize(h),this.redraw())},50);this._resizeObserver=new ResizeObserver(h=>{if(!l){l=!0;return}u(h)}),this._resizeObserver.observe(this._container)}this.handlers=new GB(this,t);let n=typeof t.hash=="string"&&t.hash||void 0;this._hash=t.hash&&new XF(n).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,H({},t.fitBoundsOptions,{duration:0}))));let a=typeof t.style=="string"||((s=(o=t.style)==null?void 0:o.projection)==null?void 0:s.type)!=="globe";this.resize(null,a),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new XB(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new $B,t.logoPosition),this.on("style.load",()=>{if(a||this._resizeTransform(),this.transform.unmodified){let l=lo(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(l)}}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(new U("".concat(l.dataType,"data"),l))}),this.on("dataloading",l=>{this.fire(new U("".concat(l.dataType,"dataloading"),l))}),this.on("dataabort",l=>{this.fire(new U("sourcedataabort",l))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(t===void 0&&(e.getDefaultPosition?t=e.getDefaultPosition():t="top-right"),!e||!e.onAdd)return this.fire(new te(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=e.onAdd(this);this._controls.push(e);let r=this._controlPositions[t];return t.indexOf("bottom")!==-1?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new te(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,i,r){return r==null&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(e,t,i,r)}resize(e,t=!0){let[i,r]=this._containerDimensions(),n=this._getClampedPixelRatio(i,r);if(this._resizeCanvas(i,r,n),this.painter.resize(i,r,n),this.painter.overLimit()){let o=this.painter.context.gl;this._maxCanvasSize=[o.drawingBufferWidth,o.drawingBufferHeight];let s=this._getClampedPixelRatio(i,r);this._resizeCanvas(i,r,s),this.painter.resize(i,r,s)}this._resizeTransform(t);let a=!this._moving;return a&&(this.stop(),this.fire(new U("movestart",e)).fire(new U("move",e))),this.fire(new U("resize",e)),a&&this.fire(new U("moveend",e)),this}_resizeTransform(e=!0){var r;let[t,i]=this._containerDimensions();this.transform.resize(t,i,e),(r=this._requestedCameraState)==null||r.resize(t,i,e)}_getClampedPixelRatio(e,t){let{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),a=e*n,o=t*n,s=a>i?i/a:1,l=o>r?r/o:1;return Math.min(s,l)*n}getPixelRatio(){var e;return(e=this._overridePixelRatio)!=null?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(Di.convert(e)),this._update()}setMinZoom(e){if(e=e!=null?e:Ns,e>=Ns&&e<=this.transform.maxZoom)return this.transform.setMinZoom(e),this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error("minZoom must be between ".concat(Ns," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if(e=e!=null?e:Px,e>=this.transform.minZoom)return this.transform.setMaxZoom(e),this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if(e=e!=null?e:fr,e<fr)throw new Error("minPitch must be greater than or equal to ".concat(fr));if(e>=fr&&e<=this.transform.maxPitch)return this.transform.setMinPitch(e),this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between ".concat(fr," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if(e=e!=null?e:Tx,e>Ms)throw new Error("maxPitch must be less than or equal to ".concat(Ms));if(e>=this.transform.minPitch)return this.transform.setMaxPitch(e),this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}project(e){return this.transform.locationToScreenPoint(re.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(hr.default.convert(e),this.terrain)}isMoving(){var e;return this._moving||((e=this.handlers)==null?void 0:e.isMoving())}isZooming(){var e;return this._zooming||((e=this.handlers)==null?void 0:e.isZooming())}isRotating(){var e;return this._rotating||((e=this.handlers)==null?void 0:e.isRotating())}_createDelegatedListener(e,t,i){if(e==="mouseenter"||e==="mouseover"){let r=!1;return{layers:t,listener:i,delegates:{mousemove:n=>{let a=t.filter(s=>this.getLayer(s)),o=a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[];o.length?r||(r=!0,i.call(this,new ei(e,this,n.originalEvent,{features:o}))):r=!1},mouseout:()=>{r=!1}}}}else if(e==="mouseleave"||e==="mouseout"){let r=!1;return{layers:t,listener:i,delegates:{mousemove:n=>{let a=t.filter(o=>this.getLayer(o));(a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[]).length?r=!0:r&&(r=!1,i.call(this,new ei(e,this,n.originalEvent)))},mouseout:n=>{r&&(r=!1,i.call(this,new ei(e,this,n.originalEvent)))}}}}else{let r=n=>{let a=t.filter(s=>this.getLayer(s)),o=a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[];o.length&&(n.features=o,i.call(this,n),delete n.features)};return{layers:t,listener:i,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){if(!this._delegatedListeners||!this._delegatedListeners[e])return;let r=this._delegatedListeners[e];for(let n=0;n<r.length;n++){let a=r[n];if(a.listener===i&&a.layers.length===t.length&&a.layers.every(o=>t.includes(o))){for(let o in a.delegates)this.off(o,a.delegates[o]);r.splice(n,1);return}}}on(e,t,i){if(i===void 0)return super.on(e,t);let r=typeof t=="string"?[t]:t,n=this._createDelegatedListener(e,r,i);this._saveDelegatedListener(e,n);for(let a in n.delegates)this.on(a,n.delegates[a]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t,i){if(i===void 0)return super.once(e,t);let r=typeof t=="string"?[t]:t,n=this._createDelegatedListener(e,r,i);for(let a in n.delegates){let o=n.delegates[a];n.delegates[a]=(...s)=>{this._removeDelegatedListener(e,r,i),o(...s)}}this._saveDelegatedListener(e,n);for(let a in n.delegates)this.once(a,n.delegates[a]);return this}off(e,t,i){if(i===void 0)return super.off(e,t);let r=typeof t=="string"?[t]:t;return this._removeDelegatedListener(e,r,i),this}queryRenderedFeatures(e,t){if(!this.style)return[];let i,r=e instanceof hr.default||Array.isArray(e),n=r?e:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(r?{}:e)||{},n instanceof hr.default||typeof n[0]=="number")i=[hr.default.convert(n)];else{let a=hr.default.convert(n[0]),o=hr.default.convert(n[1]);i=[a,new hr.default(o.x,a.y),o,new hr.default(a.x,o.y),a]}return this.style.queryRenderedFeatures(i,t,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=H({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),t.diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(t==null)throw new Error("Missing UI string '".concat(e,"'"));return t}_updateStyle(e,t){var r,n;if(t.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,t));return}let i=this.style&&t.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new Rm(this,t||{});else return(n=(r=this.style)==null?void 0:r.projection)==null||n.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,t,i):this.style.loadJSON(e,t,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new Rm(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,t){if(typeof e=="string"){let i=e,r=this._requestManager.transformRequest(i,"Style");ll(r,new AbortController).then(n=>{this._updateDiff(n.data,t)}).catch(n=>{n&&this.fire(new te(n))})}else typeof e=="object"&&this._updateDiff(e,t)}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(i){nt("Unable to perform style diff: ".concat(i.message||i.error||i,". Rebuilding the style from scratch.")),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():nt("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style&&this.style.sourceCaches[e];if(t===void 0){this.fire(new te(new Error("There is no source with ID '".concat(e,"'"))));return}return t.loaded()}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this._centerClampedToGround&&this.transform.setElevation(0);else{let t=this.style.sourceCaches[e.source];if(!t)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(e.source));this.terrain===null&&t.reload();for(let i in this.style._layers){let r=this.style._layers[i];r.type==="hillshade"&&r.source===e.source&&nt("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),r.type==="color-relief"&&r.source===e.source&&nt("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new HB(this.painter,t,e),this.painter.renderToTexture=new JB(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var r;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId===e.source&&!this._elevationFreeze&&(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((r=i.source)==null?void 0:r.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new U("terrain",{terrain:e})),this}getTerrain(){var e,t;return(t=(e=this.terrain)==null?void 0:e.options)!=null?t:null}areTilesLoaded(){let e=this.style&&this.style.sourceCaches;for(let t in e){let i=e[t]._tiles;for(let r in i){let n=i[r];if(!(n.state==="loaded"||n.state==="errored"))return!1}}return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,i){if(i){let r=this.getSource(i);if(!r)throw new Error('There is no source with ID "'.concat(i,'", cannot set LOD parameters'));r.calculateTileZoom=rc(Math.max(1,e),Math.max(1,t))}else for(let r in this.style.sourceCaches)this.style.sourceCaches[r].getSource().calculateTileZoom=rc(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let i=this.style.sourceCaches[e];if(!i)throw new Error('There is no source cache with ID "'.concat(e,'", cannot refresh tile'));t===void 0?i.reload(!0):i.refreshTiles(t.map(r=>new zl(r.z,r.x,r.y)))}addImage(e,t,i={}){let{pixelRatio:r=1,sdf:n=!1,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u}=i;this._lazyInitEmptyStyle();let h=0;if(t instanceof HTMLImageElement||Zi(t)){let{width:c,height:p,data:d}=me.getImageData(t);this.style.addImage(e,{data:new Ne({width:c,height:p},d),pixelRatio:r,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:h})}else{if(t.width===void 0||t.height===void 0)return this.fire(new te(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:c,height:p,data:d}=t,f=t;return this.style.addImage(e,{data:new Ne({width:c,height:p},new Uint8Array(d)),pixelRatio:r,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:h,userImage:f}),f.onAdd&&f.onAdd(this,e),this}}}updateImage(e,t){let i=this.style.getImage(e);if(!i)return this.fire(new te(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let r=t instanceof HTMLImageElement||Zi(t)?me.getImageData(t):t,{width:n,height:a,data:o}=r;if(n===void 0||a===void 0)return this.fire(new te(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(n!==i.data.width||a!==i.data.height)return this.fire(new te(new Error("The width and height of the updated image must be that same as the previous version of the image")));let s=!(t instanceof HTMLImageElement||Zi(t));return i.data.replace(o,s),this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new te(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return Ci.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,r={}){return this.style.setPaintProperty(e,t,i,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,r={}){return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,r=>{r||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,i=>{i||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let t=this._canvasContainer=ye.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ye.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);let n=this._controlContainer=ye.create("div","maplibregl-control-container",e),a=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(o=>{a[o]=ye.create("div","maplibregl-ctrl-".concat(o," "),n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width="".concat(e,"px"),this._canvas.style.height="".concat(t,"px")}_setupPainter(){let e=Ht(He({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),t=null;this._canvas.addEventListener("webglcontextcreationerror",r=>{t={requestedAttributes:e},r&&(t.statusMessage=r.statusMessage,t.type=r.type)},{once:!0});let i=null;if(this._canvasContextAttributes.contextType?i=this._canvas.getContext(this._canvasContextAttributes.contextType,e):i=this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!i){let r="Failed to initialize WebGL";throw t?(t.message=r,new Error(JSON.stringify(t))):new Error(r)}this.painter=new UF(i,this.transform),Pc.testSupport(i)}migrateProjection(e,t){super.migrateProjection(e,t),this.painter.transform=e,this.fire(new U("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var o,s,l,u,h;let t=this._idleTriggered?this._fadeDuration:0,i=((o=this.style.projection)==null?void 0:o.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let c=this.transform.zoom,p=me.now();this.style.zoomHistory.update(c,p);let d=new et(c,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),f=d.crossFadingFactor();(f!==1||f!==this._crossFadingFactor)&&(r=!0,this._crossFadingFactor=f),this.style.update(d)}let n=((s=this.style.projection)==null?void 0:s.transitionState)>0!==i;(l=this.style.projection)==null||l.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((u=this.style.projection)==null?void 0:u.transitionState,(h=this.style.projection)==null?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||n)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):this._centerClampedToGround&&this.transform.setElevation(0),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,n),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new U("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,Ma.mark("load"),this.fire(new U("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new U("idle")),this._loaded&&!this._fullyLoaded&&!a&&(this._fullyLoaded=!0,Ma.mark("fullLoad")),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Ci.removeThrottleControl(this._imageQueueHandle),(t=this._resizeObserver)==null||t.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ye.remove(this._canvasContainer),ye.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),Ma.clearMetrics(),this._removed=!0,this.fire(new U("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,me.frame(this._frameRequest,e=>{Ma.frame(e),this._frameRequest=null;try{this._render(e)}catch(t){if(!IT(t)&&!Jz(t))throw t}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return eR}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},bV=ne(le(),1);var wV=ne(le(),1);var PV=ne(le(),1);var TV=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");var tR=ne(le(),1),SV=ty.version;function MV(e){br.WORKER_URL=e}var CV=tR.default;F();F();F();F();F();F();F();var Tt=63710088e-1,Mx={centimeters:Tt*100,centimetres:Tt*100,degrees:Tt/111325,feet:Tt*3.28084,inches:Tt*39.37,kilometers:Tt/1e3,kilometres:Tt/1e3,meters:Tt,metres:Tt,miles:Tt/1609.344,millimeters:Tt*1e3,millimetres:Tt*1e3,nauticalmiles:Tt/1852,radians:1,yards:Tt*1.0936},DX={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Tt,yards:1.0936133};function Sr(e,t,i){i===void 0&&(i={});var r={type:"Feature"};return(i.id===0||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=t||{},r.geometry=e,r}function iR(e,t,i){if(i===void 0&&(i={}),!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(!Sx(e[0])||!Sx(e[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:e};return Sr(r,t,i)}function LX(e,t,i){i===void 0&&(i={});for(var r=0,n=e;r<n.length;r++){var a=n[r];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var o=0;o<a[a.length-1].length;o++)if(a[a.length-1][o]!==a[0][o])throw new Error("First and last Position are not equivalent.")}var s={type:"Polygon",coordinates:e};return Sr(s,t,i)}function Cx(e,t,i){if(i===void 0&&(i={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var r={type:"LineString",coordinates:e};return Sr(r,t,i)}function zX(e,t){t===void 0&&(t={});var i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function FX(e,t,i){i===void 0&&(i={});var r={type:"MultiLineString",coordinates:e};return Sr(r,t,i)}function BX(e,t,i){i===void 0&&(i={});var r={type:"MultiPolygon",coordinates:e};return Sr(r,t,i)}function RX(e,t){t===void 0&&(t="kilometers");var i=Mx[t];if(!i)throw new Error(t+" units is invalid");return e*i}function OX(e,t){t===void 0&&(t="kilometers");var i=Mx[t];if(!i)throw new Error(t+" units is invalid");return e/i}function NX(e){var t=e%(2*Math.PI);return t*180/Math.PI}function VX(e){var t=e%360;return t*Math.PI/180}function Sx(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function jl(e,t,i){if(e!==null)for(var r,n,a,o,s,l,u,h=0,c=0,p,d=e.type,f=d==="FeatureCollection",y=d==="Feature",g=f?e.features.length:1,_=0;_<g;_++){u=f?e.features[_].geometry:y?e.geometry:e,p=u?u.type==="GeometryCollection":!1,s=p?u.geometries.length:1;for(var b=0;b<s;b++){var v=0,w=0;if(o=p?u.geometries[b]:u,o!==null){l=o.coordinates;var P=o.type;switch(h=i&&(P==="Polygon"||P==="MultiPolygon")?1:0,P){case null:break;case"Point":if(t(l,c,_,v,w)===!1)return!1;c++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(t(l[r],c,_,v,w)===!1)return!1;c++,P==="MultiPoint"&&v++}P==="LineString"&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(n=0;n<l[r].length-h;n++){if(t(l[r][n],c,_,v,w)===!1)return!1;c++}P==="MultiLineString"&&v++,P==="Polygon"&&w++}P==="Polygon"&&v++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(w=0,n=0;n<l[r].length;n++){for(a=0;a<l[r][n].length-h;a++){if(t(l[r][n][a],c,_,v,w)===!1)return!1;c++}w++}v++}break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(jl(o.geometries[r],t,i)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function $X(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var i=0;i<e.features.length&&t(e.features[i],i)!==!1;i++);}function rR(e,t){var i,r,n,a,o,s,l,u,h,c,p=0,d=e.type==="FeatureCollection",f=e.type==="Feature",y=d?e.features.length:1;for(i=0;i<y;i++){for(s=d?e.features[i].geometry:f?e.geometry:e,u=d?e.features[i].properties:f?e.properties:{},h=d?e.features[i].bbox:f?e.bbox:void 0,c=d?e.features[i].id:f?e.id:void 0,l=s?s.type==="GeometryCollection":!1,o=l?s.geometries.length:1,n=0;n<o;n++){if(a=l?s.geometries[n]:s,a===null){if(t(null,p,u,h,c)===!1)return!1;continue}switch(a.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(a,p,u,h,c)===!1)return!1;break}case"GeometryCollection":{for(r=0;r<a.geometries.length;r++)if(t(a.geometries[r],p,u,h,c)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}p++}}function nR(e,t){rR(e,function(i,r,n,a,o){var s=i===null?null:i.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return t(Sr(i,n,{bbox:a,id:o}),r,0)===!1?!1:void 0}var l;switch(s){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var u=0;u<i.coordinates.length;u++){var h=i.coordinates[u],c={type:l,coordinates:h};if(t(Sr(c,n),r,u)===!1)return!1}})}function aR(e,t){nR(e,function(i,r,n){var a=0;if(i.geometry){var o=i.geometry.type;if(!(o==="Point"||o==="MultiPoint")){var s,l=0,u=0,h=0;if(jl(i,function(c,p,d,f,y){if(s===void 0||r>l||f>u||y>h){s=c,l=r,u=f,h=y,a=0;return}var g=Cx([s,c],i.properties);if(t(g,r,n,y,a)===!1)return!1;a++,s=c})===!1)return!1}}})}function qX(e,t,i){var r=i,n=!1;return aR(e,function(a,o,s,l,u){n===!1&&i===void 0?r=a:r=t(r,a,o,s,l,u),n=!0}),r}function Lp(e){var t=[1/0,1/0,-1/0,-1/0];return jl(e,function(i){t[0]>i[0]&&(t[0]=i[0]),t[1]>i[1]&&(t[1]=i[1]),t[2]<i[0]&&(t[2]=i[0]),t[3]<i[1]&&(t[3]=i[1])}),t}Lp.default=Lp;var Ix=Lp;function Ax(e){return Ix(e)}F();F();F();F();F();var Wn=class{constructor(){S(this,"type","interaction");S(this,"hover",!1);S(this,"dirty",!1)}};F();F();import{z as zp}from"zod";var Ex=zp.union([zp.enum(["low","medium","high","always-visible"]),zp.number()]),kx=["","","low","medium","high","always-visible"],oR=2,sR=3;var lR=5;function Dx(e){return Math.min(lR,Math.max(oR,e))}function Hn(e){if(typeof e=="number")return Dx(e);let t=kx.indexOf(e);return t===-1?sR:t}function a$(e){let t=Dx(e);return kx[t]}F();F();import{z as ve}from"zod";F();import Qi from"zod";var uR=Qi.enum(Xd),hR=e=>{let t=e[0];for(let i=1;i<e.length;i++){let r=e[i];if(r<=t)return!1;t=r}return!0},cR=e=>{let t=e[0];for(let i=1;i<e.length;i++){let r=e[i];if(r>=t)return!1;t=r}return!0},pR=e=>hR(e)||cR(e),Lx=Qi.object({on:Qi.literal("zoom-level"),input:Qi.tuple([Qi.number()]).rest(Qi.number()).refine(pR,{message:"input array must be strictly increasing or decreasing"}),output:Qi.tuple([Qi.number()]).rest(Qi.number()),easing:uR.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"});F();function Gl(e){"@babel/helpers - typeof";return Gl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gl(e)}var dR=/^\s+/,fR=/\s+$/;function K(e,t){if(e=e||"",t=t||{},e instanceof K)return e;if(!(this instanceof K))return new K(e,t);var i=mR(e);this._originalInput=e,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||i.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}K.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),i,r,n,a,o,s;return i=t.r/255,r=t.g/255,n=t.b/255,i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),n<=.03928?s=n/12.92:s=Math.pow((n+.055)/1.055,2.4),.2126*a+.7152*o+.0722*s},setAlpha:function(t){return this._a=Vx(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=Fx(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=Fx(this._r,this._g,this._b),i=Math.round(t.h*360),r=Math.round(t.s*100),n=Math.round(t.v*100);return this._a==1?"hsv("+i+", "+r+"%, "+n+"%)":"hsva("+i+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=zx(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=zx(this._r,this._g,this._b),i=Math.round(t.h*360),r=Math.round(t.s*100),n=Math.round(t.l*100);return this._a==1?"hsl("+i+", "+r+"%, "+n+"%)":"hsla("+i+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return Bx(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return xR(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Xe(this._r,255)*100)+"%",g:Math.round(Xe(this._g,255)*100)+"%",b:Math.round(Xe(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Xe(this._r,255)*100)+"%, "+Math.round(Xe(this._g,255)*100)+"%, "+Math.round(Xe(this._b,255)*100)+"%)":"rgba("+Math.round(Xe(this._r,255)*100)+"%, "+Math.round(Xe(this._g,255)*100)+"%, "+Math.round(Xe(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:kR[Bx(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var i="#"+Rx(this._r,this._g,this._b,this._a),r=i,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=K(t);r="#"+Rx(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+i+",endColorstr="+r+")"},toString:function(t){var i=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,a=!i&&n&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return a?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return K(this.toString())},_applyModification:function(t,i){var r=t.apply(null,[this].concat([].slice.call(i)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(PR,arguments)},brighten:function(){return this._applyModification(TR,arguments)},darken:function(){return this._applyModification(SR,arguments)},desaturate:function(){return this._applyModification(vR,arguments)},saturate:function(){return this._applyModification(bR,arguments)},greyscale:function(){return this._applyModification(wR,arguments)},spin:function(){return this._applyModification(MR,arguments)},_applyCombination:function(t,i){return t.apply(null,[this].concat([].slice.call(i)))},analogous:function(){return this._applyCombination(AR,arguments)},complement:function(){return this._applyCombination(CR,arguments)},monochromatic:function(){return this._applyCombination(ER,arguments)},splitcomplement:function(){return this._applyCombination(IR,arguments)},triad:function(){return this._applyCombination(Ox,[3])},tetrad:function(){return this._applyCombination(Ox,[4])}};K.fromRatio=function(e,t){if(Gl(e)=="object"){var i={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?i[r]=e[r]:i[r]=vo(e[r]));e=i}return K(e,t)};function mR(e){var t={r:0,g:0,b:0},i=1,r=null,n=null,a=null,o=!1,s=!1;return typeof e=="string"&&(e=FR(e)),Gl(e)=="object"&&(er(e.r)&&er(e.g)&&er(e.b)?(t=yR(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):er(e.h)&&er(e.s)&&er(e.v)?(r=vo(e.s),n=vo(e.v),t=_R(e.h,r,n),o=!0,s="hsv"):er(e.h)&&er(e.s)&&er(e.l)&&(r=vo(e.s),a=vo(e.l),t=gR(e.h,r,a),o=!0,s="hsl"),e.hasOwnProperty("a")&&(i=e.a)),i=Vx(i),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:i}}function yR(e,t,i){return{r:Xe(e,255)*255,g:Xe(t,255)*255,b:Xe(i,255)*255}}function zx(e,t,i){e=Xe(e,255),t=Xe(t,255),i=Xe(i,255);var r=Math.max(e,t,i),n=Math.min(e,t,i),a,o,s=(r+n)/2;if(r==n)a=o=0;else{var l=r-n;switch(o=s>.5?l/(2-r-n):l/(r+n),r){case e:a=(t-i)/l+(t<i?6:0);break;case t:a=(i-e)/l+2;break;case i:a=(e-t)/l+4;break}a/=6}return{h:a,s:o,l:s}}function gR(e,t,i){var r,n,a;e=Xe(e,360),t=Xe(t,100),i=Xe(i,100);function o(u,h,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?u+(h-u)*6*c:c<1/2?h:c<2/3?u+(h-u)*(2/3-c)*6:u}if(t===0)r=n=a=i;else{var s=i<.5?i*(1+t):i+t-i*t,l=2*i-s;r=o(l,s,e+1/3),n=o(l,s,e),a=o(l,s,e-1/3)}return{r:r*255,g:n*255,b:a*255}}function Fx(e,t,i){e=Xe(e,255),t=Xe(t,255),i=Xe(i,255);var r=Math.max(e,t,i),n=Math.min(e,t,i),a,o,s=r,l=r-n;if(o=r===0?0:l/r,r==n)a=0;else{switch(r){case e:a=(t-i)/l+(t<i?6:0);break;case t:a=(i-e)/l+2;break;case i:a=(e-t)/l+4;break}a/=6}return{h:a,s:o,v:s}}function _R(e,t,i){e=Xe(e,360)*6,t=Xe(t,100),i=Xe(i,100);var r=Math.floor(e),n=e-r,a=i*(1-t),o=i*(1-n*t),s=i*(1-(1-n)*t),l=r%6,u=[i,o,a,a,s,i][l],h=[s,i,i,o,a,a][l],c=[a,a,s,i,i,o][l];return{r:u*255,g:h*255,b:c*255}}function Bx(e,t,i,r){var n=[_i(Math.round(e).toString(16)),_i(Math.round(t).toString(16)),_i(Math.round(i).toString(16))];return r&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function xR(e,t,i,r,n){var a=[_i(Math.round(e).toString(16)),_i(Math.round(t).toString(16)),_i(Math.round(i).toString(16)),_i(jx(r))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function Rx(e,t,i,r){var n=[_i(jx(r)),_i(Math.round(e).toString(16)),_i(Math.round(t).toString(16)),_i(Math.round(i).toString(16))];return n.join("")}K.equals=function(e,t){return!e||!t?!1:K(e).toRgbString()==K(t).toRgbString()};K.random=function(){return K.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function vR(e,t){t=t===0?0:t||10;var i=K(e).toHsl();return i.s-=t/100,i.s=Ul(i.s),K(i)}function bR(e,t){t=t===0?0:t||10;var i=K(e).toHsl();return i.s+=t/100,i.s=Ul(i.s),K(i)}function wR(e){return K(e).desaturate(100)}function PR(e,t){t=t===0?0:t||10;var i=K(e).toHsl();return i.l+=t/100,i.l=Ul(i.l),K(i)}function TR(e,t){t=t===0?0:t||10;var i=K(e).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(255*-(t/100)))),i.g=Math.max(0,Math.min(255,i.g-Math.round(255*-(t/100)))),i.b=Math.max(0,Math.min(255,i.b-Math.round(255*-(t/100)))),K(i)}function SR(e,t){t=t===0?0:t||10;var i=K(e).toHsl();return i.l-=t/100,i.l=Ul(i.l),K(i)}function MR(e,t){var i=K(e).toHsl(),r=(i.h+t)%360;return i.h=r<0?360+r:r,K(i)}function CR(e){var t=K(e).toHsl();return t.h=(t.h+180)%360,K(t)}function Ox(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var i=K(e).toHsl(),r=[K(e)],n=360/t,a=1;a<t;a++)r.push(K({h:(i.h+a*n)%360,s:i.s,l:i.l}));return r}function IR(e){var t=K(e).toHsl(),i=t.h;return[K(e),K({h:(i+72)%360,s:t.s,l:t.l}),K({h:(i+216)%360,s:t.s,l:t.l})]}function AR(e,t,i){t=t||6,i=i||30;var r=K(e).toHsl(),n=360/i,a=[K(e)];for(r.h=(r.h-(n*t>>1)+720)%360;--t;)r.h=(r.h+n)%360,a.push(K(r));return a}function ER(e,t){t=t||6;for(var i=K(e).toHsv(),r=i.h,n=i.s,a=i.v,o=[],s=1/t;t--;)o.push(K({h:r,s:n,v:a})),a=(a+s)%1;return o}K.mix=function(e,t,i){i=i===0?0:i||50;var r=K(e).toRgb(),n=K(t).toRgb(),a=i/100,o={r:(n.r-r.r)*a+r.r,g:(n.g-r.g)*a+r.g,b:(n.b-r.b)*a+r.b,a:(n.a-r.a)*a+r.a};return K(o)};K.readability=function(e,t){var i=K(e),r=K(t);return(Math.max(i.getLuminance(),r.getLuminance())+.05)/(Math.min(i.getLuminance(),r.getLuminance())+.05)};K.isReadable=function(e,t,i){var r=K.readability(e,t),n,a;switch(a=!1,n=BR(i),n.level+n.size){case"AAsmall":case"AAAlarge":a=r>=4.5;break;case"AAlarge":a=r>=3;break;case"AAAsmall":a=r>=7;break}return a};K.mostReadable=function(e,t,i){var r=null,n=0,a,o,s,l;i=i||{},o=i.includeFallbackColors,s=i.level,l=i.size;for(var u=0;u<t.length;u++)a=K.readability(e,t[u]),a>n&&(n=a,r=K(t[u]));return K.isReadable(e,r,{level:s,size:l})||!o?r:(i.includeFallbackColors=!1,K.mostReadable(e,["#fff","#000"],i))};var Fp=K.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},kR=K.hexNames=DR(Fp);function DR(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[e[i]]=i);return t}function Vx(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Xe(e,t){LR(e)&&(e="100%");var i=zR(e);return e=Math.min(t,Math.max(0,parseFloat(e))),i&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function Ul(e){return Math.min(1,Math.max(0,e))}function jt(e){return parseInt(e,16)}function LR(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function zR(e){return typeof e=="string"&&e.indexOf("%")!=-1}function _i(e){return e.length==1?"0"+e:""+e}function vo(e){return e<=1&&(e=e*100+"%"),e}function jx(e){return Math.round(parseFloat(e)*255).toString(16)}function Nx(e){return jt(e)/255}var gi=(function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",i="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",n="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{CSS_UNIT:new RegExp(i),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function er(e){return!!gi.CSS_UNIT.exec(e)}function FR(e){e=e.replace(dR,"").replace(fR,"").toLowerCase();var t=!1;if(Fp[e])e=Fp[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=gi.rgb.exec(e))?{r:i[1],g:i[2],b:i[3]}:(i=gi.rgba.exec(e))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=gi.hsl.exec(e))?{h:i[1],s:i[2],l:i[3]}:(i=gi.hsla.exec(e))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=gi.hsv.exec(e))?{h:i[1],s:i[2],v:i[3]}:(i=gi.hsva.exec(e))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=gi.hex8.exec(e))?{r:jt(i[1]),g:jt(i[2]),b:jt(i[3]),a:Nx(i[4]),format:t?"name":"hex8"}:(i=gi.hex6.exec(e))?{r:jt(i[1]),g:jt(i[2]),b:jt(i[3]),format:t?"name":"hex"}:(i=gi.hex4.exec(e))?{r:jt(i[1]+""+i[1]),g:jt(i[2]+""+i[2]),b:jt(i[3]+""+i[3]),a:Nx(i[4]+""+i[4]),format:t?"name":"hex8"}:(i=gi.hex3.exec(e))?{r:jt(i[1]+""+i[1]),g:jt(i[2]+""+i[2]),b:jt(i[3]+""+i[3]),format:t?"name":"hex"}:!1}function BR(e){var t,i;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),i=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),i!=="small"&&i!=="large"&&(i="small"),{level:t,size:i}}var st={RIGHT:"right",LEFT:"left",TOP:"top",HIDDEN:"hidden",CENTER:"center"},rn="low-priority",Gx=Object.values(st),Bp=[st.RIGHT,st.LEFT,st.TOP,st.HIDDEN],Ux=ve.object({margin:ve.number().min(6).default(6),maxLines:ve.number().min(1).default(2),textSize:ve.number().min(0).default(11.5),maxWidth:ve.number().min(0).default(150),lineHeight:ve.number().min(0).default(1.2),color:ve.string().default("#333"),outlineColor:ve.string().default("white"),textColor:ve.string().optional(),textOutlineColor:ve.string().optional(),pinColor:ve.string().optional(),pinOutlineColor:ve.string().optional(),pinColorInactive:ve.string().optional(),pinOutlineColorInactive:ve.string().optional(),icon:ve.string().optional(),iconSize:ve.number().min(0).default(20),iconScale:ve.union([ve.number(),Lx]).default(1),iconPadding:ve.number().min(0).default(2),iconFit:ve.enum(["fill","contain","cover"]).default("cover"),iconOverflow:ve.enum(["visible","hidden"]).default("hidden"),iconVisible:ve.union([ve.boolean(),ve.number()]).default(!0),opacity:ve.number().min(0).max(1).default(1)}),v$=ve.strictObject(Ux.shape),Rp=e=>{var n,a;let t=He({},e);t.color!=null&&(t.textColor==null&&(t.textColor=t.color),t.pinColor==null&&(t.pinColor=t.color)),t.outlineColor!=null&&(t.textOutlineColor==null&&(t.textOutlineColor=t.outlineColor),t.pinOutlineColor==null&&(t.pinOutlineColor=t.outlineColor));let i=(n=t.pinColor)!=null?n:t.color,r=(a=t.pinOutlineColor)!=null?a:t.outlineColor;return i!=null&&t.pinColorInactive==null&&(t.pinColorInactive=K(i).toRgbString()),r!=null&&t.pinOutlineColorInactive==null&&(t.pinOutlineColorInactive=K(r).toRgbString()),t},Xx=Ux.transform(e=>Rp(e)),$x=e=>Xx.parse(e),RR=ve.object({rank:Ex.optional(),appearance:Xx.optional(),interactive:ve.boolean().default(!1),textPlacement:ve.union([ve.enum(Gx),ve.array(ve.enum(Gx))]).default(Bp),occlude:ve.boolean().default(!0)}),OR=e=>{RR.parse(e!=null?e:{})},NR=ve.array(ve.number()).min(2).max(3),VR=ve.string(),b$=(e,t,i)=>{NR.parse(e),VR.parse(t),OR(i)},qx=["color","outlineColor"],jR=[...qx,"maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"],GR=[...qx,"icon","iconSize","iconScale","iconVisible","iconPadding","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"],Yx=(e,t)=>jR.some(i=>t[i]!=null&&e[i]!==t[i]),Zx=(e,t)=>GR.some(i=>t[i]!=null&&e[i]!==t[i]),UR=["textPlacement"],XR=["margin"],Wx=(e,t)=>{let i=UR.some(n=>t[n]!=null&&e[n]!==t[n]),r=XR.some(n=>{var a,o,s;return((a=t.appearance)==null?void 0:a[n])!=null&&((o=e.appearance)==null?void 0:o[n])!==((s=t.appearance)==null?void 0:s[n])});return i||r};var Hx=4,qR=6,Jx=6.5,Xl=Jx/2,Kx=[Xl,Xl,Xl,Xl],Kn=class Kn{constructor(t,i,r){S(this,"lines",0);S(this,"id");S(this,"rank");S(this,"type","label");S(this,"initialRank");S(this,"contextConfigured",!1);S(this,"fillText");S(this,"newStyle",{});S(this,"currentOpacity",0);S(this,"visibilityNeedsUpdate",!1);S(this,"activePlacement",st.RIGHT);S(this,"text");S(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"});S(this,"projection",new Ni);S(this,"labelCacheId");S(this,"_cache",{});S(this,"appearance");S(this,"options");S(this,"visible",!0);S(this,"enabled",!0);S(this,"isOccluded",!1);S(this,"offscreen",!1);S(this,"canShow",!1);S(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});S(this,"dimensions",{width:0,height:0});S(this,"currentStrategyIndex",-1);S(this,"totalPinSize",0);S(this,"iconScale",1);S(this,"iconPadding");S(this,"dirty",!0);S(this,"textDirty",!0);S(this,"pinDirty",!0);S(this,"attachedDirty",!0);S(this,"collisionDirty",!0);S(this,"lastTextAlign");S(this,"imageHash");S(this,"pinSize",0);S(this,"iconVisible",!1);S(this,"dp");S(this,"animate",!0);S(this,"onStrategySelected",t=>{var r;if(this.currentStrategyIndex===t)return;this.currentStrategyIndex=t;let i=this.strategies[t];if(this.activePlacement=(r=i==null?void 0:i.name)!=null?r:this.activePlacement,i){i.onStrategySelected();let n=this.style;this.style=this.newStyle,this.newStyle=n}});S(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});var a,o,s;if(this.id=(a=i.id)!=null?a:bt(),this.options=i!=null?i:{},this.text=t,this.dp=(l=1)=>l*r.pixelRatio,typeof i.rank=="string")this.rank=Hn(i.rank),this.initialRank=this.rank;else if(i.rank!=null&&i.rank>0)this.rank=i.rank,this.initialRank=i.rank;else{let l=Math.trunc(Y.env.NODE_ENV==="test"?Kn.testId:Kn.testId*10)/10;Kn.testId+=.001,this.rank=l,this.initialRank=l}this.options.textPlacement=(o=i.textPlacement)!=null?o:Bp;let n=$x((s=i.appearance)!=null?s:{});this.appearance=n,this.iconPadding=n.iconPadding}get scaledPinSize(){return this.totalPinSize*this.iconScale}get scaledIconPadding(){return this.appearance.iconPadding*this.iconScale}get textVisible(){return this.offscreen||!this.visible||!this.canShow||!this.enabled?!1:this.style.textLabelVisible===!0&&this.style.textAlign!=null&&this.style.left!=null&&this.style.top!=null}calculatePinSize(){let t=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.pinSize=this.dp(this.appearance.iconSize):this.pinSize=this.dp(Jx),this.totalPinSize=Math.ceil((this.pinSize+2.5)/t)}getNoTextBbox(t){let i=this.scaledPinSize/2+t;return[i,i,i,i]}getHiddenTextPlacementBbox(t){return this.iconVisible?this.getNoTextBbox(t):Kx}getBoundingBoxForPlacement(t){let{width:i,height:r}=this.dimensions,{margin:n}=this.appearance,a=Math.max(qR,n);if(this.text==="")return this.getNoTextBbox(a);let o=Math.max(this.scaledPinSize,r);switch(t){case st.RIGHT:return[o/2+a,o/2+a,this.scaledPinSize/2+a,this.scaledPinSize/2+i+a];case st.LEFT:return[o/2+a,o/2+a,this.scaledPinSize/2+i+a,this.scaledPinSize/2+a];case st.TOP:{let s=this.dp();return[r+this.scaledPinSize/2/s+a,this.scaledPinSize/2+a,i/2+a,i/2+a]}case st.CENTER:return[r/2+a,r/2+a,i/2+a,i/2+a];case st.HIDDEN:return this.getHiddenTextPlacementBbox(a);case rn:return Kx;default:return this.getNoTextBbox(a)}}getStrategyStyleForPlacement(t){let{width:i,height:r}=this.dimensions;switch(t){case st.TOP:this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r-this.scaledPinSize/2,this.newStyle.left=-i/2;return;case st.LEFT:this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=-i-this.scaledPinSize/2-Hx,this.newStyle.textLabelVisible=!0;return;case st.RIGHT:this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=this.scaledPinSize/2+Hx,this.newStyle.textLabelVisible=!0;return;case st.CENTER:this.newStyle.pinVisibility=0,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r/2,this.newStyle.left=-i/2;return;case st.HIDDEN:this.newStyle.pinVisibility=this.iconVisible?1:.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return;case rn:default:this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return}}get strategies(){let t=Array.isArray(this.options.textPlacement)?this.options.textPlacement:[this.options.textPlacement],i=[],r=!1;for(let n of t)this.options.rank==="always-visible"&&n===st.HIDDEN&&t.length>1||(i.push({name:n,getBoundingBox:()=>this.getBoundingBoxForPlacement(n),onStrategySelected:()=>this.getStrategyStyleForPlacement(n)}),n===st.HIDDEN&&(r=!0));return r&&i.push({name:rn,getBoundingBox:()=>this.getBoundingBoxForPlacement(rn),onStrategySelected:()=>this.getStrategyStyleForPlacement(rn)}),i}recomputeCurrentStrategy(t=this.iconScale){let i=this.iconScale!==t;if(i||this.dirty){let r=this.pinDirty,n=this.strategies[this.currentStrategyIndex];if(this.iconScale=t,this.collisionDirty=!0,i&&!r&&this.calculatePinSize(),n){n.onStrategySelected();let a=this.style;this.style=this.newStyle,this.newStyle=a}this.dirty=!1}}toPackedMessage(t=!1){var n;let i=this.strategies[this.currentStrategyIndex],r=this.currentStrategyIndex!=null&&this.currentStrategyIndex!==-1&&this.text!==""&&i!=null&&i.name!==st.HIDDEN&&i.name!==rn;if(this.visible&&t&&this.collisionDirty===!1&&r?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,r&&this.currentStrategyIndex!==((n=this.packedMessage.bboxes[0])==null?void 0:n[4])){let a=this.packedMessage.bboxes.findIndex(o=>o[4]===this.currentStrategyIndex);if(a!==-1){let o=this.packedMessage.bboxes.splice(a,1)[0];this.packedMessage.bboxes.unshift(o)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let a=0;a<this.strategies.length;a++){let s=this.strategies[a].getBoundingBox(),l=[s[0],s[1],s[2],s[3],a];r&&a===this.currentStrategyIndex?this.packedMessage.bboxes.unshift(l):this.packedMessage.bboxes.push(l)}return this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};S(Kn,"testId",0);var Op=Kn,Qx=Op;F();var Dv=wd(Iv());import{z as lt}from"zod";F();var Re={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center",TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",HIDDEN:"hidden"},Wp=Object.values(Re),Av=[Re.CENTER,Re.HIDDEN],Ev=Object.freeze({size:8,color:"#666"});var Hp=lt.object({rank:lt.union([lt.enum(["low","medium","high","always-visible"]),lt.number()]).optional(),interactive:lt.union([lt.boolean(),lt.literal("pointer-events-auto")]).optional(),id:lt.string().optional(),placement:lt.union([lt.enum(Wp),lt.array(lt.enum(Wp))]).optional(),dynamicResize:lt.boolean().optional(),zIndex:lt.number().optional(),lowPriorityPin:lt.object({size:lt.number().positive().optional(),color:lt.string().optional()}).optional()});function q$(e,t,i){lt.array(lt.number()).min(2).max(3).parse(e),lt.string().parse(t),Hp.parse(i)}var ta=class ta{constructor(t,i={}){S(this,"id");S(this,"type","marker");S(this,"rank",0);S(this,"initialRank",0);S(this,"activePlacement","center");S(this,"pointerEvents","none");S(this,"options",{rank:"low",interactive:!1,id:"",placement:Av,dynamicResize:!1,occlude:!0,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:He({},Ev)});S(this,"projection",new Ni);S(this,"enabled",!0);S(this,"canShow",!1);S(this,"visible",!0);S(this,"isOccluded",!1);S(this,"offscreen",!1);S(this,"strategyIndex",-1);S(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});S(this,"dimensions",{width:0,height:0});S(this,"markerContainer");S(this,"containerEl");S(this,"contentEl",null);S(this,"contentHtml","");S(this,"style",{top:"0px",left:"0px"});S(this,"dirty",!1);S(this,"attachedDirty",!0);S(this,"collisionDirty",!0);S(this,"visibilityNeedsUpdate","show");S(this,"animation",null);S(this,"currentStrategyIndex",-1);S(this,"onStrategySelected",(t,i=!1)=>{var n;if(this.currentStrategyIndex===t&&!i)return;this.currentStrategyIndex=t;let r=this.strategies[t];if(this.activePlacement=(n=r==null?void 0:r.name)!=null?n:"center",this.activePlacement===Re.HIDDEN){this.markerContainer.setAttribute("data-placement",Re.HIDDEN);let a=this.options.lowPriorityPin,o=a.size,s=a.color;this.markerContainer.style.setProperty("--mappedin-pin-size","".concat(o,"px")),this.markerContainer.style.setProperty("--pin-color",s),this.markerContainer.style.opacity="0.6",this.style.top=-o/2+"px",this.style.left=-o/2+"px"}else{this.markerContainer.setAttribute("data-placement",this.activePlacement),this.markerContainer.style.removeProperty("--mappedin-pin-size"),this.markerContainer.style.removeProperty("--pin-color"),this.markerContainer.style.opacity="1";let{width:a,height:o}=this.dimensions,s=-o/2+"px",l=-a/2+"px";switch(this.style.top=s,this.style.left=l,this.activePlacement){case Re.TOP:{this.style.top=-o+"px";break}case Re.BOTTOM:{this.style.top="0px";break}case Re.LEFT:{this.style.left=-a+"px";break}case Re.RIGHT:{this.style.left="0px";break}case Re.TOP_LEFT:{this.style.top=-o+"px",this.style.left=-a+"px";break}case Re.TOP_RIGHT:{this.style.top=-o+"px",this.style.left="0px";break}case Re.BOTTOM_LEFT:{this.style.top="0px",this.style.left=-a+"px";break}case Re.BOTTOM_RIGHT:{this.style.top="0px",this.style.left="0px";break}case Re.CENTER:default:this.style.top=s,this.style.left=l}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left});S(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!1});var r,n,a,o;if(this.id=(i==null?void 0:i.id)||bt(),this.options=(0,Dv.default)(this.options,i),this.options.placement=(r=i.placement)!=null?r:this.options.placement,typeof i.rank=="string")this.rank=Hn(i.rank);else if(i.rank!=null&&i.rank>0)this.rank=i.rank;else{let s=Math.trunc(Y.env.NODE_ENV==="test"?ta.testId:ta.testId*10)/10;ta.testId+=.001,this.rank=s}typeof i.interactive=="string"&&(this.pointerEvents=i.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=t,this.initialRank=this.rank,this.markerContainer=document.createElement("div"),this.markerContainer.className="mappedin-marker",this.markerContainer.style.opacity="0",this.markerContainer.innerHTML='<div class="mappedin-marker-content">'.concat(this.contentHtml,"</div>"),this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.containerEl=(n=this.markerContainer.firstElementChild)!=null?n:null,this.contentEl=(o=(a=this.markerContainer.firstElementChild)==null?void 0:a.firstElementChild)!=null?o:null}updateDimensionsIfZeroWidthHeight(t,i){this.dimensions.width===0&&this.dimensions.height===0&&this.updateDimensions(t,i)}updateDimensions(t,i){if(t!=null&&i!=null)this.dimensions={width:t,height:i};else{let{width:r,height:n}=this.markerContainer.getBoundingClientRect();this.dimensions={width:r,height:n}}Object.assign(this.markerContainer,{width:this.dimensions.width+"px",height:this.dimensions.height+"px"}),this.currentStrategyIndex=-1}get strategies(){let{width:t,height:i}=this.dimensions;if(t===0||i===0)return[];let r=Array.isArray(this.options.placement)?this.options.placement:[this.options.placement],n=[];for(let a of r)this.options.rank==="always-visible"&&a===Re.HIDDEN&&r.length>1||n.push({name:a,getBoundingBox:()=>{let o=i/2,s=i/2,l=t/2,u=t/2;switch(a){case Re.TOP:{o=i,s=0;break}case Re.BOTTOM:{o=0,s=i;break}case Re.LEFT:{l=t,u=0;break}case Re.RIGHT:{l=0,u=t;break}case Re.TOP_LEFT:{o=i,l=t,s=0,u=0;break}case Re.TOP_RIGHT:{o=i,u=t,s=0,l=0;break}case Re.BOTTOM_LEFT:{s=i,l=t,o=0,u=0;break}case Re.BOTTOM_RIGHT:{s=i,u=t,o=0,l=0;break}case Re.HIDDEN:let h=Math.max(2,4/2);return[this.options.lowPriorityPin.size/2+h,this.options.lowPriorityPin.size/2+h,this.options.lowPriorityPin.size/2+h,this.options.lowPriorityPin.size/2+h]}return[o+4,s+4,l+4,u+4]}});return n}toPackedMessage(t=!1){var r;this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.packedMessage.shouldCollideWithScreenEdges=!0;let i=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&t&&i&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,i&&this.currentStrategyIndex!==((r=this.packedMessage.bboxes[0])==null?void 0:r[4])){let n=this.packedMessage.bboxes.findIndex(a=>a[4]===this.currentStrategyIndex);if(n!==-1){let a=this.packedMessage.bboxes.splice(n,1)[0];this.packedMessage.bboxes.unshift(a)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let n=0;n<this.strategies.length;n++){let a=this.strategies[n];n===this.currentStrategyIndex&&i?this.packedMessage.bboxes.unshift([...a.getBoundingBox(),n]):this.packedMessage.bboxes.push([...a.getBoundingBox(),n])}return this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){return this.options.rank==="always-visible"?-1:this.strategies.findIndex(t=>t.name===Re.HIDDEN)}destroy(){}};S(ta,"testId",0);var kv=ta;F();var sn=class extends Ct{constructor(){super(...arguments);S(this,"type","geometry");S(this,"userData",{entityId:"",type:"geometry"});S(this,"components",[])}raycast(i,r){this.userData.type==="model"&&this.children[0]&&i.intersectObject(this.children[0],!0).forEach(n=>{r.push(n)})}},Gt=class{constructor(t,i){S(this,"id",bt());S(this,"components");S(this,"parentId");S(this,"type");S(this,"entities2D",new Map);this.components=[t,i],this.type=t.type}getComponent(t){return this.components.find(i=>(i==null?void 0:i.type)===t)}get object3d(){return this.components[0].mesh}get parentObject3D(){var t;return(t=this.components[0].mesh)==null?void 0:t.parent}attach(t){this.parentObject3D instanceof kt?t.object3d.userData.attachedEntityId=this.id:this.entities2D.set(t.id,t)}detach(t){this.parentObject3D instanceof kt&&(t.object3d.userData.parentEntityId=void 0),this.entities2D.delete(t.id)}removeAllEntities(){for(let t of this.entities2D.values())this.detach(t)}};F();var Fi=class extends Ct{},nr=class{constructor(t,i,r=0){S(this,"id");S(this,"type");S(this,"verticalOffset");S(this,"object3d",new Fi);S(this,"components");S(this,"disposed",!1);S(this,"worldPosition",new Oe);this.id=t.id||bt(),this.components=[t],this.verticalOffset=r,this.object3d=new Fi,this.object3d.position.set(i.x,i.y,i.z+r),this.object3d.userData.entityId=this.id,this.type=t.type,this.object3d.userData.type=this.type,this.positionDirty=!0}get parentObject3D(){return this.object3d.parent}get attachedTo(){return this.object3d.userData.attachedEntityId}getComponent(t){return this.components.find(i=>(i==null?void 0:i.type)===t)}get position(){return this.positionDirty&&(this.object3d.matrixAutoUpdate=!0,this.object3d.getWorldPosition(this.worldPosition),this.positionDirty=!1,this.object3d.matrixAutoUpdate=!1),this.worldPosition}get positionDirty(){return this.object3d.userData.worldPositionDirty}set positionDirty(t){this.object3d.userData.worldPositionDirty=t}updatePosition(t){this.object3d.position.copy(t),this.positionDirty=!0}setAltitude(t){this.object3d.position.z=t,this.positionDirty=!0}};F();import{z as pe}from"zod";F();var Lv=class extends ha{constructor(i,r,n=!0){super();S(this,"rendererState");S(this,"convertTo3DMapPosition");S(this,"textSet",new Set);S(this,"batchedTextMap",new Map);S(this,"resolvedBatchedTextMap",new Map);S(this,"useWorker",!0);S(this,"debugTextAreaMesh",new Map);n===!1&&(this.useWorker=!1,VO(!1)),this.rendererState=i,this.convertTo3DMapPosition=r}remove(i){this.textSet.delete(i)}getBatchedText(i){return this.resolvedBatchedTextMap.get(i)}update(i){var s,l,u;let r,n,a,o=[];for(let h of this.rendererState.geometry3DIdsInScene)if(r=this.rendererState.geometry3DMap.get(h),(r==null?void 0:r.type)==="text3d"){n=r.components[0],a=r.components[1];let c=(s=n.mesh)==null?void 0:s.parent;if(!c||!(c instanceof Dt)||!(n instanceof eu))continue;if("textArea"in n.feature.properties&&n.mesh!=null&&n.polygonEntityId!=null&&n.textMesh==null&&n.mesh.parent!=null&&((u=(l=n.feature.properties)==null?void 0:l.textArea)==null?void 0:u.position)!=null){if(this.textSet.has(n.polygonEntityId))continue;this.textSet.add(n.polygonEntityId),this.batchedTextMap.has(c)||this.batchedTextMap.set(c,ia().then(({BatchedText:f})=>{let y=new f;return y.type="batchedtext",c.add(y),this.resolvedBatchedTextMap.set(c,y),y}));let d=this.batchedTextMap.get(c);if(!d)throw new Error("batched text required");o.push(zv({entityId:h,textComponent:n,styleComponent:a,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:d,rendererState:this.rendererState,type:"text-area"}).then(f=>(f&&f.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(f.textComponent,i),f)))}else if(n.mesh!=null&&n.textMesh==null&&n.mesh.parent!=null){if(this.textSet.has(h.toString()))continue;this.textSet.add(h.toString()),this.batchedTextMap.has(c)||this.batchedTextMap.set(c,ia().then(({BatchedText:f})=>{let y=new f;return y.type="batchedtext",c.add(y),this.resolvedBatchedTextMap.set(c,y),y}));let d=this.batchedTextMap.get(c);if(!d)throw new Error("batched text required");o.push(zv({entityId:h,textComponent:n,styleComponent:a,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:d,rendererState:this.rendererState,type:"point"}).then(f=>(f&&f.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(f.textComponent,i),f)))}let p=this.batchedTextMap.get(c);n.textMesh&&p&&Promise.all([p,Promise.resolve({meshComponent:n,styleComponent:a})]).then(([d,{meshComponent:f,styleComponent:y}])=>{let{textMesh:g}=f;if(g){if(d){let _=Qp(d,g);f.visible&&!_?d.add(g):!f.visible&&_&&d.remove(g)}y.flipToFaceCamera&&this.flipIfNeeded(f,i)}})}return Promise.all(o).then(h=>{if(h.length===0)return;let c=new Set(h.map(d=>d==null?void 0:d.batchedText)),p=[];return c.forEach(d=>{p.push(new Promise(f=>{d?d.sync(()=>{f()}):f()}))}),this.publish("render"),Promise.all(p)})}flipIfNeeded(i,r){let n=i.textMesh;if(!n)return!1;let a=n.rotation.z,o=$o(a+r);return o>Math.PI/2&&o<3*Math.PI/2?(n.rotation.z=$o(a+Math.PI),n.updateMatrix(),!0):!1}showTextAreaMesh(){let i,r;for(let n of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(n),(i==null?void 0:i.type)==="text3d"&&(r=i.components[0],"textArea"in r.feature.properties)){let a=r.feature.properties.textArea;if(!a)continue;let o=new Ld(a.maxWidth,a.maxHeight),s=new sr(o,new Lr({color:"pink"})),{textMesh:l}=r;if(!l)continue;let u=this.convertTo3DMapPosition(a.position,Co);s.position.copy(u),s.position.z=l.position.z-.1,s.rotation.z=l.rotation.z,Kp.identity(),Kp.makeRotationAxis(new Oe(0,0,1),l.userData.rotationZ),Co.set(a.maxWidth/2,0,0),Co.applyMatrix4(Kp),s.position.x-=Co.x,s.position.y-=Co.y,this.rendererState.geometryScene.add(s),this.debugTextAreaMesh.set(n,s)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(i=>{this.rendererState.geometryScene.remove(i)}),this.debugTextAreaMesh.clear(),this.publish("render")}};function VO(e){ia().then(({configureTroikaTextBuilder:t})=>{t({useWorker:e})})}var Kp=new Vi,Co=new Oe,Jp;async function dq(e){let{preloadFont:t}=await ia();return t(e)}function ia(){return Jp||(Jp=import("./text3d-XNHJVYRH.js").then(e=>e)),Jp}async function zv({entityId:e,textComponent:t,styleComponent:i,convertTo3DMapPosition:r,batchedMeshPromise:n,rendererState:a,type:o="text-area"}){return Promise.all([ia(),Promise.resolve({entityId:e,meshComponent:t,styleComponent:i})]).then(([{createTroikaTextPoint:s,createTroikaTextArea:l},u])=>o==="text-area"?l(u.entityId,u.meshComponent,u.styleComponent,r):s(u.entityId,u.meshComponent,u.styleComponent,r)).catch(s=>{ot.warn("Trouble creating text: ",s)}).then(s=>{if(!(s!=null&&s.text))return;let l=[Promise.resolve(s.text),n,Promise.resolve()];if(t.polygonEntityId){let u=a.geometry3DMap.get(t.polygonEntityId);if((u==null?void 0:u.type)==="geometry"){let h=u.components[0],c=u.components[1];h.textMesh=s.text,s.text.position.z=c.altitude+c.height+jO}}else l[2]=ia().then(({syncText:u})=>u(s.text));return Promise.all(l)}).then(s=>{if(!s)return;let[l,u]=s;return u.add(l),t.batchedText||(t.batchedText=u),{text:l,batchedText:u,textComponent:t,styleComponent:i}})}function Qp(e,t){return e._members.has(t)}var jO=.5;var GO=pe.object({visible:pe.boolean(),color:pe.string(),flipToFaceCamera:pe.boolean(),font:pe.string().optional(),fontSize:pe.number(),margin:pe.union([pe.number(),pe.tuple([pe.number(),pe.number(),pe.number(),pe.number()])]),outlineColor:pe.string(),outlineOpacity:pe.number(),outlineBlur:pe.union([pe.number(),pe.string()]),outlineWidth:pe.number(),outlineOffsetX:pe.number(),outlineOffsetY:pe.number(),strokeWidth:pe.number(),maxWidth:pe.number().optional(),maxHeight:pe.number().optional(),strokeOpacity:pe.number(),strokeColor:pe.string(),fillOpacity:pe.number(),hoverColor:pe.string().optional(),id:pe.union([pe.string(),pe.number()]),type:pe.literal("text3d"),position:pe.tuple([pe.number(),pe.number(),pe.number()]),content:pe.string(),rotation:pe.number()}),Fv=pe.strictObject(GO.partial().omit({id:!0,type:!0}).shape),Bv=pe.strictObject(Fv.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0,rotation:!0}).shape),vq=pe.strictObject({appearance:Fv.optional(),parentId:pe.string().optional()}),eu=class{constructor(t){S(this,"mesh",new sn);S(this,"textMesh");S(this,"type","text3d");S(this,"feature");S(this,"parent");S(this,"batchedText");S(this,"polygonEntityId");this.feature=t}get visible(){return this.batchedText&&this.textMesh?Qp(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(t){this.batchedText&&this.textMesh?t?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=t),this.mesh.visible=t}};F();var ra,tu=class{constructor(t){S(this,"type","outline");S(this,"color");S(this,"dirty",!0);S(this,"enabled",!0);vt(this,ra,!1);S(this,"edgeColors");S(this,"edgeVisibility");S(this,"geometry");S(this,"ranges");S(this,"topFaceVerticesIndices");this.color=t}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(t){if(!this.edgeVisibility||!this.ranges||Ie(this,ra)===t)return;tt(this,ra,t);let i=this.edgeVisibility.array,r=t?1:0;for(let n=0;n<this.ranges.count;n++){let a=this.ranges.start+n;i[a]=r}this.edgeVisibility.needsUpdate=!0}get visible(){return Ie(this,ra)}get currentColor(){return this.edgeColors&&this.ranges?[this.edgeColors.array[this.ranges.start*4],this.edgeColors.array[this.ranges.start*4+1],this.edgeColors.array[this.ranges.start*4+2]]:[0,0,0]}};ra=new WeakMap;F();F();function Aq(e){return e instanceof Bi?e.material:null}function ed(e,t){return e==="auto"?t===1?bu:wu:e==="back"?Pd:e==="front"?bu:wu}function Eq(e,t,i=1){let r=ed(t,i);e.side!==r&&(e.side=r)}F();F();var iu=class extends Id{constructor(i){let r=i,n=3,a=n*4;super(new Uint8Array(i*a),n,i,Sd,Td);S(this,"_width");S(this,"_height");S(this,"_propertiesLength");this._width=a,this._height=r,this._propertiesLength=n}setColor(i,r,n){let a=this.image.data,o=i*this._width;a[o]=Math.round(r.r*255),a[o+1]=Math.round(r.g*255),a[o+2]=Math.round(r.b*255),a[o+3]=0,a[o+4]=Math.round(n.r*255),a[o+5]=Math.round(n.g*255),a[o+6]=Math.round(n.b*255),a[o+7]=0,this.needsUpdate=!0}getColor(i){let r=this.image.data,n=i*this._width,a=new ut(r[n]/255,r[n+1]/255,r[n+2]/255),o=new ut(r[n+4]/255,r[n+5]/255,r[n+6]/255);return{color:a,topColor:o}}setTexture(i,r,n){let a=this.image.data,o=i*this._width;a[o+8]=r?255:0,a[o+9]=n?255:0,a[o+10]=0,a[o+11]=0,this.needsUpdate=!0}getTexture(i){let r=this.image.data,n=i*this._width,a=r[n+8]===255,o=r[n+9]===255;return{texture:a,topTexture:o}}};F();var Rv="#define LAMBERT\nvarying vec3 vViewPosition;\nvarying vec4 vPosition;\nvarying vec2 vUv;\nvarying vec4 finalPosition;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\nvarying float vBatchId;\nvarying vec4 vWorldPosition;\nvarying vec3 vWorldNormal;\n\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n vWorldNormal = normalize((modelMatrix * vec4(objectNormal, 0.0)).xyz);\n #include <normal_vertex>\n\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n vWorldPosition = modelMatrix * vec4(transformed, 1.0);\n \n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n \n // To mitigate visual defects on machines such as windows and iOS\n vBatchId = getIndirectIndex(gl_DrawID) + 0.5;\n vViewPosition = - mvPosition.xyz;\n worldNormal = normal;\n vUv = uv;\n vVerticalOffset = position.z;\n}\n";F();var Ov="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nuniform float uGradientEnd;\nuniform float uGradientIntensity;\nuniform float uMinSideAlpha;\nuniform float uMaxSideAlpha;\nuniform float uGradientStart;\nuniform highp sampler2D uPropertiesTexture;\nuniform highp sampler2D uTopTexture;\nuniform highp sampler2D uTexture;\nuniform float uRepeatYFactor;\nuniform bool uBlendTexture;\nuniform vec3 overlayColor;\nuniform float overlayStrength;\nvarying float vBatchId;\n\nvarying vec2 vUv;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\n\nfloat shadowThreshold = 0.05;\nfloat shadowStrengthMultiplier = 0.6;\n\n#include <common>\nuniform sampler2D shadowMap;\nuniform mat4 lightMatrix;\nuniform float cameraNear;\nuniform float cameraFar;\nuniform float shadowBias;\nuniform float shadowOpacity;\nuniform vec3 baseColor;\nuniform float shadowMapSize;\nuniform float pcfSpread;\nuniform vec3 sunDir;\nuniform float normalBias;\nuniform bool shadowEnabled;\nuniform float depthRangeMax;\nvarying vec4 vWorldPosition;\nvarying vec3 vWorldNormal;\n\nfloat interleavedGradientNoise(vec2 position) {\n vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);\n return fract(magic.z * fract(dot(position, magic.xy)));\n}\n\n// Compile-time sample count for loop unrolling (injected via material)\n#ifndef PCF_SAMPLES\n#define PCF_SAMPLES 4\n#endif\n\n// Poisson disk samples - only define what we need based on sample count\n#if PCF_SAMPLES <= 4\nconst vec2 poissonDisk[4] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760)\n);\n#elif PCF_SAMPLES <= 8\nconst vec2 poissonDisk[8] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(-0.38277543, 0.27676845),\n vec2(0.97484398, 0.75648379)\n);\n#else\nconst vec2 poissonDisk[16] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(-0.38277543, 0.27676845),\n vec2(0.97484398, 0.75648379),\n vec2(0.44323325, -0.97511554),\n vec2(0.53742981, -0.47373420),\n vec2(-0.26496911, -0.41893023),\n vec2(0.79197514, 0.19090188),\n vec2(-0.24188840, 0.99706507),\n vec2(-0.81409955, 0.91437590),\n vec2(0.19984126, 0.78641367),\n vec2(0.14383161, -0.14100790)\n);\n#endif\n\n/**\n * Samples the shadow map using PCF (Percentage Closer Filtering)\n * Uses compile-time loop count for GPU optimization\n * @param lightSpacePos Position in light space coordinates\n * @param outDepthGap Output: average depth gap between receiver and caster (for self-shadow detection)\n * @returns Visibility factor (1.0 = fully lit, 0.0 = fully shadowed)\n */\nfloat sampleShadowWithDepthGap(vec3 lightSpacePos, out float outDepthGap) {\n float scaledTexelSize = (1.0 / shadowMapSize) * pcfSpread;\n float currentDepth = lightSpacePos.z * depthRangeMax;\n \n // Rotation for temporal stability\n float noise = interleavedGradientNoise(gl_FragCoord.xy) * 6.283185;\n float cosNoise = cos(noise);\n float sinNoise = sin(noise);\n mat2 rotation = mat2(cosNoise, -sinNoise, sinNoise, cosNoise);\n \n float shadow = 0.0;\n float totalDepthGap = 0.0;\n float shadowSamples = 0.0;\n \n // Compile-time unrolled loop - GPU can optimize this efficiently\n for(int i = 0; i < PCF_SAMPLES; i++) {\n vec2 offset = rotation * poissonDisk[i] * scaledTexelSize;\n vec2 uv = clamp(lightSpacePos.xy + offset, 0.0, 1.0);\n \n float sampledDepth = texture2D(shadowMap, uv).r;\n float inShadow = step(sampledDepth + shadowBias, currentDepth);\n shadow += inShadow;\n \n // Track depth gap for shadow samples\n if(inShadow > 0.5) {\n totalDepthGap += currentDepth - sampledDepth;\n shadowSamples += 1.0;\n }\n }\n \n // Calculate average depth gap (0 if no shadow samples)\n outDepthGap = shadowSamples > 0.0 ? totalDepthGap / shadowSamples : 0.0;\n \n return 1.0 - shadow / float(PCF_SAMPLES);\n}\n\n/**\n * Samples the shadow map using PCF (Percentage Closer Filtering)\n * Uses compile-time loop count for GPU optimization\n * @param lightSpacePos Position in light space coordinates\n * @returns Visibility factor (1.0 = fully lit, 0.0 = fully shadowed)\n */\nfloat sampleShadow(vec3 lightSpacePos) {\n float unusedDepthGap;\n return sampleShadowWithDepthGap(lightSpacePos, unusedDepthGap);\n}\n\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvec3 blendTextureColor(vec3 diffuseColor, vec4 texColor) {\n vec3 texturedColor = diffuseColor * texColor.rgb;\n return mix(diffuseColor, texturedColor, texColor.a);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n\n // get the normalized world normal of vertex fragment\n vec3 surfaceNormal = normalize(worldNormal);\n\n // dot product with Z up (1.0 = horizontal top, 0.0 = vertical side)\n float dotUp = abs(dot(surfaceNormal, vec3(0.0, 0.0, 1.0)));\n\n int idx = int(vBatchId) * 1;\n vec3 diffuse = texelFetch(uPropertiesTexture, ivec2(0, idx), 0).rgb;\n bool shouldShowTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).r > 0.99;\n\n if(shouldShowTexture) {\n vec4 tex2d = texture2D(uTexture, vec2(vUv.x, vUv.y * uRepeatYFactor));\n diffuse = uBlendTexture ? blendTextureColor(diffuse, tex2d) : tex2d.rgb;\n }\n\n // if this is a fragment facing upwards, use topColor (dotUp > 0.99996 \u2248 angle < 0.02\xB0)\n if(dotUp > 0.99996) {\n bool shouldShowTopTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).g > 0.99;\n\n if(shouldShowTopTexture) {\n vec4 topTex2d = texture2D(uTopTexture, vUv);\n diffuse = uBlendTexture ? blendTextureColor(diffuse, topTex2d) : topTex2d.rgb;\n } else {\n diffuse = texelFetch(uPropertiesTexture, ivec2(1, idx), 0).rgb;\n }\n }\n\n vec4 diffuseColor = vec4(diffuse, opacity);\n\n // only for vertical surfaces (dotUp < 0.0175 \u2248 angle > 89\xB0)\n if(dotUp < 0.0175) {\n\n // get the percentage of the z position from the ground, up\n float percentFromZeroZ = max((abs(vVerticalOffset) - uGradientStart) / uGradientEnd, 0.0);\n\n // gradient based on percentage\n float alpha = smoothstep(uMinSideAlpha, uMaxSideAlpha, percentFromZeroZ);\n\n // mix the shadow color with the diffuse color based on the alpha and opacity\n diffuseColor = vec4(mix(diffuseColor.rgb, diffuseColor.rgb * (1.0 - uGradientIntensity), 1.0 - alpha), opacity);\n }\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n\n // accumulation\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n\n // modulation\n #include <aomap_fragment>\n\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n if (shadowEnabled){\n vec3 surfaceNormal = normalize(vWorldNormal);\n float ndl = max(dot(surfaceNormal, -sunDir), 0.0);\n \n // Apply normal offset bias to prevent self-shadowing on thin geometry\n // Offset the position along the surface normal before shadow calculation\n vec3 normalOffset = surfaceNormal * normalBias;\n vec4 offsetWorldPos = vWorldPosition + vec4(normalOffset, 0.0);\n \n // Calculate shadow in light space using offset position\n vec4 shadowCoord = lightMatrix * offsetWorldPos;\n vec3 projCoords = shadowCoord.xyz / shadowCoord.w;\n \n // Check if fragment is within shadow map bounds\n bool inBounds = projCoords.x >= 0.0 && projCoords.x <= 1.0 && \n projCoords.y >= 0.0 && projCoords.y <= 1.0 && \n projCoords.z >= 0.0 && projCoords.z <= 1.0;\n \n \n if(inBounds){\n float depthGap;\n float visibility = sampleShadowWithDepthGap(projCoords, depthGap);\n float shadowIntensity = 1.0 - visibility;\n \n // Prevent self-shadowing on sun-facing surfaces, but keep real shadows from objects above\n // depthGap is small for self-shadowing, larger for real shadows from other objects\n // Only apply normal-based fade when depth gap is small (likely self-shadow)\n float selfShadowThreshold = 0.001; // Depth gap threshold for self-shadow detection\n float isSelfShadow = 1.0 - smoothstep(0.0, selfShadowThreshold, depthGap);\n \n // Normal-based fade: reduce shadows on sun-facing surfaces\n float normalFade = 1.0 - smoothstep(0.3, 0.7, ndl);\n \n // Combine: only apply normal fade for self-shadows, keep full intensity for real shadows\n float combinedFade = mix(1.0, normalFade, isSelfShadow);\n shadowIntensity *= combinedFade;\n \n // Only apply shadow if intensity is significant (prevents subtle darkening)\n if(shadowIntensity > shadowThreshold) {\n float shadowStrength = shadowIntensity * shadowOpacity;\n vec3 shadowedColor = mix(gl_FragColor.rgb, baseColor * gl_FragColor.rgb, shadowStrength * shadowStrengthMultiplier);\n gl_FragColor.rgb = shadowedColor;\n }\n }\n }\n\n // Apply overlay color blend (0 = no overlay, 1 = fully overlaid with overlayColor)\n // Only affects RGB, preserves original alpha/opacity\n if(overlayStrength > 0.0) {\n gl_FragColor.rgb = mix(gl_FragColor.rgb, overlayColor, overlayStrength);\n }\n\n #include <dithering_fragment>\n\n}\n";var UO=-.05,XO=1,Io=class e extends zd{constructor(i,r,n=1){super(i);S(this,"propertiesTexture");S(this,"texturesVisible",!1);S(this,"pcfSampleCount",4);S(this,"uniforms",{uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:void 0},uTexture:{value:void 0},uRepeatYFactor:{value:1},uBlendTexture:{value:!1},overlayColor:{value:new ut},overlayStrength:{value:0},shadowOpacity:{value:.5},shadowMapSize:{value:1024},pcfSpread:{value:1},sunDir:{value:new Oe(0,1,0)},normalBias:{value:.05},shadowEnabled:{value:!1},depthRangeMax:{value:1},shadowMap:{value:null},lightMatrix:{value:new Vi},cameraNear:{value:.1},cameraFar:{value:1e3},shadowBias:{value:1e-5},baseColor:{value:new Oe(0,0,0)}});S(this,"colorSpace",Pu);S(this,"showTextures",i=>{this.texturesVisible=!0;let r=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(r||n)&&(this.propertiesTexture.setTexture(i,r,n),this.needsUpdate=!0)});this.alphaTest=.01,this.propertiesTexture=new iu(r),this.uniforms.uRepeatYFactor.value=n,this.onBeforeCompile=a=>{let o=this.uniforms.uGradientIntensity,s=this.uniforms.uGradientEnd,l=this.uniforms.uGradientStart,u=this.uniforms.uTopTexture,h=this.uniforms.uTexture,c=this.uniforms.uRepeatYFactor,p=this.uniforms.uBlendTexture,d=this.uniforms.overlayColor,f=this.uniforms.overlayStrength,y=this.uniforms.shadowOpacity,g=this.uniforms.shadowMapSize,_=this.uniforms.pcfSpread,b=this.uniforms.sunDir,v=this.uniforms.normalBias,w=this.uniforms.shadowEnabled,P=this.uniforms.depthRangeMax,T=this.uniforms.shadowMap,C=this.uniforms.lightMatrix,A=this.uniforms.cameraNear,k=this.uniforms.cameraFar,z=this.uniforms.shadowBias,L=this.uniforms.baseColor;this.uniforms=a.uniforms,a.vertexShader=Rv,a.fragmentShader="#define PCF_SAMPLES ".concat(this.pcfSampleCount,"\n")+Ov,T!=null&&T.value&&(w!=null&&w.value)&&(C!=null&&C.value)&&(a.uniforms.shadowMap={value:T.value},a.uniforms.lightMatrix={value:C.value},a.uniforms.cameraNear={value:A.value},a.uniforms.cameraFar={value:k.value},a.uniforms.shadowBias={value:z.value},a.uniforms.baseColor={value:L.value},a.uniforms.shadowMapSize={value:g.value},a.uniforms.pcfSpread={value:_.value},a.uniforms.sunDir={value:b.value},a.uniforms.normalBias={value:v.value},a.uniforms.shadowEnabled={value:!0},a.uniforms.depthRangeMax={value:P.value}),Object.assign(this.uniforms,{uGradientIntensity:o,uGradientEnd:s,uGradientStart:l,overlayColor:d,overlayStrength:f,shadowOpacity:y,shadowMapSize:g,pcfSpread:_,sunDir:b,normalBias:v,shadowEnabled:w,depthRangeMax:P,shadowMap:T,lightMatrix:C,cameraNear:A,cameraFar:k,shadowBias:z,baseColor:L,uMinSideAlpha:{value:UO},uMaxSideAlpha:{value:XO},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:u,uTexture:h,uRepeatYFactor:c,uBlendTexture:p}),this.userData||(this.userData={}),this.userData.shadowUniforms=a.uniforms}}get repeatYFactor(){return this.uniforms.uRepeatYFactor.value}set repeatYFactor(i){i!==this.uniforms.uRepeatYFactor.value&&(this.uniforms.uRepeatYFactor.value=i,this.needsUpdate=!0)}get texture(){return this.uniforms.uTexture.value}set texture(i){if(i==null){this.uniforms.uTexture.value=null;return}i.wrapS=sa,i.wrapT=sa,i.colorSpace=this.colorSpace,this.uniforms.uTexture.value=i}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(i){if(i==null){this.uniforms.uTopTexture.value=null;return}i.wrapS=sa,i.wrapT=sa,i.colorSpace=this.colorSpace,this.uniforms.uTopTexture.value=i}get blendTexture(){return this.uniforms.uBlendTexture.value}set blendTexture(i){i!==this.uniforms.uBlendTexture.value&&(this.uniforms.uBlendTexture.value=i,this.colorSpace=i?Md:Pu,this.texture&&(this.texture.colorSpace=this.colorSpace),this.topTexture&&(this.topTexture.colorSpace=this.colorSpace),this.needsUpdate=!0)}setGradientShading(i,r,n){this.uniforms.uGradientStart.value=i,this.uniforms.uGradientEnd.value=r,this.uniforms.uGradientIntensity.value=n}getGradientShading(){return{start:this.uniforms.uGradientStart.value,end:this.uniforms.uGradientEnd.value,intensity:this.uniforms.uGradientIntensity.value}}setOverlay(i,r){this.uniforms.overlayColor.value.set(i),this.uniforms.overlayStrength.value=r}getOverlay(){return{color:"#"+this.uniforms.overlayColor.value.getHexString(),strength:this.uniforms.overlayStrength.value}}clearOverlay(){this.uniforms.overlayStrength.value=0}setColor(i,r,n){this.propertiesTexture.setColor(i,r,n)}getColor(i){return this.propertiesTexture.getColor(i)}hideTextures(i){this.texturesVisible=!1;let r=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(r||n)&&(this.propertiesTexture.setTexture(i,!1,!1),this.needsUpdate=!0)}removeSideTexture(i){if(this.texture){this.texture.dispose(),this.uniforms.uTexture.value=null;let r=!!this.uniforms.uTopTexture.value;this.propertiesTexture.setTexture(i,!1,r),this.needsUpdate=!0}}removeTopTexture(i){if(this.topTexture){this.topTexture.dispose(),this.uniforms.uTopTexture.value=null;let r=!!this.uniforms.uTexture.value;this.propertiesTexture.setTexture(i,r,!1),this.needsUpdate=!0}}dispose(){super.dispose(),this.propertiesTexture.dispose()}setShadowUniforms(i,r,n,a,o,s,l,u,h,c,p,d,f,y){this.uniforms.lightMatrix.value.copy(r),this.uniforms.shadowMap.value=i,this.uniforms.sunDir.value.copy(p),this.uniforms.shadowOpacity.value=s,this.uniforms.baseColor.value=l,this.uniforms.shadowBias.value=o,this.uniforms.normalBias.value=d,this.uniforms.pcfSpread.value=h,this.uniforms.shadowMapSize.value=u,this.uniforms.shadowEnabled.value=y,this.uniforms.depthRangeMax.value=f,this.uniforms.cameraNear.value=n,this.uniforms.cameraFar.value=a,c!==this.pcfSampleCount&&(this.pcfSampleCount=c,this.needsUpdate=!0)}clone(i){let r=new e(i!=null?i:{},1,this.repeatYFactor);this.texture&&(r.texture=this.texture),this.topTexture&&(r.topTexture=this.topTexture),this.blendTexture&&(r.blendTexture=this.blendTexture);let n=this.getGradientShading();return n.intensity>0&&r.setGradientShading(n.start,n.end,n.intensity),r}};F();var Zq={top:0,bottom:0,left:0,right:0,type:"pixel"},Ao={enabled:!1,thickness:0,size:0,offset:0,segments:3};function Wq(e,t){var i,r,n,a,o;return{bevelEnabled:(i=e==null?void 0:e.enabled)!=null?i:Ao.enabled,bevelThickness:(r=e==null?void 0:e.thickness)!=null?r:Ao.thickness,bevelSize:(n=e==null?void 0:e.size)!=null?n:(e==null?void 0:e.thickness)||Ao.size,bevelOffset:(a=e==null?void 0:e.offset)!=null?a:Ao.offset,bevelSegments:(o=e==null?void 0:e.segments)!=null?o:Ao.segments,depth:t}}var Nv="mappedin";var Vv={MASKS:12,GEOMETRY:0,IMAGE_MESH:1,XRAY_PATH:9,STENCIL_PATH:10,ALWAYS_ON_TOP_PATHS:11,ALWAYS_ON_TOP_MODELS:12},Hq={SHOULD_CAST_SHADOWS:30},Kq={PATH:1,UNDERGROUND_MASK:251,CLIPPING_BASELINE:252},Jq=250,Qq={tension:0,cornerRadius:.5},e7="collision-worker.csp.js",t7="maplibre-worker.csp.js";F();function x7(e,t){var h,c,p,d;let i=0;for(let f of e)i+=((c=(h=f.components[0])==null?void 0:h.geometry)==null?void 0:c.attributes.position.count)||0;let r=new ut(t.color),n=(p=t.opacity)!=null?p:1,a=new Io({color:r,side:ed((d=t.side)!=null?d:"auto",n),opacity:n,transparent:n<1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},e.length),o=new na(e.length,i,0,a);o.renderOrder=Vv.GEOMETRY;let s,l,u;for(let f of e)s=f.components[0],!(!(s instanceof Bi)||!s.geometry)&&(s.mesh=o,s.material=a,s.instanceIndex=o.addGeometry(s.geometry),o.addInstance(s.instanceIndex),o.userData.entities[s.instanceIndex]=f.id,a instanceof Io&&a.setColor(s.instanceIndex,r,t.topColor?new ut(t.topColor):r),l=o.getGeometryIdAt(s.instanceIndex),s.batchedProps&&(u=o.getGeometryRangeAt(l),u&&(s.batchedProps.range=u),s.batchedProps.geometryId=l));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}function td(e,t=30){return K(e).darken(t).toRgbString()}function v7(e,t,i,r){if(t.length<1)return;e.boundingBox||e.computeBoundingBox();let n=e.boundingBox,a=e.getAttribute("position"),o=e.getAttribute("normal"),s=e.getAttribute("uv"),l,u;e.index?(l=e.index.count/3,u=function(v,w){return e.index.getX(v*3+w)}):(l=a.count/3,u=function(v,w){return v*3+w});let h=new Vi;h.makeRotationFromQuaternion(new Tu().setFromEuler(new Su(0,0,i/180*Math.PI)));let c=t.find(v=>v.face==="top"),p;c&&(p={min:r(c.bounds[1],c.bounds[0],0),max:r(c.bounds[3],c.bounds[2],n.max.z)});let d=t.find(v=>v.face==="side"),f;if(d&&(f={min:r(d.bounds[1],d.bounds[0],0),max:r(d.bounds[3],d.bounds[2],n.max.z)}),!(!f&&!p))for(let v=0;v<l;++v){let w=o.getX(u(v,0))+o.getX(u(v,1))+o.getX(u(v,2)),P=o.getY(u(v,0))+o.getY(u(v,1))+o.getY(u(v,2)),T=o.getZ(u(v,0))+o.getZ(u(v,1))+o.getZ(u(v,2)),C=Math.abs(w),A=Math.abs(P),k=Math.abs(T);var y,g;C<=A&&C<=k?(y="x",A<=k?g="y":g="z"):A<=C&&A<=k?(y="y",C<=k?g="x":g="z"):(y="z",C<=A?g="x":g="y"),y==="z"&&(y=g,g="z");let z,L,E,D,x,M;if(g==="z"||y==="z"){if(!d||!f)continue;z=d.repeat.u,L=d.repeat.v,E=d.offset.u,D=d.offset.v,x=d.rotation,M=f}else{if(!c||!p)continue;z=c.repeat.u,L=c.repeat.v,E=c.offset.u,D=c.offset.v,x=(360-i+c.rotation)%360,M=p}let{min:I,max:R}=M,N=new Ct;N.position.set(I.x,I.y,0),N.updateMatrix(),N.updateMatrixWorld();let $=I.clone().applyMatrix4(h),Q=R.clone().applyMatrix4(h),oe=Math.abs(Q.x-$.x),Le=Math.abs(Q.y-$.y),Ce=new Oe(oe,Le,R.z).applyMatrix4(N.matrixWorld),ze=Math.abs(Ce[y]-I[y]),$e=Math.abs(Ce[g]-I[g]),Lt=x*Math.PI/180||0,Xt=Math.cos(Lt),$t=Math.sin(Lt),qt=N.matrixWorld.clone().invert(),or=new Tu().setFromEuler(new Su(0,0,i/180*Math.PI));for(let _t=0;_t<3;_t++){let mn=new Oe(a.getX(u(v,_t)),a.getY(u(v,_t)),a.getZ(u(v,_t))).applyMatrix4(qt);mn.applyQuaternion(or);let Ar=mn.applyMatrix4(N.matrixWorld),Ri=Ar.x,Er=Ar.y,Oi=Ar.z;var _,b;y==="x"?_=z*(Ri-I[y])/ze+E:y==="y"?_=z*(Er-I[y])/ze+E:_=z*(Oi-I[y])/ze+E,g==="x"?b=L*(Ri-I[g])/$e+D:g==="y"?b=L*(Er-I[g])/$e+D:b=L*(Oi-I[g])/$e+D,_-=.5,b-=.5;let Yt=_*Xt-b*$t+.5,zt=_*$t+b*Xt+.5;s.setX(u(v,_t),Yt),s.setY(u(v,_t),zt)}}}function ru(e){if(!e.startsWith("data:"))return;let t=e.indexOf(",");if(t===-1)return;let i=e.slice(5,t),r=e.slice(t+1),n=i.split(";"),a=n[0]||"",o=n.includes("base64");return{mimeType:a,isBase64:o,data:r}}function b7(e){if(e.trimStart().startsWith("{"))return!0;let t=ru(e);return t!=null&&t.mimeType==="application/json"}function w7(e){let t=ru(e);return t?atob(t.data):e}function P7(e){let t=ru(e);return!t||!t.isBase64?!1:t.mimeType==="application/gltf-binary"||t.mimeType==="application/octet-stream"}function T7(e){let t=ru(e);if(!t)return ot.error("Invalid binary data URI",e),new ArrayBuffer(0);let i=atob(t.data),r=new Uint8Array(i.length);for(let n=0;n<i.length;n++)r[n]=i.charCodeAt(n);return r.buffer}F();var nu=class{constructor(){S(this,"type","focusable");S(this,"dirty",!0);S(this,"vertices");S(this,"boundingBox",new la)}};F();var au=class{constructor(t,i){S(this,"type","texture");S(this,"texture");S(this,"topTexture");S(this,"showTexture",!0);S(this,"showTopTexture",!0);S(this,"textureInstance");S(this,"topTextureInstance");S(this,"dirty",!0);this.texture=typeof t=="string"?{path:t}:t,this.topTexture=typeof i=="string"?{path:i}:i}};F();var ou=class{constructor(){S(this,"type","border");S(this,"dirty",!0);S(this,"needsRebuild",!1);S(this,"mesh")}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}};F();var su=class{constructor(){S(this,"type","mask");S(this,"maskId",0);S(this,"enabled",!0);S(this,"mode","mask");S(this,"effect","hide");S(this,"dirty",!0)}};F();var lu=class{constructor(){S(this,"type","clippingPlane");S(this,"dirty",!0);S(this,"needsRebuild",!1);S(this,"verticalOffset",1/0);S(this,"plane");S(this,"holeFillMesh");S(this,"topColor");S(this,"topVisible",!0)}};function Eo(e,t,i){if(t!==void 0){if(e.type==="model"||e.type==="path"||e.type==="marker"||e.type==="label"||e.type==="geometry"||e.type==="group-container"||e.type==="custom-geometry")return t===!0?(e instanceof nr&&e.components[1]===void 0?(e.components[1]=new Wn,e.components[1].dirty=!0):e instanceof Gt&&e.components[2]===void 0?(e.components[2]=new Wn,e.components[2].dirty=!0):e instanceof Dt&&e.components[0]===void 0&&(e.components[0]=new Wn,e.components[0].dirty=!0),!0):(e instanceof nr?e.components[1]=void 0:e instanceof Gt?e.components[2]=void 0:e instanceof Dt&&(e.components[0]=void 0),!0);if(e.type==="geometry-group"){let r;for(let n of e.userData.entities3D.values())r=i.geometry3DMap.get(n),Eo(r,t,i);return!0}}return!1}function uY(e,t,i){var r;if(!(!(i!=null&&i.color)&&!("topColor"in i))){if(i!==void 0&&e.type==="geometry-group"){let n,a=(r=t.outlinesOptions)==null?void 0:r.darkenFactor;for(let o of e.userData.entities3D.values())n=t.geometry3DMap.get(o),n&&jv(n,i,a);return!0}return!1}}function YO(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].shading=t,e.components[1].dirty=!0)}function hY(e,t,i){if(i!==void 0&&e.type==="geometry-group"){for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);n&&YO(n,i)}return!0}return!1}function cY(e,t){t!==void 0&&e.type==="geometry"&&(t.showImage!==void 0&&(e.components[1].showImage=t.showImage),t.flipImageToFaceCamera!==void 0&&(e.components[1].flipImageToFaceCamera=t.flipImageToFaceCamera))}function ZO(e,t,i){if(i!==void 0){if(e.type==="geometry"){let r=e.components[1];if(r.height!==i)return r.height=i,r.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),e.components[5]&&(e.components[5].needsRebuild=!0,e.components[5].dirty=!0),!0}else if(e.type==="geometry-group"){for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&ZO(n,t,i)}return!0}}return!1}function jv(e,t,i){if(t!==void 0){let r=!1;(e.type==="path"||e.type==="geometry")&&(t.initialColor!==void 0&&t.initialColor!==e.components[1].initialColor&&(e.components[1].initialColor=t.initialColor,r=!0),t.color!==void 0&&t.color!==e.components[1].color&&(e.components[1].color=t.color,r=!0,e.components[3]&&(e.components[3].color=td(t.color,i),e.components[3].dirty=!0)),"topColor"in t&&(e.components[1].topColor=t.topColor,r=!0),r&&(e.components[1].dirty=!0))}}function pY(e,t,i,r){if(t!==void 0){if(e.type==="label"||e.type==="marker"){let n=i(t[1],t[0],t[2]||0);e.updatePosition(n),r==null||r.expandBoundsIfOutside(n)}else if(e.type==="custom-geometry"){let n=e.components[0],a=i(t[1],t[0],t[2]||0);n.position.copy(a),r==null||r.expandBoundsIfOutside(a)}}}function dY(e,t){var i;return t!==void 0&&(e.type==="marker"||e.type==="label"||e.type==="custom-geometry")&&e.parentObject3D!==t&&e.parentObject3D instanceof Dt?((i=e.parentObject3D)==null||i.removeEntity(e),t.addEntity(e),!0):!1}function fY(e,t){t!==void 0&&(e.type==="marker"||e.type==="label")&&e.components[0].enabled!==t&&(e.components[0].enabled=t)}function mY(e,t,i){var r;if(t!==void 0&&e.type==="marker"){let n=e.components[0],a=!1;if(t.contentHTML!==void 0&&(n.containerEl.innerHTML=t.contentHTML,n.contentHtml=t.contentHTML,a=!0),Xv(e,t.placement)&&(n.collisionDirty=!0,a=!0),t.dynamicResize!==void 0&&(n.options.dynamicResize=t.dynamicResize,a=!0),Uv(e,(r=t.options)==null?void 0:r.occlude)&&(a=!0),t.options!=null){try{Hp.parse(t.options||{})}catch(o){return ot.error(o),!1}t.options.interactive!=null&&(t.options.interactive==="pointer-events-auto"?(n.pointerEvents="auto",Eo(e,!1,i)):(n.pointerEvents="none",Eo(e,t.options.interactive,i))),t.options.zIndex!=null&&(n.options.zIndex=t.options.zIndex),Gv(e,t.options.rank),a=!0}return a}return!1}function Gv(e,t){return t!==void 0&&(e.type==="marker"||e.type==="label")?(e.components[0].rank=Hn(t),!0):!1}function WO(e,t){var o;if(((o=t==null?void 0:t.options)==null?void 0:o.appearance)==null)return;let i=Rp(t.options.appearance||{}),r=i.opacity!=null&&i.opacity!==e.appearance.opacity,a=i.iconScale!=null&&i.iconScale!==e.appearance.iconScale&&typeof i.iconScale=="number"&&Number.isFinite(i.iconScale);r&&(i.opacity=id(i.opacity)),a&&(i.iconScale=id(i.iconScale)),nd(e.appearance,i),r&&e.canShow&&e.visibilityNeedsUpdate!=="hide"&&(e.visibilityNeedsUpdate="show")}function yY(e,t,i){var r,n,a,o,s,l;if(t!==void 0&&e.type==="label"){let u=e.components[0];t.text!==void 0&&t.text!==u.text&&(u.text=t.text,u.textDirty=!0),Yx(u.appearance,((r=t.options)==null?void 0:r.appearance)||{})&&(u.textDirty=!0),Zx(u.appearance,((n=t.options)==null?void 0:n.appearance)||{})&&(u.pinDirty=!0),WO(u,t),Wx(u.options,t.options||{})&&(Xv(e,(a=t.options)==null?void 0:a.textPlacement),u.currentStrategyIndex=-1,u.collisionDirty=!0),Eo(e,(o=t.options)==null?void 0:o.interactive,i),Gv(e,(s=t.options)==null?void 0:s.rank),Uv(e,(l=t.options)==null?void 0:l.occlude)}}function Uv(e,t){if(t!==void 0&&(e.type==="label"||e.type==="marker")){let i=e.components[2];if(i)return i.enabled=t,!0}return!1}function Xv(e,t){if(t!==void 0){if(e.type==="label"){let i=e.components[0];return i.options.textPlacement=t,!0}else if(e.type==="marker"){let i=e.components[0];return i.options.placement=t,!0}}return!1}function gY(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].hoverColor=t,e.components[1].dirty=!0)}function _Y(e,t){if(t!==void 0){let i=e.components[2];if(e.type==="geometry"&&i!=null)return i.hover=t,i.dirty=!0,!0}return!1}function xY(e,t){t!==void 0&&e.type==="image"&&(e.components[1].flipImageToFaceCamera=t)}function vY(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].enableImageCollisions=t)}function $v(e,t,i){if(i!==void 0){if(e.type==="model"||e.type==="path"||e.type==="geometry"||e.type==="custom-geometry"||e.type==="image"||e.type==="text3d"){let r=!1;i!==e.components[1].visible&&(e.components[1].visible=i,e.components[1].dirty=!0,r=!0);let n=e.components[3];return n&&r&&(n.dirty=!0),r}else if(e.type==="geometry-group"){if(e.visible!==i)return e.setVisible(i),!0}else if(e.type==="group-container"){if(e.visible!==i)return e.setVisible(i),i===!1&&e.traverse(r=>{if(r instanceof Fi){let n=t.geometry2DMap.get(r.userData.entityId);if(n){let a=n.components[0];a instanceof Qx&&(a.canShow=i)}}}),!0}else if(e.type==="label"&&e.components[0].visible!==i)return e.components[0].visible=i,!0}return!1}function HO(e,t,i){if(i!==void 0)if(e.type==="geometry-group"){for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&HO(n,t,i)}return!0}else if(e.type==="group-container"){if(e.opacity!==i){e.setOpacity(i);let r=1;return e.parent instanceof Dt&&(r=e.parent.opacity),qv(e,t,r),!0}}else e instanceof Gt&&e.components[1].opacity!==i&&(e.components[1].opacity=i,e.components[1].dirty=!0);return!1}function qv(e,t,i=1){if(e.type==="group-container"&&"children"in e&&e.children.length>0){let r=i*e.opacity;e.userData.computedOpacity=r;for(let n of e.children)(n instanceof kt&&n.type==="geometry-group"||n instanceof Dt&&n.type==="group-container")&&qv(n,t,r)}else if(e.type==="geometry-group")for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r),a;((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&(a=n.components[1],a.dirty=!0)}}function bY(e,t,i){let r=!1;if((i==null?void 0:i.texture)!=null||(i==null?void 0:i.topTexture)!=null){if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let a=t.geometry3DMap.get(n);a&&KO(a,i)}return!0}return r}function KO(e,t){if(e.type==="geometry"&&((t==null?void 0:t.texture)!=null||(t==null?void 0:t.topTexture)!=null)){let i=!1,r=e.components[6];if(r==null?(e.components[6]=new au(t==null?void 0:t.texture,t==null?void 0:t.topTexture),i=!0):((t==null?void 0:t.texture)!=null&&(r==null?void 0:r.texture)!==(t==null?void 0:t.texture)&&(r.texture=typeof t.texture=="string"?{path:t.texture}:t.texture,i=!0,r.dirty=!0),(t==null?void 0:t.topTexture)!=null&&(r==null?void 0:r.topTexture)!==(t==null?void 0:t.topTexture)&&(r.topTexture=typeof t.topTexture=="string"?{path:t.topTexture}:t.topTexture,i=!0,r.dirty=!0)),i&&e.components[0]instanceof Bi){let n=e.components[0];return n.detached===!1&&(n.shouldDetach=!0,n.dirty=!0),!0}}return!1}function JO(e,t,i,r){if(i!=null||r!=null){if(e.type==="geometry"){let n=e.components[1];i!=null&&n.overlayStrength!==i&&(n.overlayStrength=i,n.dirty=!0),r!==void 0&&!Ud(n.overlayColor,r)&&(n.overlayColor=r,n.dirty=!0)}else if(e.type==="geometry-group"){let n;for(let a of e.userData.entities3D.values())n=t.geometry3DMap.get(a),n&&(n==null?void 0:n.type)==="geometry"&&JO(n,t,i,r)}}}function wY(e,t){if(Object.keys(t!=null?t:{}).length===0||t==null)return!1;if(e.type==="geometry-group"){e.components[0]==null&&t.enabled===!0&&(e.components[0]=new su);let i=e.components[0];if(i==null)return!1;t.enabled!=null&&i.enabled!==t.enabled&&(i.enabled=t.enabled,i.dirty=!0),t.maskId!=null&&Number.isInteger(t.maskId)&&i.maskId!==t.maskId&&(i.maskId=t.maskId,i.dirty=!0),t.effect!=null&&i&&i.effect!==t.effect&&(i.effect=t.effect,i.dirty=!0),t.mode!=null&&i&&i.mode!==t.mode&&(i.mode=t.mode,i.dirty=!0)}return!1}function PY(e,t){if(t!==void 0&&e.type==="geometry"){let i=e.components[1];if(i.opacity!==t){i.opacity=t;let r=e.components[0],n=e.components[3];n&&(n.dirty=!0),r.detached===!1&&(r.shouldDetach=!0,r.dirty=!0),i.dirty=!0;let a=e.parentObject3D;return(a==null?void 0:a.type)==="geometry-group"&&(a.userData.shadingDirty=!0),!0}}return!1}function QO(e,t,i){if(i!==void 0)if(e.type==="geometry"||e.type==="path"||e.type==="custom-geometry"){let r=e.components[1];if(r.altitude!==i)return r.altitude=i,r.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),e.components[5]&&(e.components[5].needsRebuild=!0,e.components[5].dirty=!0),!0}else{if(e.type==="group-container"&&e.altitude!==i)return e.setAltitude(i),!0;if(e.type==="geometry-group"){let r;for(let n of e.userData.entities3D.values())r=t.geometry3DMap.get(n),r&&QO(r,t,i)}}return!1}function e4(e,t,i){var r;if(i!==void 0){if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let a=t.geometry3DMap.get(n);a instanceof Gt&&e4(a,t,i)}else if(e.type==="geometry"){let n=e.components[3],a=e.components[1];if(!n&&i===!0){let o=(r=t.outlinesOptions)==null?void 0:r.darkenFactor;e.components[3]=new tu(td(a.color,o))}else n&&(n.enabled=i,n.dirty=!0)}return!0}return!1}function TY(e,t){if(t!==void 0){let i,r=4;if(e.type==="geometry"?(i=e.components[4],r=4):e.type==="group-container"&&(i=e.components[1],r=1),t===!0&&i==null)return e.components[r]=new nu,!0;if(t===!1&&i!=null)return e.components[r]=void 0,!0}return!1}function SY(e,t){if(t!==void 0&&e.type==="geometry"){let i=e.components[1];if(i.renderOrder!==t){i.renderOrder=t;let r=e.components[0];return r.detached===!1&&(r.shouldDetach=!0,r.dirty=!0),r.imageMesh&&(r.imageMesh.renderOrder=t+1),i.dirty=!0,!0}}return!1}function t4(e,t,i){if(i!=null){if(e.type==="geometry"){let r=e.components[1];r.side!==i&&(r.side=i,r.dirty=!0)}else if(e.type==="geometry-group")for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);n instanceof Gt&&t4(n,t,i)}}}function MY(e,t){if(t!==void 0&&e.type==="geometry"){let i=e.components[1],r;if(r=e.components[5],t.borderVisible!==i.borderVisible&&t.borderVisible!=null){if(t.borderVisible===!0){if(r==null){let n=new ou;e.components[5]=n,r=e.components[5]}r.visible=!0,r.dirty=!0}else t.borderVisible===!1&&r!=null&&(r.visible=!1,r.dirty=!0);i.borderVisible=t.borderVisible}i.borderColor!==t.borderColor&&t.borderColor!=null&&(i.borderColor=t.borderColor,r&&(r.dirty=!0)),i.borderWidth!==t.borderWidth&&t.borderWidth!=null&&(i.borderWidth=t.borderWidth,r&&(r.needsRebuild=!0))}}function CY(e,t,i){var o;let{visible:r,color:n}=i;if(e.type!=="path")return;let a=e.components[0];r!=null&&$v(e,t,r),n!=null&&jv(e,{color:n},(o=t.outlinesOptions)==null?void 0:o.darkenFactor),Object.assign(a,i4(i)),rd(i)||(a.materialDirty=!0,i.width!=null&&(a.dirty=!0),(i.smoothingTension!=null||i.smoothingCornerRadius!=null)&&(a.dirty=!0),i.__EXPERIMENTAL_GEOMETRY!=null&&(a.dirty=!0),i.__EXPERIMENTAL_ENDCAP_EXTENSION!=null&&(a.dirty=!0))}function i4(e){return ko(e,r4)}var r4=["smoothingTension","smoothingCornerRadius","animateArrowsOnPath","displayArrowsOnPath","width","accentColor","completeFraction","highlightCompleteFraction","highlightStartFraction","highlightEndFraction","highlightColor","highlightWidthMultiplier","dashed","visibleThroughGeometry","xrayOpacity","dashLength","dashGap","dashRelativeToWidth","dashSize","gapSize","dashAbsolute","dashMeters","gapMeters","__EXPERIMENTAL_GEOMETRY","__EXPERIMENTAL_ENDCAP_EXTENSION","__EXPERIMENTAL_BILLBOARDING","__EXPERIMENTAL_BORDER","__EXPERIMENTAL_PREVENT_SELF_OVERLAP"];function IY(e){if(!(e instanceof Gt&&e.type==="text3d"))throw new Error("expect target is TextGeometry3D")}var n4=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function AY(e,t,i){$v(e,t,i.visible);let r=e.components[1],n=ko(i,n4);"margin"in i&&ot.warn("update to margin is not supported atm"),"content"in i&&ot.warn("content update is not supported atm");try{Bv.parse(n)}catch(a){ot.error(a);return}Object.keys(n).length>0&&(Object.assign(r,n),r.dirty=!0)}var a4=["color","material","opacity","verticalOffset","rotation","position","scale"];function EY(e,t,i,r){var s;let n=ko(t,a4),a=e.components[1],o=e.components[0];if(Object.keys(n).length>0){if(n.material&&(a.material=n.material),n.opacity!=null&&(a.opacity=n.opacity),n.verticalOffset!=null&&(a.verticalOffset=n.verticalOffset),n.color!=null&&(a.color=n.color),n.position!=null&&(o.feature.geometry.coordinates=n.position,o.positionDirty=!0,i&&r)){let l=i(n.position[1],n.position[0],(s=n.position[2])!=null?s:0);r.expandBoundsIfOutside(l)}n.rotation!=null&&(a.rotation=n.rotation),n.scale!=null&&(a.scale=n.scale),n.visibleThroughGeometry!=null&&(o.visibleThroughGeometry=n.visibleThroughGeometry),a.dirty=!0}}function kY(e,t){if(t!==void 0&&e.type==="model"){if(!e.components[1].EXPERIMENTAL_clippingEnabled)return;let r=e.components[7];r==null&&(e.components[7]=new lu,r=e.components[7]),r=e.components[7],t.clippingPlaneZOffset!=null&&r.verticalOffset!==t.clippingPlaneZOffset&&(r.verticalOffset=t.clippingPlaneZOffset,r.dirty=!0),t.clippingPlaneTopColor!=null&&r.topColor!==t.clippingPlaneTopColor&&(r.topColor=t.clippingPlaneTopColor,r.dirty=!0),t.clippingPlaneTopVisible!=null&&r.topVisible!==t.clippingPlaneTopVisible&&(r.topVisible=t.clippingPlaneTopVisible,r.dirty=!0)}}F();F();var sd=wd(i1());function r1(e){this.name="JSClipperError",this.message=e,this.stack=new Error().stack}r1.prototype=Error.prototype;sd.default.Error=function(e){throw new r1(e)};var ar=sd.default;var Q6="gray",ld=new ar.ClipperOffset,Mt=100;function ud(e,t,i){let{color:r=Q6,opacity:n=1,width:a=1,join:o="round",cap:s="round",height:l=.01,altitude:u=0}=i||{};Array.isArray(n)&&(n=0);let h=[],c=e.geometry.coordinates.every(_=>_[2]!=null);for(let _=0;_<e.geometry.coordinates.length-1;_++){let b=t(e.geometry.coordinates[_][1],e.geometry.coordinates[_][0],e.geometry.coordinates[_][2]),v=t(e.geometry.coordinates[_+1][1],e.geometry.coordinates[_+1][0],e.geometry.coordinates[_+1][2]);h.push([b,v])}let p=h[0][0].y;ld.AddPaths(h.map(_=>_.map(b=>({X:b.x*Mt,Y:(c?b.z:b.y)*Mt}))),o==="round"?ar.JoinType.jsRound:o==="miter"?ar.JoinType.jsMiter:ar.JoinType.jsSquare,s==="round"?ar.EndType.etOpenRound:s==="butt"?ar.EndType.etOpenButt:ar.EndType.etOpenSquare);let d=new ar.PolyTree;ld.Execute(d,a/2*Mt);let f=[],y={bevelEnabled:!1,depth:l};for(let _ of d.m_AllPolys){let b=new kd;if(_.IsHole())continue;let v=_.m_polygon;b.moveTo(v[0].X/Mt,v[0].Y/Mt),v.slice(1).forEach(w=>b.lineTo(w.X/Mt,w.Y/Mt)),b.lineTo(v[0].X/Mt,v[0].Y/Mt),b.holes=_.m_Childs.map(w=>{let P=new Ed,T=w.m_polygon;return P.moveTo(T[0].X/Mt,T[0].Y/Mt),T.slice(1).forEach(C=>P.lineTo(C.X/Mt,C.Y/Mt)),P.lineTo(T[0].X/Mt,T[0].Y/Mt),P}),f.push(new Dd(b,y))}let g=Vo(f);return c&&(g.rotateX(Math.PI/2),g.translate(0,p+l/2,u||0)),g.userData={style:{color:r,opacity:n}},ld.Clear(),g}F();F();var Ut=63710088e-1,WY={centimeters:Ut*100,centimetres:Ut*100,degrees:360/(2*Math.PI),feet:Ut*3.28084,inches:Ut*39.37,kilometers:Ut/1e3,kilometres:Ut/1e3,meters:Ut,metres:Ut,miles:Ut/1609.344,millimeters:Ut*1e3,millimetres:Ut*1e3,nauticalmiles:Ut/1852,radians:1,yards:Ut*1.0936};function n1(e,t,i={}){let r={type:"Feature"};return(i.id===0||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=t||{},r.geometry=e,r}function a1(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return n1({type:"LineString",coordinates:e},t,i)}function o1(e,t={}){let i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function s1(e,t,i={}){return n1({type:"MultiLineString",coordinates:e},t,i)}F();function du(e){return e.type==="Feature"?e.geometry:e}function eN(e,t={}){let i=du(e);switch(!t.properties&&e.type==="Feature"&&(t.properties=e.properties),i.type){case"Polygon":return tN(i,t);case"MultiPolygon":return iN(i,t);default:throw new Error("invalid poly")}}function tN(e,t={}){let r=du(e).coordinates,n=t.properties?t.properties:e.type==="Feature"?e.properties:{};return l1(r,n)}function iN(e,t={}){let r=du(e).coordinates,n=t.properties?t.properties:e.type==="Feature"?e.properties:{},a=[];return r.forEach(o=>{a.push(l1(o,n))}),o1(a)}function l1(e,t){return e.length>1?s1(e,t):a1(e[0],t)}var hd=eN;F();function u1(e){e&&(e.map&&(e.map.dispose(),e.map=void 0),e.dispose())}function cd(e){for(;e.children.length>0;)cd(e.children[0]);"geometry"in e&&e.geometry&&e.geometry.dispose(),"material"in e&&Array.isArray(e.material)?e.material.forEach(function(t){u1(t)}):"material"in e&&typeof e.material<"u"&&u1(e.material),e.parent&&e.parent.remove(e)}F();function h1(e){return e!=null&&e.geometry.type==="Polygon"&&e.geometry.coordinates[0].length>2}function rN(e,t){let i=e[0]*t[0]+e[1]*t[1],r=Math.sqrt(e[0]*e[0]+e[1]*e[1]),n=Math.sqrt(t[0]*t[0]+t[1]*t[1]);if(r===0||n===0)return 0;let a=i/(r*n),o=Math.max(-1,Math.min(1,a));return Math.acos(o)*(180/Math.PI)}function nN(e,t=5){if(e.length<3)return e;let i=e.length>3&&e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1],r=[],n=i?e.length-1:e.length;for(let a=0;a<n;a++){let o=i&&a===0?e[e.length-2]:e[a-1],s=e[a],l=i&&a===e.length-1?e[1]:e[a+1];if(o==null||l==null){r.push(s);continue}let u=[s[0]-o[0],s[1]-o[1]],h=[l[0]-s[0],l[1]-s[1]];rN(u,h)>t&&r.push(s)}if(i&&r.length>0){let a=r[0],o=r[r.length-1];(a[0]!==o[0]||a[1]!==o[1])&&r.push([a[0],a[1]])}return r}function c1(e,t=5){return Ht(He({},e),{geometry:Ht(He({},e.geometry),{coordinates:e.geometry.coordinates.map(i=>nN(i,t))})})}var d1=.1,aN=15,oN=.25,p1=class{constructor(t,i){S(this,"rendererState");S(this,"dirty",!1);S(this,"convertTo3DMapPosition");S(this,"colorToMaterialCache",{});this.rendererState=t,this.convertTo3DMapPosition=i}update(){var n,a,o;let t,i,r;for(let s of this.rendererState.geometry3DsInScene)if(r=s.components[0],t=s.components[1],i=s.components[5],s.type==="geometry"&&r instanceof Bi&&i!=null){if(i!=null&&i.dirty){if(i.mesh==null)try{if(!h1(r.feature))continue;let l=this.buildBorder(r.feature,t,i);l!=null&&((n=r.mesh)==null||n.add(l))}catch(l){ot.error(l),i.dirty=!1}(a=i.mesh)==null||a.children.forEach(l=>{i&&l.material.color.set(t.borderColor)}),i.dirty=!1,i.visible=t.borderVisible}if(i!=null&&i.needsRebuild){i.mesh!=null&&(cd(i.mesh),i.mesh=void 0);try{let l=this.buildBorder(r.feature,t,i);l!=null&&((o=r.mesh)==null||o.add(l))}catch(l){ot.error(l)}i.needsRebuild=!1,i.visible=t.borderVisible}}}buildBorder(t,i,r){var v,w,P,T,C;let n=hd(t),a=c1(t,aN);if(((w=(v=a.geometry.coordinates[0])==null?void 0:v.length)!=null?w:0)<3)return;let o=hd(a),s=i.borderWidth/2,l=i.borderColor,u=ud(n,this.convertTo3DMapPosition,{width:s,height:s,color:l,cap:"square"}),h=u.clone();h.translate(0,0,i.height);let c;o.geometry.type==="LineString"?c=o.geometry.coordinates:c=o.geometry.coordinates.flat();let p=[];c.pop();for(let A of c||[])try{let k=ud({type:"Feature",geometry:{type:"LineString",coordinates:[[A[0],A[1],0],[A[0],A[1],i.height]]},properties:{}},this.convertTo3DMapPosition,{width:s,height:s,color:l,cap:"butt"});p.push(k)}catch(k){ot.warn(k)}let d=Vo([u,h,...p]),f=(P=this.colorToMaterialCache[l])==null?void 0:P[0];f==null&&(f=new Lr({color:l}));let y=(T=this.colorToMaterialCache[l])==null?void 0:T[1];y==null&&(y=new Lr({color:l})),this.colorToMaterialCache[l]=[f,y];let g=new Ct,_=new sr(d,f),b=new sr(d,y);return g.add(_),g.add(b),b.material.depthWrite=!1,b.material.depthTest=!1,b.material.opacity=oN,b.material.transparent=!0,g.position.z=(C=i.altitude)!=null?C:0,r.mesh=g,g}destroy(){for(let[t,[i,r]]of Object.entries(this.colorToMaterialCache))i.dispose(),r.dispose();this.colorToMaterialCache={}}};var pd="#ffffff",sN=.1,fu=.1,lN="#333333",zo,Fo,Bo,dd=class{constructor(t={}){S(this,"type","style");S(this,"initialColor",pd);vt(this,zo,pd);S(this,"initialTopColor");vt(this,Fo);vt(this,Bo);S(this,"dirty",!0);S(this,"visible",!0);S(this,"opacity",1);S(this,"width",sN);S(this,"height",fu);S(this,"initialHeight",fu);S(this,"altitude",0);S(this,"join","round");S(this,"cap","round");S(this,"showImage",!0);S(this,"flipImageToFaceCamera",!0);S(this,"enableImageCollisions",!1);S(this,"url");S(this,"side","double");S(this,"renderOrder",0);S(this,"shading");S(this,"bevel");S(this,"borderVisible",!1);S(this,"borderColor",lN);S(this,"borderWidth");S(this,"overlayStrength",0);S(this,"overlayColor","#333333");S(this,"maxImageSize");this.color=(t==null?void 0:t.color)!==void 0?t.color:this.color,this.initialColor=this.color,this.width=(t==null?void 0:t.width)!==void 0?t.width:this.width,this.opacity=(t==null?void 0:t.opacity)!==void 0?t.opacity:this.opacity,this.visible=(t==null?void 0:t.visible)!==void 0?t.visible:this.visible,this.height=(t==null?void 0:t.height)!==void 0?t.height:this.height,this.initialHeight=this.height,this.altitude=(t==null?void 0:t.altitude)!==void 0?t.altitude:this.altitude,this.join=(t==null?void 0:t.join)!==void 0?t.join:this.join,this.cap=(t==null?void 0:t.cap)!==void 0?t.cap:this.cap,this.topColor=t==null?void 0:t.topColor,this.initialTopColor=this.topColor,this.showImage=(t==null?void 0:t.showImage)!==void 0?t.showImage:this.showImage,this.flipImageToFaceCamera=(t==null?void 0:t.flipImageToFaceCamera)!==void 0?t.flipImageToFaceCamera:this.flipImageToFaceCamera,this.url=t==null?void 0:t.url,this.side=(t==null?void 0:t.side)!==void 0?t.side:this.side,this.renderOrder=(t==null?void 0:t.renderOrder)!==void 0?t.renderOrder:this.renderOrder,this.shading=t==null?void 0:t.shading,this.bevel=t==null?void 0:t.bevel,this.borderVisible=(t==null?void 0:t.borderVisible)!==void 0?t.borderVisible:this.borderVisible,this.borderColor=(t==null?void 0:t.borderColor)!==void 0?t.borderColor:this.borderColor,this.borderWidth=(t==null?void 0:t.borderWidth)!==void 0?t.borderWidth:d1,this.enableImageCollisions=(t==null?void 0:t.enableImageCollisions)!==void 0?t.enableImageCollisions:this.enableImageCollisions,this.overlayStrength=(t==null?void 0:t.overlayStrength)!==void 0?t.overlayStrength:this.overlayStrength,this.overlayColor=(t==null?void 0:t.overlayColor)!==void 0?t.overlayColor:this.overlayColor,this.maxImageSize=t==null?void 0:t.maxImageSize}set color(t){Xo(t)?tt(this,zo,t):ot.warn('Failed to update color. Invalid color "'.concat(t,'".'))}get color(){return Ie(this,zo)}set topColor(t){t===void 0||Xo(t)?tt(this,Fo,t):ot.warn('Failed to update top color. Invalid color "'.concat(t,'".'))}get topColor(){return Ie(this,Fo)}set hoverColor(t){Xo(t)?tt(this,Bo,t):ot.warn('Failed to update hover color. Invalid color "'.concat(t,'".'))}get hoverColor(){return Ie(this,Bo)}};zo=new WeakMap,Fo=new WeakMap,Bo=new WeakMap;var na=class extends Ad{constructor(){super(...arguments);S(this,"type","entityBatchedMesh");S(this,"userData",{entities:{}})}},Ro,cn,Bi=class{constructor(t){S(this,"mesh");S(this,"imageMesh");S(this,"textMesh");S(this,"textEntityId");S(this,"type","geometry");S(this,"dirty",!0);S(this,"shouldDetach",!1);S(this,"detached",!1);S(this,"instanceIndex",-1);S(this,"geometry");S(this,"batchedProps");S(this,"material");S(this,"feature");S(this,"currentHeight",fu);S(this,"color",new ut);S(this,"topColor",new ut);S(this,"position",new Oe);S(this,"altitude",0);vt(this,Ro,1);vt(this,cn);this.feature=t}get visible(){return this.mesh&&this.instanceIndex!==-1?this.mesh.getVisibleAt(this.instanceIndex):!1}set visible(t){this.mesh&&this.instanceIndex!==-1&&this.mesh.setVisibleAt(this.instanceIndex,t)}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(t){this.mesh&&(this.mesh.renderOrder=t)}setColor(t,i){this.color.set(t),this.topColor.set(i),this.material&&this.material.setColor(this.instanceIndex,this.color,this.topColor)}getColor(){var t;return(t=this.material)==null?void 0:t.getColor(this.instanceIndex)}get opacity(){return Ie(this,Ro)}set opacity(t){tt(this,Ro,t)}get featureBbox(){return Ie(this,cn)?Ie(this,cn):(tt(this,cn,Ax(this.feature)),Ie(this,cn))}};Ro=new WeakMap,cn=new WeakMap;var kt=class extends Ct{constructor(i){super();S(this,"visible",!0);S(this,"type","geometry-group");S(this,"components",[]);S(this,"userData",{entityId:"",entities3D:new Set,dirty:!0,shadingDirty:!0});this.userData.entityId=i}getComponent(i){return this.components.find(r=>(r==null?void 0:r.type)===i)}setVisible(i){this.visible!==i&&(this.visible=i,this.dispatchEvent({type:"childremoved",child:this}))}removeEntity(){this.dispatchEvent({type:"childremoved",child:this})}getfirstChildEntityId(){let i;for(let n of this.children)if(!n.userData.detached){i=n;break}return i instanceof na?Object.values(i.userData.entities)[0]:void 0}};var Dt=class e extends Ct{constructor(i){super();S(this,"childrenIds",new Set);S(this,"children",[]);S(this,"type","group-container");S(this,"userData",{entityId:"",entities2D:new Set,dirty:!0,occluderDirty:!1,opacity:1,computedOpacity:1,preloadGeometry:!1});S(this,"components",[]);this.userData.entityId=i}getComponent(){}addOccluderFeature(i,r){this.userData.occluderFeature=i,this.userData.occluderId=r,this.userData.occluderDirty=!0}addEntity(i){i instanceof e?(this.childrenIds.add(i.userData.entityId),this.add(i)):i instanceof nr?(this.childrenIds.add(i.id),this.add(i.object3d),this.userData.entities2D.add(i.id),i.positionDirty=!0):i instanceof kt?(this.childrenIds.add(i.userData.entityId),this.add(i)):i instanceof Gt&&i.object3d&&(this.childrenIds.add(i.id),this.add(i.object3d)),this.dispatchEvent({type:"childadded",child:this})}removeEntity(i){i instanceof e?(this.childrenIds.delete(i.userData.entityId),this.remove(i)):i instanceof nr?(this.childrenIds.delete(i.id),this.userData.entities2D.delete(i.id),this.remove(i.object3d)):i instanceof kt?(this.childrenIds.delete(i.userData.entityId),this.remove(i)):i instanceof Gt&&i.object3d&&(this.childrenIds.delete(i.id),this.add(i.object3d)),this.dispatchEvent({type:"childremoved",child:this})}setVisible(i){this.visible!==i&&(this.visible=i,this.dispatchEvent({type:"childremoved",child:this}))}setAltitude(i){if(this.position.z!==i){let r=!1;this.matrixWorldAutoUpdate===!1&&(r=!0,pn(this)),this.position.z=i,this.updateMatrixWorld(),r&&dn(this),this.dispatchEvent({type:"childremoved",child:this}),this.set2DGeometryChildrenPositionDirty()}}set2DGeometryChildrenPositionDirty(){this.children.forEach(i=>{i instanceof Fi?i.userData.worldPositionDirty=!0:i instanceof e&&i.set2DGeometryChildrenPositionDirty()})}get altitude(){return this.position.z}setOpacity(i){this.userData.opacity=i}get opacity(){return this.userData.opacity}};F();function uN(e,t,i){let r={translateX:e.x,translateY:e.y,translateZ:e.z,scale:e.meterInMercatorCoordinateUnits()},n=new Vi,a=new Vi().makeTranslation(r.translateX,r.translateY,r.translateZ).scale(new Oe(r.scale,-r.scale,r.scale));return{id:Nv,type:"custom",renderingMode:"3d",render:(o,s)=>{n.fromArray(s.defaultProjectionData.mainMatrix),t.projectionMatrix.copy(n).multiply(a),i()}}}F();function f1(e){return(2*Math.atan(Math.exp((.5-e)*2*Math.PI))-Math.PI/2)*180/Math.PI}function m1(e){return e*360-180}function mu(e){let t=e*Math.PI/180;return .5-Math.log(Math.tan(Math.PI/4+t/2))/(2*Math.PI)}function yu(e){return(e+180)/360}function hN(e,t,i,r){let n=e*Math.PI/180,a=2*Math.PI*ji*Math.cos(n),o=i/a,s=r/a,l=yu(t),u=mu(e),h=l+o,c=u-s,p=m1(h);return{lat:f1(c),lon:p}}function cN(e,t,i,r){let n=yu(t),a=mu(e),o=yu(r),s=mu(i),l=o-n,u=a-s,h=e*Math.PI/180,c=2*Math.PI*ji*Math.cos(h),p=l*c,d=u*c;return{x:p,y:d}}function pN(e,t,i=1e-10){if(e.length!==t.length)return!1;let r=Math.abs(e[0]-t[0])<i,n=Math.abs(e[1]-t[1])<i;if(e.length===3&&t.length===3){let a=Math.abs(e[2]-t[2])<i;return r&&n&&a}return r&&n}F();function dN(e){let t=e.min,i=e.max,r=new Oe(t.x,t.y,t.z),n=new Oe(i.x,t.y,t.z),a=new Oe(t.x,i.y,t.z),o=new Oe(i.x,i.y,t.z);return[r,n,a,o]}F();function y1(e,t){let i;return typeof t=="string"||typeof t=="number"?(i=e.geometry2DMap.get(t),i==null&&(i=e.geometry3DMap.get(t))):typeof(t==null?void 0:t.id)=="string"||typeof(t==null?void 0:t.id)=="number"?(i=e.geometry2DMap.get(t.id),i==null&&(i=e.geometry3DMap.get(t.id))):i=t,i}function iW(e,t,i=[],r=new la,n){(e.getSystems().renderSystem.threeDdirty||e.getSystems().renderSystem.twoDdirty)&&e.renderSync();let a=y1(e.getInternalState(),t);return g1(a,i,r,n),i}var gu=new Oe;function g1(e,t=[],i=new la,r){if(e.visible){if(e.isMesh||e.isLine||e.isPoints){let n=e.geometry;if(n.isBufferGeometry){let a=n.attributes.position;for(let o=0;o<a.count;o++)gu.fromBufferAttribute(a,o),r!==void 0&&(gu.z=r),t.push(gu.clone()),i.expandByPoint(gu)}}for(let n of e.children)g1(n,t,i,r)}}F();function fN(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}F();function ko(e,t){let i={};for(let r=0;r<t.length;r++){let n=t[r];n in e&&(i[n]=e[n])}return i}function rd(e){return Object.keys(e).length===0}F();var mN=e=>t=>{if(!t.includes("mappedin")){let i={};for(let r in e){let n=e[r];t.includes("mappedin")||(e[r]=n)}return{url:t,headers:i}}return{url:t,headers:e}};F();var yN=1e4;function gN(e,t){var n;let i=(n=t==null?void 0:t.timeout)!=null?n:yN,r=t==null?void 0:t.styleUrl;return new Promise((a,o)=>{let s=!1,l=()=>{e.off("style.load",u),e.off("error",h),clearTimeout(c)},u=()=>{s||(s=!0,l(),a())},h=p=>{var y,g;let d=(y=p.error)==null?void 0:y.url;if((d==null?void 0:d.includes("style"))||r&&d===r){if(s)return;s=!0,l(),o(new Error("Style loading failed: ".concat(((g=p.error)==null?void 0:g.message)||"Unknown error")))}},c=setTimeout(()=>{s||(s=!0,l(),o(new Error("Style loading timed out")))},i);e.once("style.load",u),e.on("error",h)})}var _N=()=>{};function pn(e,t=!1){t?e.traverse(i=>{pn(i)}):(e.matrixWorldAutoUpdate=!0,e.updateMatrixWorld=Ct.prototype.updateMatrixWorld)}function dn(e,t=!1){t?e.traverse(i=>{dn(i)}):(e.matrixWorldAutoUpdate=!1,e.updateMatrixWorld=_N)}var xN=(e,t,i,r,n,a=!1)=>{var l;let o=e instanceof Dt&&e.userData.preloadGeometry,s=a||o&&!e.visible;if(e.children&&(e.visible||o)){pn(e);for(let u of e.children){if(u.visible&&u.type&&!s)if(pn(u),"entities3D"in u.userData&&((l=u.userData)!=null&&l.entities3D)&&u instanceof kt){i.add(u.userData.entityId),r.add(u);for(let h of u.userData.entities3D.values())i.add(h),t.has(h)&&r.add(t.get(h))}else u.type==="group-container"||u.type==="custom-geometry"?(i.add(u.userData.entityId),r.add(u)):u instanceof sn&&(i.add(u.userData.entityId),t.has(u.userData.entityId)&&r.add(t.get(u.userData.entityId)));else dn(u);u instanceof kt&&u.userData.dirty&&n.add(u.userData.entityId),xN(u,t,i,r,n,s)}}else dn(e);return i},vN=(e,t,i,r)=>{var n;if(e.children&&e.visible&&!((n=e.userData)!=null&&n.hidden)){pn(e);for(let a of e.children)a instanceof Fi&&(a.visible?(pn(a),i.add(a.userData.entityId),t.has(a.userData.entityId)&&r.add(t.get(a.userData.entityId))):dn(a)),vN(a,t,i,r)}else dn(e);return i};function nd(e,t){for(let i in t)if(!(i==="__proto__"||i==="constructor"||i==="prototype")){if(t[i]==null){e[i]=void 0;continue}Array.isArray(t[i])?e[i]=t[i]:typeof t[i]=="object"&&typeof e[i]=="object"&&e[i]!==null&&!Array.isArray(e[i])?nd(e[i],t[i]):e[i]=t[i]}return e}function bN(e){return fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}async function TW(e){let t=await bN(e),{access_token:i}=await t.json();return{"x-mappedin-tiles-key":i}}function SW(e,t=0){let i=3735928559^t,r=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),i=Math.imul(i^a,2654435761),r=Math.imul(r^a,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&r)+(i>>>0)}function MW(e,t,i){let r=e*(Math.PI/180)/2,n=t/2;return i*Math.tan(r)/n}function CW(e){return new Di(new re(e[0][0],e[0][1]),new re(e[1][0],e[1][1])).getCenter().toArray()}function IW(e,t){return e<t||t<=12}function AW(e){let t=1;return e.type==="geometry-group"&&e.parent!=null&&e.parent instanceof Dt?t=e.parent.userData.computedOpacity:(e.type==="geometry"||e.type==="custom-geometry"||e.type==="model")&&e.parentObject3D!=null&&e.parentObject3D instanceof kt&&e.parentObject3D.parent!=null&&e.parentObject3D.parent instanceof Dt&&(t=e.parentObject3D.parent.userData.computedOpacity),t}var wN="maplibre-frustum-culling-hack";function EW(){let e=new Cd(.01,.01,.01),t=new Lr({opacity:0,depthWrite:!1,transparent:!0}),i=new sr(e,t);return i.position.copy(new Oe(0,50,0)),i.frustumCulled=!1,i.name=wN,i}var Ir=new Oe,_1=new Ni;function kW(e,t,i=new No){return e.updateMatrixWorld(),e.traverse(r=>{if(r instanceof sr){let a=r.geometry.attributes.position;if(t.position.distanceTo(r.position)<t.near)return;for(let s=0;s<a.count;s++)Ir.fromBufferAttribute(a,s),Ir.applyMatrix4(r.matrixWorld),Ir.applyMatrix4(t.matrixWorldInverse),Ir.applyMatrix4(t.projectionMatrix),Ir.z<1&&Ir.z>0&&(_1.set(Ir.x,Ir.y),i.expandByPoint(_1))}}),i}function x1(e,t){let i=t.clientWidth,r=t.clientHeight;return new Ni((e.x+1)*i/2,(1-e.y)*r/2)}function DW(e,t,i){let r=document.createElement("div");r.style.position="absolute",r.style.border="2px solid ".concat(t),r.style.pointerEvents="none";let n=x1(new Ni(e.min.x,e.min.y),i),a=x1(new Ni(e.max.x,e.max.y),i);r.style.left="".concat(n.x,"px"),r.style.top="".concat(a.y,"px");let o=Math.abs(a.x-n.x),s=Math.abs(a.y-n.y);return r.style.width="".concat(o,"px"),r.style.height="".concat(s,"px"),i.appendChild(r),r}function LW(e,t){let i=0,r=0,n=e.clientWidth,a=e.clientHeight;if(t){let{left:o,top:s,right:l,bottom:u,type:h}=t,c=o!=null?o:0,p=s!=null?s:0,d=l!=null?l:0,f=u!=null?u:0;h==="portion"?(i=c*n,r=p*a,n=n-i-d*n,a=a-r-f*a):(i=c,r=p,n=n-i-d,a=a-r-f)}return[i,r,n,a].map(o=>Math.max(o,0))}function id(e){return(e*100|0)/100}function zW(e,t,i){t>e.getMaxZoom()?(e.setMaxZoom(i),e.setMinZoom(t)):(e.setMinZoom(t),e.setMaxZoom(i))}F();var fd=class{constructor(t){S(this,"type","text3dStyle");S(this,"visible");S(this,"altitude");S(this,"color");S(this,"dirty",!0);S(this,"maxWidth");S(this,"maxHeight");S(this,"hoverByPolygon");S(this,"flipToFaceCamera",v1.flipToFaceCamera);S(this,"font");S(this,"fillOpacity");S(this,"fontSize");S(this,"margin");S(this,"outlineWidth");S(this,"outlineBlur");S(this,"outlineOffsetX");S(this,"strokeColor");S(this,"strokeOpacity");S(this,"strokeWidth");S(this,"hoverColor");S(this,"outlineOffsetY");S(this,"outlineColor");S(this,"outlineOpacity");t&&Object.assign(this,t)}getState(t=!1){let i={};for(let r in this)!t&&r==="dirty"||this[r]!==void 0&&(i[r]=this[r]);return i}},v1=Object.freeze({visible:!0,color:"black",flipToFaceCamera:!0,fillOpacity:1,font:void 0,fontSize:2,margin:[.2,1,.2,1.5],outlineColor:"black",outlineOpacity:1,outlineWidth:0,outlineOffsetX:0,outlineOffsetY:0,outlineBlur:0,strokeOpacity:1,strokeWidth:0,maxWidth:void 0,maxHeight:void 0,strokeColor:"black",hoverColor:void 0});F();F();var fn,md=class{constructor(t){S(this,"type","modelStyle");S(this,"dirty",!0);S(this,"renderOrderDirty",!0);S(this,"visible",!0);S(this,"opacity",1);S(this,"verticalOffset",0);S(this,"interactive",!1);S(this,"color");S(this,"material");S(this,"rotation");S(this,"scale");vt(this,fn,!1);S(this,"EXPERIMENTAL_clippingEnabled",!1);S(this,"clippingPlaneZOffset",1/0);S(this,"clippingPlaneTopColor");S(this,"clippingPlaneTopVisible",!0);if(t){let i=t,{visibleThroughGeometry:r,EXPERIMENTAL_clippingEnabled:n}=i,a=vd(i,["visibleThroughGeometry","EXPERIMENTAL_clippingEnabled"]);Object.assign(this,a),r!==void 0&&tt(this,fn,r),n!==void 0&&(this.EXPERIMENTAL_clippingEnabled=n)}}get visibleThroughGeometry(){return Ie(this,fn)}set visibleThroughGeometry(t){Ie(this,fn)!==t&&(tt(this,fn,t),this.renderOrderDirty=!0)}};fn=new WeakMap;F();var PN=[1,1,1],TN=[0,0,0];export{M1 as a,C1 as b,SN as c,ot as d,ua as e,Nd as f,ji as g,E1 as h,k1 as i,VN as j,Fr as k,Rd as l,jN as m,GN as n,D1 as o,UN as p,XN as q,$N as r,qN as s,YN as t,L1 as u,JN as v,o8 as w,bt as x,h8 as y,ha as z,Iu as A,Ud as B,Xo as C,b8 as D,w8 as E,$d as F,U1 as G,M8 as H,q1 as I,C8 as J,z1 as K,Sr as L,iR as M,LX as N,Cx as O,zX as P,FX as Q,BX as R,RX as S,OX as T,NX as U,VX as V,jl as W,$X as X,nR as Y,qX as Z,Ix as _,Ex as $,lR as aa,a$ as ba,K as ca,Gx as da,Bp as ea,Ux as fa,$x as ga,b$ as ha,Qx as ia,Iv as ja,Wp as ka,q$ as la,kv as ma,De as na,vV as oa,MV as pa,CV as qa,nr as ra,sn as sa,Gt as ta,Zq as ua,Wq as va,Nv as wa,Vv as xa,Hq as ya,Kq as za,Jq as Aa,Qq as Ba,e7 as Ca,t7 as Da,uN as Ea,hN as Fa,cN as Ga,pN as Ha,dN as Ia,y1 as Ja,iW as Ka,fN as La,mN as Ma,$o as Na,gN as Oa,pn as Pa,dn as Qa,xN as Ra,vN as Sa,TW as Ta,SW as Ua,MW as Va,CW as Wa,IW as Xa,AW as Ya,EW as Za,kW as _a,DW as $a,LW as ab,id as bb,zW as cb,fd as db,v1 as eb,md as fb,PN as gb,TN as hb,Lv as ib,VO as jb,dq as kb,GO as lb,Bv as mb,vq as nb,eu as ob,tu as pb,Aq as qb,ed as rb,Eq as sb,Io as tb,x7 as ub,td as vb,v7 as wb,b7 as xb,w7 as yb,P7 as zb,T7 as Ab,nu as Bb,au as Cb,lu as Db,Eo as Eb,uY as Fb,hY as Gb,cY as Hb,ZO as Ib,jv as Jb,pY as Kb,dY as Lb,fY as Mb,mY as Nb,yY as Ob,Uv as Pb,gY as Qb,_Y as Rb,xY as Sb,vY as Tb,$v as Ub,HO as Vb,bY as Wb,KO as Xb,JO as Yb,wY as Zb,PY as _b,QO as $b,e4 as ac,TY as bc,SY as cc,t4 as dc,MY as ec,CY as fc,i4 as gc,IY as hc,AY as ic,EY as jc,kY as kc,ar as lc,ud as mc,cd as nc,p1 as oc,pd as pc,dd as qc,na as rc,Bi as sc,kt as tc,Dt as uc};
|