lecodes-viewer 0.19.2 → 0.20.2

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.
Files changed (30) hide show
  1. package/dist-embed/VERSION.json +3 -3
  2. package/dist-embed/assets/{createViewer2d-D12Wy3VF.js → createViewer2d-Dx-COLjO.js} +1 -1
  3. package/dist-embed/assets/createViewerLite-B91Sj6p_.js +852 -0
  4. package/dist-embed/assets/host-DZ6302Ho.js +168 -0
  5. package/dist-embed/assets/{index-UwRci5mq.js → index-D10DoNfS.js} +1 -1
  6. package/dist-embed/assets/{loadCreatorUiNode-UAdhjRTd.js → loadCreatorUiNode-D87bZHrH.js} +1 -1
  7. package/dist-embed/assets/mapViewImpl-B2JcES8l.js +810 -0
  8. package/dist-embed/assets/maplibre-gl-worker-CJfwIrte.js +8 -0
  9. package/dist-embed/assets/{particles-DxYDmI1O.filamat → particles-Cgp1L6RQ.filamat} +0 -0
  10. package/dist-embed/assets/{particles-quad-DwYo9yCK.filamat → particles-quad-CgrEJN4M.filamat} +0 -0
  11. package/dist-embed/embed.js +9 -9
  12. package/package.json +7 -3
  13. package/src/createViewer.ts +2 -0
  14. package/src/host.ts +3 -0
  15. package/src/ui/nativeViewSystem.ts +2 -91
  16. package/src/ui/presentPlayer.ts +2 -156
  17. package/src/utils/imageNode.ts +5 -0
  18. package/src/viewer/createViewer.ts +26 -2
  19. package/src/viewer/particles-quad.filamat +0 -0
  20. package/src/viewer/particles.filamat +0 -0
  21. package/dist-embed/assets/createViewerLite-CinItTpO.js +0 -707
  22. package/dist-embed/assets/host-Vzbyo0SX.js +0 -162
  23. package/src/assets/banner.png +0 -0
  24. package/src/assets/image2.png +0 -0
  25. package/src/assets/landing.mp4 +0 -0
  26. package/src/assets/neutral_ibl256.ktx +0 -0
  27. package/src/assets/output.mp4 +0 -0
  28. package/src/assets/output2.mp4 +0 -0
  29. package/src/assets/texture.png +0 -0
  30. package/src/assets/vue.svg +0 -1
@@ -0,0 +1,8 @@
1
+ (function(){"use strict";/**
2
+ * MapLibre GL JS
3
+ * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.7.0/LICENSE.txt
4
+ */var me,ht,Nt;var hf=Object.create,Co=Object.defineProperty,cf=Object.getOwnPropertyDescriptor,pf=Object.getOwnPropertyNames,ff=Object.getPrototypeOf,df=Object.prototype.hasOwnProperty,Ln=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),yf=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=pf(t),a=0,s=n.length,o;a<s;a++)o=n[a],!df.call(e,o)&&o!==r&&Co(e,o,{get:(l=>t[l]).bind(null,o),enumerable:!(i=cf(t,o))||i.enumerable});return e},mf=(e,t,r)=>(r=e==null?{}:hf(ff(e)),yf(Co(r,"default",{value:e,enumerable:!0}),e));function B(e,t){this.x=e,this.y=t}B.prototype={clone(){return new B(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),r=Math.sin(e),i=t*this.x-r*this.y,n=r*this.x+t*this.y;return this.x=i,this.y=n,this},_rotateAround(e,t){let r=Math.cos(e),i=Math.sin(e),n=t.x+r*(this.x-t.x)-i*(this.y-t.y),a=t.y+i*(this.x-t.x)+r*(this.y-t.y);return this.x=n,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:B},B.convert=function(e){if(e instanceof B)return e;if(Array.isArray(e))return new B(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new B(+e.x,+e.y);throw Error("Expected [x, y] or {x, y} point format")};let Bo;function gf(){return Bo??(Bo=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Bo}let _i;function xf(){if(_i==null&&(_i=!1,gf())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let r=0;r<25;r++){let i=r*4;e.fillStyle=`rgb(${i},${i+1},${i+2})`,e.fillRect(r%5,Math.floor(r/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!=3&&t[r]!==r){_i=!0;break}}}return _i||!1}var Ue=typeof Float32Array<"u"?Float32Array:Array;function vf(){var e=new Ue(9);return Ue!=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 Po(){var e=new Ue(3);return Ue!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function bf(e){var t=e[0],r=e[1],i=e[2];return Math.sqrt(t*t+r*r+i*i)}function Mo(e,t,r){var i=new Ue(3);return i[0]=e,i[1]=t,i[2]=r,i}function wf(e,t){var r=t[0],i=t[1],n=t[2],a=r*r+i*i+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 _f(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Vn(e,t,r){var i=t[0],n=t[1],a=t[2],s=r[0],o=r[1],l=r[2];return e[0]=n*l-a*o,e[1]=a*s-i*l,e[2]=i*o-n*s,e}var Sf=bf;(function(){var e=Po();return function(t,r,i,n,a,s){var o,l;for(r||(r=3),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],a(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2];return t}})();function Af(){var e=new Ue(4);return Ue!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Df(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],s=r*r+i*i+n*n+a*a;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=i*s,e[2]=n*s,e[3]=a*s,e}function Ef(e,t,r){var i=t[0],n=t[1],a=t[2],s=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*s,e[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*s,e[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*s,e[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*s,e}(function(){var e=Af();return function(t,r,i,n,a,s){var o,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],e[3]=t[o+3],a(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2],t[o+3]=e[3];return t}})();function zo(){var e=new Ue(4);return Ue!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Tf(e,t,r){r*=.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function On(e,t,r,i){var n=t[0],a=t[1],s=t[2],o=t[3],l=r[0],u=r[1],h=r[2],c=r[3],p,f=n*l+a*u+s*h+o*c,d,y,m;return f<0&&(f=-f,l=-l,u=-u,h=-h,c=-c),1-f>1e-6?(p=Math.acos(f),d=Math.sin(p),y=Math.sin((1-i)*p)/d,m=Math.sin(i*p)/d):(y=1-i,m=i),e[0]=y*n+m*l,e[1]=y*a+m*u,e[2]=y*s+m*h,e[3]=y*o+m*c,e}function If(e,t){var r=t[0]+t[4]+t[8],i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[n*3+n]&&(n=2);var a=(n+1)%3,s=(n+2)%3;i=Math.sqrt(t[n*3+n]-t[a*3+a]-t[s*3+s]+1),e[n]=.5*i,i=.5/i,e[3]=(t[a*3+s]-t[s*3+a])*i,e[a]=(t[a*3+n]+t[n*3+a])*i,e[s]=(t[s*3+n]+t[n*3+s])*i}return e}var Lo=Df;(function(){var e=Po(),t=Mo(1,0,0),r=Mo(0,1,0);return function(i,n,a){var s=_f(n,a);return s<-.999999?(Vn(e,t,n),Sf(e)<1e-6&&Vn(e,r,n),wf(e,e),Tf(i,e,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Vn(e,n,a),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=1+s,Lo(i,i))}})(),(function(){var e=zo(),t=zo();return function(r,i,n,a,s,o){return On(e,i,s,o),On(t,n,a,o),On(r,e,t,2*o*(1-o)),r}})(),(function(){var e=vf();return function(t,r,i,n){return e[0]=i[0],e[3]=i[1],e[6]=i[2],e[1]=n[0],e[4]=n[1],e[7]=n[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],Lo(t,If(t,e))}})();function kf(){var e=new Ue(2);return Ue!=Float32Array&&(e[0]=0,e[1]=0),e}(function(){var e=kf();return function(t,r,i,n,a,s){var o,l;for(r||(r=2),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],a(e,e,s),t[o]=e[0],t[o+1]=e[1];return t}})();const ne=8192,Ff="__$json__:";function Si(e){return e instanceof Error?e:Error(typeof e=="string"?e:String(e))}function Cf(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function Sr(e,t,r){return Math.min(r,Math.max(t,e))}function Bf(e,t,r){let i=r-t,n=((e-t)%i+i)%i+t;return n===t?r:n}function ke(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function Pf(e){return Math.log(e)/Math.LN2%1==0}function $n(e,t,r){let i={};for(let n in e)i[n]=t.call(this,e[n],n,e);return i}function Mf(e,t,r){let i={};for(let n in e)t.call(this,e[n],n,e)&&(i[n]=e[n]);return i}function ct(e){return Array.isArray(e)?e.map(ct):typeof e=="object"&&e?$n(e,ct):e}const Vo={};function ge(e){Vo[e]||(typeof console<"u"&&console.warn(e),Vo[e]=!0)}function pt(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function Gt(e){return typeof WorkerGlobalScope<"u"&&e!==void 0&&e instanceof WorkerGlobalScope}function Rn(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}function zf(e,t,r,i,n){let a=Math.max(-t,0)*4,s=(Math.max(0,r)-r)*i*4+a,o=i*4,l=Math.max(0,t),u=Math.max(0,r),h=Math.min(e.width,t+i),c=Math.min(e.height,r+n);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:s,stride:o}]}}async function Lf(e,t,r,i,n){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let a=new VideoFrame(e,{timestamp:0});try{let s=a==null?void 0:a.format;if(!s||!(s.startsWith("BGR")||s.startsWith("RGB")))throw Error(`Unrecognized format ${s}`);let o=s.startsWith("BGR"),l=new Uint8ClampedArray(i*n*4);if(await a.copyTo(l,zf(e,t,r,i,n)),o)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()}}let Ar,Dr;function Vf(e,t,r,i,n){let a=e.width,s=e.height;(!Ar||!Dr)&&(Ar=new OffscreenCanvas(a,s),Dr=Ar.getContext("2d",{willReadFrequently:!0})),Ar.width=a,Ar.height=s,Dr.drawImage(e,0,0,a,s);let o=Dr.getImageData(t,r,i,n);return Dr.clearRect(0,0,a,s),o.data}async function Of(e,t,r,i,n){if(xf())try{return await Lf(e,t,r,i,n)}catch{}return Vf(e,t,r,i,n)}function Oo(e,t,r,i){return e.addEventListener(t,r,i),{unsubscribe:()=>{e.removeEventListener(t,r,i)}}}function $o(e){return e*Math.PI/180}const Ro="AbortError";var Nn=class extends Error{constructor(e=Ro){super(e instanceof Error?e.message:e),this.name=Ro,e instanceof Error&&e.stack&&(this.stack=e.stack)}};function No(e){return e instanceof Error&&e.name==="AbortError"}function $f(e){if(e.aborted)throw new Nn(e.reason)}const Un={REGISTERED_PROTOCOLS:{}};function Rf(e){return Un.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}function Nf(e,t){Un.REGISTERED_PROTOCOLS[e]=t}function Uf(e){delete Un.REGISTERED_PROTOCOLS[e]}const Uo="global-dispatcher";var Ai=class extends Error{constructor(e,t,r,i){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=i}};function qo(){var e;if(Gt(self))return(e=self.worker)==null?void 0:e.referrer;if(window.location.protocol==="blob:")try{return window.parent.location.href}catch{}return window.location.href}const qf=e=>{var t;return e.startsWith("file:")||((t=qo())==null?void 0:t.startsWith("file:"))&&!/^\w+:/.test(e)};async function Gf(e,t){let r=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:qo(),referrerPolicy:e.referrerPolicy,signal:t.signal});e.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let i;try{i=await fetch(r)}catch(s){throw No(s)?s:new Ai(0,Si(s).message,e.url,new Blob)}if(!i.ok){let s=await i.blob();throw new Ai(i.status,i.statusText,e.url,s)}let n;n=e.type==="arrayBuffer"||e.type==="image"?i.arrayBuffer():e.type==="json"?i.json():i.text();let a=await n;return $f(t.signal),{data:a,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}}function jf(e,t){return new Promise((r,i)=>{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 s in e.headers)n.setRequestHeader(s,e.headers[s]);e.type==="json"&&(n.responseType="text",(a=e.headers)!=null&&a.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials=e.credentials==="include",n.onerror=()=>{i(Error(n.statusText))},n.onload=()=>{if(!t.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let s=n.response;if(e.type==="json")try{s=JSON.parse(n.response)}catch(o){i(o);return}r({data:s,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires"),etag:n.getResponseHeader("ETag")})}else{let s=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});i(new Ai(n.status,n.statusText,e.url,s))}},t.signal.addEventListener("abort",()=>{n.abort(),i(new Nn(t.signal.reason))}),n.send(e.body)})}const qn=async function(e,t){var r,i;if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){let n=Rf(e.url);if(n){let a=await n(e,t);return!a.data&&e.type==="arrayBuffer"?ke(a,{data:new ArrayBuffer(0)}):a}if(Gt(self)&&((r=self.worker)!=null&&r.actor))return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:Uo},t)}if(!qf(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return Gf(e,t);if(Gt(self)&&((i=self.worker)!=null&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:Uo},t)}return jf(e,t)},Yf=(e,t)=>qn(ke(e,{type:"json"}),t),Xf=(e,t)=>qn(ke(e,{type:"arrayBuffer"}),t);function Go(e,t,r){var i;(i=r[e])!=null&&i.includes(t)||(r[e]||(r[e]=[]),r[e].push(t))}function Gn(e,t,r){if(r!=null&&r[e]){let i=r[e].indexOf(t);i!==-1&&r[e].splice(i,1)}}var jo=class{constructor(e,t={}){ke(this,t),this.type=e}},Di=class extends jo{constructor(e,t={}){super("error",ke({error:e},t))}},Zf=class{on(e,t){return this._listeners||(this._listeners={}),Go(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return Gn(e,t,this._listeners),Gn(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||(this._oneTimeListeners={}),Go(e,t,this._oneTimeListeners),this):new Promise(r=>this.once(e,r))}fire(e,t){var n,a,s,o;let r=typeof e=="string"?new jo(e,t||{}):e,i=r.type;if(this.listens(i)){r.target=this;let l=((a=(n=this._listeners)==null?void 0:n[i])==null?void 0:a.slice())??[];for(let c of l)c.call(this,r);let u=((o=(s=this._oneTimeListeners)==null?void 0:s[i])==null?void 0:o.slice())??[];for(let c of u)Gn(i,c,this._oneTimeListeners),c.call(this,r);let h=this._eventedParent;h&&(ke(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(r))}else r instanceof Di&&console.error(r.error);return this}listens(e){var t,r,i,n,a;return!!((r=(t=this._listeners)==null?void 0:t[e])!=null&&r.length||(n=(i=this._oneTimeListeners)==null?void 0:i[e])!=null&&n.length||(a=this._eventedParent)!=null&&a.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}},Yo={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"},"fill-extrusion-rounded-corner-distance":{type:"number",default:0,minimum:0,units:"meters","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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"},"symbol-height-offset":{type:"number",default:0,units:"meters",requires:[{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-height-anchor":{type:"enum",values:{ground:{},absolute:{}},default:"ground",requires:["symbol-height-offset"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const w=Yo,Wf=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var D=class{constructor(e,t,r,i,n="error"){this.message=(e?`${e}: `:"")+r,i&&(this.identifier=i),this.severity=n,t!=null&&t.__line__&&(this.line=t.__line__)}};const Er={kind:"null"},k={kind:"number"},U={kind:"string"},Y={kind:"boolean"},qe={kind:"color"},Ei={kind:"projectionDefinition"},bt={kind:"object"},G={kind:"value"},Hf={kind:"error"},Ti={kind:"collator"},Tr={kind:"formatted"},Ii={kind:"padding"},Ir={kind:"colorArray"},ki={kind:"numberArray"},kr={kind:"resolvedImage"},Fi={kind:"variableAnchorOffsetCollection"};function Ae(e,t){return{kind:"array",itemType:e,N:t}}function ee(e){if(e.kind==="array"){let t=ee(e.itemType);return typeof e.N=="number"?`array<${t}, ${e.N}>`:e.itemType.kind==="value"?"array":`array<${t}>`}return e.kind}const Kf=[Er,k,U,Y,qe,Ei,Tr,bt,Ae(G),Ii,ki,Ir,kr,Fi];function Fr(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Fr(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 r of Kf)if(!Fr(r,t))return null}}return`Expected ${ee(e)} but found ${ee(t)} instead.`}function jn(e,t){return t.some(r=>r.kind===e.kind)}function wt(e,t){return t.some(r=>r==="null"?e===null:r==="array"?Array.isArray(e):r==="object"?e&&!Array.isArray(e)&&typeof e=="object":r===typeof e)}function ft(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}const Xo=.96422,Zo=.82521,Wo=4/29,Yn=6/29,Ho=3*Yn*Yn,Jf=Math.PI/180,Qf=180/Math.PI;function Ko(e){return e%=360,e<0&&(e+=360),e}function Jo([e,t,r,i]){e=Xn(e),t=Xn(t),r=Xn(r);let n,a,s=Zn((.2225045*e+.7168786*t+.0606169*r)/1);e===t&&t===r?n=a=s:(n=Zn((.4360747*e+.3850649*t+.1430804*r)/Xo),a=Zn((.0139322*e+.0971045*t+.7141733*r)/Zo));let o=116*s-16;return[o<0?0:o,500*(n-s),200*(s-a),i]}function Xn(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Zn(e){return e>.008856451679035631?e**(1/3):e/Ho+Wo}function Qo([e,t,r,i]){let n=(e+16)/116,a=isNaN(t)?n:n+t/500,s=isNaN(r)?n:n-r/200;return n=1*Hn(n),a=Xo*Hn(a),s=Zo*Hn(s),[Wn(3.1338561*a-1.6168667*n-.4906146*s),Wn(-.9787684*a+1.9161415*n+.033454*s),Wn(.0719453*a-.2289914*n+1.4052427*s),i]}function Wn(e){return e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055,e<0?0:e>1?1:e}function Hn(e){return e>Yn?e*e*e:Ho*(e-Wo)}function ed(e){let[t,r,i,n]=Jo(e),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?Ko(Math.atan2(i,r)*Qf):NaN,a,t,n]}function td([e,t,r,i]){return e=isNaN(e)?0:e*Jf,Qo([r,Math.cos(e)*t,Math.sin(e)*t,i])}function rd([e,t,r,i]){e=Ko(e),t/=100,r/=100;function n(a){let s=(a+e/30)%12,o=t*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(s-3,9-s,1))}return[n(0),n(8),n(4),i]}const id=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Cr(e,t){return id(e,t)?e[t]:void 0}function nd(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=Cr(ad,e);if(t){let[i,n,a]=t;return[i/255,n/255,a/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let i=e.length<6?1:2,n=1;return[Ci(e.slice(n,n+=i)),Ci(e.slice(n,n+=i)),Ci(e.slice(n,n+=i)),Ci(e.slice(n,n+i)||"ff")]}if(e.startsWith("rgb")){let i=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){let[n,a,s,o,l,u,h,c,p,f,d,y]=i,m=[o||" ",h||" ",f].join("");if(m===" "||m===" /"||m===",,"||m===",,,"){let g=[s,u,p].join(""),x=g==="%%%"?100:g===""?255:0;if(x){let v=[jt(+a/x,0,1),jt(+l/x,0,1),jt(+c/x,0,1),d?el(+d,y):1];if(tl(v))return v}}return}}let r=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){let[i,n,a,s,o,l,u,h,c]=r,p=[a||" ",o||" ",u].join("");if(p===" "||p===" /"||p===",,"||p===",,,"){let f=[+n,jt(+s,0,100),jt(+l,0,100),h?el(+h,c):1];if(tl(f))return rd(f)}}}function Ci(e){return parseInt(e.padEnd(2,e),16)/255}function el(e,t){return jt(t?e/100:e,0,1)}function jt(e,t,r){return Math.min(Math.max(t,e),r)}function tl(e){return!e.some(Number.isNaN)}const ad={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 dt(e,t,r){return e+r*(t-e)}function Yt(e,t,r){return e.map((i,n)=>dt(i,t[n],r))}function sd(e){return e==="rgb"||e==="hcl"||e==="lab"}var te=(me=class{constructor(t,r,i,n=1,a=!0){this.r=t,this.g=r,this.b=i,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,r,i,n]))}static parse(t){if(t instanceof me)return t;if(typeof t!="string")return;let r=nd(t);if(r)return new me(...r,!1)}get rgb(){let{r:t,g:r,b:i,a:n}=this,a=n||1/0;return this.overwriteGetter("rgb",[t/a,r/a,i/a,n])}get hcl(){return this.overwriteGetter("hcl",ed(this.rgb))}get lab(){return this.overwriteGetter("lab",Jo(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,i,n]=this.rgb;return`rgba(${[t,r,i].map(a=>Math.round(a*255)).join(",")},${n})`}static interpolate(t,r,i,n="rgb"){switch(n){case"rgb":{let[a,s,o,l]=Yt(t.rgb,r.rgb,i);return new me(a,s,o,l,!1)}case"hcl":{let[a,s,o,l]=t.hcl,[u,h,c,p]=r.hcl,f,d;if(!isNaN(a)&&!isNaN(u)){let v=u-a;u>a&&v>180?v-=360:u<a&&a-u>180&&(v+=360),f=a+i*v}else isNaN(a)?isNaN(u)?f=NaN:(f=u,(o===1||o===0)&&(d=h)):(f=a,(c===1||c===0)&&(d=s));let[y,m,g,x]=td([f,d??dt(s,h,i),dt(o,c,i),dt(l,p,i)]);return new me(y,m,g,x,!1)}case"lab":{let[a,s,o,l]=Qo(Yt(t.lab,r.lab,i));return new me(a,s,o,l,!1)}}}},me.black=new me(0,0,0,1),me.white=new me(1,1,1,1),me.transparent=new me(0,0,0,0),me.red=new me(1,0,0,1),me);const od=["bottom","center","top"];var Kn=class{constructor(e,t,r,i,n,a){this.text=e,this.image=t,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=a}},tt=class Bn{constructor(t){this.sections=t}static fromString(t){return new Bn([new Kn(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Bn?t:Bn.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}},Ze=class gi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof gi)return t;if(typeof t=="number")return new gi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let r of t)if(typeof r!="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]]}return new gi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i){return new gi(Yt(t.values,r.values,i))}},We=class xi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof xi)return t;if(typeof t=="number")return new xi([t]);if(Array.isArray(t)){for(let r of t)if(typeof r!="number")return;return new xi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i){return new xi(Yt(t.values,r.values,i))}},Me=class vi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof vi)return t;if(typeof t=="string"){let i=te.parse(t);return i?new vi([i]):void 0}if(!Array.isArray(t))return;let r=[];for(let i of t){if(typeof i!="string")return;let n=te.parse(i);if(!n)return;r.push(n)}return new vi(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i,n="rgb"){let a=[];if(t.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)a.push(te.interpolate(t.values[s],r.values[s],i,n));return new vi(a)}},J=class extends Error{constructor(e,t){super(e),this.name="RuntimeError",this.path=t}toJSON(){return this.message}};const ld=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var He=class Pn{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Pn)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!=0)){for(let r=0;r<t.length;r+=2){let i=t[r],n=t[r+1];if(typeof i!="string"||!ld.has(i)||!Array.isArray(n)||n.length!==2||typeof n[0]!="number"||typeof n[1]!="number")return}return new Pn(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i,n){let a=t.values,s=r.values;if(a.length!==s.length)throw new J(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`,n);let o=[];for(let l=0;l<a.length;l+=2){if(a[l]!==s[l])throw new J(`Cannot interpolate values containing mismatched anchors. from[${l}]: ${a[l]}, to[${l}]: ${s[l]}`,n);o.push(a[l]);let[u,h]=a[l+1],[c,p]=s[l+1];o.push([dt(u,c,i),dt(h,p,i)])}return new Pn(o)}},Ke=class Mp{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Mp({name:t,available:!1}):null}},_t=class wr{constructor(t,r,i){this.from=t,this.to=r,this.transition=i}toString(){return this.from===this.to&&this.transition===1?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(t,r,i){return new wr(t,r,i)}static parse(t){if(t instanceof wr)return t;if(Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number")return new wr(t[0],t[1],t[2]);if(typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number")return new wr(t.from,t.to,t.transition);if(typeof t=="string")return new wr(t,t,1)}},Jn=class{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,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}};function rl(e,t,r,i){return typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?i===void 0||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[e,t,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[e,t,r,i]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Xt(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof _t||e instanceof te||e instanceof Jn||e instanceof tt||e instanceof Ze||e instanceof We||e instanceof Me||e instanceof He||e instanceof Ke)return!0;if(Array.isArray(e)){for(let t of e)if(!Xt(t))return!1;return!0}if(typeof e=="object"){for(let t in e)if(!Xt(e[t]))return!1;return!0}return!1}function ae(e){if(e===null)return Er;if(typeof e=="string")return U;if(typeof e=="boolean")return Y;if(typeof e=="number")return k;if(e instanceof te)return qe;if(e instanceof _t)return Ei;if(e instanceof Jn)return Ti;if(e instanceof tt)return Tr;if(e instanceof Ze)return Ii;if(e instanceof We)return ki;if(e instanceof Me)return Ir;if(e instanceof He)return Fi;if(e instanceof Ke)return kr;if(Array.isArray(e)){let t=e.length,r;for(let i of e){let n=ae(i);if(!r)r=n;else{if(r===n)continue;r=G;break}}return Ae(r||G,t)}return bt}function Br(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof te||e instanceof _t||e instanceof tt||e instanceof Ze||e instanceof We||e instanceof Me||e instanceof He||e instanceof Ke?e.toString():JSON.stringify(e)}var Zt=class zp{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Xt(t[1]))return r.error(`invalid value of type "${typeof t[1]}"`);let i=t[1],n=ae(i),a=r.expectedType;return n.kind==="array"&&n.N===0&&a&&a.kind==="array"&&(typeof a.N!="number"||a.N===0)&&(n=a),new zp(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};const ud=["Unknown","Point","LineString","Polygon"];var il=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"?ud[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=te.parse(e),this._parseColorCache.set(e,t)),t}};function Bi(e,t,r){let i=e.length-1,n=0,a=i,s=0,o,l;for(;n<=a;)if(s=Math.floor((n+a)/2),o=e[s],l=e[s+1],o<=t){if(s===i||t<l)return s;n=s+1}else if(o>t)a=s-1;else throw new J("Input is not a number.",r);return 0}var Qn=class Lp{constructor(t,r,i,n){this.type=t,this.input=r,this.key=n,this.labels=[],this.outputs=[];for(let[a,s]of i)this.labels.push(a),this.outputs.push(s)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let i=r.parse(t[1],1,k);if(!i)return null;let n=[],a=null;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);for(let s=1;s<t.length;s+=2){let o=s===1?-1/0:t[s],l=t[s+1],u=s,h=s+1;if(typeof o!="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(n.length&&n[n.length-1][0]>=o)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let c=r.parse(l,h,a);if(!c)return null;a||(a=c.type),n.push([o,c])}return new Lp(a,i,n,r.key)}evaluate(t){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(t);let n=this.input.evaluate(t);if(n<=r[0])return i[0].evaluate(t);let a=r.length;return n>=r[a-1]?i[a-1].evaluate(t):i[Bi(r,n,this.key)].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function hd(e,t,r,i){let n=3*e,a=3*(r-e)-n,s=1-n-a,o=3*t,l=3*(i-t)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)<c)return((u*p+l)*p+o)*p;let g=(3*s*p+2*a)*p+n;if(Math.abs(g)<1e-6)break;p-=m/g}let f=0,d=1;p=h;for(let y=0;y<20;y++){let m=((s*p+a)*p+n)*p;if(Math.abs(m-h)<c)break;h>m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var Je=class Ao{constructor(t,r,i,n,a,s){this.type=t,this.operator=r,this.interpolation=i,this.input=n,this.key=s,this.labels=[],this.outputs=[];for(let[o,l]of a)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(t,r,i,n){let a=0;if(t.name==="exponential")a=ea(r,t.base,i,n);else if(t.name==="linear")a=ea(r,1,i,n);else if(t.name==="cubic-bezier"){let s=t.controlPoints;a=hd(s[0],s[1],s[2],s[3])(ea(r,1,i,n))}return a}static parse(t,r){let[i,n,a,...s]=t;if(!Array.isArray(n)||n.length===0)return r.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 r.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 r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(a=r.parse(a,2,k),!a)return null;let o=[],l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&r.expectedType!=Ir?l=qe:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<s.length;u+=2){let h=s[u],c=s[u+1],p=u+3,f=u+4;if(typeof h!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(o.length&&o[o.length-1][0]>=h)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);let d=r.parse(c,f,l);if(!d)return null;l||(l=d.type),o.push([h,d])}return!ft(l,k)&&!ft(l,Ei)&&!ft(l,qe)&&!ft(l,Ii)&&!ft(l,ki)&&!ft(l,Ir)&&!ft(l,Fi)&&!ft(l,Ae(k))?r.error(`Type ${ee(l)} is not interpolatable.`):new Ao(l,i,n,a,o,r.key)}evaluate(t){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(t);let n=this.input.evaluate(t);if(n<=r[0])return i[0].evaluate(t);let a=r.length;if(n>=r[a-1])return i[a-1].evaluate(t);let s=Bi(r,n,this.key),o=r[s],l=r[s+1],u=Ao.interpolationFactor(this.interpolation,n,o,l),h=i[s].evaluate(t),c=i[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return dt(h,c,u);case"color":return te.interpolate(h,c,u);case"padding":return Ze.interpolate(h,c,u);case"colorArray":return Me.interpolate(h,c,u);case"numberArray":return We.interpolate(h,c,u);case"variableAnchorOffsetCollection":return He.interpolate(h,c,u,this.key);case"array":return Yt(h,c,u);case"projectionDefinition":return _t.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return te.interpolate(h,c,u,"hcl");case"colorArray":return Me.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return te.interpolate(h,c,u,"lab");case"colorArray":return Me.interpolate(h,c,u,"lab")}}}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function ea(e,t,r,i){let n=i-r,a=e-r;return n===0?0:t===1?a/n:(t**+a-1)/(t**+n-1)}const St={color:te.interpolate,number:dt,padding:Ze.interpolate,numberArray:We.interpolate,colorArray:Me.interpolate,variableAnchorOffsetCollection:He.interpolate,array:Yt};var nl=class Vp{constructor(t){this.type=Tr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=t[1];if(!Array.isArray(i)&&typeof i=="object")return r.error("First argument must be an image or text section.");let n=[],a=!1;for(let s=1;s<=t.length-1;++s){let o=t[s];if(a&&typeof o=="object"&&!Array.isArray(o)){a=!1;let l=null;if(o["font-scale"]&&(l=r.parse(o["font-scale"],1,k),!l))return null;let u=null;if(o["text-font"]&&(u=r.parse(o["text-font"],1,Ae(U)),!u))return null;let h=null;if(o["text-color"]&&(h=r.parse(o["text-color"],1,qe),!h))return null;let c=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!od.includes(o["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(c=r.parse(o["vertical-align"],1,U),!c)return null}let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=r.parse(t[s],1,G);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'.");a=!0,n.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Vp(n)}evaluate(t){return new tt(this.sections.map(r=>{let i=r.content.evaluate(t);return ae(i)===kr?new Kn("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new Kn(Br(i),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)}))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}};function al(e,t,r=0,i=e.length-1,n=cd){for(;i>r;){if(i-r>600){let l=i-r+1,u=t-r+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);al(e,t,Math.max(r,Math.floor(t-u*c/l+p)),Math.min(i,Math.floor(t+(l-u)*c/l+p)),n)}let a=e[t],s=r,o=i;for(Pr(e,r,t),n(e[i],a)>0&&Pr(e,r,i);s<o;){for(Pr(e,s,o),s++,o--;n(e[s],a)<0;)s++;for(;n(e[o],a)>0;)o--}n(e[r],a)===0?Pr(e,r,o):(o++,Pr(e,o,i)),o<=t&&(r=o+1),t<=o&&(i=o-1)}}function Pr(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function cd(e,t){return e<t?-1:+(e>t)}function Pi(e,t){if(e.length<=1)return[e];let r=[],i,n;for(let a of e){let s=fd(a);s!==0&&(a.area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[a]):i.push(a))}if(i&&r.push(i),t>1)for(let a=0;a<r.length;a++)r[a].length<=t||(al(r[a],t,1,r[a].length-1,pd),r[a]=r[a].slice(0,t));return r}function pd(e,t){return t.area-e.area}function fd(e){let t=0;for(let r=0,i=e.length,n=i-1,a,s;r<i;n=r++)a=e[r],s=e[n],t+=(s.x-a.x)*(a.y+s.y);return t}const Mi={string:U,number:k,boolean:Y,object:bt};var rt=class Op{constructor(t,r,i){this.type=t,this.args=r,this.key=i}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=1,n,a=t[0];if(a==="array"){let o;if(t.length>2){let u=t[1];if(typeof u!="string"||!(u in Mi)||u==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);o=Mi[u],i++}else o=G;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);l=t[2],i++}n=Ae(o,l)}else{if(!Mi[a])throw Error(`Types doesn't contain name = ${a}`);n=Mi[a]}let s=[];for(;i<t.length;i++){let o=r.parse(t[i],i,G);if(!o)return null;s.push(o)}return new Op(n,s,r.key)}evaluate(t){for(let r=0;r<this.args.length;r++){let i=this.args[r].evaluate(t);if(!Fr(this.type,ae(i)))return i;if(r===this.args.length-1)throw new J(`Expected value to be of type ${ee(this.type)}, but found ${ee(ae(i))} instead.`,this.key)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};const sl={"to-boolean":Y,"to-color":qe,"to-number":k,"to-string":U};var Wt=class $p{constructor(t,r,i){this.type=t,this.args=r,this.key=i}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=t[0];if(!sl[i])throw Error(`Can't parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&t.length!==2)return r.error("Expected one argument.");let n=sl[i],a=[];for(let s=1;s<t.length;s++){let o=r.parse(t[s],s,G);if(!o)return null;a.push(o)}return new $p(n,a,r.key)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,i;for(let n of this.args){if(r=n.evaluate(t),i=null,r instanceof te)return r;if(typeof r=="string"){let a=t.parseColor(r);if(a)return a}else if(Array.isArray(r)&&(i=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:rl(r[0],r[1],r[2],r[3]),!i))return new te(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new J(i||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}case"padding":{let r;for(let i of this.args){r=i.evaluate(t);let n=Ze.parse(r);if(n)return n}throw new J(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}case"numberArray":{let r;for(let i of this.args){r=i.evaluate(t);let n=We.parse(r);if(n)return n}throw new J(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}case"colorArray":{let r;for(let i of this.args){r=i.evaluate(t);let n=Me.parse(r);if(n)return n}throw new J(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}case"variableAnchorOffsetCollection":{let r;for(let i of this.args){r=i.evaluate(t);let n=He.parse(r);if(n)return n}throw new J(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}case"number":{let r=null;for(let i of this.args){if(r=i.evaluate(t),r===null)return 0;let n=Number(r);if(!isNaN(n))return n}throw new J(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case"formatted":return tt.fromString(Br(this.args[0].evaluate(t)));case"resolvedImage":return Ke.fromString(Br(this.args[0].evaluate(t)));case"projectionDefinition":{let r=this.args[0].evaluate(t);if(_t.parse(r))return r;throw new J(`Could not parse projectionDefinition from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}default:return Br(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},ol=class Rp{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let i=[];for(let a=1;a<t.length-1;a+=2){let s=t[a];if(typeof s!="string")return r.error(`Expected string, but found ${typeof s} instead.`,a);if(/[^a-zA-Z0-9_]/.test(s))return r.error("Variable names must contain only alphanumeric characters or '_'.",a);let o=r.parse(t[a+1],a+1);if(!o)return null;i.push([s,o])}let n=r.parse(t[t.length-1],t.length-1,r.expectedType,i);return n?new Rp(i,n):null}outputDefined(){return this.result.outputDefined()}},ll=class Np{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");let i=t[1];return r.scope.has(i)?new Np(i,r.scope.get(i)):r.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},dd=class Up{constructor(t,r,i,n){this.type=t,this.index=r,this.input=i,this.key=n}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,k),n=r.parse(t[2],2,Ae(r.expectedType||G));if(!i||!n)return null;let a=n.type;return new Up(a.itemType,i,n,r.key)}evaluate(t){let r=this.index.evaluate(t),i=this.input.evaluate(t);if(r<0)throw new J(`Array index out of bounds: ${r} < 0.`,this.key);if(r>=i.length)throw new J(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new J(`Array index must be an integer, but found ${r} instead.`,this.key);return i[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},yd=class qp{constructor(t,r,i){this.needle=t,this.haystack=r,this.key=i,this.type=Y}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,G),n=r.parse(t[2],2,G);return!i||!n?null:jn(i.type,[Y,U,k,Er,G])?new qp(i,n,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ee(i.type)} instead`)}evaluate(t){let r=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!wt(r,["boolean","string","number","null"]))throw new J(`Expected first argument to be of type boolean, string, number or null, but found ${ee(ae(r))} instead.`,this.key);if(!wt(i,["string","array"]))throw new J(`Expected second argument to be of type array or string, but found ${ee(ae(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},md=class Do{constructor(t,r,i,n){this.needle=t,this.haystack=r,this.key=i,this.fromIndex=n,this.type=k}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,G),n=r.parse(t[2],2,G);if(!i||!n)return null;if(!jn(i.type,[Y,U,k,Er,G]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ee(i.type)} instead`);if(t.length===4){let a=r.parse(t[3],3,k);return a?new Do(i,n,r.key,a):null}return new Do(i,n,r.key)}evaluate(t){let r=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!wt(r,["boolean","string","number","null"]))throw new J(`Expected first argument to be of type boolean, string, number or null, but found ${ee(ae(r))} instead.`,this.key);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),wt(i,["string"])){let a=i.indexOf(r,n);return a===-1?-1:[...i.slice(0,a)].length}if(wt(i,["array"]))return i.indexOf(r,n);throw new J(`Expected second argument to be of type array or string, but found ${ee(ae(i))} instead.`,this.key)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},gd=class Gp{constructor(t,r,i,n,a,s){this.inputType=t,this.type=r,this.input=i,this.cases=n,this.outputs=a,this.otherwise=s}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let i,n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let a={},s=[];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=r.concat(u);if(h.length===0)return p.error("Expected at least one branch label.");for(let d of h){if(typeof d!="number"&&typeof d!="string")return p.error("Branch labels must be numbers or strings.");if(typeof d=="number"&&Math.abs(d)>2**53-1)return p.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof d=="number"&&Math.floor(d)!==d)return p.error("Numeric branch labels must be integer values.");if(!i)i=ae(d);else if(p.checkSubtype(i,ae(d)))return null;if(a[String(d)]!==void 0)return p.error("Branch labels must be unique.");a[String(d)]=s.length}let f=r.parse(c,u,n);if(!f)return null;n||(n=f.type),s.push(f)}let o=r.parse(t[1],1,G);if(!o)return null;let l=r.parse(t[t.length-1],t.length-1,n);return!l||o.type.kind!=="value"&&r.concat(1).checkSubtype(i,o.type)?null:new Gp(i,n,o,a,s,l)}evaluate(t){let r=this.input.evaluate(t);return(ae(r)===this.inputType&&this.outputs[this.cases[r]]||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()}},xd=class jp{constructor(t,r,i){this.type=t,this.branches=r,this.otherwise=i}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let n=[];for(let s=1;s<t.length-1;s+=2){let o=r.parse(t[s],s,Y);if(!o)return null;let l=r.parse(t[s+1],s+1,i);if(!l)return null;n.push([o,l]),i||(i=l.type)}let a=r.parse(t[t.length-1],t.length-1,i);if(!a)return null;if(!i)throw Error("Can't infer output type");return new jp(i,n,a)}evaluate(t){for(let[r,i]of this.branches)if(r.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,i]of this.branches)t(r),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},vd=class Eo{constructor(t,r,i,n,a){this.type=t,this.input=r,this.beginIndex=i,this.key=n,this.endIndex=a}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,G),n=r.parse(t[2],2,k);if(!i||!n)return null;if(!jn(i.type,[Ae(G),U,G]))return r.error(`Expected first argument to be of type array or string, but found ${ee(i.type)} instead`);if(t.length===4){let a=r.parse(t[3],3,k);return a?new Eo(i.type,i,n,r.key,a):null}return new Eo(i.type,i,n,r.key)}evaluate(t){let r=this.input.evaluate(t),i=this.beginIndex.evaluate(t),n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),wt(r,["string"]))return[...r].slice(i,n).join("");if(wt(r,["array"]))return r.slice(i,n);throw new J(`Expected first argument to be of type array or string, but found ${ee(ae(r))} instead.`,this.key)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}},ul=class To{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=null,n=r.expectedType;n&&n.kind!=="value"&&(i=n);let a=[];for(let s of t.slice(1)){let o=r.parse(s,1+a.length,i,void 0,{typeAnnotation:"omit"});if(!o)return null;i||(i=o.type),a.push(o)}if(!i)throw Error("No output type");return n&&a.some(s=>Fr(n,s.type))?new To(G,a):new To(i,a)}evaluate(t){let r=null,i=0,n;for(let a of this.args)if(i++,r=a.evaluate(t),r&&r instanceof Ke&&!r.available&&(n||(n=r.name),r=null,i===this.args.length&&(r=n)),r!==null)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};function hl(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 bd(e,t,r){return t===r}function wd(e,t,r){return t!==r}function _d(e,t,r){return t<r}function Sd(e,t,r){return t>r}function Ad(e,t,r){return t<=r}function Dd(e,t,r){return t>=r}function cl(e,t,r,i){return i.compare(t,r)===0}function Ed(e,t,r,i){return!cl(e,t,r,i)}function Td(e,t,r,i){return i.compare(t,r)<0}function Id(e,t,r,i){return i.compare(t,r)>0}function kd(e,t,r,i){return i.compare(t,r)<=0}function Fd(e,t,r,i){return i.compare(t,r)>=0}function Ht(e,t,r){let i=e!=="=="&&e!=="!=";return class Yp{constructor(a,s,o,l){this.lhs=a,this.rhs=s,this.key=o,this.collator=l,this.type=Y,this.hasUntypedArgument=a.type.kind==="value"||s.type.kind==="value"}static parse(a,s){if(a.length!==3&&a.length!==4)return s.error("Expected two or three arguments.");let o=a[0],l=s.parse(a[1],1,G);if(!l)return null;if(!hl(o,l.type))return s.concat(1).error(`"${o}" comparisons are not supported for type '${ee(l.type)}'.`);let u=s.parse(a[2],2,G);if(!u)return null;if(!hl(o,u.type))return s.concat(2).error(`"${o}" comparisons are not supported for type '${ee(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error(`Cannot compare types '${ee(l.type)}' and '${ee(u.type)}'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new rt(u.type,[l],s.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new rt(l.type,[u],s.key)));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 s.error("Cannot use collator to compare non-string types.");if(h=s.parse(a[3],3,Ti),!h)return null}return new Yp(l,u,s.key,h)}evaluate(a){let s=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=ae(s),u=ae(o);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new J(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!i&&this.hasUntypedArgument){let l=ae(s),u=ae(o);if(l.kind!=="string"||u.kind!=="string")return t(a,s,o)}return this.collator?r(a,s,o,this.collator.evaluate(a)):t(a,s,o)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}const Cd=Ht("==",bd,cl),Bd=Ht("!=",wd,Ed),Pd=Ht("<",_d,Td),Md=Ht(">",Sd,Id),zd=Ht("<=",Ad,kd),Ld=Ht(">=",Dd,Fd);var pl=class Xp{constructor(t,r,i){this.type=Ti,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let i=t[1];if(typeof i!="object"||Array.isArray(i))return r.error("Collator options argument must be an object.");let n=r.parse(i["case-sensitive"]!==void 0&&i["case-sensitive"],1,Y);if(!n)return null;let a=r.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,Y);if(!a)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,U),!s)?null:new Xp(n,a,s)}evaluate(t){return new Jn(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}},Vd=class Zp{constructor(t,r,i,n,a,s){this.type=U,this.number=t,this.locale=r,this.currency=i,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=s}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let i=r.parse(t[1],1,k);if(!i)return null;let n=t[2];if(typeof n!="object"||Array.isArray(n))return r.error("NumberFormat options argument must be an object.");let a=null;if(n.locale&&(a=r.parse(n.locale,1,U),!a))return null;let s=null;if(n.currency&&(s=r.parse(n.currency,1,U),!s))return null;let o=null;if(n.unit&&(o=r.parse(n.unit,1,U),!o))return null;if(s&&o)return r.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(n["min-fraction-digits"]&&(l=r.parse(n["min-fraction-digits"],1,k),!l))return null;let u=null;return n["max-fraction-digits"]&&(u=r.parse(n["max-fraction-digits"],1,k),!u)?null:new Zp(i,a,s,o,l,u)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.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.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},Od=class Wp{constructor(t){this.type=kr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let i=r.parse(t[1],1,U);return i?new Wp(i):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),i=Ke.fromString(r);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(r)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}},$d=class Hp{constructor(t,r){this.input=t,this.key=r,this.type=k}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=r.parse(t[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${ee(i.type)} instead.`):new Hp(i,r.key):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new J(`Expected value to be of type string or array, but found ${ee(ae(r))} instead.`,this.key)}eachChild(t){t(this.input)}outputDefined(){return!1}};const Qe=8192;function Rd(e,t){let r=Nd(e[0]),i=qd(e[1]),n=2**t.z;return[Math.round(r*n*Qe),Math.round(i*n*Qe)]}function ta(e,t){let r=2**t.z,i=(e[0]/Qe+t.x)/r,n=(e[1]/Qe+t.y)/r;return[Ud(i),Gd(n)]}function Nd(e){return(180+e)/360}function Ud(e){return e*360-180}function qd(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Gd(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function Mr(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 zr(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function jd(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Yd(e,t,r){let i=e[0]-t[0],n=e[1]-t[1],a=e[0]-r[0],s=e[1]-r[1];return i*s-a*n===0&&i*a<=0&&n*s<=0}function zi(e,t,r,i){let n=[t[0]-e[0],t[1]-e[1]];return Hd([i[0]-r[0],i[1]-r[1]],n)!==0&&!!(dl(e,t,r,i)&&dl(r,i,e,t))}function Xd(e,t,r){for(let i of r)for(let n=0;n<i.length-1;++n)if(zi(e,t,i[n],i[n+1]))return!0;return!1}function Kt(e,t,r=!1){let i=!1;for(let n of t)for(let a=0;a<n.length-1;a++){if(Yd(e,n[a],n[a+1]))return r;jd(e,n[a],n[a+1])&&(i=!i)}return i}function Zd(e,t){for(let r of t)if(Kt(e,r))return!0;return!1}function fl(e,t){for(let r of e)if(!Kt(r,t))return!1;for(let r=0;r<e.length-1;++r)if(Xd(e[r],e[r+1],t))return!1;return!0}function Wd(e,t){for(let r of t)if(fl(e,r))return!0;return!1}function Hd(e,t){return e[0]*t[1]-e[1]*t[0]}function dl(e,t,r,i){let n=e[0]-r[0],a=e[1]-r[1],s=t[0]-r[0],o=t[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],h=n*u-l*a,c=s*u-l*o;return h>0&&c<0||h<0&&c>0}function ra(e,t,r){let i=[];for(let n=0;n<e.length;n++){let a=[];for(let s=0;s<e[n].length;s++){let o=Rd(e[n][s],r);Mr(t,o),a.push(o)}i.push(a)}return i}function yl(e,t,r){let i=[];for(let n=0;n<e.length;n++){let a=ra(e[n],t,r);i.push(a)}return i}function ml(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){let n=i*.5,a=e[0]-r[0]>n?-i:r[0]-e[0]>n?i:0;a===0&&(a=e[0]-r[2]>n?-i:r[2]-e[0]>n?i:0),e[0]+=a}Mr(t,e)}function Kd(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function gl(e,t,r,i){let n=2**i.z*Qe,a=[i.x*Qe,i.y*Qe],s=[];for(let o of e)for(let l of o){let u=[l.x+a[0],l.y+a[1]];ml(u,t,r,n),s.push(u)}return s}function xl(e,t,r,i){let n=2**i.z*Qe,a=[i.x*Qe,i.y*Qe],s=[];for(let o of e){let l=[];for(let u of o){let h=[u.x+a[0],u.y+a[1]];Mr(t,h),l.push(h)}s.push(l)}if(t[2]-t[0]<=n/2){Kd(t);for(let o of s)for(let l of o)ml(l,t,r,n)}return s}function Jd(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=ra(t.coordinates,i,n),s=gl(e.geometry(),r,i,n);if(!zr(r,i))return!1;for(let o of s)if(!Kt(o,a))return!1}if(t.type==="MultiPolygon"){let a=yl(t.coordinates,i,n),s=gl(e.geometry(),r,i,n);if(!zr(r,i))return!1;for(let o of s)if(!Zd(o,a))return!1}return!0}function Qd(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=ra(t.coordinates,i,n),s=xl(e.geometry(),r,i,n);if(!zr(r,i))return!1;for(let o of s)if(!fl(o,a))return!1}if(t.type==="MultiPolygon"){let a=yl(t.coordinates,i,n),s=xl(e.geometry(),r,i,n);if(!zr(r,i))return!1;for(let o of s)if(!Wd(o,a))return!1}return!0}var ia=class Mn{constructor(t,r){this.type=Y,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Xt(t[1])){let i=t[1];if(i.type==="FeatureCollection"){let n=[];for(let a of i.features){let{type:s,coordinates:o}=a.geometry;s==="Polygon"&&n.push(o),s==="MultiPolygon"&&n.push(...o)}if(n.length)return new Mn(i,{type:"MultiPolygon",coordinates:n})}else if(i.type==="Feature"){let n=i.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new Mn(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new Mn(i,i)}return r.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 Jd(t,this.geometries);if(t.geometryType()==="LineString")return Qd(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},vl=class{constructor(e=[],t=(r,i)=>r<i?-1:+(r>i)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}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:r}=this,i=t[e];for(;e>0;){let n=e-1>>1,a=t[n];if(r(i,a)>=0)break;t[e]=a,e=n}t[e]=i}_down(e){let{data:t,compare:r}=this,i=this.length>>1,n=t[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&r(t[s],t[a])<0&&(a=s),r(t[a],n)>=0)break;t[e]=t[a],e=a}t[e]=n}};const bl=Math.PI/180;var na=class{constructor(e){let t=bl*6378.137*1e3,r=Math.cos(e*bl),i=1/(1-.0066943799901413165*(1-r*r)),n=Math.sqrt(i);this.kx=t*n*r,this.ky=t*n*i*.9933056200098587}distance(e,t){let r=this.wrap(e[0]-t[0])*this.kx,i=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(e,t){let r=1/0,i,n,a,s;for(let o=0;o<e.length-1;o++){let l=e[o][0],u=e[o][1],h=this.wrap(e[o+1][0]-l)*this.kx,c=(e[o+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[o+1][0],u=e[o+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 f=h*h+c*c;f<r&&(r=f,i=l,n=u,a=o,s=p)}return{point:[i,n],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}};function wl(e,t){return t[0]-e[0]}function Li(e){return e[1]-e[0]+1}function it(e,t){return e[1]>=e[0]&&e[1]<t}function aa(e,t){if(e[0]>e[1])return[null,null];let r=Li(e);if(t){if(r===2)return[e,null];let n=Math.floor(r/2);return[[e[0],e[0]+n],[e[0]+n,e[1]]]}if(r===1)return[e,null];let i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}function sa(e,t){if(!it(t,e.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=t[0];i<=t[1];++i)Mr(r,e[i]);return r}function oa(e){let t=[1/0,1/0,-1/0,-1/0];for(let r of e)for(let i of r)Mr(t,i);return t}function _l(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function la(e,t,r){if(!_l(e)||!_l(t))return NaN;let i=0,n=0;return e[2]<t[0]&&(i=t[0]-e[2]),e[0]>t[2]&&(i=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),r.distance([0,0],[i,n])}function At(e,t,r){let i=r.pointOnLine(t,e);return r.distance(e,i.point)}function ua(e,t,r,i,n){let a=Math.min(At(e,[r,i],n),At(t,[r,i],n)),s=Math.min(At(r,[e,t],n),At(i,[e,t],n));return Math.min(a,s)}function ey(e,t,r,i,n){if(!(it(t,e.length)&&it(i,r.length)))return 1/0;let a=1/0;for(let s=t[0];s<t[1];++s){let o=e[s],l=e[s+1];for(let u=i[0];u<i[1];++u){let h=r[u],c=r[u+1];if(zi(o,l,h,c))return 0;a=Math.min(a,ua(o,l,h,c,n))}}return a}function ty(e,t,r,i,n){if(!(it(t,e.length)&&it(i,r.length)))return NaN;let a=1/0;for(let s=t[0];s<=t[1];++s)for(let o=i[0];o<=i[1];++o)if(a=Math.min(a,n.distance(e[s],r[o])),a===0)return a;return a}function ry(e,t,r){if(Kt(e,t,!0))return 0;let i=1/0;for(let n of t){let a=n[0],s=n[n.length-1];if(a!==s&&(i=Math.min(i,At(e,[s,a],r)),i===0))return i;let o=r.pointOnLine(n,e);if(i=Math.min(i,r.distance(e,o.point)),i===0)return i}return i}function iy(e,t,r,i){if(!it(t,e.length))return NaN;for(let a=t[0];a<=t[1];++a)if(Kt(e[a],r,!0))return 0;let n=1/0;for(let a=t[0];a<t[1];++a){let s=e[a],o=e[a+1];for(let l of r)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let p=l[c],f=l[u];if(zi(s,o,p,f))return 0;n=Math.min(n,ua(s,o,p,f,i))}}return n}function Sl(e,t){for(let r of e)for(let i of r)if(Kt(i,t,!0))return!0;return!1}function ny(e,t,r,i=1/0){let n=oa(e),a=oa(t);if(i!==1/0&&la(n,a,r)>=i)return i;if(zr(n,a)){if(Sl(e,t))return 0}else if(Sl(t,e))return 0;let s=1/0;for(let o of e)for(let l=0,u=o.length,h=u-1;l<u;h=l++){let c=o[h],p=o[l];for(let f of t)for(let d=0,y=f.length,m=y-1;d<y;m=d++){let g=f[m],x=f[d];if(zi(c,p,g,x))return 0;s=Math.min(s,ua(c,p,g,x,r))}}return s}function Al(e,t,r,i,n,a){if(!a)return;let s=la(sa(i,a),n,r);s<t&&e.push([s,a,[0,0]])}function Vi(e,t,r,i,n,a,s){if(!a||!s)return;let o=la(sa(i,a),sa(n,s),r);o<t&&e.push([o,a,s])}function Oi(e,t,r,i,n=1/0){let a=Math.min(i.distance(e[0],r[0][0]),n);if(a===0)return a;let s=new vl([[0,[0,e.length-1],[0,0]]],wl),o=oa(r);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],h=t?50:100;if(Li(u)<=h){if(!it(u,e.length))return NaN;if(t){let c=iy(e,u,r,i);if(isNaN(c)||c===0)return c;a=Math.min(a,c)}else for(let c=u[0];c<=u[1];++c){let p=ry(e[c],r,i);if(a=Math.min(a,p),a===0)return 0}}else{let c=aa(u,t);Al(s,a,i,e,o,c[0]),Al(s,a,i,e,o,c[1])}}return a}function $i(e,t,r,i,n,a=1/0){let s=Math.min(a,n.distance(e[0],r[0]));if(s===0)return s;let o=new vl([[0,[0,e.length-1],[0,r.length-1]]],wl);for(;o.length>0;){let l=o.pop();if(l[0]>=s)continue;let u=l[1],h=l[2],c=t?50:100,p=i?50:100;if(Li(u)<=c&&Li(h)<=p){if(!it(u,e.length)&&it(h,r.length))return NaN;let f;if(t&&i)f=ey(e,u,r,h,n),s=Math.min(s,f);else if(t&&!i){let d=e.slice(u[0],u[1]+1);for(let y=h[0];y<=h[1];++y)if(f=At(r[y],d,n),s=Math.min(s,f),s===0)return s}else if(!t&&i){let d=r.slice(h[0],h[1]+1);for(let y=u[0];y<=u[1];++y)if(f=At(e[y],d,n),s=Math.min(s,f),s===0)return s}else f=ty(e,u,r,h,n),s=Math.min(s,f)}else{let f=aa(u,t),d=aa(h,i);Vi(o,s,n,e,r,f[0],d[0]),Vi(o,s,n,e,r,f[0],d[1]),Vi(o,s,n,e,r,f[1],d[0]),Vi(o,s,n,e,r,f[1],d[1])}}return s}function ay(e,t){let r=e.geometry(),i=r.flat().map(s=>ta([s.x,s.y],e.canonical));if(r.length===0)return NaN;let n=new na(i[0][1]),a=1/0;for(let s of t){switch(s.type){case"Point":a=Math.min(a,$i(i,!1,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,$i(i,!1,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Oi(i,!1,s.coordinates,n,a))}if(a===0)return a}return a}function sy(e,t){let r=e.geometry(),i=r.flat().map(s=>ta([s.x,s.y],e.canonical));if(r.length===0)return NaN;let n=new na(i[0][1]),a=1/0;for(let s of t){switch(s.type){case"Point":a=Math.min(a,$i(i,!0,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,$i(i,!0,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Oi(i,!0,s.coordinates,n,a))}if(a===0)return a}return a}function oy(e,t){let r=e.geometry();if(r.length===0||r[0].length===0)return NaN;let i=Pi(r,0).map(s=>s.map(o=>o.map(l=>ta([l.x,l.y],e.canonical)))),n=new na(i[0][0][0][1]),a=1/0;for(let s of t)for(let o of i){switch(s.type){case"Point":a=Math.min(a,Oi([s.coordinates],!1,o,n,a));break;case"LineString":a=Math.min(a,Oi(s.coordinates,!0,o,n,a));break;case"Polygon":a=Math.min(a,ny(o,s.coordinates,n,a))}if(a===0)return a}return a}function ha(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 ca=class zn{constructor(t,r){this.type=k,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Xt(t[1])){let i=t[1];if(i.type==="FeatureCollection")return new zn(i,i.features.map(n=>ha(n.geometry)).flat());if(i.type==="Feature")return new zn(i,ha(i.geometry));if("type"in i&&"coordinates"in i)return new zn(i,ha(i))}return r.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 ay(t,this.geometries);if(t.geometryType()==="LineString")return sy(t,this.geometries);if(t.geometryType()==="Polygon")return oy(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},ly=class Kp{constructor(t){let r=null;for(let i of t)if(!r)r=i.type;else{if(r===i.type)continue;r=G;break}this.type=Ae(r??G,t.length),this.arr=t}static parse(t,r){if(t.length!==2)return r.error(`'semiliteral' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Xt(t[1]))return r.error(`invalid value of type "${typeof t[1]}"`);let i=t[1],n=ae(i);if(n.kind==="array"){let a=i.map(s=>r.parse(s,null,G));return new Kp(a)}return new Zt(n,i)}evaluate(t){return this.arr.map(r=>r.evaluate(t))}eachChild(t){this.arr.forEach(t)}outputDefined(){return this.arr.every(t=>t.outputDefined())}},pa=class Jp{constructor(t){this.key=t,this.type=G}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=t[1];return i==null?r.error("Global state property must be defined."):typeof i=="string"?new Jp(i):r.error(`Global state property must be string, but found ${typeof t[1]} instead.`)}evaluate(t){var i;let r=(i=t.globals)==null?void 0:i.globalState;return!r||Object.keys(r).length===0?null:Cr(r,this.key)??null}eachChild(){}outputDefined(){return!1}};const Jt={"==":Cd,"!=":Bd,">":Md,"<":Pd,">=":Ld,"<=":zd,array:rt,at:dd,boolean:rt,case:xd,coalesce:ul,collator:pl,format:nl,image:Od,in:yd,"index-of":md,interpolate:Je,"interpolate-hcl":Je,"interpolate-lab":Je,length:$d,let:ol,literal:Zt,match:gd,number:rt,"number-format":Vd,object:rt,semiliteral:ly,slice:vd,step:Qn,string:rt,"to-boolean":Wt,"to-color":Wt,"to-number":Wt,"to-string":Wt,var:ll,within:ia,distance:ca,"global-state":pa};var et=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},uy=class Qp{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[i,n]of r)this.bindings[i]=n}concat(t){return new Qp(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},Dl=class ef{constructor(t,r,i=[],n,a=new uy,s=[]){this.registry=t,this.path=i,this.key=i.map(o=>`[${o}]`).join(""),this.scope=a,this.errors=s,this.expectedType=n,this._isConstant=r}parse(t,r,i,n,a={}){return r?this.concat(r,i,n)._parse(t,a):this._parse(t,a)}_parse(t,r){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);let i=this.key;function n(a,s,o){return o==="assert"?new rt(s,[a],i):o==="coerce"?new Wt(s,[a],i):a}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 a=t[0];if(typeof a!="string")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let s=this.registry[a];if(s){let o=s.parse(t,this);if(!o)return null;if(this.expectedType){let l=this.expectedType,u=o.type;if((l.kind==="string"||l.kind==="number"||l.kind==="boolean"||l.kind==="object"||l.kind==="array")&&u.kind==="value")o=n(o,l,r.typeAnnotation||"assert");else if(l.kind==="projectionDefinition"&&["string","array","value"].includes(u.kind)||["color","formatted","resolvedImage"].includes(l.kind)&&["value","string"].includes(u.kind)||["padding","numberArray"].includes(l.kind)&&["value","number","array"].includes(u.kind)||l.kind==="colorArray"&&["value","string","array"].includes(u.kind)||l.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(u.kind))o=n(o,l,r.typeAnnotation||"coerce");else if(this.checkSubtype(l,u))return null}if(!(o instanceof Zt)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let l=new il;try{o=new Zt(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return t===void 0?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 ${typeof t} instead.`)}concat(t,r,i){let n=typeof t=="number"?this.path.concat(t):this.path,a=i?this.scope.concat(i):this.scope;return new ef(this.registry,this._isConstant,n,r||null,a,this.errors)}error(t,...r){let i=`${this.key}${r.map(n=>`[${n}]`).join("")}`;this.errors.push(new et(i,t))}checkSubtype(t,r){let i=Fr(t,r);return i&&this.error(i),i}},Dt=class bi{constructor(t,r,i,n,a){this.name=t,this.type=r,this._evaluate=i,this.args=n,this.key=a}evaluate(t){return this._evaluate(t,this.args,this.key)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){let i=t[0],n=bi.definitions[i];if(!n)return r.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let a=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,h]of o){l=new Dl(r.registry,Ri,r.path,null,r.scope);let c=[],p=!1;for(let f=1;f<t.length;f++){let d=t[f],y=Array.isArray(u)?u[f-1]:u.type,m=l.parse(d,1+c.length,y);if(!m){p=!0;break}c.push(m)}if(!p){if(Array.isArray(u)&&u.length!==c.length){l.error(`Expected ${u.length} arguments, but found ${c.length} instead.`);continue}for(let f=0;f<c.length;f++){let d=Array.isArray(u)?u[f]:u.type,y=c[f];l.concat(f+1).checkSubtype(d,y.type)}if(l.errors.length===0)return new bi(i,a,h,c,r.key)}}if(o.length===1)r.errors.push(...l.errors);else{let u=(o.length?o:s).map(([c])=>cy(c)).join(" | "),h=[];for(let c=1;c<t.length;c++){let p=r.parse(t[c],1+h.length);if(!p)return null;h.push(ee(p.type))}r.error(`Expected arguments of type ${u}, but found (${h.join(", ")}) instead.`)}return null}static register(t,r){bi.definitions=r;for(let i in r)t[i]=bi}};function El(e,[t,r,i,n],a){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);let s=n?n.evaluate(e):1,o=rl(t,r,i,s);if(o)throw new J(o,a);return new te(t/255,r/255,i/255,s,!1)}function Tl(e,t){return e in t&&t[e]!==void 0}function fa(e,t){let r=t[e];return r===void 0?null:r}function hy(e,t,r,i){for(;r<=i;){let n=r+i>>1;if(t[n]===e)return!0;t[n]>e?i=n-1:r=n+1}return!1}function Et(e){return{type:e}}Dt.register(Jt,{error:[Hf,[U],(e,[t],r)=>{throw new J(t.evaluate(e),r)}],typeof:[U,[G],(e,[t])=>ee(ae(t.evaluate(e)))],"to-rgba":[Ae(k,4),[qe],(e,[t])=>{let[r,i,n,a]=t.evaluate(e).rgb;return[r*255,i*255,n*255,a]}],rgb:[qe,[k,k,k],El],rgba:[qe,[k,k,k,k],El],has:{type:Y,overloads:[[[U],(e,[t])=>Tl(t.evaluate(e),e.properties())],[[U,bt],(e,[t,r])=>Tl(t.evaluate(e),r.evaluate(e))]]},get:{type:G,overloads:[[[U],(e,[t])=>fa(t.evaluate(e),e.properties())],[[U,bt],(e,[t,r])=>fa(t.evaluate(e),r.evaluate(e))]]},"feature-state":[G,[U],(e,[t])=>fa(t.evaluate(e),e.featureState||{})],properties:[bt,[],e=>e.properties()],"geometry-type":[U,[],e=>e.geometryType()],id:[G,[],e=>e.id()],zoom:[k,[],e=>e.globals.zoom],"heatmap-density":[k,[],e=>e.globals.heatmapDensity||0],elevation:[k,[],e=>e.globals.elevation||0],"line-progress":[k,[],e=>e.globals.lineProgress||0],accumulated:[G,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[k,Et(k),(e,t)=>{let r=0;for(let i of t)r+=i.evaluate(e);return r}],"*":[k,Et(k),(e,t)=>{let r=1;for(let i of t)r*=i.evaluate(e);return r}],"-":{type:k,overloads:[[[k,k],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[k],(e,[t])=>-t.evaluate(e)]]},"/":[k,[k,k],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[k,[k,k],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[k,[],()=>Math.LN2],pi:[k,[],()=>Math.PI],e:[k,[],()=>Math.E],"^":[k,[k,k],(e,[t,r])=>t.evaluate(e)**+r.evaluate(e)],sqrt:[k,[k],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[k,[k],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[k,[k],(e,[t])=>Math.log(t.evaluate(e))],log2:[k,[k],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[k,[k],(e,[t])=>Math.sin(t.evaluate(e))],cos:[k,[k],(e,[t])=>Math.cos(t.evaluate(e))],tan:[k,[k],(e,[t])=>Math.tan(t.evaluate(e))],asin:[k,[k],(e,[t])=>Math.asin(t.evaluate(e))],acos:[k,[k],(e,[t])=>Math.acos(t.evaluate(e))],atan:[k,[k],(e,[t])=>Math.atan(t.evaluate(e))],min:[k,Et(k),(e,t)=>Math.min(...t.map(r=>r.evaluate(e)))],max:[k,Et(k),(e,t)=>Math.max(...t.map(r=>r.evaluate(e)))],abs:[k,[k],(e,[t])=>Math.abs(t.evaluate(e))],round:[k,[k],(e,[t])=>{let r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[k,[k],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[k,[k],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[Y,[U,G],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[Y,[G],(e,[t])=>e.id()===t.value],"filter-type-==":[Y,[U],(e,[t])=>e.geometryType()===t.value],"filter-<":[Y,[U,G],(e,[t,r])=>{let i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i<n}],"filter-id-<":[Y,[G],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<i}],"filter->":[Y,[U,G],(e,[t,r])=>{let i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[Y,[G],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>i}],"filter-<=":[Y,[U,G],(e,[t,r])=>{let i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[Y,[G],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<=i}],"filter->=":[Y,[U,G],(e,[t,r])=>{let i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[Y,[G],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>=i}],"filter-has":[Y,[G],(e,[t])=>{let r=t.value,i=e.properties();return r in i&&i[r]!==void 0}],"filter-has-id":[Y,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[Y,[Ae(U)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[Y,[Ae(G)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[Y,[U,Ae(G)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[Y,[U,Ae(G)],(e,[t,r])=>hy(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:Y,overloads:[[[Y,Y],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Et(Y),(e,t)=>{for(let r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:Y,overloads:[[[Y,Y],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Et(Y),(e,t)=>{for(let r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[Y,[Y],(e,[t])=>!t.evaluate(e)],"is-supported-script":[Y,[U],(e,[t])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[U,[U],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[U,[U],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[U,Et(G),(e,t)=>t.map(r=>Br(r.evaluate(e))).join("")],split:[Ae(U),[U,U],(e,[t,r])=>t.evaluate(e).split(r.evaluate(e))],join:[U,[Ae(U),U],(e,[t,r])=>t.evaluate(e).join(r.evaluate(e))],"resolved-locale":[U,[Ti],(e,[t])=>t.evaluate(e).resolvedLocale()]});function cy(e){return Array.isArray(e)?`(${e.map(ee).join(", ")})`:`(${ee(e.type)}...)`}function Ri(e){if(e instanceof ll)return Ri(e.boundExpression);if(e instanceof Dt&&e.name==="error"||e instanceof pl||e instanceof ia||e instanceof ca||e instanceof pa)return!1;let t=e instanceof Wt||e instanceof rt,r=!0;return e.eachChild(i=>{r&&(r=t?Ri(i):i instanceof Zt)}),r?Ni(e)&&Ui(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Ni(e){if(e instanceof Dt&&(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 ia||e instanceof ca)return!1;let t=!0;return e.eachChild(r=>{t&&!Ni(r)&&(t=!1)}),t}function Lr(e){if(e instanceof Dt&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(r=>{t&&!Lr(r)&&(t=!1)}),t}function Ui(e,t){if(e instanceof Dt&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(i=>{r&&!Ui(i,t)&&(r=!1)}),r}function Qt(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function Il(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function da(e){return!!e.expression&&e.expression.interpolated}function Vr(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function j(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function qi(e){return typeof e=="object"&&!!e&&!Array.isArray(e)&&ae(e)===bt}function py(e){return e}function fy(e){switch(e.type){case"color":return te.parse;case"padding":return Ze.parse;case"numberArray":return We.parse;case"colorArray":return Me.parse;default:return null}}function dy(e){switch(e){case"exponential":return Fl;case"interval":return my;case"categorical":return yy;case"identity":return gy;default:throw Error(`Unknown function type "${e}"`)}}function kl(e,t){let r=e.stops&&typeof e.stops[0][0]=="object",i=r||e.property!==void 0,n=r||!i,a=e.type||(da(t)?"exponential":"interval"),s=fy(t);if(s&&(e=Vr({},e),e.stops&&(e.stops=e.stops.map(h=>[h[0],s(h[1])])),e.default?e.default=s(e.default):e.default=s(t.default)),e.colorSpace&&!sd(e.colorSpace))throw Error(`Unknown color space: "${e.colorSpace}"`);let o=dy(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(r){let h={},c=[];for(let d=0;d<e.stops.length;d++){let y=e.stops[d],m=y[0].zoom;h[m]===void 0&&(h[m]={zoom:m,type:e.type,property:e.property,default:e.default,stops:[]},c.push(m)),h[m].stops.push([y[0].value,y[1]])}let p=[];for(let d of c)p.push([h[d].zoom,kl(h[d],t)]);let f={name:"linear"};return{kind:"composite",interpolationType:f,interpolationFactor:Je.interpolationFactor.bind(void 0,f),zoomStops:p.map(d=>d[0]),evaluate({zoom:d},y){return Fl({stops:p,base:e.base},t,d).evaluate(d,y)}}}if(n){let h=a==="exponential"?{name:"exponential",base:e.base===void 0?1:e.base}:null;return{kind:"camera",interpolationType:h,interpolationFactor:Je.interpolationFactor.bind(void 0,h),zoomStops:e.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(e,t,c,l,u)}}return{kind:"source",evaluate(h,c){let p=c&&c.properties?c.properties[e.property]:void 0;return p===void 0?Or(e.default,t.default):o(e,t,p,l,u)}}}function Or(e,t,r){if(e!==void 0)return e;if(t!==void 0)return t;if(r!==void 0)return r}function yy(e,t,r,i,n){return Or(typeof r===n?i[r]:void 0,e.default,t.default)}function my(e,t,r){if(j(r)!=="number")return Or(e.default,t.default);let i=e.stops.length;if(i===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let n=Bi(e.stops.map(a=>a[0]),r,"");return e.stops[n][1]}function Fl(e,t,r){let i=e.base===void 0?1:e.base;if(j(r)!=="number")return Or(e.default,t.default);let n=e.stops.length;if(n===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let a=Bi(e.stops.map(h=>h[0]),r,""),s=xy(r,i,e.stops[a][0],e.stops[a+1][0]),o=e.stops[a][1],l=e.stops[a+1][1],u=St[t.type]||py;return typeof o.evaluate=="function"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(c!==void 0&&p!==void 0)return u(c,p,s,e.colorSpace)}}:u(o,l,s,e.colorSpace)}function gy(e,t,r){switch(t.type){case"color":r=te.parse(r);break;case"formatted":r=tt.fromString(r.toString());break;case"resolvedImage":r=Ke.fromString(r.toString());break;case"padding":r=Ze.parse(r);break;case"colorArray":r=Me.parse(r);break;case"numberArray":r=We.parse(r);break;default:j(r)!==t.type&&(t.type!=="enum"||!t.values[r])&&(r=void 0)}return Or(r,e.default,t.default)}function xy(e,t,r,i){let n=i-r,a=e-r;return n===0?0:t===1?a/n:(t**+a-1)/(t**+n-1)}function ya(e){return{result:"success",value:e}}function er(e){return{result:"error",value:e}}var ma=class{constructor(e,t,r,i){this.expression=e,this._warningHistory={},this._evaluator=new il,this._defaultValue=r?zl(r):null,this._enumValues=r&&r.type==="enum"?r.values:null,this._globalState=i,this._rootKey=t}evaluateWithoutErrorHandling(e,t,r,i,n,a){return this._globalState&&(e=tr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,i,n,a){this._globalState&&(e=tr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||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 J(`Expected value to be one of ${Object.keys(this._enumValues).map(o=>JSON.stringify(o)).join(", ")}, but found ${JSON.stringify(s)} instead.`,"");return s}catch(s){let o=s instanceof J?s.path:"",l=`${o}|${s.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<"u"&&console.warn(Cl(this._rootKey,o,s.message,this._defaultValue))),this._defaultValue}}};function Cl(e,t,r,i){return`${e}${t}: ${r}${i==null?"":` Falling back to ${String(i)}.`}`}function Bl(e){if(!e)throw Error('rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".')}function Gi(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in Jt}function Tt(e,t,r,i){Bl(t);let n=new Dl(Jt,Ri,[],r?wy(r):void 0),a=n.parse(e,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?ya(new ma(a,t,r,i)):er(n.errors)}var $r=class{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Lr(t.expression),this.globalStateRefs=Rr(t.expression),this._globalState=r}evaluateWithoutErrorHandling(e,t,r,i,n,a){return this._globalState&&(e=tr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,n,a)}evaluate(e,t,r,i,n,a){return this._globalState&&(e=tr(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,n,a)}},ji=class{constructor(e,t,r,i,n){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Lr(t.expression),this.globalStateRefs=Rr(t.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(e,t,r,i,n,a){return this._globalState&&(e=tr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,n,a)}evaluate(e,t,r,i,n,a){return this._globalState&&(e=tr(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,n,a)}interpolationFactor(e,t,r){return this.interpolationType?Je.interpolationFactor(this.interpolationType,e,t,r):0}};function vy(e){return e._styleExpression!==void 0}function Pl(e,t,r,i){let n=Tt(e,t,r,i);if(n.result==="error")return n;let a=n.value.expression,s=Ni(a);if(!s&&!Qt(r))return er([new et("","data expressions not supported")]);let o=Ui(a,["zoom"]);if(!o&&!Il(r))return er([new et("","zoom expressions not supported")]);let l=Yi(a);if(!l&&!o)return er([new et("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(l instanceof et)return er([l]);if(l instanceof Je&&!da(r))return er([new et("",'"interpolate" expressions cannot be used with this property')]);if(!l)return ya(s?new $r("constant",n.value,i):new $r("source",n.value,i));let u=l instanceof Je?l.interpolation:void 0;return ya(s?new ji("camera",n.value,l.labels,u,i):new ji("composite",n.value,l.labels,u,i))}var Ml=class tf{constructor(t,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,Bl(r),this._parameters=t,this._specification=i,this._rootKey=r,this._defaultValue=zl(i),this._warningHistory={};let n=kl(this._parameters,this._specification);this.kind=n.kind,this.interpolationFactor=n.interpolationFactor,this.zoomStops=n.zoomStops,this.interpolationType=n.interpolationType,this._innerEvaluate=n.evaluate}evaluate(t,r){try{return this._innerEvaluate(t,r)}catch(i){let n=i instanceof Error?i.message:String(i),a=`|${n}`;return this._warningHistory[a]||(this._warningHistory[a]=!0,typeof console<"u"&&console.warn(Cl(this._rootKey,"",n,this._defaultValue))),this._defaultValue}}static deserialize(t){return new tf(t._parameters,t._rootKey,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification,_rootKey:t._rootKey}}};function by(e,t,r,i){if(qi(e))return new Ml(e,t,r);if(Gi(e)){let n=Pl(e,t,r,i);if(n.result==="error")throw Error(n.value.map(a=>`${a.key}: ${a.message}`).join(", "));return n.value}{let n=e;return r.type==="color"&&typeof e=="string"?n=te.parse(e):r.type==="padding"&&(typeof e=="number"||Array.isArray(e))?n=Ze.parse(e):r.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?n=We.parse(e):r.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?n=Me.parse(e):r.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?n=He.parse(e):r.type==="projectionDefinition"&&typeof e=="string"&&(n=_t.parse(e)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>n}}}function Yi(e){let t=null;if(e instanceof ol)t=Yi(e.result);else if(e instanceof ul){for(let r of e.args)if(t=Yi(r),t)break}else(e instanceof Qn||e instanceof Je)&&e.input instanceof Dt&&e.input.name==="zoom"&&(t=e);return t instanceof et||e.eachChild(r=>{let i=Yi(r);i instanceof et?t=i:!t&&i?t=new et("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new et("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Rr(e,t=new Set){return e instanceof pa&&t.add(e.key),e.eachChild(r=>{Rr(r,t)}),t}function wy(e){let t={color:qe,string:U,number:k,enum:U,boolean:Y,formatted:Tr,padding:Ii,numberArray:ki,colorArray:Ir,projectionDefinition:Ei,resolvedImage:kr,variableAnchorOffsetCollection:Fi};return e.type==="array"?Ae(t[e.value]||G,e.length):t[e.type]}function zl(e){if(e.type==="color"&&qi(e.default))return new te(0,0,0,0);switch(e.type){case"color":return te.parse(e.default)||null;case"padding":return Ze.parse(e.default)||null;case"numberArray":return We.parse(e.default)||null;case"colorArray":return Me.parse(e.default)||null;case"variableAnchorOffsetCollection":return He.parse(e.default)||null;case"projectionDefinition":return _t.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function tr(e,t){let{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o}=e??{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o,globalState:t}}function _y(e){let t=!1;for(let r of e){let i=Ll(r);if(i==="expression")return"expression";i==="legacy"&&(t=!0)}return t?"legacy":"neutral"}function Ll(e){if(typeof e=="boolean")return"neutral";if(!Array.isArray(e)||e.length===0)return"legacy";switch(e[0]){case"has":return e.length<2||e[1]==="$id"||e[1]==="$type"?"legacy":e.length===2?"neutral":"expression";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]))?"expression":"legacy";case"!in":case"!has":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2])?"expression":"legacy";case"none":return"legacy";case"any":case"all":return _y(e.slice(1));default:return"expression"}}function ga(e){return Ll(e)!=="legacy"}function Vl(e){return e==="$type"?["geometry-type"]:e==="$id"?["id"]:["get",e]}function Sy(e){switch(e[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return e.length!==3||typeof e[1]!="string"?null:[e[0],Vl(e[1]),e[2]];case"in":case"!in":{if(e.length<2||typeof e[1]!="string")return null;let t=["in",Vl(e[1]),["literal",e.slice(2)]];return e[0]==="!in"?["!",t]:t}case"has":case"!has":{if(e.length!==2||typeof e[1]!="string"||e[1]==="$type"||e[1]==="$id")return null;let t=["has",e[1]];return e[0]==="!has"?["!",t]:t}default:return null}}function Ol(e){if((e[0]==="<"||e[0]==="<="||e[0]===">"||e[0]===">=")&&e[1]==="$type")return`"$type" cannot be use with operator "${e[0]}"`;let t=Sy(e);return t?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(e)} with ${JSON.stringify(t)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(e)} to expression syntax.`}function xa(e,t,r){let i=r[e];return Array.isArray(i)?ga(i)?va(i,t.concat(e)):{path:t.concat(e),legacyFilter:i}:null}function va(e,t=[]){if(!Array.isArray(e)||e.length<1)return null;switch(e[0]){case"all":case"any":case"none":for(let r=1;r<e.length;r++){let i=xa(r,t,e);if(i)return i}break;case"!":{let r=xa(1,t,e);if(r)return r;break}case"case":for(let r=1;r<e.length-1;r+=2){let i=xa(r,t,e);if(i)return i}}return null}function Ay(e,t){let r=va(e);if(!r||typeof console>"u")return;let i=r.path.map(n=>`[${n}]`).join("");console.warn(`${t}${i}: ${Ol(r.legacyFilter)}`)}const Dy={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Nr(e,t,r){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};ga(e)?Ay(e,t):e=Xi(e);let i=Tt(e,t,Dy,r);if(i.result==="error")throw Error(i.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,a,s)=>i.value.evaluate(n,a,{},s),needGeometry:$l(e),getGlobalStateRefs:()=>Rr(i.value.expression)}}function Ey(e,t){return e<t?-1:+(e>t)}function $l(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($l(e[t]))return!0;return!1}function Xi(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?ba(e[1],e[2],"=="):t==="!="?Zi(ba(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?ba(e[1],e[2],t):t==="any"?Ty(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(Xi)):t==="none"?["all"].concat(e.slice(1).map(Xi).map(Zi)):t==="in"?Rl(e[1],e.slice(2)):t==="!in"?Zi(Rl(e[1],e.slice(2))):t==="has"?Nl(e[1]):t!=="!has"||Zi(Nl(e[1]))}function ba(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function Ty(e){return["any"].concat(e.map(Xi))}function Rl(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(r=>typeof r!=typeof t[0])?["filter-in-large",e,["literal",t.sort(Ey)]]:["filter-in-small",e,["literal",t]]}}function Nl(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Zi(e){return["!",e]}function Ul(e){let t=e.key,r=e.value;return r?[new D(t,r,"constants have been deprecated as of v8")]:[]}function se(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function It(e){if(Array.isArray(e))return e.map(It);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=It(e[r]);return t}return se(e)}function Fe(e){let t=e.key,r=e.value,i=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,s=e.styleSpec,o=e.validateSpec,l=[],u=j(r);if(u!=="object")return[new D(t,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(".")[0],p=Cr(i,c)||i["*"],f;if(Cr(n,c))f=n[c];else if(Cr(i,c)){if(r[h]===void 0)continue;f=o}else if(n["*"])f=n["*"];else if(i["*"])f=o;else{l.push(new D(t,r[h],`unknown property "${h}"`));continue}l=l.concat(f({key:(t&&`${t}.`)+h,value:r[h],valueSpec:p,style:a,styleSpec:s,object:r,objectKey:h,validateSpec:o},r))}for(let h in i)n[h]||i[h].required&&i[h].default===void 0&&r[h]===void 0&&l.push(new D(t,r,`missing required property "${h}"`));return l}function wa(e){let t=e.value,r=e.valueSpec,i=e.validateSpec,n=e.style,a=e.styleSpec,s=e.key,o=e.arrayElementValidator||i;if(j(t)!=="array")return[new D(s,t,`array expected, ${j(t)} found`)];if(r.length&&t.length!==r.length)return[new D(s,t,`array length ${r.length} expected, length ${t.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),j(r.value)==="object"&&(l=r.value);let u=[];for(let h=0;h<t.length;h++)u=u.concat(o({array:t,arrayIndex:h,value:t[h],valueSpec:l,validateSpec:e.validateSpec,style:n,styleSpec:a,key:`${s}[${h}]`}));return u}function Wi(e){let t=e.key,r=e.value,i=e.valueSpec,n=j(r);return n==="number"&&r!==r&&(n="NaN"),n==="number"?"minimum"in i&&r<i.minimum?[new D(t,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new D(t,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new D(t,r,`number expected, ${n} found`)]}function ql(e){let t=e.valueSpec,r=se(e.value.type),i,n={},a,s,o=r!=="categorical"&&e.value.property===void 0,l=!o,u=j(e.value.stops)==="array"&&j(e.value.stops[0])==="array"&&j(e.value.stops[0][0])==="object",h=Fe({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:c,default:d}});return r==="identity"&&o&&h.push(new D(e.key,e.value,'missing required property "property"')),r!=="identity"&&!e.value.stops&&h.push(new D(e.key,e.value,'missing required property "stops"')),r==="exponential"&&e.valueSpec.expression&&!da(e.valueSpec)&&h.push(new D(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Qt(e.valueSpec)?h.push(new D(e.key,e.value,"property functions not supported")):o&&!Il(e.valueSpec)&&h.push(new D(e.key,e.value,"zoom functions not supported"))),(r==="categorical"||u)&&e.value.property===void 0&&h.push(new D(e.key,e.value,'"property" property is required')),h;function c(y){if(r==="identity")return[new D(y.key,y.value,'identity function may not have a "stops" property')];let m=[],g=y.value;return m=m.concat(wa({key:y.key,value:g,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),j(g)==="array"&&g.length===0&&m.push(new D(y.key,g,"array must have at least one stop")),m}function p(y){let m=[],g=y.value,x=y.key;if(j(g)!=="array")return[new D(x,g,`array expected, ${j(g)} found`)];if(g.length!==2)return[new D(x,g,`array length 2 expected, length ${g.length} found`)];if(u){if(j(g[0])!=="object")return[new D(x,g,`object expected, ${j(g[0])} found`)];if(g[0].zoom===void 0)return[new D(x,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new D(x,g,"object stop key must have value")];if(s&&s>se(g[0].zoom))return[new D(x,g[0].zoom,"stop zoom values must appear in ascending order")];se(g[0].zoom)!==s&&(s=se(g[0].zoom),a=void 0,n={}),m=m.concat(Fe({key:`${x}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Wi,value:f}}))}else m=m.concat(f({key:`${x}[0]`,value:g[0],validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},g));return Gi(It(g[1]))?m.concat([new D(`${x}[1]`,g[1],"expressions are not allowed in function stops.")]):m.concat(y.validateSpec({key:`${x}[1]`,value:g[1],valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function f(y,m){let g=j(y.value),x=se(y.value),v=y.value===null?m:y.value;if(!i)i=g;else if(g!==i)return[new D(y.key,v,`${g} stop domain type must match previous stop domain type ${i}`)];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new D(y.key,v,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let b=`number expected, ${g} found`;return Qt(t)&&r===void 0&&(b+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new D(y.key,v,b)]}return r==="categorical"&&g==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new D(y.key,v,`integer expected, found ${x}`)]:r!=="categorical"&&g==="number"&&a!==void 0&&x<a?[new D(y.key,v,"stop domain values must appear in ascending order")]:(a=x,r==="categorical"&&x in n?[new D(y.key,v,"stop domain values must be unique")]:(n[x]=!0,[]))}function d(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function rr(e){let t=(e.expressionContext==="property"?Pl:Tt)(It(e.value),e.key,e.valueSpec);if(t.result==="error")return t.value.map(i=>new D(`${e.key}${i.key}`,e.value,i.message));let r=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!r.outputDefined())return[new D(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!Lr(r))return[new D(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!Lr(r))return[new D(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!Ui(r,["zoom","feature-state"]))return[new D(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!Ni(r))return[new D(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Iy(e){let t=e.value,r=e.key,i=j(t);return i==="boolean"?[]:[new D(r,t,`boolean expected, ${i} found`)]}function _a(e){let t=e.key,r=e.value,i=j(r);return i==="string"?te.parse(String(r))?[]:[new D(t,r,`color expected, "${r}" found`)]:[new D(t,r,`color expected, ${i} found`)]}function Ur(e){let t=e.key,r=e.value,i=e.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(se(r))===-1&&n.push(new D(t,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(se(r))===-1&&n.push(new D(t,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function ky(e,t){let r=e;for(let i of t)r=r[i];return r}function Fy(e,t){let r=va(t);return r?[new D(`${e.key}${r.path.map(i=>`[${i}]`).join("")}`,ky(e.value,r.path),Ol(r.legacyFilter),null,"warning")]:[]}function Sa(e){let t=It(e.value);return ga(t)?[...Fy(e,t),...rr(Vr({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:Gl(e)}function Gl(e){let t=e.value,r=e.key;if(j(t)!=="array")return[new D(r,t,`array expected, ${j(t)} found`)];let i=e.styleSpec,n,a=[];if(t.length<1)return[new D(r,t,"filter array must have at least 1 element")];switch(a=a.concat(Ur({key:`${r}[0]`,value:t[0],valueSpec:i.filter_operator,style:e.style,styleSpec:e.styleSpec})),se(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&se(t[1])==="$type"&&a.push(new D(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&a.push(new D(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=j(t[1]),n!=="string"&&a.push(new D(`${r}[1]`,t[1],`string expected, ${n} found`)));for(let s=2;s<t.length;s++)n=j(t[s]),se(t[1])==="$type"?a=a.concat(Ur({key:`${r}[${s}]`,value:t[s],valueSpec:i.geometry_type,style:e.style,styleSpec:e.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&a.push(new D(`${r}[${s}]`,t[s],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let s=1;s<t.length;s++)a=a.concat(Gl({key:`${r}[${s}]`,value:t[s],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=j(t[1]),t.length===2?n!=="string"&&a.push(new D(`${r}[1]`,t[1],`string expected, ${n} found`)):a.push(new D(r,t,`filter array for "${t[0]}" operator must have 2 elements`))}return a}function jl(e,t){let r=e.key,i=e.validateSpec,n=e.style,a=e.styleSpec,s=e.value,o=e.objectKey,l=a[`${t}_${e.layerType}`];if(!l)return[];let u=o.match(/^(.*)-transition$/);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:s,valueSpec:a.transition,style:n,styleSpec:a});let h=e.valueSpec||l[o];if(!h)return[new D(r,s,`unknown property "${o}"`)];let c;if(j(s)==="string"&&Qt(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new D(r,s,`"${o}" does not support interpolation syntax
5
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];let p=[];return e.layerType==="symbol"&&o==="text-font"&&qi(It(s))&&se(s.type)==="identity"&&p.push(new D(r,s,'"text-font" does not support identity functions')),p.concat(i({key:e.key,value:s,valueSpec:h,style:n,styleSpec:a,expressionContext:"property",propertyType:t,propertyKey:o}))}function Yl(e){return jl(e,"paint")}function Xl(e){return jl(e,"layout")}function Zl(e){var l,u;let t=[],r=e.value,i=e.key,n=e.style,a=e.styleSpec;if(j(r)!=="object")return[new D(i,r,`object expected, ${j(r)} found`)];!r.type&&!r.ref&&t.push(new D(i,r,'either "type" or "ref" is required'));let s=se(r.type),o=se(r.ref);if(r.id){let h=se(r.id);for(let c=0;c<e.arrayIndex;c++){let p=n.layers[c];se(p.id)===h&&t.push(new D(i,r.id,`duplicate layer id "${r.id}", previously used at line ${p.id.__line__}`))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(c=>{c in r&&t.push(new D(i,r[c],`"${c}" is prohibited for ref layers`))});let h;n.layers.forEach(c=>{se(c.id)===o&&(h=c)}),h?h.ref?t.push(new D(i,r.ref,"ref cannot reference another ref layer")):s=se(h.type):t.push(new D(i,r.ref,`ref layer "${o}" not found`))}else if(s!=="background")if(!r.source)t.push(new D(i,r,'missing required property "source"'));else{let h=n.sources&&n.sources[r.source],c=h&&se(h.type);h?c==="vector"&&s==="raster"?t.push(new D(i,r.source,`layer "${r.id}" requires a raster source`)):c!=="raster-dem"&&s==="hillshade"||c!=="raster-dem"&&s==="color-relief"?t.push(new D(i,r.source,`layer "${r.id}" requires a raster-dem source`)):c==="raster"&&s!=="raster"?t.push(new D(i,r.source,`layer "${r.id}" requires a vector source`)):c==="vector"&&!r["source-layer"]?t.push(new D(i,r,`layer "${r.id}" must specify a "source-layer"`)):c==="raster-dem"&&s!=="hillshade"&&s!=="color-relief"?t.push(new D(i,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):s==="line"&&r.paint&&r.paint["line-gradient"]&&(c!=="geojson"||!h.lineMetrics)&&t.push(new D(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new D(i,r.source,`source "${r.source}" not found`))}return s==="raster"&&((l=r.paint)!=null&&l.resampling)&&((u=r.paint)!=null&&u["raster-resampling"])&&t.push(new D(i,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),t=t.concat(Fe({key:i,value:r,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:`${i}.type`,value:r.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"})},filter:Sa,layout(h){return Fe({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return Xl(Vr({layerType:s},c))}}})},paint(h){return Fe({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return Yl(Vr({layerType:s},c))}}})}}})),t}function yt(e){let t=e.value,r=e.key,i=j(t);return i==="string"?[]:[new D(r,t,`string expected, ${i} found`)]}function Cy(e){let t=e.sourceName??"",r=e.value,i=e.styleSpec,n=i.source_raster_dem,a=e.style,s=[],o=j(r);if(r===void 0)return s;if(o!=="object")return s.push(new D("source_raster_dem",r,`object expected, ${o} found`)),s;let l=se(r.encoding)==="custom",u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(let c in r)!l&&u.includes(c)?s.push(new D(c,r[c],`In "${t}": "${c}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):n[c]?s=s.concat(e.validateSpec({key:c,value:r[c],valueSpec:n[c],validateSpec:e.validateSpec,style:a,styleSpec:i})):s.push(new D(c,r[c],`unknown property "${c}"`));return s}const Wl={promoteId:By};function Hl(e){let t=e.value,r=e.key,i=e.styleSpec,n=e.style,a=e.validateSpec;if(!t.type)return[new D(r,t,'"type" is required')];let s=se(t.type),o;switch(s){case"vector":case"raster":return o=Fe({key:r,value:t,valueSpec:i[`source_${s.replace("-","_")}`],style:e.style,styleSpec:i,objectElementValidators:Wl,validateSpec:a}),o;case"raster-dem":return o=Cy({sourceName:r,value:t,style:e.style,styleSpec:i,validateSpec:a}),o;case"geojson":if(o=Fe({key:r,value:t,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:Wl}),t.cluster)for(let l in t.clusterProperties){let[u,h]=t.clusterProperties[l],c=typeof u=="string"?[u,["accumulated"],["get",l]]:u;o.push(...rr({key:`${r}.${l}.map`,value:h,expressionContext:"cluster-map"})),o.push(...rr({key:`${r}.${l}.reduce`,value:c,expressionContext:"cluster-reduce"}))}return o;case"video":return Fe({key:r,value:t,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case"image":return Fe({key:r,value:t,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case"canvas":return[new D(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ur({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function By({key:e,value:t}){if(j(t)==="string")return yt({key:e,value:t});{let r=[];for(let i in t)r.push(...yt({key:`${e}.${i}`,value:t[i]}));return r}}function Kl(e){let t=e.value,r=e.styleSpec,i=r.light,n=e.style,a=[],s=j(t);if(t===void 0)return a;if(s!=="object")return a=a.concat([new D("light",t,`object expected, ${s} found`)]),a;for(let o in t){let l=o.match(/^(.*)-transition$/);a=l&&i[l[1]]&&i[l[1]].transition?a.concat(e.validateSpec({key:o,value:t[o],valueSpec:r.transition,validateSpec:e.validateSpec,style:n,styleSpec:r})):i[o]?a.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],validateSpec:e.validateSpec,style:n,styleSpec:r})):a.concat([new D(o,t[o],`unknown property "${o}"`)])}return a}function Jl(e){let t=e.value,r=e.styleSpec,i=r.sky,n=e.style,a=j(t);if(t===void 0)return[];if(a!=="object")return[new D("sky",t,`object expected, ${a} found`)];let s=[];for(let o in t)s=i[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new D(o,t[o],`unknown property "${o}"`)]);return s}function Ql(e){let t=e.value,r=e.styleSpec,i=r.terrain,n=e.style,a=[],s=j(t);if(t===void 0)return a;if(s!=="object")return a=a.concat([new D("terrain",t,`object expected, ${s} found`)]),a;for(let o in t)a=i[o]?a.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],validateSpec:e.validateSpec,style:n,styleSpec:r})):a.concat([new D(o,t[o],`unknown property "${o}"`)]);return a}function Py(e){return yt(e).length===0?[]:rr(e)}function My(e){return yt(e).length===0?[]:rr(e)}function zy(e){let t=e.key,r=e.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new D(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},n=[];for(let a=0;a<r.length;a++)n=n.concat(e.validateSpec({key:`${t}[${a}]`,value:r[a],validateSpec:e.validateSpec,valueSpec:i}));return n}return Wi({key:t,value:r,valueSpec:{}})}function Ly(e){let t=e.key,r=e.value;if(j(r)==="array"){let i={type:"number"};if(r.length<1)return[new D(t,r,"array length at least 1 expected, length 0 found")];let n=[];for(let a=0;a<r.length;a++)n=n.concat(e.validateSpec({key:`${t}[${a}]`,value:r[a],validateSpec:e.validateSpec,valueSpec:i}));return n}return Wi({key:t,value:r,valueSpec:{}})}function Vy(e){let t=e.key,r=e.value;if(j(r)==="array"){if(r.length<1)return[new D(t,r,"array length at least 1 expected, length 0 found")];let i=[];for(let n=0;n<r.length;n++)i=i.concat(_a({key:`${t}[${n}]`,value:r[n]}));return i}return _a({key:t,value:r})}function Oy(e){let t=e.key,r=e.value,i=j(r),n=e.styleSpec;if(i!=="array"||r.length<1||r.length%2!=0)return[new D(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let a=[];for(let s=0;s<r.length;s+=2)a=a.concat(Ur({key:`${t}[${s}]`,value:r[s],valueSpec:n.layout_symbol["text-anchor"]})),a=a.concat(wa({key:`${t}[${s+1}]`,value:r[s+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return a}function eu(e){let t=[],r=e.value,i=e.key;if(Array.isArray(r)){let n=[],a=[];for(let s in r)r[s].id&&n.includes(r[s].id)&&t.push(new D(i,r,`all the sprites' ids must be unique, but ${r[s].id} is duplicated`)),n.push(r[s].id),r[s].url&&a.includes(r[s].url)&&t.push(new D(i,r,`all the sprites' URLs must be unique, but ${r[s].url} is duplicated`)),a.push(r[s].url),t=t.concat(Fe({key:`${i}[${s}]`,value:r[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return yt({key:i,value:r})}function $y(e){let t=e.value,r=e.styleSpec,i=r.projection,n=e.style,a=j(t);if(t===void 0)return[];if(a!=="object")return[new D("projection",t,`object expected, ${a} found`)];let s=[];for(let o in t)s=i[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new D(o,t[o],`unknown property "${o}"`)]);return s}function Ry(e){let t=e.key,r=e.value;r=r instanceof String?r.valueOf():r;let i=j(r);return i==="array"&&!Uy(r)&&!Ny(r)?[new D(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(i)?[]:[new D(t,r,`projection expected, invalid type "${i}" found`)]}function Ny(e){return!!["interpolate","step","literal"].includes(e[0])}function Uy(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"}function Aa(e){return!!e&&e.constructor===Object}function tu(e){return Aa(e.value)?[]:[new D(e.key,e.value,`object expected, ${j(e.value)} found`)]}const ru=1114111,qy=/^u\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\?{1,6}))$/i;function Gy(e,t){if(j(t)!=="string")return[];let r=`${t}`,i=()=>[new D(e,t,'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"')],n=r.match(qy);if(!n)return i();let[,a,s,o]=n;if(o!==void 0)return o.length>6?i():[];let l=parseInt(a,16),u=s===void 0?l:parseInt(s,16);return l>ru||u>ru?[new D(e,t,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new D(e,t,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function iu(e){let t=e.key??"font-faces",r=e.value,i=e.validateSpec,n=e.styleSpec??Yo,a=e.style;if(!Aa(r))return[new D(t,r,`object expected, ${j(r)} found`)];let s=[];for(let o in r){let l=r[o],u=j(l);if(u==="string")s.push(...yt({key:`${t}.${o}`,value:l}));else if(u==="array"){let h={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[c,p]of l.entries()){let f=`${t}.${o}[${c}]`;s.push(...Fe({key:f,value:p,valueSpec:h,styleSpec:n,style:a,validateSpec:i}));let d=Aa(p)?p["unicode-range"]:void 0;if(j(d)==="array")for(let[y,m]of d.entries())s.push(...Gy(`${f}.unicode-range[${y}]`,m))}}else s.push(new D(`${t}.${o}`,l,`string or array expected, ${u} found`))}return s}const nu={"*"(){return[]},array:wa,boolean:Iy,number:Wi,color:_a,constants:Ul,enum:Ur,filter:Sa,function:ql,layer:Zl,object:Fe,source:Hl,light:Kl,sky:Jl,terrain:Ql,projection:$y,projectionDefinition:Ry,string:yt,formatted:Py,resolvedImage:My,padding:zy,numberArray:Ly,colorArray:Vy,variableAnchorOffsetCollection:Oy,sprite:eu,state:tu,fontFaces:iu};function Hi(e){let t=e.value,r=e.valueSpec,i=e.styleSpec;return e.validateSpec=Hi,r.expression&&qi(se(t))?ql(e):r.expression&&Gi(It(t))?rr(e):r.type&&nu[r.type]?nu[r.type](e):Fe(Vr({},e,{valueSpec:r.type?i[r.type]:r}))}function au(e){let t=e.value,r=e.key,i=yt(e);return i.length||(t.indexOf("{fontstack}")===-1&&i.push(new D(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&i.push(new D(r,t,'"glyphs" url must include a "{range}" token'))),i}function Ce(e,t=w){let r=[];return r=r.concat(Hi({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Hi,objectElementValidators:{glyphs:au,"*"(){return[]}}})),e.constants&&(r=r.concat(Ul({key:"constants",value:e.constants}))),su(r)}Ce.source=Le(ze(Hl)),Ce.sprite=Le(ze(eu)),Ce.glyphs=Le(ze(au)),Ce.fontFaces=Le(ze(iu)),Ce.light=Le(ze(Kl)),Ce.sky=Le(ze(Jl)),Ce.terrain=Le(ze(Ql)),Ce.state=Le(ze(tu)),Ce.layer=Le(ze(Zl)),Ce.filter=Le(ze(Sa)),Ce.paintProperty=Le(ze(Yl)),Ce.layoutProperty=Le(ze(Xl));function ze(e){return function(t){return e(Object.assign({},t,{validateSpec:Hi}))}}function su(e){return[].concat(e).sort((t,r)=>t.line-r.line)}function Le(e){return function(...t){return su(e.apply(this,t))}}const jy={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};var Yy=class{constructor(e,t,r){this._rootKey=t,this._globalState=r,this.setValue(e)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(e){if(e==null||e==="visible"||e==="none"){this._literalValue=e==="none"?"none":"visible",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let t=Tt(e,this._rootKey,jy,this._globalState);if(t.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=Rr(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function Xy(e,t,r){return new Yy(e,t,r)}const ou=Ce;new Set(Object.keys(w).filter(e=>e.startsWith("source_")).map(e=>e.slice(7).replaceAll("_","-")));function Zy(e,t){let r=!1;for(let i of t){if(i.severity==="warning"){ge(i.message);continue}e.fire(new Di(Error(i.message))),r=!0}return r}function Wy(e,t,r,i){return(i==null?void 0:i.validate)!==!1&&Zy(e,t({styleSpec:w,...r}))}var Da=class rf{constructor(t,r,i){let n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let s=new Int32Array(this.arrayBuffer);t=s[0],r=s[1],i=s[2],this.d=r+2*i;for(let u=0;u<this.d*this.d;u++){let h=s[3+u],c=s[3+u+1];n.push(h===c?null:s.subarray(h,c))}let o=s[3+n.length],l=s[3+n.length+1];this.keys=s.subarray(o,l),this.bboxes=s.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*i;for(let s=0;s<this.d*this.d;s++)n.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=i,this.scale=r/t,this.uid=0;let a=i/r*t;this.min=-a,this.max=t+a}insert(t,r,i,n,a){this._forEachCell(r,i,n,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(a)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,i,n,a,s){this.cells[a].push(s)}query(t,r,i,n,a){let s=this.min,o=this.max;if(t<=s&&r<=s&&o<=i&&o<=n&&!a)return[...this.keys];{let l=[];return this._forEachCell(t,r,i,n,this._queryCell,l,{},a),l}}_queryCell(t,r,i,n,a,s,o,l){let u=this.cells[a];if(u!==null){let h=this.keys,c=this.bboxes;for(let p of u)if(o[p]===void 0){let f=p*4;(l?l(c[f+0],c[f+1],c[f+2],c[f+3]):t<=c[f+2]&&r<=c[f+3]&&i>=c[f+0]&&n>=c[f+1])?(o[p]=!0,s.push(h[p])):o[p]=!1}}}_forEachCell(t,r,i,n,a,s,o,l){let u=this._convertToCellCoord(t),h=this._convertToCellCoord(r),c=this._convertToCellCoord(i),p=this._convertToCellCoord(n);for(let f=u;f<=c;f++)for(let d=h;d<=p;d++){let y=this.d*d+f;if(!(l&&!l(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&a.call(this,t,r,i,n,y,s,o,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,r=3+this.cells.length+1+1,i=0;for(let s of this.cells)i+=s.length;let n=new Int32Array(r+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=r;for(let s=0;s<t.length;s++){let o=t[s];n[3+s]=a,n.set(o,a),a+=o.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,r){let i=t.toArrayBuffer();return r&&r.push(i),{buffer:i}}static deserialize(t){return new rf(t.buffer)}};const nt={};function C(e,t,r={}){if(nt[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),nt[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}C("Object",Object),C("Set",Set),C("TransferableGridIndex",Da),C("Color",te),C("Error",Error),C("AJAXError",Ai),C("ResolvedImage",Ke),C("StylePropertyFunction",Ml),C("StyleExpression",ma,{omit:["_evaluator"]}),C("ZoomDependentExpression",ji),C("ZoomConstantExpression",$r),C("CompoundExpression",Dt,{omit:["_evaluate"]});for(let e in Jt)Jt[e]._classRegistryKey||C(`Expression_${e}`,Jt[e]);function lu(e){var t;return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||((t=e.constructor)==null?void 0:t.name)==="ArrayBuffer")}function Ea(e){let t=e.constructor;return e.$name||t._classRegistryKey}function Hy(e){if(typeof e!="object"||!e)return!1;let t=Ea(e);return t&&t!=="Object"}function uu(e){return!Hy(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||lu(e)||Rn(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function qr(e,t){if(uu(e))return(lu(e)||Rn(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let a=[];for(let s of e)a.push(qr(s,t));return a}if(typeof e!="object")throw Error(`can't serialize object of type ${typeof e}`);let r=Ea(e);if(!r)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!nt[r])throw Error(`${r} is not registered.`);let{klass:i}=nt[r],n=i.serialize?i.serialize(e,t):{};if(i.serialize){if(n===(t==null?void 0:t[t.length-1]))throw Error("statically serialized object won't survive transfer of $name property")}else{for(let a in e){if(!e.hasOwnProperty(a)||nt[r].omit.includes(a))continue;let s=e[a];s!==void 0&&(n[a]=nt[r].shallow.includes(a)?s:qr(s,t))}e instanceof Error&&(n.message=e.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(n.$name=r),n}function Gr(e){if(uu(e))return e;if(Array.isArray(e))return e.map(Gr);if(typeof e!="object")throw Error(`can't deserialize object of type ${typeof e}`);let t=Ea(e)||"Object";if(!nt[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:r}=nt[t];if(!r)throw Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(e);let i=Object.create(r.prototype);for(let n of Object.keys(e)){if(n==="$name")continue;let a=e[n];i[n]=nt[t].shallow.includes(n)?a:Gr(a)}return i}var hu=class{constructor(){this.first=!0}update(e,t){let r=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=r,!0))}};function Ky(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function Ki(e){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function Jy(e){return/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))}function Qy(e){return/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(e))}function em(e){return/[\r\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0600-\u0605\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DD\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0890\u0891\u0897-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E33-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB3-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1037\u1039-\u103E\u1056-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1084-\u1086\u108D\u109D\u1100-\u11FF\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60\u1A62\u1A65-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA960-\uA97C\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCBD\uDCC2\uDCCD\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC2\uDDC3\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF1F\uDF22-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE84-\uDE99\uDF60-\uDF67]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6\uDF00-\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD2F]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDD63\uDD67-\uDD6A\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF\uDDEE\uDDEF\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDDE6-\uDDFF\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF]/.test(e)}function cu(e){return/[\u0E01-\u0E3A\u0E40-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FD4\u0FD9\u0FDA\u1000-\u109F\u1780-\u17DD\u17E0-\u17E9\u17F0-\u17F9\u19E0-\u19FF\u1B00-\u1B4C\u1B4E-\u1B7F\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE-\uA9FE\uAA60-\uAA7F]|\uD805[\uDED0-\uDEE3]/gim.test(String.fromCodePoint(e))}function tm(e,t){return/(?:[\u1039\u17D2\u1A60\u1BAB\u200D\uAAF6]|\uD802\uDE3F|\uD804[\uDD33\uDFD0]|\uD806[\uDD3E\uDE47\uDE99]|\uD807[\uDD45\uDD97\uDF42])$/.test(e)||new RegExp("^\\p{gc=Mc}","u").test(t)}function Ta(e){return/\s/u.test(String.fromCodePoint(e))}function Ia(e){for(let t of e)if(Ki(t.codePointAt(0)))return!0;return!1}function rm(e){for(let t of e)if(!nm(t.codePointAt(0)))return!1;return!0}function pu(e){let t=e.map(r=>{try{return RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}const im=pu(["Arab","Dupl","Mong","Ougr","Syrc"]);function nm(e){return!im.test(String.fromCodePoint(e))}function fu(e){return!(Ki(e)||Jy(e))}function du(e){return new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(e))}const am=pu("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".split("."));function ka(e){return am.test(String.fromCodePoint(e))}function sm(e,t){return!t&&ka(e)?!1:!Qy(e)}function om(e){for(let t of e)if(ka(t.codePointAt(0)))return!0;return!1}function lm(e,t){for(let r of e)if(!sm(r.codePointAt(0),t))return!1;return!0}const at=new 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(at.isParsed())throw 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 r=e.pluginURL,i=new Promise(a=>{this.loadScriptResolve=a}),n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(await t(r),await Promise.race([i,n]),this.isParsed()){let a={pluginStatus:"loaded",pluginURL:r};return this.setState(a),a}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)}};var W=class{constructor(t,r){this.isSupportedScript=um,this.zoom=t,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new hu,this.transition=r.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new hu,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*r}}};function um(e){return lm(e,at.getRTLTextPluginStatus()==="loaded")}const hm="-transition";var Ji=class{constructor(e,t,r,i){this.property=e,this.value=t,this.expression=by(t===void 0?e.specification.default:t,r,e.specification,i)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,r){return this.property.possiblyEvaluate(this,e,t,r)}},Fa=class{constructor(e,t,r){this.property=e,this.value=new Ji(e,void 0,t,r)}transitioned(e,t){return new yu(this.property,this.value,t,ke({},e.transition,this.transition),e.now)}untransitioned(){return new yu(this.property,this.value,null,{},0)}},cm=class{constructor(e,t,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=t}_propertyRootKey(e){return`${this._rootKey}.${String(e)}`}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return ct(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Fa(this._values[e].property,this._propertyRootKey(e),this._globalState)),this._values[e].value=new Ji(this._values[e].property,t===null?void 0:ct(t),this._propertyRootKey(e),this._globalState)}getTransition(e){return ct(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Fa(this._values[e].property,this._propertyRootKey(e),this._globalState)),this._values[e].transition=ct(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);r!==void 0&&(e[t]=r);let i=this.getTransition(t);i!==void 0&&(e[`${t}${hm}`]=i)}return e}transitioned(e,t){let r=new mu(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(e,t._values[i]);return r}untransitioned(){let e=new mu(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},yu=class{constructor(e,t,r,i,n){this.property=e,this.value=t,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(e,t,r){let i=e.now||0,n=this.value.possiblyEvaluate(e,t,r),a=this.prior;if(!a)return n;if(i>this.end||this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return a.possiblyEvaluate(e,t,r);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,r),n,Cf(s))}}},mu=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,r){let i=new Qi(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(e,t,r);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},pm=class{constructor(e,t,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=r,this._rootKey=t}_propertyRootKey(e){return`${this._rootKey}.${String(e)}`}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return ct(this._values[e].value)}setValue(e,t){this._values[e]=new Ji(this._values[e].property,t===null?void 0:ct(t),this._propertyRootKey(e),this._globalState)}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);r!==void 0&&(e[t]=r)}return e}possiblyEvaluate(e,t,r){let i=new Qi(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(e,t,r);return i}},Ve=class{constructor(e,t,r){this.property=e,this.value=t,this.parameters=r}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,t,r,i){return this.property.evaluate(this.value,this.parameters,e,t,r,i)}},Qi=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}};function gu(e){if(Array.isArray(e))return e.length;let t=e==null?void 0:e.values;return Array.isArray(t)?t.length:void 0}function xu(e,t){let r=gu(e),i=gu(t);return r!==void 0&&i!==void 0&&r!==i}var M=class{constructor(t,r){this.specification=t,this.name=r}possiblyEvaluate(t,r){if(t.isDataDriven())throw Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,i){if(xu(t,r))return ge(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),r;let n=this.specification.type,a=St[n];return a?a(t,r,i):t}},V=class{constructor(t,r,i){this.specification=t,this.name=r,this.overrides=i}possiblyEvaluate(t,r,i,n){return t.expression.kind==="constant"||t.expression.kind==="camera"?new Ve(this,{kind:"constant",value:t.expression.evaluate(r,null,{},i,n)},r):new Ve(this,t.expression,r)}interpolate(t,r,i){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new Ve(this,{kind:"constant",value:void 0},t.parameters);if(xu(t.value.value,r.value.value))return ge(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),r;let n=this.specification.type,a=St[n];if(a){let s=a(t.value.value,r.value.value,i);return new Ve(this,{kind:"constant",value:s},t.parameters)}return t}evaluate(t,r,i,n,a,s){return t.kind==="constant"?t.value:t.evaluate(r,i,n,a,s)}},jr=class extends V{possiblyEvaluate(e,t,r,i){if(e.value===void 0)return new Ve(this,{kind:"constant",value:void 0},t);if(e.expression.kind==="constant"){let n=e.expression.evaluate(t,null,{},r,i),a=e.property.specification.type==="resolvedImage"&&typeof n!="string"?n.name:n,s=this._calculate(a,a,a,t);return new Ve(this,{kind:"constant",value:s},t)}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 Ve(this,{kind:"constant",value:n},t)}return new Ve(this,e.expression,t)}evaluate(e,t,r,i,n,a){if(e.kind==="source"){let s=e.evaluate(t,r,i,n,a);return this._calculate(s,s,s,t)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},r,i),e.evaluate({zoom:Math.floor(t.zoom)},r,i),e.evaluate({zoom:Math.floor(t.zoom)+1},r,i),t):e.value}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}},vu=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t,r,i){if(e.value!==void 0){if(e.expression.kind==="constant"){let n=e.expression.evaluate(t,null,{},r,i);return this._calculate(n,n,n,t)}return this._calculate(e.expression.evaluate(new W(Math.floor(t.zoom-1),t)),e.expression.evaluate(new W(Math.floor(t.zoom),t)),e.expression.evaluate(new W(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}},en=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t,r,i){return!!e.expression.evaluate(t,null,{},r,i)}interpolate(){return!1}},Ee=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let r=e[t];r.specification.overridable&&this.overridableProperties.push(t);let i=this.defaultPropertyValues[t]=new Ji(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[t]=new Fa(r,r.name,void 0);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=i.possiblyEvaluate({})}}};C("DataDrivenProperty",V),C("DataConstantProperty",M),C("CrossFadedDataDrivenProperty",jr),C("CrossFadedProperty",vu),C("ColorRampProperty",en);const bu=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Ca=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";var Ge=class extends Zf{constructor(e,t,r){if(super(),this.id=e.id,this.type=e.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=Xy(this.visibility,`layers[${this.id}].layout.visibility`,r),e.type!=="custom"&&(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=Nr(e.filter,`layers[${this.id}].filter`,r)),t.layout&&(this._unevaluatedLayout=new pm(t.layout,`layers[${this.id}].layout`,r)),t.paint)){this._transitionablePaint=new cm(t.paint,`layers[${this.id}].paint`,r);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 Qi(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=Nr(e,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){var t;if(e==="visibility")return this.visibility;if((t=this._transitionablePaint)!=null&&t.hasProperty(e))throw Error(e+bu);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;for(let t of this._visibilityExpression.getGlobalStateRefs())e.add(t);if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[t];for(let i of r.getGlobalStateRefs())e.add(i)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){let e=new globalThis.Map;if(this._transitionablePaint)for(let t in this._transitionablePaint._values){let r=this._transitionablePaint._values[t].value;for(let i of r.getGlobalStateRefs()){let n=e.get(i)??[];n.push({name:t,value:r.value}),e.set(i,n)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,r={}){var i;if(e==="visibility"){this.visibility=t,this._visibilityExpression.setValue(t),this.recalculateVisibility();return}if((i=this._transitionablePaint)!=null&&i.hasProperty(e)){this.fire(new Di(Error(e+bu)));return}t!=null&&this._validate(ou.layoutProperty,`layers.${this.id}.layout.${e}`,e,t,r)||this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){var t,r;if(e.endsWith("-transition")){let i=e.slice(0,-11);if(i==="visibility"||(t=this._unevaluatedLayout)!=null&&t.hasProperty(i))throw Error(e+Ca);return this._transitionablePaint.getTransition(i)}if(e==="visibility"||(r=this._unevaluatedLayout)!=null&&r.hasProperty(e))throw Error(e+Ca);return this._transitionablePaint.getValue(e)}setPaintProperty(e,t,r={}){var i;if(e==="visibility"||(i=this._unevaluatedLayout)!=null&&i.hasProperty(e))return this.fire(new Di(Error(e+Ca))),!1;if(t!=null&&this._validate(ou.paintProperty,`layers.${this.id}.paint.${e}`,e,t,r))return!1;if(e.endsWith("-transition"))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let n=this._transitionablePaint._values[e],a=n.property.specification["property-type"]==="cross-faded-data-driven",s=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let l=this._transitionablePaint._values[e].value;return l.isDataDriven()||s||a||this._handleOverridablePaintPropertyUpdate(e,o,l)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,r){return!1}isHidden(e=this.minzoom,t=!1){return this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&e>=this.maxzoom?!0:this._evaluatedVisibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}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(){var t,r;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:(t=this._unevaluatedLayout)==null?void 0:t.serialize(),paint:(r=this._transitionablePaint)==null?void 0:r.serialize()};return this.visibility&&(e.layout||(e.layout={}),e.layout.visibility=this.visibility),Mf(e,(i,n)=>i!==void 0&&!(n==="layout"&&!Object.keys(i).length)&&!(n==="paint"&&!Object.keys(i).length))}_validate(e,t,r,i,n={}){return Wy(this,e,{key:t,layerType:this.type,objectKey:r,value:i},n)}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 Ve)||!Qt(t.property.specification))&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}return!1}};let fm;const dm=()=>fm||(fm=new Ee({"raster-opacity":new M(w.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new M(w.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new M(w.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new M(w.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new M(w.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new M(w.paint_raster["raster-contrast"],"raster-contrast"),resampling:new M(w.paint_raster.resampling,"resampling"),"raster-resampling":new M(w.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new M(w.paint_raster["raster-fade-duration"],"raster-fade-duration")}));var ym={get paint(){return dm()}},mm=class extends Ge{constructor(e,t){super(e,ym,t)}};const gm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};var Yr=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}},re=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function he(e,t=1){let r=0,i=0;return{members:e.map(n=>{let a=xm(n.type),s=r=wu(r,Math.max(t,a)),o=n.components||1;return i=Math.max(i,a),r+=a*o,{name:n.name,type:n.type,components:o,offset:s}}),size:wu(r,Math.max(i,t)),alignment:t}}function xm(e){return gm[e].BYTES_PER_ELEMENT}function wu(e,t){return Math.ceil(e/t)*t}var Xr=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=e*2;return this.int16[i+0]=t,this.int16[i+1]=r,e}};Xr.prototype.bytesPerElement=4,C("StructArrayLayout2i4",Xr);var Ba=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let n=e*3;return this.int16[n+0]=t,this.int16[n+1]=r,this.int16[n+2]=i,e}};Ba.prototype.bytesPerElement=6,C("StructArrayLayout3i6",Ba);var _u=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){let a=e*4;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=n,e}};_u.prototype.bytesPerElement=8,C("StructArrayLayout4i8",_u);var Pa=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,n,a)}emplace(e,t,r,i,n,a,s){let o=e*6;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,e}};Pa.prototype.bytesPerElement=12,C("StructArrayLayout2i4i12",Pa);var Ma=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,n,a)}emplace(e,t,r,i,n,a,s){let o=e*4,l=e*8;return this.int16[o+0]=t,this.int16[o+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=s,e}};Ma.prototype.bytesPerElement=8,C("StructArrayLayout2i4ub8",Ma);var Zr=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=e*2;return this.float32[i+0]=t,this.float32[i+1]=r,e}};Zr.prototype.bytesPerElement=8,C("StructArrayLayout2f8",Zr);var za=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,e,t,r,i,n,a,s,o,l,u)}emplace(e,t,r,i,n,a,s,o,l,u,h){let c=e*10;return this.uint16[c+0]=t,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=n,this.uint16[c+4]=a,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,e}};za.prototype.bytesPerElement=20,C("StructArrayLayout10ui20",za);var La=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,r,i,n,a,s,o)}emplace(e,t,r,i,n,a,s,o,l){let u=e*8;return this.uint16[u+0]=t,this.uint16[u+1]=r,this.uint16[u+2]=i,this.uint16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=s,this.uint16[u+6]=o,this.uint16[u+7]=l,e}};La.prototype.bytesPerElement=16,C("StructArrayLayout8ui16",La);var Va=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a,s,o,l,u,h,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,e,t,r,i,n,a,s,o,l,u,h,c,p)}emplace(e,t,r,i,n,a,s,o,l,u,h,c,p,f){let d=e*14,y=e*7;return this.int16[d+0]=t,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=o,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,this.float32[y+6]=f,e}};Va.prototype.bytesPerElement=28,C("StructArrayLayout4i4ui4i1f28",Va);var Oa=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let n=e*3;return this.float32[n+0]=t,this.float32[n+1]=r,this.float32[n+2]=i,e}};Oa.prototype.bytesPerElement=12,C("StructArrayLayout3f12",Oa);var $a=class extends re{_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 r=e*1;return this.uint32[r+0]=t,e}};$a.prototype.bytesPerElement=4,C("StructArrayLayout1ul4",$a);var Ra=class extends re{_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,r,i,n,a,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,r,i,n,a,s,o,l)}emplace(e,t,r,i,n,a,s,o,l,u){let h=e*10,c=e*5;return this.int16[h+0]=t,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=s,this.uint32[c+3]=o,this.uint16[h+8]=l,this.uint16[h+9]=u,e}};Ra.prototype.bytesPerElement=20,C("StructArrayLayout6i1ul2ui20",Ra);var Na=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,n,a)}emplace(e,t,r,i,n,a,s){let o=e*6;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,e}};Na.prototype.bytesPerElement=12,C("StructArrayLayout2i2i2i12",Na);var Su=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n)}emplace(e,t,r,i,n,a){let s=e*4,o=e*8;return this.float32[s+0]=t,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[o+6]=n,this.int16[o+7]=a,e}};Su.prototype.bytesPerElement=16,C("StructArrayLayout2f1f2i16",Su);var Ua=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,n,a)}emplace(e,t,r,i,n,a,s){let o=e*16,l=e*4,u=e*8;return this.uint8[o+0]=t,this.uint8[o+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=s,e}};Ua.prototype.bytesPerElement=16,C("StructArrayLayout2ub2f2i16",Ua);var qa=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let n=e*3;return this.uint16[n+0]=t,this.uint16[n+1]=r,this.uint16[n+2]=i,e}};qa.prototype.bytesPerElement=6,C("StructArrayLayout3ui6",qa);var Ga=class extends re{_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,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g){let x=this.length;return this.resize(x+1),this.emplace(x,e,t,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g)}emplace(e,t,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x){let v=e*26,b=e*13,_=e*52;return this.int16[v+0]=t,this.int16[v+1]=r,this.uint16[v+2]=i,this.uint16[v+3]=n,this.uint32[b+2]=a,this.uint32[b+3]=s,this.uint32[b+4]=o,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=h,this.float32[b+7]=c,this.float32[b+8]=p,this.uint8[_+36]=f,this.uint8[_+37]=d,this.uint8[_+38]=y,this.uint32[b+10]=m,this.int16[v+22]=g,this.float32[b+12]=x,e}};Ga.prototype.bytesPerElement=52,C("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",Ga);var ja=class extends re{_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,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,_,A,S,E,T,z,O,P){let L=this.length;return this.resize(L+1),this.emplace(L,e,t,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,_,A,S,E,T,z,O,P)}emplace(e,t,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,_,A,S,E,T,z,O,P,L){let I=e*34,$=e*17;return this.int16[I+0]=t,this.int16[I+1]=r,this.int16[I+2]=i,this.int16[I+3]=n,this.int16[I+4]=a,this.int16[I+5]=s,this.int16[I+6]=o,this.int16[I+7]=l,this.uint16[I+8]=u,this.uint16[I+9]=h,this.uint16[I+10]=c,this.uint16[I+11]=p,this.uint16[I+12]=f,this.uint16[I+13]=d,this.uint16[I+14]=y,this.uint16[I+15]=m,this.uint16[I+16]=g,this.uint16[I+17]=x,this.uint16[I+18]=v,this.uint16[I+19]=b,this.uint16[I+20]=_,this.uint16[I+21]=A,this.uint16[I+22]=S,this.uint32[$+12]=E,this.float32[$+13]=T,this.float32[$+14]=z,this.uint16[I+30]=O,this.uint16[I+31]=P,this.float32[$+16]=L,e}};ja.prototype.bytesPerElement=68,C("StructArrayLayout8i15ui1ul2f2ui1f68",ja);var tn=class extends re{_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 r=e*1;return this.float32[r+0]=t,e}};tn.prototype.bytesPerElement=4,C("StructArrayLayout1f4",tn);var Ya=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let n=e*6,a=e*3;return this.uint16[n+0]=t,this.float32[a+1]=r,this.float32[a+2]=i,e}};Ya.prototype.bytesPerElement=12,C("StructArrayLayout1ui2f12",Ya);var Xa=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let n=e*2,a=e*4;return this.uint32[n+0]=t,this.uint16[a+2]=r,this.uint16[a+3]=i,e}};Xa.prototype.bytesPerElement=8,C("StructArrayLayout1ul2ui8",Xa);var Za=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=e*2;return this.uint16[i+0]=t,this.uint16[i+1]=r,e}};Za.prototype.bytesPerElement=4,C("StructArrayLayout2ui4",Za);var Au=class extends re{_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 r=e*1;return this.uint16[r+0]=t,e}};Au.prototype.bytesPerElement=2,C("StructArrayLayout1ui2",Au);var Wa=class extends re{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){let a=e*4;return this.float32[a+0]=t,this.float32[a+1]=r,this.float32[a+2]=i,this.float32[a+3]=n,e}};Wa.prototype.bytesPerElement=16,C("StructArrayLayout4f16",Wa);var Du=class extends Yr{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 B(this.anchorPointX,this.anchorPointY)}};Du.prototype.size=20;var Eu=class extends Ra{get(e){return new Du(this,e)}};C("CollisionBoxArray",Eu);var Tu=class extends Yr{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]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Tu.prototype.size=52;var Iu=class extends Ga{get(e){return new Tu(this,e)}};C("PlacedSymbolArray",Iu);var ku=class extends Yr{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]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};ku.prototype.size=68;var Fu=class extends ja{get(e){return new ku(this,e)}};C("SymbolInstanceArray",Fu);var Cu=class extends tn{getoffsetX(e){return this.float32[e*1+0]}};C("GlyphOffsetArray",Cu);var Bu=class extends Ba{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};C("SymbolLineVertexArray",Bu);var Pu=class extends Yr{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]}};Pu.prototype.size=12;var Mu=class extends Ya{get(e){return new Pu(this,e)}};C("TextAnchorOffsetArray",Mu);var zu=class extends Yr{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]}};zu.prototype.size=8;var Lu=class extends Xa{get(e){return new zu(this,e)}};C("FeatureIndexArray",Lu);var vm=class extends Xr{},bm=class extends Xr{},wm=class extends Xr{},_m=class extends Pa{},Sm=class extends Ma{},Am=class extends Zr{},ir=class extends za{},Vu=class extends La{},Dm=class extends Va{},Em=class extends Oa{},Tm=class extends $a{},Ou=class extends Na{},Im=class extends Ua{},Wr=class extends qa{},Ha=class extends Za{};const km=he([{name:"a_pos",components:2,type:"Int16"}],4),Fm=km.members;var Be=class _r{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,r,i,n){let a=this.segments[this.segments.length-1];return t>_r.MAX_VERTEX_ARRAY_LENGTH&&ge(`Max vertices per segment is ${_r.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${_r.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+t>_r.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(r,i,n):a}createNewSegment(t,r,i){let n={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(n.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(t,r,i){return this.prepareSegment(0,t,r,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,i,n){return new _r([{vertexOffset:t,primitiveOffset:r,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};Be.MAX_VERTEX_ARRAY_LENGTH=2**16-1,C("SegmentVector",Be);function $u(e,t){return e=Sr(Math.floor(e),0,255),t=Sr(Math.floor(t),0,255),256*e+t}const Cm=he([{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"}]),Bm=he([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var Pm=Ln(((e,t)=>{function r(i,n){for(var a=i.length&3,s=i.length-a,o=n,l,u=3432918353,h=461845907,c,p=0;p<s;)c=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c,o=o<<13|o>>>19,l=(o&65535)*5+(((o>>>16)*5&65535)<<16)&4294967295,o=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,a){case 3:c^=(i.charCodeAt(p+2)&255)<<16;case 2:c^=(i.charCodeAt(p+1)&255)<<8;case 1:c^=i.charCodeAt(p)&255,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c}return o^=i.length,o^=o>>>16,o=(o&65535)*2246822507+(((o>>>16)*2246822507&65535)<<16)&4294967295,o^=o>>>13,o=(o&65535)*3266489909+(((o>>>16)*3266489909&65535)<<16)&4294967295,o^=o>>>16,o>>>0}t!==void 0&&(t.exports=r)})),Mm=Ln(((e,t)=>{function r(i,n){for(var a=i.length,s=n^a,o=0,l;a>=4;)l=i.charCodeAt(o)&255|(i.charCodeAt(++o)&255)<<8|(i.charCodeAt(++o)&255)<<16|(i.charCodeAt(++o)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^l,a-=4,++o;switch(a){case 3:s^=(i.charCodeAt(o+2)&255)<<16;case 2:s^=(i.charCodeAt(o+1)&255)<<8;case 1:s^=i.charCodeAt(o)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}t.exports=r})),Ka=mf(Ln(((e,t)=>{var r=Pm(),i=Mm();t.exports=r,t.exports.murmur3=r,t.exports.murmur2=i}))()),Ru=class nf{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,i,n){this.ids.push(Nu(t)),this.positions.push(r,i,n)}getPositions(t){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let r=Nu(t),i=0,n=this.ids.length-1;for(;i<n;){let s=i+n>>1;this.ids[s]>=r?n=s:i=s+1}let a=[];for(;this.ids[i]===r;){let s=this.positions[3*i],o=this.positions[3*i+1],l=this.positions[3*i+2];a.push({index:s,start:o,end:l}),i++}return a}static serialize(t,r){let i=new Float64Array(t.ids),n=new Uint32Array(t.positions);return Ja(i,n,0,i.length-1),r&&r.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(t){let r=new nf;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}};function Nu(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:(0,Ka.default)(String(e))}function Ja(e,t,r,i){for(;r<i;){let n=e[r+i>>1],a=r-1,s=i+1;for(;;){do a++;while(e[a]<n);do s--;while(e[s]>n);if(a>=s)break;rn(e,a,s),rn(t,3*a,3*s),rn(t,3*a+1,3*s+1),rn(t,3*a+2,3*s+2)}s-r<i-s?(Ja(e,t,r,s),r=s+1):(Ja(e,t,s+1,i),i=s)}}function rn(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}C("FeaturePositionMap",Ru);var Qa=class{constructor(e,t){this.gl=e.gl,this.location=t}},es=class extends Qa{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},zm=class extends Qa{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]))}},Lm=class extends Qa{constructor(e,t){super(e,t),this.current=te.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))}};function ts(e){return[$u(255*e.r,255*e.g),$u(255*e.b,255*e.a)]}var Hr=class{constructor(e,t,r){this.value=e,this.uniformNames=t.map(i=>`u_${i}`),this.type=r}setUniform(e,t,r){e.set(r.constantOr(this.value))}getBinding(e,t,r){return this.type==="color"?new Lm(e,t):new es(e,t)}},kt=class{constructor(e,t){this.uniformNames=t.map(r=>`u_${r}`),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}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,r,i){let n=null;i==="u_pattern_to"?n=this.patternTo:i==="u_pattern_from"?n=this.patternFrom:i==="u_dasharray_to"?n=this.dashTo:i==="u_dasharray_from"?n=this.dashFrom:i==="u_pixel_ratio_to"?n=this.pixelRatioTo:i==="u_pixel_ratio_from"&&(n=this.pixelRatioFrom),n!==null&&e.set(n)}getBinding(e,t,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new zm(e,t):new es(e,t)}},st=class{constructor(e,t,r,i){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=t.map(n=>({name:`a_${n}`,type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,t,r){let i=this.paintVertexArray.length,n=this.expression.evaluate(new W(0,r),t,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(i,e,n)}updatePaintArray(e,t,r,i,n){let a=this.expression.evaluate(new W(0,n),r,i);this._setPaintValue(e,t,a)}_setPaintValue(e,t,r){if(this.type==="color"){let i=ts(r);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i[0],i[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){var t,r;(t=this.paintVertexArray)!=null&&t.arrayBuffer.byteLength&&((r=this.paintVertexBuffer)!=null&&r.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},je=class{constructor(e,t,r,i,n,a){this.expression=e,this.uniformNames=t.map(s=>`u_${s}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map(s=>({name:`a_${s}`,type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,r){let i=this.expression.evaluate(new W(this.zoom,r),t,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new W(this.zoom+1,r),t,{},r.canonical,[],r.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(a,e,i,n)}updatePaintArray(e,t,r,i,n){let a=this.expression.evaluate(new W(this.zoom,n),r,i),s=this.expression.evaluate(new W(this.zoom+1,n),r,i);this._setPaintValue(e,t,a,s)}_setPaintValue(e,t,r,i){if(this.type==="color"){let n=ts(r),a=ts(i);for(let s=e;s<t;s++)this.paintVertexArray.emplace(s,n[0],n[1],a[0],a[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(e){var t,r;(t=this.paintVertexArray)!=null&&t.arrayBuffer.byteLength&&((r=this.paintVertexBuffer)!=null&&r.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 r=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,i=Sr(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,t,r){return new es(e,t)}},mt=class{constructor(e,t,r,i,n,a){this.expression=e,this.type=t,this.useIntegerZoom=r,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(e,t,r){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,this.getPositionIds(t),r)}updatePaintArray(e,t,r,i,n){this._setPaintValues(e,t,this.getPositionIds(r),n)}_setPaintValues(e,t,r,i){let n=this.getPositions(i);if(!n||!r)return;let a=n[r.min],s=n[r.mid],o=n[r.max];if(!(!a||!s||!o))for(let l=e;l<t;l++)this.emplace(this.zoomInPaintVertexArray,l,a,s),this.emplace(this.zoomOutPaintVertexArray,l,o,s)}upload(e){var t,r;if((t=this.zoomInPaintVertexArray)!=null&&t.arrayBuffer.byteLength&&((r=this.zoomOutPaintVertexArray)!=null&&r.arrayBuffer.byteLength)){let i=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,i,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,i,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Uu=class extends mt{getPositions(e){return e.imagePositions}getPositionIds(e){var t;return(t=e.patterns)==null?void 0:t[this.layerId]}getVertexAttributes(){return Cm.members}emplace(e,t,r,i){e.emplace(t,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.pixelRatio,i.pixelRatio)}},qu=class extends mt{getPositions(e){return e.dashPositions}getPositionIds(e){var t;return(t=e.dashes)==null?void 0:t[this.layerId]}getVertexAttributes(){return Bm.members}emplace(e,t,r,i){e.emplace(t,0,r.y,r.height,r.width,0,i.y,i.height,i.width)}},Gu=class{constructor(e,t,r){this.binders={},this._buffers=[];let i=[];for(let n in e.paint._values){if(!r(n))continue;let a=e.paint.get(n);if(!(a instanceof Ve)||!Qt(a.property.specification))continue;let s=Vm(n,e.type),o=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(o.kind==="constant")this.binders[n]=c?new kt(o.value,s):new Hr(o.value,s,l),i.push(`/u_${n}`);else if(o.kind==="source"||c){let p=ju(n,l,"source");this.binders[n]=c?n==="line-dasharray"?new qu(o,l,u,t,p,e.id):new Uu(o,l,u,t,p,e.id):new st(o,s,l,p),i.push(`/a_${n}`)}else{let p=ju(n,l,"composite");this.binders[n]=new je(o,s,l,u,t,p),i.push(`/z_${n}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof st||t instanceof je?t.maxValue:0}populatePaintArrays(e,t,r){for(let i in this.binders){let n=this.binders[i];(n instanceof st||n instanceof je||n instanceof mt)&&n.populatePaintArray(e,t,r)}}setConstantPatternPositions(e,t){for(let r in this.binders){let i=this.binders[r];i instanceof kt&&i.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(let r in this.binders){let i=this.binders[r];i instanceof kt&&i.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,r,i,n){let a=!1;for(let s of e){let o=t.getPositions(s.id);for(let l of o){let u=r.feature(l.index);for(let h in this.binders){let c=this.binders[h];(c instanceof st||c instanceof je||c instanceof mt)&&c.expression.isStateDependent===!0&&(c.expression=i.paint.get(h).value,c.updatePaintArray(l.start,l.end,u,s.state,n),a=!0)}}}return a}defines(){let e=[];for(let t in this.binders){let r=this.binders[t];(r instanceof Hr||r instanceof kt)&&e.push(...r.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof st||r instanceof je)for(let i of r.paintVertexAttributes)e.push(i.name);else if(r instanceof mt){let i=r.getVertexAttributes();for(let n of i)e.push(n.name)}}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof Hr||r instanceof kt||r instanceof je)for(let i of r.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let r=[];for(let i in this.binders){let n=this.binders[i];if(n instanceof Hr||n instanceof kt||n instanceof je){for(let a of n.uniformNames)if(t[a]){let s=n.getBinding(e,t[a],a);r.push({name:a,property:i,binding:s})}}}return r}setUniforms(e,t,r,i){for(let{name:n,property:a,binding:s}of t)this.binders[a].setUniform(s,i,r.get(a),n)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let r=this.binders[t];if(e&&r instanceof mt){let i=e.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof st||r instanceof je)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(e){for(let t in this.binders){let r=this.binders[t];(r instanceof st||r instanceof je||r instanceof mt)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof st||t instanceof je||t instanceof mt)&&t.destroy()}}},Ft=class{constructor(e,t,r=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new Gu(i,t,r);this.needsUpload=!1,this._featureMap=new Ru,this._bufferOffset=0}populatePaintArrays(e,t,r,i){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,i);t.id!==void 0&&this._featureMap.add(t.id,r,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,r,i){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(e,this._featureMap,t,n,i)||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 Vm(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-dasharray":["dasharray_to","dasharray_from"],"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(`${t}-`,"").replace(/-/g,"_")]}function Om(e){return{"line-pattern":{source:ir,composite:ir},"fill-pattern":{source:ir,composite:ir},"fill-extrusion-pattern":{source:ir,composite:ir},"line-dasharray":{source:Vu,composite:Vu}}[e]}function ju(e,t,r){var n;let i={color:{source:Zr,composite:Wa},number:{source:tn,composite:Zr}};return((n=Om(e))==null?void 0:n[r])||i[t][r]}C("ConstantBinder",Hr),C("CrossFadedConstantBinder",kt),C("SourceExpressionBinder",st),C("CrossFadedPatternBinder",Uu),C("CrossFadedDasharrayBinder",qu),C("CompositeExpressionBinder",je),C("ProgramConfiguration",Gu,{omit:["_buffers"]}),C("ProgramConfigurationSet",Ft);const rs=2**14-1,Yu=-rs-1;function Ct(e){let t=ne/e.extent,r=e.loadGeometry();for(let i of r)for(let n of i){let a=Math.round(n.x*t),s=Math.round(n.y*t);n.x=Sr(a,Yu,rs),n.y=Sr(s,Yu,rs),(a<n.x||a>n.x+1||s<n.y||s>n.y+1)&&ge("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function nr(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Ct(e):[]}}const Xu=-32768;function $m(e,t,r,i,n){e.emplaceBack(Xu+t*8+i,Xu+r*8+n)}var is=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new bm,this.indexArray=new Wr,this.segments=new Be,this.programConfigurations=new Ft(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,r){let i=this.layers[0],n=[],a=null,s=!1,o=i.type==="heatmap";if(i.type==="circle"){let c=i;a=c.layout.get("circle-sort-key"),s=!a.isConstant(),o||(o=c.paint.get("circle-pitch-alignment")==="map")}let l=o?t.subdivisionGranularity.circle:1,u=new W(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:c,id:p,index:f,sourceLayerIndex:d}of e){let y=nr(c,h);if(!this.layers[0]._featureFilter.filter(u,y,r))continue;let m=s?a.evaluate(y,{},r):void 0,g={id:p,properties:c.properties,type:c.type,sourceLayerIndex:d,index:f,geometry:h?y.geometry:Ct(c),patterns:{},sortKey:m};n.push(g)}s&&n.sort((c,p)=>c.sortKey-p.sortKey);for(let c of n){let{geometry:p,index:f,sourceLayerIndex:d}=c,y=e[f].feature;this.addFeature(c,p,f,r,l),t.featureIndex.insert(y,p,f,d,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fm),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,r,i,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 Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let o of t)for(let l of o){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),p=c.vertexLength;for(let f=0;f<s;f++)for(let d=0;d<s;d++)$m(this.layoutVertexArray,u,h,a[d],a[f]);for(let f=0;f<s-1;f++)for(let d=0;d<s-1;d++){let y=p+f*s+d,m=p+(f+1)*s+d;this.indexArray.emplaceBack(y,m+1,y+1),this.indexArray.emplaceBack(y,m,m+1)}c.vertexLength+=s*s,c.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:{},canonical:i})}};C("CircleBucket",is,{omit:["layers"]});function Rm(e,t){for(let r of e)if(ar(t,r))return!0;for(let r of t)if(ar(e,r))return!0;return ns(e,t)}function nn(e,t,r){return ar(e,t)?!0:as(t,e,r)}function Zu(e,t){if(e.length===1)return Hu(t,e[0]);for(let r of t)for(let i of r)if(ar(e,i))return!0;for(let r of e)if(Hu(t,r))return!0;for(let r of t)if(ns(e,r))return!0;return!1}function Nm(e,t,r){for(let i of t){if(e.length>=3){for(let n of i)if(ar(e,n))return!0}if(Um(e,i,r))return!0}return!1}function Um(e,t,r){if(e.length>1){if(ns(e,t))return!0;for(let i of t)if(as(i,e,r))return!0}for(let i of e)if(as(i,t,r))return!0;return!1}function ns(e,t){if(e.length===0||t.length===0)return!1;for(let r=0;r<e.length-1;r++){let i=e[r],n=e[r+1];for(let a=0;a<t.length-1;a++){let s=t[a],o=t[a+1];if(qm(i,n,s,o))return!0}}return!1}function qm(e,t,r,i){return pt(e,r,i)!==pt(t,r,i)&&pt(e,t,r)!==pt(e,t,i)}function as(e,t,r){let i=r*r;if(t.length===1)return e.distSqr(t[0])<i;for(let n=1;n<t.length;n++){let a=t[n-1],s=t[n];if(Wu(e,a,s)<i)return!0}return!1}function Wu(e,t,r){let i=t.distSqr(r);if(i===0)return e.distSqr(t);let n=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/i;return n<0?e.distSqr(t):n>1?e.distSqr(r):e.distSqr(r.sub(t)._mult(n)._add(t))}function Hu(e,t){let r=!1,i,n,a;for(let s of e){i=s;for(let o=0,l=i.length-1;o<i.length;l=o++)n=i[o],a=i[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&&(r=!r)}return r}function ar(e,t){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let a=e[i],s=e[n];a.y>t.y!=s.y>t.y&&t.x<(s.x-a.x)*(t.y-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function Gm(e,t,r,i,n){for(let s of e)if(t<=s.x&&r<=s.y&&i>=s.x&&n>=s.y)return!0;let a=[new B(t,r),new B(t,n),new B(i,n),new B(i,r)];if(e.length>2){for(let s of a)if(ar(e,s))return!0}for(let s=0;s<e.length-1;s++){let o=e[s],l=e[s+1];if(jm(o,l,a))return!0}return!1}function jm(e,t,r){let i=r[0],n=r[2];if(e.x<i.x&&t.x<i.x||e.x>n.x&&t.x>n.x||e.y<i.y&&t.y<i.y||e.y>n.y&&t.y>n.y)return!1;let a=pt(e,t,r[0]);return a!==pt(e,t,r[1])||a!==pt(e,t,r[2])||a!==pt(e,t,r[3])}function sr(e,t,r){let i=t.paint.get(e).value;return i.kind==="constant"?i.value:r.programConfigurations.get(t.id).getMaxValue(e)}function an(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function sn(e,t,r,i,n){if(!t[0]&&!t[1])return e;let a=B.convert(t)._mult(n);r==="viewport"&&a._rotate(-i);let s=[];for(let o of e)s.push(o.sub(a));return s}function Ym(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],n=t.at(-1);(r===0||n&&!i.equals(n))&&t.push(i)}return t}function Xm(e,t){let r=[];for(let i of e){let n=Ym(i),a=[];for(let s=0;s<n.length;s++){let o=n[s],l=n[s-1],u=n[s+1],h=s===0?new B(0,0):o.sub(l)._unit()._perp(),c=s===n.length-1?new B(0,0):u.sub(o)._unit()._perp(),p=h._add(c)._unit(),f=p.x*c.x+p.y*c.y;f!==0&&p._mult(1/f),a.push(p._mult(t)._add(o))}r.push(a)}return r}function Zm({queryGeometry:e,size:t},r){return nn(e,r,t)}function Wm({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},a){return nn(e,a,t*(r.projectTileCoordinates(a.x,a.y,i,n==null?void 0:n(a.x,a.y)).signedDistanceFromCamera/r.cameraToCenterDistance))}function Hm({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},a){let s=r.projectTileCoordinates(a.x,a.y,i,n==null?void 0:n(a.x,a.y)).signedDistanceFromCamera,o=t*(r.cameraToCenterDistance/s);return nn(e,ss(a,r,i,n),o)}function Km({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},a){return nn(e,ss(a,r,i,n),t)}function Ku({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n,pitchAlignment:a="map",pitchScale:s="map"},o){let l=a==="map"?s==="map"?Zm:Wm:s==="map"?Hm:Km,u={queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n};for(let h of o)for(let c of h)if(l(u,c))return!0;return!1}function ss(e,t,r,i){let n=t.projectTileCoordinates(e.x,e.y,r,i==null?void 0:i(e.x,e.y)).point;return new B((n.x*.5+.5)*t.width,(-n.y*.5+.5)*t.height)}function Jm(e,t,r,i){return e.map(n=>ss(n,t,r,i))}let Qm;const eg=()=>Qm||(Qm=new Ee({"circle-sort-key":new V(w.layout_circle["circle-sort-key"],"circle-sort-key")}));let tg;const rg=()=>tg||(tg=new Ee({"circle-radius":new V(w.paint_circle["circle-radius"],"circle-radius"),"circle-color":new V(w.paint_circle["circle-color"],"circle-color"),"circle-blur":new V(w.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new V(w.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new M(w.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new M(w.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new M(w.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new M(w.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new V(w.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new V(w.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new V(w.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")}));var ig={get paint(){return rg()},get layout(){return eg()}},ng=class extends Ge{constructor(e,t){super(e,ig,t)}createBucket(e){return new is(e)}queryRadius(e){let t=e;return sr("circle-radius",this,t)+sr("circle-stroke-width",this,t)+an(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l=sn(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,a),u=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r),h=this.paint.get("circle-pitch-scale"),c=this.paint.get("circle-pitch-alignment"),p,f;return c==="map"?(p=l,f=u*a):(p=Jm(l,n,s,o),f=u),Ku({queryGeometry:p,size:f,transform:n,unwrappedTileID:s,getElevation:o,pitchAlignment:c,pitchScale:h},i)}},Ju=class extends is{};C("HeatmapBucket",Ju,{omit:["layers"]});let ag;const sg=()=>ag||(ag=new Ee({"heatmap-radius":new V(w.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new V(w.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new M(w.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new en(w.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new M(w.paint_heatmap["heatmap-opacity"],"heatmap-opacity")}));var og={get paint(){return sg()}};function os(e,{width:t,height:r},i,n){if(!n)n=new Uint8Array(t*r*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*r*i)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${t*r*i}`);return e.width=t,e.height=r,e.data=n,e}function Qu(e,{width:t,height:r},i){if(t===e.width&&r===e.height)return;let n=os({},{width:t,height:r},i);ls(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},i),e.width=t,e.height=r,e.data=n.data}function ls(e,t,r,i,n,a){if(n.width===0||n.height===0)return t;if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw RangeError("out of range destination coordinates for image copy");let s=e.data,o=t.data;if(s===o)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){let u=((r.y+l)*e.width+r.x)*a,h=((i.y+l)*t.width+i.x)*a;for(let c=0;c<n.width*a;c++)o[h+c]=s[u+c]}return t}var us=class af{constructor(t,r){os(this,t,1,r)}resize(t){Qu(this,t,1)}clone(){return new af({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,i,n,a){ls(t,r,i,n,a,1)}},Pe=class sf{constructor(t,r){os(this,t,4,r)}resize(t){Qu(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new sf({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,i,n,a){ls(t,r,i,n,a,4)}setPixel(t,r,i){let n=(t*this.width+r)*4;this.data[n+0]=Math.round(i.r*255/i.a),this.data[n+1]=Math.round(i.g*255/i.a),this.data[n+2]=Math.round(i.b*255/i.a),this.data[n+3]=Math.round(i.a*255)}};function hs(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=4){let i=e[r+3];t[r+0]=Math.round(e[r+0]*i/255),t[r+1]=Math.round(e[r+1]*i/255),t[r+2]=Math.round(e[r+2]*i/255),t[r+3]=i}return t}C("AlphaImage",us),C("RGBAImage",Pe);function lg(e){let t={},r=e.resolution||256,i=e.clips?e.clips.length:1,n=e.image||new Pe({width:r,height:i});if(!Pf(r))throw Error(`width is not a power of 2 - ${r}`);let a=(s,o,l)=>{t[e.evaluationKey]=l;let u=e.expression.evaluate(t);n.setPixel(s/4/r,o/4,u)};if(e.clips)for(let s=0,o=0;s<i;++s,o+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let h=l/(r-1),{start:c,end:p}=e.clips[s],f=c*(1-h)+p*h;a(o,u,f)}else for(let s=0,o=0;s<r;s++,o+=4){let l=s/(r-1);a(0,o,l)}return n}const ug="big-fb";var hg=class extends Ge{createBucket(e){return new Ju(e)}constructor(e,t){super(e,og,t),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=lg({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has("big-fb")&&this.heatmapFbos.delete(ug)}queryRadius(e){return sr("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){return Ku({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(t,r)*a,transform:n,unwrappedTileID:s,getElevation:o},i)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}};let cg;const pg=()=>cg||(cg=new Ee({"hillshade-illumination-direction":new M(w.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new M(w.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new M(w.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new M(w.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new M(w.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new M(w.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new M(w.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new M(w.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new M(w.paint_hillshade.resampling,"resampling")}));var fg={get paint(){return pg()}},dg=class extends Ge{constructor(e,t){super(e,fg,t),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,r=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,n=Math.max(e.length,t.length,r.length,i.length);e=e.concat(Array(n-e.length).fill(e.at(-1))),t=t.concat(Array(n-t.length).fill(t.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));let a=t.map($o);return{directionRadians:e.map($o),altitudeRadians:a,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}};let yg;const mg=()=>yg||(yg=new Ee({"color-relief-opacity":new M(w["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new en(w["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new M(w["paint_color-relief"].resampling,"resampling")}));var gg={get paint(){return mg()}};function cs(e){return"data"in e}var eh=class{constructor(e,t,r,i){this.context=e,this.format=r,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(t,i)}update(e,t,r){var u;let{width:i,height:n}=e,a=(((u=this.size)==null?void 0:u[0])!==i||this.size[1]!==n)&&!r,{context:s}=this,{gl:o}=s;this.useMipmap=!!(t!=null&&t.useMipmap),a&&this.size&&this.format===o.RGBA&&(o.deleteTexture(this.texture),this.texture=o.createTexture(),this._ownedHandle=this.texture,this.filter=void 0,this.wrap=void 0),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1);let l=this.format===o.RGBA&&(t==null?void 0:t.premultiply)!==!1;if(a)if(this.size=[i,n],this.format===o.RGBA&&i>0&&n>0){let h=this.useMipmap?Math.floor(Math.log2(Math.max(i,n)))+1:1;if(o.texStorage2D(o.TEXTURE_2D,h,o.RGBA8,i,n),cs(e)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:c}=e;l&&c&&(c=hs(c)),c&&o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,n,o.RGBA,o.UNSIGNED_BYTE,c)}else s.pixelStoreUnpackPremultiplyAlpha.set(l),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,e)}else cs(e)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,l,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(e,o));else{let{x:h,y:c}=r||{x:0,y:0};cs(e)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,l,h,c,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(e,h,c,o))}this.useMipmap&&o.generateMipmap(o.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,t){t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,t.UNSIGNED_BYTE,e)}_uploadRawData(e,t,r,i,n){let{data:a}=e;t&&a&&(a=hs(a)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,i,0,this.format,n.UNSIGNED_BYTE,a)}_updateDomImage(e,t,r,i){i.texSubImage2D(i.TEXTURE_2D,0,t,r,i.RGBA,i.UNSIGNED_BYTE,e)}_updateRawData(e,t,r,i,n,a,s){let{data:o}=e;t&&o&&(o=hs(o)),s.texSubImage2D(s.TEXTURE_2D,0,r,i,n,a,s.RGBA,s.UNSIGNED_BYTE,o)}bind(e,t,r){let{context:i}=this,{gl:n}=i;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),r===n.LINEAR_MIPMAP_NEAREST&&!this.useMipmap&&(r=n.LINEAR),e!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||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)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},th=(ht=class{constructor(t,r,i,n=1,a=1,s=1,o=0){if(this.uid=t,r.height!==r.width)throw RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){ge(`"${i}" 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),ht.byteViewCache.set(this,new Uint8Array(this.data.buffer)),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=a,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let h=0;h<l;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(l,h)]=this.data[this._idx(l-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,l)]=this.data[this._idx(h,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)];let u=this._getByteView();this.min=2**53-1,this.max=-9007199254740991;for(let h=0;h<l;h++)for(let c=0;c<l;c++){let p=this._idx(h,c)*4,f=this._unpackAtIndex(u,p);f>this.max&&(this.max=f),f<this.min&&(this.min=f)}}get(t,r){let i=this._getByteView(),n=this._idx(t,r)*4;return this._unpackAtIndex(i,n)}sampleBilinear(t,r){let i=Math.floor(t),n=Math.floor(r);if(i<-1||i>=this.dim||n<-1||n>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${r}, dim: ${this.dim}`);let a=this._getByteView(),s=((n+1)*this.stride+i+1)*4,o=this.stride*4,l=t-i,u=r-n,h=this._unpackAtIndex(a,s),c=this._unpackAtIndex(a,s+4),p=this._unpackAtIndex(a,s+o),f=this._unpackAtIndex(a,s+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+p*(1-l)*u+f*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${r}, dim: ${this.dim}`);return(r+1)*this.stride+(t+1)}unpack(t,r,i){return t*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(t){return rh(t,this.getUnpackVector())}getPixels(){return new Pe({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(t,r,i){if(this.dim!==t.dim)throw Error("dem dimension mismatch");let n=r*this.dim,a=r*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(r){case-1:n=a-1;break;case 1:a=n+1}switch(i){case-1:s=o-1;break;case 1:o=s+1}let l=-r*this.dim,u=-i*this.dim;for(let h=s;h<o;h++)for(let c=n;c<a;c++)this.data[this._idx(c,h)]=t.data[this._idx(c+l,h+u)]}_getByteView(){let t=ht.byteViewCache.get(this);return(t==null?void 0:t.buffer)!==this.data.buffer&&(t=new Uint8Array(this.data.buffer),ht.byteViewCache.set(this,t)),t}_unpackAtIndex(t,r){return this.unpack(t[r],t[r+1],t[r+2])}},ht.byteViewCache=new WeakMap,ht);function rh(e,t){let r=t[0],i=t[1],n=t[2],a=t[3],s=Math.min(r,i,n),o=Math.round((e+a)/s);return{r:Math.floor(o*s/r)%256,g:Math.floor(o*s/i)%256,b:Math.floor(o*s/n)%256}}C("DEMData",th);var xg=class extends Ge{constructor(e,t){super(e,gg,t)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof $r&&r._styleExpression.expression instanceof Je){this.colorRampExpression=r;let a=r._styleExpression.expression;t.elevationStops=a.labels,t.colorStops=[];for(let s of t.elevationStops)t.colorStops.push(a.evaluate({globals:{elevation:s}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[te.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 i={elevationStops:[],colorStops:[]},n=(t.elevationStops.length-1)/(e-1);for(let a=0;a<t.elevationStops.length-.5;a+=n)i.elevationStops.push(t.elevationStops[Math.round(a)]),i.colorStops.push(t.colorStops[Math.round(a)]);return ge(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(t),n=new Pe({width:i.colorStops.length,height:1}),a=new Pe({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let o=rh(i.elevationStops[s],r);a.setPixel(0,s,new te(o.r/255,o.g/255,o.b/255,1)),n.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new eh(e,a,e.gl.RGBA),colorTexture:new eh(e,n,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}};const vg=he([{name:"a_pos",components:2,type:"Int16"}],4),bg=vg.members;function on(e,t,r){let i=r.patternDependencies,n=!1;for(let a of t){let s=a.paint.get(`${e}-pattern`);s.isConstant()||(n=!0);let o=s.constantOr(null);o&&(n=!0,i[o.to]=!0,i[o.from]=!0)}return n}function ps(e,t,r,i,n){let{zoom:a}=i,s=n.patternDependencies;for(let o of t){let l=o.paint.get(`${e}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:a-1},r,{},n.availableImages),h=l.evaluate({zoom:a},r,{},n.availableImages),c=l.evaluate({zoom:a+1},r,{},n.availableImages);u=u!=null&&u.name?u.name:u,h=h!=null&&h.name?h.name:h,c=c!=null&&c.name?c.name:c,s[u]=!0,s[h]=!0,s[c]=!0,r.patterns[o.id]={min:u,mid:h,max:c}}}return r}const Kr=new Set;let fs=!1;function wg(e,t,r=2){let i=t&&t.length,n=i?t[0]*r:e.length;Kr.size&&Kr.clear();let a=ih(e,0,n,r,!0),s=[];if(!a||a.next===a.prev)return s;let o=0,l=0,u=0;if(i&&(a=Eg(e,t,a,r)),e.length>80*r){o=e[0],l=e[1];let h=o,c=l;for(let p=r;p<n;p+=r){let f=e[p],d=e[p+1];f<o&&(o=f),d<l&&(l=d),f>h&&(h=f),d>c&&(c=d)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return ds(a,s,o,l,u),s}function ih(e,t,r,i,n){let a=null;if(n===$g(e,t,r,i)>0)for(let s=t;s<r;s+=i)a=uh(s/i|0,e[s],e[s+1],a);else for(let s=r-i;s>=t;s-=i)a=uh(s/i|0,e[s],e[s+1],a);return a&&ti(a,a.next)&&(ii(a),a=a.next),a}function Bt(e,t=e){let r=t===e,i=e,n;do n=!1,i!==i.next&&(Kr.size===0||!Kr.has(i))&&(ti(i,i.next)||pe(i.prev,i,i.next)===0)?((r||i===t)&&(t=i.prev),fs=!0,ii(i),i=i.prev,n=!0):(r||i!==t)&&(i=i.next,n=!r);while(n||i!==t);return t}function ds(e,t,r,i,n){n&&Pg(e,r,i,n);let a=e,s=!1;for(;e.prev!==e.next;){let o=e.prev,l=e.next;if(pe(o,e,l)<0&&(n?Sg(e,r,i,n):_g(e))){t.push(o.i,e.i,l.i),ii(e),e=l,a=l;continue}if(e=l,e===a){if(fs=!1,e=Bt(e),fs){a=e;continue}if(!s){e=Ag(e,t),a=e,s=!0;continue}Dg(e,t,r,i,n);break}}}function _g(e){let t=e.prev,r=e,i=e.next,n=t.x,a=r.x,s=i.x,o=t.y,l=r.y,u=i.y,h=Math.min(n,a,s),c=Math.min(o,l,u),p=Math.max(n,a,s),f=Math.max(o,l,u),d=i.next;for(;d!==t;){if(d.x>=h&&d.x<=p&&d.y>=c&&d.y<=f&&(n!==d.x||o!==d.y)&&hn(n,o,a,l,s,u,d.x,d.y)&&pe(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Sg(e,t,r,i){let n=e.prev,a=e,s=e.next,o=n.x,l=a.x,u=s.x,h=n.y,c=a.y,p=s.y,f=Math.min(o,l,u),d=Math.min(h,c,p),y=Math.max(o,l,u),m=Math.max(h,c,p),g=xs(f,d,t,r,i),x=xs(y,m,t,r,i),v=e.prevZ;for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==s&&(o!==v.x||h!==v.y)&&hn(o,h,l,c,u,p,v.x,v.y)&&pe(v.prev,v,v.next)>=0)return!1;v=v.prevZ}let b=e.nextZ;for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==s&&(o!==b.x||h!==b.y)&&hn(o,h,l,c,u,p,b.x,b.y)&&pe(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Ag(e,t){let r=e,i=!1;do{let n=r.prev,a=r.next.next;oh(n,r,r.next,a,!1)&&ri(n,a)&&ri(a,n)&&(t.push(n.i,r.i,a.i),ii(r),ii(r.next),r=e=a,i=!0),r=r.next}while(r!==e);return i?Bt(r):r}function Dg(e,t,r,i,n){let a=e;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&Lg(a,s)){let o=lh(a,s);a=Bt(a,a.next),o=Bt(o,o.next),ds(a,t,r,i,n),ds(o,t,r,i,n);return}s=s.next}a=a.next}while(a!==e)}let ys=!1;function Eg(e,t,r,i){let n=[];for(let a=0,s=t.length;a<s;a++){let o=ih(e,t[a]*i,a<s-1?t[a+1]*i:e.length,i,!1);o===o.next&&Kr.add(o),n.push(zg(o))}n.sort(Tg),kg(e.length/i,t.length),nh(r,r),ys=!0;for(let a=0;a<n.length;a++)r=Ig(n[a],r);return ys=!1,Bt(r)}function Tg(e,t){return e.x-t.x||e.y-t.y||(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}function Ig(e,t){let r=Cg(e,t);if(!r)return t;let i=lh(r,e),n=i.next;return nh(r,n.next),Bt(i,i.next),Bt(r,r.next)}let oe=new Float64Array,ln=0;const ms=[],gs=[];function kg(e,t){let r=Math.ceil((e+2*t)/16)+t+2;oe.length<r*4&&(oe=new Float64Array(r*4)),ln=0}function nh(e,t){let r=e;do{let i=ln++;ms[i]=r;let n=1/0,a=1/0,s=-1/0,o=-1/0,l=0;do{let h=r.next;r.z=i,r.x<n&&(n=r.x),r.x>s&&(s=r.x),r.y<a&&(a=r.y),r.y>o&&(o=r.y),h.x<n&&(n=h.x),h.x>s&&(s=h.x),h.y<a&&(a=h.y),h.y>o&&(o=h.y),r=h}while(++l<16&&r!==t);gs[i]=r;let u=i*4;oe[u]=n,oe[u+1]=a,oe[u+2]=s,oe[u+3]=o}while(r!==t)}function Fg(e,t){let r=e.z*4;t.x<oe[r]&&(oe[r]=t.x),t.y<oe[r+1]&&(oe[r+1]=t.y),t.x>oe[r+2]&&(oe[r+2]=t.x),t.y>oe[r+3]&&(oe[r+3]=t.y)}function ah(e){let t=gs[e];for(;t.prev.next!==t;)t=t.next;return gs[e]=t,t}function sh(e){let t=ms[e];for(;t.prev.next!==t;)t=t.next;return ms[e]=t,t}function Cg(e,t){let r=t,i=e.x,n=e.y,a=-1/0,s;if(ti(e,r))return r;for(let p=0,f=0;p<ln;p++,f+=4){if(n<oe[f+1]||n>oe[f+3]||oe[f]>i||oe[f+2]<=a)continue;let d=ah(p);r=sh(p);do{if(r.prev.next===r){if(ti(e,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let y=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(y<=i&&y>a&&(a=y,s=r.x<r.next.x?r:r.next,y===i))return s}}r=r.next}while(r!==d)}if(!s)return null;let o=s.x,l=s.y,u=Math.min(n,l),h=Math.max(n,l),c=1/0;for(let p=0,f=0;p<ln;p++,f+=4){if(oe[f+2]<o||oe[f]>i||oe[f+3]<u||oe[f+1]>h)continue;let d=ah(p);r=sh(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&hn(n<l?i:a,n,o,l,n<l?a:i,n,r.x,r.y)){let y=Math.abs(n-r.y)/(i-r.x);(ri(r,e)||r.y===n&&r.next.y===n&&r.next.x>i)&&(y<c||y===c&&(r.x>s.x||r.x===s.x&&Bg(s,r)))&&(s=r,c=y)}r=r.next}while(r!==d)}return s}function Bg(e,t){return pe(e.prev,e,t.prev)<0&&pe(t.next,e,e.next)<0}const Oe=[];let Jr=[],Pt=new Uint32Array,Qr=new Uint32Array;const ei=new Uint32Array(256);function Pg(e,t,r,i){let n=e,a=0;do n.z=xs(n.x,n.y,t,r,i),Oe[a++]=n,n=n.next;while(n!==e);Mg(a);let s=null;for(let o=0;o<a;o++){let l=Oe[o];l.prevZ=s,s&&(s.nextZ=l),s=l}s.nextZ=null}function Mg(e){if(e<=32){for(let t=1;t<e;t++){let r=Oe[t],i=r.z,n=t-1;for(;n>=0&&Oe[n].z>i;)Oe[n+1]=Oe[n],n--;Oe[n+1]=r}return}Pt.length<e&&(Pt=new Uint32Array(e),Qr=new Uint32Array(e),Jr=Array(e));for(let t=0;t<e;t++)Pt[t]=Oe[t].z;un(e,Oe,Pt,Jr,Qr,0),un(e,Jr,Qr,Oe,Pt,8),un(e,Oe,Pt,Jr,Qr,16),un(e,Jr,Qr,Oe,Pt,24)}function un(e,t,r,i,n,a){ei.fill(0);for(let o=0;o<e;o++)ei[r[o]>>>a&255]++;let s=0;for(let o=0;o<256;o++){let l=ei[o];ei[o]=s,s+=l}for(let o=0;o<e;o++){let l=r[o],u=ei[l>>>a&255]++;i[u]=t[o],n[u]=l}}function xs(e,t,r,i,n){return e=(e-r)*n|0,t=(t-i)*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 zg(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function hn(e,t,r,i,n,a,s,o){return(n-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(i-o)>=(r-s)*(t-o)&&(r-s)*(a-o)>=(n-s)*(i-o)}function Lg(e,t){let r=ti(e,t)&&pe(e.prev,e,e.next)>0&&pe(t.prev,t,t.next)>0;return e.next.i!==t.i&&(r||ri(e,t)&&ri(t,e)&&(pe(e.prev,e,t.prev)!==0||pe(e,t.prev,t)!==0))&&!Vg(e,t)&&(r||Og(e,t))}function pe(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function ti(e,t){return e.x===t.x&&e.y===t.y}function oh(e,t,r,i,n=!0){let a=pe(e,t,r),s=pe(e,t,i),o=pe(r,i,e),l=pe(r,i,t);return(a>0&&s<0||a<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:n?!!(a===0&&cn(e,r,t)||s===0&&cn(e,i,t)||o===0&&cn(r,e,i)||l===0&&cn(r,t,i)):!1}function cn(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Vg(e,t){let r=Math.min(e.x,t.x),i=Math.max(e.x,t.x),n=Math.min(e.y,t.y),a=Math.max(e.y,t.y),s=e;do{let o=s.next;if(s.x>i&&o.x>i||s.x<r&&o.x<r||s.y>a&&o.y>a||s.y<n&&o.y<n){s=o;continue}if(s.i!==e.i&&o.i!==e.i&&s.i!==t.i&&o.i!==t.i&&oh(s,o,e,t))return!0;s=o}while(s!==e);return!1}function ri(e,t){return pe(e.prev,e,e.next)<0?pe(e,t,e.next)>=0&&pe(e,e.prev,t)>=0:pe(e,t,e.prev)<0||pe(e,e.next,t)<0}function Og(e,t){let r=e,i=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do{let s=r.next;r.y>a!=s.y>a&&n<(s.x-r.x)*(a-r.y)/(s.y-r.y)+r.x&&(i=!i),r=s}while(r!==e);return i}function lh(e,t){let r=vs(e.i,e.x,e.y),i=vs(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function uh(e,t,r,i){let n=vs(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function ii(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),ys&&Fg(e.prev,e.next)}function vs(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function $g(e,t,r,i){let n=0;for(let a=t,s=r-i;a<r;a+=i)n+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return n}var ni=class{constructor(e,t){if(t>e)throw 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)}},Rg=(Nt=class{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}},Nt.noSubdivision=new Nt({fill:new ni(0,0),line:new ni(0,0),tile:new ni(0,0),stencil:new ni(0,0),circle:1}),Nt);C("SubdivisionGranularityExpression",ni),C("SubdivisionGranularitySetting",Rg);const bs=-32768,ws=32767;var Ng=class{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=ne/e,this._canonical=t}_getKey(e,t){return e+=32768,t+=32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let r=Math.round(e)|0,i=Math.round(t)|0,n=this._getKey(r,i);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(r,i),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return qg(this._vertexBuffer,e);let t=[],r=e.length;for(let i=0;i<r;i+=3){let n=[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,o=1/0,l=-1/0,u=-1/0;for(let d=0;d<3;d++){let y=a[d*2],m=a[d*2+1];s=Math.min(s,y),l=Math.max(l,y),o=Math.min(o,m),u=Math.max(u,m)}if(s===l||o===u)continue;let h=Math.floor(s/this._granularityCellSize),c=Math.ceil(l/this._granularityCellSize),p=Math.floor(o/this._granularityCellSize),f=Math.ceil(u/this._granularityCellSize);if(h===c&&p===f){t.push(...n);continue}for(let d=p;d<f;d++){let y=this._scanlineGenerateVertexRingForCellRow(d,a,n);Gg(this._vertexBuffer,y,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,r){let i=e*this._granularityCellSize,n=i+this._granularityCellSize,a=[];for(let s=0;s<3;s++){let o=t[s*2],l=t[s*2+1],u=t[(s+1)*2%6],h=t[((s+1)*2+1)%6],c=t[(s+2)*2%6],p=t[((s+2)*2+1)%6],f=u-o,d=h-l,y=f===0,m=d===0,g=(i-l)/d,x=(n-l)/d,v=Math.min(g,x),b=Math.max(g,x);if(!m&&(v>=1||b<=0)||m&&(l<i||l>n)){h>=i&&h<=n&&a.push(r[(s+1)%3]);continue}if(!m&&v>0){let S=o+f*v,E=l+d*v;a.push(this._vertexToIndex(S,E))}let _=o+f*Math.max(v,0),A=o+f*Math.min(b,1);if(y||this._generateIntraEdgeVertices(a,o,l,u,h,_,A),!m&&b<1){let S=o+f*b,E=l+d*b;a.push(this._vertexToIndex(S,E))}(m||h>=i&&h<=n)&&a.push(r[(s+1)%3]),!m&&(h<=i||h>=n)&&this._generateInterEdgeVertices(a,o,l,u,h,c,p,A,i,n)}return a}_generateIntraEdgeVertices(e,t,r,i,n,a,s){let o=i-t,l=n-r,u=l===0,h=u?Math.min(t,i):Math.min(a,s),c=u?Math.max(t,i):Math.max(a,s),p=Math.floor(h/this._granularityCellSize)+1,f=Math.ceil(c/this._granularityCellSize)-1;if(u?t<i:a<s)for(let d=p;d<=f;d++){let y=d*this._granularityCellSize,m=r+l*(y-t)/o;e.push(this._vertexToIndex(y,m))}else for(let d=f;d>=p;d--){let y=d*this._granularityCellSize,m=r+l*(y-t)/o;e.push(this._vertexToIndex(y,m))}}_generateInterEdgeVertices(e,t,r,i,n,a,s,o,l,u){let h=n-r,c=a-i,p=s-n,f=(l-n)/p,d=(u-n)/p,y=Math.min(f,d),m=Math.max(f,d),g=i+c*y,x=Math.floor(Math.min(g,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(g,o)/this._granularityCellSize)-1,b=o<g,_=p===0;if(_&&(s===l||s===u))return;if(_||y>=1||m<=0){let S=t-a,E=r-s,T=(l-s)/E,z=(u-s)/E,O=a+S*Math.min(T,z);x=Math.floor(Math.min(O,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(O,o)/this._granularityCellSize)-1,b=o<O}let A=h>0?u:l;if(b)for(let S=x;S<=v;S++){let E=S*this._granularityCellSize;e.push(this._vertexToIndex(E,A))}else for(let S=v;S>=x;S--){let E=S*this._granularityCellSize;e.push(this._vertexToIndex(E,A))}}_generateOutline(e){let t=[];for(let r of e){let i=Mt(r,this._granularity,!0),n=this._pointArrayToIndices(i),a=[];for(let s=1;s<n.length;s++)a.push(n[s-1]),a.push(n[s]);t.push(a)}return t}_handlePoles(e){let t=!1,r=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(t||r)&&this._fillPoles(e,t,r)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let r=e[t+1];r===-32768&&(e[t+1]=-32767),r===32767&&(e[t+1]=32766)}}_generatePoleQuad(e,t,r,i,n,a){i>n==(a===-32768)?(e.push(r),e.push(t),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(n,a)),e.push(r),e.push(this._vertexToIndex(i,a))):(e.push(t),e.push(r),e.push(this._vertexToIndex(i,a)),e.push(r),e.push(this._vertexToIndex(n,a)),e.push(this._vertexToIndex(i,a)))}_fillPoles(e,t,r){let i=this._vertexBuffer,n=ne,a=e.length;for(let s=2;s<a;s+=3){let o=e[s-2],l=e[s-1],u=e[s],h=i[o*2],c=i[o*2+1],p=i[l*2],f=i[l*2+1],d=i[u*2],y=i[u*2+1];t&&(c===0&&f===0&&this._generatePoleQuad(e,o,l,h,p,bs),f===0&&y===0&&this._generatePoleQuad(e,l,u,p,d,bs),y===0&&c===0&&this._generatePoleQuad(e,u,o,d,h,bs)),r&&(c===n&&f===n&&this._generatePoleQuad(e,o,l,h,p,ws),f===n&&y===n&&this._generatePoleQuad(e,l,u,p,d,ws),y===n&&c===n&&this._generatePoleQuad(e,u,o,d,h,ws))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){var s;if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:r,holeIndices:i}=Ug(e);this._initializeVertices(r);let n;try{let o=wg(r,i),l=this._convertIndices(r,o);n=this._subdivideTrianglesScanline(l)}catch(o){console.error(o)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(n),this._granularity>=2&&((s=this._canonical)==null?void 0:s.z)===0&&(n=this._removeTrianglesOutsideTileX(n),a=a.map(o=>this._removeLinesOutsideTileX(o))),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:a}}_vertexOutsideTileX(e){let t=this._vertexBuffer[e*2];return t<0||t>8192}_removeTrianglesOutsideTileX(e){let t=[];for(let r=0;r<e.length;r+=3)this._vertexOutsideTileX(e[r])||this._vertexOutsideTileX(e[r+1])||this._vertexOutsideTileX(e[r+2])||t.push(e[r],e[r+1],e[r+2]);return t}_removeLinesOutsideTileX(e){let t=[];for(let r=0;r<e.length;r+=2)this._vertexOutsideTileX(e[r])||this._vertexOutsideTileX(e[r+1])||t.push(e[r],e[r+1]);return t}_convertIndices(e,t){let r=[];for(let i of t){let n=e[i*2],a=e[i*2+1];r.push(this._vertexToIndex(n,a))}return r}_pointArrayToIndices(e){let t=[];for(let r of e)t.push(this._vertexToIndex(r.x,r.y));return t}};function hh(e,t,r,i=!0){return new Ng(r,t).subdividePolygonInternal(e,i)}function Mt(e,t,r=!1){if(!e||e.length<1||e.length<2)return[];let i=e[0],n=e[e.length-1],a=r&&(i.x!==n.x||i.y!==n.y);if(t<2)return a?[...e,e[0]]:[...e];let s=Math.floor(ne/t),o=[];o.push(new B(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],f=c.x,d=c.y,y=p.x,m=p.y,g=f!==y,x=d!==m;if(!g&&!x)continue;let v=y-f,b=m-d,_=Math.abs(v),A=Math.abs(b),S=f,E=d;for(;;){let z=v>0?(Math.floor(S/s)+1)*s:(Math.ceil(S/s)-1)*s,O=b>0?(Math.floor(E/s)+1)*s:(Math.ceil(E/s)-1)*s,P=Math.abs(S-z),L=Math.abs(E-O),I=Math.abs(S-y),$=Math.abs(E-m),R=g?P/_:1/0,F=x?L/A:1/0;if((I<=P||!g)&&($<=L||!x))break;if(R<F&&g||!x){S=z,E+=b*R;let N=new B(S,Math.round(E));(o[o.length-1].x!==N.x||o[o.length-1].y!==N.y)&&o.push(N)}else{S+=v*F,E=O;let N=new B(Math.round(S),E);(o[o.length-1].x!==N.x||o[o.length-1].y!==N.y)&&o.push(N)}}let T=new B(y,m);(o[o.length-1].x!==T.x||o[o.length-1].y!==T.y)&&o.push(T)}return o}function Ug(e){let t=[],r=[];for(let i of e)if(i.length!==0){i!==e[0]&&t.push(r.length/2);for(let n of i)r.push(n.x),r.push(n.y)}return{flattened:r,holeIndices:t}}function qg(e,t){let r=[];for(let i=0;i<t.length;i+=3){let n=t[i],a=t[i+1],s=t[i+2],o=e[n*2],l=e[n*2+1],u=e[a*2],h=e[a*2+1],c=e[s*2],p=e[s*2+1],f=u-o,d=h-l,y=c-o;f*(p-l)-d*y>0?(r.push(n),r.push(s),r.push(a)):(r.push(n),r.push(a),r.push(s))}return r}function Gg(e,t,r){if(t.length===0)throw Error("Subdivision vertex ring is empty.");let i=0,n=e[t[0]*2];for(let l=1;l<t.length;l++){let u=e[t[l]*2];u<n&&(n=u,i=l)}let a=t.length,s=i,o=(s+1)%a;for(;;){let l=s-1>=0?s-1:a-1,u=(o+1)%a,h=e[t[l]*2],c=e[t[l]*2+1],p=e[t[u]*2],f=e[t[u]*2+1],d=e[t[s]*2],y=e[t[s]*2+1],m=e[t[o]*2],g=e[t[o]*2+1],x=!1;if(h<p)x=!0;else if(h>p)x=!1;else{let v=g-y,b=-(m-d),_=y<g?1:-1;((h-d)*v+(c-y)*b)*_>((p-d)*v+(f-y)*b)*_&&(x=!0)}if(x){let v=t[l],b=t[s],_=t[o];v!==b&&v!==_&&b!==_&&r.push(_,b,v),s--,s<0&&(s=a-1)}else{let v=t[u],b=t[s],_=t[o];v!==b&&v!==_&&b!==_&&r.push(_,b,v),o++,o>=a&&(o=0)}if(l===u)break}}function ch(e,t,r,i,n,a,s,o,l){let u=n.length/2,h=s&&o&&l;if(u<Be.MAX_VERTEX_ARRAY_LENGTH){let c=t.prepareSegment(u,r,i),p=c.vertexLength;for(let y=0;y<a.length;y+=3)i.emplaceBack(p+a[y],p+a[y+1],p+a[y+2]);c.vertexLength+=u,c.primitiveLength+=a.length/3;let f,d;h&&(d=s.prepareSegment(u,r,o),f=d.vertexLength,d.vertexLength+=u);for(let y=0;y<n.length;y+=2)e(n[y],n[y+1]);if(h)for(let y of l){for(let m=1;m<y.length;m+=2)o.emplaceBack(f+y[m-1],f+y[m]);d.primitiveLength+=y.length/2}}else jg(t,r,i,n,a,e),h&&Yg(s,r,o,n,l,e),t.forceNewSegmentOnNextPrepare(),s==null||s.forceNewSegmentOnNextPrepare()}function ai(e,t,r,i,n,a,s){if(a){let o=i.count;return r(t[n*2],t[n*2+1]),e[n]=i.count,i.count++,s.vertexLength++,o}return e[n]}function jg(e,t,r,i,n,a){let s=[];for(let c=0;c<i.length/2;c++)s.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),h=u.vertexLength;for(let c=2;c<n.length;c+=3){let p=n[c-2],f=n[c-1],d=n[c],y=s[p]<l,m=s[f]<l,g=s[d]<l,x=+!!y+ +!!m+ +!!g;u.vertexLength+x>Be.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=o.count,y=!0,m=!0,g=!0,h=0);let v=ai(s,i,a,o,p,y,u),b=ai(s,i,a,o,f,m,u),_=ai(s,i,a,o,d,g,u);r.emplaceBack(h+v-l,h+b-l,h+_-l),u.primitiveLength++}}function Yg(e,t,r,i,n,a){let s=[];for(let c=0;c<i.length/2;c++)s.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),h=u.vertexLength;for(let c of n)for(let p=1;p<c.length;p+=2){let f=c[p-1],d=c[p],y=s[f]<l,m=s[d]<l,g=+!!y+ +!!m;u.vertexLength+g>Be.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=o.count,y=!0,m=!0,h=0);let x=ai(s,i,a,o,f,y,u),v=ai(s,i,a,o,d,m,u);r.emplaceBack(h+x-l,h+v-l),u.primitiveLength++}}var _s=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new wm,this.indexArray=new Wr,this.indexArray2=new Ha,this.programConfigurations=new Ft(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,r){this.hasDependencies=on("fill",this.layers,t);let i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),a=[],s=new W(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of e){let p=nr(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r,t.availableImages):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Ct(l),patterns:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;if(this.hasDependencies){let f=ps("fill",this.layers,l,{zoom:this.zoom},t);this.patternFeatures.push(f)}else this.addFeature(l,u,h,r,{},t.subdivisionGranularity);let p=e[h].feature;t.featureIndex.insert(p,u,h,c,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}addFeatures(e,t,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,r,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,bg),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,r,i,n,a){for(let s of Pi(t,500)){let o=hh(s,i,a.fill.getGranularityForZoomLevel(i.z)),l=this.layoutVertexArray;ch((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,o.verticesFlattened,o.indicesTriangles,this.segments2,this.indexArray2,o.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,canonical:i})}};C("FillBucket",_s,{omit:["layers","patternFeatures"]});let Xg;const Zg=()=>Xg||(Xg=new Ee({"fill-sort-key":new V(w.layout_fill["fill-sort-key"],"fill-sort-key")}));let Wg;const Hg=()=>Wg||(Wg=new Ee({"fill-antialias":new M(w.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new V(w.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new M(w.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new V(w.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new V(w.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new M(w.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new M(w.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new jr(w.paint_fill["fill-pattern"],"fill-pattern")}));var Kg={get paint(){return Hg()},get layout(){return Zg()}},Jg=class extends Ge{constructor(e,t){super(e,Kg,t)}recalculate(e,t){super.recalculate(e,t);let r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new _s(e)}queryRadius(){return an(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:r,pixelsToTileUnits:i}){return Zu(sn(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),t)}isTileClipped(){return!0}};const Qg=he([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),e1=he([{name:"a_centroid",components:2,type:"Int16"}],4),t1=Qg.members;var pn=class Io{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 r=new Io;return r.extend(t(new B(this.minX,this.minY))),r.extend(t(new B(this.maxX,this.minY))),r.extend(t(new B(this.minX,this.maxY))),r.extend(t(new B(this.maxX,this.maxY))),r}static fromPoints(t){let r=new Io;for(let i of t)r.extend(i);return r}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}};pn.fromPoints([new B(0,0),new B(ne,ne)]);function Ss(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function ph(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 si=class{constructor(e,t,r,i,n){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=n;e.pos<t;){let a=e.readVarint();if(a===8)this.id=e.readVarint();else if(a===18){let s=e.readVarint()+e.pos;for(;e.pos<s;){let o=i[e.readVarint()],l=n[e.readVarint()];this.properties[o]=l}}else a===24?this.type=e.readVarint():(a===34&&(this._geometry=e.pos),e.skip(a))}}loadGeometry(){if(this._geometry<0)throw Error("feature has no geometry");let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,r=[],i,n=1,a=0,s=0,o=0;for(;e.pos<t;){if(a<=0){let l=e.readVarint();if(n=l&7,a=l>>3,a===0)continue}if(a--,n===1)s+=e.readSVarint(),o+=e.readSVarint(),i&&r.push(i),i=[new B(s,o)];else if(n===2)s+=e.readSVarint(),o+=e.readSVarint(),i&&i.push(new B(s,o));else if(n===7)i&&i.push(i[0].clone());else throw Error(`unknown command ${n}`)}return i&&r.push(i),r}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,r=1,i=0,n=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;for(;e.pos<t;){if(i<=0){let h=e.readVarint();if(r=h&7,i=h>>3,i===0)continue}if(i--,r===1||r===2)n+=e.readSVarint(),a+=e.readSVarint(),n<s&&(s=n),n>o&&(o=n),a<l&&(l=a),a>u&&(u=a);else if(r!==7)throw Error(`unknown command ${r}`)}return[s,l,o,u]}toGeoJSON(e,t,r){let i=this.extent*2**r,n=this.extent*e,a=this.extent*t,s=this.loadGeometry();function o(c){return[(c.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(c.y+a)*2/i)*Math.PI))-90]}function l(c){return c.map(o)}let u;if(this.type===1){let c=[];for(let f of s)c.push(f[0]);let p=l(c);u=c.length===1?{type:"Point",coordinates:p[0]}:{type:"MultiPoint",coordinates:p}}else if(this.type===2){let c=s.map(l);u=c.length===1?{type:"LineString",coordinates:c[0]}:{type:"MultiLineString",coordinates:c}}else if(this.type===3){let c=fh(s),p=[];for(let f of c)p.push(f.map(l));u=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p}}else throw Error("unknown feature type");let h={type:"Feature",geometry:u,properties:this.properties};return this.id!=null&&(h.id=this.id),h}};si.types=["Unknown","Point","LineString","Polygon"];function fh(e){let t=e.length;if(t<=1)return[e];let r=[],i,n;for(let a=0;a<t;a++){let s=r1(e[a]);s!==0&&(n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[e[a]]):i&&i.push(e[a]))}return i&&r.push(i),r}function r1(e){let t=0;for(let r=0,i=e.length,n=i-1,a,s;r<i;n=r++)a=e[r],s=e[n],t+=(s.x-a.x)*(a.y+s.y);return t}var i1=class{constructor(e,t){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],t===void 0&&(t=e.length);e.pos<t;){let r=e.readVarint();r===10?this.name=e.readString():r===18?(this._features.push(e.pos),e.skip(r)):r===26?this._keys.push(e.readString()):r===34?this._values.push(n1(e)):r===40?this.extent=e.readVarint():r===120?this.version=e.readVarint():e.skip(r)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[e];let t=this._pbf.readVarint()+this._pbf.pos;return new si(this._pbf,t,this.extent,this._keys,this._values)}};function n1(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let i=e.readVarint();t=i===10?e.readString():i===21?e.readFloat():i===25?e.readDouble():i===32?e.readVarint(!0):i===40?e.readVarint():i===48?e.readSVarint():i===56?e.readBoolean():(e.skip(i),null)}if(t==null)throw Error("unknown feature value");return t}var dh=class{constructor(e,t=e.length){let r=Object.create(null);for(;e.pos<t;){let i=e.readVarint();if(i===26){let n=new i1(e,e.readVarint()+e.pos);n.length&&(r[n.name]=n)}else e.skip(i)}this.layers=r}};const yh=63710088e-1;var mh=class wi{constructor(t,r){if(isNaN(t)||isNaN(r))throw Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new wi(Bf(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,i=this.lat*r,n=t.lat*r,a=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((t.lng-this.lng)*r);return yh*Math.acos(Math.min(a,1))}static convert(t){if(t instanceof wi)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new wi(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t)return new wi(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw 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>]")}};const gh=2*Math.PI*yh;function xh(e){return gh*Math.cos(e*Math.PI/180)}function a1(e){return(180+e)/360}function s1(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function o1(e,t){return e/xh(t)}function l1(e){return e*360-180}function As(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function u1(e,t){return e*xh(As(t))}function h1(e){return 1/Math.cos(e*Math.PI/180)}var Ds=class of{constructor(t,r,i=0){this.x=+t,this.y=+r,this.z=+i}static fromLngLat(t,r=0){let i=mh.convert(t);return new of(a1(i.lng),s1(i.lat),o1(r,i.lat))}toLngLat(){return new mh(l1(this.x),As(this.y))}toAltitude(){return u1(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/gh*h1(As(this.y))}};function c1(e,t,r){let i=1/(1<<r.z);return new Ds(e/ne*i+r.x*i,t/ne*i+r.y*i)}function p1(e,t,r){return c1(e,t,r).toLngLat()}function vh(e,t,r){if(t<=0||!e||e.length===0)return e;let i=f1(t,r);return e.map(n=>d1(n,i))}function f1(e,t){let r=p1(ne/2,ne/2,t),i=Ds.fromLngLat(r).meterInMercatorCoordinateUnits(),n=(1<<t.z)*ne;return e*i*n}function d1(e,t){if(!e||e.length<3)return e;let r=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,i=r?e.length-1:e.length;if(i<3)return e;let n=[];for(let s=0;s<i;s++){let o=e[(s-1+i)%i],l=e[s],u=e[(s+1)%i];if(Ss(o,l)||Ss(l,u)){n.push(l.clone());continue}m1(n,o,l,u,t)}let a=y1(n);return a.length<3?e:(r&&a.push(a[0].clone()),a)}function y1(e){let t=[];for(let r of e){let i=r.round(),n=t[t.length-1];((n==null?void 0:n.x)!==i.x||(n==null?void 0:n.y)!==i.y)&&t.push(i)}for(;t.length>1&&t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y;)t.pop();return t}function m1(e,t,r,i,n){let a=t.sub(r),s=i.sub(r),o=a.mag(),l=s.mag();if(o<1e-6||l<1e-6){e.push(r.clone());return}a._div(o),s._div(l);let u=a.x*s.x+a.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){e.push(r.clone());return}let h=.2,c=Math.min(n,o*h,l*h),p=r.add(a.mult(c)),f=r.add(s.mult(c)),d=Math.sqrt((1+u)/2),y=r.add(a.add(s)._unit()._mult(c/d)),m=p.sub(y).angleWith(f.sub(y)),g=Math.max(2,Math.ceil(Math.abs(m)/(Math.PI/6)-1e-6));for(let x=0;x<=g;x++)e.push(p.rotateAround(x/g*m,y))}const Es=8192;function oi(e,t,r,i,n,a,s,o){e.emplaceBack(t,r,Math.floor(i*Es)*2+s,n*Es*2,a*Es*2,Math.round(o))}var Ts=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new _m,this.centroidVertexArray=new vm,this.indexArray=new Wr,this.programConfigurations=new Ft(e.layers,e.zoom),this.segments=new Be,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,r){this.features=[],this.hasDependencies=on("fill-extrusion",this.layers,t);let i=new W(this.zoom),n=this.layers[0],a=n.layout.get("fill-extrusion-rounded-corner-distance"),s=n._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of e){let c=nr(o,s);if(!n._featureFilter.filter(i,c,r))continue;let p=s?c.geometry:Ct(o),f={id:l,sourceLayerIndex:h,index:u,geometry:a>0?vh(p,a,r):p,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(ps("fill-extrusion",this.layers,f,{zoom:this.zoom},t)):this.addFeature(f,f.geometry,u,r,{},t.subdivisionGranularity),t.featureIndex.insert(o,f.geometry,u,h,this.index,!0)}}addFeatures(e,t,r){for(let i of this.features){let{geometry:n}=i;this.addFeature(i,n,i.index,t,r,e.subdivisionGranularity)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}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,t1),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,e1.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,r,i,n,a){let s=this.layers[0],o=s.layout?s.layout.get("fill-extrusion-rounded-corner-distance"):0,l=o>0?vh(t,o,i):t;for(let u of Pi(l,500)){let h={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(h,i,e,u,a);let p=this.layoutVertexArray.length-c,f=Math.floor(h.x/h.sampleCount),d=Math.floor(h.y/h.sampleCount);for(let y=0;y<p;y++)this.centroidVertexArray.emplaceBack(f,d)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,canonical:i})}processPolygon(e,t,r,i,n){if(i.length<1||ph(i[0]))return;for(let h of i)h.length!==0&&g1(e,h);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=n.fill.getGranularityForZoomLevel(t.z),o=si.types[r.type]==="Polygon";for(let h of i){if(h.length===0||ph(h))continue;let c=Mt(h,s,o);this._generateSideFaces(c,a)}if(!o)return;let l=hh(i,t,s,!1),u=this.layoutVertexArray;ch((h,c)=>{oi(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let r=0;for(let i=1;i<e.length;i++){let n=e[i],a=e[i-1];if(Ss(n,a))continue;t.segment.vertexLength+4>Be.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(a)._perp()._unit(),o=a.dist(n);r+o>32768&&(r=0),oi(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,r),oi(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,r),r+=o,oi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,r),oi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,r);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 g1(e,t){for(let r=0;r<t.length;r++){let i=t[r];(r!==t.length-1||t[0].x!==i.x||t[0].y!==i.y)&&(e.x+=i.x,e.y+=i.y,e.sampleCount++)}}C("FillExtrusionBucket",Ts,{omit:["layers","features"]});let x1;const v1=()=>x1||(x1=new Ee({"fill-extrusion-rounded-corner-distance":new M(w["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")}));let b1;const w1=()=>b1||(b1=new Ee({"fill-extrusion-opacity":new M(w["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new V(w["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new M(w["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new M(w["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new jr(w["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new V(w["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new V(w["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new M(w["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")}));var _1={get paint(){return w1()},get layout(){return v1()}},S1=class extends Ge{constructor(e,t){super(e,_1,t)}createBucket(e){return new Ts(e)}queryRadius(){return an(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,pixelPosMatrix:s}){let o=sn(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,r),u=this.paint.get("fill-extrusion-base").evaluate(t,r),h=E1(o,s,0),c=D1(i,u,l,s),p=c[0],f=c[1];return A1(p,f,h)}};function li(e,t){return e.x*t.x+e.y*t.y}function bh(e,t){if(e.length===1){let r=0,i=t[r++],n;for(;!n||i.equals(n);)if(n=t[r++],!n)return 1/0;for(;r<t.length;r++){let a=t[r],s=e[0],o=n.sub(i),l=a.sub(i),u=s.sub(i),h=li(o,o),c=li(o,l),p=li(l,l),f=li(u,o),d=li(u,l),y=h*p-c*c,m=(p*f-c*d)/y,g=(h*d-c*f)/y,x=1-m-g,v=i.z*x+n.z*m+a.z*g;if(isFinite(v))return v}return 1/0}{let r=1/0;for(let i of t)r=Math.min(r,i.z);return r}}function A1(e,t,r){let i=1/0;Zu(r,t)&&(i=bh(r,t[0]));for(let n=0;n<t.length;n++){let a=t[n],s=e[n];for(let o=0;o<a.length-1;o++){let l=a[o],u=a[o+1],h=s[o],c=[l,u,s[o+1],h,l];Rm(r,c)&&(i=Math.min(i,bh(r,c)))}}return i!==1/0&&i}function D1(e,t,r,i){let n=[],a=[],s=i[8]*t,o=i[9]*t,l=i[10]*t,u=i[11]*t,h=i[8]*r,c=i[9]*r,p=i[10]*r,f=i[11]*r;for(let d of e){let y=[],m=[];for(let g of d){let x=g.x,v=g.y,b=i[0]*x+i[4]*v+i[12],_=i[1]*x+i[5]*v+i[13],A=i[2]*x+i[6]*v+i[14],S=i[3]*x+i[7]*v+i[15],E=b+s,T=_+o,z=A+l,O=S+u,P=b+h,L=_+c,I=A+p,$=S+f,R=new B(E/O,T/O);R.z=z/O,y.push(R);let F=new B(P/$,L/$);F.z=I/$,m.push(F)}n.push(y),a.push(m)}return[n,a]}function E1(e,t,r){let i=[];for(let n of e){let a=[n.x,n.y,r,1];Ef(a,a,t),i.push(new B(a[0]/a[3],a[1]/a[3]))}return i}function Is(e,t,r,i){let n=i,a=t+(r-t>>1),s=r-t,o,l=e[t],u=e[t+1],h=e[r],c=e[r+1];for(let p=t+3;p<r;p+=3){let f=T1(e[p],e[p+1],l,u,h,c);if(f>n){o=p,n=f;continue}if(f===n){let d=Math.abs(p-a);d<s&&(o=p,s=d)}}n>i&&(o-t>3&&Is(e,t,o,i),e[o+2]=n,r-o>3&&Is(e,o,r,i))}function T1(e,t,r,i,n,a){let s=n-r,o=a-i;if(s!==0||o!==0){let l=((e-r)*s+(t-i)*o)/(s*s+o*o);l>1?(r=n,i=a):l>0&&(r+=s*l,i+=o*l)}return s=e-r,o=t-i,s*s+o*o}function fe(e,t,r,i){let n={type:t,geom:r},a={id:e??null,type:n.type,geometry:n.geom,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case"Point":case"MultiPoint":ui(a,n.geom);break;case"LineString":ui(a,n.geom.points);break;case"Polygon":ui(a,n.geom[0].points);break;case"MultiLineString":for(let s of n.geom)ui(a,s.points);break;case"MultiPolygon":for(let s of n.geom)ui(a,s[0].points)}return a}function ks(e){let t=e;e.points.length>64&&(t.points=new Float64Array(e.points))}function ui(e,t){for(let r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function Fs(e,t){let r=[];switch(e.type){case"FeatureCollection":for(let i=0;i<e.features.length;i++)fn(r,e.features[i],t,i);break;case"Feature":fn(r,e,t);break;default:fn(r,{geometry:e,properties:void 0},t)}return r}function fn(e,t,r,i,n=0){var o;if(!t.geometry)return;if(n>1024)throw Error("GeometryCollection nesting exceeds supported depth: 1024");if(t.geometry.type==="GeometryCollection"){k1(e,t,t.geometry,r,i,n+1);return}if(!((o=t.geometry.coordinates)!=null&&o.length))return;let a=I1(t,r,i),s=(r.tolerance/((1<<r.maxZoom)*r.extent))**2;switch(t.geometry.type){case"Point":F1(e,a,t.geometry,t.properties);return;case"MultiPoint":C1(e,a,t.geometry,t.properties);return;case"LineString":B1(e,a,t.geometry,s,t.properties);return;case"MultiLineString":P1(e,a,t.geometry,s,r,t.properties);return;case"Polygon":M1(e,a,t.geometry,s,t.properties);return;case"MultiPolygon":z1(e,a,t.geometry,s,t.properties);return;default:throw Error("Input data is not a valid GeoJSON object.")}}function I1(e,t,r){var i;return t.promoteId?(i=e.properties)==null?void 0:i[t.promoteId]:t.generateId?r||0:e.id}function k1(e,t,r,i,n,a=0){for(let s of r.geometries)fn(e,{id:t.id,geometry:s,properties:t.properties},i,n,a)}function F1(e,t,r,i){let n=[];n.push(or(r.coordinates[0]),lr(r.coordinates[1]),0),e.push(fe(t,"Point",n,i))}function C1(e,t,r,i){let n=[];for(let a of r.coordinates)n.push(or(a[0]),lr(a[1]),0);e.push(fe(t,"MultiPoint",n,i))}function B1(e,t,r,i,n){let a={points:[]};Cs(r.coordinates,a,i,!1),e.push(fe(t,"LineString",a,n))}function P1(e,t,r,i,n,a){if(n.lineMetrics)for(let s of r.coordinates){let o={points:[]};Cs(s,o,i,!1),e.push(fe(t,"LineString",o,a))}else{let s=[];Bs(r.coordinates,s,i,!1),e.push(fe(t,"MultiLineString",s,a))}}function M1(e,t,r,i,n){let a=[];Bs(r.coordinates,a,i,!0),e.push(fe(t,"Polygon",a,n))}function z1(e,t,r,i,n){let a=[];for(let s of r.coordinates){let o=[];Bs(s,o,i,!0),a.push(o)}e.push(fe(t,"MultiPolygon",a,n))}function Cs(e,t,r,i){let n,a,s=0;for(let l=0;l<e.length;l++){let u=or(e[l][0]),h=lr(e[l][1]);t.points.push(u,h,0),l>0&&(s+=i?(n*h-u*a)/2:Math.sqrt((u-n)**2+(h-a)**2)),n=u,a=h}let o=t.points.length-3;t.points[2]=1,r>0&&Is(t.points,0,o,r),t.points[o+2]=1,ks(t),t.size=Math.abs(s),t.start=0,t.end=t.size}function Bs(e,t,r,i){for(let n=0;n<e.length;n++){let a={points:[]};Cs(e[n],a,r,i),t.push(a)}}function or(e){return e/360+.5}function lr(e){let t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function L1(e){return{type:"FeatureCollection",features:e.map(t=>dn(t))}}function dn(e){let t={type:"Feature",geometry:V1(e),properties:e.tags};return e.id!=null&&(t.id=e.id),t}function V1(e){let{type:t,geometry:r}=e;switch(t){case"Point":return{type:t,coordinates:wh(r[0],r[1])};case"MultiPoint":return{type:t,coordinates:yn(r)};case"LineString":return{type:t,coordinates:yn(r.points)};case"MultiLineString":case"Polygon":return{type:t,coordinates:r.map(i=>yn(i.points))};case"MultiPolygon":return{type:t,coordinates:r.map(i=>i.map(n=>yn(n.points)))}}}function yn(e){let t=[];for(let r=0;r<e.length;r+=3)t.push(wh(e[r],e[r+1]));return t}function wh(e,t){return[_h(e),Sh(t)]}function _h(e){return(e-.5)*360}function Sh(e){let t=(180-e*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function ot(e,t,r,i,n,a,s,o){if(r/=t,i/=t,a>=r&&s<i)return e;if(s<r||a>=i)return null;let l=[];for(let u of e){let h=n===0?u.minX:u.minY,c=n===0?u.maxX:u.maxY;if(h>=r&&c<i){l.push(u);continue}if(!(c<r||h>=i))switch(u.type){case"Point":case"MultiPoint":O1(u,l,r,i,n);continue;case"LineString":$1(u,l,r,i,n,o);continue;case"MultiLineString":R1(u,l,r,i,n);continue;case"Polygon":N1(u,l,r,i,n);continue;case"MultiPolygon":U1(u,l,r,i,n);continue}}return l.length?l:null}function O1(e,t,r,i,n){let a=[];if(q1(e.geometry,a,r,i,n),!a.length)return;let s=a.length===3?"Point":"MultiPoint";t.push(fe(e.id,s,a,e.tags))}function $1(e,t,r,i,n,a){let s=[];if(Ah(e.geometry,s,r,i,n,!1,a.lineMetrics),s.length){if(a.lineMetrics){for(let o of s)t.push(fe(e.id,"LineString",o,e.tags));return}if(s.length>1){t.push(fe(e.id,"MultiLineString",s,e.tags));return}t.push(fe(e.id,"LineString",s[0],e.tags))}}function R1(e,t,r,i,n){let a=[];if(Ps(e.geometry,a,r,i,n,!1),a.length){if(a.length===1){t.push(fe(e.id,"LineString",a[0],e.tags));return}t.push(fe(e.id,"MultiLineString",a,e.tags))}}function N1(e,t,r,i,n){let a=[];Ps(e.geometry,a,r,i,n,!0),a.length&&t.push(fe(e.id,"Polygon",a,e.tags))}function U1(e,t,r,i,n){let a=[];for(let s of e.geometry){let o=[];Ps(s,o,r,i,n,!0),o.length&&a.push(o)}a.length&&t.push(fe(e.id,"MultiPolygon",a,e.tags))}function q1(e,t,r,i,n){for(let a=0;a<e.length;a+=3){let s=e[a+n];s>=r&&s<=i&&ur(t,e[a],e[a+1],e[a+2])}}function Ah(e,t,r,i,n,a,s){let o=Dh(e),l=n===0?G1:j1,u=e.start,h,c;for(let g=0;g<e.points.length-3;g+=3){let x=e.points[g],v=e.points[g+1],b=e.points[g+2],_=e.points[g+3],A=e.points[g+4],S=n===0?x:v,E=n===0?_:A,T=!1;s&&(h=Math.sqrt((x-_)**2+(v-A)**2)),S<r?E>r&&(c=l(o,x,v,_,A,r),s&&(o.start=u+h*c)):S>i?E<i&&(c=l(o,x,v,_,A,i),s&&(o.start=u+h*c)):ur(o.points,x,v,b),E<r&&S>=r&&(c=l(o,x,v,_,A,r),T=!0),E>i&&S<=i&&(c=l(o,x,v,_,A,i),T=!0),!a&&T&&(s&&(o.end=u+h*c),t.push(o),o=Dh(e)),s&&(u+=h)}let p=e.points.length-3,f=e.points[p],d=e.points[p+1],y=e.points[p+2],m=n===0?f:d;m>=r&&m<=i&&ur(o.points,f,d,y),p=o.points.length-3,a&&p>=3&&(o.points[p]!==o.points[0]||o.points[p+1]!==o.points[1])&&ur(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(ks(o),t.push(o))}function Dh(e){return{points:[],size:e.size,start:e.start,end:e.end}}function Ps(e,t,r,i,n,a){for(let s of e)Ah(s,t,r,i,n,a,!1)}function ur(e,t,r,i){e.push(t,r,i)}function G1(e,t,r,i,n,a){let s=(a-t)/(i-t);return ur(e.points,a,r+(n-r)*s,1),s}function j1(e,t,r,i,n,a){let s=(a-r)/(n-r);return ur(e.points,t+(i-t)*s,a,1),s}function Ms(e,t){let r=t.buffer/t.extent,i=e,n=ot(e,1,-1-r,r,0,-1,2,t),a=ot(e,1,1-r,2+r,0,-1,2,t);return!n&&!a||(i=ot(e,1,-r,1+r,0,-1,2,t)||[],n&&(i=Eh(n,1).concat(i)),a&&(i=i.concat(Eh(a,-1)))),i}function Eh(e,t){let r=[];for(let i of e)switch(i.type){case"Point":case"MultiPoint":{let n=Y1(i.geometry,t);r.push(fe(i.id,i.type,n,i.tags));continue}case"LineString":{let n=zs(i.geometry,t);r.push(fe(i.id,i.type,n,i.tags));continue}case"MultiLineString":case"Polygon":{let n=[];for(let a of i.geometry)n.push(zs(a,t));r.push(fe(i.id,i.type,n,i.tags));continue}case"MultiPolygon":{let n=[];for(let a of i.geometry){let s=[];for(let o of a)s.push(zs(o,t));n.push(s)}r.push(fe(i.id,i.type,n,i.tags));continue}}return r}function Y1(e,t){let r=[];for(let i=0;i<e.length;i+=3)r.push(e[i]+t,e[i+1],e[i+2]);return r}function zs(e,t){let r={points:[],size:e.size};e.start!==void 0&&(r.start=e.start,r.end=e.end);for(let i=0;i<e.points.length;i+=3)r.points.push(e.points[i]+t,e.points[i+1],e.points[i+2]);return ks(r),r}function X1(e,t,r){let i=W1(t,r),n=[];if(i.removeAll&&(n=e,e=[]),i.remove.size||i.add.size){let a=[];for(let s of e)(i.remove.has(s.id)||i.add.has(s.id))&&a.push(s);if(a.length){n=n.concat(a);let s=new Set(a.map(o=>o.id));e=e.filter(o=>!s.has(o.id))}if(i.add.size){let s=Fs({type:"FeatureCollection",features:Array.from(i.add.values())},r);s=Ms(s,r),n=n.concat(s),e=e.concat(s)}}if(i.update.size){let a=new Map,s=[];for(let o of e)i.update.has(o.id)?a.set(o.id,[...a.get(o.id)||[],o]):s.push(o);for(let[o,l]of i.update){let u=a.get(o);if(!u||u.length===0)continue;let h=Z1(u,l,r);n=n.concat(u,h),s=s.concat(h)}e=s}return{affected:n,source:e}}function Z1(e,t,r){var a,s;let i=!!t.newGeometry,n=t.removeAllProperties||((a=t.removeProperties)==null?void 0:a.length)>0||((s=t.addOrUpdateProperties)==null?void 0:s.length)>0;if(i){let o=e[0],l=Fs({type:"FeatureCollection",features:[{type:"Feature",id:o.id,geometry:t.newGeometry,properties:n?Th(o.tags,t):o.tags}]},r);return l=Ms(l,r),l}if(n){let o=[];for(let l of e){let u={...l};u.tags=Th(u.tags,t),o.push(u)}return o}return e}function Th(e,t){if(t.removeAllProperties)return{};let r={...e||{}};if(t.removeProperties)for(let i of t.removeProperties)delete r[i];if(t.addOrUpdateProperties)for(let{key:i,value:n}of t.addOrUpdateProperties)r[i]=n;return r}function W1(e,t){var r,i;return e?{removeAll:e.removeAll,remove:new Set(e.remove||[]),add:new Map((r=e.add)==null?void 0:r.map(n=>[t.promoteId?n.properties[t.promoteId]:n.id,n])),update:new Map((i=e.update)==null?void 0:i.map(n=>[n.id,n]))}:{remove:new Set,add:new Map,update:new Map}}const Ih=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ie=new Uint32Array(96);var H1=class lf{static from(t){if(!t||t.byteLength===void 0||t.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,i]=new Uint8Array(t,0,2);if(r!==219)throw Error("Data does not appear to be in a KDBush format.");let n=i>>4;if(n!==1)throw Error(`Got v${n} data when expected v1.`);let a=Ih[i&15];if(!a)throw Error("Unrecognized array type.");let[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new lf(o,s,a,void 0,t)}constructor(t,r=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(t)||t<0)throw Error(`Unexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let s=Ih.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,t),this.coords=new i(a,8+l+u,t*2),this._pos=t*2,this._finished=!0;else{let h=this.data=new n(8+o+l+u);this.ids=new this.IndexArrayType(h,8,t),this.coords=new i(h,8+l+u,t*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+s]),new Uint16Array(h,2,1)[0]=r,new Uint32Array(h,4,1)[0]=t}}add(t,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=r,i}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return Ls(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;ie[0]=0,ie[1]=a.length-1,ie[2]=0;let l=3,u=[];for(;l>0;){let h=ie[--l],c=ie[--l],p=ie[--l];if(c-p<=o){for(let m=p;m<=c;m++){let g=s[2*m],x=s[2*m+1];g>=t&&g<=i&&x>=r&&x<=n&&u.push(a[m])}continue}let f=p+c>>1,d=s[2*f],y=s[2*f+1];d>=t&&d<=i&&y>=r&&y<=n&&u.push(a[f]),(h===0?t<=d:r<=y)&&(ie[l++]=p,ie[l++]=f-1,ie[l++]=1-h),(h===0?i>=d:n>=y)&&(ie[l++]=f+1,ie[l++]=c,ie[l++]=1-h)}return u}within(t,r,i){let n=[];return this.withinInto(t,r,i,n),n}withinInto(t,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;ie[0]=0,ie[1]=a.length-1,ie[2]=0;let l=3,u=0,h=i*i;for(;l>0;){let c=ie[--l],p=ie[--l],f=ie[--l];if(p-f<=o){for(let g=f;g<=p;g++)Fh(s[2*g],s[2*g+1],t,r)<=h&&(n[u++]=a[g]);continue}let d=f+p>>1,y=s[2*d],m=s[2*d+1];Fh(y,m,t,r)<=h&&(n[u++]=a[d]),(c===0?t-i<=y:r-i<=m)&&(ie[l++]=f,ie[l++]=d-1,ie[l++]=1-c),(c===0?t+i>=y:r+i>=m)&&(ie[l++]=d+1,ie[l++]=p,ie[l++]=1-c)}return u}};function Ls(e,t,r,i,n,a){if(n-i<=r)return;let s=i+n>>1;kh(e,t,s,i,n,a),Ls(e,t,r,i,s-1,1-a),Ls(e,t,r,s+1,n,1-a)}function kh(e,t,r,i,n,a){for(;n>i;){if(n-i>600){let u=n-i+1,h=r-i+1,c=Math.log(u),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1);kh(e,t,r,Math.max(i,Math.floor(r-h*p/u+f)),Math.min(n,Math.floor(r+(u-h)*p/u+f)),a)}let s=t[2*r+a],o=i,l=n;for(hi(e,t,i,r),t[2*n+a]>s&&hi(e,t,i,n);o<l;){for(hi(e,t,o,l),o++,l--;t[2*o+a]<s;)o++;for(;t[2*l+a]>s;)l--}t[2*i+a]===s?hi(e,t,i,l):(l++,hi(e,t,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function hi(e,t,r,i){Vs(e,r,i),Vs(t,2*r,2*i),Vs(t,2*r+1,2*i+1)}function Vs(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function Fh(e,t,r,i){let n=e-r,a=t-i;return n*n+a*a}const Os={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e};var K1=class{constructor(e){this.options=Object.assign(Object.create(Os),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){let t=[];for(let r of e){if(!r.geometry)continue;let[i,n]=r.geometry.coordinates,[a,s]=[or(i),lr(n)],o={id:r.id,type:"Point",geometry:[a,s],tags:r.properties};t.push(o)}this.createIndex(t)}initialize(e){let t=[];for(let r of e)r.type==="Point"&&t.push(r);this.createIndex(t)}updateIndex(e,t,r){this.options=Object.assign(Object.create(Os),r.clusterOptions),this.initialize(e)}createIndex(e){let{log:t,minZoom:r,maxZoom:i}=this.options;t&&console.time("total time");let n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;let a=[];for(let o=0;o<e.length;o++){let l=e[o];if(!(l!=null&&l.geometry))continue;let[u,h]=l.geometry;u=Math.fround(u),h=Math.fround(h),a.push(u,h,1/0,o,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this.createTree(a);t&&console.timeEnd(n);for(let o=i;o>=r;o--){let l=Date.now();s=this.trees[o]=this.createTree(this.cluster(s,o)),t&&console.log("z%d: %d clusters in %dms",o,s.numItems,Date.now()-l)}t&&console.timeEnd("total time")}getClusters(e,t){return this.getClustersInternal(e,t).map(r=>dn(r))}getClustersInternal(e,t){let r=((e[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,e[1])),n=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)r=-180,n=180;else if(r>n){let h=this.getClustersInternal([r,i,180,a],t),c=this.getClustersInternal([-180,i,n,a],t);return h.concat(c)}let s=this.trees[this.limitZoom(t)],o=s.range(or(r),lr(a),or(n),lr(i)),l=s.flatData,u=[];for(let h of o){let c=this.stride*h;u.push(l[c+5]>1?J1(l,c,this.clusterProps):this.points[l[c+3]])}return u}getChildren(e){let t=this.getOriginId(e),r=this.getOriginZoom(e),i=Error("No cluster with the specified id: "+e),n=this.trees[r];if(!n)throw i;let a=n.flatData;if(t*this.stride>=a.length)throw i;let s=this.options.radius/(this.options.extent*2**(r-1)),o=a[t*this.stride],l=a[t*this.stride+1],u=n.within(o,l,s),h=[];for(let c of u){let p=c*this.stride;a[p+4]===e&&h.push(a[p+5]>1?Q1(a,p,this.clusterProps):dn(this.points[a[p+3]]))}if(h.length===0)throw i;return h}getLeaves(e,t,r){t||(t=10),r||(r=0);let i=[];return this.appendLeaves(i,e,t,r,0),i}getTile(e,t,r){let i=this.trees[this.limitZoom(e)];if(!i)return null;let n=2**e,{extent:a,radius:s}=this.options,o=s/a,l=(r-o)/n,u=(r+1+o)/n,h={transformed:!0,features:[],source:null,x:t,y:r,z:e};return this.addTileFeatures(i.range((t-o)/n,l,(t+1+o)/n,u),i.flatData,t,r,n,h),t===0&&this.addTileFeatures(i.range(1-o/n,l,1,u),i.flatData,n,r,n,h),t===n-1&&this.addTileFeatures(i.range(0,l,o/n,u),i.flatData,-1,r,n,h),h}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,t,r,i,n){let a=this.getChildren(t);for(let s of a){let o=s.properties;if(o!=null&&o.cluster?n+o.point_count<=i?n+=o.point_count:n=this.appendLeaves(e,o.cluster_id,r,i,n):n<i?n++:e.push(s),e.length===r)break}return n}createTree(e){let t=new H1(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<e.length;r+=this.stride)t.add(e[r],e[r+1]);return t.finish(),t.flatData=e,t.data=null,t}addTileFeatures(e,t,r,i,n,a){for(let s of e){let o=s*this.stride,l=t[o+5]>1,u,h,c;if(l)u=$s(t,o,this.clusterProps),h=t[o],c=t[o+1];else{let d=this.points[t[o+3]];u=d.tags,[h,c]=d.geometry}let p={type:1,geometry:[[Math.round(this.options.extent*(h*n-r)),Math.round(this.options.extent*(c*n-i))]],tags:u},f;f=l||this.options.generateId?t[o+3]:this.points[t[o+3]].id,f!==void 0&&(p.id=f),a.features.push(p)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,t){let{radius:r,extent:i,reduce:n,minPoints:a}=this.options,s=r/(i*2**t),o=e.flatData,l=[],u=this.stride;for(let h=0;h<o.length;h+=u){if(o[h+2]<=t)continue;o[h+2]=t;let c=o[h],p=o[h+1],f=e.within(o[h],o[h+1],s),d=o[h+5],y=d;for(let m of f){let g=m*u;o[g+2]>t&&(y+=o[g+5])}if(y>d&&y>=a){let m=c*d,g=p*d,x,v=-1,b=((h/u|0)<<5)+(t+1)+this.points.length;for(let _ of f){let A=_*u;if(o[A+2]<=t)continue;o[A+2]=t;let S=o[A+5];m+=o[A]*S,g+=o[A+1]*S,o[A+4]=b,n&&(x||(x=this.map(o,h,!0),v=this.clusterProps.length,this.clusterProps.push(x)),n(x,this.map(o,A)))}o[h+4]=b,l.push(m/y,g/y,1/0,b,-1,y),n&&l.push(v)}else{for(let m=0;m<u;m++)l.push(o[h+m]);if(y>1)for(let m of f){let g=m*u;if(!(o[g+2]<=t)){o[g+2]=t;for(let x=0;x<u;x++)l.push(o[g+x])}}}}return l}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,t,r){if(e[t+5]>1){let a=this.clusterProps[e[t+6]];return r?Object.assign({},a):a}let i=this.points[e[t+3]].tags,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}};function J1(e,t,r){return{id:e[t+3],type:"Point",tags:$s(e,t,r),geometry:[e[t],e[t+1]]}}function Q1(e,t,r){return{type:"Feature",id:e[t+3],properties:$s(e,t,r),geometry:{type:"Point",coordinates:[_h(e[t]),Sh(e[t+1])]}}}function $s(e,t,r){let i=e[t+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,a=e[t+6],s=a===-1?{}:Object.assign({},r[a]);return Object.assign(s,{cluster:!0,cluster_id:e[t+3],point_count:i,point_count_abbreviated:n})}const Ch="geojsonvt_clip_start",Bh="geojsonvt_clip_end";function Ph(e,t,r,i,n){let a=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),s={transformed:!1,features:[],source:null,x:r,y:i,z:t,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:e.length};for(let o of e)e0(s,o,a,n);return s}function e0(e,t,r,i){switch(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),t.type){case"Point":case"MultiPoint":t0(e,t);return;case"LineString":r0(e,t,r,i);return;case"MultiLineString":case"Polygon":i0(e,t,r);return;case"MultiPolygon":n0(e,t,r);return}}function t0(e,t){let r=[];for(let n=0;n<t.geometry.length;n+=3)r.push(t.geometry[n],t.geometry[n+1]),e.numPoints++,e.numSimplified++;if(!r.length)return;let i={type:1,tags:t.tags||null,geometry:r};t.id!==null&&(i.id=t.id),e.features.push(i)}function r0(e,t,r,i){let n=[];if(Rs(n,t.geometry,e,r,!1,!1),!n.length)return;let a=t.tags||null;if(i.lineMetrics){a={};for(let o in t.tags)a[o]=t.tags[o];a[Ch]=t.geometry.start/t.geometry.size,a[Bh]=t.geometry.end/t.geometry.size}let s={type:2,tags:a,geometry:n};t.id!==null&&(s.id=t.id),e.features.push(s)}function i0(e,t,r){let i=[];for(let a=0;a<t.geometry.length;a++)Rs(i,t.geometry[a],e,r,t.type==="Polygon",a===0);if(!i.length)return;let n={type:t.type==="Polygon"?3:2,tags:t.tags||null,geometry:i};t.id!==null&&(n.id=t.id),e.features.push(n)}function n0(e,t,r){let i=[];for(let a=0;a<t.geometry.length;a++){let s=t.geometry[a];for(let o=0;o<s.length;o++)Rs(i,s[o],e,r,!0,o===0)}if(!i.length)return;let n={type:3,tags:t.tags||null,geometry:i};t.id!==null&&(n.id=t.id),e.features.push(n)}function Rs(e,t,r,i,n,a){let s=i*i;if(i>0&&t.size<(n?s:i)){r.numPoints+=t.points.length/3;return}let o=[];for(let l=0;l<t.points.length;l+=3)(i===0||t.points[l+2]>s)&&(r.numSimplified++,o.push(t.points[l],t.points[l+1])),r.numPoints++;n&&a0(o,a),e.push(o)}function a0(e,t){let r=0;for(let i=0,n=e.length,a=n-2;i<n;a=i,i+=2)r+=(e[i]-e[a])*(e[i+1]+e[a+1]);if(r>0===t)for(let i=0,n=e.length;i<n/2;i+=2){let a=e[i],s=e[i+1];e[i]=e[n-2-i],e[i+1]=e[n-1-i],e[n-2-i]=a,e[n-1-i]=s}}function Mh(e,t){if(e.transformed)return e;let r=1<<e.z,i=e.x,n=e.y;for(let a of e.features)a.type===1?s0(a,t,r,i,n):o0(a,t,r,i,n);return e.transformed=!0,e}function s0(e,t,r,i,n){let a=e,s=e.geometry,o=[];for(let l=0;l<s.length;l+=2)o.push(zh(s[l],s[l+1],t,r,i,n));return a.geometry=o,a}function o0(e,t,r,i,n){let a=e,s=e.geometry,o=[];for(let l of s){let u=[];for(let h=0;h<l.length;h+=2)u.push(zh(l[h],l[h+1],t,r,i,n));o.push(u)}return a.geometry=o,a}function zh(e,t,r,i,n,a){return[Math.round(r*(e*i-n)),Math.round(r*(t*i-a))]}var l0=class{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.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)))}updateIndex(e,t,r){r.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(t),r.debug>1&&console.timeEnd("invalidating");let[i,n,a]=[0,0,0],s=Ph(e,i,n,a,r);s.source=e;let o=mn(i,n,a);if(this.tiles[o]=s,this.tileCoords.push({z:i,x:n,y:a,id:o}),r.debug){let l=`z${i}`;this.stats[l]=(this.stats[l]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,t,r){return null}getTile(e,t,r){let{extent:i,debug:n}=this.options,a=1<<e;t=t+a&a-1;let s=mn(e,t,r);if(this.tiles[s])return Mh(this.tiles[s],i);n>1&&console.log("drilling down to z%d-%d-%d",e,t,r);let o=e,l=t,u=r,h;for(;!h&&o>0;)o--,l>>=1,u>>=1,h=this.tiles[mn(o,l,u)];return!(h!=null&&h.source)||(n>1&&(console.log("found parent tile z%d-%d-%d",o,l,u),console.time("drilling down")),this.splitTile(h.source,o,l,u,e,t,r),n>1&&console.timeEnd("drilling down"),!this.tiles[s])?null:Mh(this.tiles[s],i)}splitTile(e,t,r,i,n,a,s){let o=[e,t,r,i],l=this.options,u=l.debug;for(;o.length;){i=o.pop(),r=o.pop(),t=o.pop(),e=o.pop();let h=1<<t,c=mn(t,r,i),p=this.tiles[c];if(!p&&(u>1&&console.time("creation"),p=this.tiles[c]=Ph(e,t,r,i,l),this.tileCoords.push({z:t,x:r,y:i,id:c}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let S=`z${t}`;this.stats[S]=(this.stats[S]||0)+1,this.total++}if(p.source=e,n==null){if(t===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(n!=null){let S=n-t;if(r!==a>>S||i!==s>>S)continue}}if(p.source=null,!e.length)continue;u>1&&console.time("clipping");let f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f,g=null,x=null,v=null,b=null,_=ot(e,h,r-f,r+y,0,p.minX,p.maxX,l),A=ot(e,h,r+d,r+m,0,p.minX,p.maxX,l);_&&(g=ot(_,h,i-f,i+y,1,p.minY,p.maxY,l),x=ot(_,h,i+d,i+m,1,p.minY,p.maxY,l)),A&&(v=ot(A,h,i-f,i+y,1,p.minY,p.maxY,l),b=ot(A,h,i+d,i+m,1,p.minY,p.maxY,l)),u>1&&console.timeEnd("clipping"),o.push(g||[],t+1,r*2,i*2),o.push(x||[],t+1,r*2,i*2+1),o.push(v||[],t+1,r*2+1,i*2),o.push(b||[],t+1,r*2+1,i*2+1)}}invalidateTiles(e){if(!e.length)return;let t=this.options,{debug:r}=t,i=1/0,n=-1/0,a=1/0,s=-1/0;for(let u of e)i=Math.min(i,u.minX),n=Math.max(n,u.maxX),a=Math.min(a,u.minY),s=Math.max(s,u.maxY);let o=t.buffer/t.extent,l=new Set;for(let u in this.tiles){let h=this.tiles[u],c=1<<h.z,p=(h.x-o)/c,f=(h.x+1+o)/c,d=(h.y-o)/c,y=(h.y+1+o)/c;if(n<p||i>=f||s<d||a>=y)continue;let m=!1;for(let g of e)if(g.maxX>=p&&g.minX<f&&g.maxY>=d&&g.minY<y){m=!0;break}if(m){if(r){r>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",h.z,h.x,h.y,h.numFeatures,h.numPoints,h.numSimplified);let g=`z${h.z}`;this.stats[g]=(this.stats[g]||0)-1,this.total--}delete this.tiles[u],l.add(u)}}l.size&&(this.tileCoords=this.tileCoords.filter(u=>!l.has(u.id)))}};function mn(e,t,r){return((1<<e)*r+t)*32+e}const u0={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:Os,debug:0};var h0=class{constructor(e,t){t=this.options=Object.assign({},u0,t);let r=t.debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw Error("promoteId and generateId cannot be used together.");let i=Fs(e,t);r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles")),i=Ms(i,t),t.updateable&&(this.source=i),this.initializeIndex(i,t)}initializeIndex(e,t){this.tileIndex=t.cluster?new K1(t.clusterOptions):new l0(t),e.length&&this.tileIndex.initialize(e)}getTile(e,t,r){return e=+e,t=+t,r=+r,e<0||e>24?null:this.tileIndex.getTile(e,t,r)}updateData(e,t){let r=this.options;if(!r.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:i,source:n}=X1(this.source,e,r);t&&({affected:i,source:n}=this.filterUpdate(n,i,t)),i.length&&(this.source=n,this.tileIndex.updateIndex(n,i,r))}filterUpdate(e,t,r){let i=new Set;for(let n of e)n.id!=null&&(r(dn(n))||(t.push(n),i.add(n.id)));return e=e.filter(n=>!i.has(n.id)),{affected:t,source:e}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return L1(this.source)}updateClusterOptions(e,t){let r=this.options.cluster;if(this.options.cluster=e,this.options.clusterOptions=t,r==e){this.tileIndex.updateIndex(this.source,[],this.options);return}this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(e){return this.tileIndex.getClusterExpansionZoom(e)}getClusterChildren(e){return this.tileIndex.getChildren(e)}getClusterLeaves(e,t,r){return this.tileIndex.getLeaves(e,t,r)}};const c0=he([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),p0=c0.members,f0=he([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),d0=f0.members,y0=Math.cos(75/2*(Math.PI/180)),Lh=1/2,Vh=2**14/Lh;var Ns=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let t of this.layers)this.gradients[t.id]={};this.layoutVertexArray=new Sm,this.layoutVertexArray2=new Am,this.indexArray=new Wr,this.programConfigurations=new Ft(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,r){this.hasDependencies=on("line",this.layers,t)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),a=[],s=new W(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of e){let p=nr(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Ct(l),patterns:{},dashes:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;this.hasDependencies?(on("line",this.layers,t)?ps("line",this.layers,l,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,t),this.patternFeatures.push(l)):this.addFeature(l,u,h,r,{},{},t.subdivisionGranularity);let p=e[h].feature;t.featureIndex.insert(p,u,h,c,this.index)}}update(e,t,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures(e,t,r,i){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,r,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,d0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,p0),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.hasOwn(e.properties,"geojsonvt_clip_start")&&Object.hasOwn(e.properties,"geojsonvt_clip_end"))return{start:+e.properties[Ch],end:+e.properties[Bh]}}addFeature(e,t,r,i,n,a,s){let o=this.layers[0].layout,l=o.get("line-join").evaluate(e,{}),u=o.get("line-cap").evaluate(e,{}),h=o.get("line-miter-limit").evaluate(e,{}),c=o.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let p of t)this.addLine(p,e,l,u,h,c,i,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,dashPositions:a,canonical:i})}addLine(e,t,r,i,n,a,s,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=s?o.line.getGranularityForZoomLevel(s.z):1;if(e=Mt(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=si.types[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-c<(u?3:2))return;r==="bevel"&&(n=1.05);let p=this.overscaling<=16?15*ne/(512*this.overscaling):0,f=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),d,y,m,g,x;this.e1=this.e2=-1,u&&(d=e[h-2],x=e[c].sub(d)._unit()._perp());for(let v=c;v<h;v++){if(m=v===h-1?u?e[c+1]:void 0:e[v+1],m&&e[v].equals(m))continue;x&&(g=x),d&&(y=d),d=e[v],x=m?m.sub(d)._unit()._perp():g,g||(g=x);let b=g.add(x);(b.x!==0||b.y!==0)&&b._unit();let _=g.x*x.x+g.y*x.y,A=b.x*x.x+b.y*x.y,S=A===0?1/0:1/A,E=2*Math.sqrt(2-2*A),T=A<y0&&y&&m,z=g.x*x.y-g.y*x.x>0;if(T&&v>c){let L=d.dist(y);if(L>2*p){let I=d.sub(d.sub(y)._mult(p/L)._round());this.updateDistance(y,I),this.addCurrentVertex(I,g,0,0,f),y=I}}let O=y&&m,P=O?r:u?"butt":i;if(O&&P==="round"&&(S<a?P="miter":S<=2&&(P="fakeround")),P==="miter"&&S>n&&(P="bevel"),P==="bevel"&&(S>2&&(P="flipbevel"),S<n&&(P="miter")),y&&this.updateDistance(y,d),P==="miter")b._mult(S),this.addCurrentVertex(d,b,0,0,f);else if(P==="flipbevel"){if(S>100)b=x.mult(-1);else{let L=S*g.add(x).mag()/g.sub(x).mag();b._perp()._mult(L*(z?-1:1))}this.addCurrentVertex(d,b,0,0,f),this.addCurrentVertex(d,b.mult(-1),0,0,f)}else if(P==="bevel"||P==="fakeround"){let L=-Math.sqrt(S*S-1),I=z?L:0,$=z?0:L;if(y&&this.addCurrentVertex(d,g,I,$,f),P==="fakeround"){let R=Math.round(E*180/Math.PI/20);for(let F=1;F<R;F++){let N=F/R;if(N!==.5){let le=N-.5,ue=1.0904+_*(-3.2452+_*(3.55645-_*1.43519)),De=.848013+_*(-1.06021+_*.215638);N+=N*le*(N-1)*(ue*le*le+De)}let K=x.sub(g)._mult(N)._add(g)._unit()._mult(z?-1:1);this.addHalfVertex(d,K.x,K.y,!1,z,0,f)}}m&&this.addCurrentVertex(d,x,-I,-$,f)}else if(P==="butt")this.addCurrentVertex(d,b,0,0,f);else if(P==="square"){let L=y?1:-1;this.addCurrentVertex(d,b,L,L,f)}else P==="round"&&(y&&(this.addCurrentVertex(d,g,0,0,f),this.addCurrentVertex(d,g,1,1,f,!0)),m&&(this.addCurrentVertex(d,x,-1,-1,f,!0),this.addCurrentVertex(d,x,0,0,f)));if(T&&v<h-1){let L=d.dist(m);if(L>2*p){let I=d.add(m.sub(d)._mult(p/L)._round());this.updateDistance(d,I),this.addCurrentVertex(I,x,0,0,f),d=I}}}}addCurrentVertex(e,t,r,i,n,a=!1){let s=t.x+t.y*r,o=t.y-t.x*r,l=-t.x+t.y*i,u=-t.y-t.x*i;this.addHalfVertex(e,s,o,a,!1,r,n),this.addHalfVertex(e,l,u,a,!0,-i,n),this.distance>Vh/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,r,i,n,a))}addHalfVertex({x:e,y:t},r,i,n,a,s,o){let l=(this.lineClips?this.scaledDistance*(Vh-1):this.scaledDistance)*Lh;if(this.layoutVertexArray.emplaceBack((e<<1)+ +!!n,(t<<1)+ +!!a,Math.round(63*r)+128,Math.round(63*i)+128,(s===0?0:s<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.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()}hasLineDasharray(e){for(let t of e){let r=t.paint.get("line-dasharray");if(r&&!r.isConstant())return!0}return!1}addLineDashDependencies(e,t,r,i){for(let n of e){let a=n.paint.get("line-dasharray");if(!a||a.value.kind==="constant")continue;let s=n.layout.get("line-cap").evaluate(t,{})==="round",o={dasharray:a.value.evaluate({zoom:r-1},t,{}),round:s},l={dasharray:a.value.evaluate({zoom:r},t,{}),round:s},u={dasharray:a.value.evaluate({zoom:r+1},t,{}),round:s},h=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,p=`${u.dasharray.join(",")},${u.round}`;i.dashDependencies[h]=o,i.dashDependencies[c]=l,i.dashDependencies[p]=u,t.dashes[n.id]={min:h,mid:c,max:p}}}};C("LineBucket",Ns,{omit:["layers","patternFeatures"]});let m0;const g0=()=>m0||(m0=new Ee({"line-cap":new V(w.layout_line["line-cap"],"line-cap"),"line-join":new V(w.layout_line["line-join"],"line-join"),"line-miter-limit":new V(w.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new V(w.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new V(w.layout_line["line-sort-key"],"line-sort-key")}));let x0;const v0=()=>x0||(x0=new Ee({"line-opacity":new V(w.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new M(w.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new V(w.paint_line["line-color"],"line-color"),"line-translate":new M(w.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new M(w.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new V(w.paint_line["line-width"],"line-width"),"line-gap-width":new V(w.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new V(w.paint_line["line-offset"],"line-offset"),"line-blur":new V(w.paint_line["line-blur"],"line-blur"),"line-dasharray":new jr(w.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new jr(w.paint_line["line-pattern"],"line-pattern"),"line-gradient":new en(w.paint_line["line-gradient"],"line-gradient")}));var Oh={get paint(){return v0()},get layout(){return g0()}},b0=class extends V{possiblyEvaluate(e,t){return t=new W(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,i){return t=ke({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,i)}};let gn;var w0=class extends Ge{constructor(e,t){super(e,Oh,t),this.gradientVersion=0,gn||(gn=new b0(Oh.paint.properties["line-width"].specification,"line-floorwidth"),gn.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();this.stepInterpolant=vy(t)?t._styleExpression.expression instanceof Qn:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=gn.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Ns(e)}queryRadius(e){let t=e,r=$h(sr("line-width",this,t),sr("line-gap-width",this,t)),i=sr("line-offset",this,t);return r/2+Math.abs(i)+an(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a}){let s=sn(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),o=a/2*$h(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),l=this.paint.get("line-offset").evaluate(t,r);return l&&(i=Xm(i,l*a)),Nm(s,i,o)}isTileClipped(){return!0}};function $h(e,t){return t>0?t+2*e:e}const _0=he([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),S0=he([{name:"a_projected_pos",components:3,type:"Float32"}],4);he([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const A0=he([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);he([{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"}]);const Rh=he([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);he([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),he([{name:"triangle",components:3,type:"Uint16"}]),he([{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"},{type:"Float32",name:"heightOffset"}]),he([{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"},{type:"Float32",name:"heightOffset"}]),he([{type:"Float32",name:"offsetX"}]),he([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),he([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);function D0(e,t,r){let i=t.layout.get("text-transform").evaluate(r,{});return i==="uppercase"?e=e.toLocaleUpperCase():i==="lowercase"&&(e=e.toLocaleLowerCase()),at.applyArabicShaping&&(e=at.applyArabicShaping(e)),e}function E0(e,t,r){for(let i of e.sections)i.text=D0(i.text,t,r);return e}function T0(e){let t={},r={},i=[],n=0;function a(u){i.push(e[u]),n++}function s(u,h,c){let p=r[u];return delete r[u],r[h]=p,i[p].geometry[0].pop(),i[p].geometry[0]=i[p].geometry[0].concat(c[0]),p}function o(u,h,c){let p=t[h];return delete t[h],t[u]=p,i[p].geometry[0].shift(),i[p].geometry[0]=c[0].concat(i[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return`${u}:${p.x}:${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 f=l(p,c),d=l(p,c,!0);if(f in r&&d in t&&r[f]!==t[d]){let y=o(f,d,c),m=s(f,d,i[y].geometry);delete t[f],delete r[d],r[l(p,i[m].geometry,!0)]=m,i[y].geometry=null}else f in r?s(f,d,c):d in t?o(f,d,c):(a(u),t[f]=n-1,r[d]=n-1)}return i.filter(u=>u.geometry)}const Nh=typeof Intl<"u"&&"Segmenter"in Intl,Uh=Nh?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null,qh=Nh?new Intl.Segmenter(void 0,{granularity:"word"}):null;function Gh(e){if(!Uh||!em(e))return[...e];let t=[];for(let{segment:r}of Uh.segment(e)){let i=t.length-1;i>=0&&tm(t[i],r)?t[i]+=r:t.push(r)}return t}function I0(e){let t=new Set;if(qh){for(let{index:i}of qh.segment(e))t.add(i);return t}let r=0;for(let i of e.split(new RegExp("\\b|(?=\\p{Ideo})","u")))t.add(r),r+=i.length;return t}function jh(e){let t=e.codePointAt(0);return e.length>(t>65535?2:1)}const hr={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function k0(e){let t="",r={premature:!0,value:void 0},i=e[Symbol.iterator](),n=i.next(),a=e[Symbol.iterator]();a.next();let s=a.next();for(;!n.done;)(s.done||!fu(s.value.codePointAt(0))||hr[s.value])&&(r.premature||!fu(r.value.codePointAt(0))||hr[r.value])&&hr[n.value]?t+=hr[n.value]:t+=n.value,r={value:n.value,premature:!1},n=i.next(),s=a.next();return t}const F0={10:!0,13:!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},C0={40:!0};function Yh(e,t,r,i,n,a){if("fontStack"in t){let s=r[t.fontStack],o=s==null?void 0:s[e];if(o)return o.metrics.advance*t.scale+n;let l=0;for(let u of e){let h=s==null?void 0:s[u];h&&(l+=h.metrics.advance*t.scale+n)}return l}{let s=i[t.imageName];return s?s.displaySize[0]*t.scale*24/a+n:0}}function Xh(e,t,r,i){let n=(e-t)**2;return i?e<t?n/2:n*2:n+Math.abs(r)*r}function Zh(e){return/^\s+$/u.test(e)}function B0(e,t,r){let i=0;return(e===10||e===13)&&(i-=1e4),r&&(i+=150),(e===40||e===65288)&&(i+=50),(t===41||t===65289)&&(i+=50),i}function Wh(e,t,r,i,n,a){let s=null,o=Xh(t,r,n,a);for(let l of i){let u=Xh(t-l.x,r,n,a)+l.badness;u<=o&&(s=l,o=u)}return{index:e,x:t,priorBreak:s,badness:o}}function Hh(e){return e?Hh(e.priorBreak).concat(e.index):[]}var Us=class ko{constructor(t="",r=[],i=[]){this.text=t,this.sections=r,this.sectionIndex=i,this.imageSectionID=null,this._graphemes=null}graphemes(){return this._graphemes??(this._graphemes=Gh(this.text)),this._graphemes}static fromFeature(t,r){let i=new ko;for(let n of t.sections)n.image?i.addImageSection(n):i.addTextSection(n,r);return i}length(){return this.graphemes().length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=k0(this.text),this._graphemes=null}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){let t=this.graphemes(),r=0;for(;r<t.length&&Zh(t[r]);)r++;let i=t.length;for(;i>r&&Zh(t[i-1]);)i--;this.text=t.slice(r,i).join(""),this.sectionIndex=this.sectionIndex.slice(r,i),this._graphemes=null}substring(t,r){let i=this.graphemes().slice(t,r).join(""),n=this.sectionIndex.slice(t,r);return new ko(i,this.sections,n)}toCodeUnitIndex(t){return this.graphemes().slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}getMaxImageSize(t){let r=0,i=0;for(let n=0;n<this.length();n++){let a=this.getSection(n);if("imageName"in a){let s=t[a.imageName];if(!s)continue;let o=s.displaySize;r=Math.max(r,o[0]),i=Math.max(i,o[1])}}return{maxImageWidth:r,maxImageHeight:i}}_appendSection(t,r){let i=this.graphemes(),n=i.length>0?i[i.length-1]:"",a=Gh(n+t);this.text+=t,this._graphemes=i.slice(0,n?-1:void 0).concat(a);let s=a.length-+!!n;for(let o=0;o<s;o++)this.sectionIndex.push(r)}addTextSection(t,r){this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||r}),this._appendSection(t.text,this.sections.length-1)}addImageSection(t){let r=t.image?t.image.name:"";if(r.length===0){ge("Can't add FormattedSection with an empty image.");return}let i=this.getNextImageSectionCharCode();if(!i){ge("Reached maximum number of images 6401");return}this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:r}),this._appendSection(String.fromCharCode(i),this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,r,i,n,a){let s=[],o=this.determineAverageLineWidth(t,r,i,n,a),l=this.hasZeroWidthSpaces(),u=this.graphemes(),h=null,c=0,p=0;for(let f=0;f<u.length;f++){let d=u[f];if(f>0){let y=u[f-1].codePointAt(0),m=d.codePointAt(0),g=Ky(y),x=cu(y)&&cu(m);(F0[y]||g||"imageName"in this.getSection(f-1)||u[f+1]!==void 0&&C0[m]||x&&(h??(h=I0(this.text))).has(p))&&s.push(Wh(f,c,o,s,B0(y,m,g&&l),!1))}Ta(d.codePointAt(0))||(c+=Yh(d,this.getSection(f),i,n,t,a)),p+=d.length}return Hh(Wh(this.length(),c,o,s,0,!0))}determineAverageLineWidth(t,r,i,n,a){let s=0,o=0;for(let u of this.graphemes()){let h=this.getSection(o);s+=Yh(u,h,i,n,t,a),o++}let l=Math.max(1,Math.ceil(s/r));return s/l}};const qs=4294967296,Kh=1/qs,Jh=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");var Qh=class{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,r=this.length){let i;for(;i=this.nextField(r);)e(i,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*qs;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*qs;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t=this.buf,r=t[this.pos++];if(r<128)return r;let i=r&127,n;return n=t[this.pos++],i|=(n&127)<<7,n<128||(n=t[this.pos++],i|=(n&127)<<14,n<128)||(n=t[this.pos++],i|=(n&127)<<21,n<128)?i:(n=t[this.pos],i|=(n&15)<<28,M0(i,e,this))}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Jh?Jh.decode(this.buf.subarray(t,e)):Z0(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;let t=this.readVarint();return this.type=t&7,this._valueStart=this.pos,t>>>3}skip(e){let t=e&7;if(t===0)for(;this.buf[this.pos++]>127;);else if(t===2)this.pos=this.readVarint()+this.pos;else if(t===5)this.pos+=4;else if(t===1)this.pos+=8;else throw Error(`Unimplemented type: ${t}`)}},P0=class{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){let r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.dataView=new DataView(r.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Kh),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Kh),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>=0&&e<128){this.pos>=this.length&&this.realloc(1),this.buf[this.pos++]=e;return}if(e>268435455||e<0){L0(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;let t=this.pos;this.pos=W0(this.buf,e,this.pos);let r=this.pos-t;r>=128&&ec(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let t=e.length;this.writeVarint(t),this.realloc(t),this.buf.set(e,this.pos),this.pos+=t}writeRawMessage(e,t){this.pos++;let r=this.pos;e(t,this);let i=this.pos-r;i>=128&&ec(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(e,t,r){this.writeTag(e,2),this.writeRawMessage(t,r)}writePackedVarint(e,t){t.length&&this.writeMessage(e,$0,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,R0,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,q0,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,N0,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,U0,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,G0,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,j0,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Y0,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,X0,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}};function M0(e,t,r){let i=r.buf,n,a;if(a=i[r.pos++],n=(a&112)>>4,a<128||(a=i[r.pos++],n|=(a&127)<<3,a<128)||(a=i[r.pos++],n|=(a&127)<<10,a<128)||(a=i[r.pos++],n|=(a&127)<<17,a<128)||(a=i[r.pos++],n|=(a&127)<<24,a<128)||(a=i[r.pos++],n|=(a&1)<<31,a<128))return z0(e,n,t);throw Error("Expected varint not more than 10 bytes")}function z0(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function L0(e,t){let r,i;if(e>=0?(r=e%4294967296|0,i=e/4294967296|0):(r=~(-e%4294967296),i=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");t.realloc(10),V0(r,i,t),O0(i,t)}function V0(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function O0(e,t){let r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function ec(e,t,r){let i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(i),r.buf.copyWithin(e+i,e,r.pos)}function $0(e,t){let r=e.length,i=t.buf,n=t.pos,a=t.length;for(let s=0;s<r;s++){let o=e[s];if(o<0||n+10>a){t.pos=n,t.writeVarint(o),i=t.buf,n=t.pos,a=t.length;continue}for(;o>127;)i[n++]=o%128|128,o=Math.floor(o/128);i[n++]=o}t.pos=n}function R0(e,t){for(let r=0;r<e.length;r++)t.writeSVarint(e[r])}function N0(e,t){for(let r=0;r<e.length;r++)t.writeFloat(e[r])}function U0(e,t){for(let r=0;r<e.length;r++)t.writeDouble(e[r])}function q0(e,t){for(let r=0;r<e.length;r++)t.writeBoolean(e[r])}function G0(e,t){for(let r=0;r<e.length;r++)t.writeFixed32(e[r])}function j0(e,t){for(let r=0;r<e.length;r++)t.writeSFixed32(e[r])}function Y0(e,t){for(let r=0;r<e.length;r++)t.writeFixed64(e[r])}function X0(e,t){for(let r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Z0(e,t,r){let i="",n=t;for(;n<r;){let a=e[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=e[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=e[n+1],u=e[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=e[n+1],u=e[n+2],h=e[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function W0(e,t,r){for(let i=0,n,a;i<t.length;i++){if(n=t.charCodeAt(i),n>55295&&n<57344)if(a){if(n<56320){e[r++]=239,e[r++]=191,e[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else{n>56319||i+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):a=n;continue}else a&&(a=(e[r++]=239,e[r++]=191,e[r++]=189,null));n<128?e[r++]=n:(n<2048?e[r++]=n>>6|192:(n<65536?e[r++]=n>>12|224:(e[r++]=n>>18|240,e[r++]=n>>12&63|128),e[r++]=n>>6&63|128),e[r++]=n&63|128)}return r}function H0(e){return typeof(e==null?void 0:e.renderWithWebGL)=="function"}function tc(e){let t=0,r=0;for(let s of e)t+=s.w*s.h,r=Math.max(r,s.w);e.sort((s,o)=>o.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],n=0,a=0;for(let s of e)for(let o=i.length-1;o>=0;o--){let l=i[o];if(!(s.w>l.w||s.h>l.h)){if(s.x=l.x,s.y=l.y,a=Math.max(a,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===l.w&&s.h===l.h){let u=i.pop();u&&o<i.length&&(i[o]=u)}else s.h===l.h?(l.x+=s.w,l.w-=s.w):s.w===l.w?(l.y+=s.h,l.h-=s.h):(i.push({x:l.x+s.w,y:l.y,w:l.w-s.w,h:s.h}),l.y+=s.h,l.h-=s.h);break}}return{w:n,h:a,fill:t/(n*a)||0}}var rc=class{constructor(e,{pixelRatio:t,version:r,isWebGLImage:i=!1,stretchX:n,stretchY:a,content:s,textFitWidth:o,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=n,this.stretchY=a,this.content=s,this.version=r,this.needsFirstWebGLRender=i,this.textFitWidth=o,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}},ic=class{constructor(e,t){let r={},i={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let n=[];this.addImages(e,r,n),this.addImages(t,i,n);let{w:a,h:s}=tc(n),o=new Pe({width:a||1,height:s||1});for(let l in e){let u=e[l];if(u.isWebGLImage)continue;let h=r[l].paddedRect;Pe.copy(u.data,o,{x:0,y:0},{x:h.x+1,y:h.y+1},u.data)}for(let l in t){let u=t[l],h=i[l].paddedRect,c=h.x+1,p=h.y+1,f=u.data.width,d=u.data.height;Pe.copy(u.data,o,{x:0,y:0},{x:c,y:p},u.data),Pe.copy(u.data,o,{x:0,y:d-1},{x:c,y:p-1},{width:f,height:1}),Pe.copy(u.data,o,{x:0,y:0},{x:c,y:p+d},{width:f,height:1}),Pe.copy(u.data,o,{x:f-1,y:0},{x:c-1,y:p},{width:1,height:d}),Pe.copy(u.data,o,{x:0,y:0},{x:c+f,y:p},{width:1,height:d})}this.image=o,this.iconPositions=r,this.patternPositions=i}addImages(e,t,r){for(let i in e){let n=e[i],a={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(a),t[i]=new rc(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,t){if(e.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==e.updateVersion){this.patchedUpdateVersion=e.updateVersion;for(let r in this.iconPositions)this.patchUpdatedImage(this.iconPositions[r],e.getImage(r),t);for(let r in this.patternPositions)this.patchUpdatedImage(this.patternPositions[r],e.getImage(r),t)}}patchUpdatedImage(e,t,r){var l;if(!e||!t||!e.needsFirstWebGLRender&&e.version===t.version)return;e.needsFirstWebGLRender=!1,e.version=t.version;let[i,n]=e.tl,a=(l=t.userImage)==null?void 0:l.data;if(!H0(a)){r.update(t.data,void 0,{x:i,y:n});return}let{width:s,height:o}=t.data;r.context.setCustomLayerDefaults(),a.renderWithWebGL({gl:r.context.gl,texture:r.texture,x:i,y:n,width:s,height:o}),r.context.setDirty()}};C("ImagePosition",rc),C("ImageAtlas",ic);var nc=(function(e){return e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e})(nc||{});function K0(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}function J0(e,t){let r=[],i=0;for(let n of t)r.push(e.substring(i,n)),i=n;return i<e.length()&&r.push(e.substring(i,e.length())),r}const ac=new RegExp("^\\p{gc=M}$","u");function Q0(e){let t=[],r=0;for(;r<e.length;){if(!ac.test(e[r])){t.push(r),r++;continue}let i=r;for(;i<e.length&&ac.test(e[i]);)i++;let n=e[i];if(n!==void 0&&ka(n.codePointAt(0))){t.push(i);for(let a=i-1;a>=r;a--)t.push(a);r=i+1}else{for(let a=r;a<i;a++)t.push(a);r=i}}return t}function ex(e){let t=[],r=0;for(let i of e.graphemes())t.push(...Array(i.length).fill(e.sectionIndex[r])),r++;return t}function sc(e,t,r){let i=[...e],n=[],a=0;for(let h of i)n.push(a),a+=h.length;let s=Q0(i),o=new Us(s.map(h=>i[h]).join(""),t,[]),l=s.map(h=>r[n[h]]??0),u=0;for(let h of o.graphemes())o.sectionIndex.push(l[u]??0),u+=[...h].length;return o}function xn(e,t,r,i,n,a,s,o,l,u,h,c,p,f,d){let y=Us.fromFeature(e,n);c===2&&y.verticalizePunctuation();let m,g=y.determineLineBreaks(u,a,t,i,f),{processBidirectionalText:x,processStyledBidirectionalText:v}=at;if(x&&y.sections.length===1){m=[],g=g.map(S=>y.toCodeUnitIndex(S));let A=x(y.toString(),g);for(let S of A)m.push(sc(S,y.sections,[...S].map(()=>0)))}else if(v){m=[],g=g.map(E=>y.toCodeUnitIndex(E));let A=ex(y),S=v(y.text,A,g);for(let E of S)m.push(sc(E[0],y.sections,E[1]))}else m=J0(y,g);let b=[],_={positionedLines:b,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:!1,verticalizable:!1};return ux(_,t,r,i,m,s,o,l,c,u,p,d),!K0(b)&&_}function oc(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function tx(e,t,r){let i=t.getMaxScale()*24,{maxImageWidth:n,maxImageHeight:a}=t.getMaxImageSize(e),s=Math.max(i,a*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:s}}function lc(e){switch(e){case"top":return 0;case"center":return .5;default:return 1}}function rx(e,t,r,i){var a;if(e!=null&&e.rect)return e;let n=(a=t[r.fontStack])==null?void 0:a[i];return n?{rect:null,metrics:n.metrics}:null}function ix(e,t,r){return!(e===1||!t&&!Ki(r)||t&&(Ta(r)||du(r)))}function vn(e){return new RegExp("\\p{Nd}","u").test(String.fromCodePoint(e))}function uc(e){return new RegExp("\\p{Lu}","u").test(String.fromCodePoint(e))}function nx(e){return/[\p{P}\p{S}]/u.test(String.fromCodePoint(e))}function ax(e){let t=e.some(vn)&&e.every(i=>vn(i)||nx(i)),r=e.length<=3&&e.every(i=>uc(i)||vn(i));return t||r}function sx(e){return(vn(e)||uc(e))&&!du(e)}function ox(e,t){let r=!1;for(let i=0;i<e.length;i++){if(t[i])continue;let n=hr[e[i]];n&&(i===0||t[i-1])&&(i===e.length-1||t[i+1])&&(e[i]=n,t[i]=!0,r=!0)}return r}function lx(e){let t=e.graphemes().slice(),r=t.map(a=>a.codePointAt(0)),i=r.map(Ki),n=a=>!i[a]&&!Ta(r[a])&&!("imageName"in e.getSection(a));for(let a=0;a<r.length;a++){if(!n(a))continue;let s=a;for(;s+1<r.length&&n(s+1);)s++;if(ax(r.slice(a,s+1)))for(let o=a;o<=s;o++)i[o]=sx(r[o]);a=s}return ox(t,i)&&(e.text=t.join(""),e._graphemes=null),i}function ux(e,t,r,i,n,a,s,o,l,u,h,c){var _;let p=0,f=0,d=0,y=0,m=o==="right"?1:o==="left"?0:.5,g=24/c,x=0;for(let A of n){A.trim();let S=A.getMaxScale(),E={positionedGlyphs:[],lineOffset:0};e.positionedLines[x]=E;let T=E.positionedGlyphs,z=0;if(!A.length()){f+=a,++x;continue}let O=tx(i,A,g),P=l===2&&!h?lx(A):null,L=A.graphemes();for(let R=0;R<L.length;R++){let F=A.getSection(R),N=L[R],K=N.codePointAt(0),le=P?P[R]:ix(l,h,K),ue="fontStack"in F&&jh(N)&&!((_=t[F.fontStack])!=null&&_[N])?[...N]:[N];for(let De of ue){let Re={glyph:De.codePointAt(0),grapheme:De,imageName:null,x:p,y:f+-17,vertical:le,scale:1,fontStack:"",sectionIndex:A.getSectionIndex(R),metrics:null,rect:null},Xe;if("fontStack"in F){if(Xe=hx(F,De,le,O,t,r),!Xe)continue;Re.fontStack=F.fontStack}else{if(e.iconsInText=!0,F.scale*=g,Xe=cx(F,le,S,O,i),!Xe)continue;z=Math.max(z,Xe.imageOffset),Re.imageName=F.imageName}let{rect:yi,metrics:vt,baselineOffset:vr}=Xe;if(Re.y+=vr,Re.scale=F.scale,Re.metrics=vt,Re.rect=yi,T.push(Re),!le)p+=vt.advance*F.scale+u;else{e.verticalizable=!0;let br="imageName"in F?vt.advance:24;p+=br*F.scale+u}}}if(T.length!==0){let R=p-u;d=Math.max(R,d),px(T,0,T.length-1,m)}p=0;let I=(S-1)*24;E.lineOffset=Math.max(z,I);let $=a*S+z;f+=$,y=Math.max($,y),++x}let{horizontalAlign:v,verticalAlign:b}=oc(s);fx(e.positionedLines,m,v,b,d,y,a,f,n.length),e.top+=-b*f,e.bottom=e.top+f,e.left+=-v*d,e.right=e.left+d}function hx(e,t,r,i,n,a){var u;let s=(u=a[e.fontStack])==null?void 0:u[t],o=rx(s,n,e,t);if(o===null)return null;let l;if(r)l=i.verticalLineContentWidth-e.scale*24;else{let h=lc(e.verticalAlign);l=(i.horizontalLineContentHeight-e.scale*24)*h}return{rect:o.rect,metrics:o.metrics,baselineOffset:l}}function cx(e,t,r,i,n){let a=n[e.imageName];if(!a)return null;let s=a.paddedRect,o=a.displaySize,l={width:o[0],height:o[1],left:1,top:-3,advance:t?o[1]:o[0]},u;if(t)u=i.verticalLineContentWidth-o[1]*e.scale;else{let c=lc(e.verticalAlign);u=(i.horizontalLineContentHeight-o[1]*e.scale)*c}let h=(t?o[0]:o[1])*e.scale-24*r;return{rect:s,metrics:l,baselineOffset:u,imageOffset:h}}function px(e,t,r,i){if(i===0)return;let n=e[r],a=n.metrics.advance*n.scale,s=(e[r].x+a)*i;for(let o=t;o<=r;o++)e[o].x-=s}function fx(e,t,r,i,n,a,s,o,l){let u=(t-r)*n,h=0;h=a===s?-i*l*s+.5*s:-o*i- -17;for(let c of e)for(let p of c.positionedGlyphs)p.x+=u,p.y+=h}function dx(e,t,r){let{horizontalAlign:i,verticalAlign:n}=oc(r),a=t[0],s=t[1],o=a-e.displaySize[0]*i,l=o+e.displaySize[0],u=s-e.displaySize[1]*n;return{image:e,top:u,bottom:u+e.displaySize[1],left:o,right:l}}function hc(e){let t=e.left,r=e.top,i=e.right-t,n=e.bottom-r,a=e.image.content[2]-e.image.content[0],s=e.image.content[3]-e.image.content[1],o=e.image.textFitWidth??"stretchOrShrink",l=e.image.textFitHeight??"stretchOrShrink",u=a/s;if(l==="proportional"){if(o==="stretchOnly"&&i/n<u||o==="proportional"){let h=Math.ceil(n*u);t*=h/i,i=h}}else if(o==="proportional"&&l==="stretchOnly"&&u!==0&&i/n>u){let h=Math.ceil(i/u);r*=h/n,n=h}return{x1:t,y1:r,x2:t+i,y2:r+n}}function cc(e,t,r,i,n,a){let s=e.image,o;if(s.content){let m=s.content,g=s.pixelRatio||1;o=[m[0]/g,m[1]/g,s.displaySize[0]-m[2]/g,s.displaySize[1]-m[3]/g]}let l=t.left*a,u=t.right*a,h,c,p,f;r==="width"||r==="both"?(f=n[0]+l-i[3],c=n[0]+u+i[1]):(f=n[0]+(l+u-s.displaySize[0])/2,c=f+s.displaySize[0]);let d=t.top*a,y=t.bottom*a;return r==="height"||r==="both"?(h=n[1]+d-i[0],p=n[1]+y+i[2]):(h=n[1]+(d+y-s.displaySize[1])/2,p=h+s.displaySize[1]),{image:s,top:h,right:c,bottom:p,left:f,collisionPadding:o}}const pc=32640;function fc(e,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new W(e+1))};if(r.kind==="source")return{kind:"source"};if(r.kind==="composite"){let{minZoom:i,maxZoom:n}=yx(r.zoomStops,e);return{kind:"composite",minZoom:i,maxZoom:n,interpolationType:r.interpolationType}}{let i=mx(r),n=r.evaluate(new W(e+1));return{kind:"camera",zoomStops:r.zoomStops,sizes:i,layoutSize:n,interpolationType:r.interpolationType}}}function yx(e,t){let r=0;for(;r<e.length&&e[r]<=t;)r++;r=Math.max(0,r-1);let i=r;for(;i<e.length&&e[i]<t+1;)i++;return i=Math.min(e.length-1,i),{minZoom:e[r],maxZoom:e[i]}}function mx(e){return e.zoomStops.map(t=>e.evaluate(new W(t===-1/0?e.zoomStops[1]-1:t)))}function dc(e,t,r){let i="never",n=e.get(t);return n?i=n:e.get(r)&&(i="always"),i}const gx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function bn(e,t,r,i,n,a,s,o,l,u,h,c,p,f){let d=o?Math.min(pc,Math.round(o[0])):0,y=o?Math.min(pc,Math.round(o[1])):0;e.emplaceBack(t,r,Math.round(i*32),Math.round(n*32),a,s,(d<<1)+ +!!l,y,u*16,h*16,c*256,p*256,f)}function yc(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function xx(e){for(let t of e.sections)if(om(t.text))return!0;return!1}var Gs=class{constructor(e){this.layoutVertexArray=new Dm,this.indexArray=new Wr,this.programConfigurations=e,this.segments=new Be,this.dynamicLayoutVertexArray=new Em,this.opacityVertexArray=new Tm,this.hasVisibleVertices=!1,this.placedSymbolArray=new Iu}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,_0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,S0.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,gx,!0),this.opacityVertexBuffer.itemSize=1),(r||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())}};C("SymbolBuffers",Gs);var js=class{constructor(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new Be,this.collisionVertexArray=new Im}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,A0.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};C("CollisionBuffers",js);var cr=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(s=>s.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=fc(this.zoom,t["text-size"]),this.iconSizeData=fc(this.zoom,t["icon-size"]);let r=this.layers[0].layout,i=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=dc(r,"text-overlap","text-allow-overlap")!=="never"||dc(r,"icon-overlap","icon-allow-overlap")!=="never"||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!i.isConstant();let a=n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,r.get("symbol-placement")==="point"&&(this.writingModes=r.get("text-writing-mode").map(s=>nc[s])),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id),this.sourceID=e.sourceID}createArrays(){this.text=new Gs(new Ft(this.layers,this.zoom,e=>e.startsWith("text"))),this.icon=new Gs(new Ft(this.layers,this.zoom,e=>e.startsWith("icon"))),this.glyphOffsetArray=new Cu,this.lineVertexArray=new Bu,this.symbolInstances=new Fu,this.textAnchorOffsets=new Mu}calculateGlyphDependencies(e,t,r,i,n){var l;let a=(i||this.allowVerticalPlacement)&&n,s=Us.fromFeature(e,r),o=s.graphemes();for(let u=0;u<o.length;u++){let h=s.getSection(u);if("imageName"in h)continue;let c=t[l=h.fontStack]||(t[l]={}),p=o[u];jh(p)&&(c[p]=!0);for(let f of p){if(c[f]=!0,!a)continue;let d=hr[f];d&&(c[d]=!0)}}}populate(e,t,r){var y;let i=this.layers[0],n=i.layout,a=n.get("text-font"),s=n.get("text-field"),o=n.get("icon-image"),l=(s.value.kind!=="constant"||s.value.value instanceof tt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),u=o.value.kind!=="constant"||!!o.value.value||Object.keys(o.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=t.iconDependencies,p=t.glyphDependencies,f=t.availableImages,d=new W(this.zoom);for(let{feature:m,id:g,index:x,sourceLayerIndex:v}of e){let b=i._featureFilter.needGeometry,_=nr(m,b);if(!i._featureFilter.filter(d,_,r))continue;b||(_.geometry=Ct(m));let A;if(l){let z=i.getValueAndResolveTokens("text-field",_,r,f),O=tt.factory(z);this.hasRTLText||(this.hasRTLText=xx(O)),(!this.hasRTLText||at.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&at.isParsed())&&(A=E0(O,i,_))}let S;if(u){let z=i.getValueAndResolveTokens("icon-image",_,r,f);S=z instanceof Ke?z:Ke.fromString(z)}if(!A&&!S)continue;let E=this.sortFeaturesByKey?h.evaluate(_,{},r):void 0,T={id:g,text:A,icon:S,index:x,sourceLayerIndex:v,geometry:_.geometry,properties:m.properties,type:si.types[m.type],sortKey:E};if(this.features.push(T),S&&(c[S.name]=!0),A){let z=a.evaluate(_,{},r).join(","),O=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=(y=this.writingModes)==null?void 0:y.includes(2);let P=Ia(A.toString());this.calculateGlyphDependencies(A,p,z,O,P);for(let L of A.sections)L.image&&(c[L.image.name]=!0)}}n.get("symbol-placement")==="line"&&(this.features=T0(this.features)),this.sortFeaturesByKey&&this.features.sort((m,g)=>m.sortKey-g.sortKey)}update(e,t,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}))}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 r=this.lineVertexArray.length;if(e.segment!==void 0){let i=e.dist(t[e.segment+1]),n=e.dist(t[e.segment]),a={};for(let s=e.segment+1;s<t.length;s++)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:i},s<t.length-1&&(i+=t[s+1].dist(t[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=t[s-1].dist(t[s]));for(let s=0;s<t.length;s++){let o=a[s];this.lineVertexArray.emplaceBack(o.x,o.y,o.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,t,r,i,n,a,s,o,l,u,h,c,p){let f=e.indexArray,d=e.layoutVertexArray,y=e.segments.prepareSegment(4*t.length,d,f,this.canOverlap?a.sortKey:void 0),m=this.glyphOffsetArray.length,g=y.vertexLength,x=this.allowVerticalPlacement&&s===2?Math.PI/2:0,v=a.text&&a.text.sections;for(let b=0;b<t.length;b++){let{tl:_,tr:A,bl:S,br:E,tex:T,pixelOffsetTL:z,pixelOffsetBR:O,minFontScaleX:P,minFontScaleY:L,glyphOffset:I,isSDF:$,sectionIndex:R}=t[b],F=y.vertexLength,N=I[1];bn(d,o.x,o.y,_.x,N+_.y,T.x,T.y,r,$,z.x,z.y,P,L,p),bn(d,o.x,o.y,A.x,N+A.y,T.x+T.w,T.y,r,$,O.x,z.y,P,L,p),bn(d,o.x,o.y,S.x,N+S.y,T.x,T.y+T.h,r,$,z.x,O.y,P,L,p),bn(d,o.x,o.y,E.x,N+E.y,T.x+T.w,T.y+T.h,r,$,O.x,O.y,P,L,p),yc(e.dynamicLayoutVertexArray,o,x),f.emplaceBack(F,F+2,F+1),f.emplaceBack(F+1,F+2,F+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(I[0]),(b===t.length-1||R!==t[b+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,a,a.index,{imagePositions:{},canonical:c,formattedSection:v==null?void 0:v[R]})}e.placedSymbolArray.emplaceBack(o.x,o.y,m,this.glyphOffsetArray.length-m,g,l,u,o.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,h,p)}_addCollisionDebugVertex(e,t,r,i,n,a){return t.emplaceBack(0,0),e.emplaceBack(r.x,r.y,i,n,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,r,i,n,a,s){let o=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),l=o.vertexLength,u=n.layoutVertexArray,h=n.collisionVertexArray,c=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,h,a,c,p,new B(e,t)),this._addCollisionDebugVertex(u,h,a,c,p,new B(r,t)),this._addCollisionDebugVertex(u,h,a,c,p,new B(r,i)),this._addCollisionDebugVertex(u,h,a,c,p,new B(e,i)),o.vertexLength+=4;let f=n.indexArray;f.emplaceBack(l,l+1),f.emplaceBack(l+1,l+2),f.emplaceBack(l+2,l+3),f.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(e,t,r,i){for(let n=e;n<t;n++){let a=this.collisionBoxArray.get(n),s=a.x1,o=a.y1,l=a.x2,u=a.y2;this.addCollisionDebugVertices(s,o,l,u,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new js(Ou,Rh.members,Ha),this.iconCollisionBox=new js(Ou,Rh.members,Ha);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,r,i,n,a,s,o,l){let u={};for(let h=t;h<r;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=i;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<s;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=o;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 r=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.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 r=e.placedSymbolArray.get(t),i=r.vertexStartIndex+r.numGlyphs*4;for(let n=r.vertexStartIndex;n<i;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),r=Math.cos(e),i=[],n=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let o=this.symbolInstances.get(s);i.push(Math.round(t*o.anchorX+r*o.anchorY)|0),n.push(o.featureIndex)}return a.sort((s,o)=>i[s]-i[o]||n[o]-n[s]),a}addToSortKeyRanges(e,t){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];(r==null?void 0:r.sortKey)===t?r.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 r=this.symbolInstances.get(t);this.featureSortOrder.push(r.featureIndex);let i=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let n=0;n<i.length;n++){let a=i[n];a>=0&&i.indexOf(a)===n&&this.addIndicesForPlacedSymbol(this.text,a)}r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};C("SymbolBucket",cr,{omit:["layers","collisionBoxArray","features","compareText"]}),cr.MAX_GLYPHS=65535,cr.addDynamicAttributes=yc;function vx(e,t){return t.replace(/{([^{}]+)}/g,(r,i)=>e&&i in e?String(e[i]):"")}let bx;const wx=()=>bx||(bx=new Ee({"symbol-placement":new M(w.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new M(w.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new M(w.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new V(w.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new M(w.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new M(w.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new M(w.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new M(w.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new M(w.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new V(w.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new V(w.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new M(w.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new M(w.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new V(w.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new V(w.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new V(w.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new M(w.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new V(w.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new V(w.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new M(w.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new M(w.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new M(w.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new V(w.layout_symbol["text-field"],"text-field"),"text-font":new V(w.layout_symbol["text-font"],"text-font"),"text-size":new V(w.layout_symbol["text-size"],"text-size"),"text-max-width":new V(w.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new M(w.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new V(w.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new V(w.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new V(w.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new M(w.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new V(w.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new V(w.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new M(w.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new M(w.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new V(w.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new M(w.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new M(w.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new V(w.layout_symbol["text-transform"],"text-transform"),"text-offset":new V(w.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new M(w.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new M(w.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new M(w.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new M(w.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new V(w.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new M(w.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")}));let _x;const Sx=()=>_x||(_x=new Ee({"icon-opacity":new V(w.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new V(w.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new V(w.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new V(w.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new V(w.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new M(w.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new M(w.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new V(w.paint_symbol["text-opacity"],"text-opacity"),"text-color":new V(w.paint_symbol["text-color"],"text-color",{runtimeType:qe,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new V(w.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new V(w.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new V(w.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new M(w.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new M(w.paint_symbol["text-translate-anchor"],"text-translate-anchor")}));var Ys={get paint(){return Sx()},get layout(){return wx()}},mc=class{constructor(e){if(e.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Er,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t!=null&&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}};C("FormatSectionOverride",mc,{omit:["defaultValue"]});var Ax=class Fo extends Ge{constructor(t,r){super(t,Ys,r)}recalculate(t,r){super.recalculate(t,r);let i=this.layout.get("icon-rotation-alignment");if((i.value.kind!=="constant"||i.value.value==="auto")&&(this.layout._values["icon-rotation-alignment"]=new Ve(i.property,{kind:"constant",value:this.layout.get("symbol-placement")==="point"?"viewport":"map"},i.parameters)),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")==="point"?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),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").constantOr("viewport")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let a=[];for(let s of n)a.includes(s)||a.push(s);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,i,n){let a=this.layout.get(t).evaluate(r,{},i,n),s=this._unevaluatedLayout._values[t];return!s.isDataDriven()&&!Gi(s.value)&&a?vx(r.properties,a):a}createBucket(t){return new cr(t)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of Ys.paint.overridableProperties){if(!Fo.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),i=new ma(new mc(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),n=null;n=r.value.kind==="constant"||r.value.kind==="source"?new $r("source",i):new ji("composite",i,r.value.zoomStops),this.paint._values[t]=new Ve(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:Fo.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let i=t.get("text-field"),n=Ys.paint.properties[r],a=!1,s=o=>{var l;for(let u of o)if((l=n.overrides)!=null&&l.hasOverride(u)){a=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof tt)s(i.value.value.sections);else if(i.value.kind==="source"||i.value.kind==="composite"){let o=u=>{if(!a)if(u instanceof Zt&&ae(u.value)===Tr){let h=u.value;s(h.sections)}else u instanceof nl?s(u.sections):u.eachChild(o)},l=i.value;l._styleExpression&&o(l._styleExpression.expression)}return a}};function Dx(e,t,r,i=1){var a;let n=(a=e.get("icon-padding").evaluate(t,{},r))==null?void 0:a.values;return[n[0]*i,n[1]*i,n[2]*i,n[3]*i]}let Ex;const Tx=()=>Ex||(Ex=new Ee({"background-color":new M(w.paint_background["background-color"],"background-color"),"background-pattern":new vu(w.paint_background["background-pattern"],"background-pattern"),"background-opacity":new M(w.paint_background["background-opacity"],"background-opacity")}));var Ix={get paint(){return Tx()}},kx=class extends Ge{constructor(e,t){super(e,Ix,t)}},Fx=class extends Ge{constructor(e,t){super(e,{},t),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=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function Cx(e,t){if(e.type==="custom")return new Fx(e,t);switch(e.type){case"background":return new kx(e,t);case"circle":return new ng(e,t);case"color-relief":return new xg(e,t);case"fill":return new Jg(e,t);case"fill-extrusion":return new S1(e,t);case"heatmap":return new hg(e,t);case"hillshade":return new dg(e,t);case"line":return new w0(e,t);case"raster":return new mm(e,t);case"symbol":return new Ax(e,t)}}var Bx=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,(e=this._channel)==null||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};const Px={once:!0};var Mx=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Bx(()=>this.process()),this.subscription=Oo(this.target,"message",r=>this.receive(r),!1),this.globalScope=Gt(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((r,i)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=t?Oo(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),i(new Nn(t.signal.reason))},Px):null;this.resolveRejects[n]={resolve:l=>{a==null||a.unsubscribe(),r(l)},reject:l=>{a==null||a.unsubscribe(),i(l)}};let s=[],o={...e,id:n,sourceMapId:this.mapId,origin:location.origin,data:qr(e.data,s)};this.target.postMessage(o,{transfer:s})})}receive(e){let t=e.data,r=t.id,i=["file://","resource://android","null"],n=[t.origin,location.origin],a=t.origin===location.origin,s=n.some(o=>i.includes(o));if(!(!a&&!s)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];let o=this.abortControllers[r];delete this.abortControllers[r],o&&o.abort();return}if(Gt(self)||t.mustQueue){this.tasks[r]=t,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,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(Si(Gr(t.error))):n.resolve(Gr(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,null,null);return}let r=Gr(t.data),i=new AbortController;this.abortControllers[e]=i;try{let n=await this.messageHandlers[t.type](t.sourceMapId,r,i);this.completeTask(e,null,n)}catch(n){this.completeTask(e,Si(n))}}completeTask(e,t,r){let i=[];delete this.abortControllers[e];let n={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?qr(t):null,data:qr(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function zx(e,t,r){return!(e<0||e>25||r<0||r>=2**e||t<0||t>=2**e)}var gc=class{constructor(e,t,r){if(!zx(e,t,r))throw Error(`x=${t}, y=${r}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=r,this.key=ci(0,e,e,t,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,r){let i=Vx(this.x,this.y,this.z),n=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(r==="tms"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}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=2**this.z;return new B((e.x*t-this.x)*ne,(e.y*t-this.y)*ne)}toString(){return`${this.z}/${this.x}/${this.y}`}},Lx=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=ci(e,t.z,t.z,t.x,t.y)}},xc=class Ne{constructor(t,r,i,n,a){if(this.terrainRttPosMatrix32f=null,t<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=r,this.canonical=new gc(i,+n,+a),this.key=ci(r,t,i,n,a)}clone(){return new Ne(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 Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?new Ne(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ne(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,r){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?ci(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):ci(this.wrap*+r,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap||this.overscaledZ-t.overscaledZ<=0)return!1;if(t.overscaledZ===0)return this.overscaledZ>0;let r=this.canonical.z-t.canonical.z;return r<0?!1:t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new Ne(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new Ne(r,this.wrap,r,i,n),new Ne(r,this.wrap,r,i+1,n),new Ne(r,this.wrap,r,i,n+1),new Ne(r,this.wrap,r,i+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 Ne(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Ne(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Lx(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Ds(t.x-this.wrap,t.y))}normalizeCoordinates(t,r,i=ne){if(t>=0&&t<i&&r>=0&&r<i)return{tileID:this,x:t,y:r};let n=Math.floor(t/i),a=Math.floor(r/i),s=t-n*i,o=r-a*i,l=this.canonical.z,u=1<<l,h=this.canonical.y+a;if(h<0||h>=u)return null;let c=this.canonical.x+n,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new Ne(this.overscaledZ,p,l,c,h),x:s,y:o}}};function ci(e,t,r,i,n){e*=2,e<0&&(e=e*-1-1);let a=1<<r;return(a*a*e+a*n+i).toString(36)+r.toString(36)+t.toString(36)}const Xs=Math.PI*6378137;function Vx(e,t,r){t=2**r-t-1;let i=vc(e*256,t*256,r),n=vc((e+1)*256,(t+1)*256,r);return`${i[0]},${i[1]},${n[0]},${n[1]}`}function vc(e,t,r){let i=2*Xs/256/2**r;return[e*i-Xs,t*i-Xs]}function Ox(e,t,r){let i="";for(let n=e;n>0;n--){let a=1<<n-1;i+=(t&a?1:0)+(r&a?2:0)}return i}C("CanonicalTileID",gc),C("OverscaledTileID",xc,{omit:["terrainRttPosMatrix32f"]});var $x=class{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id=="number"&&!isNaN(e.id)&&(this.id=e.id))}loadGeometry(){let e=[],t=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let r of t){let i=[];for(let n of r)i.push(new B(n[0],n[1]));e.push(i)}return e}};const Zs="_geojsonTileLayer";var Rx=class{constructor(e,t){this.layers={[Zs]:this},this.name=Zs,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new $x(this.features[e],this.extent)}};function bc(e,t=""){let r=new P0;return Nx(e,r,t),r.finish()}function Nx(e,t,r=""){for(let i in e.layers)t.writeMessage(3,(n,a)=>Ux(n,a,r),e.layers[i])}function Ux(e,t,r=""){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);let i={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let s=0;s<e.length;s++)i.feature=e.feature(s),t.writeMessage(2,qx,i);let n=i.keys;for(let s of n)t.writeStringField(3,s);let a=i.values;for(let s of a)t.writeMessage(4,Yx,s)}function qx(e,t){if(!e.feature)return;let r=e.feature;r.id!==void 0&&t.writeVarintField(1,r.id),t.writeMessage(2,Gx,e),t.writeVarintField(3,r.type),t.writeMessage(4,jx,r)}function Gx(e,t){var r;for(let i in(r=e.feature)==null?void 0:r.properties){let n=e.feature.properties[i],a=e.keycache[i];if(n==null)continue;a===void 0&&(e.keys.push(i),a=e.keys.length-1,e.keycache[i]=a),t.writeVarint(a),typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"&&(n=e.jsonPrefix+JSON.stringify(n));let s=typeof n+":"+n,o=e.valuecache[s];o===void 0&&(e.values.push(n),o=e.values.length-1,e.valuecache[s]=o),t.writeVarint(o)}}function Ws(e,t){return(t<<3)+(e&7)}function wc(e){return e<<1^e>>31}function jx(e,t){let r=e.loadGeometry(),i=e.type,n=0,a=0;for(let s of r){let o=1;i===1&&(o=s.length),t.writeVarint(Ws(1,o));let l=i===3?s.length-1:s.length;for(let u=0;u<l;u++){u===1&&i!==1&&t.writeVarint(Ws(2,l-1));let h=s[u].x-n,c=s[u].y-a;t.writeVarint(wc(h)),t.writeVarint(wc(c)),n+=h,a+=c}e.type===3&&t.writeVarint(Ws(7,1))}}function Yx(e,t){let r=typeof e;r==="string"?t.writeStringField(1,e):r==="boolean"?t.writeBooleanField(7,e):r==="number"&&(e%1==0?e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e):t.writeDoubleField(3,e))}var _c=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let r=e[t];this._stringToNumber[r]=t,this._numberToString[t]=r}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}},Xx=class{constructor(e,t,r,i,n){this.type="Feature",this._vectorTileFeature=e,this._x=r,this._y=i,this._z=t;for(let a in e.properties)typeof e.properties[a]!="string"||!e.properties[a].startsWith("__$json__:")||(e.properties[a]=JSON.parse(e.properties[a].slice(10)));this.properties=e.properties,this.id=n}projectPoint(e,t,r,i){return[(e.x+t)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(e.y+r)*2/i)*Math.PI))-90]}projectLine(e,t,r,i){return e.map(n=>this.projectPoint(n,t,r,i))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t=e.extent*2**this._z,r=e.extent*this._x,i=e.extent*this._y,n=e.loadGeometry();switch(e.type){case 1:{let a=[];for(let o of n)a.push(o[0]);let s=this.projectLine(a,r,i,t);this._geometry=a.length===1?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let a=n.map(s=>this.projectLine(s,r,i,t));this._geometry=a.length===1?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a};break}case 3:{let a=fh(n),s=[];for(let o of a)s.push(o.map(l=>this.projectLine(l,r,i,t)));this._geometry=s.length===1?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t!=="_geometry"&&t!=="_vectorTileFeature"&&t!=="_x"&&t!=="_y"&&t!=="_z"&&(e[t]=this[t]);return e}},zt=class{constructor(e,t,r){this._name=e,this.dataBuffer=t,typeof r=="number"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){var t;return((t=this.nullabilityBuffer)==null?void 0:t.get(e))||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},wn=class extends zt{},Hs=class extends wn{getValueFromBuffer(e){return this.dataBuffer[e]}},Ks=class extends wn{getValueFromBuffer(e){return this.dataBuffer[e]}},Sc=class extends zt{constructor(e,t,r,i){super(e,t,i),this.delta=r}},Js=class extends Sc{constructor(e,t,r,i,n){super(e,n?Int32Array.of(t):Uint32Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}},Qs=class extends zt{constructor(e,t,r,i){super(e,i?Int32Array.of(t):Uint32Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}},Zx=class{constructor(e,t,r,i,n=4096){if(this._name=e,this._geometryVector=t,this._idVector=r,this._propertyVectors=i,this._extent=n,e.length===0)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this.propertyVectors.map(t=>[t.name,t]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;if(this.idVector){let s=this.idVector.getValue(r);s!==null&&(i=this.containsMaxSafeIntegerValues(this.idVector)?Number(s):s)}let n={coordinates:t[r],type:this.geometryVector.geometryType(r)},a={};for(let s of this.propertyVectors){if(!s)continue;let o=s.name,l=s.getValue(r);l!==null&&(a[o]=l)}e.push({id:i,geometry:n,properties:a})}return e}containsMaxSafeIntegerValues(e){return e instanceof Hs||e instanceof Qs||e instanceof Js||e instanceof Ks}};const pi={FEATURE:0},X={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},gt={GEOMETRY:0,STRUCT:1,MAP:2},Ac={ID:0};var Dc=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}},q;(function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON",e.PDE="PDE"})(q||(q={}));var $e;(function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT"})($e||($e={}));const eo=new Uint32Array(33);eo[0]=0;for(let e=1;e<=32;e++)eo[e]=e===32?4294967295:4294967295>>>32-e;const to=eo,Ec=65536;function ro(e,t){return e-e%t}function Wx(e){return ro(e+31,32)}function Hx(e){if(!Number.isFinite(e)||e<=0)return Ec;let t=ro(Math.floor(e),256);return t===0?256:t}function Kx(e){let t=e>>>0;return((t&255)<<24|(t&65280)<<8|t>>>8&65280|t>>>24&255)>>>0}function Jx(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0;r[n++]=a>>>0&3,r[n++]=a>>>2&3,r[n++]=a>>>4&3,r[n++]=a>>>6&3,r[n++]=a>>>8&3,r[n++]=a>>>10&3,r[n++]=a>>>12&3,r[n++]=a>>>14&3,r[n++]=a>>>16&3,r[n++]=a>>>18&3,r[n++]=a>>>20&3,r[n++]=a>>>22&3,r[n++]=a>>>24&3,r[n++]=a>>>26&3,r[n++]=a>>>28&3,r[n++]=a>>>30&3,r[n++]=s>>>0&3,r[n++]=s>>>2&3,r[n++]=s>>>4&3,r[n++]=s>>>6&3,r[n++]=s>>>8&3,r[n++]=s>>>10&3,r[n++]=s>>>12&3,r[n++]=s>>>14&3,r[n++]=s>>>16&3,r[n++]=s>>>18&3,r[n++]=s>>>20&3,r[n++]=s>>>22&3,r[n++]=s>>>24&3,r[n++]=s>>>26&3,r[n++]=s>>>28&3,r[n]=s>>>30&3}function Qx(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0;r[n++]=a>>>0&7,r[n++]=a>>>3&7,r[n++]=a>>>6&7,r[n++]=a>>>9&7,r[n++]=a>>>12&7,r[n++]=a>>>15&7,r[n++]=a>>>18&7,r[n++]=a>>>21&7,r[n++]=a>>>24&7,r[n++]=a>>>27&7,r[n++]=(a>>>30|(s&1)<<2)&7,r[n++]=s>>>1&7,r[n++]=s>>>4&7,r[n++]=s>>>7&7,r[n++]=s>>>10&7,r[n++]=s>>>13&7,r[n++]=s>>>16&7,r[n++]=s>>>19&7,r[n++]=s>>>22&7,r[n++]=s>>>25&7,r[n++]=s>>>28&7,r[n++]=(s>>>31|(o&3)<<1)&7,r[n++]=o>>>2&7,r[n++]=o>>>5&7,r[n++]=o>>>8&7,r[n++]=o>>>11&7,r[n++]=o>>>14&7,r[n++]=o>>>17&7,r[n++]=o>>>20&7,r[n++]=o>>>23&7,r[n++]=o>>>26&7,r[n]=o>>>29&7}function e2(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0;r[n++]=a>>>0&15,r[n++]=a>>>4&15,r[n++]=a>>>8&15,r[n++]=a>>>12&15,r[n++]=a>>>16&15,r[n++]=a>>>20&15,r[n++]=a>>>24&15,r[n++]=a>>>28&15,r[n++]=s>>>0&15,r[n++]=s>>>4&15,r[n++]=s>>>8&15,r[n++]=s>>>12&15,r[n++]=s>>>16&15,r[n++]=s>>>20&15,r[n++]=s>>>24&15,r[n++]=s>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n]=l>>>28&15}function t2(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0;r[n++]=a>>>0&31,r[n++]=a>>>5&31,r[n++]=a>>>10&31,r[n++]=a>>>15&31,r[n++]=a>>>20&31,r[n++]=a>>>25&31,r[n++]=(a>>>30|(s&7)<<2)&31,r[n++]=s>>>3&31,r[n++]=s>>>8&31,r[n++]=s>>>13&31,r[n++]=s>>>18&31,r[n++]=s>>>23&31,r[n++]=(s>>>28|(o&1)<<4)&31,r[n++]=o>>>1&31,r[n++]=o>>>6&31,r[n++]=o>>>11&31,r[n++]=o>>>16&31,r[n++]=o>>>21&31,r[n++]=o>>>26&31,r[n++]=(o>>>31|(l&15)<<1)&31,r[n++]=l>>>4&31,r[n++]=l>>>9&31,r[n++]=l>>>14&31,r[n++]=l>>>19&31,r[n++]=l>>>24&31,r[n++]=(l>>>29|(u&3)<<3)&31,r[n++]=u>>>2&31,r[n++]=u>>>7&31,r[n++]=u>>>12&31,r[n++]=u>>>17&31,r[n++]=u>>>22&31,r[n]=u>>>27&31}function r2(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0;r[n++]=a>>>0&63,r[n++]=a>>>6&63,r[n++]=a>>>12&63,r[n++]=a>>>18&63,r[n++]=a>>>24&63,r[n++]=(a>>>30|(s&15)<<2)&63,r[n++]=s>>>4&63,r[n++]=s>>>10&63,r[n++]=s>>>16&63,r[n++]=s>>>22&63,r[n++]=(s>>>28|(o&3)<<4)&63,r[n++]=o>>>2&63,r[n++]=o>>>8&63,r[n++]=o>>>14&63,r[n++]=o>>>20&63,r[n++]=o>>>26&63,r[n++]=l>>>0&63,r[n++]=l>>>6&63,r[n++]=l>>>12&63,r[n++]=l>>>18&63,r[n++]=l>>>24&63,r[n++]=(l>>>30|(u&15)<<2)&63,r[n++]=u>>>4&63,r[n++]=u>>>10&63,r[n++]=u>>>16&63,r[n++]=u>>>22&63,r[n++]=(u>>>28|(h&3)<<4)&63,r[n++]=h>>>2&63,r[n++]=h>>>8&63,r[n++]=h>>>14&63,r[n++]=h>>>20&63,r[n]=h>>>26&63}function i2(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0;r[n++]=a>>>0&127,r[n++]=a>>>7&127,r[n++]=a>>>14&127,r[n++]=a>>>21&127,r[n++]=(a>>>28|(s&7)<<4)&127,r[n++]=s>>>3&127,r[n++]=s>>>10&127,r[n++]=s>>>17&127,r[n++]=s>>>24&127,r[n++]=(s>>>31|(o&63)<<1)&127,r[n++]=o>>>6&127,r[n++]=o>>>13&127,r[n++]=o>>>20&127,r[n++]=(o>>>27|(l&3)<<5)&127,r[n++]=l>>>2&127,r[n++]=l>>>9&127,r[n++]=l>>>16&127,r[n++]=l>>>23&127,r[n++]=(l>>>30|(u&31)<<2)&127,r[n++]=u>>>5&127,r[n++]=u>>>12&127,r[n++]=u>>>19&127,r[n++]=(u>>>26|(h&1)<<6)&127,r[n++]=h>>>1&127,r[n++]=h>>>8&127,r[n++]=h>>>15&127,r[n++]=h>>>22&127,r[n++]=(h>>>29|(c&15)<<3)&127,r[n++]=c>>>4&127,r[n++]=c>>>11&127,r[n++]=c>>>18&127,r[n]=c>>>25&127}function n2(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0;r[n++]=a>>>0&255,r[n++]=a>>>8&255,r[n++]=a>>>16&255,r[n++]=a>>>24&255,r[n++]=s>>>0&255,r[n++]=s>>>8&255,r[n++]=s>>>16&255,r[n++]=s>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n]=p>>>24&255}function a2(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0;r[n++]=a>>>0&511,r[n++]=a>>>9&511,r[n++]=a>>>18&511,r[n++]=(a>>>27|(s&15)<<5)&511,r[n++]=s>>>4&511,r[n++]=s>>>13&511,r[n++]=s>>>22&511,r[n++]=(s>>>31|(o&255)<<1)&511,r[n++]=o>>>8&511,r[n++]=o>>>17&511,r[n++]=(o>>>26|(l&7)<<6)&511,r[n++]=l>>>3&511,r[n++]=l>>>12&511,r[n++]=l>>>21&511,r[n++]=(l>>>30|(u&127)<<2)&511,r[n++]=u>>>7&511,r[n++]=u>>>16&511,r[n++]=(u>>>25|(h&3)<<7)&511,r[n++]=h>>>2&511,r[n++]=h>>>11&511,r[n++]=h>>>20&511,r[n++]=(h>>>29|(c&63)<<3)&511,r[n++]=c>>>6&511,r[n++]=c>>>15&511,r[n++]=(c>>>24|(p&1)<<8)&511,r[n++]=p>>>1&511,r[n++]=p>>>10&511,r[n++]=p>>>19&511,r[n++]=(p>>>28|(f&31)<<4)&511,r[n++]=f>>>5&511,r[n++]=f>>>14&511,r[n]=f>>>23&511}function s2(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,d=e[t+9]>>>0;r[n++]=a>>>0&1023,r[n++]=a>>>10&1023,r[n++]=a>>>20&1023,r[n++]=(a>>>30|(s&255)<<2)&1023,r[n++]=s>>>8&1023,r[n++]=s>>>18&1023,r[n++]=(s>>>28|(o&63)<<4)&1023,r[n++]=o>>>6&1023,r[n++]=o>>>16&1023,r[n++]=(o>>>26|(l&15)<<6)&1023,r[n++]=l>>>4&1023,r[n++]=l>>>14&1023,r[n++]=(l>>>24|(u&3)<<8)&1023,r[n++]=u>>>2&1023,r[n++]=u>>>12&1023,r[n++]=u>>>22&1023,r[n++]=h>>>0&1023,r[n++]=h>>>10&1023,r[n++]=h>>>20&1023,r[n++]=(h>>>30|(c&255)<<2)&1023,r[n++]=c>>>8&1023,r[n++]=c>>>18&1023,r[n++]=(c>>>28|(p&63)<<4)&1023,r[n++]=p>>>6&1023,r[n++]=p>>>16&1023,r[n++]=(p>>>26|(f&15)<<6)&1023,r[n++]=f>>>4&1023,r[n++]=f>>>14&1023,r[n++]=(f>>>24|(d&3)<<8)&1023,r[n++]=d>>>2&1023,r[n++]=d>>>12&1023,r[n]=d>>>22&1023}function o2(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,d=e[t+9]>>>0,y=e[t+10]>>>0;r[n++]=a>>>0&2047,r[n++]=a>>>11&2047,r[n++]=(a>>>22|(s&1)<<10)&2047,r[n++]=s>>>1&2047,r[n++]=s>>>12&2047,r[n++]=(s>>>23|(o&3)<<9)&2047,r[n++]=o>>>2&2047,r[n++]=o>>>13&2047,r[n++]=(o>>>24|(l&7)<<8)&2047,r[n++]=l>>>3&2047,r[n++]=l>>>14&2047,r[n++]=(l>>>25|(u&15)<<7)&2047,r[n++]=u>>>4&2047,r[n++]=u>>>15&2047,r[n++]=(u>>>26|(h&31)<<6)&2047,r[n++]=h>>>5&2047,r[n++]=h>>>16&2047,r[n++]=(h>>>27|(c&63)<<5)&2047,r[n++]=c>>>6&2047,r[n++]=c>>>17&2047,r[n++]=(c>>>28|(p&127)<<4)&2047,r[n++]=p>>>7&2047,r[n++]=p>>>18&2047,r[n++]=(p>>>29|(f&255)<<3)&2047,r[n++]=f>>>8&2047,r[n++]=f>>>19&2047,r[n++]=(f>>>30|(d&511)<<2)&2047,r[n++]=d>>>9&2047,r[n++]=d>>>20&2047,r[n++]=(d>>>31|(y&1023)<<1)&2047,r[n++]=y>>>10&2047,r[n]=y>>>21&2047}function l2(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,d=e[t+9]>>>0,y=e[t+10]>>>0,m=e[t+11]>>>0;r[n++]=a>>>0&4095,r[n++]=a>>>12&4095,r[n++]=(a>>>24|(s&15)<<8)&4095,r[n++]=s>>>4&4095,r[n++]=s>>>16&4095,r[n++]=(s>>>28|(o&255)<<4)&4095,r[n++]=o>>>8&4095,r[n++]=o>>>20&4095,r[n++]=l>>>0&4095,r[n++]=l>>>12&4095,r[n++]=(l>>>24|(u&15)<<8)&4095,r[n++]=u>>>4&4095,r[n++]=u>>>16&4095,r[n++]=(u>>>28|(h&255)<<4)&4095,r[n++]=h>>>8&4095,r[n++]=h>>>20&4095,r[n++]=c>>>0&4095,r[n++]=c>>>12&4095,r[n++]=(c>>>24|(p&15)<<8)&4095,r[n++]=p>>>4&4095,r[n++]=p>>>16&4095,r[n++]=(p>>>28|(f&255)<<4)&4095,r[n++]=f>>>8&4095,r[n++]=f>>>20&4095,r[n++]=d>>>0&4095,r[n++]=d>>>12&4095,r[n++]=(d>>>24|(y&15)<<8)&4095,r[n++]=y>>>4&4095,r[n++]=y>>>16&4095,r[n++]=(y>>>28|(m&255)<<4)&4095,r[n++]=m>>>8&4095,r[n]=m>>>20&4095}function u2(e,t,r,i){let n=i,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,d=e[t+9]>>>0,y=e[t+10]>>>0,m=e[t+11]>>>0,g=e[t+12]>>>0,x=e[t+13]>>>0,v=e[t+14]>>>0,b=e[t+15]>>>0;r[n++]=a>>>0&65535,r[n++]=a>>>16&65535,r[n++]=s>>>0&65535,r[n++]=s>>>16&65535,r[n++]=o>>>0&65535,r[n++]=o>>>16&65535,r[n++]=l>>>0&65535,r[n++]=l>>>16&65535,r[n++]=u>>>0&65535,r[n++]=u>>>16&65535,r[n++]=h>>>0&65535,r[n++]=h>>>16&65535,r[n++]=c>>>0&65535,r[n++]=c>>>16&65535,r[n++]=p>>>0&65535,r[n++]=p>>>16&65535,r[n++]=f>>>0&65535,r[n++]=f>>>16&65535,r[n++]=d>>>0&65535,r[n++]=d>>>16&65535,r[n++]=y>>>0&65535,r[n++]=y>>>16&65535,r[n++]=m>>>0&65535,r[n++]=m>>>16&65535,r[n++]=g>>>0&65535,r[n++]=g>>>16&65535,r[n++]=x>>>0&65535,r[n++]=x>>>16&65535,r[n++]=v>>>0&65535,r[n++]=v>>>16&65535,r[n++]=b>>>0&65535,r[n]=b>>>16&65535}function h2(e,t,r,i){let n=i,a=t;for(let s=0;s<8;s++){let o=e[a++]>>>0;r[n++]=o>>>0&1,r[n++]=o>>>1&1,r[n++]=o>>>2&1,r[n++]=o>>>3&1,r[n++]=o>>>4&1,r[n++]=o>>>5&1,r[n++]=o>>>6&1,r[n++]=o>>>7&1,r[n++]=o>>>8&1,r[n++]=o>>>9&1,r[n++]=o>>>10&1,r[n++]=o>>>11&1,r[n++]=o>>>12&1,r[n++]=o>>>13&1,r[n++]=o>>>14&1,r[n++]=o>>>15&1,r[n++]=o>>>16&1,r[n++]=o>>>17&1,r[n++]=o>>>18&1,r[n++]=o>>>19&1,r[n++]=o>>>20&1,r[n++]=o>>>21&1,r[n++]=o>>>22&1,r[n++]=o>>>23&1,r[n++]=o>>>24&1,r[n++]=o>>>25&1,r[n++]=o>>>26&1,r[n++]=o>>>27&1,r[n++]=o>>>28&1,r[n++]=o>>>29&1,r[n++]=o>>>30&1,r[n++]=o>>>31&1}}function c2(e,t,r,i){let n=i,a=t;for(let s=0;s<8;s++){let o=e[a++]>>>0,l=e[a++]>>>0;r[n++]=o>>>0&3,r[n++]=o>>>2&3,r[n++]=o>>>4&3,r[n++]=o>>>6&3,r[n++]=o>>>8&3,r[n++]=o>>>10&3,r[n++]=o>>>12&3,r[n++]=o>>>14&3,r[n++]=o>>>16&3,r[n++]=o>>>18&3,r[n++]=o>>>20&3,r[n++]=o>>>22&3,r[n++]=o>>>24&3,r[n++]=o>>>26&3,r[n++]=o>>>28&3,r[n++]=o>>>30&3,r[n++]=l>>>0&3,r[n++]=l>>>2&3,r[n++]=l>>>4&3,r[n++]=l>>>6&3,r[n++]=l>>>8&3,r[n++]=l>>>10&3,r[n++]=l>>>12&3,r[n++]=l>>>14&3,r[n++]=l>>>16&3,r[n++]=l>>>18&3,r[n++]=l>>>20&3,r[n++]=l>>>22&3,r[n++]=l>>>24&3,r[n++]=l>>>26&3,r[n++]=l>>>28&3,r[n++]=l>>>30&3}}function p2(e,t,r,i){let n=i,a=t;for(let s=0;s<8;s++){let o=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0;r[n++]=o>>>0&7,r[n++]=o>>>3&7,r[n++]=o>>>6&7,r[n++]=o>>>9&7,r[n++]=o>>>12&7,r[n++]=o>>>15&7,r[n++]=o>>>18&7,r[n++]=o>>>21&7,r[n++]=o>>>24&7,r[n++]=o>>>27&7,r[n++]=(o>>>30|(l&1)<<2)&7,r[n++]=l>>>1&7,r[n++]=l>>>4&7,r[n++]=l>>>7&7,r[n++]=l>>>10&7,r[n++]=l>>>13&7,r[n++]=l>>>16&7,r[n++]=l>>>19&7,r[n++]=l>>>22&7,r[n++]=l>>>25&7,r[n++]=l>>>28&7,r[n++]=(l>>>31|(u&3)<<1)&7,r[n++]=u>>>2&7,r[n++]=u>>>5&7,r[n++]=u>>>8&7,r[n++]=u>>>11&7,r[n++]=u>>>14&7,r[n++]=u>>>17&7,r[n++]=u>>>20&7,r[n++]=u>>>23&7,r[n++]=u>>>26&7,r[n++]=u>>>29&7}}function f2(e,t,r,i){let n=i,a=t;for(let s=0;s<8;s++){let o=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,h=e[a++]>>>0;r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n++]=l>>>28&15,r[n++]=u>>>0&15,r[n++]=u>>>4&15,r[n++]=u>>>8&15,r[n++]=u>>>12&15,r[n++]=u>>>16&15,r[n++]=u>>>20&15,r[n++]=u>>>24&15,r[n++]=u>>>28&15,r[n++]=h>>>0&15,r[n++]=h>>>4&15,r[n++]=h>>>8&15,r[n++]=h>>>12&15,r[n++]=h>>>16&15,r[n++]=h>>>20&15,r[n++]=h>>>24&15,r[n++]=h>>>28&15}}function d2(e,t,r,i){let n=i,a=t;for(let s=0;s<8;s++){let o=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,h=e[a++]>>>0,c=e[a++]>>>0;r[n++]=o>>>0&31,r[n++]=o>>>5&31,r[n++]=o>>>10&31,r[n++]=o>>>15&31,r[n++]=o>>>20&31,r[n++]=o>>>25&31,r[n++]=(o>>>30|(l&7)<<2)&31,r[n++]=l>>>3&31,r[n++]=l>>>8&31,r[n++]=l>>>13&31,r[n++]=l>>>18&31,r[n++]=l>>>23&31,r[n++]=(l>>>28|(u&1)<<4)&31,r[n++]=u>>>1&31,r[n++]=u>>>6&31,r[n++]=u>>>11&31,r[n++]=u>>>16&31,r[n++]=u>>>21&31,r[n++]=u>>>26&31,r[n++]=(u>>>31|(h&15)<<1)&31,r[n++]=h>>>4&31,r[n++]=h>>>9&31,r[n++]=h>>>14&31,r[n++]=h>>>19&31,r[n++]=h>>>24&31,r[n++]=(h>>>29|(c&3)<<3)&31,r[n++]=c>>>2&31,r[n++]=c>>>7&31,r[n++]=c>>>12&31,r[n++]=c>>>17&31,r[n++]=c>>>22&31,r[n++]=c>>>27&31}}function y2(e,t,r,i){let n=i,a=t;for(let s=0;s<8;s++){let o=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,h=e[a++]>>>0,c=e[a++]>>>0,p=e[a++]>>>0;r[n++]=o>>>0&63,r[n++]=o>>>6&63,r[n++]=o>>>12&63,r[n++]=o>>>18&63,r[n++]=o>>>24&63,r[n++]=(o>>>30|(l&15)<<2)&63,r[n++]=l>>>4&63,r[n++]=l>>>10&63,r[n++]=l>>>16&63,r[n++]=l>>>22&63,r[n++]=(l>>>28|(u&3)<<4)&63,r[n++]=u>>>2&63,r[n++]=u>>>8&63,r[n++]=u>>>14&63,r[n++]=u>>>20&63,r[n++]=u>>>26&63,r[n++]=h>>>0&63,r[n++]=h>>>6&63,r[n++]=h>>>12&63,r[n++]=h>>>18&63,r[n++]=h>>>24&63,r[n++]=(h>>>30|(c&15)<<2)&63,r[n++]=c>>>4&63,r[n++]=c>>>10&63,r[n++]=c>>>16&63,r[n++]=c>>>22&63,r[n++]=(c>>>28|(p&3)<<4)&63,r[n++]=p>>>2&63,r[n++]=p>>>8&63,r[n++]=p>>>14&63,r[n++]=p>>>20&63,r[n++]=p>>>26&63}}function m2(e,t,r,i){let n=i,a=t;for(let s=0;s<8;s++){let o=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,h=e[a++]>>>0,c=e[a++]>>>0,p=e[a++]>>>0,f=e[a++]>>>0;r[n++]=o>>>0&127,r[n++]=o>>>7&127,r[n++]=o>>>14&127,r[n++]=o>>>21&127,r[n++]=(o>>>28|(l&7)<<4)&127,r[n++]=l>>>3&127,r[n++]=l>>>10&127,r[n++]=l>>>17&127,r[n++]=l>>>24&127,r[n++]=(l>>>31|(u&63)<<1)&127,r[n++]=u>>>6&127,r[n++]=u>>>13&127,r[n++]=u>>>20&127,r[n++]=(u>>>27|(h&3)<<5)&127,r[n++]=h>>>2&127,r[n++]=h>>>9&127,r[n++]=h>>>16&127,r[n++]=h>>>23&127,r[n++]=(h>>>30|(c&31)<<2)&127,r[n++]=c>>>5&127,r[n++]=c>>>12&127,r[n++]=c>>>19&127,r[n++]=(c>>>26|(p&1)<<6)&127,r[n++]=p>>>1&127,r[n++]=p>>>8&127,r[n++]=p>>>15&127,r[n++]=p>>>22&127,r[n++]=(p>>>29|(f&15)<<3)&127,r[n++]=f>>>4&127,r[n++]=f>>>11&127,r[n++]=f>>>18&127,r[n++]=f>>>25&127}}function g2(e,t,r,i){let n=i,a=t;for(let s=0;s<8;s++){let o=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,h=e[a++]>>>0,c=e[a++]>>>0,p=e[a++]>>>0,f=e[a++]>>>0,d=e[a++]>>>0;r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n++]=p>>>24&255,r[n++]=f>>>0&255,r[n++]=f>>>8&255,r[n++]=f>>>16&255,r[n++]=f>>>24&255,r[n++]=d>>>0&255,r[n++]=d>>>8&255,r[n++]=d>>>16&255,r[n++]=d>>>24&255}}function x2(e,t,r,i){let n=i,a=t;for(let s=0;s<128;s++){let o=e[a++]>>>0;r[n++]=o&65535,r[n++]=o>>>16&65535}}function v2(e,t,r,i,n){let a=to[n]>>>0,s=t,o=0,l=e[s]>>>0,u=i;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+n<=32){let p=l>>>o&a;r[u+c]=p|0,o+=n,o===32&&(o=0,s++,c!==31&&(l=e[s]>>>0))}else{let p=32-o,f=l>>>o;s++,l=e[s]>>>0;let d=n-p,y=-1>>>32-d>>>0,m=(f|(l&y)<<p)&a;r[u+c]=m|0,o=d}u+=32,o=0,h<7&&(l=e[s]>>>0)}}const io=Hx(Ec),b2=3*io/256+io|0;function Tc(){let e=new Uint8Array(b2);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function w2(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t=Math.max(16,e|0);return{encodedWords:new Uint32Array(t),decoderWorkspace:Tc()}}function _2(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let r=new Uint32Array(Math.max(16,t*2));return e.encodedWords=r,r}function S2(e,t,r,i){i.byteContainer.length<r&&(i.byteContainer=new Uint8Array(r*2),i.byteContainerI32=void 0);let n=i.byteContainer,a=r>>>2;if(n.byteOffset&3)for(let o=0;o<a;o=o+1|0){let l=e[t+o|0]|0,u=o<<2;n[u]=l&255,n[u+1|0]=l>>>8&255,n[u+2|0]=l>>>16&255,n[u+3|0]=l>>>24&255}else{let o=i.byteContainerI32;(!o||o.buffer!==n.buffer||o.byteOffset!==n.byteOffset||o.length<a)&&(o=i.byteContainerI32=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>>2)),o.set(e.subarray(t,t+a))}let s=r&3;if(s>0){let o=e[t+a|0]|0,l=a<<2;for(let u=0;u<s;u=u+1|0)n[l+u|0]=o>>>(u<<3)&255}return n}function A2(e,t,r){let i=e[t++]|0,n=r.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(i>>>a-1&1))continue;if(t>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let s=e[t++]>>>0,o=Wx(s),l=s*a+31>>>5;if(t+l>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${s}, streamWordIndex=${t}, needWords=${l}, availableWords=${e.length-t}, encodedWords=${e.length})`);let u=n[a];(!u||u.length<o)&&(u=n[a]=new Uint32Array(o));let h=0;for(;h<s;h=h+32|0)M2(e,t,u,h,a),t=t+a|0;let c=h-s|0;t=t-(c*a>>>5)|0,r.exceptionSizes[a]=s}return t}function D2(e,t,r,i,n){switch(n){case 1:h2(e,t,r,i);break;case 2:c2(e,t,r,i);break;case 3:p2(e,t,r,i);break;case 4:f2(e,t,r,i);break;case 5:d2(e,t,r,i);break;case 6:y2(e,t,r,i);break;case 7:m2(e,t,r,i);break;case 8:g2(e,t,r,i);break;case 16:x2(e,t,r,i);break;default:v2(e,t,r,i,n)}return t+(n<<3)|0}function E2(e,t,r,i){if(r+2>t)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${t})`);let n=e[r++],a=e[r++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:a,bytePosIn:r}}function T2(e,t,r,i,n,a){if(r+1>t)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${r}, byteSize=${t})`);let s=e[r++];if(s<i||s>32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${a} (bitWidth=${i}, expected ${i}..32)`);let o=s-i|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${a} (bitWidth=${i}, maxBits=${s})`);if(r+n>t)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${n}, have=${t-r})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:r}}function I2(e,t,r,i,n,a,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=T2(n,a,s,r,i,l);if(s=c,h===1){let m=1<<r;for(let g=0;g<i;g=g+1|0){let x=n[s++];e[x+t|0]|=m}return s}let p=o.dataToBePacked[h];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${r}, maxBits=${u}) at block ${l}`);let f=o.dataPointers,d=f[h]|0,y=o.exceptionSizes[h]|0;if(d+i>y)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${d}, need ${i}, size=${y}) at block ${l}`);for(let m=0;m<i;m=m+1|0){let g=n[s++],x=p[d++]|0;e[g+t|0]|=x<<r}return f[h]=d,s}function k2(e,t,r,i,n,a,s,o,l,u){let h=r|0,c=0;for(let p=0;p<s;p=p+1|0){let f=E2(o,l,c,p);c=f.bytePosIn;let d=f.bitWidth,y=f.exceptionCount,m=a+p*256|0;switch(d){case 0:n.fill(0,m,m+256);break;case 32:for(let g=0;g<256;g=g+1|0)n[m+g|0]=e[h+g|0]|0;h=h+256|0;break;default:h=D2(e,h,n,m,d)}y>0&&(c=I2(n,m,d,y,o,l,c,u,p))}if(h!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${e.length})`)}function F2(e,t,r,i,n,a){let s=r|0,o=e[s]|0;if(o<=0||s+o>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let l=s+1|0,u=s+o|0,h=e[u]>>>0,c=h+3>>>2,p=u+1,f=p+c;if(f>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${e.length})`);let d=S2(e,p,h,a),y=h,m=A2(e,f,a);return a.dataPointers.fill(0),k2(e,s,l,u,t,i|0,n/256|0,d,y,a),m}function C2(e,t,r,i,n,a){let s=i+ro(n,256),o=i,l=r;for(;o!==s;){let u=Math.min(io,s-o);l=F2(e,t,l,o,u,a),o=o+u|0}return l}function B2(e,t,r,i,n,a){if(a===0)return t;let s=0,o=t,l=t+r,u=n,h=n,c=n+a,p=0,f=0;for(;o<l&&h<c;){let d=e[o]>>>s&255;if(s+=8,o+=s>>>5,s&=31,p|=(d&127)<<f,d&128)i[h++]=p|0,p=0,f=0;else if(f+=7,f>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-u}/${a}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${a}, consumedWords=${o-t}/${r}, vbyteStart=${t}, vbyteEnd=${l})`);return o}function P2(e,t,r){let i=0,n=0,a=new Uint32Array(t),s=r??Tc();if(e.length>0){let u=e[i]|0;if(i=i+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(n+u>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${u}, out.length=${a.length})`);i=C2(e,a,i,n,u,s),n=n+u|0}let o=e.length-i|0,l=t-n|0;return B2(e,i,o,a,n,l),a}function M2(e,t,r,i,n){switch(n){case 2:Jx(e,t,r,i);return;case 3:Qx(e,t,r,i);return;case 4:e2(e,t,r,i);return;case 5:t2(e,t,r,i);return;case 6:r2(e,t,r,i);return;case 7:i2(e,t,r,i);return;case 8:n2(e,t,r,i);return;case 9:a2(e,t,r,i);return;case 10:s2(e,t,r,i);return;case 11:o2(e,t,r,i);return;case 12:l2(e,t,r,i);return;case 16:u2(e,t,r,i);return;case 32:for(let u=0;u<32;u=u+1|0)r[i+u|0]=e[t+u|0]|0;return}let a=to[n]>>>0,s=t,o=0,l=e[s]>>>0;for(let u=0;u<32;u++)if(o+n<=32){let h=l>>>o&a;r[i+u]=h|0,o+=n,o===32&&(o=0,s++,u!==31&&(l=e[s]>>>0))}else{let h=32-o,c=l>>>o;s++,l=e[s]>>>0;let p=to[n-h]>>>0,f=(c|(l&p)<<h)&a;r[i+u]=f|0,o=n-h}}function z2(e,t,r,i){if(t<0||r<0||t+r>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${r}, bytes.length=${e.length})`);let n=Math.floor(r/4),a=r%4!=0,s=a?n+1:n;if(i.length<s)throw RangeError(`decodeBigEndianInt32sInto: out.length=${i.length} < ${s}`);if(n>0){let o=e.byteOffset+t;if(o&3)for(let l=0;l<n;l++){let u=t+l*4;i[l]=e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]|0}else{let l=new Uint32Array(e.buffer,o,n);for(let u=0;u<n;u++)i[u]=Kx(l[u])|0}}if(a){let o=t+n*4,l=r-n*4,u=0;for(let h=0;h<l;h++)u|=e[o+h]<<24-h*8;i[n]=u|0}return s}function xe(e,t,r){let i=new Uint32Array(r),n=0,a=t.get();for(let s=0;s<i.length;s++){let o=e[a++],l=o&127;if(o<128){i[n++]=l;continue}if(o=e[a++],l|=(o&127)<<7,o<128){i[n++]=l;continue}if(o=e[a++],l|=(o&127)<<14,o<128){i[n++]=l;continue}if(o=e[a++],l|=(o&127)<<21,o<128){i[n++]=l;continue}o=e[a++],l|=(o&15)<<28,i[n++]=l}return t.set(a),i}function no(e,t,r){let i=new BigUint64Array(r);for(let n=0;n<i.length;n++)i[n]=L2(e,t);return i}function L2(e,t){let r=0n,i=0,n=t.get();for(;n<e.length;){let a=e[n++];if(r|=BigInt(a&127)<<BigInt(i),!(a&128))break;if(i+=7,i>=64)throw Error("Varint too long")}return t.set(n),r}function V2(e,t,r){let i=new Float64Array(r);for(let n=0;n<r;n++)i[n]=O2(e,t);return i}function O2(e,t){let r,i;return i=e[t.get()],t.increment(),r=i&127,i<128||(i=e[t.get()],t.increment(),r|=(i&127)<<7,i<128)||(i=e[t.get()],t.increment(),r|=(i&127)<<14,i<128)||(i=e[t.get()],t.increment(),r|=(i&127)<<21,i<128)?r:(i=e[t.get()],r|=(i&15)<<28,$2(r,e,t))}function $2(e,t,r){let i,n;if(n=t[r.get()],r.increment(),i=(n&112)>>4,n<128||(n=t[r.get()],r.increment(),i|=(n&127)<<3,n<128)||(n=t[r.get()],r.increment(),i|=(n&127)<<10,n<128)||(n=t[r.get()],r.increment(),i|=(n&127)<<17,n<128)||(n=t[r.get()],r.increment(),i|=(n&127)<<24,n<128)||(n=t[r.get()],r.increment(),i|=(n&1)<<31,n<128))return i*4294967296+(e>>>0);throw Error("Expected varint not more than 10 bytes")}function R2(e,t,r,i){return N2(e,t,r,i,w2(r>>>2))}function N2(e,t,r,i,n){let a=i.get();if(r&3)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${a} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=r>>>2,o=_2(n,s);z2(e,a,r,o);let l=P2(o.subarray(0,s),t,n.decoderWorkspace);return i.add(r),l}function Z(e){return e>>>1^-(e&1)}function ve(e){return e>>1n^-(e&1n)}function Lt(e){return e%2==1?(e+1)/-2:e/2}function U2(e){let t=new Int32Array(e.length);for(let r=0;r<e.length;r++)t[r]=Z(e[r]);return t}function q2(e){let t=new BigInt64Array(e.length);for(let r=0;r<e.length;r++)t[r]=ve(e[r]);return t}function ao(e,t,r){if(r===void 0){r=0;for(let a=0;a<t;a++)r+=e[a]}let i=new Uint32Array(r),n=0;for(let a=0;a<t;a++){let s=e[a],o=e[a+t];i.fill(o,n,n+s),n+=s}return i}function so(e,t,r){if(r===void 0){r=0;for(let a=0;a<t;a++)r+=Number(e[a])}let i=new BigUint64Array(r),n=0;for(let a=0;a<t;a++){let s=Number(e[a]),o=e[a+t];i.fill(o,n,n+s),n+=s}return i}function Ic(e,t,r){let i=new Float64Array(r),n=0;for(let a=0;a<t;a++){let s=e[a],o=e[a+t];i.fill(o,n,n+s),n+=s}return i}function kc(e){let t=new Int32Array(e.length);t[0]=Z(e[0]);let r=e.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let n=e[i],a=e[i+1],s=e[i+2],o=e[i+3];t[i]=Z(n)+t[i-1],t[i+1]=Z(a)+t[i],t[i+2]=Z(s)+t[i+1],t[i+3]=Z(o)+t[i+2]}for(;i!==e.length;++i)t[i]=Z(e[i])+t[i-1];return t}function Fc(e){let t=new BigInt64Array(e.length);t[0]=ve(e[0]);let r=e.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let n=e[i],a=e[i+1],s=e[i+2],o=e[i+3];t[i]=ve(n)+t[i-1],t[i+1]=ve(a)+t[i],t[i+2]=ve(s)+t[i+1],t[i+3]=ve(o)+t[i+2]}for(;i!==t.length;++i)t[i]=ve(e[i])+t[i-1];return t}function G2(e){e[0]=Lt(e[0]);let t=e.length/4*4,r=1;if(t>=4)for(;r<t-4;r+=4){let i=e[r],n=e[r+1],a=e[r+2],s=e[r+3];e[r]=Lt(i)+e[r-1],e[r+1]=Lt(n)+e[r],e[r+2]=Lt(a)+e[r+1],e[r+3]=Lt(s)+e[r+2]}for(;r!==e.length;++r)e[r]=Lt(e[r])+e[r-1]}function j2(e,t,r){if(r===void 0){r=0;for(let a=0;a<t;a++)r+=e[a]}let i=new Int32Array(r),n=0;for(let a=0;a<t;a++){let s=e[a],o=e[a+t];o=Z(o),i.fill(o,n,n+s),n+=s}return i}function Y2(e,t,r){if(r===void 0){r=0;for(let a=0;a<t;a++)r+=Number(e[a])}let i=new BigInt64Array(r),n=0;for(let a=0;a<t;a++){let s=Number(e[a]),o=e[a+t];o=ve(o),i.fill(o,n,n+s),n+=s}return i}function X2(e,t,r){let i=new Float64Array(r),n=0;for(let a=0;a<t;a++){let s=e[a],o=e[a+t];o=Lt(o),i.fill(o,n,n+s),n+=s}return i}function oo(e){let t=e.length/4*4,r=1;if(t>=4)for(let i=e[0];r<t-4;r+=4)i=e[r]+=i,i=e[r+1]+=i,i=e[r+2]+=i,i=e[r+3]+=i;for(;r!==e.length;)e[r]+=e[r-1],++r}function Z2(e){let t=0;for(let r=0;r<e.length;r++)e[r]+=t,t=e[r]}function W2(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=Z(e[0]),t[1]=Z(e[1]);let r=e.length/4*4,i=2;if(r>=4)for(;i<r-4;i+=4){let n=e[i],a=e[i+1],s=e[i+2],o=e[i+3];t[i]=Z(n)+t[i-2],t[i+1]=Z(a)+t[i-1],t[i+2]=Z(s)+t[i],t[i+3]=Z(o)+t[i+1]}for(;i!==e.length;i+=2)t[i]=Z(e[i])+t[i-2],t[i+1]=Z(e[i+1])+t[i-1];return t}function H2(e){let t=new Int32Array(e.length+1);t[0]=0,t[1]=Z(e[0]);let r=t[1];for(let i=2;i!==t.length;++i){let n=e[i-1],a=Z(n);r+=a,t[i]=t[i-1]+r}return new Uint32Array(t)}function K2(e,t,r){let i=new Int32Array(r+1);i[0]=0;let n=1,a=i[0];for(let s=0;s<t;s++){let o=e[s],l=e[s+t];l=Z(l);for(let u=n;u<n+o;u++)i[u]=l+a,a=i[u];n+=o}return i}function J2(e,t,r){let i=new Uint32Array(r+1);i[0]=0;let n=1,a=i[0];for(let s=0;s<t;s++){let o=e[s],l=e[s+t];for(let u=n;u<n+o;u++)i[u]=l+a,a=i[u];n+=o}return i}function Q2(e,t,r){let i=new Int32Array(r),n=0,a=0;for(let s=0;s<t;s++){let o=e[s],l=e[s+t],u=Z(l);for(let h=0;h<o;h++)a+=u,i[n++]=a}return i}function ev(e,t,r){let i=new BigInt64Array(r),n=0,a=0n;for(let s=0;s<t;s++){let o=Number(e[s]),l=e[s+t],u=ve(l);for(let h=0;h<o;h++)a+=u,i[n++]=a}return i}function Cc(e){let t=new Uint32Array(e.length);t[0]=Z(e[0])>>>0;for(let r=1;r<e.length;r++)t[r]=t[r-1]+Z(e[r])>>>0;return t}function Bc(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,ve(e[0]));for(let r=1;r<e.length;r++)t[r]=BigInt.asUintN(64,t[r-1]+ve(e[r]));return t}function tv(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=Z(e[0])>>>0,t[1]=Z(e[1])>>>0;for(let r=2;r<e.length;r+=2)t[r]=t[r-2]+Z(e[r])>>>0,t[r+1]=t[r-1]+Z(e[r+1])>>>0;return t}function rv(e){return e[1]}function iv(e){return Z(e[1])}function nv(e){if(e.length===2){let t=Z(e[1]);return[t,t]}return[Z(e[2]),Z(e[3])]}function av(e){return e[1]}function sv(e){return ve(e[1])}function ov(e){if(e.length===2){let t=ve(e[1]);return[t,t]}return[ve(e[2]),ve(e[3])]}var ce;(function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"})(ce||(ce={}));var Te;(function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"})(Te||(Te={}));var lt;(function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"})(lt||(lt={}));var de;(function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"})(de||(de={}));const lv=[ce.PRESENT,ce.DATA,ce.OFFSET,ce.LENGTH],Pc=[q.NONE,q.DELTA,q.COMPONENTWISE_DELTA,q.RLE,q.MORTON,q.PDE],uv=[$e.NONE,$e.FAST_PFOR,$e.VARINT],hv=[Te.NONE,Te.SINGLE,Te.SHARED,Te.VERTEX,Te.MORTON,Te.FSST],cv=[lt.VERTEX,lt.INDEX,lt.STRING,lt.KEY],pv=[de.VAR_BINARY,de.GEOMETRIES,de.PARTS,de.RINGS,de.TRIANGLES,de.SYMBOL,de.DICTIONARY];function Q(e,t){let r=yv(e,t);return r.logicalLevelTechnique1===q.MORTON?fv(r,e,t):(q.RLE===r.logicalLevelTechnique1||q.RLE===r.logicalLevelTechnique2)&&$e.NONE!==r.physicalLevelTechnique?dv(r,e,t):r}function fv(e,t,r){let i=xe(t,r,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:i[0],coordinateShift:i[1]}}function dv(e,t,r){let i=xe(t,r,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}function yv(e,t){let r=e[t.get()],i=lv[r>>4],n={};switch(i){case ce.DATA:n={dictionaryType:hv[r&15]};break;case ce.OFFSET:n={offsetType:cv[r&15]};break;case ce.LENGTH:n={lengthType:pv[r&15]}}t.increment();let a=e[t.get()],s=Pc[a>>5],o=Pc[a>>2&7],l=uv[a&3];t.increment();let u=xe(e,t,2),h=u[0],c=u[1];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var H;(function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(H||(H={}));var Ye=class{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8),r=e%8;return(this.values[t]>>r&1)==1}set(e,t){let r=Math.floor(e/8),i=e%8;this.values[r]=this.values[r]|+!!t<<i}getInt(e){let t=Math.floor(e/8),r=e%8;return this.values[t]>>r&1}size(){return this._size}getBuffer(){return this.values}};function Vt(e,t,r){if(!t)return e;let i=t.size(),n=e.constructor,a=new n(i),s=0;for(let o=0;o<i;o++)a[o]=t.get(o)?e[s++]:r;return a}function mv(e,t,r){if(!r)return e;let i=r.size(),n=new Ye(e,t),a=new Ye(new Uint8Array(Math.ceil(i/8)),i),s=0;for(let o=0;o<i;o++){let l=r.get(o)?n.get(s++):!1;a.set(o,l)}return a.getBuffer()}function pr(e,t,r,i,n){let a=gv(e,Math.ceil(t/8),r,i);return n?mv(a,t,n):a}function gv(e,t,r,i){let n=new Uint8Array(t),a=0,s=i.get()+r;for(;a<t&&!(i.get()>=s);){let o=e[i.increment()];if(o<=127){let l=o+3,u=e[i.increment()],h=Math.min(a+l,t);n.fill(u,a,h),a=h}else{let l=256-o;for(let u=0;u<l&&a<t;u++)n[a++]=e[i.increment()]}}return i.set(s),n}function Mc(e,t,r,i){let n=t.get(),a=n+r*Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(n,a)).buffer,o=new Float32Array(s);return t.set(a),i?Vt(o,i,0):o}function zc(e,t,r,i){let n=t.get(),a=n+r*Float64Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(n,a)).buffer,o=new Float64Array(s);return t.set(a),i?Vt(o,i,0):o}function xv(e,t,r){let i=t.get(),n=r*Uint32Array.BYTES_PER_ELEMENT,a=new DataView(e.buffer,e.byteOffset,e.byteLength),s=new Uint32Array(r);for(let o=0;o<r;o++)s[o]=a.getUint32(i+o*Uint32Array.BYTES_PER_ELEMENT,!0);return t.add(n),s}function vv(e,t,r){let i=t.get(),n=r*BigUint64Array.BYTES_PER_ELEMENT,a=new DataView(e.buffer,e.byteOffset,e.byteLength),s=new BigUint64Array(r);for(let o=0;o<r;o++)s[o]=a.getBigUint64(i+o*BigUint64Array.BYTES_PER_ELEMENT,!0);return t.add(n),s}const bv=new TextDecoder;function lo(e,t,r){return r-t>=12?bv.decode(e.subarray(t,r)):wv(e,t,r)}function wv(e,t,r){let i="",n=t;for(;n<r;){let a=e[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=e[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=e[n+1],u=e[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=e[n+1],u=e[n+2],h=e[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function _n(e,t,r,i,n){return Ev(fr(e,t,r),r,i,n)}function be(e,t,r,i,n){return Tv(fr(e,t,r),r,i,n)}function xt(e,t,r){return Fv(fr(e,t,r),r)}function fr(e,t,r){let i=r.physicalLevelTechnique;switch(i){case $e.FAST_PFOR:return R2(e,r.numValues,r.byteLength,t);case $e.VARINT:return xe(e,t,r.numValues);case $e.NONE:return xv(e,t,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function fi(e,t,r){let i=r.physicalLevelTechnique;switch(i){case $e.VARINT:return no(e,t,r.numValues);case $e.NONE:return vv(e,t,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function _v(e,t,r){let i=fr(e,t,r);return i.length===1?Z(i[0]):iv(i)}function uo(e,t,r){let i=fr(e,t,r);return i.length===1?r.logicalLevelTechnique1===q.DELTA?Z(i[0]):i[0]:rv(i)}function Lc(e,t,r){return nv(fr(e,t,r))}function Vc(e,t,r){return ov(no(e,t,r.numValues))}function Oc(e,t,r,i){return Iv(fi(e,t,r),r,i)}function ho(e,t,r,i){return Rc(fi(e,t,r),r,i)}function Sv(e,t,r,i){let n=Av(e,t,r,!1);return i?Vt(n,i,0):n}function Av(e,t,r,i){if(r.physicalLevelTechnique===$e.VARINT)return kv(V2(e,t,r.numValues),r,i);let n=fi(e,t,r),a=Rc(n,r);return Float64Array.from(a,Number)}function Dv(e,t,r){let i=fi(e,t,r);return i.length===1?ve(i[0]):sv(i)}function $c(e,t,r){let i=fi(e,t,r);return i.length===1?r.logicalLevelTechnique1===q.DELTA?ve(i[0]):i[0]:av(i)}function Ev(e,t,r,i){let n;switch(t.logicalLevelTechnique1){case q.DELTA:if(t.logicalLevelTechnique2===q.RLE){let a=t;if(!i)return Q2(e,a.runs,a.numRleValues);e=ao(e,a.runs,a.numRleValues),n=kc(e)}else n=kc(e);break;case q.RLE:n=j2(e,t.runs,t.numRleValues);break;case q.MORTON:oo(e),n=new Int32Array(e);break;case q.COMPONENTWISE_DELTA:n=W2(e);break;case q.NONE:n=U2(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Vt(n,i,0):n}function Tv(e,t,r,i){let n;switch(t.logicalLevelTechnique1){case q.DELTA:if(t.logicalLevelTechnique2===q.RLE){let a=t;n=Cc(ao(e,a.runs,a.numRleValues))}else n=Cc(e);break;case q.RLE:n=ao(e,t.runs,t.numRleValues);break;case q.MORTON:oo(e),n=e;break;case q.COMPONENTWISE_DELTA:n=tv(e);break;case q.NONE:n=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Vt(n,i,0):n}function Iv(e,t,r){let i;switch(t.logicalLevelTechnique1){case q.DELTA:if(t.logicalLevelTechnique2===q.RLE){let n=t;if(!r)return ev(e,n.runs,n.numRleValues);e=so(e,n.runs,n.numRleValues),i=Fc(e)}else i=Fc(e);break;case q.RLE:i=Y2(e,t.runs,t.numRleValues);break;case q.NONE:i=q2(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Vt(i,r,0n):i}function Rc(e,t,r){let i;switch(t.logicalLevelTechnique1){case q.DELTA:if(t.logicalLevelTechnique2===q.RLE){let n=t;i=Bc(so(e,n.runs,n.numRleValues))}else i=Bc(e);break;case q.RLE:i=so(e,t.runs,t.numRleValues);break;case q.NONE:i=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Vt(i,r,0n):i}function kv(e,t,r){switch(t.logicalLevelTechnique1){case q.DELTA:if(t.logicalLevelTechnique2===q.RLE){let i=t;e=Ic(e,i.runs,i.numRleValues)}return G2(e),e;case q.RLE:return Bv(e,t,r);case q.NONE:return e;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}function Fv(e,t){if(t.logicalLevelTechnique1===q.DELTA&&t.logicalLevelTechnique2===q.NONE)return H2(e);if(t.logicalLevelTechnique1===q.RLE&&t.logicalLevelTechnique2===q.NONE){let r=t;return J2(e,r.runs,r.numRleValues)}if(t.logicalLevelTechnique1===q.NONE&&t.logicalLevelTechnique2===q.NONE){Z2(e);let r=new Uint32Array(t.numValues+1);return r[0]=0,r.set(e,1),r}if(t.logicalLevelTechnique1===q.DELTA&&t.logicalLevelTechnique2===q.RLE){let r=t,i=K2(e,r.runs,r.numRleValues);return oo(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}function Sn(e,t,r,i,n="int32"){let a=e.logicalLevelTechnique1;if(a===q.RLE)return e.runs===1?H.CONST:H.FLAT;if(a!==q.DELTA||e.logicalLevelTechnique2!==q.RLE)return e.numValues===1?H.CONST:H.FLAT;let s=t instanceof Ye?t.size():t,o=e;if(o.numRleValues!==s)return H.FLAT;if(o.runs===1)return H.SEQUENCE;if(o.runs!==2)return e.numValues===1?H.CONST:H.FLAT;let l=i.get();if(e.physicalLevelTechnique===$e.VARINT)return Cv(r,i,n)?H.SEQUENCE:e.numValues===1?H.CONST:H.FLAT;let u=i.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),h[2]===2&&h[3]===2?H.SEQUENCE:e.numValues===1?H.CONST:H.FLAT}function Cv(e,t,r){let i=new Dc(t.get());if(r==="int64"){let a=no(e,i,4);return a[2]===2n&&a[3]===2n}let n=xe(e,i,4);return n[2]===2&&n[3]===2}function Bv(e,t,r){return r?X2(e,t.runs,t.numRleValues):Ic(e,t.runs,t.numRleValues)}var Nc=class extends wn{getValueFromBuffer(e){return this.dataBuffer[e]}},Uc=class extends Sc{constructor(e,t,r,i,n){super(e,n?BigInt64Array.of(t):BigUint64Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}};function co(e,t,r){return{x:qc(e,t)-r,y:qc(e>>1,t)-r}}function qc(e,t){let r=0;for(let i=0;i<t;i++)r|=(e&1<<2*i)>>i;return r}var we;(function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"})(we||(we={}));var Pv;(function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"})(Pv||(Pv={}));var Ot;(function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"})(Ot||(Ot={}));function Mv(e){let t=Array(e.numGeometries),r=1,i=1,n=1,a=0,s=0,o=0,l=e.mortonSettings,u=e.topologyVector,h=u.geometryOffsets,c=u.partOffsets,p=u.ringOffsets,f=e.vertexOffsets,d=!f||f.length===0,y=e.containsPolygonGeometry(),m=e.vertexBuffer;for(let g=0;g<e.numGeometries;g++){let x=e.geometryType(g);switch(x){case we.POINT:{let v,b;if(d)v=m[s++],b=m[s++];else if(e.vertexBufferType===Ot.MORTON){let _=m[f[o++]],A=co(_,l.numBits,l.coordinateShift);v=A.x,b=A.y}else{let _=f[o++]*2;v=m[_],b=m[_+1]}t[a++]=[[new B(v,b)]],h&&n++,c&&r++,p&&i++}break;case we.MULTIPOINT:{let v=h[n]-h[n-1];n++;let b;if(d){b=Array(v);for(let _=0;_<v;_++){let A=m[s++],S=m[s++];b[_]=new B(A,S)}}else b=$t(e.vertexBufferType,m,f,o,v,!1,l),o+=v;t[a++]=b.map(_=>[_]),r+=v,i+=v}break;case we.LINESTRING:{let v;y?(v=p[i]-p[i-1],i++):v=c[r]-c[r-1],r++;let b;d?(b=dr(m,s,v,!1),s+=v*2):(b=$t(e.vertexBufferType,m,f,o,v,!1,l),o+=v),t[a++]=[b],h&&n++}break;case we.POLYGON:{let v=c[r]-c[r-1];r++;let b=Array(v-1),_,A=p[i]-p[i-1];if(i++,d){_=dr(m,s,A,!0),s+=A*2;for(let S=0;S<b.length;S++)A=p[i]-p[i-1],i++,b[S]=dr(m,s,A,!0),s+=A*2}else{_=$t(e.vertexBufferType,m,f,o,A,!0,l),o+=A;for(let S=0;S<b.length;S++)A=p[i]-p[i-1],i++,b[S]=$t(e.vertexBufferType,m,f,o,A,!0,l),o+=A}t[a++]=[_].concat(b),h&&n++}break;case we.MULTILINESTRING:{let v=h[n]-h[n-1];n++;let b=Array(v);for(let _=0;_<v;_++){let A;if(y?(A=p[i]-p[i-1],i++):A=c[r]-c[r-1],r++,d)b[_]=dr(m,s,A,!1),s+=A*2;else{let S=$t(e.vertexBufferType,m,f,o,A,!1,l);b[_]=S,o+=A}}t[a++]=b}break;case we.MULTIPOLYGON:{let v=h[n]-h[n-1];n++;let b=Array(v);for(let _=0;_<v;_++){let A=c[r]-c[r-1];r++;let S,E=Array(A-1),T=p[i]-p[i-1];i++,d?(S=dr(m,s,T,!0),s+=T*2):(S=$t(e.vertexBufferType,m,f,o,T,!0,l),o+=T);for(let z=0;z<E.length;z++){let O=p[i]-p[i-1];i++,d?(E[z]=dr(m,s,O,!0),s+=O*2):(E[z]=$t(e.vertexBufferType,m,f,o,O,!0,l),o+=O)}b[_]=[S].concat(E)}t[a++]=b.flat()}break;default:throw Error(`The specified geometry type (${x}) is currently not supported.`)}}return t}function $t(e,t,r,i,n,a,s){return e===Ot.MORTON?Lv(t,r,i,n,a,s):zv(t,r,i,n,a)}function dr(e,t,r,i){let n=Array(i?r+1:r);for(let a=0;a<r*2;a+=2){let s=e[t+a],o=e[t+a+1];n[a/2]=new B(s,o)}return i&&(n[n.length-1]=n[0]),n}function zv(e,t,r,i,n){let a=Array(n?i+1:i);for(let s=0;s<i*2;s+=2){let o=t[r+s/2]*2,l=e[o],u=e[o+1];a[s/2]=new B(l,u)}return n&&(a[a.length-1]=a[0]),a}function Lv(e,t,r,i,n,a){let s=Array(n?i+1:i);for(let o=0;o<i;o++){let l=e[t[r+o]],u=co(l,a.numBits,a.coordinateShift);s[o]=new B(u.x,u.y)}return n&&(s[s.length-1]=s[0]),s}var Gc=class{constructor(e,t,r,i,n){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let r=this.vertexOffsets[e],i=this.vertexBuffer[r],n=co(i,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[n.x,n.y]}let t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return Mv(this)}get mortonSettings(){return this._mortonSettings}};function Vv(e,t,r,i,n){return new jc(e,t,Ot.VEC_2,r,i,n)}function Ov(e,t,r,i,n,a){return new jc(e,t,Ot.MORTON,r,i,n,a)}var jc=class extends Gc{constructor(e,t,r,i,n,a,s){super(r,i,n,a,s),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===we.POLYGON||this._geometryType===we.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function Yc(e,t,r,i){return new Xc(Ot.VEC_2,e,t,r,i)}function $v(e,t,r,i,n){return new Xc(Ot.MORTON,e,t,r,i,n)}var Xc=class extends Gc{constructor(e,t,r,i,n,a){super(e,r,i,n,a),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===we.POLYGON||this.geometryType(e)===we.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},Zc=class{constructor(e,t,r,i){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let e=new Uint32Array(this.numGeometries);for(let t=0;t<this.numGeometries;t++)e[t]=this.geometryType(t);return Yc(e,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function Wc(e,t,r,i,n,a){return new Rv(e,t,r,i,n,a)}var Rv=class extends Zc{constructor(e,t,r,i,n,a){super(r,i,n,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};function Hc(e,t,r,i,n){return new Nv(e,t,r,i,n)}var Nv=class extends Zc{constructor(e,t,r,i,n){super(t,r,i,n),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function Uv(e,t,r,i,n){let a=Q(e,r),s=Sn(a,i,e,r),o,l,u,h;if(s===H.CONST){let v=uo(e,r,a),b,_,A,S;for(let E=0;E<t-1;E++){let T=Q(e,r);switch(T.physicalStreamType){case ce.LENGTH:switch(T.logicalStreamType.lengthType){case de.GEOMETRIES:b=xt(e,r,T);break;case de.PARTS:_=xt(e,r,T);break;case de.RINGS:A=xt(e,r,T);break;case de.TRIANGLES:S=xt(e,r,T)}break;case ce.OFFSET:switch(T.logicalStreamType.offsetType){case lt.VERTEX:o=be(e,r,T);break;case lt.INDEX:h=be(e,r,T)}break;case ce.DATA:if(Te.VERTEX===T.logicalStreamType.dictionaryType)l=_n(e,r,T,n);else{let z=T;u={numBits:z.numBits,coordinateShift:z.coordinateShift},l=be(e,r,T,n)}}}return h?b!==void 0||_!==void 0?Wc(i,v,S,h,l,{geometryOffsets:b,partOffsets:_,ringOffsets:A}):Wc(i,v,S,h,l):u===void 0?Vv(i,v,{geometryOffsets:b,partOffsets:_,ringOffsets:A},o,l):Ov(i,v,{geometryOffsets:b,partOffsets:_,ringOffsets:A},o,l,u)}let c=be(e,r,a),p,f,d,y;for(let v=0;v<t-1;v++){let b=Q(e,r);switch(b.physicalStreamType){case ce.LENGTH:switch(b.logicalStreamType.lengthType){case de.GEOMETRIES:p=be(e,r,b);break;case de.PARTS:f=be(e,r,b);break;case de.RINGS:d=be(e,r,b);break;case de.TRIANGLES:y=xt(e,r,b)}break;case ce.OFFSET:switch(b.logicalStreamType.offsetType){case lt.VERTEX:o=be(e,r,b);break;case lt.INDEX:h=be(e,r,b)}break;case ce.DATA:if(Te.VERTEX===b.logicalStreamType.dictionaryType)l=_n(e,r,b,n);else{let _=b;u={numBits:_.numBits,coordinateShift:_.coordinateShift},l=be(e,r,b,n)}}}let m,g,x;return p?(m=po(c,p,2),f&&d?(g=Kc(c,m,f,!1),x=Gv(c,m,g,d)):f&&(g=qv(c,m,f))):f&&d?(g=po(c,f,1),x=Kc(c,g,d,!0)):f&&(g=po(c,f,0)),h&&!g?Hc(c,y,h,l):h?Hc(c,y,h,l,{geometryOffsets:m,partOffsets:g,ringOffsets:x}):u===void 0?Yc(c,{geometryOffsets:m,partOffsets:g,ringOffsets:x},o,l):$v(c,{geometryOffsets:m,partOffsets:g,ringOffsets:x},o,l,u)}function po(e,t,r){let i=new Uint32Array(e.length+1),n=0;i[0]=n;let a=0;for(let s=0;s<e.length;s++)n=i[s+1]=n+(e[s]>r?t[a++]:1);return i}function Kc(e,t,r,i){let n=new Uint32Array(t[t.length-1]+1),a=0;n[0]=a;let s=1,o=0;for(let l=0;l<e.length;l++){let u=e[l],h=t[l+1]-t[l];if(u===5||u===2||i&&(u===4||u===1))for(let c=0;c<h;c++)a=n[s++]=a+r[o++];else for(let c=0;c<h;c++)n[s++]=++a}return n}function qv(e,t,r){let i=new Uint32Array(t[t.length-1]+1),n=0;i[0]=n;let a=1,s=0;for(let o=0;o<e.length;o++){let l=e[o],u=t[o+1]-t[o];if(l===4||l===1)for(let h=0;h<u;h++)n=i[a++]=n+r[s++];else for(let h=0;h<u;h++)i[a++]=++n}return i}function Gv(e,t,r,i){let n=new Uint32Array(r[r.length-1]+1),a=0;n[0]=a;let s=1,o=1,l=0;for(let u=0;u<e.length;u++){let h=e[u],c=t[u+1]-t[u];if(h!==0&&h!==3)for(let p=0;p<c;p++){let f=r[s]-r[s-1];s++;for(let d=0;d<f;d++)a=n[o++]=a+i[l++]}else for(let p=0;p<c;p++)n[o++]=++a,s++}return n}var jv=class extends zt{constructor(e,t,r){super(e,t.getBuffer(),r),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}},Yv=class extends wn{getValueFromBuffer(e){return this.dataBuffer[e]}},Jc=class extends zt{constructor(e,t,r,i){super(e,i?BigInt64Array.of(t):BigUint64Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}},fo=class extends zt{constructor(e,t,r,i){super(e,r,i),this.offsetBuffer=t}},Qc=class extends fo{constructor(e,t,r,i){super(e,t,r,i??t.length-1)}getValueFromBuffer(e){let t=this.offsetBuffer[e],r=this.offsetBuffer[e+1];return lo(this.dataBuffer,t,r)}},yr=class extends fo{constructor(e,t,r,i,n){super(e,r,i,n??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e],r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return lo(this.dataBuffer,r,i)}};function Xv(e,t){let r=0;for(let i=0;i<t.length;i++){let n=t[i];n===255?(r++,i++):r+=e[n]}return r}function Zv(e,t,r){let i=new Uint32Array(t.length);for(let s=1;s<t.length;s++)i[s]=i[s-1]+t[s-1];let n=new Uint8Array(Xv(t,r)),a=0;for(let s=0;s<r.length;s++){let o=r[s];if(o===255)s++,n[a++]=r[s];else{let l=t[o],u=i[o];for(;l-- >0;)n[a++]=e[u++]}}return n}var ep=class extends fo{constructor(e,t,r,i,n,a,s,o){super(e,r,i,s??t.length),this.indexBuffer=t,this.symbolOffsetBuffer=n,this.symbolTableBuffer=a,this.sharedDictionaryCache=o}getValueFromBuffer(e){var n;this.decodedDictionary??(this.decodedDictionary=(n=this.sharedDictionaryCache)==null?void 0:n.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let t=this.indexBuffer[e],r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return lo(this.decodedDictionary,r,i)}decodeDictionary(){return this.symbolLengthBuffer??(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),Zv(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),r=e[0];for(let i=1;i<e.length;i++){let n=e[i];t[i-1]=n-r,r=n}return t}};function tp(e,t,r,i,n){let a,s,o,l,u,h=n,c,p;for(let f=0;f<i;f++){let d=Q(t,r);switch(d.physicalStreamType){case ce.PRESENT:{let y=new Ye(pr(t,d.numValues,d.byteLength,r),d.numValues);h=n??y;break}case ce.OFFSET:s=be(t,r,d,void 0,h);break;case ce.LENGTH:{let y=xt(t,r,d);de.DICTIONARY===d.logicalStreamType.lengthType?a=y:de.SYMBOL===d.logicalStreamType.lengthType?l=y:c=y;break}case ce.DATA:{let y=t.subarray(r.get(),r.get()+d.byteLength);r.add(d.byteLength);let m=d.logicalStreamType.dictionaryType;Te.FSST===m?u=y:Te.SINGLE===m||Te.SHARED===m?o=y:Te.NONE===m&&(p=y);break}}}return Wv(e,u,s,a,o,l,h)??Hv(e,o,s,a,h)??Kv(e,c,p,s,h)}function Wv(e,t,r,i,n,a,s){if(t){if(!r||!i||!n||!a)throw Error(`Incomplete FSST dictionary string column "${e}"`);return new ep(e,r,i,n,a,t,s)}}function Hv(e,t,r,i,n){if(t){if(!r||!i)throw Error(`Incomplete dictionary string column "${e}"`);return n?new yr(e,r,i,t,n):new yr(e,r,i,t)}}function Kv(e,t,r,i,n){if(!(!t||!r)){if(i)return n?new yr(e,i,t,r,n):new yr(e,i,t,r);if(n&&n.size()!==t.length-1){let a=new Uint32Array(n.size()),s=0;for(let o=0;o<n.size();o++)n.get(o)?a[o]=s++:a[o]=0;return new yr(e,a,t,r,n)}return n?new Qc(e,t,r,n):new Qc(e,t,r)}}function Jv(e,t,r,i){let n,a,s,o,l=!1;for(;!l;){let f=Q(e,t);switch(f.physicalStreamType){case ce.LENGTH:de.DICTIONARY===f.logicalStreamType.lengthType?n=xt(e,t,f):s=xt(e,t,f);break;case ce.DATA:Te.SINGLE===f.logicalStreamType.dictionaryType||Te.SHARED===f.logicalStreamType.dictionaryType?(a=e.subarray(t.get(),t.get()+f.byteLength),l=!0):o=e.subarray(t.get(),t.get()+f.byteLength),t.add(f.byteLength)}}if(r.type!=="complexType")throw Error(`Shared dictionary column ${r.name} must be a complex (struct) column.`);if(!n||!a)throw Error(`Incomplete shared dictionary for column "${r.name}"`);let u=r.complexType.children,h=[],c=o?{}:void 0,p=0;for(let f of u){let d=xe(e,t,1)[0];if(d===0)continue;let y=f.name?`${r.name}${f.name}`:r.name;if(f.type!=="scalarField"||f.scalarField.physicalType!==X.STRING)throw Error("Currently only scalar string fields are implemented for a struct.");if(d>1&&!f.nullable||d===1&&f.nullable)throw Error(`The number of streams for the child field ${f.name} does not match its nullability. nullibilty: ${f.nullable}, numStreams: ${d}`);let m;if(f.nullable){let x=Q(e,t);m=new Ye(pr(e,x.numValues,x.byteLength,t),x.numValues)}let g=be(e,t,Q(e,t),void 0,m);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column "${y}"`);h[p++]=new ep(y,g,n,a,s,o,m,c)}else h[p++]=new yr(y,g,n,a,m)}return h}var rp=class extends zt{constructor(e,t,r){super(e,new Uint8Array,r??t.length),this.values=t}getValueFromBuffer(e){return this.values[e]}},ut;(function(e){e[e.STRING=1]="STRING",e[e.INT32=2]="INT32",e[e.UINT32=4]="UINT32",e[e.INT64=8]="INT64",e[e.UINT64=16]="UINT64",e[e.FLOAT=32]="FLOAT",e[e.DOUBLE=64]="DOUBLE",e[e.PRESENCE=128]="PRESENCE"})(ut||(ut={}));var Rt;(function(e){e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e[e.START_MAP=2]="START_MAP",e[e.START_LIST=3]="START_LIST",e[e.COUNT=4]="COUNT"})(Rt||(Rt={}));function Qv(e,t,r,i){let n=eb(r);if(i===0)return n.map(h=>new rp(h,[]));let a=tb(e,t,i),s=(a.presentStream?a.presentCount:a.lengthStream.length)/n.length,o=[],l=0,u=0;for(let h=0;h<n.length;h++){let c=sb(a,h,s,l,u);o.push(new rp(n[h],c.value,c.nullabilityBuffer)),l=c.countsEnd,u=c.valuesEnd}return o}function eb(e){let t=e.type==="complexType"?e.complexType.children:void 0;return!t||t.length===0?[e.name]:t.map(r=>e.name+(r.name??""))}function tb(e,t,r){let i=e[t.get()];t.add(1);let n=be(e,t,Q(e,t)),a=r-1,s=[];i&ut.STRING&&(a-=rb(e,t,s)),a-=ib(e,t,i,s),a-=nb(e,t,i,s);let o,l=0;if(i&ut.PRESENCE){let h=ab(e,t);o=h.value,l=h.count,a--}let u=new Uint32Array;if(a>0&&(u=be(e,t,Q(e,t)),a--),a!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${a}`);return{lengthStream:n,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}function rb(e,t,r){let i=e[t.get()];t.add(1);let n=tp("",e,t,i);if(n)for(let a=0;a<n.size;a++)r.push(n.getValue(a));return i}function ib(e,t,r,i){let n=0;return r&ut.INT32?(mr(i,_n(e,t,Q(e,t))),n++):r&ut.INT64&&(mr(i,Oc(e,t,Q(e,t))),n++),r&ut.UINT32?(mr(i,be(e,t,Q(e,t))),n++):r&ut.UINT64&&(mr(i,ho(e,t,Q(e,t))),n++),n}function nb(e,t,r,i){let n=0;return r&ut.FLOAT&&(mr(i,Mc(e,t,Q(e,t).numValues)),n++),r&ut.DOUBLE&&(mr(i,zc(e,t,Q(e,t).numValues)),n++),n}function ab(e,t){let r=Q(e,t);if(r.physicalStreamType!==ce.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${r.physicalStreamType}`);let i=r.numValues,n=t.get(),a=new Ye(pr(e,i,r.byteLength,t),i);return t.set(n+r.byteLength),{value:a,count:i}}function sb(e,t,r,i,n){let{lengthStream:a,flattenedValues:s,presentStream:o,dictionary:l}=e,u=t*r,h=r,c;if(o){c=new Ye(new Uint8Array(Math.ceil(r/8)),r),h=0;for(let x=0;x<r;x++)o.get(u+x)&&(c.set(x,!0),h++)}let p=i+h;if(p>a.length)throw Error("Merged map counts underflow while decoding child streams");let f=Array(r),d=i,y=n;for(let x=0;x<r;x++){if(o&&!o.get(u+x)){f[x]=null;continue}let v=y+a[d++];if(v>s.length)throw Error("Map value stream underflow while decoding feature payload");let b=ob(s,y,v,l);f[x]=b.value,y=b.nextIndex}let m=0;for(let x=i;x<p;x++)m+=a[x];let g=n+m;if(y!==g)throw Error("Unused flattened map values remain after decode");return{value:f,nullabilityBuffer:c,countsEnd:p,valuesEnd:g}}function ob(e,t,r,i){return r-t===1||e[t]===Rt.START_LIST?yo(e,t,r,i):ip(e,t,r,i)}function ip(e,t,r,i){let n=Object.create(null),a=t;for(;a<r;){let s=ap(e[a++],i);if(typeof s!="string")throw Error(`Map key dictionary index does not resolve to a string: ${s}`);let o=yo(e,a,r,i);n[s]=o.value,a=o.nextIndex}return{value:n,nextIndex:a}}function yo(e,t,r,i){if(t>=r)throw Error("Unexpected end of map value stream");let n=e[t];if(n===Rt.FALSE)return{value:!1,nextIndex:t+1};if(n===Rt.TRUE)return{value:!0,nextIndex:t+1};if(n===Rt.START_MAP){let a=np(e,t,r);return{value:ip(e,t+2,a,i).value,nextIndex:a}}if(n===Rt.START_LIST){let a=np(e,t,r),s=[],o=t+2;for(;o<a;){let l=yo(e,o,a,i);s.push(l.value),o=l.nextIndex}return{value:s,nextIndex:a}}return{value:ap(n,i),nextIndex:t+1}}function np(e,t,r){if(t+1>=r)throw Error("Missing length for nested map/list payload");let i=e[t+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let n=t+i;if(n>r)throw Error("Nested payload exceeds containing payload bounds");return n}function ap(e,t){let r=e-Rt.COUNT;if(r<0||r>=t.length)throw Error(`Scalar dictionary index out of range: ${e}`);return t[r]}function mr(e,t){for(let r of t)e.push(r)}function lb(e,t,r,i,n,a){var s;return r.type==="scalarType"?ub(i,e,t,n,r.scalarType,r):((s=r.complexType)==null?void 0:s.physicalType)===gt.MAP?Qv(e,t,r,i):i===0?null:Jv(e,t,r)}function ub(e,t,r,i,n,a){let s;if(e===0)return null;if(a.nullable){let l=Q(t,r),u=l.numValues,h=r.get(),c=pr(t,u,l.byteLength,r);r.set(h+l.byteLength),s=new Ye(c,l.numValues)}let o=s??i;switch(n.physicalType){case X.UINT_32:case X.INT_32:return db(t,r,a,n,o);case X.STRING:{let l=a.nullable?e-1:e;return tp(a.name,t,r,l,s)??null}case X.BOOLEAN:return hb(t,r,a,i,o);case X.UINT_64:case X.INT_64:return fb(t,r,a,o,n);case X.FLOAT:return cb(t,r,a,o);case X.DOUBLE:return pb(t,r,a,o);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}function hb(e,t,r,i,n){let a=Q(e,t),s=a.numValues,o=t.get(),l=di(n)?n:void 0,u=pr(e,s,a.byteLength,t,l);t.set(o+a.byteLength);let h=new Ye(u,s);return new jv(r.name,h,n)}function cb(e,t,r,i){let n=Q(e,t),a=di(i)?i:void 0,s=Mc(e,t,n.numValues,a);return new Yv(r.name,s,i)}function pb(e,t,r,i){let n=Q(e,t),a=di(i)?i:void 0,s=zc(e,t,n.numValues,a);return new Ks(r.name,s,i)}function fb(e,t,r,i,n){let a=Q(e,t),s=Sn(a,i,e,t,"int64"),o=n.physicalType===X.INT_64;if(s===H.FLAT){let u=di(i)?i:void 0,h=o?Oc(e,t,a,u):ho(e,t,a,u);return new Nc(r.name,h,i)}if(s===H.SEQUENCE){let u=Vc(e,t,a);return new Uc(r.name,u[0],u[1],a.numRleValues,o)}let l=o?Dv(e,t,a):$c(e,t,a);return new Jc(r.name,l,i,o)}function db(e,t,r,i,n){let a=Q(e,t),s=Sn(a,n,e,t),o=i.physicalType===X.INT_32;if(s===H.FLAT){let u=di(n)?n:void 0,h=o?_n(e,t,a,void 0,u):be(e,t,a,void 0,u);return new Hs(r.name,h,n)}if(s===H.SEQUENCE){let u=Lc(e,t,a);return new Js(r.name,u[0],u[1],a.numRleValues,o)}let l=o?_v(e,t,a):uo(e,t,a);return new Qs(r.name,l,n,o)}function di(e){return e instanceof Ye}const ye={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function sp(e){switch(e){case ye.ID:case ye.ID|ye.ID_NULLABLE:case ye.ID|ye.ID_LONG:case ye.ID|ye.ID_LONG|ye.ID_NULLABLE:return{nullable:(e&ye.ID_NULLABLE)!==0,columnScope:pi.FEATURE,type:"scalarType",scalarType:{longID:(e&ye.ID_LONG)!==0,type:"logicalType",logicalType:Ac.ID}};case ye.GEOMETRY:return{nullable:!1,columnScope:pi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:gt.GEOMETRY,children:[]}};case ye.STRUCT:return{nullable:!1,columnScope:pi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:gt.STRUCT,children:[]}};case ye.MAP:return{nullable:!0,columnScope:pi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:gt.MAP,children:[]}};default:return vb(e)}}function yb(e){return e>=ye.SCALAR_BASE}function op(e){return e===ye.STRUCT||e===ye.MAP}function mb(e){if(e.type==="scalarType"){let t=e.scalarType;if(t.type==="physicalType")switch(t.physicalType){case X.BOOLEAN:case X.INT_8:case X.UINT_8:case X.INT_32:case X.UINT_32:case X.INT_64:case X.UINT_64:case X.FLOAT:case X.DOUBLE:return!1;case X.STRING:return!0;default:return!1}if(t.type==="logicalType")return!1}else if(e.type==="complexType"){let t=e.complexType;if(t.type==="physicalType")switch(t.physicalType){case gt.GEOMETRY:case gt.STRUCT:case gt.MAP:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}function gb(e){var t;return e.type==="scalarType"&&((t=e.scalarType)==null?void 0:t.type)==="logicalType"&&e.scalarType.logicalType===Ac.ID}function xb(e){var t;return e.type==="complexType"&&((t=e.complexType)==null?void 0:t.type)==="physicalType"&&e.complexType.physicalType===gt.GEOMETRY}function vb(e){let t;switch(e){case 10:case 11:t=X.BOOLEAN;break;case 12:case 13:t=X.INT_8;break;case 14:case 15:t=X.UINT_8;break;case 16:case 17:t=X.INT_32;break;case 18:case 19:t=X.UINT_32;break;case 20:case 21:t=X.INT_64;break;case 22:case 23:t=X.UINT_64;break;case 24:case 25:t=X.FLOAT;break;case 26:case 27:t=X.DOUBLE;break;case 28:case 29:t=X.STRING;break;default:return null}return{nullable:!!(e&1),columnScope:pi.FEATURE,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:t}}}const bb=new TextDecoder,lp="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function mo(e,t){let r=xe(e,t,1)[0];if(r===0)return"";let i=t.get(),n=i+r,a=e.subarray(i,n);return t.add(r),bb.decode(a)}function wb(e){let t=e.name,r=e.nullable;return e.type==="scalarType"?{type:"scalarField",scalarField:e.scalarType,name:t,nullable:r}:{type:"complexField",complexField:e.complexType,name:t,nullable:r}}function up(e,t){let r=xe(e,t,1)[0]>>>0,i=r>=ye.SCALAR_BASE?sp(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let n={...i,name:mo(e,t)};if(n.type==="complexType"&&op(r)){let a=n.complexType,s=xe(e,t,1)[0]>>>0;a.children=Array(s);for(let o=0;o<s;o++)a.children[o]=up(e,t)}return wb(n)}function _b(e,t){let r=xe(e,t,1)[0]>>>0,i=sp(r);if(!i)throw Error(`Unsupported column type code ${r}. Supported: ${lp}`);let n;if(yb(r))n=mo(e,t);else if(r<ye.GEOMETRY)n="id";else if(r===ye.GEOMETRY)n="geometry";else throw Error(`Unsupported column type code ${r}. Supported: ${lp}`);let a={...i,name:n};if(a.type==="complexType"&&op(r)){let s=xe(e,t,1)[0]>>>0,o=a.complexType;o.children=Array(s);for(let l=0;l<s;l++)o.children[l]=up(e,t)}return a}function Sb(e,t){let r={};r.featureTables=[];let i={};if(i.name=mo(e,t),i.name.length===0)throw Error("Missing layer name");let n=xe(e,t,1)[0]>>>0,a=xe(e,t,1)[0]>>>0;i.columns=Array(a);for(let s=0;s<a;s++)i.columns[s]=_b(e,t);return r.featureTables.push(i),[r,n]}function Ab(e,t,r=!0){let i=new Dc(0),n=[];for(;i.get()<e.length;){let a=xe(e,i,1)[0]>>>0,s=i.get()+a;if(s>e.length)throw Error(`Block overruns tile: ${s} > ${e.length}`);let o=xe(e,i,1)[0]>>>0;if(o!==1&&o!==2){i.set(s);continue}let[l,u]=Sb(e,i),h=l.featureTables[0],c=null,p=null,f=[],d=0;for(let m of h.columns){let g=m.name;if(gb(m)){let x=null;if(m.nullable){let b=Q(e,i),_=i.get(),A=pr(e,b.numValues,b.byteLength,i);i.set(_+b.byteLength),x=new Ye(A,b.numValues)}let v=Q(e,i);d=x?x.size():v.decompressedCount,c=Db(e,m,i,g,v,x??d,r)}else if(xb(m)){let x=xe(e,i,1)[0];if(d===0){let v=i.get();d=Q(e,i).decompressedCount,i.set(v)}p=Uv(e,x,i,d,t)}else{let x=mb(m)?xe(e,i,1)[0]:1;if(x===0)continue;let v=lb(e,i,m,x,d);if(v)if(Array.isArray(v))for(let b of v)f.push(b);else f.push(v)}}let y=new Zx(h.name,p,c,f,u);n.push(y),i.set(s)}return n}function Db(e,t,r,i,n,a,s=!1){var h;let o=(h=t.scalarType)!=null&&h.longID?X.UINT_64:X.UINT_32,l=typeof a=="number"?void 0:a,u=Sn(n,a,e,r,o===X.UINT_64?"int64":"int32");if(o===X.UINT_32)switch(u){case H.FLAT:return new Hs(i,be(e,r,n,void 0,l),a);case H.SEQUENCE:{let c=Lc(e,r,n);return new Js(i,c[0],c[1],n.numRleValues,!1)}case H.CONST:return new Qs(i,uo(e,r,n),a,!1)}switch(u){case H.FLAT:return s?new Ks(i,Sv(e,r,n,l),a):new Nc(i,ho(e,r,n,l),a);case H.SEQUENCE:{let c=Vc(e,r,n);return new Uc(i,c[0],c[1],n.numRleValues,!1)}case H.CONST:return new Jc(i,$c(e,r,n),a,!1)}throw Error("Vector type not supported for id column.")}var Eb=class{constructor(e,t){var r;switch(this._featureData=e,this.properties=this._featureData.properties||{},(r=this._featureData.geometry)==null?void 0:r.type){case we.POINT:case we.MULTIPOINT:this.type=1;break;case we.LINESTRING:case we.MULTILINESTRING:this.type=2;break;case we.POLYGON:case we.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t of this._featureData.geometry.coordinates){let r=[];for(let i of t)r.push(new B(i.x,i.y));e.push(r)}return e}},Tb=class{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new Eb(this.features[e],this.extent)}},hp=class{constructor(e){this.layers={};let t=Ab(new Uint8Array(e));this.layers=t.reduce((r,i)=>({...r,[i.name]:new Tb(i)}),{})}},cp=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 Da(ne,16,0),this.grid3D=new Da(ne,16,0),this.featureIndexArray=new Lu,this.promoteId=t}insert(e,t,r,i,n,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);let o=a?this.grid3D:this.grid;for(let l of t){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(s,u[0],u[1],u[2],u[3])}}loadVTLayers(){if(!this.vtLayers){switch(this.encoding){case"mlt":this.vtLayers=new hp(this.rawTileData).layers;break;default:this.vtLayers=new dh(new Qh(this.rawTileData)).layers}this.sourceLayerCoder=new _c(this.vtLayers?Object.keys(this.vtLayers).sort():[Zs])}return this.vtLayers}query(e,t,r,i){this.loadVTLayers();let n=e.params,a=ne/e.tileSize/e.scale,s=Nr(n.filter,"queryRenderedFeatures filter",n.globalState),o=e.queryGeometry,l=e.queryPadding*a,u=pn.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=pn.fromPoints(e.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,m,g,x)=>Gm(e.cameraQueryGeometry,y-l,m-l,g+l,x+l));for(let y of p)h.push(y);h.sort(kb);let f={},d;for(let y of h){if(y===d)continue;d=y;let m=this.featureIndexArray.get(y),g=null;this.loadMatchingFeature(f,m.bucketIndex,m.sourceLayerIndex,m.featureIndex,s,n.layers,n.availableImages,t,r,i,(x,v,b)=>(g||(g=Ct(x)),v.queryIntersectsFeature({queryGeometry:o,feature:x,featureState:b,geometry:g,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return f}loadMatchingFeature(e,t,r,i,n,a,s,o,l,u,h){let c=this.bucketLayerIDs[t];if(a&&!c.some(y=>a.has(y)))return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(i);if(n.needGeometry){let y=nr(f,!0);if(!n.filter(new W(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new W(this.tileID.overscaledZ),f))return;let d=this.getId(f,p);for(let y of c){if(a&&!a.has(y))continue;let m=o[y];if(!m)continue;let g={};d&&u&&(g=u.getState(m.sourceLayer||"_geojsonTileLayer",d));let x=ke({},l[y]);x.paint=pp(x.paint,m.paint,f,g,s),x.layout=pp(x.layout,m.layout,f,g,s);let v=!h||h(f,m,g);if(!v)continue;let b=new Xx(f,this.z,this.x,this.y,d);b.layer=x;let _=e[y];_===void 0&&(_=e[y]=[]),_.push({featureIndex:i,feature:b,intersectionZ:v})}}lookupSymbolFeatures(e,t,r,i,n,a,s,o){let l={};this.loadVTLayers();let u=Nr(n.filterSpec,"queryRenderedFeatures symbol filter",n.globalState);for(let h of e)this.loadMatchingFeature(l,r,i,h,u,a,s,o,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let r of t)if(e===r)return!0;return!1}getId(e,t){var i;let r=e.id;if(this.promoteId){let n=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];r=e.properties[n],typeof r=="boolean"&&(r=Number(r)),r===void 0&&((i=e.properties)!=null&&i.cluster)&&this.promoteId&&(r=Number(e.properties.cluster_id))}return r}};C("FeatureIndex",cp,{omit:["rawTileData","sourceLayerCoder"]});function Ib(e){return typeof e=="object"&&!!e&&"evaluate"in e}function pp(e,t,r,i,n){return $n(e,(a,s)=>{let o=t instanceof Qi?t.get(s):null;return Ib(o)?o.evaluate(r,i,void 0,n):o})}function kb(e,t){return t-e}var Fb=class{constructor(e){this.maxEntries=e,this.map=new Map}get(e){let t=this.map.get(e);return t!==void 0&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxEntries){let r=this.map.keys().next().value;this.map.delete(r)}this.map.set(e,t)}clear(){this.map.clear()}};function Cb(e,t,r,i,n){let a=[];for(let s of e){let o;for(let l=0;l<s.length-1;l++){let u=s[l],h=s[l+1];u.x<t&&h.x<t||(u.x<t?u=new B(t,u.y+(h.y-u.y)*((t-u.x)/(h.x-u.x)))._round():h.x<t&&(h=new B(t,u.y+(h.y-u.y)*((t-u.x)/(h.x-u.x)))._round()),!(u.y<r&&h.y<r)&&(u.y<r?u=new B(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round():h.y<r&&(h=new B(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round()),!(u.x>=i&&h.x>=i)&&(u.x>=i?u=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round():h.x>=i&&(h=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round()),!(u.y>=n&&h.y>=n)&&(u.y>=n?u=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round():h.y>=n&&(h=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],a.push(o)),o.push(h)))))}}return a}function Bb(e,t,r,i,n,a){let s=fp(e,t,r,n,0);return s=fp(s,t,i,a,1),s}function fp(e,t,r,i,n){switch(t){case 1:return Pb(e,r,i,n);case 2:return dp(e,r,i,n,!1);case 3:return dp(e,r,i,n,!0)}return[]}function Pb(e,t,r,i){let n=[];for(let a of e)for(let s of a){let o=i===0?s.x:s.y;o>=t&&o<=r&&n.push([s])}return n}function Mb(e,t,r,i,n){let a=i===0?zb:Lb,s=[],o=[];for(let h=0;h<e.length-1;h++){let c=e[h],p=e[h+1],f=i===0?c.x:c.y,d=i===0?p.x:p.y,y=!1;f<t?d>t&&s.push(a(c,p,t)):f>r?d<r&&s.push(a(c,p,r)):s.push(c),d<t&&f>=t&&(s.push(a(c,p,t)),y=!0),d>r&&f<=r&&(s.push(a(c,p,r)),y=!0),!n&&y&&(o.push(s),s=[])}let l=e.length-1,u=i===0?e[l].x:e[l].y;return u>=t&&u<=r&&s.push(e[l]),n&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new B(s[0].x,s[0].y)),s.length>0&&o.push(s),o}function dp(e,t,r,i,n){let a=[];for(let s of e){let o=Mb(s,t,r,i,n);o.length>0&&a.push(...o)}return a}function zb(e,t,r){let i=(r-e.x)/(t.x-e.x);return new B(r,e.y+(t.y-e.y)*i)}function Lb(e,t,r){let i=(r-e.y)/(t.y-e.y);return new B(e.x+(t.x-e.x)*i,r)}var gr=class uf extends B{constructor(t,r,i,n){super(t,r),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new uf(this.x,this.y,this.angle,this.segment)}};C("Anchor",gr);function yp(e,t,r,i,n){if(t.segment===void 0||r===0)return!0;let a=t,s=t.segment+1,o=0;for(;o>-r/2;){if(s--,s<0)return!1;o-=e[s].dist(a),a=e[s]}o+=e[s].dist(e[s+1]),s++;let l=[],u=0;for(;o<r/2;){let h=e[s-1],c=e[s],p=e[s+1];if(!p)return!1;let f=h.angleTo(c)-c.angleTo(p);for(f=Math.abs((f+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:o,angleDelta:f}),u+=f;o-l[0].distance>i;)u-=l.shift().angleDelta;if(u>n)return!1;s++,o+=c.dist(p)}return!0}function mp(e){let t=0;for(let r=0;r<e.length-1;r++)t+=e[r].dist(e[r+1]);return t}function gp(e,t,r){return e?3/5*t*r:0}function xp(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Vb(e,t,r,i,n,a){let s=gp(r,n,a),o=xp(r,i)*a,l=0,u=mp(e)/2;for(let h=0;h<e.length-1;h++){let c=e[h],p=e[h+1],f=c.dist(p);if(l+f>u){let d=(u-l)/f,y=new gr(St.number(c.x,p.x,d),St.number(c.y,p.y,d),p.angleTo(c),h);return y._round(),!s||yp(e,y,o,s,t)?y:void 0}l+=f}}function Ob(e,t,r,i,n,a,s,o,l){let u=gp(i,a,s),h=xp(i,n),c=h*s,p=e[0].x===0||e[0].x===l||e[0].y===0||e[0].y===l;t-c<t/4&&(t=c+t/4);let f=a*2;return vp(e,p?t/2*o%t:(h/2+f)*s*o%t,t,u,r,c,p,!1,l)}function vp(e,t,r,i,n,a,s,o,l){let u=a/2,h=mp(e),c=0,p=t-r,f=[];for(let d=0;d<e.length-1;d++){let y=e[d],m=e[d+1],g=y.dist(m),x=m.angleTo(y);for(;p+r<c+g;){p+=r;let v=(p-c)/g,b=St.number(y.x,m.x,v),_=St.number(y.y,m.y,v);if(b>=0&&b<l&&_>=0&&_<l&&p-u>=0&&p+u<=h){let A=new gr(b,_,x,d);A._round(),(!i||yp(e,A,a,i,n))&&f.push(A)}}c+=g}return!o&&!f.length&&!s&&(f=vp(e,c/2,r,i,n,a,s,!0,l)),f}function bp(e,t,r,i){let n=[],a=e.image,s=a.pixelRatio,o=a.paddedRect.w-2,l=a.paddedRect.h-2,u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},h=a.stretchX||[[0,o]],c=a.stretchY||[[0,l]],p=(I,$)=>I+$[1]-$[0],f=h.reduce(p,0),d=c.reduce(p,0),y=o-f,m=l-d,g=0,x=f,v=0,b=d,_=0,A=y,S=0,E=m;if(a.content&&i){let I=a.content,$=I[2]-I[0],R=I[3]-I[1];(a.textFitWidth||a.textFitHeight)&&(u=hc(e)),g=An(h,0,I[0]),v=An(c,0,I[1]),x=An(h,I[0],I[2]),b=An(c,I[1],I[3]),_=I[0]-g,S=I[1]-v,A=$-x,E=R-b}let T=u.x1,z=u.y1,O=u.x2-T,P=u.y2-z,L=(I,$,R,F)=>{let N=Dn(I.stretch-g,x,O,T),K=En(I.fixed-_,A,I.stretch,f),le=Dn($.stretch-v,b,P,z),ue=En($.fixed-S,E,$.stretch,d),De=Dn(R.stretch-g,x,O,T),Re=En(R.fixed-_,A,R.stretch,f),Xe=Dn(F.stretch-v,b,P,z),yi=En(F.fixed-S,E,F.stretch,d),vt=new B(N,le),vr=new B(De,le),br=new B(De,Xe),In=new B(N,Xe),bo=new B(K/s,ue/s),wo=new B(Re/s,yi/s),Ie=t*Math.PI/180;if(Ie){let Cn=Math.sin(Ie),_e=Math.cos(Ie),Se=[_e,-Cn,Cn,_e];vt._matMult(Se),vr._matMult(Se),In._matMult(Se),br._matMult(Se)}let Ut=I.stretch+I.fixed,kn=R.stretch+R.fixed,Fn=$.stretch+$.fixed,_o=F.stretch+F.fixed;return{tl:vt,tr:vr,bl:In,br,tex:{x:a.paddedRect.x+1+Ut,y:a.paddedRect.y+1+Fn,w:kn-Ut,h:_o-Fn},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:bo,pixelOffsetBR:wo,minFontScaleX:A/s/O,minFontScaleY:E/s/P,isSDF:r}};if(!i||!a.stretchX&&!a.stretchY)n.push(L({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));else{let I=wp(h,y,f),$=wp(c,m,d);for(let R=0;R<I.length-1;R++){let F=I[R],N=I[R+1];for(let K=0;K<$.length-1;K++){let le=$[K],ue=$[K+1];n.push(L(F,le,N,ue))}}}return n}function An(e,t,r){let i=0;for(let n of e)i+=Math.max(t,Math.min(r,n[1]))-Math.max(t,Math.min(r,n[0]));return i}function wp(e,t,r){let i=[{fixed:-1,stretch:0}];for(let[n,a]of e){let s=i[i.length-1];i.push({fixed:n-s.stretch,stretch:s.stretch}),i.push({fixed:n-s.stretch,stretch:s.stretch+(a-n)})}return i.push({fixed:t+1,stretch:r}),i}function Dn(e,t,r,i){return e/t*r+i}function En(e,t,r,i){return e-t*r/i}function $b(e,t,r,i,n,a,s,o){let l=i.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[];for(let h of t.positionedLines)for(let c of h.positionedGlyphs){if(!c.rect)continue;let p=c.rect||{},f=4,d=!0,y=1,m=0,g=(n||o)&&c.vertical,x=c.metrics.advance*c.scale/2;if(o&&t.verticalizable){let F=(c.scale-1)*24,N=(24-c.metrics.width*c.scale)/2;m=h.lineOffset/2-(c.imageName?-N:F)}if(c.imageName){let F=s[c.imageName];d=F.sdf,y=F.pixelRatio,f=1/y}let v=n?[c.x+x,c.y]:[0,0],b=n?[0,0]:[c.x+x+r[0],c.y+r[1]-m],_=[0,0];g&&(_=b,b=[0,0]);let A=c.metrics.isDoubleResolution?2:1,S=(c.metrics.left-f)*c.scale-x+b[0],E=(-c.metrics.top-f)*c.scale+b[1],T=S+p.w/A*c.scale/y,z=E+p.h/A*c.scale/y,O=new B(S,E),P=new B(T,E),L=new B(S,z),I=new B(T,z);if(g){let F=new B(-x,x- -17),N=-Math.PI/2,K=12-x,le=c.imageName?K:0,ue=new B(22-K,-le),De=new B(..._);O._rotateAround(N,F)._add(ue)._add(De),P._rotateAround(N,F)._add(ue)._add(De),L._rotateAround(N,F)._add(ue)._add(De),I._rotateAround(N,F)._add(ue)._add(De)}if(l){let F=Math.sin(l),N=Math.cos(l),K=[N,-F,F,N];O._matMult(K),P._matMult(K),L._matMult(K),I._matMult(K)}let $=new B(0,0),R=new B(0,0);u.push({tl:O,tr:P,bl:L,br:I,tex:p,writingMode:t.writingMode,glyphOffset:v,sectionIndex:c.sectionIndex,isSDF:d,pixelOffsetTL:$,pixelOffsetBR:R,minFontScaleX:0,minFontScaleY:0})}return u}var Tn=class{constructor(e,t,r,i,n,a,s,o,l,u){var h;if(this.boxStartIndex=e.length,l){let c=a.top,p=a.bottom,f=a.collisionPadding;f&&(c-=f[1],p+=f[3]);let d=p-c;d>0&&(d=Math.max(10,d),this.circleDiameter=d)}else{let c=(h=a.image)!=null&&h.content&&(a.image.textFitWidth||a.image.textFitHeight)?hc(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};c.y1=c.y1*s-o[0],c.y2=c.y2*s+o[2],c.x1=c.x1*s-o[3],c.x2=c.x2*s+o[1];let p=a.collisionPadding;if(p&&(c.x1-=p[0]*s,c.y1-=p[1]*s,c.x2+=p[2]*s,c.y2+=p[3]*s),u){let f=new B(c.x1,c.y1),d=new B(c.x2,c.y1),y=new B(c.x1,c.y2),m=new B(c.x2,c.y2),g=u*Math.PI/180;f._rotate(g),d._rotate(g),y._rotate(g),m._rotate(g),c.x1=Math.min(f.x,d.x,y.x,m.x),c.x2=Math.max(f.x,d.x,y.x,m.x),c.y1=Math.min(f.y,d.y,y.y,m.y),c.y2=Math.max(f.y,d.y,y.y,m.y)}e.emplaceBack(t.x,t.y,c.x1,c.y1,c.x2,c.y2,r,i,n)}this.boxEndIndex=e.length}},Rb=class{constructor(e=[],t=(r,i)=>r<i?-1:+(r>i)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}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:r}=this,i=t[e];for(;e>0;){let n=e-1>>1,a=t[n];if(r(i,a)>=0)break;t[e]=a,e=n}t[e]=i}_down(e){let{data:t,compare:r}=this,i=this.length>>1,n=t[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&r(t[s],t[a])<0&&(a=s),r(t[a],n)>=0)break;t[e]=t[a],e=a}t[e]=n}};function Nb(e,t=1){let r=pn.fromPoints(e[0]),i=Math.min(r.width(),r.height()),n=i/2,a=new Rb([],Ub),{minX:s,minY:o,maxX:l,maxY:u}=r;if(i===0)return new B(s,o);for(let p=s;p<l;p+=i)for(let f=o;f<u;f+=i)a.push(new xr(p+n,f+n,n,e));let h=Gb(e),c=h;for(;a.length;){let p=a.pop();(p.d>c.d||!c.d)&&(c=p),!(p.max-c.d<=t)&&(n=p.h/2,a.push(new xr(p.p.x-n,p.p.y-n,n,e)),a.push(new xr(p.p.x+n,p.p.y-n,n,e)),a.push(new xr(p.p.x-n,p.p.y+n,n,e)),a.push(new xr(p.p.x+n,p.p.y+n,n,e)))}return h.d>0&&c.d-h.d<=t?h.p:c.p}function Ub(e,t){return t.max-e.max}var xr=class{constructor(e,t,r,i){this.p=new B(e,t),this.h=r,this.d=qb(this.p,i),this.max=this.d+this.h*Math.SQRT2}};function qb(e,t){let r=!1,i=1/0;for(let n of t)for(let a=0,s=n.length,o=s-1;a<s;o=a++){let l=n[a],u=n[o];l.y>e.y!=u.y>e.y&&e.x<(u.x-l.x)*(e.y-l.y)/(u.y-l.y)+l.x&&(r=!r),i=Math.min(i,Wu(e,l,u))}return(r?1:-1)*Math.sqrt(i)}function Gb(e){let t=0,r=0,i=0,n=e[0];for(let a=0,s=n.length,o=s-1;a<s;o=a++){let l=n[a],u=n[o],h=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*h,i+=(l.y+u.y)*h,t+=h*3}return new xr(r/t,i/t,0,e)}let jb=(function(e){return 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})({});const go=1/0;function _p(e,t){function r(n,a){let s=0,o=0;a<0&&(a=0);let l=a/Math.SQRT2;switch(n){case"top-right":case"top-left":o=l-7;break;case"bottom-right":case"bottom-left":o=-l+7;break;case"bottom":o=-a+7;break;case"top":o=a-7}switch(n){case"top-right":case"bottom-right":s=-l;break;case"top-left":case"bottom-left":s=l;break;case"left":s=a;break;case"right":s=-a}return[s,o]}function i(n,a,s){let o=0,l=0;switch(a=Math.abs(a),s=Math.abs(s),n){case"top-right":case"top-left":case"top":l=s-7;break;case"bottom-right":case"bottom-left":case"bottom":l=-s+7}switch(n){case"top-right":case"bottom-right":case"right":o=-a;break;case"top-left":case"bottom-left":case"left":o=a}return[o,l]}return t[1]===go?r(e,t[0]):i(e,t[0],t[1])}function Sp(e,t,r){var s;let i=e.layout,n=(s=i.get("text-variable-anchor-offset"))==null?void 0:s.evaluate(t,{},r);if(n){let o=n.values,l=[];for(let u=0;u<o.length;u+=2){let h=l[u]=o[u],c=o[u+1].map(p=>p*24);h.startsWith("top")?c[1]-=7:h.startsWith("bottom")&&(c[1]+=7),l[u+1]=c}return new He(l)}let a=i.get("text-variable-anchor");if(a){let o;o=e._unevaluatedLayout.getValue("text-radial-offset")===void 0?i.get("text-offset").evaluate(t,{},r).map(u=>u*24):[i.get("text-radial-offset").evaluate(t,{},r)*24,go];let l=[];for(let u of a)l.push(u,_p(u,o));return new He(l)}return null}function Yb(e){var h,c;e.bucket.createArrays();let t=512*e.bucket.overscaling;e.bucket.tilePixelRatio=ne/t,e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;let r=e.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,a={layoutIconSize:n["icon-size"].possiblyEvaluate(new W(e.bucket.zoom+1),e.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new W(e.bucket.zoom+1),e.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new W(18))};if(e.bucket.textSizeData.kind==="composite"){let{minZoom:p,maxZoom:f}=e.bucket.textSizeData;a.compositeTextSizes=[n["text-size"].possiblyEvaluate(new W(p),e.canonical),n["text-size"].possiblyEvaluate(new W(f),e.canonical)]}if(e.bucket.iconSizeData.kind==="composite"){let{minZoom:p,maxZoom:f}=e.bucket.iconSizeData;a.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new W(p),e.canonical),n["icon-size"].possiblyEvaluate(new W(f),e.canonical)]}let s=i.get("text-line-height")*24,o=i.get("text-rotation-alignment")!=="viewport"&&i.get("symbol-placement")!=="point",l=i.get("text-keep-upright"),u=i.get("text-size");for(let p of e.bucket.features){let f=i.get("text-font").evaluate(p,{},e.canonical).join(","),d=u.evaluate(p,{},e.canonical),y=a.layoutTextSize.evaluate(p,{},e.canonical),m=a.layoutIconSize.evaluate(p,{},e.canonical),g={horizontal:{},vertical:void 0},x=p.text,v=[0,0];if(x){let S=x.toString(),E=i.get("text-letter-spacing").evaluate(p,{},e.canonical)*24,T=rm(S)?E:0,z=i.get("text-anchor").evaluate(p,{},e.canonical),O=Sp(r,p,e.canonical);if(!O){let $=i.get("text-radial-offset").evaluate(p,{},e.canonical);v=$?_p(z,[$*24,go]):i.get("text-offset").evaluate(p,{},e.canonical).map(R=>R*24)}let P=o?"center":i.get("text-justify").evaluate(p,{},e.canonical),L=i.get("symbol-placement")==="point"?i.get("text-max-width").evaluate(p,{},e.canonical)*24:1/0,I=()=>{e.bucket.allowVerticalPlacement&&Ia(S)&&(g.vertical=xn(x,e.glyphMap,e.glyphPositions,e.imagePositions,f,L,s,z,"left",T,v,2,!0,y,d))};if(!o&&O){let $=new Set;if(P==="auto")for(let F=0;F<O.values.length;F+=2)$.add(Ap(O.values[F]));else $.add(P);let R=!1;for(let F of $)if(!g.horizontal[F])if(R)g.horizontal[F]=g.horizontal[0];else{let N=xn(x,e.glyphMap,e.glyphPositions,e.imagePositions,f,L,s,"center",F,T,v,1,!1,y,d);N&&(g.horizontal[F]=N,R=N.positionedLines.length===1)}I()}else{P==="auto"&&(P=Ap(z));let $=xn(x,e.glyphMap,e.glyphPositions,e.imagePositions,f,L,s,z,P,T,v,1,!1,y,d);$&&(g.horizontal[P]=$),I(),Ia(S)&&o&&l&&(g.vertical=xn(x,e.glyphMap,e.glyphPositions,e.imagePositions,f,L,s,z,P,T,v,2,!1,y,d))}}let b,_=!1;if((h=p.icon)!=null&&h.name){let S=e.imageMap[p.icon.name];S&&(b=dx(e.imagePositions[p.icon.name],i.get("icon-offset").evaluate(p,{},e.canonical),i.get("icon-anchor").evaluate(p,{},e.canonical)),_=!!S.sdf,e.bucket.sdfIcons===void 0?e.bucket.sdfIcons=_:e.bucket.sdfIcons!==_&&ge("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),S.pixelRatio===e.bucket.pixelRatio?i.get("icon-rotate").constantOr(1)!==0&&(e.bucket.iconsNeedLinear=!0):e.bucket.iconsNeedLinear=!0)}let A=Ep(g.horizontal)||g.vertical;(c=e.bucket).iconsInText||(c.iconsInText=A?A.iconsInText:!1),(A||b)&&Xb(e.bucket,p,g,b,e.imageMap,a,y,m,v,_,e.canonical,e.subdivisionGranularity)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()}function Ap(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"}function Xb(e,t,r,i,n,a,s,o,l,u,h,c){let p=a.textMaxSize.evaluate(t,{});p===void 0&&(p=s);let f=e.layers[0].layout,d=f.get("icon-offset").evaluate(t,{},h),y=Ep(r.horizontal),m=s/24,g=e.tilePixelRatio*m,x=e.tilePixelRatio*p/24,v=e.tilePixelRatio*o,b=e.tilePixelRatio*f.get("symbol-spacing"),_=f.get("text-padding")*e.tilePixelRatio,A=Dx(f,t,h,e.tilePixelRatio),S=f.get("text-max-angle")/180*Math.PI,E=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",T=f.get("icon-rotation-alignment").constantOr("viewport")==="map"&&f.get("symbol-placement")!=="point",z=f.get("symbol-placement"),O=b/2,P=f.get("icon-text-fit"),L;i&&P!=="none"&&(e.allowVerticalPlacement&&r.vertical&&(L=cc(i,r.vertical,P,f.get("icon-text-fit-padding"),d,m)),y&&(i=cc(i,y,P,f.get("icon-text-fit-padding"),d,m)));let I=h?c.line.getGranularityForZoomLevel(h.z):1,$=(R,F)=>{F.x<0||F.x>=8192||F.y<0||F.y>=8192||Wb(e,F,R,r,i,n,L,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,g,[_,_,_,_],E,l,v,A,T,d,t,a,u,h,s)};if(z==="line")for(let R of Cb(t.geometry,0,0,ne,ne)){let F=Mt(R,I),N=Ob(F,b,S,r.vertical||y,i,24,x,e.overscaling,ne);for(let K of N){let le=y;(!le||!Hb(e,le.text,O,K))&&$(F,K)}}else if(z==="line-center"){for(let R of t.geometry)if(R.length>1){let F=Mt(R,I),N=Vb(F,S,r.vertical||y,i,24,x);N&&$(F,N)}}else if(t.type==="Polygon")for(let R of Pi(t.geometry,0)){let F=Nb(R,16);$(Mt(R[0],I,!0),new gr(F.x,F.y,0))}else if(t.type==="LineString")for(let R of t.geometry){let F=Mt(R,I);$(F,new gr(F[0].x,F[0].y,0))}else if(t.type==="Point")for(let R of t.geometry)for(let F of R)$([F],new gr(F.x,F.y,0))}function Zb(e,t){let r=e.length,i=t==null?void 0:t.values;if((i==null?void 0:i.length)>0)for(let n=0;n<i.length;n+=2){let a=jb[i[n]],s=i[n+1];e.emplaceBack(a,s[0],s[1])}return[r,e.length]}function Dp(e,t,r,i,n,a,s,o,l,u,h,c,p,f,d,y){let m=$b(t,r,o,n,a,s,i,e.allowVerticalPlacement),g=e.textSizeData,x=null;g.kind==="source"?(x=[128*n.layout.get("text-size").evaluate(s,{})],x[0]>32640&&ge(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):g.kind==="composite"&&(x=[128*d.compositeTextSizes[0].evaluate(s,{},y),128*d.compositeTextSizes[1].evaluate(s,{},y)],(x[0]>32640||x[1]>32640)&&ge(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,m,x,o,a,s,h,t,u.lineStartIndex,u.lineLength,f,y,l);for(let v of c)p[v]=e.text.placedSymbolArray.length-1;return m.length*4}function Ep(e){for(let t in e)return e[t];return null}function Wb(e,t,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,_,A,S,E){let T=e.addToLineVertexArray(t,r),z=o.layout.get("symbol-height-offset").evaluate(b,{},S),O,P,L,I,$=0,R=0,F=0,N=0,K=-1,le=-1,ue={},De=(0,Ka.default)("");if(e.allowVerticalPlacement&&i.vertical){let _e=o.layout.get("text-rotate").evaluate(b,{},S)+90,Se=i.vertical;L=new Tn(l,t,u,h,c,Se,p,f,d,_e),s&&(I=new Tn(l,t,u,h,c,s,m,g,d,_e))}if(n){let _e=o.layout.get("icon-rotate").evaluate(b,{}),Se=o.layout.get("icon-text-fit")!=="none",mi=bp(n,_e,A,Se),So=s?bp(s,_e,A,Se):void 0;P=new Tn(l,t,u,h,c,n,m,g,!1,_e),$=mi.length*4;let Pp=e.iconSizeData,qt=null;Pp.kind==="source"?(qt=[128*o.layout.get("icon-size").evaluate(b,{})],qt[0]>32640&&ge(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Pp.kind==="composite"&&(qt=[128*_.compositeIconSizes[0].evaluate(b,{},S),128*_.compositeIconSizes[1].evaluate(b,{},S)],(qt[0]>32640||qt[1]>32640)&&ge(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,mi,qt,v,x,b,0,t,T.lineStartIndex,T.lineLength,-1,S,z),K=e.icon.placedSymbolArray.length-1,So&&(R=So.length*4,e.addSymbols(e.icon,So,qt,v,x,b,2,t,T.lineStartIndex,T.lineLength,-1,S,z),le=e.icon.placedSymbolArray.length-1)}let Re=Object.keys(i.horizontal);for(let _e of Re){let Se=i.horizontal[_e];O||(O=(De=(0,Ka.default)(Se.text),new Tn(l,t,u,h,c,Se,p,f,d,o.layout.get("text-rotate").evaluate(b,{},S))));let mi=Se.positionedLines.length===1;if(F+=Dp(e,t,Se,a,o,d,b,y,z,T,i.vertical?1:3,mi?Re:[_e],ue,K,_,S),mi)break}i.vertical&&(N+=Dp(e,t,i.vertical,a,o,d,b,y,z,T,2,["vertical"],ue,le,_,S));let Xe=O?O.boxStartIndex:e.collisionBoxArray.length,yi=O?O.boxEndIndex:e.collisionBoxArray.length,vt=L?L.boxStartIndex:e.collisionBoxArray.length,vr=L?L.boxEndIndex:e.collisionBoxArray.length,br=P?P.boxStartIndex:e.collisionBoxArray.length,In=P?P.boxEndIndex:e.collisionBoxArray.length,bo=I?I.boxStartIndex:e.collisionBoxArray.length,wo=I?I.boxEndIndex:e.collisionBoxArray.length,Ie=-1,Ut=(_e,Se)=>_e!=null&&_e.circleDiameter?Math.max(_e.circleDiameter,Se):Se;Ie=Ut(O,Ie),Ie=Ut(L,Ie),Ie=Ut(P,Ie),Ie=Ut(I,Ie);let kn=+(Ie>-1);kn&&(Ie*=E/24),e.glyphOffsetArray.length>=cr.MAX_GLYPHS&&ge("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),b.sortKey!==void 0&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey);let Fn=Sp(o,b,S),[_o,Cn]=Zb(e.textAnchorOffsets,Fn);e.symbolInstances.emplaceBack(t.x,t.y,ue.right>=0?ue.right:-1,ue.center>=0?ue.center:-1,ue.left>=0?ue.left:-1,ue.vertical||-1,K,le,De,Xe,yi,vt,vr,br,In,bo,wo,u,F,N,$,R,kn,0,p,Ie,_o,Cn,z)}function Hb(e,t,r,i){let n=e.compareText;if(!(t in n))n[t]=[];else{let a=n[t];for(let s=a.length-1;s>=0;s--)if(i.dist(a[s])<r)return!0}return n[t].push(i),!1}/**
6
+ * MapLibre GL JS
7
+ * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.7.0/LICENSE.txt
8
+ */function xo(e){let t=typeof e;if(t==="number"||t==="boolean"||t==="string"||e==null)return JSON.stringify(e);if(Array.isArray(e)){let n="[";for(let a of e)n+=`${xo(a)},`;return`${n}]`}let r=Object.keys(e).sort(),i="{";for(let n=0;n<r.length;n++)i+=`${JSON.stringify(r[n])}:${xo(e[r[n]])},`;return`${i}}`}function Kb(e){let t="";for(let r of Wf)t+=`/${xo(e[r])}`;return t}function Jb(e,t){let r={};for(let n=0;n<e.length;n++){let a=t&&t[e[n].id]||Kb(e[n]);t&&(t[e[n].id]=a);let s=r[a];s||(s=r[a]=[]),s.push(e[n])}let i=[];for(let n in r)i.push(r[n]);return i}var Qb=class{constructor(e,t){this.keyCache={},e&&this.replace(e,t)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(e,t,r){for(let n of e){this._layerConfigs[n.id]=n;let a=this._layers[n.id]=Cx(n,r);a._featureFilter=Nr(a.filter,`layers[${n.id}].filter`,r),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(let n of t)delete this.keyCache[n],delete this._layerConfigs[n],delete this._layers[n];this.familiesBySource={};let i=Jb(Object.values(this._layerConfigs),this.keyCache);for(let n of i){let a=n.map(c=>this._layers[c.id]),s=a[0];if(s.isHidden())continue;let o=s.source||"",l=this.familiesBySource[o];l||(l=this.familiesBySource[o]={});let u=s.sourceLayer||"_geojsonTileLayer",h=l[u];h||(h=l[u]=[]),h.push(a)}}},Tp=class{constructor(e){let t={},r=[];for(let s in e){let o=e[s],l=t[s]={};for(let u in o){let h=o[u];if(!h||h.bitmap.width===0||h.bitmap.height===0)continue;let c={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(c),l[u]={rect:c,metrics:h.metrics}}}let{w:i,h:n}=tc(r),a=new us({width:i||1,height:n||1});for(let s in e){let o=e[s];for(let l in o){let u=o[l];if(!u||u.bitmap.width===0||u.bitmap.height===0)continue;let h=t[s][l].rect;us.copy(u.bitmap,a,{x:0,y:0},{x:h.x+1,y:h.y+1},u.bitmap)}}this.image=a,this.positions=t}};C("GlyphAtlas",Tp);var Ip=class{constructor(e){this.tileID=new xc(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=[]}async parse(e,t,r,i,n){this.data=e,this.collisionBoxArray=new Eu;let a=new _c(Object.keys(e.layers).sort()),s=new cp(this.tileID,this.promoteId);s.bucketLayerIDs=[];let o={},l={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:r,subdivisionGranularity:n},u=t.familiesBySource[this.source];for(let E in u){let T=e.layers[E];if(!T)continue;T.version===1&&ge(`Vector tile source "${this.source}" layer "${E}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let z=a.encode(E),O=[];for(let P=0;P<T.length;P++){let L=T.feature(P),I=s.getId(L,E);O.push({feature:L,id:I,index:P,sourceLayerIndex:z})}for(let P of u[E]){let L=P[0];L.source!==this.source&&ge(`layer.source = ${L.source} does not equal this.source = ${this.source}`),!L.isHidden(this.zoom,!0)&&(vo(P,this.zoom,r),(o[L.id]=L.createBucket({index:s.bucketLayerIDs.length,layers:P,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:z,sourceID:this.source})).populate(O,l,this.tileID.canonical),s.bucketLayerIDs.push(P.map(I=>I.id)))}}let h=$n(l.glyphDependencies,E=>Object.keys(E));for(let E of this.inFlightDependencies)E==null||E.abort();this.inFlightDependencies=[];let c=Promise.resolve({});if(Object.keys(h).length){let E=new AbortController;this.inFlightDependencies.push(E),c=i.sendAsync({type:"GG",data:{stacks:h,source:this.source,tileID:this.tileID,type:"glyphs"}},E)}let p=Object.keys(l.iconDependencies),f=Promise.resolve({});if(p.length){let E=new AbortController;this.inFlightDependencies.push(E),f=i.sendAsync({type:"GI",data:{icons:p,source:this.source,tileID:this.tileID,type:"icons"}},E)}let d=Object.keys(l.patternDependencies),y=Promise.resolve({});if(d.length){let E=new AbortController;this.inFlightDependencies.push(E),y=i.sendAsync({type:"GI",data:{icons:d,source:this.source,tileID:this.tileID,type:"patterns"}},E)}let m=l.dashDependencies,g=Promise.resolve({});if(Object.keys(m).length){let E=new AbortController;this.inFlightDependencies.push(E),g=i.sendAsync({type:"GDA",data:{dashes:m}},E)}let[x,v,b,_]=await Promise.all([c,f,y,g]),A=new Tp(x),S=new ic(v,b);for(let E in o){let T=o[E];T instanceof cr?(vo(T.layers,this.zoom,r),Yb({bucket:T,glyphMap:x,glyphPositions:A.positions,imageMap:v,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:l.subdivisionGranularity})):T.hasDependencies&&(T instanceof _s||T instanceof Ts||T instanceof Ns)&&(vo(T.layers,this.zoom,r),T.addFeatures(l,this.tileID.canonical,S.patternPositions,_))}return{buckets:Object.values(o).filter(E=>!E.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:A.image,imageAtlas:S,dashPositions:_,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?v:null,glyphPositions:this.returnDependencies?A.positions:null}}};function vo(e,t,r){let i=new W(t);for(let n of e)n.recalculate(i,r)}var kp=class{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(e,t){this.loading[e]=t}finishLoading(e){delete this.loading[e]}abort(e){let t=this.loading[e];t!=null&&t.abort&&(t.abort.abort(),delete this.loading[e])}getParsing(e){return this.parsing[e]}setParsing(e,t){this.parsing[e]=t}removeParsing(e){delete this.parsing[e]}markLoaded(e,t){this.loaded[e]=t}getLoaded(e){let t=this.loaded[e];if(t)return t}removeLoaded(e){delete this.loaded[e]}clearLoaded(){this.loaded={}}},Fp=class{constructor(e){this.start=`${e}#start`,this.end=`${e}#end`,this.measure=e,performance.mark(this.start)}finish(){performance.mark(this.end);let e=performance.getEntriesByName(this.measure);return e.length===0&&(performance.measure(this.measure,this.start,this.end),e=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),e}},ew=class{constructor(e,t,r,i,n){this.type=e,this.properties=r||{},this.extent=n,this.pointsArray=t,this.id=i}loadGeometry(){return this.pointsArray.map(e=>e.map(t=>new B(t.x,t.y)))}},tw=class{constructor(e,t,r){this.version=2,this._myFeatures=e,this.name=t,this.length=e.length,this.extent=r}feature(e){return this._myFeatures[e]}},rw=class{constructor(){this.layers={}}addLayer(e){this.layers[e.name]=e}};function iw(e,t,r){let{extent:i}=e,n=2**(r.z-t.z),a=(r.x-t.x*n)*i,s=(r.y-t.y*n)*i,o=[];for(let l=0;l<e.length;l++){let u=e.feature(l),h=u.loadGeometry();for(let c of h)for(let p of c)p.x=p.x*n-a,p.y=p.y*n-s;h=Bb(h,u.type,-128,-128,i+128,i+128),h.length!==0&&o.push(new ew(u.type,h,u.properties,u.id,i))}return new tw(o,e.name,i)}var nw=class{constructor(e,t,r){this.actor=e,this.layerIndex=t,this.availableImages=r,this.tileState=new kp,this.overzoomedTileResultCache=new Fb(1e3)}loadVectorTile(e,t){try{return{vectorTile:e.encoding==="mlt"?new hp(t):new dh(new Qh(t)),rawData:t}}catch(r){let i=new Uint8Array(t),n=i[0]===31&&i[1]===139,a=`Unable to parse the tile at ${e.request.url}, `;throw a+=n?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${Si(r).message}`,Error(a)}}async loadTile(e){let{uid:t,overzoomParameters:r}=e;r&&(e.request=r.overzoomRequest);let i=this._startRequestTiming(e),n=new Ip(e);this.tileState.startLoading(t,n);let a=new AbortController;n.abort=a;try{let s=await Xf(e.request,a);if(e.etag&&e.etag===s.etag)return this.tileState.finishLoading(t),this._getEtagUnmodifiedResult(s,i);let o=this.loadVectorTile(e,s.data);if(this.tileState.finishLoading(t),!o)return null;let{vectorTile:l,rawData:u}=o;r&&({vectorTile:l,rawData:u}=this._getOverzoomTile(e,l));let h=this._getExpiryData(s),c=this._finishRequestTiming(i);n.vectorTile=l,n.etag=s.etag,this.tileState.markLoaded(t,n);let p={rawData:u,cacheControl:h,resourceTiming:c};return this.tileState.setParsing(t,p),await this._parseWorkerTile(n,e)}catch(s){throw this.tileState.finishLoading(t),this.tileState.markLoaded(t,n),s}}_getEtagUnmodifiedResult(e,t){let r=this._getExpiryData(e),i=this._finishRequestTiming(t);return ke({etagUnmodified:!0},r,i)}async _parseWorkerTile(e,t){let r=this.tileState.getParsing(e.uid),i=await e.parse(e.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);if(r){let{rawData:n,cacheControl:a,resourceTiming:s}=r,o=t.overzoomParameters?"mvt":t.encoding;i=ke({rawTileData:n.slice(0),encoding:o},i,a,s),this.tileState.removeParsing(e.uid)}else e.etag&&(i=ke(i,{etag:e.etag}));return i}_getExpiryData({expires:e,cacheControl:t,etag:r}){let i={};return e&&(i.expires=e),t&&(i.cacheControl=t),r&&(i.etag=r),i}_startRequestTiming(e){var t;if((t=e.request)!=null&&t.collectResourceTiming)return new Fp(e.request.url)}_finishRequestTiming(e){let t=e==null?void 0:e.finish();return t?{resourceTiming:JSON.parse(JSON.stringify(t))}:{}}_getOverzoomTile(e,t){var c;let{tileID:r,source:i,overzoomParameters:n}=e,{maxZoomTileID:a}=n,s=`${a.key}_${r.key}_${(c=e.request)==null?void 0:c.url}`,o=this.overzoomedTileResultCache.get(s);if(o)return o;let l=new rw,u=this.layerIndex.familiesBySource[i];for(let p in u){let f=t.layers[p];if(!f)continue;let d=iw(f,a,r.canonical);d.length>0&&l.addLayer(d)}let h={vectorTile:l,rawData:bc(l).buffer};return this.overzoomedTileResultCache.set(s,h),h}async reloadTile(e){let t=e.uid,r=this.tileState.getLoaded(t);if(!r)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.vectorTile)return r.showCollisionBoxes=e.showCollisionBoxes,await this._parseWorkerTile(r,e)}async abortTile(e){this.tileState.abort(e.uid)}async removeTile(e){this.tileState.removeLoaded(e.uid)}},aw=class{constructor(){this.loaded={}}async loadTile(e){let{uid:t,encoding:r,rawImageData:i,redFactor:n,greenFactor:a,blueFactor:s,baseShift:o}=e,l=i.width+2,u=i.height+2,h=Rn(i)?new Pe({width:l,height:u},await Of(i,-1,-1,l,u)):i,c=new th(t,h,r,n,a,s,o);return this.loaded||(this.loaded={}),this.loaded[t]=c,c}removeTile(e){let t=this.loaded,r=e.uid;t!=null&&t[r]&&delete t[r]}},sw=class{constructor(e,t,r,i=ow){this.actor=e,this.layerIndex=t,this.availableImages=r,this.tileState=new kp,this._createGeoJSONIndex=i}loadVectorTile(e){if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let{z:t,x:r,y:i}=e.tileID.canonical,n=this._geoJSONIndex.getTile(t,r,i);if(!n)return null;let a=new Rx(n.features,{version:2,extent:ne});return{vectorTile:a,rawData:bc(a,Ff).buffer}}async loadTile(e){let{uid:t}=e,r=new Ip(e);r.abort=new AbortController;try{let i=this.loadVectorTile(e);if(!i)return null;let{vectorTile:n,rawData:a}=i;r.vectorTile=n,this.tileState.markLoaded(t,r);let s={rawData:a};return this.tileState.setParsing(t,s),await this._parseWorkerTile(r,e)}catch(i){throw this.tileState.markLoaded(t,r),i}}async _parseWorkerTile(e,t){let r=this.tileState.getParsing(e.uid),i=await e.parse(e.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);if(r){let{rawData:n}=r;i=ke({rawTileData:n.slice(0),encoding:"mvt"},i),this.tileState.removeParsing(e.uid)}return i}async abortTile(e){this.tileState.abort(e.uid)}async removeTile(e){this.tileState.removeLoaded(e.uid)}async loadData(e){var r;(r=this._pendingRequest)==null||r.abort();let t=this._startRequestTiming(e);this._pendingRequest=new AbortController;try{await this.loadAndProcessGeoJSON(e,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let i={};return e.request&&(i.data=e.data),this._finishRequestTiming(t,e,i),i}catch(i){if(delete this._pendingRequest,!No(i))throw i;return{abandoned:!0}}}_startRequestTiming(e){var t;if((t=e.request)!=null&&t.collectResourceTiming)return new Fp(e.request.url)}_finishRequestTiming(e,t,r){let i=e==null?void 0:e.finish();i&&(r.resourceTiming={[t.source]:JSON.parse(JSON.stringify(i))})}async reloadTile(e){let t=e.uid,r=this.tileState.getLoaded(t);if(!r)return await this.loadTile(e);if(r.vectorTile)return r.showCollisionBoxes=e.showCollisionBoxes,await this._parseWorkerTile(r,e)}async loadAndProcessGeoJSON(e,t){if(e.request&&(e.data=(await Yf(e.request,t)).data),e.data){e.data=this._filterGeoJSON(e.data,e.filter,e.source),this._geoJSONIndex=this._createGeoJSONIndex(e.data,e);return}if(e.dataDiff){this._geoJSONIndex??(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},e)),this._geoJSONIndex.updateData(e.dataDiff,this._getFilterPredicate(e.filter,e.source));return}if(e.updateCluster&&this._geoJSONIndex.updateClusterOptions(e.geojsonVtOptions.cluster,Cp(e)),this._geoJSONIndex==null)throw Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`)}_filterGeoJSON(e,t,r){if(e.type!=="FeatureCollection")return e;let i=this._getFilterPredicate(t,r);return i?{type:"FeatureCollection",features:e.features.filter(n=>i(n))}:e}_getFilterPredicate(e,t){if(typeof e!="boolean"&&!(e!=null&&e.length))return;let r=Tt(e,`sources.${t}.filter`,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(r.result==="error")throw Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));return i=>r.value.evaluate({zoom:0},i)}async removeSource(e){var t;(t=this._pendingRequest)==null||t.abort()}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getClusterChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getClusterLeaves(e.clusterId,e.limit,e.offset)}};function ow(e,t){let r=ke(t.geojsonVtOptions||{},{updateable:!0,clusterOptions:Cp(t)});return new h0(e,r)}function Cp({geojsonVtOptions:e,clusterProperties:t,source:r}){if(!t||!e.clusterOptions)return e.clusterOptions;let i={},n={},a={accumulated:null,zoom:0},s={properties:null},o=Object.keys(t);for(let l of o){let[u,h]=t[l],c=Tt(h,`sources.${r}.clusterProperties.${l}[1]`),p=Tt(typeof u=="string"?[u,["accumulated"],["get",l]]:u,`sources.${r}.clusterProperties.${l}[0]`);i[l]=c.value,n[l]=p.value}return e.clusterOptions.map=l=>{s.properties=l;let u={};for(let h of o)u[h]=i[h].evaluate(a,s);return u},e.clusterOptions.reduce=(l,u)=>{s.properties=u;for(let h of o)a.accumulated=l[h],l[h]=n[h].evaluate(a,s)},e.clusterOptions}async function Bp(e){if(e.endsWith(".mjs")){await import(e);return}let t=await fetch(e,{credentials:"same-origin"});if(!t.ok)throw Error(`Failed to load ${e}: ${t.status}`);let r=await t.text();if(/^[ \t]*(import|export)\s/m.test(r)){let i=URL.createObjectURL(new Blob([r],{type:"text/javascript"}));try{await import(i)}finally{URL.revokeObjectURL(i)}return}globalThis.eval(r)}var lw=class{constructor(e){this.self=e,this.actor=new Mx(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(t,r)=>{if(this.externalWorkerSourceTypes[t])throw Error(`Worker source with name "${t}" already registered.`);this.externalWorkerSourceTypes[t]=r},this.self.addProtocol=Nf,this.self.removeProtocol=Uf,this.self.registerRTLTextPlugin=t=>{at.setMethods(t)},this.self.makeRequest=qn,this.actor.registerMessageHandler("LDT",(t,r)=>this._getDEMWorkerSource(t,r.source).loadTile(r)),this.actor.registerMessageHandler("RDT",async(t,r)=>{this._getDEMWorkerSource(t,r.source).removeTile(r)}),this.actor.registerMessageHandler("GCEZ",async(t,r)=>this._getWorkerSource(t,r.type,r.source).getClusterExpansionZoom(r)),this.actor.registerMessageHandler("GCC",async(t,r)=>this._getWorkerSource(t,r.type,r.source).getClusterChildren(r)),this.actor.registerMessageHandler("GCL",async(t,r)=>this._getWorkerSource(t,r.type,r.source).getClusterLeaves(r)),this.actor.registerMessageHandler("LD",(t,r)=>this._getWorkerSource(t,r.type,r.source).loadData(r)),this.actor.registerMessageHandler("LT",(t,r)=>this._getWorkerSource(t,r.type,r.source).loadTile(r)),this.actor.registerMessageHandler("RT",(t,r)=>this._getWorkerSource(t,r.type,r.source).reloadTile(r)),this.actor.registerMessageHandler("AT",(t,r)=>this._getWorkerSource(t,r.type,r.source).abortTile(r)),this.actor.registerMessageHandler("RMT",(t,r)=>this._getWorkerSource(t,r.type,r.source).removeTile(r)),this.actor.registerMessageHandler("RS",async(t,r)=>{var n,a;if(!((a=(n=this.workerSources[t])==null?void 0:n[r.type])!=null&&a[r.source]))return;let i=this.workerSources[t][r.type][r.source];delete this.workerSources[t][r.type][r.source],i.removeSource!==void 0&&i.removeSource(r)}),this.actor.registerMessageHandler("RM",async t=>{delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],this.globalStates.delete(t)}),this.actor.registerMessageHandler("SR",async(t,r)=>{this.referrer=r}),this.actor.registerMessageHandler("SRPS",(t,r)=>this._syncRTLPluginState(t,r)),this.actor.registerMessageHandler("IS",async(t,r)=>{await Bp(r)}),this.actor.registerMessageHandler("SI",(t,r)=>this._setImages(t,r)),this.actor.registerMessageHandler("UL",async(t,r)=>{this._getLayerIndex(t).update(r.layers,r.removedIds,this._getGlobalState(t))}),this.actor.registerMessageHandler("UGS",async(t,r)=>{let i=this._getGlobalState(t);for(let n in r)i[n]=r[n]}),this.actor.registerMessageHandler("SL",async(t,r)=>{this._getLayerIndex(t).replace(r,this._getGlobalState(t))})}_getGlobalState(e){let t=this.globalStates.get(e);return t||(t={},this.globalStates.set(e,t)),t}async _setImages(e,t){this.availableImages[e]=t;for(let r in this.workerSources[e]){let i=this.workerSources[e][r];for(let n in i)i[n].availableImages=t}}async _syncRTLPluginState(e,t){return await at.syncState(t,Bp)}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new Qb),t}_getWorkerSource(e,t,r){var i,n;if((i=this.workerSources)[e]||(i[e]={}),(n=this.workerSources[e])[t]||(n[t]={}),!this.workerSources[e][t][r]){let a={sendAsync:(s,o)=>(s.targetMapId=e,this.actor.sendAsync(s,o))};switch(t){case"vector":this.workerSources[e][t][r]=new nw(a,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][t][r]=new sw(a,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][r]=new this.externalWorkerSourceTypes[t](a,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][r]}_getDEMWorkerSource(e,t){var r,i;return(r=this.demWorkerSources)[e]||(r[e]={}),(i=this.demWorkerSources[e])[t]||(i[t]=new aw),this.demWorkerSources[e][t]}};Gt(self)&&(self.worker=new lw(self))})();