@inploi/plugin-job-search 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/index.js +3 -3
- package/cdn/style.css +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
package/cdn/index.js
CHANGED
|
@@ -57,21 +57,21 @@ ${T.concat(T).join(`
|
|
|
57
57
|
`)},A1=function(){var p=parseInt(document.body.getAttribute(_u)||"0",10);return isFinite(p)?p:0},DI=function(){Ji(function(){return document.body.setAttribute(_u,(A1()+1).toString()),function(){var p=A1()-1;p<=0?document.body.removeAttribute(_u):document.body.setAttribute(_u,p.toString())}},[])},RI=function(p){var x=p.noRelative,T=p.noImportant,C=p.gapMode,L=C===void 0?"margin":C;DI();var k=Pn(function(){return CI(L)},[L]);return Kt(MI,{styles:PI(k,!x,L,T?"":"!important")})},Qg=!1;if(typeof window<"u")try{var Df=Object.defineProperty({},"passive",{get:function(){return Qg=!0,!0}});window.addEventListener("test",Df,Df),window.removeEventListener("test",Df,Df)}catch{Qg=!1}var gu=Qg?{passive:!1}:!1,zI=function(p){return p.tagName==="TEXTAREA"},I1=function(p,x){var T=window.getComputedStyle(p);return T[x]!=="hidden"&&!(T.overflowY===T.overflowX&&!zI(p)&&T[x]==="visible")},LI=function(p){return I1(p,"overflowY")},kI=function(p){return I1(p,"overflowX")},C1=function(p,x){var T=x;do{typeof ShadowRoot<"u"&&T instanceof ShadowRoot&&(T=T.host);var C=M1(p,T);if(C){var L=P1(p,T),k=L[1],j=L[2];if(k>j)return!0}T=T.parentNode}while(T&&T!==document.body);return!1},OI=function(p){var x=p.scrollTop,T=p.scrollHeight,C=p.clientHeight;return[x,T,C]},FI=function(p){var x=p.scrollLeft,T=p.scrollWidth,C=p.clientWidth;return[x,T,C]},M1=function(p,x){return p==="v"?LI(x):kI(x)},P1=function(p,x){return p==="v"?OI(x):FI(x)},BI=function(p,x){return p==="h"&&x==="rtl"?-1:1},NI=function(p,x,T,C,L){var k=BI(p,window.getComputedStyle(x).direction),j=k*C,o=T.target,re=x.contains(o),fe=!1,xe=j>0,oe=0,Ee=0;do{var be=P1(p,o),Pe=be[0],_e=be[1],ze=be[2],Se=_e-ze-k*Pe;(Pe||Se)&&M1(p,o)&&(oe+=Se,Ee+=Pe),o=o.parentNode}while(!re&&o!==document.body||re&&(x.contains(o)||x===o));return(xe&&(L&&oe===0||!L&&j>oe)||!xe&&(L&&Ee===0||!L&&-j>Ee))&&(fe=!0),fe},Rf=function(p){return"changedTouches"in p?[p.changedTouches[0].clientX,p.changedTouches[0].clientY]:[0,0]},D1=function(p){return[p.deltaX,p.deltaY]},R1=function(p){return p&&"current"in p?p.current:p},jI=function(p,x){return p[0]===x[0]&&p[1]===x[1]},VI=function(p){return`
|
|
58
58
|
.block-interactivity-`.concat(p,` {pointer-events: none;}
|
|
59
59
|
.allow-interactivity-`).concat(p,` {pointer-events: all;}
|
|
60
|
-
`)},UI=0,yu=[];function $I(p){var x=Oi([]),T=Oi([0,0]),C=Oi(),L=Ni(UI++)[0],k=Ni(function(){return E1()})[0],j=Oi(p);Ji(function(){j.current=p},[p]),Ji(function(){if(p.inert){document.body.classList.add("block-interactivity-".concat(L));var _e=uI([p.lockRef.current],(p.shards||[]).map(R1),!0).filter(Boolean);return _e.forEach(function(ze){return ze.classList.add("allow-interactivity-".concat(L))}),function(){document.body.classList.remove("block-interactivity-".concat(L)),_e.forEach(function(ze){return ze.classList.remove("allow-interactivity-".concat(L))})}}},[p.inert,p.lockRef.current,p.shards]);var o=Ur(function(_e,ze){if("touches"in _e&&_e.touches.length===2)return!j.current.allowPinchZoom;var Se=Rf(_e),st=T.current,nt="deltaX"in _e?_e.deltaX:st[0]-Se[0],Xe="deltaY"in _e?_e.deltaY:st[1]-Se[1],ct,xt=_e.target,$t=Math.abs(nt)>Math.abs(Xe)?"h":"v";if("touches"in _e&&$t==="h"&&xt.type==="range")return!1;var kt=C1($t,xt);if(!kt)return!0;if(kt?ct=$t:(ct=$t==="v"?"h":"v",kt=C1($t,xt)),!kt)return!1;if(!C.current&&"changedTouches"in _e&&(nt||Xe)&&(C.current=ct),!ct)return!0;var Wt=C.current||ct;return NI(Wt,ze,_e,Wt==="h"?nt:Xe,!0)},[]),re=Ur(function(_e){var ze=_e;if(!(!yu.length||yu[yu.length-1]!==k)){var Se="deltaY"in ze?D1(ze):Rf(ze),st=x.current.filter(function(ct){return ct.name===ze.type&&ct.target===ze.target&&jI(ct.delta,Se)})[0];if(st&&st.should){ze.cancelable&&ze.preventDefault();return}if(!st){var nt=(j.current.shards||[]).map(R1).filter(Boolean).filter(function(ct){return ct.contains(ze.target)}),Xe=nt.length>0?o(ze,nt[0]):!j.current.noIsolation;Xe&&ze.cancelable&&ze.preventDefault()}}},[]),fe=Ur(function(_e,ze,Se,st){var nt={name:_e,delta:ze,target:Se,should:st};x.current.push(nt),setTimeout(function(){x.current=x.current.filter(function(Xe){return Xe!==nt})},1)},[]),xe=Ur(function(_e){T.current=Rf(_e),C.current=void 0},[]),oe=Ur(function(_e){fe(_e.type,D1(_e),_e.target,o(_e,p.lockRef.current))},[]),Ee=Ur(function(_e){fe(_e.type,Rf(_e),_e.target,o(_e,p.lockRef.current))},[]);Ji(function(){return yu.push(k),p.setCallbacks({onScrollCapture:oe,onWheelCapture:oe,onTouchMoveCapture:Ee}),document.addEventListener("wheel",re,gu),document.addEventListener("touchmove",re,gu),document.addEventListener("touchstart",xe,gu),function(){yu=yu.filter(function(_e){return _e!==k}),document.removeEventListener("wheel",re,gu),document.removeEventListener("touchmove",re,gu),document.removeEventListener("touchstart",xe,gu)}},[]);var be=p.removeScrollBar,Pe=p.inert;return Kt(rr,null,Pe?Kt(k,{styles:VI(L)}):null,be?Kt(RI,{gapMode:"margin"}):null)}const GI=vI(T1,$I);var z1=on(function(p,x){return Kt(Pf,ks({},p,{ref:x,sideCar:GI}))});z1.classNames=Pf.classNames;const L1=z1;var HI=function(p){if(typeof document>"u")return null;var x=Array.isArray(p)?p[0]:p;return x.ownerDocument.body},vu=new WeakMap,zf=new WeakMap,Lf={},ey=0,k1=function(p){return p&&(p.host||k1(p.parentNode))},qI=function(p,x){return x.map(function(T){if(p.contains(T))return T;var C=k1(T);return C&&p.contains(C)?C:(console.error("aria-hidden",T,"in not contained inside",p,". Doing nothing"),null)}).filter(function(T){return!!T})},ZI=function(p,x,T,C){var L=qI(x,Array.isArray(p)?p:[p]);Lf[T]||(Lf[T]=new WeakMap);var k=Lf[T],j=[],o=new Set,re=new Set(L),fe=function(oe){!oe||o.has(oe)||(o.add(oe),fe(oe.parentNode))};L.forEach(fe);var xe=function(oe){!oe||re.has(oe)||Array.prototype.forEach.call(oe.children,function(Ee){if(o.has(Ee))xe(Ee);else try{var be=Ee.getAttribute(C),Pe=be!==null&&be!=="false",_e=(vu.get(Ee)||0)+1,ze=(k.get(Ee)||0)+1;vu.set(Ee,_e),k.set(Ee,ze),j.push(Ee),_e===1&&Pe&&zf.set(Ee,!0),ze===1&&Ee.setAttribute(T,"true"),Pe||Ee.setAttribute(C,"true")}catch(Se){console.error("aria-hidden: cannot operate on ",Ee,Se)}})};return xe(x),o.clear(),ey++,function(){j.forEach(function(oe){var Ee=vu.get(oe)-1,be=k.get(oe)-1;vu.set(oe,Ee),k.set(oe,be),Ee||(zf.has(oe)||oe.removeAttribute(C),zf.delete(oe)),be||oe.removeAttribute(T)}),ey--,ey||(vu=new WeakMap,vu=new WeakMap,zf=new WeakMap,Lf={})}},O1=function(p,x,T){T===void 0&&(T="data-aria-hidden");var C=Array.from(Array.isArray(p)?p:[p]),L=x||HI(p);return L?(C.push.apply(C,Array.from(L.querySelectorAll("[aria-live], script"))),ZI(C,L,T,"aria-hidden")):function(){return null}};const F1="Dialog",[B1,XO]=Gg(F1),[WI,tl]=B1(F1),XI=p=>{const{__scopeDialog:x,children:T,open:C,defaultOpen:L,onOpenChange:k,modal:j=!0}=p,o=Oi(null),re=Oi(null),[fe=!1,xe]=s1({prop:C,defaultProp:L,onChange:k});return Kt(WI,{scope:x,triggerRef:o,contentRef:re,contentId:Ef(),titleId:Ef(),descriptionId:Ef(),open:fe,onOpenChange:xe,onOpenToggle:Ur(()=>xe(oe=>!oe),[xe]),modal:j},T)},YI="DialogTrigger",KI=on((p,x)=>{const{__scopeDialog:T,...C}=p,L=tl(YI,T),k=Ls(x,L.triggerRef);return Kt(Qa.button,sn({type:"button","aria-haspopup":"dialog","aria-expanded":L.open,"aria-controls":L.contentId,"data-state":iy(L.open)},C,{ref:k,onClick:ss(p.onClick,L.onOpenToggle)}))}),N1="DialogPortal",[JI,j1]=B1(N1,{forceMount:void 0}),QI=p=>{const{__scopeDialog:x,forceMount:T,children:C,container:L}=p,k=tl(N1,x);return Kt(JI,{scope:x,forceMount:T},Rs.map(C,j=>Kt(mu,{present:T||k.open},Kt(g1,{asChild:!0,container:L},j))))},ty="DialogOverlay",eC=on((p,x)=>{const T=j1(ty,p.__scopeDialog),{forceMount:C=T.forceMount,...L}=p,k=tl(ty,p.__scopeDialog);return k.modal?Kt(mu,{present:C||k.open},Kt(tC,sn({},L,{ref:x}))):null}),tC=on((p,x)=>{const{__scopeDialog:T,...C}=p,L=tl(ty,T);return Kt(L1,{as:Af,allowPinchZoom:!0,shards:[L.contentRef]},Kt(Qa.div,sn({"data-state":iy(L.open)},C,{ref:x,style:{pointerEvents:"auto",...C.style}})))}),ld="DialogContent",iC=on((p,x)=>{const T=j1(ld,p.__scopeDialog),{forceMount:C=T.forceMount,...L}=p,k=tl(ld,p.__scopeDialog);return Kt(mu,{present:C||k.open},k.modal?Kt(rC,sn({},L,{ref:x})):Kt(nC,sn({},L,{ref:x})))}),rC=on((p,x)=>{const T=tl(ld,p.__scopeDialog),C=Oi(null),L=Ls(x,T.contentRef,C);return Ji(()=>{const k=C.current;if(k)return O1(k)},[]),Kt(V1,sn({},p,{ref:L,trapFocus:T.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ss(p.onCloseAutoFocus,k=>{var j;k.preventDefault(),(j=T.triggerRef.current)===null||j===void 0||j.focus()}),onPointerDownOutside:ss(p.onPointerDownOutside,k=>{const j=k.detail.originalEvent,o=j.button===0&&j.ctrlKey===!0;(j.button===2||o)&&k.preventDefault()}),onFocusOutside:ss(p.onFocusOutside,k=>k.preventDefault())}))}),nC=on((p,x)=>{const T=tl(ld,p.__scopeDialog),C=Oi(!1),L=Oi(!1);return Kt(V1,sn({},p,{ref:x,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:k=>{var j;if((j=p.onCloseAutoFocus)===null||j===void 0||j.call(p,k),!k.defaultPrevented){var o;C.current||(o=T.triggerRef.current)===null||o===void 0||o.focus(),k.preventDefault()}C.current=!1,L.current=!1},onInteractOutside:k=>{var j,o;(j=p.onInteractOutside)===null||j===void 0||j.call(p,k),k.defaultPrevented||(C.current=!0,k.detail.originalEvent.type==="pointerdown"&&(L.current=!0));const re=k.target;((o=T.triggerRef.current)===null||o===void 0?void 0:o.contains(re))&&k.preventDefault(),k.detail.originalEvent.type==="focusin"&&L.current&&k.preventDefault()}}))}),V1=on((p,x)=>{const{__scopeDialog:T,trapFocus:C,onOpenAutoFocus:L,onCloseAutoFocus:k,...j}=p,o=tl(ld,T),re=Oi(null),fe=Ls(x,re);return y1(),Kt(rr,null,Kt(d1,{asChild:!0,loop:!0,trapped:C,onMountAutoFocus:L,onUnmountAutoFocus:k},Kt(l1,sn({role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":iy(o.open)},j,{ref:fe,onDismiss:()=>o.onOpenChange(!1)}))),!1)});function iy(p){return p?"open":"closed"}const oC=XI,sC=KI,aC=QI,lC=eC,cC=iC,uC=["top","right","bottom","left"],Os=Math.min,Eo=Math.max,kf=Math.round,Of=Math.floor,il=p=>({x:p,y:p}),hC={left:"right",right:"left",bottom:"top",top:"bottom"},dC={start:"end",end:"start"};function ry(p,x,T){return Eo(p,Os(x,T))}function fa(p,x){return typeof p=="function"?p(x):p}function ma(p){return p.split("-")[0]}function xu(p){return p.split("-")[1]}function ny(p){return p==="x"?"y":"x"}function oy(p){return p==="y"?"height":"width"}function rl(p){return["top","bottom"].includes(ma(p))?"y":"x"}function sy(p){return ny(rl(p))}function pC(p,x,T){T===void 0&&(T=!1);const C=xu(p),L=sy(p),k=oy(L);let j=L==="x"?C===(T?"end":"start")?"right":"left":C==="start"?"bottom":"top";return x.reference[k]>x.floating[k]&&(j=Ff(j)),[j,Ff(j)]}function fC(p){const x=Ff(p);return[ay(p),x,ay(x)]}function ay(p){return p.replace(/start|end/g,x=>dC[x])}function mC(p,x,T){const C=["left","right"],L=["right","left"],k=["top","bottom"],j=["bottom","top"];switch(p){case"top":case"bottom":return T?x?L:C:x?C:L;case"left":case"right":return x?k:j;default:return[]}}function _C(p,x,T,C){const L=xu(p);let k=mC(ma(p),T==="start",C);return L&&(k=k.map(j=>j+"-"+L),x&&(k=k.concat(k.map(ay)))),k}function Ff(p){return p.replace(/left|right|bottom|top/g,x=>hC[x])}function gC(p){return{top:0,right:0,bottom:0,left:0,...p}}function U1(p){return typeof p!="number"?gC(p):{top:p,right:p,bottom:p,left:p}}function Bf(p){const{x,y:T,width:C,height:L}=p;return{width:C,height:L,top:T,left:x,right:x+C,bottom:T+L,x,y:T}}function $1(p,x,T){let{reference:C,floating:L}=p;const k=rl(x),j=sy(x),o=oy(j),re=ma(x),fe=k==="y",xe=C.x+C.width/2-L.width/2,oe=C.y+C.height/2-L.height/2,Ee=C[o]/2-L[o]/2;let be;switch(re){case"top":be={x:xe,y:C.y-L.height};break;case"bottom":be={x:xe,y:C.y+C.height};break;case"right":be={x:C.x+C.width,y:oe};break;case"left":be={x:C.x-L.width,y:oe};break;default:be={x:C.x,y:C.y}}switch(xu(x)){case"start":be[j]-=Ee*(T&&fe?-1:1);break;case"end":be[j]+=Ee*(T&&fe?-1:1);break}return be}const yC=async(p,x,T)=>{const{placement:C="bottom",strategy:L="absolute",middleware:k=[],platform:j}=T,o=k.filter(Boolean),re=await(j.isRTL==null?void 0:j.isRTL(x));let fe=await j.getElementRects({reference:p,floating:x,strategy:L}),{x:xe,y:oe}=$1(fe,C,re),Ee=C,be={},Pe=0;for(let _e=0;_e<o.length;_e++){const{name:ze,fn:Se}=o[_e],{x:st,y:nt,data:Xe,reset:ct}=await Se({x:xe,y:oe,initialPlacement:C,placement:Ee,strategy:L,middlewareData:be,rects:fe,platform:j,elements:{reference:p,floating:x}});xe=st??xe,oe=nt??oe,be={...be,[ze]:{...be[ze],...Xe}},ct&&Pe<=50&&(Pe++,typeof ct=="object"&&(ct.placement&&(Ee=ct.placement),ct.rects&&(fe=ct.rects===!0?await j.getElementRects({reference:p,floating:x,strategy:L}):ct.rects),{x:xe,y:oe}=$1(fe,Ee,re)),_e=-1)}return{x:xe,y:oe,placement:Ee,strategy:L,middlewareData:be}};async function cd(p,x){var T;x===void 0&&(x={});const{x:C,y:L,platform:k,rects:j,elements:o,strategy:re}=p,{boundary:fe="clippingAncestors",rootBoundary:xe="viewport",elementContext:oe="floating",altBoundary:Ee=!1,padding:be=0}=fa(x,p),Pe=U1(be),ze=o[Ee?oe==="floating"?"reference":"floating":oe],Se=Bf(await k.getClippingRect({element:(T=await(k.isElement==null?void 0:k.isElement(ze)))==null||T?ze:ze.contextElement||await(k.getDocumentElement==null?void 0:k.getDocumentElement(o.floating)),boundary:fe,rootBoundary:xe,strategy:re})),st=oe==="floating"?{x:C,y:L,width:j.floating.width,height:j.floating.height}:j.reference,nt=await(k.getOffsetParent==null?void 0:k.getOffsetParent(o.floating)),Xe=await(k.isElement==null?void 0:k.isElement(nt))?await(k.getScale==null?void 0:k.getScale(nt))||{x:1,y:1}:{x:1,y:1},ct=Bf(k.convertOffsetParentRelativeRectToViewportRelativeRect?await k.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:st,offsetParent:nt,strategy:re}):st);return{top:(Se.top-ct.top+Pe.top)/Xe.y,bottom:(ct.bottom-Se.bottom+Pe.bottom)/Xe.y,left:(Se.left-ct.left+Pe.left)/Xe.x,right:(ct.right-Se.right+Pe.right)/Xe.x}}const vC=p=>({name:"arrow",options:p,async fn(x){const{x:T,y:C,placement:L,rects:k,platform:j,elements:o,middlewareData:re}=x,{element:fe,padding:xe=0}=fa(p,x)||{};if(fe==null)return{};const oe=U1(xe),Ee={x:T,y:C},be=sy(L),Pe=oy(be),_e=await j.getDimensions(fe),ze=be==="y",Se=ze?"top":"left",st=ze?"bottom":"right",nt=ze?"clientHeight":"clientWidth",Xe=k.reference[Pe]+k.reference[be]-Ee[be]-k.floating[Pe],ct=Ee[be]-k.reference[be],xt=await(j.getOffsetParent==null?void 0:j.getOffsetParent(fe));let $t=xt?xt[nt]:0;(!$t||!await(j.isElement==null?void 0:j.isElement(xt)))&&($t=o.floating[nt]||k.floating[Pe]);const kt=Xe/2-ct/2,Wt=$t/2-_e[Pe]/2-1,Ai=Os(oe[Se],Wt),mi=Os(oe[st],Wt),bi=Ai,Jt=$t-_e[Pe]-mi,Bt=$t/2-_e[Pe]/2+kt,vi=ry(bi,Bt,Jt),ri=!re.arrow&&xu(L)!=null&&Bt!==vi&&k.reference[Pe]/2-(Bt<bi?Ai:mi)-_e[Pe]/2<0,ui=ri?Bt<bi?Bt-bi:Bt-Jt:0;return{[be]:Ee[be]+ui,data:{[be]:vi,centerOffset:Bt-vi-ui,...ri&&{alignmentOffset:ui}},reset:ri}}}),xC=function(p){return p===void 0&&(p={}),{name:"flip",options:p,async fn(x){var T,C;const{placement:L,middlewareData:k,rects:j,initialPlacement:o,platform:re,elements:fe}=x,{mainAxis:xe=!0,crossAxis:oe=!0,fallbackPlacements:Ee,fallbackStrategy:be="bestFit",fallbackAxisSideDirection:Pe="none",flipAlignment:_e=!0,...ze}=fa(p,x);if((T=k.arrow)!=null&&T.alignmentOffset)return{};const Se=ma(L),st=rl(o),nt=ma(o)===o,Xe=await(re.isRTL==null?void 0:re.isRTL(fe.floating)),ct=Ee||(nt||!_e?[Ff(o)]:fC(o)),xt=Pe!=="none";!Ee&&xt&&ct.push(..._C(o,_e,Pe,Xe));const $t=[o,...ct],kt=await cd(x,ze),Wt=[];let Ai=((C=k.flip)==null?void 0:C.overflows)||[];if(xe&&Wt.push(kt[Se]),oe){const Bt=pC(L,j,Xe);Wt.push(kt[Bt[0]],kt[Bt[1]])}if(Ai=[...Ai,{placement:L,overflows:Wt}],!Wt.every(Bt=>Bt<=0)){var mi,bi;const Bt=(((mi=k.flip)==null?void 0:mi.index)||0)+1,vi=$t[Bt];if(vi)return{data:{index:Bt,overflows:Ai},reset:{placement:vi}};let ri=(bi=Ai.filter(ui=>ui.overflows[0]<=0).sort((ui,pr)=>ui.overflows[1]-pr.overflows[1])[0])==null?void 0:bi.placement;if(!ri)switch(be){case"bestFit":{var Jt;const ui=(Jt=Ai.filter(pr=>{if(xt){const _r=rl(pr.placement);return _r===st||_r==="y"}return!0}).map(pr=>[pr.placement,pr.overflows.filter(_r=>_r>0).reduce((_r,Ii)=>_r+Ii,0)]).sort((pr,_r)=>pr[1]-_r[1])[0])==null?void 0:Jt[0];ui&&(ri=ui);break}case"initialPlacement":ri=o;break}if(L!==ri)return{reset:{placement:ri}}}return{}}}};function G1(p,x){return{top:p.top-x.height,right:p.right-x.width,bottom:p.bottom-x.height,left:p.left-x.width}}function H1(p){return uC.some(x=>p[x]>=0)}const bC=function(p){return p===void 0&&(p={}),{name:"hide",options:p,async fn(x){const{rects:T}=x,{strategy:C="referenceHidden",...L}=fa(p,x);switch(C){case"referenceHidden":{const k=await cd(x,{...L,elementContext:"reference"}),j=G1(k,T.reference);return{data:{referenceHiddenOffsets:j,referenceHidden:H1(j)}}}case"escaped":{const k=await cd(x,{...L,altBoundary:!0}),j=G1(k,T.floating);return{data:{escapedOffsets:j,escaped:H1(j)}}}default:return{}}}}};async function wC(p,x){const{placement:T,platform:C,elements:L}=p,k=await(C.isRTL==null?void 0:C.isRTL(L.floating)),j=ma(T),o=xu(T),re=rl(T)==="y",fe=["left","top"].includes(j)?-1:1,xe=k&&re?-1:1,oe=fa(x,p);let{mainAxis:Ee,crossAxis:be,alignmentAxis:Pe}=typeof oe=="number"?{mainAxis:oe,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...oe};return o&&typeof Pe=="number"&&(be=o==="end"?Pe*-1:Pe),re?{x:be*xe,y:Ee*fe}:{x:Ee*fe,y:be*xe}}const TC=function(p){return p===void 0&&(p=0),{name:"offset",options:p,async fn(x){var T,C;const{x:L,y:k,placement:j,middlewareData:o}=x,re=await wC(x,p);return j===((T=o.offset)==null?void 0:T.placement)&&(C=o.arrow)!=null&&C.alignmentOffset?{}:{x:L+re.x,y:k+re.y,data:{...re,placement:j}}}}},SC=function(p){return p===void 0&&(p={}),{name:"shift",options:p,async fn(x){const{x:T,y:C,placement:L}=x,{mainAxis:k=!0,crossAxis:j=!1,limiter:o={fn:ze=>{let{x:Se,y:st}=ze;return{x:Se,y:st}}},...re}=fa(p,x),fe={x:T,y:C},xe=await cd(x,re),oe=rl(ma(L)),Ee=ny(oe);let be=fe[Ee],Pe=fe[oe];if(k){const ze=Ee==="y"?"top":"left",Se=Ee==="y"?"bottom":"right",st=be+xe[ze],nt=be-xe[Se];be=ry(st,be,nt)}if(j){const ze=oe==="y"?"top":"left",Se=oe==="y"?"bottom":"right",st=Pe+xe[ze],nt=Pe-xe[Se];Pe=ry(st,Pe,nt)}const _e=o.fn({...x,[Ee]:be,[oe]:Pe});return{..._e,data:{x:_e.x-T,y:_e.y-C}}}}},EC=function(p){return p===void 0&&(p={}),{options:p,fn(x){const{x:T,y:C,placement:L,rects:k,middlewareData:j}=x,{offset:o=0,mainAxis:re=!0,crossAxis:fe=!0}=fa(p,x),xe={x:T,y:C},oe=rl(L),Ee=ny(oe);let be=xe[Ee],Pe=xe[oe];const _e=fa(o,x),ze=typeof _e=="number"?{mainAxis:_e,crossAxis:0}:{mainAxis:0,crossAxis:0,..._e};if(re){const nt=Ee==="y"?"height":"width",Xe=k.reference[Ee]-k.floating[nt]+ze.mainAxis,ct=k.reference[Ee]+k.reference[nt]-ze.mainAxis;be<Xe?be=Xe:be>ct&&(be=ct)}if(fe){var Se,st;const nt=Ee==="y"?"width":"height",Xe=["top","left"].includes(ma(L)),ct=k.reference[oe]-k.floating[nt]+(Xe&&((Se=j.offset)==null?void 0:Se[oe])||0)+(Xe?0:ze.crossAxis),xt=k.reference[oe]+k.reference[nt]+(Xe?0:((st=j.offset)==null?void 0:st[oe])||0)-(Xe?ze.crossAxis:0);Pe<ct?Pe=ct:Pe>xt&&(Pe=xt)}return{[Ee]:be,[oe]:Pe}}}},AC=function(p){return p===void 0&&(p={}),{name:"size",options:p,async fn(x){const{placement:T,rects:C,platform:L,elements:k}=x,{apply:j=()=>{},...o}=fa(p,x),re=await cd(x,o),fe=ma(T),xe=xu(T),oe=rl(T)==="y",{width:Ee,height:be}=C.floating;let Pe,_e;fe==="top"||fe==="bottom"?(Pe=fe,_e=xe===(await(L.isRTL==null?void 0:L.isRTL(k.floating))?"start":"end")?"left":"right"):(_e=fe,Pe=xe==="end"?"top":"bottom");const ze=be-re.top-re.bottom,Se=Ee-re.left-re.right,st=Os(be-re[Pe],ze),nt=Os(Ee-re[_e],Se),Xe=!x.middlewareData.shift;let ct=st,xt=nt;if(oe?xt=xe||Xe?Os(nt,Se):Se:ct=xe||Xe?Os(st,ze):ze,Xe&&!xe){const kt=Eo(re.left,0),Wt=Eo(re.right,0),Ai=Eo(re.top,0),mi=Eo(re.bottom,0);oe?xt=Ee-2*(kt!==0||Wt!==0?kt+Wt:Eo(re.left,re.right)):ct=be-2*(Ai!==0||mi!==0?Ai+mi:Eo(re.top,re.bottom))}await j({...x,availableWidth:xt,availableHeight:ct});const $t=await L.getDimensions(k.floating);return Ee!==$t.width||be!==$t.height?{reset:{rects:!0}}:{}}}};function bu(p){return q1(p)?(p.nodeName||"").toLowerCase():"#document"}function Ao(p){var x;return(p==null||(x=p.ownerDocument)==null?void 0:x.defaultView)||window}function _a(p){var x;return(x=(q1(p)?p.ownerDocument:p.document)||window.document)==null?void 0:x.documentElement}function q1(p){return p instanceof Node||p instanceof Ao(p).Node}function as(p){return p instanceof Element||p instanceof Ao(p).Element}function Fs(p){return p instanceof HTMLElement||p instanceof Ao(p).HTMLElement}function Z1(p){return typeof ShadowRoot>"u"?!1:p instanceof ShadowRoot||p instanceof Ao(p).ShadowRoot}function ud(p){const{overflow:x,overflowX:T,overflowY:C,display:L}=ls(p);return/auto|scroll|overlay|hidden|clip/.test(x+C+T)&&!["inline","contents"].includes(L)}function IC(p){return["table","td","th"].includes(bu(p))}function Nf(p){return[":popover-open",":modal"].some(x=>{try{return p.matches(x)}catch{return!1}})}function ly(p){const x=cy(),T=as(p)?ls(p):p;return T.transform!=="none"||T.perspective!=="none"||(T.containerType?T.containerType!=="normal":!1)||!x&&(T.backdropFilter?T.backdropFilter!=="none":!1)||!x&&(T.filter?T.filter!=="none":!1)||["transform","perspective","filter"].some(C=>(T.willChange||"").includes(C))||["paint","layout","strict","content"].some(C=>(T.contain||"").includes(C))}function CC(p){let x=nl(p);for(;Fs(x)&&!wu(x);){if(ly(x))return x;if(Nf(x))return null;x=nl(x)}return null}function cy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function wu(p){return["html","body","#document"].includes(bu(p))}function ls(p){return Ao(p).getComputedStyle(p)}function jf(p){return as(p)?{scrollLeft:p.scrollLeft,scrollTop:p.scrollTop}:{scrollLeft:p.scrollX,scrollTop:p.scrollY}}function nl(p){if(bu(p)==="html")return p;const x=p.assignedSlot||p.parentNode||Z1(p)&&p.host||_a(p);return Z1(x)?x.host:x}function W1(p){const x=nl(p);return wu(x)?p.ownerDocument?p.ownerDocument.body:p.body:Fs(x)&&ud(x)?x:W1(x)}function hd(p,x,T){var C;x===void 0&&(x=[]),T===void 0&&(T=!0);const L=W1(p),k=L===((C=p.ownerDocument)==null?void 0:C.body),j=Ao(L);if(k){const o=uy(j);return x.concat(j,j.visualViewport||[],ud(L)?L:[],o&&T?hd(o):[])}return x.concat(L,hd(L,[],T))}function uy(p){return p.parent&&Object.getPrototypeOf(p.parent)?p.frameElement:null}function X1(p){const x=ls(p);let T=parseFloat(x.width)||0,C=parseFloat(x.height)||0;const L=Fs(p),k=L?p.offsetWidth:T,j=L?p.offsetHeight:C,o=kf(T)!==k||kf(C)!==j;return o&&(T=k,C=j),{width:T,height:C,$:o}}function hy(p){return as(p)?p:p.contextElement}function Tu(p){const x=hy(p);if(!Fs(x))return il(1);const T=x.getBoundingClientRect(),{width:C,height:L,$:k}=X1(x);let j=(k?kf(T.width):T.width)/C,o=(k?kf(T.height):T.height)/L;return(!j||!Number.isFinite(j))&&(j=1),(!o||!Number.isFinite(o))&&(o=1),{x:j,y:o}}const MC=il(0);function Y1(p){const x=Ao(p);return!cy()||!x.visualViewport?MC:{x:x.visualViewport.offsetLeft,y:x.visualViewport.offsetTop}}function PC(p,x,T){return x===void 0&&(x=!1),!T||x&&T!==Ao(p)?!1:x}function oc(p,x,T,C){x===void 0&&(x=!1),T===void 0&&(T=!1);const L=p.getBoundingClientRect(),k=hy(p);let j=il(1);x&&(C?as(C)&&(j=Tu(C)):j=Tu(p));const o=PC(k,T,C)?Y1(k):il(0);let re=(L.left+o.x)/j.x,fe=(L.top+o.y)/j.y,xe=L.width/j.x,oe=L.height/j.y;if(k){const Ee=Ao(k),be=C&&as(C)?Ao(C):C;let Pe=Ee,_e=uy(Pe);for(;_e&&C&&be!==Pe;){const ze=Tu(_e),Se=_e.getBoundingClientRect(),st=ls(_e),nt=Se.left+(_e.clientLeft+parseFloat(st.paddingLeft))*ze.x,Xe=Se.top+(_e.clientTop+parseFloat(st.paddingTop))*ze.y;re*=ze.x,fe*=ze.y,xe*=ze.x,oe*=ze.y,re+=nt,fe+=Xe,Pe=Ao(_e),_e=uy(Pe)}}return Bf({width:xe,height:oe,x:re,y:fe})}function DC(p){let{elements:x,rect:T,offsetParent:C,strategy:L}=p;const k=L==="fixed",j=_a(C),o=x?Nf(x.floating):!1;if(C===j||o&&k)return T;let re={scrollLeft:0,scrollTop:0},fe=il(1);const xe=il(0),oe=Fs(C);if((oe||!oe&&!k)&&((bu(C)!=="body"||ud(j))&&(re=jf(C)),Fs(C))){const Ee=oc(C);fe=Tu(C),xe.x=Ee.x+C.clientLeft,xe.y=Ee.y+C.clientTop}return{width:T.width*fe.x,height:T.height*fe.y,x:T.x*fe.x-re.scrollLeft*fe.x+xe.x,y:T.y*fe.y-re.scrollTop*fe.y+xe.y}}function RC(p){return Array.from(p.getClientRects())}function K1(p){return oc(_a(p)).left+jf(p).scrollLeft}function zC(p){const x=_a(p),T=jf(p),C=p.ownerDocument.body,L=Eo(x.scrollWidth,x.clientWidth,C.scrollWidth,C.clientWidth),k=Eo(x.scrollHeight,x.clientHeight,C.scrollHeight,C.clientHeight);let j=-T.scrollLeft+K1(p);const o=-T.scrollTop;return ls(C).direction==="rtl"&&(j+=Eo(x.clientWidth,C.clientWidth)-L),{width:L,height:k,x:j,y:o}}function LC(p,x){const T=Ao(p),C=_a(p),L=T.visualViewport;let k=C.clientWidth,j=C.clientHeight,o=0,re=0;if(L){k=L.width,j=L.height;const fe=cy();(!fe||fe&&x==="fixed")&&(o=L.offsetLeft,re=L.offsetTop)}return{width:k,height:j,x:o,y:re}}function kC(p,x){const T=oc(p,!0,x==="fixed"),C=T.top+p.clientTop,L=T.left+p.clientLeft,k=Fs(p)?Tu(p):il(1),j=p.clientWidth*k.x,o=p.clientHeight*k.y,re=L*k.x,fe=C*k.y;return{width:j,height:o,x:re,y:fe}}function J1(p,x,T){let C;if(x==="viewport")C=LC(p,T);else if(x==="document")C=zC(_a(p));else if(as(x))C=kC(x,T);else{const L=Y1(p);C={...x,x:x.x-L.x,y:x.y-L.y}}return Bf(C)}function Q1(p,x){const T=nl(p);return T===x||!as(T)||wu(T)?!1:ls(T).position==="fixed"||Q1(T,x)}function OC(p,x){const T=x.get(p);if(T)return T;let C=hd(p,[],!1).filter(o=>as(o)&&bu(o)!=="body"),L=null;const k=ls(p).position==="fixed";let j=k?nl(p):p;for(;as(j)&&!wu(j);){const o=ls(j),re=ly(j);!re&&o.position==="fixed"&&(L=null),(k?!re&&!L:!re&&o.position==="static"&&!!L&&["absolute","fixed"].includes(L.position)||ud(j)&&!re&&Q1(p,j))?C=C.filter(xe=>xe!==j):L=o,j=nl(j)}return x.set(p,C),C}function FC(p){let{element:x,boundary:T,rootBoundary:C,strategy:L}=p;const j=[...T==="clippingAncestors"?Nf(x)?[]:OC(x,this._c):[].concat(T),C],o=j[0],re=j.reduce((fe,xe)=>{const oe=J1(x,xe,L);return fe.top=Eo(oe.top,fe.top),fe.right=Os(oe.right,fe.right),fe.bottom=Os(oe.bottom,fe.bottom),fe.left=Eo(oe.left,fe.left),fe},J1(x,o,L));return{width:re.right-re.left,height:re.bottom-re.top,x:re.left,y:re.top}}function BC(p){const{width:x,height:T}=X1(p);return{width:x,height:T}}function NC(p,x,T){const C=Fs(x),L=_a(x),k=T==="fixed",j=oc(p,!0,k,x);let o={scrollLeft:0,scrollTop:0};const re=il(0);if(C||!C&&!k)if((bu(x)!=="body"||ud(L))&&(o=jf(x)),C){const oe=oc(x,!0,k,x);re.x=oe.x+x.clientLeft,re.y=oe.y+x.clientTop}else L&&(re.x=K1(L));const fe=j.left+o.scrollLeft-re.x,xe=j.top+o.scrollTop-re.y;return{x:fe,y:xe,width:j.width,height:j.height}}function dy(p){return ls(p).position==="static"}function eb(p,x){return!Fs(p)||ls(p).position==="fixed"?null:x?x(p):p.offsetParent}function tb(p,x){const T=Ao(p);if(Nf(p))return T;if(!Fs(p)){let L=nl(p);for(;L&&!wu(L);){if(as(L)&&!dy(L))return L;L=nl(L)}return T}let C=eb(p,x);for(;C&&IC(C)&&dy(C);)C=eb(C,x);return C&&wu(C)&&dy(C)&&!ly(C)?T:C||CC(p)||T}const jC=async function(p){const x=this.getOffsetParent||tb,T=this.getDimensions,C=await T(p.floating);return{reference:NC(p.reference,await x(p.floating),p.strategy),floating:{x:0,y:0,width:C.width,height:C.height}}};function VC(p){return ls(p).direction==="rtl"}const UC={convertOffsetParentRelativeRectToViewportRelativeRect:DC,getDocumentElement:_a,getClippingRect:FC,getOffsetParent:tb,getElementRects:jC,getClientRects:RC,getDimensions:BC,getScale:Tu,isElement:as,isRTL:VC};function $C(p,x){let T=null,C;const L=_a(p);function k(){var o;clearTimeout(C),(o=T)==null||o.disconnect(),T=null}function j(o,re){o===void 0&&(o=!1),re===void 0&&(re=1),k();const{left:fe,top:xe,width:oe,height:Ee}=p.getBoundingClientRect();if(o||x(),!oe||!Ee)return;const be=Of(xe),Pe=Of(L.clientWidth-(fe+oe)),_e=Of(L.clientHeight-(xe+Ee)),ze=Of(fe),st={rootMargin:-be+"px "+-Pe+"px "+-_e+"px "+-ze+"px",threshold:Eo(0,Os(1,re))||1};let nt=!0;function Xe(ct){const xt=ct[0].intersectionRatio;if(xt!==re){if(!nt)return j();xt?j(!1,xt):C=setTimeout(()=>{j(!1,1e-7)},1e3)}nt=!1}try{T=new IntersectionObserver(Xe,{...st,root:L.ownerDocument})}catch{T=new IntersectionObserver(Xe,st)}T.observe(p)}return j(!0),k}function GC(p,x,T,C){C===void 0&&(C={});const{ancestorScroll:L=!0,ancestorResize:k=!0,elementResize:j=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:re=!1}=C,fe=hy(p),xe=L||k?[...fe?hd(fe):[],...hd(x)]:[];xe.forEach(Se=>{L&&Se.addEventListener("scroll",T,{passive:!0}),k&&Se.addEventListener("resize",T)});const oe=fe&&o?$C(fe,T):null;let Ee=-1,be=null;j&&(be=new ResizeObserver(Se=>{let[st]=Se;st&&st.target===fe&&be&&(be.unobserve(x),cancelAnimationFrame(Ee),Ee=requestAnimationFrame(()=>{var nt;(nt=be)==null||nt.observe(x)})),T()}),fe&&!re&&be.observe(fe),be.observe(x));let Pe,_e=re?oc(p):null;re&&ze();function ze(){const Se=oc(p);_e&&(Se.x!==_e.x||Se.y!==_e.y||Se.width!==_e.width||Se.height!==_e.height)&&T(),_e=Se,Pe=requestAnimationFrame(ze)}return T(),()=>{var Se;xe.forEach(st=>{L&&st.removeEventListener("scroll",T),k&&st.removeEventListener("resize",T)}),oe==null||oe(),(Se=be)==null||Se.disconnect(),be=null,re&&cancelAnimationFrame(Pe)}}const HC=TC,qC=SC,ZC=xC,WC=AC,XC=bC,ib=vC,YC=EC,KC=(p,x,T)=>{const C=new Map,L={platform:UC,...T},k={...L.platform,_c:C};return yC(p,x,{...L,platform:k})};var Vf=typeof document<"u"?ha:Ji;function Uf(p,x){if(p===x)return!0;if(typeof p!=typeof x)return!1;if(typeof p=="function"&&p.toString()===x.toString())return!0;let T,C,L;if(p&&x&&typeof p=="object"){if(Array.isArray(p)){if(T=p.length,T!==x.length)return!1;for(C=T;C--!==0;)if(!Uf(p[C],x[C]))return!1;return!0}if(L=Object.keys(p),T=L.length,T!==Object.keys(x).length)return!1;for(C=T;C--!==0;)if(!{}.hasOwnProperty.call(x,L[C]))return!1;for(C=T;C--!==0;){const k=L[C];if(!(k==="_owner"&&p.$$typeof)&&!Uf(p[k],x[k]))return!1}return!0}return p!==p&&x!==x}function rb(p){return typeof window>"u"?1:(p.ownerDocument.defaultView||window).devicePixelRatio||1}function nb(p,x){const T=rb(p);return Math.round(x*T)/T}function ob(p){const x=Oi(p);return Vf(()=>{x.current=p}),x}function JC(p){p===void 0&&(p={});const{placement:x="bottom",strategy:T="absolute",middleware:C=[],platform:L,elements:{reference:k,floating:j}={},transform:o=!0,whileElementsMounted:re,open:fe}=p,[xe,oe]=Ni({x:0,y:0,strategy:T,placement:x,middlewareData:{},isPositioned:!1}),[Ee,be]=Ni(C);Uf(Ee,C)||be(C);const[Pe,_e]=Ni(null),[ze,Se]=Ni(null),st=Ur(ui=>{ui!==xt.current&&(xt.current=ui,_e(ui))},[]),nt=Ur(ui=>{ui!==$t.current&&($t.current=ui,Se(ui))},[]),Xe=k||Pe,ct=j||ze,xt=Oi(null),$t=Oi(null),kt=Oi(xe),Wt=re!=null,Ai=ob(re),mi=ob(L),bi=Ur(()=>{if(!xt.current||!$t.current)return;const ui={placement:x,strategy:T,middleware:Ee};mi.current&&(ui.platform=mi.current),KC(xt.current,$t.current,ui).then(pr=>{const _r={...pr,isPositioned:!0};Jt.current&&!Uf(kt.current,_r)&&(kt.current=_r,td(()=>{oe(_r)}))})},[Ee,x,T,mi]);Vf(()=>{fe===!1&&kt.current.isPositioned&&(kt.current.isPositioned=!1,oe(ui=>({...ui,isPositioned:!1})))},[fe]);const Jt=Oi(!1);Vf(()=>(Jt.current=!0,()=>{Jt.current=!1}),[]),Vf(()=>{if(Xe&&(xt.current=Xe),ct&&($t.current=ct),Xe&&ct){if(Ai.current)return Ai.current(Xe,ct,bi);bi()}},[Xe,ct,bi,Ai,Wt]);const Bt=Pn(()=>({reference:xt,floating:$t,setReference:st,setFloating:nt}),[st,nt]),vi=Pn(()=>({reference:Xe,floating:ct}),[Xe,ct]),ri=Pn(()=>{const ui={position:T,left:0,top:0};if(!vi.floating)return ui;const pr=nb(vi.floating,xe.x),_r=nb(vi.floating,xe.y);return o?{...ui,transform:"translate("+pr+"px, "+_r+"px)",...rb(vi.floating)>=1.5&&{willChange:"transform"}}:{position:T,left:pr,top:_r}},[T,o,vi.floating,xe.x,xe.y]);return Pn(()=>({...xe,update:bi,refs:Bt,elements:vi,floatingStyles:ri}),[xe,bi,Bt,vi,ri])}const QC=p=>{function x(T){return{}.hasOwnProperty.call(T,"current")}return{name:"arrow",options:p,fn(T){const{element:C,padding:L}=typeof p=="function"?p(T):p;return C&&x(C)?C.current!=null?ib({element:C.current,padding:L}).fn(T):{}:C?ib({element:C,padding:L}).fn(T):{}}}},eM=(p,x)=>({...HC(p),options:[p,x]}),tM=(p,x)=>({...qC(p),options:[p,x]}),iM=(p,x)=>({...YC(p),options:[p,x]}),rM=(p,x)=>({...ZC(p),options:[p,x]}),nM=(p,x)=>({...WC(p),options:[p,x]}),oM=(p,x)=>({...XC(p),options:[p,x]}),sM=(p,x)=>({...QC(p),options:[p,x]});function aM(p){const[x,T]=Ni(void 0);return fu(()=>{if(p){T({width:p.offsetWidth,height:p.offsetHeight});const C=new ResizeObserver(L=>{if(!Array.isArray(L)||!L.length)return;const k=L[0];let j,o;if("borderBoxSize"in k){const re=k.borderBoxSize,fe=Array.isArray(re)?re[0]:re;j=fe.inlineSize,o=fe.blockSize}else j=p.offsetWidth,o=p.offsetHeight;T({width:j,height:o})});return C.observe(p,{box:"border-box"}),()=>C.unobserve(p)}else T(void 0)},[p]),x}const sb="Popper",[ab,lb]=Gg(sb),[lM,cb]=ab(sb),cM=p=>{const{__scopePopper:x,children:T}=p,[C,L]=Ni(null);return Kt(lM,{scope:x,anchor:C,onAnchorChange:L},T)},uM="PopperAnchor",hM=on((p,x)=>{const{__scopePopper:T,virtualRef:C,...L}=p,k=cb(uM,T),j=Oi(null),o=Ls(x,j);return Ji(()=>{k.onAnchorChange((C==null?void 0:C.current)||j.current)}),C?null:Kt(Qa.div,sn({},L,{ref:o}))}),ub="PopperContent",[dM,YO]=ab(ub),pM=on((p,x)=>{var T,C,L,k,j,o,re,fe;const{__scopePopper:xe,side:oe="bottom",sideOffset:Ee=0,align:be="center",alignOffset:Pe=0,arrowPadding:_e=0,avoidCollisions:ze=!0,collisionBoundary:Se=[],collisionPadding:st=0,sticky:nt="partial",hideWhenDetached:Xe=!1,updatePositionStrategy:ct="optimized",onPlaced:xt,...$t}=p,kt=cb(ub,xe),[Wt,Ai]=Ni(null),mi=Ls(x,wr=>Ai(wr)),[bi,Jt]=Ni(null),Bt=aM(bi),vi=(T=Bt==null?void 0:Bt.width)!==null&&T!==void 0?T:0,ri=(C=Bt==null?void 0:Bt.height)!==null&&C!==void 0?C:0,ui=oe+(be!=="center"?"-"+be:""),pr=typeof st=="number"?st:{top:0,right:0,bottom:0,left:0,...st},_r=Array.isArray(Se)?Se:[Se],Ii=_r.length>0,$r={padding:pr,boundary:_r.filter(fM),altBoundary:Ii},{refs:gn,floatingStyles:Yn,placement:ho,isPositioned:Ui,middlewareData:Zi}=JC({strategy:"fixed",placement:ui,whileElementsMounted:(...wr)=>GC(...wr,{animationFrame:ct==="always"}),elements:{reference:kt.anchor},middleware:[eM({mainAxis:Ee+ri,alignmentAxis:Pe}),ze&&tM({mainAxis:!0,crossAxis:!1,limiter:nt==="partial"?iM():void 0,...$r}),ze&&rM({...$r}),nM({...$r,apply:({elements:wr,rects:Br,availableWidth:En,availableHeight:Gr})=>{const{width:Dr,height:an}=Br.reference,On=wr.floating.style;On.setProperty("--radix-popper-available-width",`${En}px`),On.setProperty("--radix-popper-available-height",`${Gr}px`),On.setProperty("--radix-popper-anchor-width",`${Dr}px`),On.setProperty("--radix-popper-anchor-height",`${an}px`)}}),bi&&sM({element:bi,padding:_e}),mM({arrowWidth:vi,arrowHeight:ri}),Xe&&oM({strategy:"referenceHidden",...$r})]}),[Lr,Uo]=hb(ho),gr=Ja(xt);fu(()=>{Ui&&(gr==null||gr())},[Ui,gr]);const Kn=(L=Zi.arrow)===null||L===void 0?void 0:L.x,oo=(k=Zi.arrow)===null||k===void 0?void 0:k.y,Qi=((j=Zi.arrow)===null||j===void 0?void 0:j.centerOffset)!==0,[Ei,un]=Ni();return fu(()=>{Wt&&un(window.getComputedStyle(Wt).zIndex)},[Wt]),Kt("div",{ref:gn.setFloating,"data-radix-popper-content-wrapper":"",style:{...Yn,transform:Ui?Yn.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ei,"--radix-popper-transform-origin":[(o=Zi.transformOrigin)===null||o===void 0?void 0:o.x,(re=Zi.transformOrigin)===null||re===void 0?void 0:re.y].join(" ")},dir:p.dir},Kt(dM,{scope:xe,placedSide:Lr,onArrowChange:Jt,arrowX:Kn,arrowY:oo,shouldHideArrow:Qi},Kt(Qa.div,sn({"data-side":Lr,"data-align":Uo},$t,{ref:mi,style:{...$t.style,animation:Ui?void 0:"none",opacity:(fe=Zi.hide)!==null&&fe!==void 0&&fe.referenceHidden?0:void 0}}))))});function fM(p){return p!==null}const mM=p=>({name:"transformOrigin",options:p,fn(x){var T,C,L,k,j;const{placement:o,rects:re,middlewareData:fe}=x,oe=((T=fe.arrow)===null||T===void 0?void 0:T.centerOffset)!==0,Ee=oe?0:p.arrowWidth,be=oe?0:p.arrowHeight,[Pe,_e]=hb(o),ze={start:"0%",center:"50%",end:"100%"}[_e],Se=((C=(L=fe.arrow)===null||L===void 0?void 0:L.x)!==null&&C!==void 0?C:0)+Ee/2,st=((k=(j=fe.arrow)===null||j===void 0?void 0:j.y)!==null&&k!==void 0?k:0)+be/2;let nt="",Xe="";return Pe==="bottom"?(nt=oe?ze:`${Se}px`,Xe=`${-be}px`):Pe==="top"?(nt=oe?ze:`${Se}px`,Xe=`${re.floating.height+be}px`):Pe==="right"?(nt=`${-be}px`,Xe=oe?ze:`${st}px`):Pe==="left"&&(nt=`${re.floating.width+be}px`,Xe=oe?ze:`${st}px`),{data:{x:nt,y:Xe}}}});function hb(p){const[x,T="center"]=p.split("-");return[x,T]}const _M=cM,gM=hM,yM=pM,db="Popover",[pb,KO]=Gg(db,[lb]),py=lb(),[vM,Su]=pb(db),xM=p=>{const{__scopePopover:x,children:T,open:C,defaultOpen:L,onOpenChange:k,modal:j=!1}=p,o=py(x),re=Oi(null),[fe,xe]=Ni(!1),[oe=!1,Ee]=s1({prop:C,defaultProp:L,onChange:k});return Kt(_M,o,Kt(vM,{scope:x,contentId:Ef(),triggerRef:re,open:oe,onOpenChange:Ee,onOpenToggle:Ur(()=>Ee(be=>!be),[Ee]),hasCustomAnchor:fe,onCustomAnchorAdd:Ur(()=>xe(!0),[]),onCustomAnchorRemove:Ur(()=>xe(!1),[]),modal:j},T))},bM="PopoverTrigger",wM=on((p,x)=>{const{__scopePopover:T,...C}=p,L=Su(bM,T),k=py(T),j=Ls(x,L.triggerRef),o=Kt(Qa.button,sn({type:"button","aria-haspopup":"dialog","aria-expanded":L.open,"aria-controls":L.contentId,"data-state":_b(L.open)},C,{ref:j,onClick:ss(p.onClick,L.onOpenToggle)}));return L.hasCustomAnchor?o:Kt(gM,sn({asChild:!0},k),o)}),fb="PopoverPortal",[TM,SM]=pb(fb,{forceMount:void 0}),EM=p=>{const{__scopePopover:x,forceMount:T,children:C,container:L}=p,k=Su(fb,x);return Kt(TM,{scope:x,forceMount:T},Kt(mu,{present:T||k.open},Kt(g1,{asChild:!0,container:L},C)))},dd="PopoverContent",AM=on((p,x)=>{const T=SM(dd,p.__scopePopover),{forceMount:C=T.forceMount,...L}=p,k=Su(dd,p.__scopePopover);return Kt(mu,{present:C||k.open},k.modal?Kt(IM,sn({},L,{ref:x})):Kt(CM,sn({},L,{ref:x})))}),IM=on((p,x)=>{const T=Su(dd,p.__scopePopover),C=Oi(null),L=Ls(x,C),k=Oi(!1);return Ji(()=>{const j=C.current;if(j)return O1(j)},[]),Kt(L1,{as:Af,allowPinchZoom:!0},Kt(mb,sn({},p,{ref:L,trapFocus:T.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ss(p.onCloseAutoFocus,j=>{var o;j.preventDefault(),k.current||(o=T.triggerRef.current)===null||o===void 0||o.focus()}),onPointerDownOutside:ss(p.onPointerDownOutside,j=>{const o=j.detail.originalEvent,re=o.button===0&&o.ctrlKey===!0,fe=o.button===2||re;k.current=fe},{checkForDefaultPrevented:!1}),onFocusOutside:ss(p.onFocusOutside,j=>j.preventDefault(),{checkForDefaultPrevented:!1})})))}),CM=on((p,x)=>{const T=Su(dd,p.__scopePopover),C=Oi(!1),L=Oi(!1);return Kt(mb,sn({},p,{ref:x,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:k=>{var j;if((j=p.onCloseAutoFocus)===null||j===void 0||j.call(p,k),!k.defaultPrevented){var o;C.current||(o=T.triggerRef.current)===null||o===void 0||o.focus(),k.preventDefault()}C.current=!1,L.current=!1},onInteractOutside:k=>{var j,o;(j=p.onInteractOutside)===null||j===void 0||j.call(p,k),k.defaultPrevented||(C.current=!0,k.detail.originalEvent.type==="pointerdown"&&(L.current=!0));const re=k.target;((o=T.triggerRef.current)===null||o===void 0?void 0:o.contains(re))&&k.preventDefault(),k.detail.originalEvent.type==="focusin"&&L.current&&k.preventDefault()}}))}),mb=on((p,x)=>{const{__scopePopover:T,trapFocus:C,onOpenAutoFocus:L,onCloseAutoFocus:k,disableOutsidePointerEvents:j,onEscapeKeyDown:o,onPointerDownOutside:re,onFocusOutside:fe,onInteractOutside:xe,...oe}=p,Ee=Su(dd,T),be=py(T);return y1(),Kt(d1,{asChild:!0,loop:!0,trapped:C,onMountAutoFocus:L,onUnmountAutoFocus:k},Kt(l1,{asChild:!0,disableOutsidePointerEvents:j,onInteractOutside:xe,onEscapeKeyDown:o,onPointerDownOutside:re,onFocusOutside:fe,onDismiss:()=>Ee.onOpenChange(!1)},Kt(yM,sn({"data-state":_b(Ee.open),role:"dialog",id:Ee.contentId},be,oe,{ref:x,style:{...oe.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}))))});function _b(p){return p?"open":"closed"}const MM=xM,PM=wM,DM=EM,RM=AM,gb=p=>{var T;const x=Number((T=p.match(/\d/g))==null?void 0:T.join(""));return Number.isNaN(x)?0:x},zM=(p,x={by:"results-count",order:"descending"})=>{const T=[...p];switch(x.by){case"results-count":T.sort((C,L)=>C.jobs-L.jobs);break;case"alphabetically":T.sort((C,L)=>C.label.localeCompare(L.label));break;case"numerically":T.sort((C,L)=>{const k=gb(C.value),j=gb(L.value);return k-j});break}return x.order==="descending"&&T.reverse(),T},pd=Vo({base:"fr bg-lowest caret-accent-11 selection:bg-accent-4 selection:text-accent-12 placeholder:text-copy-neutral placeholder:opacity-30 ring-width-section ease-expo-out duration-snappy transition-all disabled:opacity-50 rounded-input font-style-input text-style-input font-weight-input",variants:{hasValue:{false:"text-copy-neutral ring-job-card-stroke",true:"text-interactive-accent-text ring-job-card-stroke"},size:{md:"py-2 px-4",unsized:""}},defaultVariants:{size:"md",hasValue:!1}}),yb=Vo({base:"flex-1 gutter-stable group/filter flex-col p-2 bg-app flex max-w-full overflow-y-auto items-stretch",variants:{ring:{default:"border-b-px border-neutral-4",unset:""}},defaultVariants:{ring:"default"}}),vb=Vo({base:"max-w-full origin-top group/tag ease-expo-out transition-all duration-snappy",variants:{type:{pill:"",line:"[&:not(:last-child)]:border-b-px border-neutral-2 has-[[data-current-value=true]]:border-b-accent-3"}}}),xb=Vo({base:"cursor-pointer flex fr gap-2 font-style-tag pointer-fine:group-[&:first-child]/filter:group-[&:first-child]/tag:rounded-t-tag py-2.5 px-2.5 font-family-tag font-weight-tag text-style-tag focus:relative w-full justify-between",variants:{active:{true:"bg-accent-2 text-accent-11",false:"text-neutral-11"},disabled:{true:"opacity-25 pointer-events-none",false:""}},compoundVariants:[{disabled:!1,active:!1,class:"hover:bg-neutral-2"}],defaultVariants:{disabled:!1,active:!1}}),LM=Vo({base:"rounded-job-tag inline-block px-1 border-solid border-px ease-expo-out transition-all duration-snappy",variants:{colorScheme:{accentStrong:"text-accent-11 bg-accent-4 border-tag-accent-strong-stroke",neutralStrong:"text-neutral-11 bg-neutral-2 border-tag-neutral-strong-stroke"}}}),kM=({children:p,colorScheme:x})=>ce("span",{class:LM({colorScheme:x}),children:ce("span",{class:"block w-[3ch] text-center tabular-nums",children:p})}),OM=(p,x)=>{const T=p.indexOf(x);return T===-1?[...p,x]:p.filter((C,L)=>L!==T)},FM=(p,x)=>{if(p===null)return!1;const T=p[x.value];return T===void 0?!0:T===0},BM=(p,x)=>{const T=C=>C>99?"99+":C.toString();return T(p===null?x.jobs:p[x.value]??0)},NM=({value:p,property:x,useQuery:T,isMobile:C,onValueChange:L,onClose:k})=>{const{t:j}=kn(),o=Qh(T()),re=Pn(()=>{switch(o.queryState){case"error":case"idle":case"loading":return null;case"loaded":case"revalidating":{const be=o.data[x.key]??[];return Object.fromEntries(be.map(Pe=>[Pe.value,Pe.jobs]))}default:No(o)}},[o,x.key]),fe=Eb(p),xe=fe.length>0,[oe,Ee]=Ni();return ce("div",{class:"theme-fill:bg-neutral-1 flex min-h-0 w-full flex-1 flex-col",children:[x.searchable&&ce("div",{class:"border-b-px border-neutral-4",children:ce("input",{type:"search",class:"theme-fill:bg-neutral-2 theme-stroke:bg-neutral-1 theme-fill:focus:bg-neutral-1 theme-stroke:focus:bg-lowest focus:ring-px focus:ring-neutral-6 pointer-fine:theme-soft:rounded-t-lg pointer-fine:theme-rounded:rounded-t-lg caret-accent-11 selection:bg-accent-4 selection:text-accent-12 placeholder:text-copy-neutral ease-expo-out duration-snappy font-style-input text-style-input font-weight-input bg-transparent px-4 py-2.5 outline-none transition-all placeholder:opacity-30 disabled:opacity-50",value:oe,onInput:be=>Ee(be.currentTarget.value),placeholder:j("type_to_search")})}),(()=>{switch(o.queryState){case"error":return ce(Xa,{error:new Error(j("filters_loading_error"),{cause:o.error}),class:"flex-1",resetError:()=>o.swr.mutate()});case"idle":case"loading":return ce("div",{"aria-hidden":!0,class:"flex flex-col p-2",children:Array.from({length:10}).map((be,Pe)=>ce("div",{style:{animationDelay:Pe*-.1+"s"},class:"bg-neutral-3 animate-skeleton h-12 w-full"},Pe))});case"revalidating":case"loaded":{const be=o.data[x.key]??[],Pe=oe&&oe.length>1?be.filter(Se=>Se.label.toLowerCase().includes(oe.toLowerCase())):be,_e=[];for(const Se of Pe){if(Se.label.length<1)continue;const st={...Se,results:BM(re,Se),disabled:FM(re,Se)};switch(x.results){case"only-available":st.disabled===!1&&_e.push(st);break;default:_e.push(st)}}return _e.find(Se=>!Se.disabled)?ce("ul",{class:yb(),children:zM(_e,x.sortSuggestions).map(Se=>{const st=fe.includes(Se.value);return ce("li",{class:vb({type:"line"}),children:ce("button",{type:"button",disabled:Se.disabled,"data-filter":!0,"data-current-value":st?"true":void 0,onClick:()=>{switch(p.select){case"many":{const nt=OM(fe,Se.value);L({select:"many",value:nt});break}case"one":L({select:"one",value:st?void 0:Se.value});break;default:No(p)}},class:xb({active:st,disabled:Se.disabled}),children:[ce("span",{class:"max-w-full truncate",children:Se.label})," ",ce(kM,{colorScheme:st?"accentStrong":"neutralStrong",children:Se.results})]})},Se.value)})}):ce("p",{class:"font-style-tag text-style-tag font-weight-tag w-full flex-1 px-4 pb-1 pt-4 text-center",children:j("no_filter_options_available")})}default:No(o)}})(),ce("footer",{class:"flex flex-none justify-end p-2",children:[ce("div",{class:"flex-1",children:xe&&ce("button",{type:"button",class:da({variant:"neutral",icon:"left"}),onClick:()=>{L(void 0)},children:[ce(Sn,{"aria-hidden":!0,name:"x"})," ",j("clear")]})}),p.select==="many"&&C&&ce("div",{class:"flex items-center overflow-hidden",children:ce("p",{class:"theme-light:text-neutral-11 theme-dark:text-neutral-12 font-style-default text-style-tag font-weight-default flex-grow select-none truncate text-center",children:[fe.length," ",j("selected")]})}),ce("div",{class:"flex-1",children:ce("button",{type:"button",class:da({variant:xe?"accent":"neutral",class:"ml-auto"}),onClick:k,children:j(xe?"done":"close")},xe?"done":"close")})]})]})},bb=8,wb={contract_type:"clock",title:"magnifier",city:"mapPin",town:"mapPin",country:"mapPin",company_name:"briefcase",category:"briefcase",pay:"pay",pay_currency:"pay",pay_mask:"pay",pay_display:"pay",pay_max:"pay",pay_min:"pay",pay_type:"pay"},Tb=Vo({base:"theme-fill:fr theme-fill:bg-neutral-2 theme-fill:hover:bg-neutral-3 theme-stroke:fr theme-stroke:hover:fr theme-stroke:ring-px theme-stroke:bg-lowest theme-stroke:ring-neutral-4 theme-stroke:hover:ring-neutral-6 group relative flex cursor-pointer select-none items-center gap-1.5 py-2.5 pl-3.5 pr-3 font-style-filter font-family-filter font-weight-filter text-style-filter duration-snappy outline-none ijs-filter flex-shrink-0 min-w-0 theme-rounded:rounded-md theme-soft:rounded-sm transition-all ease-expo-out active:scale-[0.975] origin-[50%_1.75rem]",variants:{state:{default:"text-copy-neutral-lowcontrast hover:text-copy-neutral",active:"text-copy-neutral"}}}),Sb=Vo({base:"bg-lowest isolate z-50 flex flex-col overflow-hidden ring-neutral-4 ring-px",variants:{mode:{mobile:"fixed bottom-0 w-full h-[80svh] rounded-t-section animate-slide-out-bottom pb-[env(safe-area-inset-bottom)]",desktop:"min-w-64 max-w-xs max-h-[--radix-popover-content-available-height] rounded-section animate-slideDownFade data-[side=top]:animate-slideUpFade shadow-lg"}}}),Eb=p=>typeof p.value=="string"?[p.value]:p.value??[],jM=({selectedValues:p})=>{const x=p.length;return x===0?null:ce("span",{"aria-label":"Current value",class:"animate-appear-tag text-style-job-card-info font-style-tag font-family-tag font-weight-tag text-tag-accent-strong-copy bg-tag-accent-strong-bg min-w-6 min-h-6 absolute -right-1 -top-1 inline-flex items-center justify-center rounded-[999px] px-2 tabular-nums",children:x},x)},VM=({active:p,value:x,onActiveChange:T,property:C,onValueChange:L,unfilteredQuery:k,useQuery:j,theme:o,widgetId:re})=>{const fe=Kl(C.key,wb)?wb[C.key]:void 0,xe=C.icon??fe??"filter",oe=Eb(x),Ee=oe.length>0,be=_x("(pointer: coarse)"),Pe=ce(rr,{children:[ce("div",{class:"flex min-w-0 flex-1 items-center gap-1.5",children:[ce(Sn,{"aria-hidden":!0,class:"flex-none",name:xe}),ce("span",{class:"truncate",children:C.label})]}),ce(Sn,{"aria-hidden":!0,class:"text-neutral-8 flex-shrink-0 rotate-90 transition-transform group-data-[state=open]:-rotate-90",name:"chevron-right"}),ce(jM,{selectedValues:oe})]}),_e=ce(NM,{useQuery:j,onClose:()=>T(!1),onValueChange:L,unfilteredQuery:k,property:C,value:x,isMobile:be});return be?ce(oC,{open:p,onOpenChange:T,children:[ce(sC,{"data-filter-key":C.key,"aria-label":C.label,"aria-selected":p?"true":void 0,class:Tb({state:p||Ee?"active":"default"}),onTouchStart:UM,children:Pe}),ce(aC,{children:ce("div",{class:"inploi-job-search","data-widget-id":re,children:[ce(lC,{class:"animate-fade-in fixed inset-0 z-50 bg-[#0009]"}),ce(cC,{class:Sb({mode:"mobile",class:bg(o)}),children:[ce("header",{class:"theme-fill:bg-neutral-1 text-neutral-12 border-b-px border-neutral-4 flex cursor-default items-center gap-2 p-4",children:[ce(Sn,{name:xe,class:"flex-none"}),ce("p",{class:"font-style-filter font-weight-filter text-style-filter truncate",children:C.label})]}),_e]})]})})]}):ce(MM,{open:p,onOpenChange:ze=>T(ze),modal:be,children:[ce(PM,{"data-filter-key":C.key,"aria-label":C.label,"aria-selected":p?"true":void 0,class:Tb({state:p||Ee?"active":"default"}),children:Pe}),ce(DM,{children:ce("div",{class:"inploi-job-search","data-widget-id":re,children:ce(RM,{side:"bottom",sideOffset:bb,align:"center",collisionPadding:bb,class:Sb({mode:"desktop",class:bg(o)}),children:_e})})})]})};function UM(){}const $M=(p,x)=>{var T,C,L;switch(x.select){case"many":(T=x.value)==null||T.forEach(k=>{var j,o;switch(p.select){case"many":(j=p.value)!=null&&j.includes(k)||(o=p.value)==null||o.push(k);break;case"one":p.value=k}});break;case"one":if(!x.value)break;switch(p.select){case"many":(C=p.value)!=null&&C.includes(x.value)||(L=p.value)==null||L.push(x.value);break;case"one":p.value=x.value}break}},GM=({value:p,activeKey:x})=>{switch(p==null?void 0:p.select){case void 0:return{newValue:void 0,newActiveKey:x};case"one":case"many":return{newValue:p,newActiveKey:x};default:No(p)}},HM=({properties:p,state:x,onFilterValueChange:T,onResetFilters:C,rpcClient:L,theme:k,alerts:j,widgetId:o})=>{const{t:re}=kn(),[fe,xe]=Ni(void 0),oe=Pn(()=>({filters:by(p,"value"),mode:x.mode,query:"",geo:void 0,page:1,view:"list"}),[p,x.mode]),Ee=Qh(ad($g({state:oe,baseKey:"filters"}),()=>Qv({rpcClient:L,state:oe}),mf)),be=Ur(Pe=>()=>{const _e={...x,filters:{...x.filters,[Pe]:oe.filters[Pe]}};return ad($g({state:_e,baseKey:"filters"}),()=>Qv({rpcClient:L,state:_e}),mf)},[L,oe.filters,x]);return Ee.queryState==="error"?ce(Xa,{error:new Error(re("filters_loading_error"),{cause:Ee.error}),resetError:()=>Ee.swr.mutate()}):ce("div",{class:"ijs-filters-section flex w-full flex-col items-stretch justify-center gap-2 overflow-auto px-4 py-2 md:flex-row md:flex-wrap md:items-center",children:[p.filter(Pe=>Pe.hidden!==!0).map(Pe=>{const _e=fe===Pe.key,ze=x.filters[Pe.key]??{select:Pe.select,value:void 0},Se=oe.filters[Pe.key];Se&&$M(ze,Se);const st=ct=>{const{newActiveKey:xt,newValue:$t}=GM({property:Pe,activeKey:fe,value:ct??Se,properties:p,appliedFilters:x.filters});return xe(xt),T(Pe.key,$t)},nt=ct=>xe(ct?Pe.key:void 0),Xe=be(Pe.key);return ce(ed,{Fallback:Xa,children:ce(VM,{unfilteredQuery:Ee,active:_e,property:Pe,onActiveChange:nt,value:ze,useQuery:Xe,onValueChange:st,theme:k,widgetId:o})},Pe.key)}),ce("button",{type:"button",class:da({variant:"neutral"}),onClick:C,children:re("reset")}),j?ce("div",{id:"inploi-job-alerts",class:"min-h-[36px]",children:ce("div",{class:"rounded-job-card bg-neutral-2 flex h-[36px] animate-pulse items-center gap-2 px-2",children:[ce("div",{class:"block h-6 w-6"}),ce("p",{class:"text-style-tag text-neutral-6 pr-2 font-[500]",children:j.params.config.label})]})}):null]})};function qM(p){var x=typeof p;return p!=null&&(x=="object"||x=="function")}var $f=qM,ZM=typeof rd=="object"&&rd&&rd.Object===Object&&rd,WM=ZM,XM=WM,YM=typeof self=="object"&&self&&self.Object===Object&&self,KM=XM||YM||Function("return this")(),Gf=KM,JM=Gf,QM=function(){return JM.Date.now()},eP=QM,tP=/\s/;function iP(p){for(var x=p.length;x--&&tP.test(p.charAt(x)););return x}var rP=iP,nP=rP,oP=/^\s+/;function sP(p){return p&&p.slice(0,nP(p)+1).replace(oP,"")}var aP=sP,lP=Gf,cP=lP.Symbol,fy=cP,Ab=fy,Ib=Object.prototype,uP=Ib.hasOwnProperty,hP=Ib.toString,fd=Ab?Ab.toStringTag:void 0;function dP(p){var x=uP.call(p,fd),T=p[fd];try{p[fd]=void 0;var C=!0}catch{}var L=hP.call(p);return C&&(x?p[fd]=T:delete p[fd]),L}var pP=dP,fP=Object.prototype,mP=fP.toString;function _P(p){return mP.call(p)}var gP=_P,Cb=fy,yP=pP,vP=gP,xP="[object Null]",bP="[object Undefined]",Mb=Cb?Cb.toStringTag:void 0;function wP(p){return p==null?p===void 0?bP:xP:Mb&&Mb in Object(p)?yP(p):vP(p)}var Pb=wP;function TP(p){return p!=null&&typeof p=="object"}var SP=TP,EP=Pb,AP=SP,IP="[object Symbol]";function CP(p){return typeof p=="symbol"||AP(p)&&EP(p)==IP}var Hf=CP,MP=aP,Db=$f,PP=Hf,Rb=0/0,DP=/^[-+]0x[0-9a-f]+$/i,RP=/^0b[01]+$/i,zP=/^0o[0-7]+$/i,LP=parseInt;function kP(p){if(typeof p=="number")return p;if(PP(p))return Rb;if(Db(p)){var x=typeof p.valueOf=="function"?p.valueOf():p;p=Db(x)?x+"":x}if(typeof p!="string")return p===0?p:+p;p=MP(p);var T=RP.test(p);return T||zP.test(p)?LP(p.slice(2),T?2:8):DP.test(p)?Rb:+p}var OP=kP,FP=$f,my=eP,zb=OP,BP="Expected a function",NP=Math.max,jP=Math.min;function VP(p,x,T){var C,L,k,j,o,re,fe=0,xe=!1,oe=!1,Ee=!0;if(typeof p!="function")throw new TypeError(BP);x=zb(x)||0,FP(T)&&(xe=!!T.leading,oe="maxWait"in T,k=oe?NP(zb(T.maxWait)||0,x):k,Ee="trailing"in T?!!T.trailing:Ee);function be(xt){var $t=C,kt=L;return C=L=void 0,fe=xt,j=p.apply(kt,$t),j}function Pe(xt){return fe=xt,o=setTimeout(Se,x),xe?be(xt):j}function _e(xt){var $t=xt-re,kt=xt-fe,Wt=x-$t;return oe?jP(Wt,k-kt):Wt}function ze(xt){var $t=xt-re,kt=xt-fe;return re===void 0||$t>=x||$t<0||oe&&kt>=k}function Se(){var xt=my();if(ze(xt))return st(xt);o=setTimeout(Se,_e(xt))}function st(xt){return o=void 0,Ee&&C?be(xt):(C=L=void 0,j)}function nt(){o!==void 0&&clearTimeout(o),fe=0,C=re=L=o=void 0}function Xe(){return o===void 0?j:st(my())}function ct(){var xt=my(),$t=ze(xt);if(C=arguments,L=this,re=xt,$t){if(o===void 0)return Pe(re);if(oe)return clearTimeout(o),o=setTimeout(Se,x),be(re)}return o===void 0&&(o=setTimeout(Se,x)),j}return ct.cancel=nt,ct.flush=Xe,ct}var UP=VP;const $P=Ig(UP),Lb=(p,x=1e3)=>{const[T,C]=Ni(p),L=Pn(()=>$P(k=>C(k),x),[x]);return Ji(()=>{L(p)},[p,L]),T},GP=on(({disabled:p,error:x,name:T,inputPlaceholder:C,items:L,onItemSelect:k,onQueryChange:j,onBlur:o,onFocus:re,inputProps:fe,menuProps:xe,query:oe},Ee)=>{const[be,Pe]=Ni(!1),[_e,ze]=Ni(),{t:Se}=kn(),st=Oi();Ji(()=>{var Xe;ze((Xe=L[0])==null?void 0:Xe.id)},[L]);const nt=Xe=>{k(Xe),Pe(!1)};return ce("div",{class:"relative h-full",children:[ce("input",{name:T,ref:Ee,disabled:p,"data-active":be?"true":void 0,"aria-controls":`ijs-${T}-menu`,placeholder:C,class:pd({size:"md"}),onFocus:()=>{re==null||re(),Pe(!0)},onBlur:()=>{st.current=window.setTimeout(()=>{o==null||o(),Pe(!1)},100)},value:oe,onChange:Xe=>j(Xe.currentTarget.value),onKeyDown:Xe=>{switch(Pe(!0),Xe.key){case"ArrowDown":case"ArrowUp":{const ct=Xe.key==="ArrowDown"?1:-1;Xe.preventDefault();const xt=L.findIndex(kt=>kt.id===_e);if(xt===-1)return;const $t=L[xt+ct]??L[Xe.key==="ArrowDown"?0:L.length-1];if(!$t)return;ze($t.id);break}case"Enter":{if(Xe.preventDefault(),!_e)return;k(_e)}}},...fe}),!x&&be&&!p&&L.length>0?ce("ul",{className:yb({ring:"unset",className:"ring-width-section rounded-input ring-job-card-stroke absolute left-0 right-0 top-12 z-50 w-full shadow-sm"}),id:`ijs-${T}-menu`,onMouseDown:()=>{st.current&&clearTimeout(st.current)},...xe,children:x?ce("div",{role:"alert",children:Se("geo_suggestions_error")}):L.map(Xe=>ce("li",{class:vb({type:"line",className:"group/tag"}),children:ce("button",{type:"button",onMouseEnter:()=>ze(Xe.id),class:xb({active:Xe.id===_e,className:"line-clamp-1 overflow-hidden truncate"}),onClick:()=>nt(Xe.id),onKeyDown:ct=>{ct.key==="Enter"&&nt(Xe.id)},children:Xe.label})},Xe.id))}):null]})}),HP=(p={})=>new Promise((x,T)=>{var C,L;if((C=p.signal)!=null&&C.aborted){T(new DOMException("Aborted","AbortError"));return}navigator.geolocation.getCurrentPosition(k=>x(k.coords),k=>T(k),p),(L=p.signal)==null||L.addEventListener("abort",()=>{T(new DOMException("Aborted","AbortError"))},{once:!0})}),qP={1:"geo_error_permission_denied",2:"geo_error_position_unavailable",3:"geo_error_timeout"},kb=typeof window<"u"&&"geolocation"in navigator&&window.isSecureContext,ZP=({onLocate:p,onError:x,signal:T})=>{const[C,L]=Ni("idle"),[k,j]=Ni(null),{t:o}=kn(),re=fe=>{L("idle"),j(fe),p(fe)};return ce("button",{"aria-label":o(C==="loading"?"geo_locating":"geo_my_location"),type:"button",onClick:()=>{if(kb){if(L("loading"),k)return re(k);HP({signal:T}).then(fe=>{const xe={lat:fe.latitude,lng:fe.longitude};re(xe)}).catch(fe=>{if(fe instanceof DOMException&&fe.name==="AbortError")return L("idle");L("error");const xe=qP[fe.code];if(!xe)return;const oe=o(xe);x(oe)})}},"data-state":C,class:da({variant:"accent",size:"lg",icon:"only",className:"data-[state=loading]:animate-pulse"}),disabled:!kb||C==="error",children:ce(Sn,{name:"target-location"})})},Eu=Vo({base:"block fr font-style-tag font-family-tag font-weight-tag",variants:{variant:{neutralWeak:"text-tag-neutral-weak-copy bg-tag-neutral-weak-bg border-solid border-px border-tag-neutral-weak-stroke",neutralStrong:"text-tag-neutral-strong-copy bg-tag-neutral-strong-bg border-solid border-px border-tag-neutral-strong-stroke",accentStrong:"text-tag-accent-strong-copy bg-tag-accent-strong-bg border-solid border-px border-tag-accent-strong-stroke",monetaryWeak:"text-tag-monetary-weak-copy bg-tag-monetary-weak-bg border-solid border-px border-tag-monetary-weak-stroke"},interactive:{true:"ease-expo-out rounded-interactive transition-all duration-snappy",false:"rounded-tag"},size:{xs:"px-2 py-0.5 text-style-tag",sm:"px-3 py-1.5 text-style-tag",lg:"px-5 py-2.5 text-style-tag",unsized:""},disabled:{true:"opacity-25 pointer-events-none",false:""}},compoundVariants:[{disabled:!1,interactive:!0,class:"cursor-pointer active:scale-[0.975]"}],defaultVariants:{variant:"neutralWeak",size:"sm",disabled:!1,interactive:!1}}),WP="https://api.mapbox.com/search/geocode/v6/forward",XP="ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==",YP=p=>atob(p).split("").reverse().join(""),KP=So({features:Jh(os(So({properties:So({mapbox_id:Qr(),place_formatted:tc(Qr()),name_preferred:tc(Qr(),"Untitled location"),coordinates:os(So({latitude:ns(),longitude:ns()}),rs(({latitude:p,longitude:x})=>({lat:p,lng:x})))})}),rs(p=>p.properties)))}),JP=(p,x)=>Array.from(new Map(p.map(T=>[typeof x=="function"?x(T):T[x],T])).values()),QP=async p=>{if(!p)return[];const x=new URL(WP);x.searchParams.set("q",p),x.searchParams.set("proximity","ip"),x.searchParams.set("access_token",YP(XP));const T=await fetch(x);if(!T.ok)throw new Error("Failed to get address details");const C=lg(KP,await T.json());if(C.success===!1)throw console.error(C.issues),new Error("Invalid data");const{features:L}=C.output;return JP(L,k=>k.name_preferred+k.place_formatted)},eD=({onSelect:p,onValueChange:x,coords:T,radius:C,onError:L})=>{const{t:k}=kn(),[j,o]=Ni(""),[re,fe]=Ni(),xe=Lb(j,500),[oe,Ee]=Ni(new AbortController),be=ad(xe,QP,{keepPreviousData:!1,revalidateIfStale:!1,revalidateOnFocus:!1}),{data:Pe,queryState:_e,error:ze}=Qh(be),[Se,st]=Ni("view"),nt=Oi(null);return Ji(()=>{if(Se==="edit"){if(!nt.current)return;nt.current.focus()}},[Se]),ce("div",{class:"relative flex-1",children:[Se==="view"&&T?ce("button",{"aria-label":k("geo_search_placeholder"),type:"button",class:pd({size:"unsized",className:"flex h-10 w-full cursor-text items-stretch px-1 py-1"}),onClick:()=>{st("edit")},children:ce("div",{class:Eu({size:"sm",variant:"accentStrong",interactive:!0,class:"truncate"}),children:re??k("location_provided")})}):ce(GP,{ref:nt,error:ze,query:j,name:"location-search",onQueryChange:o,onFocus:()=>{oe.abort(),Ee(new AbortController)},onBlur:()=>{st("view"),o("")},onItemSelect:Xe=>{if(_e!=="loaded")return;const ct=Pe.find(xt=>xt.mapbox_id===Xe);ct&&(p(ct.coordinates),st("view"),fe(ct.name_preferred))},inputPlaceholder:k("geo_search_placeholder"),items:(Pe==null?void 0:Pe.map(Xe=>({id:Xe.mapbox_id,label:ce("div",{class:"flex min-w-0 max-w-full gap-2 overflow-hidden",children:[ce("strong",{class:"truncate",children:Xe.name_preferred})," ",ce("span",{class:"flex-1 truncate opacity-50",children:Xe.place_formatted})]})})))??[]}),ce("div",{class:"absolute bottom-0 right-0 top-0 flex items-center",children:!j&&!T?ce(ZP,{onLocate:Xe=>{st("view"),fe(k("geo_my_location")),x({type:"provided",coords:Xe,radius:C})},onError:L,signal:oe.signal}):ce("button",{type:"button","aria-label":k("geo_clear_search"),onClick:()=>{o(""),fe(void 0),x({radius:C,type:"provided"}),st("edit"),nt.current&&(nt.current.value="",nt.current.focus())},class:da({variant:"neutral",size:"lg",icon:"only"}),children:ce(Sn,{name:"x"})})})]})},tD=[.25,.5,1,3,5,10,15,20,30,40],iD=20,Ob=p=>p*1609.34,rD=new Intl.NumberFormat(void 0,{style:"unit",unit:"mile",unitDisplay:"long",maximumFractionDigits:1,trailingZeroDisplay:"stripIfInteger"}),nD=os(So({type:Ps("provided"),lat:tc(os(Qr(),rs(Number))),lng:tc(os(Qr(),rs(Number))),radius:os(Qr(),rs(Number))}),rs(p=>({radius:p.radius,type:p.type,coords:p.lat&&p.lng?{lat:p.lat,lng:p.lng}:void 0}))),oD=({value:p,onValueChange:x,logger:T})=>{const{t:C}=kn(),L=dg(),k=(p==null?void 0:p.type)==="provided"?p.radius:Ob(iD),[j,o]=Ni();return ce("div",{class:"flex flex-col gap-2",children:[ce("form",{onChange:re=>{const fe=new FormData(re.currentTarget),xe=lg(nD,Object.fromEntries(fe.entries()));if(!xe.success){T.error(xe.issues),o(xe.issues[0].message);return}x(xe.output)},class:"flex flex-col gap-2 md:flex-row",children:[ce("input",{type:"hidden",name:"type",value:"provided"}),(p==null?void 0:p.type)==="provided"&&p.coords?ce(rr,{children:[ce("input",{type:"hidden",name:"lat",value:p.coords.lat}),ce("input",{type:"hidden",name:"lng",value:p.coords.lng})]}):null,ce(eD,{coords:(p==null?void 0:p.type)==="provided"?p.coords:void 0,radius:k,onValueChange:x,onSelect:re=>{o(void 0),x({type:"provided",radius:k,coords:re})},onError:o}),ce("div",{class:"relative",children:[ce("label",{class:"sr-only",for:L,children:C("geo_range_label")}),ce("select",{id:L,name:"radius",class:pd({size:"unsized",className:"w-full appearance-none truncate py-2 pl-3 pr-10"}),value:k,onChange:re=>{o(void 0),x({type:"provided",coords:(p==null?void 0:p.type)==="provided"?p.coords:void 0,radius:Number(re.currentTarget.value)})},children:tD.map(re=>ce("option",{value:Ob(re),class:"truncate",children:rD.format(re)},re))}),ce("div",{class:"text-copy-neutral-lowcontrast pointer-events-none absolute bottom-0 right-0 top-0 flex w-10 items-center justify-center",children:ce(Sn,{name:"chevron-right",class:"h-6 w-6 rotate-90"})})]})]}),j?ce("div",{role:"alert",class:"text-pretty text-copy-neutral font-style-tag font-weight-tag text-style-tag flex gap-1",children:[ce(Sn,{name:"warning",class:"animate-appear-tag size-[1lh] flex-none"}),j]}):null]})},sD=2,aD=({value:p,onValueChange:x})=>{const[T,C]=Ni(p??""),L=T!==""&&T===p,{t:k}=kn();return Ji(()=>{C(p??"")},[p]),Ji(()=>{let j=T.trim();if(j.length<=sD&&(j=null),j===null){x("");return}const o=setTimeout(()=>{x(j)},300);return()=>clearTimeout(o)},[T,x]),ce("div",{class:"flex flex-col gap-3",children:ce("div",{class:"relative",children:[ce("label",{class:"absolute left-0 flex h-full items-center px-2",for:"ijs-keyword",children:[ce(Sn,{"aria-hidden":!0,title:"Search by keyword",name:"magnifierSimple",class:lu({"text-copy-neutral-icon":!L,"text-copy-accent-icon":L})}),ce("span",{class:"sr-only",children:"Keyword"})]}),ce("input",{autoComplete:"off",autocomplete:"off",name:"keyword",id:"ijs-keyword",type:"search",class:pd({hasValue:L,size:"unsized",class:"peer py-2 pl-10 pr-4"}),placeholder:k("type_to_search_jobs"),value:T,onChange:j=>{C(j.currentTarget.value)}}),ce("button",{type:"button",class:da({variant:"neutral",size:"lg",position:"absolute",class:"bottom-0 right-0 top-0 h-full peer-placeholder-shown:hidden",icon:"only"}),onClick:()=>{C("")},children:ce(Sn,{name:"x"})})]})})},lD=({intervalMs:p,strings:x,class:T})=>{const[C,L]=Ni(0),[k,j]=Ni(!0),o=[...x,x[0]];return Ji(()=>{C===o.length&&(j(!1),L(0));const re=setTimeout(()=>{j(!0),L(fe=>fe+1)},p);return()=>clearTimeout(re)},[C,o.length,p]),ce("div",{className:lu("relative h-full w-full overflow-hidden",T),children:ce("div",{className:lu("absolute w-full",{"transition-transform duration-500 ease-in-out":k}),style:{height:`${100*o.length}%`,transform:`translateY(-${C*(100/o.length)}%)`},children:o.map((re,fe)=>ce("div",{className:"flex items-center whitespace-nowrap",style:{height:`${100/o.length}%`},children:re},fe))})})},cD=(p,x)=>{Ji(()=>{const T=C=>{document.activeElement===p.current&&x(C)};return document.addEventListener("selectionchange",T),()=>document.removeEventListener("selectionchange",T)},[p,x])},Fb=3,uD=({value:p,onValueChange:x,options:T})=>{const[C,L]=Ni(p??""),k=C.trim(),j=k!==""&&k===p,{t:o}=kn(),re=k.split("");Ji(()=>{L(p??"")},[p]);const[fe,xe]=Ni(0),oe=Oi(null);return cD(oe,Ee=>{Ee.target instanceof HTMLInputElement&&xe(Ee.target.scrollLeft)}),Ji(()=>{let Ee=C.trim();if(Ee.length<=Fb&&(Ee=null),Ee===null){x("");return}const be=setTimeout(()=>{x(Ee.trim())},1e3);return()=>clearTimeout(be)},[C,x]),ce("div",{class:"mb-2 flex flex-col gap-2",children:[ce("div",{class:"relative",children:[ce("label",{class:"absolute left-0 flex h-full items-center px-2",for:"ijs-keyword",children:[ce(Sn,{"aria-hidden":!0,title:"Search by keyword",name:"ai",class:lu("duration-snappy transition-transform",{"text-copy-neutral-icon scale-90":!j,"text-copy-accent-icon":j})}),ce("span",{class:"sr-only",children:"Keyword"})]}),ce("input",{ref:oe,autoComplete:"off",autocomplete:"off",name:"keyword",id:"ijs-keyword",type:"text",placeholder:T!=null&&T.suggestions?T.suggestions.join(", "):" ",class:pd({hasValue:j,size:"unsized",class:"peer px-10 py-2 tracking-tight !text-transparent placeholder:!text-transparent"}),style:{fontKerning:"none"},value:C,onChange:Ee=>{const be=Ee.currentTarget.value.trim();L(be)},onKeyDown:Ee=>{if(Ee.key==="Enter"){if(Ee.currentTarget.value.trim().length<=Fb)return;Ee.preventDefault(),x(C)}}}),ce("div",{"data-synced":j,class:"font-weight-input text-copy-neutral group pointer-events-none absolute inset-x-10 inset-y-0 flex overflow-hidden tracking-tight peer-placeholder-shown:right-0",children:k.length>0?ce("div",{"aria-hidden":!0,class:"flex items-center whitespace-nowrap",style:{transform:`translateX(${-fe}px)`},children:re.map((Ee,be)=>ce("span",{style:{animationDelay:`${be*300/re.length}ms`},class:"group-data-[synced=true]:animate-ai-letter inline-block",children:Ee===" "?" ":Ee},k+be))}):T!=null&&T.suggestions?ce(lD,{intervalMs:2e3,strings:T.suggestions,class:"opacity-30","aria-hidden":!0}):null}),ce("button",{type:"button",class:da({variant:"neutral",size:"lg",position:"absolute",class:"bottom-0 right-0 top-0 h-full peer-placeholder-shown:hidden",icon:"only"}),onClick:()=>{L(""),x("")},children:ce(Sn,{name:"x"})})]}),ce("p",{class:"font-family-default text-balance font-style-default text-style-job-card-info text-copy-neutral-lowcontrast",children:o("ai_disclaimer")})]})};var hD=Array.isArray,_y=hD,dD=_y,pD=Hf,fD=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mD=/^\w*$/;function _D(p,x){if(dD(p))return!1;var T=typeof p;return T=="number"||T=="symbol"||T=="boolean"||p==null||pD(p)?!0:mD.test(p)||!fD.test(p)||x!=null&&p in Object(x)}var gD=_D,yD=Pb,vD=$f,xD="[object AsyncFunction]",bD="[object Function]",wD="[object GeneratorFunction]",TD="[object Proxy]";function SD(p){if(!vD(p))return!1;var x=yD(p);return x==bD||x==wD||x==xD||x==TD}var ED=SD,AD=Gf,ID=AD["__core-js_shared__"],CD=ID,gy=CD,Bb=function(){var p=/[^.]+$/.exec(gy&&gy.keys&&gy.keys.IE_PROTO||"");return p?"Symbol(src)_1."+p:""}();function MD(p){return!!Bb&&Bb in p}var PD=MD,DD=Function.prototype,RD=DD.toString;function zD(p){if(p!=null){try{return RD.call(p)}catch{}try{return p+""}catch{}}return""}var LD=zD,kD=ED,OD=PD,FD=$f,BD=LD,ND=/[\\^$.*+?()[\]{}|]/g,jD=/^\[object .+?Constructor\]$/,VD=Function.prototype,UD=Object.prototype,$D=VD.toString,GD=UD.hasOwnProperty,HD=RegExp("^"+$D.call(GD).replace(ND,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qD(p){if(!FD(p)||OD(p))return!1;var x=kD(p)?HD:jD;return x.test(BD(p))}var ZD=qD;function WD(p,x){return p==null?void 0:p[x]}var XD=WD,YD=ZD,KD=XD;function JD(p,x){var T=KD(p,x);return YD(T)?T:void 0}var Nb=JD,QD=Nb,eR=QD(Object,"create"),qf=eR,jb=qf;function tR(){this.__data__=jb?jb(null):{},this.size=0}var iR=tR;function rR(p){var x=this.has(p)&&delete this.__data__[p];return this.size-=x?1:0,x}var nR=rR,oR=qf,sR="__lodash_hash_undefined__",aR=Object.prototype,lR=aR.hasOwnProperty;function cR(p){var x=this.__data__;if(oR){var T=x[p];return T===sR?void 0:T}return lR.call(x,p)?x[p]:void 0}var uR=cR,hR=qf,dR=Object.prototype,pR=dR.hasOwnProperty;function fR(p){var x=this.__data__;return hR?x[p]!==void 0:pR.call(x,p)}var mR=fR,_R=qf,gR="__lodash_hash_undefined__";function yR(p,x){var T=this.__data__;return this.size+=this.has(p)?0:1,T[p]=_R&&x===void 0?gR:x,this}var vR=yR,xR=iR,bR=nR,wR=uR,TR=mR,SR=vR;function Au(p){var x=-1,T=p==null?0:p.length;for(this.clear();++x<T;){var C=p[x];this.set(C[0],C[1])}}Au.prototype.clear=xR,Au.prototype.delete=bR,Au.prototype.get=wR,Au.prototype.has=TR,Au.prototype.set=SR;var ER=Au;function AR(){this.__data__=[],this.size=0}var IR=AR;function CR(p,x){return p===x||p!==p&&x!==x}var MR=CR,PR=MR;function DR(p,x){for(var T=p.length;T--;)if(PR(p[T][0],x))return T;return-1}var Zf=DR,RR=Zf,zR=Array.prototype,LR=zR.splice;function kR(p){var x=this.__data__,T=RR(x,p);if(T<0)return!1;var C=x.length-1;return T==C?x.pop():LR.call(x,T,1),--this.size,!0}var OR=kR,FR=Zf;function BR(p){var x=this.__data__,T=FR(x,p);return T<0?void 0:x[T][1]}var NR=BR,jR=Zf;function VR(p){return jR(this.__data__,p)>-1}var UR=VR,$R=Zf;function GR(p,x){var T=this.__data__,C=$R(T,p);return C<0?(++this.size,T.push([p,x])):T[C][1]=x,this}var HR=GR,qR=IR,ZR=OR,WR=NR,XR=UR,YR=HR;function Iu(p){var x=-1,T=p==null?0:p.length;for(this.clear();++x<T;){var C=p[x];this.set(C[0],C[1])}}Iu.prototype.clear=qR,Iu.prototype.delete=ZR,Iu.prototype.get=WR,Iu.prototype.has=XR,Iu.prototype.set=YR;var KR=Iu,JR=Nb,QR=Gf,ez=JR(QR,"Map"),tz=ez,Vb=ER,iz=KR,rz=tz;function nz(){this.size=0,this.__data__={hash:new Vb,map:new(rz||iz),string:new Vb}}var oz=nz;function sz(p){var x=typeof p;return x=="string"||x=="number"||x=="symbol"||x=="boolean"?p!=="__proto__":p===null}var az=sz,lz=az;function cz(p,x){var T=p.__data__;return lz(x)?T[typeof x=="string"?"string":"hash"]:T.map}var Wf=cz,uz=Wf;function hz(p){var x=uz(this,p).delete(p);return this.size-=x?1:0,x}var dz=hz,pz=Wf;function fz(p){return pz(this,p).get(p)}var mz=fz,_z=Wf;function gz(p){return _z(this,p).has(p)}var yz=gz,vz=Wf;function xz(p,x){var T=vz(this,p),C=T.size;return T.set(p,x),this.size+=T.size==C?0:1,this}var bz=xz,wz=oz,Tz=dz,Sz=mz,Ez=yz,Az=bz;function Cu(p){var x=-1,T=p==null?0:p.length;for(this.clear();++x<T;){var C=p[x];this.set(C[0],C[1])}}Cu.prototype.clear=wz,Cu.prototype.delete=Tz,Cu.prototype.get=Sz,Cu.prototype.has=Ez,Cu.prototype.set=Az;var Iz=Cu,Ub=Iz,Cz="Expected a function";function yy(p,x){if(typeof p!="function"||x!=null&&typeof x!="function")throw new TypeError(Cz);var T=function(){var C=arguments,L=x?x.apply(this,C):C[0],k=T.cache;if(k.has(L))return k.get(L);var j=p.apply(this,C);return T.cache=k.set(L,j)||k,j};return T.cache=new(yy.Cache||Ub),T}yy.Cache=Ub;var Mz=yy,Pz=Mz,Dz=500;function Rz(p){var x=Pz(p,function(C){return T.size===Dz&&T.clear(),C}),T=x.cache;return x}var zz=Rz,Lz=zz,kz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Oz=/\\(\\)?/g,Fz=Lz(function(p){var x=[];return p.charCodeAt(0)===46&&x.push(""),p.replace(kz,function(T,C,L,k){x.push(L?k.replace(Oz,"$1"):C||T)}),x}),Bz=Fz;function Nz(p,x){for(var T=-1,C=p==null?0:p.length,L=Array(C);++T<C;)L[T]=x(p[T],T,p);return L}var jz=Nz,$b=fy,Vz=jz,Uz=_y,$z=Hf,Gz=1/0,Gb=$b?$b.prototype:void 0,Hb=Gb?Gb.toString:void 0;function qb(p){if(typeof p=="string")return p;if(Uz(p))return Vz(p,qb)+"";if($z(p))return Hb?Hb.call(p):"";var x=p+"";return x=="0"&&1/p==-Gz?"-0":x}var Hz=qb,qz=Hz;function Zz(p){return p==null?"":qz(p)}var Wz=Zz,Xz=_y,Yz=gD,Kz=Bz,Jz=Wz;function Qz(p,x){return Xz(p)?p:Yz(p,x)?[p]:Kz(Jz(p))}var eL=Qz,tL=Hf,iL=1/0;function rL(p){if(typeof p=="string"||tL(p))return p;var x=p+"";return x=="0"&&1/p==-iL?"-0":x}var nL=rL,oL=eL,sL=nL;function aL(p,x){x=oL(x,p);for(var T=0,C=x.length;p!=null&&T<C;)p=p[sL(x[T++])];return T&&T==C?p:void 0}var lL=aL,cL=lL;function uL(p,x,T){var C=p==null?void 0:cL(p,x);return C===void 0?T:C}var hL=uL;const dL=Ig(hL),md=({chars:p})=>ce("span",{style:{width:p+"ch"},class:"rounded-job-tag block h-[1lh] min-h-[1em] bg-[currentColor] opacity-25"}),Zb=Vo({base:"ijs-job relative rounded-job-card bg-job-card-bg ring-width-job-card ring-job-card-stroke flex gap-4 fr ease-expo-out min-w-0 p-4 transition-all duration-medium",variants:{interactive:{true:"active:bg-job-card-bg-active active:ring-job-card-stroke-active hover:bg-job-card-bg-active hover:ring-job-card-stroke-active active:scale-[0.975]",false:"animate-skeleton"}},defaultVariants:{interactive:!0}}),pL=Vo({base:"font-style-job-heading font-weight-job-heading text-copy-neutral font-family-job-heading text-pretty",variants:{size:{sm:"text-style-filter",default:"text-style-job-heading"}},defaultVariants:{size:"default"}}),vy=({job:p,property:x})=>{if(!x)return null;const T=dL(p.raw,x.key);return x.transform?x.transform(T):T},fL=({job:p,config:x="hidden"})=>x==="hidden"?null:ce("div",{class:"rounded-logo h-12 flex-none overflow-hidden",style:{aspectRatio:x.replace(":","/")},children:p.company.logo?ce("img",{src:p.company.logo,alt:p.company.name,class:"h-full w-full select-none object-contain [-webkit-user-drag:none]"}):null}),Wb=p=>Array.isArray(p)?p:[p],mL=1e3*60*60*24,Xb=({job:p,config:x,onJobClick:T,size:C})=>{var be,Pe,_e;const{t:L}=kn(),k=x.subheading?vy({job:p,property:x.subheading}):null,j=x.infoTags.flatMap(ze=>Wb(vy({job:p,property:ze}))).filter(Boolean),o=Wb((be=x.overrides)!=null&&be.salary?vy({job:p,property:x.overrides.salary}):p.pay).filter(Boolean),re=x.postedDate??"show",fe=(Pe=x.overrides)!=null&&Pe.baseUrl?x.overrides.baseUrl(p.id.toString()):p.href,xe=x.newUnderDays??7,oe=p.createdAt?new Date(p.createdAt).getTime()>Date.now()-xe*mL:!1,Ee=ze=>{var Se,st;T==null||T(p),(st=(Se=x.overrides)==null?void 0:Se.onClick)==null||st.call(Se,ze)};return ce("a",{onMouseEnter:(_e=x.overrides)==null?void 0:_e.onMouseEnter,onClick:Ee,href:fe,target:x.openJob==="redirect-new-tab"?"_blank":void 0,class:Zb(),children:[ce("div",{class:"flex min-w-0 flex-1 flex-col gap-4",children:[ce("div",{class:"gap-logo flex items-center",children:[ce(fL,{job:p,config:C!=="sm"?x.logo:void 0}),ce("div",{class:"flex flex-col items-start gap-1",children:[ce("div",{class:"order-2 flex flex-col gap-1",children:[p.match?ce("p",{class:"text-style-job-card text-tag-accent-strong-bg flex items-center ",children:[ce(Sn,{name:"ai",class:"size-4 inline-block"}),ce("span",{children:p.match})]}):null,ce("p",{class:pL({size:C}),children:[p.title.trim(),oe&&re!=="hide"&&ce(rr,{children:[" ",ce("span",{"aria-hidden":!0,class:"ring-px ring-tag-accent-strong-bg rounded-job-card text-tag-accent-strong-bg font-weight-tag not-sr-only order-1 inline-block px-2 py-1 align-middle text-[10px] leading-none",children:L("new")})]})]}),k?ce("p",{class:"text-style-job-card text-copy-neutral-lowcontrast",children:k}):null]}),re==="show"?ce("p",{class:"text-style-job-card-info text-copy-job-info order-1",children:[L("posted")," ",p.relativePostedDate]}):null]})]}),ce("div",{class:"flex min-w-0 flex-col items-start gap-2",children:[ce("div",{class:"flex min-w-0 max-w-full flex-wrap items-center gap-2",children:o.map((ze,Se)=>ce("span",{class:Eu({variant:"monetaryWeak",size:"xs"}),children:ze},Se))}),j.length>0&&ce("ul",{class:"flex min-w-0 max-w-full flex-wrap items-center gap-2",children:j.map(ze=>ce("li",{class:Eu({size:"xs",class:"max-w-full truncate"}),children:ze},ze))})]})]}),C==="sm"?ce("div",{"aria-hidden":!0,class:"absolute right-1 top-1/2 -translate-y-1/2 transform",children:ce(Sn,{name:"chevron-right",class:"size-5 text-copy-neutral-icon"})}):ce("div",{"aria-hidden":!0,class:"flex items-center",children:ce(Sn,{name:"chevron-right",class:"text-copy-neutral-icon"})})]})},xy=({config:p,animationDelay:x,seed:T})=>{const C=p.logo??"hidden",L=p.postedDate??"show";return ce("div",{"aria-hidden":!0,style:{animationDelay:x+"s"},class:Zb({interactive:!1}),children:[ce("div",{class:"flex flex-1 flex-col gap-4",children:[ce("div",{class:"flex items-center gap-4",children:[C==="hidden"?null:ce("div",{class:"rounded-logo bg-copy-neutral h-12 opacity-25",style:{aspectRatio:C.replace(":","/")}}),ce("div",{class:"flex flex-col items-start gap-1",children:[L==="show"?ce("p",{class:"text-style-job-card-info text-copy-job-info",children:ce(md,{chars:12})}):null,ce("div",{class:"flex flex-col gap-1",children:[ce("p",{class:"text-style-job-heading font-style-job-heading font-weight-job-heading text-copy-neutral font-family-job-heading",children:ce(md,{chars:13+(T+5)*T%7})}),p.subheading!==null?ce("p",{class:"text-style-job-card text-copy-neutral-lowcontrast",children:ce(md,{chars:7+T*T%3})}):null]})]})]}),ce("div",{class:"flex flex-col items-start gap-2",children:[T%2===0&&ce("span",{class:Eu({variant:"neutralWeak",size:"xs",class:"h-[1lh] min-h-[1em] w-[10ch]"})}),ce("div",{class:"flex items-center gap-2",children:[ce("span",{class:Eu({variant:"neutralWeak",size:"xs",class:"h-[1lh] min-h-[1em] w-[6ch]"})}),ce("span",{class:Eu({variant:"neutralWeak",size:"xs",class:"h-[1lh] min-h-[1em] w-[8ch]"})})]})]})]}),ce("div",{"aria-hidden":!0,class:"flex items-center",children:ce(Sn,{name:"chevron-right",class:"text-copy-neutral-icon"})})]})},_L=({state:p,fetchNextPage:x,config:T,remainingItems:C})=>{const{t:L}=kn(),k=Math.min(ic,C);return p==="revalidating"?ce("ul",{class:"flex flex-col gap-3","aria-hidden":!0,children:Array.from({length:ic}).map((j,o)=>ce("li",{children:ce(xy,{seed:o,animationDelay:(o-4)*.1,config:T})},o))}):ce("button",{type:"button",class:da({variant:"neutral",class:"w-full max-w-[45rem] self-center py-2"}),onClick:x,children:[L("load_more_count",{count:k})," ",L("of_remaining_count",{count:C})]})},gL=({state:p,rpcClient:x,jobCardConfig:T,initialData:C,onResultsUpdate:L,onJobClick:k,onPaginate:j,mode:o,afterResults:re})=>ce(rr,{children:Array.from({length:p.page}).map((fe,xe)=>{const oe=xe===p.page-1;return ce(ed,{Fallback:Xa,children:ce(yL,{state:p,rpcClient:x,page:xe+1,isFirst:xe===0,isLast:oe,fetchNextPage:()=>{j(p.page+1)},jobCardConfig:T,initialData:C,onResultsUpdate:L,onJobClick:k,mode:o,afterResults:re},xe)},xe)})}),Yb=({page:p})=>{const{t:x}=kn();return ce("div",{"aria-hidden":!0,class:"text-copy-neutral-lowcontrast mx-auto flex w-full max-w-[45rem] gap-2 py-4",onClick:T=>{T.preventDefault()},children:[ce("span",{class:"bg-wavy bg-neutral-3 flex-1 opacity-10"}),ce("span",{class:"text-style-tag justify-center text-center",children:[x("page")," ",p]}),ce("span",{class:"bg-wavy bg-neutral-3 flex-1 opacity-10"})]})},yL=({state:p,rpcClient:x,page:T,isFirst:C,isLast:L,fetchNextPage:k,jobCardConfig:j,initialData:o,onResultsUpdate:re,onJobClick:fe,afterResults:xe})=>{const{t:oe}=kn(),Ee=T===1?o:void 0,{data:be,error:Pe,queryState:_e,swr:ze}=Qh(ad($g({state:p,baseKey:T.toString()}),()=>ex({rpcClient:x,state:p,page:T,t:oe}),{...mf,fallbackData:Ee}));switch(Ji(()=>{be&&C&&re&&re({totalCount:be.pagination.total})},[be,C,re]),_e){case"idle":return null;case"loading":return ce(rr,{children:[C?ce("div",{class:"flex w-full max-w-[45rem] items-center gap-2 self-center",children:[ce("div",{class:"flex-1"}),ce("p",{class:"animate-skeleton text-copy-neutral-lowcontrast text-style-tag m-0 justify-center p-0 text-center",children:ce(md,{chars:8})}),ce("div",{class:"flex flex-1 justify-end",children:xe})]}):ce(Yb,{page:T}),ce("ul",{class:"flex w-full max-w-[45rem] flex-col gap-3 self-center","aria-hidden":!0,children:Array.from({length:ic}).map((Se,st)=>ce("li",{children:ce(xy,{seed:st,animationDelay:(st-ic)*.1,config:j})},st))})]});case"error":return ce(Xa,{error:new Error(oe("jobs_loading_error"),{cause:Pe}),resetError:()=>ze.mutate()});case"revalidating":case"loaded":{if(Cs(be.pagination.current_page===T,"Received wrong page from server"),be.pagination.total===0)return ce("div",{class:"mx-auto flex flex-col items-center gap-2 px-2 py-4 text-center",children:[ce(Sn,{"aria-hidden":!0,name:"magnifier",class:"text-copy-neutral-lowcontrast"}),ce("div",{class:"flex flex-col items-center gap-1",children:[ce("p",{class:"text-copy-neutral text-style-job-heading",children:oe("no_jobs_found")}),ce("p",{class:"text-copy-neutral-lowcontrast text-style-tag [text-wrap:pretty]",children:oe("no_jobs_found_description")})]})]});const Se=be.pagination.last_page!==be.pagination.current_page,st=T*ic,nt=Math.max(be.pagination.total-st,0),Xe=ct=>{fe(ct,T)};return ce(rr,{children:[C?ce("div",{class:"flex w-full max-w-[45rem] items-center gap-2 self-center",children:[ce("div",{class:"flex-1"}),ce("p",{class:"text-copy-neutral-lowcontrast text-style-tag m-0 justify-center p-0 text-center",children:oe("jobs_found",{count:be.pagination.total})}),ce("div",{class:"flex flex-1 justify-end",children:xe})]}):ce(Yb,{page:T}),ce("ul",{"aria-label":`Page ${T}`,class:"flex w-full max-w-[45rem] flex-col gap-3 self-center",children:be.results.map(ct=>ce("li",{class:"ease-expo-out duration-slow transition-opacity",style:{opacity:_e==="revalidating"?.33:1},children:ce(Xb,{job:ct,onJobClick:Xe,config:j})},ct.id))}),Se&&L&&ce(_L,{state:_e,fetchNextPage:k,config:j,remainingItems:nt})]})}default:No(_e)}},vL=Sg(()=>Promise.resolve().then(()=>ML).then(p=>p.Map)),xL=({state:p,rpcClient:x,mapConfig:T,onGeoChange:C,afterResults:L,onJobClick:k,jobCardConfig:j})=>{var Pe,_e;const{t:o}=kn(),[re,fe]=Ni(new AbortController),xe=_x("(max-width: 767px)"),oe=Ur(ze=>{C(ze),re.abort(),fe(new AbortController)},[C,re]),Ee=Qh(ad(["map",p],()=>IE({rpcClient:x,state:p,t:o,signal:re.signal}),mf));if(Ee.queryState==="error")return ce(Xa,{error:new Error(o("jobs_loading_error"),{cause:Ee.error}),resetError:()=>Ee.swr.mutate()});const be=Ee.queryState==="loaded"||Ee.queryState==="revalidating";return ce(rr,{children:[ce("div",{class:"flex items-center gap-2",children:[ce("div",{class:"flex-1"}),ce("p",{class:"text-copy-neutral-lowcontrast text-style-tag m-0 justify-center p-0 text-center",children:be?Ee.data.results.length!==0&&o("map_jobs_showing",{count:Ee.data.results.length}):ce("div",{class:"animate-skeleton",children:ce(md,{chars:8})})}),ce("div",{class:"flex flex-1 justify-end",children:L})]}),ce("div",{class:"theme-fill:bg-neutral-2 theme-stroke:bg-lowest ring-px theme-fill:ring-neutral-3 theme-stroke:ring-neutral-3 theme-soft:rounded-lg theme-rounded:rounded-xl relative flex h-auto flex-col items-stretch overflow-hidden md:h-[70svh] md:flex-row",children:[ce("div",{class:"md:min-w-80 aspect-square flex-1 md:order-2 md:aspect-auto",children:be?ce(hu,{fallback:ce("div",{class:"animate-skeleton bg-neutral-6 h-full w-full"}),children:ce(vL,{config:T,mapData:Ee,autoFit:((Pe=p.geo)==null?void 0:Pe.type)!=="bounds",onBoundsChange:oe})}):ce("div",{class:"animate-skeleton bg-neutral-6 h-full w-full"})}),ce("ul",{class:"flex h-full w-full snap-x snap-proximity scroll-px-4 gap-3 overflow-auto p-4 md:order-1 md:max-w-xl md:flex-col",children:[((_e=Ee.data)==null?void 0:_e.results.length)===0?ce("div",{class:"mx-auto flex h-full w-full flex-col items-center justify-center gap-2 text-center",children:[ce(Sn,{"aria-hidden":!0,name:"magnifier",class:"text-copy-neutral-lowcontrast"}),ce("div",{class:"flex flex-col items-center gap-1",children:[ce("p",{class:"text-copy-neutral text-style-job-heading",children:o("no_jobs_found")}),ce("p",{class:"text-copy-neutral-lowcontrast text-style-tag [text-wrap:pretty]",children:o("no_jobs_found_description")})]})]}):null,be?Ee.data.results.map(ze=>ce("li",{class:"ease-expo-out duration-slow min-w-[calc(100%-1rem)] snap-start transition-opacity",style:{opacity:Ee.queryState==="revalidating"?.33:1},children:ce(Xb,{job:ze,onJobClick:Se=>k(Se,1),config:j,size:xe?"sm":void 0})},ze.id)):Array.from({length:6}).map((ze,Se)=>ce("li",{children:ce(xy,{seed:Se,animationDelay:(Se-6)*.1,config:j})},Se))]})]})]})},Kb=Vo({base:"flex items-center justify-center cursor-pointer text-style-tag rounded-interactive active:scale-95 transition-all duration-snappy pl-2 pr-2.5 py-1.5 gap-1",variants:{active:{true:"bg-lowest text-neutral-12 shadow-sm animate-appear-tag",false:"text-neutral-10 hover:text-neutral-12"}},defaultVariants:{active:!1}}),bL=({value:p,onValueChange:x})=>{const{t:T}=kn();return ce("div",{class:"bg-neutral-3 rounded-interactive ring-neutral-3 mr-[3px] inline-flex ring-[3px]",children:[ce("button",{type:"button","aria-pressed":p==="list",class:Kb({active:p==="list"}),onClick:()=>x("list"),children:[ce(Sn,{name:"list",class:"size-5"}),ce("span",{children:T("list")})]}),ce("button",{type:"button","aria-pressed":p==="map",class:Kb({active:p==="map"}),onClick:()=>x("map"),children:[ce(Sn,{name:"map",class:"size-5"}),ce("span",{children:T("map")})]})]})},wL=p=>{const x=p.state.view,T=p.mapConfig&&p.mapConfig.enabled?ce(bL,{value:x,onValueChange:p.onViewChange}):null;return x==="list"?ce(gL,{afterResults:T,...p}):ce(xL,{...p,afterResults:T})},by=(p,x="value")=>p.reduce((T,C)=>{switch(C.select){case"one":{const L=C.value??C[x],k=typeof L=="string"?L:L==null?void 0:L[0];T[C.key]={select:C.select,value:k};break}case"many":{const L=C.value??C[x],k=typeof L=="string"?[L]:Array.isArray(L)?L:[];T[C.key]={select:C.select,value:k};break}default:No(C.select)}return T},{}),Mu=p=>Object.fromEntries(Object.entries(p).map(([x,T])=>{const C=T==null?void 0:T.value;return[x,Array.isArray(C)?C:C?[C]:[]]}).filter(([,x])=>x!==void 0&&x.length>0)),Jb=p=>(p==null?void 0:p.type)==="bounds"?void 0:p,TL=({rpcClient:p,logger:x,properties:T,analytics:C,initialData:L,onStateChange:k,params:j})=>{var $t,kt,Wt,Ai,mi;const{t:o}=kn(),re=Oi(null),fe=Pn(()=>by(T,"defaultValue"),[T]),[xe,oe]=Ni(!0),[Ee,be]=Ni(()=>typeof j.initialState=="function"?j.initialState(j):j.initialState),[Pe,_e]=Ni(0),{onJobClick:ze,analyticsPaginate:Se}=SL({appRef:re,analytics:C,state:Ee,hasInteracted:!xe,totalCount:Pe,defaultFilters:fe}),st=Ur(bi=>{be(Jt=>{if(Jt.page===bi)return Jt;const Bt={...Jt,page:bi};return k==null||k(Bt),Bt}),Se(bi)},[Se,k]),nt=Ur(bi=>{be(Jt=>{const Bt={...Jt,view:bi};return k==null||k(Bt),Bt})},[k]),Xe=Ur(bi=>{be(Jt=>{var ri;if(!Jt.query&&!bi||Jt.query===bi)return Jt;oe(!1);const Bt=Jb(Jt.geo),vi={...Jt,query:bi,geo:Bt,page:1,mode:(ri=j.naturalLanguageSearch)!=null&&ri.enabled?"vector":"query"};return k==null||k(vi),vi})},[k,($t=j.naturalLanguageSearch)==null?void 0:$t.enabled]),ct=Ur(bi=>{oe(!1),be(Jt=>{const Bt={...Jt,geo:bi};return k==null||k(Bt),Bt})},[k]),xt=Ur(()=>{be(bi=>{const Jt={...bi,filters:by(T,"defaultValue"),query:"",geo:void 0,page:1};return k==null||k(Jt),Jt})},[k,T]);return ce("div",{ref:re,class:lu("ijs-app font-family-default font-weight-default font-style-default flex min-h-screen flex-col gap-4",{"reduce-motion":(kt=j.theme.accessibility)==null?void 0:kt.reducedMotion},bg(j.theme)),children:[ce(ed,{Fallback:Xa,children:ce("div",{class:"flex flex-col gap-2",children:[ce("div",{class:"px-4",children:ce("div",{class:"bg-section-strong-bg ring-section-weak-stroke rounded-section ring-px lg:ring-width-section flex flex-col gap-4 p-4 md:flex-row",children:[ce("section",{class:"flex flex-1 flex-col gap-1",children:[ce("p",{class:"text-style-filter text-copy-neutral font-style-filter font-weight-filter",children:o("search_label")}),(Wt=j.naturalLanguageSearch)!=null&&Wt.enabled?ce(uD,{value:Ee.query,onValueChange:Xe,options:j.naturalLanguageSearch}):j.enableKeywordSearch?ce(aD,{value:Ee.query,onValueChange:Xe}):null]}),(Ai=j.geolocation)!=null&&Ai.enabled?ce("section",{class:"flex flex-1 flex-col gap-1",children:[ce("p",{class:"text-style-filter text-copy-neutral font-style-filter font-weight-filter",children:o("geo_label")}),ce(oD,{value:Ee.geo,onValueChange:bi=>{oe(!1),be(Jt=>{const Bt={...Jt,geo:bi,page:1};return k==null||k(Bt),Bt}),Se(1)},logger:x})]}):null]})}),ce(HM,{state:Ee,onFilterValueChange:(bi,Jt)=>{oe(!1),be(Bt=>{const vi={...Bt.filters,[bi]:Jt},ri=Jb(Bt.geo),ui={...Bt,filters:vi,geo:ri,page:1};return k==null||k(ui),ui}),Se(1)},onResetFilters:xt,properties:T,rpcClient:p,alerts:j.alerts,theme:j.theme,widgetId:j.widgetId})]})}),ce("section",{class:"flex flex-col gap-4 overflow-hidden px-4 py-4",children:[ce(ed,{Fallback:Xa,children:ce(wL,{state:Ee,rpcClient:p,jobCardConfig:j.jobCard,mapConfig:j.map,initialData:xe?L==null?void 0:L.jobs:void 0,onResultsUpdate:bi=>{_e(bi.totalCount)},onJobClick:ze,onPaginate:st,mode:(mi=j.naturalLanguageSearch)!=null&&mi.enabled?"vector":"query",onGeoChange:ct,onViewChange:nt})}),j.feedback?ce("div",{class:"flex flex-wrap items-center justify-center gap-2",children:[ce("p",{class:"font-family-default text-balance font-style-default text-style-job-card-info text-copy-neutral-lowcontrast",children:o("feedback")}),ce("div",{"data-widget":"inploi-feedback","data-key":"job-search",children:ce("div",{class:"rounded-job-card bg-neutral-2 h-8 w-[72px] animate-pulse"})})]}):null]})]})},SL=({appRef:p,analytics:x,state:T,defaultFilters:C,totalCount:L,hasInteracted:k})=>{const j=Ur((fe=1)=>({query:T.query,mode:T.mode,filters:Mu(T.filters),default_filters:Mu(C),total_count:L,page_size:ic,page:fe}),[T.query,T.mode,T.filters,C,L]);return jE(p,{minViewTime:2e3,onView:()=>{x.log({event:"VIEW_SEARCH",properties:j()})}}),Ji(()=>{const fe=window.setTimeout(()=>{k&&(!T.query&&!Object.keys(Mu(T.filters)).length||L!==0&&x.log({event:"SEARCH_SETTLE",properties:j()}))},5e3);return()=>{clearTimeout(fe)}},[x,k,j,L,T.query,T.filters]),{onJobClick:(fe,xe)=>{x.log({event:"SEARCH_JOB_CLICK",properties:{job_id:fe.id,...j(xe)}})},analyticsPaginate:fe=>{x.log({event:"SEARCH_PAGINATE",properties:j(fe)})}}},EL=`.inploi-job-search{font-size:16px;--tw-content: ""}.inploi-job-search *{box-sizing:border-box;border-style:solid;border-width:0;-webkit-tap-highlight-color:transparent;font-family:inherit;font-style:inherit;font-weight:inherit}.inploi-job-search :before,.inploi-job-search :after{box-sizing:border-box}.inploi-job-search :is(a){text-decoration:none}.inploi-job-search :is(ul,ol){list-style:none;padding:0;margin:0}.inploi-job-search :is(p){margin:0;padding:0}.inploi-job-search :is(li){margin:0;padding:0;list-style:none}.inploi-job-search :is(button),.inploi-job-search :is(a){display:block;margin:0;padding:0;border:unset;background:unset;text-align:unset}.inploi-job-search :is(input),.inploi-job-search :is(textarea){display:block;margin:0;padding:0;min-width:0;max-width:unset;width:100%}.inploi-job-search :is(svg){display:block}.inploi-job-search :is(button){touch-action:manipulation}.inploi-job-search input[type=search]::-webkit-search-decoration,.inploi-job-search input[type=search]::-webkit-search-cancel-button,.inploi-job-search input[type=search]::-webkit-search-results-button,.inploi-job-search input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}@media (prefers-reduced-motion){.inploi-job-search *{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important;animation-delay:0s!important}}.inploi-job-search *,.inploi-job-search :before,.inploi-job-search :after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.inploi-job-search ::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.inploi-job-search .container{width:100%}@media (min-width: 640px){.inploi-job-search .container{max-width:640px}}@media (min-width: 768px){.inploi-job-search .container{max-width:768px}}@media (min-width: 1024px){.inploi-job-search .container{max-width:1024px}}@media (min-width: 1280px){.inploi-job-search .container{max-width:1280px}}@media (min-width: 1536px){.inploi-job-search .container{max-width:1536px}}.inploi-job-search .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.inploi-job-search .not-sr-only{position:static;width:auto;height:auto;padding:0;margin:0;overflow:visible;clip:auto;white-space:normal}.inploi-job-search .pointer-events-none{pointer-events:none}.inploi-job-search .visible{visibility:visible}.inploi-job-search .invisible{visibility:hidden}.inploi-job-search .collapse{visibility:collapse}.inploi-job-search .static{position:static}.inploi-job-search .fixed{position:fixed}.inploi-job-search .absolute{position:absolute}.inploi-job-search .relative{position:relative}.inploi-job-search .sticky{position:sticky}.inploi-job-search .inset-0{top:0;right:0;bottom:0;left:0}.inploi-job-search .inset-x-10{left:2.5rem;right:2.5rem}.inploi-job-search .inset-y-0{top:0;bottom:0}.inploi-job-search .-right-1{right:-.25rem}.inploi-job-search .-top-1{top:-.25rem}.inploi-job-search .bottom-0{bottom:0}.inploi-job-search .left-0{left:0}.inploi-job-search .left-12{left:3rem}.inploi-job-search .right-0{right:0}.inploi-job-search .right-1{right:.25rem}.inploi-job-search .right-12{right:3rem}.inploi-job-search .top-0{top:0}.inploi-job-search .top-1\\/2{top:50%}.inploi-job-search .top-12{top:3rem}.inploi-job-search .top-2{top:.5rem}.inploi-job-search .isolate{isolation:isolate}.inploi-job-search .z-50{z-index:50}.inploi-job-search .order-1{order:1}.inploi-job-search .order-2{order:2}.inploi-job-search .m-0{margin:0}.inploi-job-search .m-11{margin:2.75rem}.inploi-job-search .m-3{margin:.75rem}.inploi-job-search .m-4{margin:1rem}.inploi-job-search .mx-auto{margin-left:auto;margin-right:auto}.inploi-job-search .mb-2{margin-bottom:.5rem}.inploi-job-search .ml-auto{margin-left:auto}.inploi-job-search .mr-\\[3px\\]{margin-right:3px}.inploi-job-search .line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.inploi-job-search .block{display:block}.inploi-job-search .inline-block{display:inline-block}.inploi-job-search .inline{display:inline}.inploi-job-search .flex{display:flex}.inploi-job-search .inline-flex{display:inline-flex}.inploi-job-search .table{display:table}.inploi-job-search .table-row{display:table-row}.inploi-job-search .flow-root{display:flow-root}.inploi-job-search .grid{display:grid}.inploi-job-search .inline-grid{display:inline-grid}.inploi-job-search .contents{display:contents}.inploi-job-search .list-item{display:list-item}.inploi-job-search .\\!hidden{display:none!important}.inploi-job-search .hidden{display:none}.inploi-job-search .aspect-square{aspect-ratio:1 / 1}.inploi-job-search .size-4{width:1rem;height:1rem}.inploi-job-search .size-5{width:1.25rem;height:1.25rem}.inploi-job-search .size-\\[1lh\\]{width:1lh;height:1lh}.inploi-job-search .h-10{height:2.5rem}.inploi-job-search .h-12{height:3rem}.inploi-job-search .h-6{height:1.5rem}.inploi-job-search .h-8{height:2rem}.inploi-job-search .h-\\[1lh\\]{height:1lh}.inploi-job-search .h-\\[36px\\]{height:36px}.inploi-job-search .h-\\[80svh\\]{height:80svh}.inploi-job-search .h-auto{height:auto}.inploi-job-search .h-full{height:100%}.inploi-job-search .max-h-\\[--radix-popover-content-available-height\\]{max-height:var(--radix-popover-content-available-height)}.inploi-job-search .min-h-0{min-height:0px}.inploi-job-search .min-h-6{min-height:1.5rem}.inploi-job-search .min-h-\\[1em\\]{min-height:1em}.inploi-job-search .min-h-\\[36px\\]{min-height:36px}.inploi-job-search .min-h-screen{min-height:100vh}.inploi-job-search .w-10{width:2.5rem}.inploi-job-search .w-6{width:1.5rem}.inploi-job-search .w-\\[10ch\\]{width:10ch}.inploi-job-search .w-\\[3ch\\]{width:3ch}.inploi-job-search .w-\\[6ch\\]{width:6ch}.inploi-job-search .w-\\[72px\\]{width:72px}.inploi-job-search .w-\\[8ch\\]{width:8ch}.inploi-job-search .w-full{width:100%}.inploi-job-search .min-w-0{min-width:0px}.inploi-job-search .min-w-6{min-width:1.5rem}.inploi-job-search .min-w-64{min-width:16rem}.inploi-job-search .min-w-\\[calc\\(100\\%-1rem\\)\\]{min-width:calc(100% - 1rem)}.inploi-job-search .max-w-\\[45rem\\]{max-width:45rem}.inploi-job-search .max-w-full{max-width:100%}.inploi-job-search .max-w-xs{max-width:20rem}.inploi-job-search .flex-1{flex:1 1 0%}.inploi-job-search .flex-none{flex:none}.inploi-job-search .flex-shrink{flex-shrink:1}.inploi-job-search .flex-shrink-0{flex-shrink:0}.inploi-job-search .shrink{flex-shrink:1}.inploi-job-search .flex-grow,.inploi-job-search .grow{flex-grow:1}.inploi-job-search .border-collapse{border-collapse:collapse}.inploi-job-search .origin-\\[50\\%_1\\.75rem\\]{transform-origin:50% 1.75rem}.inploi-job-search .origin-top{transform-origin:top}.inploi-job-search .-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.inploi-job-search .rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.inploi-job-search .scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.inploi-job-search .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes appear-tag{0%{transform:scale(.9)}to{transform:scale(1)}}.inploi-job-search .animate-appear-tag{animation:appear-tag .6s cubic-bezier(.16,1,.3,1) both}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.inploi-job-search .animate-fade-in{animation:fade-in .4s cubic-bezier(.16,1,.3,1) both}.inploi-job-search .animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes selected-tag{0%{transform:scale(1.11)}to{transform:scale(1)}}.inploi-job-search .animate-selected-tag{animation:selected-tag .9s cubic-bezier(.16,1,.3,1)}@keyframes skeleton{0%{opacity:.2}50%{opacity:.6}to{opacity:.25}}.inploi-job-search .animate-skeleton{animation:skeleton 1.2s cubic-bezier(.4,0,.6,1) infinite}@keyframes slide-out-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}.inploi-job-search .animate-slide-out-bottom{animation:slide-out-bottom .4s cubic-bezier(.16,1,.3,1) both}@keyframes slideDownFade{0%{opacity:0;transform:scale(.95) translateY(-16px)}to{opacity:1;transform:scale(1) translateY(0)}}.inploi-job-search .animate-slideDownFade{animation:slideDownFade .2s cubic-bezier(.34,1.56,.64,1)}.inploi-job-search .cursor-default{cursor:default}.inploi-job-search .cursor-pointer{cursor:pointer}.inploi-job-search .cursor-text{cursor:text}.inploi-job-search .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.inploi-job-search .resize{resize:both}.inploi-job-search .snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.inploi-job-search .snap-proximity{--tw-scroll-snap-strictness: proximity}.inploi-job-search .snap-start{scroll-snap-align:start}.inploi-job-search .scroll-px-4{scroll-padding-left:1rem;scroll-padding-right:1rem}.inploi-job-search .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.inploi-job-search .flex-col{flex-direction:column}.inploi-job-search .flex-wrap{flex-wrap:wrap}.inploi-job-search .items-start{align-items:flex-start}.inploi-job-search .items-center{align-items:center}.inploi-job-search .items-stretch{align-items:stretch}.inploi-job-search .justify-end{justify-content:flex-end}.inploi-job-search .justify-center{justify-content:center}.inploi-job-search .justify-between{justify-content:space-between}.inploi-job-search .gap-1{gap:.25rem}.inploi-job-search .gap-1\\.5{gap:.375rem}.inploi-job-search .gap-2{gap:.5rem}.inploi-job-search .gap-3{gap:.75rem}.inploi-job-search .gap-4{gap:1rem}.inploi-job-search .gap-logo{gap:var(--i-logo-gap)}.inploi-job-search .self-center{align-self:center}.inploi-job-search .overflow-auto{overflow:auto}.inploi-job-search .overflow-hidden{overflow:hidden}.inploi-job-search .overflow-y-auto{overflow-y:auto}.inploi-job-search .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.inploi-job-search .whitespace-nowrap{white-space:nowrap}.inploi-job-search .text-balance{text-wrap:balance}.inploi-job-search .text-pretty{text-wrap:pretty}.inploi-job-search .break-words{overflow-wrap:break-word}.inploi-job-search .rounded-\\[999px\\]{border-radius:999px}.inploi-job-search .rounded-input{border-radius:var(--i-radius-input)}.inploi-job-search .rounded-interactive{border-radius:var(--i-radius-interactive)}.inploi-job-search .rounded-job-card{border-radius:var(--i-radius-job-card)}.inploi-job-search .rounded-job-tag{border-radius:var(--i-radius-job-tag)}.inploi-job-search .rounded-logo{border-radius:var(--i-radius-logo)}.inploi-job-search .rounded-section{border-radius:var(--i-radius-section)}.inploi-job-search .rounded-tag{border-radius:var(--i-radius-job-tag)}.inploi-job-search .rounded-t-section{border-top-left-radius:var(--i-radius-section);border-top-right-radius:var(--i-radius-section)}.inploi-job-search .border-px{border-width:1px}.inploi-job-search .border-b-px{border-bottom-width:1px}.inploi-job-search .border-solid{border-style:solid}.inploi-job-search .border-neutral-2{border-color:var(--i-color-n-2)}.inploi-job-search .border-neutral-4{border-color:var(--i-color-n-4)}.inploi-job-search .border-section-weak-stroke{border-color:var(--i-section-weak-stroke-color)}.inploi-job-search .border-tag-accent-strong-stroke{border-color:var(--i-tag-accent-strong-stroke-color)}.inploi-job-search .border-tag-monetary-weak-stroke{border-color:var(--i-tag-monetary-weak-stroke-color)}.inploi-job-search .border-tag-neutral-strong-stroke{border-color:var(--i-tag-neutral-strong-stroke-color)}.inploi-job-search .border-tag-neutral-weak-stroke{border-color:var(--i-tag-neutral-weak-stroke-color)}.inploi-job-search .bg-\\[\\#0009\\]{background-color:#0009}.inploi-job-search .bg-\\[currentColor\\]{background-color:currentColor}.inploi-job-search .bg-accent-2{background-color:var(--i-color-a-2)}.inploi-job-search .bg-accent-4{background-color:var(--i-color-a-4)}.inploi-job-search .bg-app{background-color:var(--i-app-bg)}.inploi-job-search .bg-copy-neutral{background-color:var(--i-copy)}.inploi-job-search .bg-interactive-accent-bg{background-color:var(--i-interactive-accent-bg)}.inploi-job-search .bg-interactive-neutral-bg{background-color:var(--i-interactive-neutral-bg)}.inploi-job-search .bg-job-card-bg{background-color:var(--i-job-card-bg)}.inploi-job-search .bg-lowest{background-color:var(--i-color-lowest)}.inploi-job-search .bg-neutral-12{background-color:var(--i-color-n-12)}.inploi-job-search .bg-neutral-2{background-color:var(--i-color-n-2)}.inploi-job-search .bg-neutral-3{background-color:var(--i-color-n-3)}.inploi-job-search .bg-neutral-6{background-color:var(--i-color-n-6)}.inploi-job-search .bg-section-strong-bg{background-color:var(--i-section-strong-bg)}.inploi-job-search .bg-tag-accent-strong-bg{background-color:var(--i-tag-accent-strong-bg)}.inploi-job-search .bg-tag-monetary-weak-bg{background-color:var(--i-tag-monetary-weak-bg)}.inploi-job-search .bg-tag-neutral-strong-bg{background-color:var(--i-tag-neutral-strong-bg)}.inploi-job-search .bg-tag-neutral-weak-bg{background-color:var(--i-tag-neutral-weak-bg)}.inploi-job-search .bg-transparent{background-color:transparent}.inploi-job-search .object-contain{-o-object-fit:contain;object-fit:contain}.inploi-job-search .p-0{padding:0}.inploi-job-search .p-1{padding:.25rem}.inploi-job-search .p-10{padding:2.5rem}.inploi-job-search .p-11{padding:2.75rem}.inploi-job-search .p-12{padding:3rem}.inploi-job-search .p-2{padding:.5rem}.inploi-job-search .p-3{padding:.75rem}.inploi-job-search .p-4{padding:1rem}.inploi-job-search .p-5{padding:1.25rem}.inploi-job-search .p-6{padding:1.5rem}.inploi-job-search .p-7{padding:1.75rem}.inploi-job-search .p-8{padding:2rem}.inploi-job-search .p-9{padding:2.25rem}.inploi-job-search .px-1{padding-left:.25rem;padding-right:.25rem}.inploi-job-search .px-10{padding-left:2.5rem;padding-right:2.5rem}.inploi-job-search .px-2{padding-left:.5rem;padding-right:.5rem}.inploi-job-search .px-2\\.5{padding-left:.625rem;padding-right:.625rem}.inploi-job-search .px-3{padding-left:.75rem;padding-right:.75rem}.inploi-job-search .px-4{padding-left:1rem;padding-right:1rem}.inploi-job-search .px-5{padding-left:1.25rem;padding-right:1.25rem}.inploi-job-search .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.inploi-job-search .py-1{padding-top:.25rem;padding-bottom:.25rem}.inploi-job-search .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.inploi-job-search .py-2{padding-top:.5rem;padding-bottom:.5rem}.inploi-job-search .py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.inploi-job-search .py-4{padding-top:1rem;padding-bottom:1rem}.inploi-job-search .pb-1{padding-bottom:.25rem}.inploi-job-search .pb-\\[env\\(safe-area-inset-bottom\\)\\]{padding-bottom:env(safe-area-inset-bottom)}.inploi-job-search .pl-1{padding-left:.25rem}.inploi-job-search .pl-10{padding-left:2.5rem}.inploi-job-search .pl-2{padding-left:.5rem}.inploi-job-search .pl-3{padding-left:.75rem}.inploi-job-search .pl-3\\.5{padding-left:.875rem}.inploi-job-search .pl-5{padding-left:1.25rem}.inploi-job-search .pr-1{padding-right:.25rem}.inploi-job-search .pr-10{padding-right:2.5rem}.inploi-job-search .pr-2{padding-right:.5rem}.inploi-job-search .pr-2\\.5{padding-right:.625rem}.inploi-job-search .pr-3{padding-right:.75rem}.inploi-job-search .pr-4{padding-right:1rem}.inploi-job-search .pt-4{padding-top:1rem}.inploi-job-search .text-center{text-align:center}.inploi-job-search .text-justify{text-align:justify}.inploi-job-search .align-middle{vertical-align:middle}.inploi-job-search .font-family-default{font-family:var(--i-font)}.inploi-job-search .font-family-filter{font-family:var(--i-font-filter)}.inploi-job-search .font-family-job-heading{font-family:var(--i-font-job-heading)}.inploi-job-search .font-family-tag{font-family:var(--i-font-tag)}.inploi-job-search .text-\\[10px\\]{font-size:10px}.inploi-job-search .text-style-filter{font-size:1rem;line-height:1.5rem;letter-spacing:-.01em}.inploi-job-search .text-style-input{font-size:1rem;line-height:1.5rem}.inploi-job-search .text-style-job-card{font-size:.875rem;line-height:1.125rem}.inploi-job-search .text-style-job-card-info{font-size:.75rem;line-height:1.125rem}.inploi-job-search .text-style-job-heading{font-size:1.125rem;line-height:1.5rem}.inploi-job-search .text-style-tag{font-size:.875rem;line-height:1.1rem}.inploi-job-search .font-\\[500\\]{font-weight:500}.inploi-job-search .font-weight-default{font-weight:var(--i-weight-default)}.inploi-job-search .font-weight-filter{font-weight:var(--i-weight-filter)}.inploi-job-search .font-weight-input{font-weight:var(--i-weight-input)}.inploi-job-search .font-weight-job-heading{font-weight:var(--i-weight-job-heading)}.inploi-job-search .font-weight-tag{font-weight:var(--i-weight-tag)}.inploi-job-search .uppercase{text-transform:uppercase}.inploi-job-search .lowercase{text-transform:lowercase}.inploi-job-search .capitalize{text-transform:capitalize}.inploi-job-search .italic{font-style:italic}.inploi-job-search .ordinal{--tw-ordinal: ordinal;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.inploi-job-search .tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.inploi-job-search .leading-none{line-height:1}.inploi-job-search .leading-snug{line-height:1.375}.inploi-job-search .tracking-tight{letter-spacing:-.025em}.inploi-job-search .\\!text-transparent{color:transparent!important}.inploi-job-search .text-accent-11{color:var(--i-color-a-11)}.inploi-job-search .text-copy-accent-icon{color:var(--i-copy-accent-icon)}.inploi-job-search .text-copy-job-info{color:var(--i-copy-info)}.inploi-job-search .text-copy-neutral{color:var(--i-copy)}.inploi-job-search .text-copy-neutral-icon{color:var(--i-copy-icon)}.inploi-job-search .text-copy-neutral-lowcontrast{color:var(--i-copy-lowcontrast)}.inploi-job-search .text-interactive-accent-text{color:var(--i-interactive-accent-text)}.inploi-job-search .text-interactive-neutral-bg{color:var(--i-interactive-neutral-bg)}.inploi-job-search .text-interactive-neutral-text{color:var(--i-interactive-neutral-text)}.inploi-job-search .text-neutral-1{color:var(--i-color-n-1)}.inploi-job-search .text-neutral-10{color:var(--i-color-n-10)}.inploi-job-search .text-neutral-11{color:var(--i-color-n-11)}.inploi-job-search .text-neutral-12{color:var(--i-color-n-12)}.inploi-job-search .text-neutral-6{color:var(--i-color-n-6)}.inploi-job-search .text-neutral-8{color:var(--i-color-n-8)}.inploi-job-search .text-tag-accent-strong-bg{color:var(--i-tag-accent-strong-bg)}.inploi-job-search .text-tag-accent-strong-copy{color:var(--i-tag-accent-strong-copy)}.inploi-job-search .text-tag-monetary-weak-copy{color:var(--i-tag-monetary-weak-copy)}.inploi-job-search .text-tag-neutral-strong-copy{color:var(--i-tag-neutral-strong-copy)}.inploi-job-search .text-tag-neutral-weak-copy{color:var(--i-tag-neutral-weak-copy)}.inploi-job-search .underline{text-decoration-line:underline}.inploi-job-search .caret-accent-11{caret-color:var(--i-color-a-11)}.inploi-job-search .opacity-10{opacity:.1}.inploi-job-search .opacity-25{opacity:.25}.inploi-job-search .opacity-30{opacity:.3}.inploi-job-search .opacity-50{opacity:.5}.inploi-job-search .opacity-80{opacity:.8}.inploi-job-search .shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.inploi-job-search .shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.inploi-job-search .shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.inploi-job-search .outline-none{outline:2px solid transparent;outline-offset:2px}.inploi-job-search .outline{outline-style:solid}.inploi-job-search .ring-\\[3px\\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .ring-px{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .ring-width-job-card{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(var(--i-job-card-stroke-width) + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .ring-width-section{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(var(--i-section-stroke-width) + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .ring-job-card-stroke{--tw-ring-color: var(--i-job-card-stroke-color)}.inploi-job-search .ring-neutral-3{--tw-ring-color: var(--i-color-n-3)}.inploi-job-search .ring-neutral-4{--tw-ring-color: var(--i-color-n-4)}.inploi-job-search .ring-section-weak-stroke{--tw-ring-color: var(--i-section-weak-stroke-color)}.inploi-job-search .ring-tag-accent-strong-bg{--tw-ring-color: var(--i-tag-accent-strong-bg)}.inploi-job-search .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.inploi-job-search .grayscale{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.inploi-job-search .invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.inploi-job-search .sepia{--tw-sepia: sepia(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.inploi-job-search .\\!filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)!important}.inploi-job-search .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.inploi-job-search .backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.inploi-job-search .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.inploi-job-search .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.inploi-job-search .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.inploi-job-search .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.inploi-job-search .duration-500{transition-duration:.5s}.inploi-job-search .duration-medium{transition-duration:.6s}.inploi-job-search .duration-slow{transition-duration:.9s}.inploi-job-search .duration-snappy{transition-duration:.4s}.inploi-job-search .ease-expo-out{transition-timing-function:cubic-bezier(.16,1,.3,1)}.inploi-job-search .ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.inploi-job-search .gutter-stable{scrollbar-gutter:stable}.inploi-job-search .font-style-default{font-style:var(--i-font-style)}.inploi-job-search .font-style-filter{font-style:var(--i-style-filter)}.inploi-job-search .font-style-input{font-style:var(--i-style-input)}.inploi-job-search .font-style-job-heading{font-style:var(--i-style-job-heading)}.inploi-job-search .font-style-tag{font-style:var(--i-style-tag)}.inploi-job-search .fr{outline:none}.inploi-job-search .fr:focus{outline:none}.inploi-job-search .fr:focus-visible{outline:none;--tw-ring-offset-width: 1px;--tw-ring-offset-color: var(--i-color-lowest);--tw-ring-opacity: 1;--tw-ring-color: var(--i-color-a-9);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .touch-hitbox:before{content:"";position:absolute;display:block;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;min-height:44px;min-width:44px;z-index:9999}.inploi-job-search .\\[-webkit-user-drag\\:none\\]{-webkit-user-drag:none}.inploi-job-search .\\[a-zA-Z0-9-_\\:\\.\\$\\@\\?\\]{a-z-a--z0-9-_:.$@?}.inploi-job-search .\\[text-wrap\\:balance\\]{text-wrap:balance}.inploi-job-search .\\[text-wrap\\:pretty\\]{text-wrap:pretty}.inploi-job-search .selection\\:bg-accent-4 *::-moz-selection{background-color:var(--i-color-a-4)}.inploi-job-search .selection\\:bg-accent-4 *::selection{background-color:var(--i-color-a-4)}.inploi-job-search .selection\\:text-accent-12 *::-moz-selection{color:var(--i-color-a-12)}.inploi-job-search .selection\\:text-accent-12 *::selection{color:var(--i-color-a-12)}.inploi-job-search .selection\\:bg-accent-4::-moz-selection{background-color:var(--i-color-a-4)}.inploi-job-search .selection\\:bg-accent-4::selection{background-color:var(--i-color-a-4)}.inploi-job-search .selection\\:text-accent-12::-moz-selection{color:var(--i-color-a-12)}.inploi-job-search .selection\\:text-accent-12::selection{color:var(--i-color-a-12)}.inploi-job-search .placeholder\\:\\!text-transparent::-moz-placeholder{color:transparent!important}.inploi-job-search .placeholder\\:\\!text-transparent::placeholder{color:transparent!important}.inploi-job-search .placeholder\\:text-copy-neutral::-moz-placeholder{color:var(--i-copy)}.inploi-job-search .placeholder\\:text-copy-neutral::placeholder{color:var(--i-copy)}.inploi-job-search .placeholder\\:opacity-30::-moz-placeholder{opacity:.3}.inploi-job-search .placeholder\\:opacity-30::placeholder{opacity:.3}.inploi-job-search .hover\\:bg-job-card-bg-active:hover{background-color:var(--i-job-card-bg-active)}.inploi-job-search .hover\\:bg-neutral-2:hover{background-color:var(--i-color-n-2)}.inploi-job-search .hover\\:text-copy-neutral:hover{color:var(--i-copy)}.inploi-job-search .hover\\:text-neutral-12:hover{color:var(--i-color-n-12)}.inploi-job-search .hover\\:ring-job-card-stroke-active:hover{--tw-ring-color: var(--i-job-card-stroke-color-active)}.inploi-job-search .focus\\:relative:focus{position:relative}.inploi-job-search .focus\\:ring-px:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .focus\\:ring-neutral-6:focus{--tw-ring-color: var(--i-color-n-6)}.inploi-job-search .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.inploi-job-search .active\\:scale-\\[0\\.975\\]:active{--tw-scale-x: .975;--tw-scale-y: .975;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.inploi-job-search .active\\:bg-job-card-bg-active:active{background-color:var(--i-job-card-bg-active)}.inploi-job-search .active\\:ring-job-card-stroke-active:active{--tw-ring-color: var(--i-job-card-stroke-color-active)}.inploi-job-search .disabled\\:bg-interactive-neutral-bg:disabled{background-color:var(--i-interactive-neutral-bg)}.inploi-job-search .disabled\\:text-interactive-neutral-bg-hover:disabled{color:var(--i-interactive-neutral-bg-hover)}.inploi-job-search .disabled\\:opacity-50:disabled{opacity:.5}.inploi-job-search .disabled\\:hover\\:disabled\\:bg-interactive-neutral-bg:disabled:hover:disabled{background-color:var(--i-interactive-neutral-bg)}.inploi-job-search .peer:-moz-placeholder-shown~.peer-placeholder-shown\\:right-0{right:0}.inploi-job-search .peer:placeholder-shown~.peer-placeholder-shown\\:right-0{right:0}.inploi-job-search .peer:-moz-placeholder-shown~.peer-placeholder-shown\\:hidden{display:none}.inploi-job-search .peer:placeholder-shown~.peer-placeholder-shown\\:hidden{display:none}.inploi-job-search .has-\\[\\[data-current-value\\=true\\]\\]\\:border-b-accent-3:has([data-current-value=true]){border-bottom-color:var(--i-color-a-3)}@keyframes slideUpFade{0%{opacity:0;transform:scale(.95) translateY(16px)}to{opacity:1;transform:scale(1) translateY(0)}}.inploi-job-search .data-\\[side\\=top\\]\\:animate-slideUpFade[data-side=top]{animation:slideUpFade .2s cubic-bezier(.34,1.56,.64,1)}@keyframes pulse{50%{opacity:.5}}.inploi-job-search .data-\\[state\\=loading\\]\\:animate-pulse[data-state=loading]{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.inploi-job-search .group[data-state=open] .group-data-\\[state\\=open\\]\\:-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes ai-letter{0%{color:var(--i-copy);transform:scale(1)}50%{transform:scale(1.125)}75%{color:var(--i-interactive-accent-text);transform:scale(1.0625)}to{color:var(--i-interactive-accent-text);transform:scale(1)}}.inploi-job-search .group[data-synced=true] .group-data-\\[synced\\=true\\]\\:animate-ai-letter{animation:ai-letter .6s cubic-bezier(.68,-.6,.32,1.6) both}@media (pointer: fine){.inploi-job-search .pointer-fine\\:hover\\:bg-interactive-accent-bg-hover:hover{background-color:var(--i-interactive-accent-bg-hover)}}@media (pointer: fine){.inploi-job-search .pointer-fine\\:hover\\:bg-interactive-neutral-bg-hover:hover{background-color:var(--i-interactive-neutral-bg-hover)}}@media (pointer: fine){.inploi-job-search .group\\/filter:first-child .group\\/tag:first-child .pointer-fine\\:group-\\[\\&\\:first-child\\]\\/filter\\:group-\\[\\&\\:first-child\\]\\/tag\\:rounded-t-tag{border-top-left-radius:var(--i-radius-job-tag);border-top-right-radius:var(--i-radius-job-tag)}}.inploi-job-search .dark .theme-dark\\:text-neutral-12{color:var(--i-color-n-12)}.inploi-job-search .light .theme-light\\:text-neutral-11{color:var(--i-color-n-11)}.inploi-job-search .rounded .theme-rounded\\:rounded-md{border-radius:.75rem}.inploi-job-search .rounded .theme-rounded\\:rounded-xl{border-radius:1.5rem}@media (pointer: fine){.inploi-job-search .rounded .pointer-fine\\:theme-rounded\\:rounded-t-lg{border-top-left-radius:1rem;border-top-right-radius:1rem}}.inploi-job-search .soft .theme-soft\\:rounded-lg{border-radius:1rem}.inploi-job-search .soft .theme-soft\\:rounded-sm{border-radius:.5rem}@media (pointer: fine){.inploi-job-search .soft .pointer-fine\\:theme-soft\\:rounded-t-lg{border-top-left-radius:1rem;border-top-right-radius:1rem}}.inploi-job-search .fill .theme-fill\\:bg-neutral-1{background-color:var(--i-color-n-1)}.inploi-job-search .fill .theme-fill\\:bg-neutral-2{background-color:var(--i-color-n-2)}.inploi-job-search .fill .theme-fill\\:ring-neutral-3{--tw-ring-color: var(--i-color-n-3)}.inploi-job-search .fill .theme-fill\\:fr{outline:none}.inploi-job-search .fill .theme-fill\\:fr:focus{outline:none}.inploi-job-search .fill .theme-fill\\:fr:focus-visible{outline:none;--tw-ring-offset-width: 1px;--tw-ring-offset-color: var(--i-color-lowest);--tw-ring-opacity: 1;--tw-ring-color: var(--i-color-a-9);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .fill .theme-fill\\:hover\\:bg-neutral-3:hover{background-color:var(--i-color-n-3)}.inploi-job-search .fill .theme-fill\\:focus\\:bg-neutral-1:focus{background-color:var(--i-color-n-1)}.inploi-job-search .stroke .theme-stroke\\:bg-lowest{background-color:var(--i-color-lowest)}.inploi-job-search .stroke .theme-stroke\\:bg-neutral-1{background-color:var(--i-color-n-1)}.inploi-job-search .stroke .theme-stroke\\:ring-px{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .stroke .theme-stroke\\:ring-neutral-3{--tw-ring-color: var(--i-color-n-3)}.inploi-job-search .stroke .theme-stroke\\:ring-neutral-4{--tw-ring-color: var(--i-color-n-4)}.inploi-job-search .stroke .theme-stroke\\:fr{outline:none}.inploi-job-search .stroke .theme-stroke\\:fr:focus{outline:none}.inploi-job-search .stroke .theme-stroke\\:fr:focus-visible{outline:none;--tw-ring-offset-width: 1px;--tw-ring-offset-color: var(--i-color-lowest);--tw-ring-opacity: 1;--tw-ring-color: var(--i-color-a-9);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .stroke .theme-stroke\\:hover\\:ring-neutral-6:hover{--tw-ring-color: var(--i-color-n-6)}.inploi-job-search .stroke .theme-stroke\\:hover\\:fr:hover{outline:none}.inploi-job-search .stroke .theme-stroke\\:hover\\:fr:hover:focus{outline:none}.inploi-job-search .stroke .theme-stroke\\:hover\\:fr:hover:focus-visible{outline:none;--tw-ring-offset-width: 1px;--tw-ring-offset-color: var(--i-color-lowest);--tw-ring-opacity: 1;--tw-ring-color: var(--i-color-a-9);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .stroke .theme-stroke\\:focus\\:bg-lowest:focus{background-color:var(--i-color-lowest)}@media (min-width: 768px){.inploi-job-search .md\\:order-1{order:1}}@media (min-width: 768px){.inploi-job-search .md\\:order-2{order:2}}@media (min-width: 768px){.inploi-job-search .md\\:aspect-auto{aspect-ratio:auto}}@media (min-width: 768px){.inploi-job-search .md\\:h-\\[70svh\\]{height:70svh}}@media (min-width: 768px){.inploi-job-search .md\\:min-w-80{min-width:20rem}}@media (min-width: 768px){.inploi-job-search .md\\:max-w-xl{max-width:36rem}}@media (min-width: 768px){.inploi-job-search .md\\:flex-row{flex-direction:row}}@media (min-width: 768px){.inploi-job-search .md\\:flex-col{flex-direction:column}}@media (min-width: 768px){.inploi-job-search .md\\:flex-wrap{flex-wrap:wrap}}@media (min-width: 768px){.inploi-job-search .md\\:items-center{align-items:center}}@media (min-width: 1024px){.inploi-job-search .lg\\:ring-width-section{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(var(--i-section-stroke-width) + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}}.inploi-job-search .\\[\\&\\:not\\(\\:last-child\\)\\]\\:border-b-px:not(:last-child){border-bottom-width:1px}.inploi-job-search .bg-wavy{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="8" fill="none" viewBox="0 -2 32 10"><path stroke="%23000" stroke-width="2" d="M0 4c8 0 8-4 16-4s8 4 16 4"/></svg>');background-size:16px 6px;background-repeat:repeat-x;background-position:center}.inploi-job-search .dark .bg-wavy{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="8" fill="none" viewBox="0 -2 32 10"><path stroke="%23fff" stroke-width="2" d="M0 4c8 0 8-4 16-4s8 4 16 4"/></svg>')}
|
|
60
|
+
`)},UI=0,yu=[];function $I(p){var x=Oi([]),T=Oi([0,0]),C=Oi(),L=Ni(UI++)[0],k=Ni(function(){return E1()})[0],j=Oi(p);Ji(function(){j.current=p},[p]),Ji(function(){if(p.inert){document.body.classList.add("block-interactivity-".concat(L));var _e=uI([p.lockRef.current],(p.shards||[]).map(R1),!0).filter(Boolean);return _e.forEach(function(ze){return ze.classList.add("allow-interactivity-".concat(L))}),function(){document.body.classList.remove("block-interactivity-".concat(L)),_e.forEach(function(ze){return ze.classList.remove("allow-interactivity-".concat(L))})}}},[p.inert,p.lockRef.current,p.shards]);var o=Ur(function(_e,ze){if("touches"in _e&&_e.touches.length===2)return!j.current.allowPinchZoom;var Se=Rf(_e),st=T.current,nt="deltaX"in _e?_e.deltaX:st[0]-Se[0],Xe="deltaY"in _e?_e.deltaY:st[1]-Se[1],ct,xt=_e.target,$t=Math.abs(nt)>Math.abs(Xe)?"h":"v";if("touches"in _e&&$t==="h"&&xt.type==="range")return!1;var kt=C1($t,xt);if(!kt)return!0;if(kt?ct=$t:(ct=$t==="v"?"h":"v",kt=C1($t,xt)),!kt)return!1;if(!C.current&&"changedTouches"in _e&&(nt||Xe)&&(C.current=ct),!ct)return!0;var Wt=C.current||ct;return NI(Wt,ze,_e,Wt==="h"?nt:Xe,!0)},[]),re=Ur(function(_e){var ze=_e;if(!(!yu.length||yu[yu.length-1]!==k)){var Se="deltaY"in ze?D1(ze):Rf(ze),st=x.current.filter(function(ct){return ct.name===ze.type&&ct.target===ze.target&&jI(ct.delta,Se)})[0];if(st&&st.should){ze.cancelable&&ze.preventDefault();return}if(!st){var nt=(j.current.shards||[]).map(R1).filter(Boolean).filter(function(ct){return ct.contains(ze.target)}),Xe=nt.length>0?o(ze,nt[0]):!j.current.noIsolation;Xe&&ze.cancelable&&ze.preventDefault()}}},[]),fe=Ur(function(_e,ze,Se,st){var nt={name:_e,delta:ze,target:Se,should:st};x.current.push(nt),setTimeout(function(){x.current=x.current.filter(function(Xe){return Xe!==nt})},1)},[]),xe=Ur(function(_e){T.current=Rf(_e),C.current=void 0},[]),oe=Ur(function(_e){fe(_e.type,D1(_e),_e.target,o(_e,p.lockRef.current))},[]),Ee=Ur(function(_e){fe(_e.type,Rf(_e),_e.target,o(_e,p.lockRef.current))},[]);Ji(function(){return yu.push(k),p.setCallbacks({onScrollCapture:oe,onWheelCapture:oe,onTouchMoveCapture:Ee}),document.addEventListener("wheel",re,gu),document.addEventListener("touchmove",re,gu),document.addEventListener("touchstart",xe,gu),function(){yu=yu.filter(function(_e){return _e!==k}),document.removeEventListener("wheel",re,gu),document.removeEventListener("touchmove",re,gu),document.removeEventListener("touchstart",xe,gu)}},[]);var be=p.removeScrollBar,Pe=p.inert;return Kt(rr,null,Pe?Kt(k,{styles:VI(L)}):null,be?Kt(RI,{gapMode:"margin"}):null)}const GI=vI(T1,$I);var z1=on(function(p,x){return Kt(Pf,ks({},p,{ref:x,sideCar:GI}))});z1.classNames=Pf.classNames;const L1=z1;var HI=function(p){if(typeof document>"u")return null;var x=Array.isArray(p)?p[0]:p;return x.ownerDocument.body},vu=new WeakMap,zf=new WeakMap,Lf={},ey=0,k1=function(p){return p&&(p.host||k1(p.parentNode))},qI=function(p,x){return x.map(function(T){if(p.contains(T))return T;var C=k1(T);return C&&p.contains(C)?C:(console.error("aria-hidden",T,"in not contained inside",p,". Doing nothing"),null)}).filter(function(T){return!!T})},ZI=function(p,x,T,C){var L=qI(x,Array.isArray(p)?p:[p]);Lf[T]||(Lf[T]=new WeakMap);var k=Lf[T],j=[],o=new Set,re=new Set(L),fe=function(oe){!oe||o.has(oe)||(o.add(oe),fe(oe.parentNode))};L.forEach(fe);var xe=function(oe){!oe||re.has(oe)||Array.prototype.forEach.call(oe.children,function(Ee){if(o.has(Ee))xe(Ee);else try{var be=Ee.getAttribute(C),Pe=be!==null&&be!=="false",_e=(vu.get(Ee)||0)+1,ze=(k.get(Ee)||0)+1;vu.set(Ee,_e),k.set(Ee,ze),j.push(Ee),_e===1&&Pe&&zf.set(Ee,!0),ze===1&&Ee.setAttribute(T,"true"),Pe||Ee.setAttribute(C,"true")}catch(Se){console.error("aria-hidden: cannot operate on ",Ee,Se)}})};return xe(x),o.clear(),ey++,function(){j.forEach(function(oe){var Ee=vu.get(oe)-1,be=k.get(oe)-1;vu.set(oe,Ee),k.set(oe,be),Ee||(zf.has(oe)||oe.removeAttribute(C),zf.delete(oe)),be||oe.removeAttribute(T)}),ey--,ey||(vu=new WeakMap,vu=new WeakMap,zf=new WeakMap,Lf={})}},O1=function(p,x,T){T===void 0&&(T="data-aria-hidden");var C=Array.from(Array.isArray(p)?p:[p]),L=x||HI(p);return L?(C.push.apply(C,Array.from(L.querySelectorAll("[aria-live], script"))),ZI(C,L,T,"aria-hidden")):function(){return null}};const F1="Dialog",[B1,XO]=Gg(F1),[WI,tl]=B1(F1),XI=p=>{const{__scopeDialog:x,children:T,open:C,defaultOpen:L,onOpenChange:k,modal:j=!0}=p,o=Oi(null),re=Oi(null),[fe=!1,xe]=s1({prop:C,defaultProp:L,onChange:k});return Kt(WI,{scope:x,triggerRef:o,contentRef:re,contentId:Ef(),titleId:Ef(),descriptionId:Ef(),open:fe,onOpenChange:xe,onOpenToggle:Ur(()=>xe(oe=>!oe),[xe]),modal:j},T)},YI="DialogTrigger",KI=on((p,x)=>{const{__scopeDialog:T,...C}=p,L=tl(YI,T),k=Ls(x,L.triggerRef);return Kt(Qa.button,sn({type:"button","aria-haspopup":"dialog","aria-expanded":L.open,"aria-controls":L.contentId,"data-state":iy(L.open)},C,{ref:k,onClick:ss(p.onClick,L.onOpenToggle)}))}),N1="DialogPortal",[JI,j1]=B1(N1,{forceMount:void 0}),QI=p=>{const{__scopeDialog:x,forceMount:T,children:C,container:L}=p,k=tl(N1,x);return Kt(JI,{scope:x,forceMount:T},Rs.map(C,j=>Kt(mu,{present:T||k.open},Kt(g1,{asChild:!0,container:L},j))))},ty="DialogOverlay",eC=on((p,x)=>{const T=j1(ty,p.__scopeDialog),{forceMount:C=T.forceMount,...L}=p,k=tl(ty,p.__scopeDialog);return k.modal?Kt(mu,{present:C||k.open},Kt(tC,sn({},L,{ref:x}))):null}),tC=on((p,x)=>{const{__scopeDialog:T,...C}=p,L=tl(ty,T);return Kt(L1,{as:Af,allowPinchZoom:!0,shards:[L.contentRef]},Kt(Qa.div,sn({"data-state":iy(L.open)},C,{ref:x,style:{pointerEvents:"auto",...C.style}})))}),ld="DialogContent",iC=on((p,x)=>{const T=j1(ld,p.__scopeDialog),{forceMount:C=T.forceMount,...L}=p,k=tl(ld,p.__scopeDialog);return Kt(mu,{present:C||k.open},k.modal?Kt(rC,sn({},L,{ref:x})):Kt(nC,sn({},L,{ref:x})))}),rC=on((p,x)=>{const T=tl(ld,p.__scopeDialog),C=Oi(null),L=Ls(x,T.contentRef,C);return Ji(()=>{const k=C.current;if(k)return O1(k)},[]),Kt(V1,sn({},p,{ref:L,trapFocus:T.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ss(p.onCloseAutoFocus,k=>{var j;k.preventDefault(),(j=T.triggerRef.current)===null||j===void 0||j.focus()}),onPointerDownOutside:ss(p.onPointerDownOutside,k=>{const j=k.detail.originalEvent,o=j.button===0&&j.ctrlKey===!0;(j.button===2||o)&&k.preventDefault()}),onFocusOutside:ss(p.onFocusOutside,k=>k.preventDefault())}))}),nC=on((p,x)=>{const T=tl(ld,p.__scopeDialog),C=Oi(!1),L=Oi(!1);return Kt(V1,sn({},p,{ref:x,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:k=>{var j;if((j=p.onCloseAutoFocus)===null||j===void 0||j.call(p,k),!k.defaultPrevented){var o;C.current||(o=T.triggerRef.current)===null||o===void 0||o.focus(),k.preventDefault()}C.current=!1,L.current=!1},onInteractOutside:k=>{var j,o;(j=p.onInteractOutside)===null||j===void 0||j.call(p,k),k.defaultPrevented||(C.current=!0,k.detail.originalEvent.type==="pointerdown"&&(L.current=!0));const re=k.target;((o=T.triggerRef.current)===null||o===void 0?void 0:o.contains(re))&&k.preventDefault(),k.detail.originalEvent.type==="focusin"&&L.current&&k.preventDefault()}}))}),V1=on((p,x)=>{const{__scopeDialog:T,trapFocus:C,onOpenAutoFocus:L,onCloseAutoFocus:k,...j}=p,o=tl(ld,T),re=Oi(null),fe=Ls(x,re);return y1(),Kt(rr,null,Kt(d1,{asChild:!0,loop:!0,trapped:C,onMountAutoFocus:L,onUnmountAutoFocus:k},Kt(l1,sn({role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":iy(o.open)},j,{ref:fe,onDismiss:()=>o.onOpenChange(!1)}))),!1)});function iy(p){return p?"open":"closed"}const oC=XI,sC=KI,aC=QI,lC=eC,cC=iC,uC=["top","right","bottom","left"],Os=Math.min,Eo=Math.max,kf=Math.round,Of=Math.floor,il=p=>({x:p,y:p}),hC={left:"right",right:"left",bottom:"top",top:"bottom"},dC={start:"end",end:"start"};function ry(p,x,T){return Eo(p,Os(x,T))}function fa(p,x){return typeof p=="function"?p(x):p}function ma(p){return p.split("-")[0]}function xu(p){return p.split("-")[1]}function ny(p){return p==="x"?"y":"x"}function oy(p){return p==="y"?"height":"width"}function rl(p){return["top","bottom"].includes(ma(p))?"y":"x"}function sy(p){return ny(rl(p))}function pC(p,x,T){T===void 0&&(T=!1);const C=xu(p),L=sy(p),k=oy(L);let j=L==="x"?C===(T?"end":"start")?"right":"left":C==="start"?"bottom":"top";return x.reference[k]>x.floating[k]&&(j=Ff(j)),[j,Ff(j)]}function fC(p){const x=Ff(p);return[ay(p),x,ay(x)]}function ay(p){return p.replace(/start|end/g,x=>dC[x])}function mC(p,x,T){const C=["left","right"],L=["right","left"],k=["top","bottom"],j=["bottom","top"];switch(p){case"top":case"bottom":return T?x?L:C:x?C:L;case"left":case"right":return x?k:j;default:return[]}}function _C(p,x,T,C){const L=xu(p);let k=mC(ma(p),T==="start",C);return L&&(k=k.map(j=>j+"-"+L),x&&(k=k.concat(k.map(ay)))),k}function Ff(p){return p.replace(/left|right|bottom|top/g,x=>hC[x])}function gC(p){return{top:0,right:0,bottom:0,left:0,...p}}function U1(p){return typeof p!="number"?gC(p):{top:p,right:p,bottom:p,left:p}}function Bf(p){const{x,y:T,width:C,height:L}=p;return{width:C,height:L,top:T,left:x,right:x+C,bottom:T+L,x,y:T}}function $1(p,x,T){let{reference:C,floating:L}=p;const k=rl(x),j=sy(x),o=oy(j),re=ma(x),fe=k==="y",xe=C.x+C.width/2-L.width/2,oe=C.y+C.height/2-L.height/2,Ee=C[o]/2-L[o]/2;let be;switch(re){case"top":be={x:xe,y:C.y-L.height};break;case"bottom":be={x:xe,y:C.y+C.height};break;case"right":be={x:C.x+C.width,y:oe};break;case"left":be={x:C.x-L.width,y:oe};break;default:be={x:C.x,y:C.y}}switch(xu(x)){case"start":be[j]-=Ee*(T&&fe?-1:1);break;case"end":be[j]+=Ee*(T&&fe?-1:1);break}return be}const yC=async(p,x,T)=>{const{placement:C="bottom",strategy:L="absolute",middleware:k=[],platform:j}=T,o=k.filter(Boolean),re=await(j.isRTL==null?void 0:j.isRTL(x));let fe=await j.getElementRects({reference:p,floating:x,strategy:L}),{x:xe,y:oe}=$1(fe,C,re),Ee=C,be={},Pe=0;for(let _e=0;_e<o.length;_e++){const{name:ze,fn:Se}=o[_e],{x:st,y:nt,data:Xe,reset:ct}=await Se({x:xe,y:oe,initialPlacement:C,placement:Ee,strategy:L,middlewareData:be,rects:fe,platform:j,elements:{reference:p,floating:x}});xe=st??xe,oe=nt??oe,be={...be,[ze]:{...be[ze],...Xe}},ct&&Pe<=50&&(Pe++,typeof ct=="object"&&(ct.placement&&(Ee=ct.placement),ct.rects&&(fe=ct.rects===!0?await j.getElementRects({reference:p,floating:x,strategy:L}):ct.rects),{x:xe,y:oe}=$1(fe,Ee,re)),_e=-1)}return{x:xe,y:oe,placement:Ee,strategy:L,middlewareData:be}};async function cd(p,x){var T;x===void 0&&(x={});const{x:C,y:L,platform:k,rects:j,elements:o,strategy:re}=p,{boundary:fe="clippingAncestors",rootBoundary:xe="viewport",elementContext:oe="floating",altBoundary:Ee=!1,padding:be=0}=fa(x,p),Pe=U1(be),ze=o[Ee?oe==="floating"?"reference":"floating":oe],Se=Bf(await k.getClippingRect({element:(T=await(k.isElement==null?void 0:k.isElement(ze)))==null||T?ze:ze.contextElement||await(k.getDocumentElement==null?void 0:k.getDocumentElement(o.floating)),boundary:fe,rootBoundary:xe,strategy:re})),st=oe==="floating"?{x:C,y:L,width:j.floating.width,height:j.floating.height}:j.reference,nt=await(k.getOffsetParent==null?void 0:k.getOffsetParent(o.floating)),Xe=await(k.isElement==null?void 0:k.isElement(nt))?await(k.getScale==null?void 0:k.getScale(nt))||{x:1,y:1}:{x:1,y:1},ct=Bf(k.convertOffsetParentRelativeRectToViewportRelativeRect?await k.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:st,offsetParent:nt,strategy:re}):st);return{top:(Se.top-ct.top+Pe.top)/Xe.y,bottom:(ct.bottom-Se.bottom+Pe.bottom)/Xe.y,left:(Se.left-ct.left+Pe.left)/Xe.x,right:(ct.right-Se.right+Pe.right)/Xe.x}}const vC=p=>({name:"arrow",options:p,async fn(x){const{x:T,y:C,placement:L,rects:k,platform:j,elements:o,middlewareData:re}=x,{element:fe,padding:xe=0}=fa(p,x)||{};if(fe==null)return{};const oe=U1(xe),Ee={x:T,y:C},be=sy(L),Pe=oy(be),_e=await j.getDimensions(fe),ze=be==="y",Se=ze?"top":"left",st=ze?"bottom":"right",nt=ze?"clientHeight":"clientWidth",Xe=k.reference[Pe]+k.reference[be]-Ee[be]-k.floating[Pe],ct=Ee[be]-k.reference[be],xt=await(j.getOffsetParent==null?void 0:j.getOffsetParent(fe));let $t=xt?xt[nt]:0;(!$t||!await(j.isElement==null?void 0:j.isElement(xt)))&&($t=o.floating[nt]||k.floating[Pe]);const kt=Xe/2-ct/2,Wt=$t/2-_e[Pe]/2-1,Ai=Os(oe[Se],Wt),mi=Os(oe[st],Wt),bi=Ai,Jt=$t-_e[Pe]-mi,Bt=$t/2-_e[Pe]/2+kt,vi=ry(bi,Bt,Jt),ri=!re.arrow&&xu(L)!=null&&Bt!==vi&&k.reference[Pe]/2-(Bt<bi?Ai:mi)-_e[Pe]/2<0,ui=ri?Bt<bi?Bt-bi:Bt-Jt:0;return{[be]:Ee[be]+ui,data:{[be]:vi,centerOffset:Bt-vi-ui,...ri&&{alignmentOffset:ui}},reset:ri}}}),xC=function(p){return p===void 0&&(p={}),{name:"flip",options:p,async fn(x){var T,C;const{placement:L,middlewareData:k,rects:j,initialPlacement:o,platform:re,elements:fe}=x,{mainAxis:xe=!0,crossAxis:oe=!0,fallbackPlacements:Ee,fallbackStrategy:be="bestFit",fallbackAxisSideDirection:Pe="none",flipAlignment:_e=!0,...ze}=fa(p,x);if((T=k.arrow)!=null&&T.alignmentOffset)return{};const Se=ma(L),st=rl(o),nt=ma(o)===o,Xe=await(re.isRTL==null?void 0:re.isRTL(fe.floating)),ct=Ee||(nt||!_e?[Ff(o)]:fC(o)),xt=Pe!=="none";!Ee&&xt&&ct.push(..._C(o,_e,Pe,Xe));const $t=[o,...ct],kt=await cd(x,ze),Wt=[];let Ai=((C=k.flip)==null?void 0:C.overflows)||[];if(xe&&Wt.push(kt[Se]),oe){const Bt=pC(L,j,Xe);Wt.push(kt[Bt[0]],kt[Bt[1]])}if(Ai=[...Ai,{placement:L,overflows:Wt}],!Wt.every(Bt=>Bt<=0)){var mi,bi;const Bt=(((mi=k.flip)==null?void 0:mi.index)||0)+1,vi=$t[Bt];if(vi)return{data:{index:Bt,overflows:Ai},reset:{placement:vi}};let ri=(bi=Ai.filter(ui=>ui.overflows[0]<=0).sort((ui,pr)=>ui.overflows[1]-pr.overflows[1])[0])==null?void 0:bi.placement;if(!ri)switch(be){case"bestFit":{var Jt;const ui=(Jt=Ai.filter(pr=>{if(xt){const _r=rl(pr.placement);return _r===st||_r==="y"}return!0}).map(pr=>[pr.placement,pr.overflows.filter(_r=>_r>0).reduce((_r,Ii)=>_r+Ii,0)]).sort((pr,_r)=>pr[1]-_r[1])[0])==null?void 0:Jt[0];ui&&(ri=ui);break}case"initialPlacement":ri=o;break}if(L!==ri)return{reset:{placement:ri}}}return{}}}};function G1(p,x){return{top:p.top-x.height,right:p.right-x.width,bottom:p.bottom-x.height,left:p.left-x.width}}function H1(p){return uC.some(x=>p[x]>=0)}const bC=function(p){return p===void 0&&(p={}),{name:"hide",options:p,async fn(x){const{rects:T}=x,{strategy:C="referenceHidden",...L}=fa(p,x);switch(C){case"referenceHidden":{const k=await cd(x,{...L,elementContext:"reference"}),j=G1(k,T.reference);return{data:{referenceHiddenOffsets:j,referenceHidden:H1(j)}}}case"escaped":{const k=await cd(x,{...L,altBoundary:!0}),j=G1(k,T.floating);return{data:{escapedOffsets:j,escaped:H1(j)}}}default:return{}}}}};async function wC(p,x){const{placement:T,platform:C,elements:L}=p,k=await(C.isRTL==null?void 0:C.isRTL(L.floating)),j=ma(T),o=xu(T),re=rl(T)==="y",fe=["left","top"].includes(j)?-1:1,xe=k&&re?-1:1,oe=fa(x,p);let{mainAxis:Ee,crossAxis:be,alignmentAxis:Pe}=typeof oe=="number"?{mainAxis:oe,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...oe};return o&&typeof Pe=="number"&&(be=o==="end"?Pe*-1:Pe),re?{x:be*xe,y:Ee*fe}:{x:Ee*fe,y:be*xe}}const TC=function(p){return p===void 0&&(p=0),{name:"offset",options:p,async fn(x){var T,C;const{x:L,y:k,placement:j,middlewareData:o}=x,re=await wC(x,p);return j===((T=o.offset)==null?void 0:T.placement)&&(C=o.arrow)!=null&&C.alignmentOffset?{}:{x:L+re.x,y:k+re.y,data:{...re,placement:j}}}}},SC=function(p){return p===void 0&&(p={}),{name:"shift",options:p,async fn(x){const{x:T,y:C,placement:L}=x,{mainAxis:k=!0,crossAxis:j=!1,limiter:o={fn:ze=>{let{x:Se,y:st}=ze;return{x:Se,y:st}}},...re}=fa(p,x),fe={x:T,y:C},xe=await cd(x,re),oe=rl(ma(L)),Ee=ny(oe);let be=fe[Ee],Pe=fe[oe];if(k){const ze=Ee==="y"?"top":"left",Se=Ee==="y"?"bottom":"right",st=be+xe[ze],nt=be-xe[Se];be=ry(st,be,nt)}if(j){const ze=oe==="y"?"top":"left",Se=oe==="y"?"bottom":"right",st=Pe+xe[ze],nt=Pe-xe[Se];Pe=ry(st,Pe,nt)}const _e=o.fn({...x,[Ee]:be,[oe]:Pe});return{..._e,data:{x:_e.x-T,y:_e.y-C}}}}},EC=function(p){return p===void 0&&(p={}),{options:p,fn(x){const{x:T,y:C,placement:L,rects:k,middlewareData:j}=x,{offset:o=0,mainAxis:re=!0,crossAxis:fe=!0}=fa(p,x),xe={x:T,y:C},oe=rl(L),Ee=ny(oe);let be=xe[Ee],Pe=xe[oe];const _e=fa(o,x),ze=typeof _e=="number"?{mainAxis:_e,crossAxis:0}:{mainAxis:0,crossAxis:0,..._e};if(re){const nt=Ee==="y"?"height":"width",Xe=k.reference[Ee]-k.floating[nt]+ze.mainAxis,ct=k.reference[Ee]+k.reference[nt]-ze.mainAxis;be<Xe?be=Xe:be>ct&&(be=ct)}if(fe){var Se,st;const nt=Ee==="y"?"width":"height",Xe=["top","left"].includes(ma(L)),ct=k.reference[oe]-k.floating[nt]+(Xe&&((Se=j.offset)==null?void 0:Se[oe])||0)+(Xe?0:ze.crossAxis),xt=k.reference[oe]+k.reference[nt]+(Xe?0:((st=j.offset)==null?void 0:st[oe])||0)-(Xe?ze.crossAxis:0);Pe<ct?Pe=ct:Pe>xt&&(Pe=xt)}return{[Ee]:be,[oe]:Pe}}}},AC=function(p){return p===void 0&&(p={}),{name:"size",options:p,async fn(x){const{placement:T,rects:C,platform:L,elements:k}=x,{apply:j=()=>{},...o}=fa(p,x),re=await cd(x,o),fe=ma(T),xe=xu(T),oe=rl(T)==="y",{width:Ee,height:be}=C.floating;let Pe,_e;fe==="top"||fe==="bottom"?(Pe=fe,_e=xe===(await(L.isRTL==null?void 0:L.isRTL(k.floating))?"start":"end")?"left":"right"):(_e=fe,Pe=xe==="end"?"top":"bottom");const ze=be-re.top-re.bottom,Se=Ee-re.left-re.right,st=Os(be-re[Pe],ze),nt=Os(Ee-re[_e],Se),Xe=!x.middlewareData.shift;let ct=st,xt=nt;if(oe?xt=xe||Xe?Os(nt,Se):Se:ct=xe||Xe?Os(st,ze):ze,Xe&&!xe){const kt=Eo(re.left,0),Wt=Eo(re.right,0),Ai=Eo(re.top,0),mi=Eo(re.bottom,0);oe?xt=Ee-2*(kt!==0||Wt!==0?kt+Wt:Eo(re.left,re.right)):ct=be-2*(Ai!==0||mi!==0?Ai+mi:Eo(re.top,re.bottom))}await j({...x,availableWidth:xt,availableHeight:ct});const $t=await L.getDimensions(k.floating);return Ee!==$t.width||be!==$t.height?{reset:{rects:!0}}:{}}}};function bu(p){return q1(p)?(p.nodeName||"").toLowerCase():"#document"}function Ao(p){var x;return(p==null||(x=p.ownerDocument)==null?void 0:x.defaultView)||window}function _a(p){var x;return(x=(q1(p)?p.ownerDocument:p.document)||window.document)==null?void 0:x.documentElement}function q1(p){return p instanceof Node||p instanceof Ao(p).Node}function as(p){return p instanceof Element||p instanceof Ao(p).Element}function Fs(p){return p instanceof HTMLElement||p instanceof Ao(p).HTMLElement}function Z1(p){return typeof ShadowRoot>"u"?!1:p instanceof ShadowRoot||p instanceof Ao(p).ShadowRoot}function ud(p){const{overflow:x,overflowX:T,overflowY:C,display:L}=ls(p);return/auto|scroll|overlay|hidden|clip/.test(x+C+T)&&!["inline","contents"].includes(L)}function IC(p){return["table","td","th"].includes(bu(p))}function Nf(p){return[":popover-open",":modal"].some(x=>{try{return p.matches(x)}catch{return!1}})}function ly(p){const x=cy(),T=as(p)?ls(p):p;return T.transform!=="none"||T.perspective!=="none"||(T.containerType?T.containerType!=="normal":!1)||!x&&(T.backdropFilter?T.backdropFilter!=="none":!1)||!x&&(T.filter?T.filter!=="none":!1)||["transform","perspective","filter"].some(C=>(T.willChange||"").includes(C))||["paint","layout","strict","content"].some(C=>(T.contain||"").includes(C))}function CC(p){let x=nl(p);for(;Fs(x)&&!wu(x);){if(ly(x))return x;if(Nf(x))return null;x=nl(x)}return null}function cy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function wu(p){return["html","body","#document"].includes(bu(p))}function ls(p){return Ao(p).getComputedStyle(p)}function jf(p){return as(p)?{scrollLeft:p.scrollLeft,scrollTop:p.scrollTop}:{scrollLeft:p.scrollX,scrollTop:p.scrollY}}function nl(p){if(bu(p)==="html")return p;const x=p.assignedSlot||p.parentNode||Z1(p)&&p.host||_a(p);return Z1(x)?x.host:x}function W1(p){const x=nl(p);return wu(x)?p.ownerDocument?p.ownerDocument.body:p.body:Fs(x)&&ud(x)?x:W1(x)}function hd(p,x,T){var C;x===void 0&&(x=[]),T===void 0&&(T=!0);const L=W1(p),k=L===((C=p.ownerDocument)==null?void 0:C.body),j=Ao(L);if(k){const o=uy(j);return x.concat(j,j.visualViewport||[],ud(L)?L:[],o&&T?hd(o):[])}return x.concat(L,hd(L,[],T))}function uy(p){return p.parent&&Object.getPrototypeOf(p.parent)?p.frameElement:null}function X1(p){const x=ls(p);let T=parseFloat(x.width)||0,C=parseFloat(x.height)||0;const L=Fs(p),k=L?p.offsetWidth:T,j=L?p.offsetHeight:C,o=kf(T)!==k||kf(C)!==j;return o&&(T=k,C=j),{width:T,height:C,$:o}}function hy(p){return as(p)?p:p.contextElement}function Tu(p){const x=hy(p);if(!Fs(x))return il(1);const T=x.getBoundingClientRect(),{width:C,height:L,$:k}=X1(x);let j=(k?kf(T.width):T.width)/C,o=(k?kf(T.height):T.height)/L;return(!j||!Number.isFinite(j))&&(j=1),(!o||!Number.isFinite(o))&&(o=1),{x:j,y:o}}const MC=il(0);function Y1(p){const x=Ao(p);return!cy()||!x.visualViewport?MC:{x:x.visualViewport.offsetLeft,y:x.visualViewport.offsetTop}}function PC(p,x,T){return x===void 0&&(x=!1),!T||x&&T!==Ao(p)?!1:x}function oc(p,x,T,C){x===void 0&&(x=!1),T===void 0&&(T=!1);const L=p.getBoundingClientRect(),k=hy(p);let j=il(1);x&&(C?as(C)&&(j=Tu(C)):j=Tu(p));const o=PC(k,T,C)?Y1(k):il(0);let re=(L.left+o.x)/j.x,fe=(L.top+o.y)/j.y,xe=L.width/j.x,oe=L.height/j.y;if(k){const Ee=Ao(k),be=C&&as(C)?Ao(C):C;let Pe=Ee,_e=uy(Pe);for(;_e&&C&&be!==Pe;){const ze=Tu(_e),Se=_e.getBoundingClientRect(),st=ls(_e),nt=Se.left+(_e.clientLeft+parseFloat(st.paddingLeft))*ze.x,Xe=Se.top+(_e.clientTop+parseFloat(st.paddingTop))*ze.y;re*=ze.x,fe*=ze.y,xe*=ze.x,oe*=ze.y,re+=nt,fe+=Xe,Pe=Ao(_e),_e=uy(Pe)}}return Bf({width:xe,height:oe,x:re,y:fe})}function DC(p){let{elements:x,rect:T,offsetParent:C,strategy:L}=p;const k=L==="fixed",j=_a(C),o=x?Nf(x.floating):!1;if(C===j||o&&k)return T;let re={scrollLeft:0,scrollTop:0},fe=il(1);const xe=il(0),oe=Fs(C);if((oe||!oe&&!k)&&((bu(C)!=="body"||ud(j))&&(re=jf(C)),Fs(C))){const Ee=oc(C);fe=Tu(C),xe.x=Ee.x+C.clientLeft,xe.y=Ee.y+C.clientTop}return{width:T.width*fe.x,height:T.height*fe.y,x:T.x*fe.x-re.scrollLeft*fe.x+xe.x,y:T.y*fe.y-re.scrollTop*fe.y+xe.y}}function RC(p){return Array.from(p.getClientRects())}function K1(p){return oc(_a(p)).left+jf(p).scrollLeft}function zC(p){const x=_a(p),T=jf(p),C=p.ownerDocument.body,L=Eo(x.scrollWidth,x.clientWidth,C.scrollWidth,C.clientWidth),k=Eo(x.scrollHeight,x.clientHeight,C.scrollHeight,C.clientHeight);let j=-T.scrollLeft+K1(p);const o=-T.scrollTop;return ls(C).direction==="rtl"&&(j+=Eo(x.clientWidth,C.clientWidth)-L),{width:L,height:k,x:j,y:o}}function LC(p,x){const T=Ao(p),C=_a(p),L=T.visualViewport;let k=C.clientWidth,j=C.clientHeight,o=0,re=0;if(L){k=L.width,j=L.height;const fe=cy();(!fe||fe&&x==="fixed")&&(o=L.offsetLeft,re=L.offsetTop)}return{width:k,height:j,x:o,y:re}}function kC(p,x){const T=oc(p,!0,x==="fixed"),C=T.top+p.clientTop,L=T.left+p.clientLeft,k=Fs(p)?Tu(p):il(1),j=p.clientWidth*k.x,o=p.clientHeight*k.y,re=L*k.x,fe=C*k.y;return{width:j,height:o,x:re,y:fe}}function J1(p,x,T){let C;if(x==="viewport")C=LC(p,T);else if(x==="document")C=zC(_a(p));else if(as(x))C=kC(x,T);else{const L=Y1(p);C={...x,x:x.x-L.x,y:x.y-L.y}}return Bf(C)}function Q1(p,x){const T=nl(p);return T===x||!as(T)||wu(T)?!1:ls(T).position==="fixed"||Q1(T,x)}function OC(p,x){const T=x.get(p);if(T)return T;let C=hd(p,[],!1).filter(o=>as(o)&&bu(o)!=="body"),L=null;const k=ls(p).position==="fixed";let j=k?nl(p):p;for(;as(j)&&!wu(j);){const o=ls(j),re=ly(j);!re&&o.position==="fixed"&&(L=null),(k?!re&&!L:!re&&o.position==="static"&&!!L&&["absolute","fixed"].includes(L.position)||ud(j)&&!re&&Q1(p,j))?C=C.filter(xe=>xe!==j):L=o,j=nl(j)}return x.set(p,C),C}function FC(p){let{element:x,boundary:T,rootBoundary:C,strategy:L}=p;const j=[...T==="clippingAncestors"?Nf(x)?[]:OC(x,this._c):[].concat(T),C],o=j[0],re=j.reduce((fe,xe)=>{const oe=J1(x,xe,L);return fe.top=Eo(oe.top,fe.top),fe.right=Os(oe.right,fe.right),fe.bottom=Os(oe.bottom,fe.bottom),fe.left=Eo(oe.left,fe.left),fe},J1(x,o,L));return{width:re.right-re.left,height:re.bottom-re.top,x:re.left,y:re.top}}function BC(p){const{width:x,height:T}=X1(p);return{width:x,height:T}}function NC(p,x,T){const C=Fs(x),L=_a(x),k=T==="fixed",j=oc(p,!0,k,x);let o={scrollLeft:0,scrollTop:0};const re=il(0);if(C||!C&&!k)if((bu(x)!=="body"||ud(L))&&(o=jf(x)),C){const oe=oc(x,!0,k,x);re.x=oe.x+x.clientLeft,re.y=oe.y+x.clientTop}else L&&(re.x=K1(L));const fe=j.left+o.scrollLeft-re.x,xe=j.top+o.scrollTop-re.y;return{x:fe,y:xe,width:j.width,height:j.height}}function dy(p){return ls(p).position==="static"}function eb(p,x){return!Fs(p)||ls(p).position==="fixed"?null:x?x(p):p.offsetParent}function tb(p,x){const T=Ao(p);if(Nf(p))return T;if(!Fs(p)){let L=nl(p);for(;L&&!wu(L);){if(as(L)&&!dy(L))return L;L=nl(L)}return T}let C=eb(p,x);for(;C&&IC(C)&&dy(C);)C=eb(C,x);return C&&wu(C)&&dy(C)&&!ly(C)?T:C||CC(p)||T}const jC=async function(p){const x=this.getOffsetParent||tb,T=this.getDimensions,C=await T(p.floating);return{reference:NC(p.reference,await x(p.floating),p.strategy),floating:{x:0,y:0,width:C.width,height:C.height}}};function VC(p){return ls(p).direction==="rtl"}const UC={convertOffsetParentRelativeRectToViewportRelativeRect:DC,getDocumentElement:_a,getClippingRect:FC,getOffsetParent:tb,getElementRects:jC,getClientRects:RC,getDimensions:BC,getScale:Tu,isElement:as,isRTL:VC};function $C(p,x){let T=null,C;const L=_a(p);function k(){var o;clearTimeout(C),(o=T)==null||o.disconnect(),T=null}function j(o,re){o===void 0&&(o=!1),re===void 0&&(re=1),k();const{left:fe,top:xe,width:oe,height:Ee}=p.getBoundingClientRect();if(o||x(),!oe||!Ee)return;const be=Of(xe),Pe=Of(L.clientWidth-(fe+oe)),_e=Of(L.clientHeight-(xe+Ee)),ze=Of(fe),st={rootMargin:-be+"px "+-Pe+"px "+-_e+"px "+-ze+"px",threshold:Eo(0,Os(1,re))||1};let nt=!0;function Xe(ct){const xt=ct[0].intersectionRatio;if(xt!==re){if(!nt)return j();xt?j(!1,xt):C=setTimeout(()=>{j(!1,1e-7)},1e3)}nt=!1}try{T=new IntersectionObserver(Xe,{...st,root:L.ownerDocument})}catch{T=new IntersectionObserver(Xe,st)}T.observe(p)}return j(!0),k}function GC(p,x,T,C){C===void 0&&(C={});const{ancestorScroll:L=!0,ancestorResize:k=!0,elementResize:j=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:re=!1}=C,fe=hy(p),xe=L||k?[...fe?hd(fe):[],...hd(x)]:[];xe.forEach(Se=>{L&&Se.addEventListener("scroll",T,{passive:!0}),k&&Se.addEventListener("resize",T)});const oe=fe&&o?$C(fe,T):null;let Ee=-1,be=null;j&&(be=new ResizeObserver(Se=>{let[st]=Se;st&&st.target===fe&&be&&(be.unobserve(x),cancelAnimationFrame(Ee),Ee=requestAnimationFrame(()=>{var nt;(nt=be)==null||nt.observe(x)})),T()}),fe&&!re&&be.observe(fe),be.observe(x));let Pe,_e=re?oc(p):null;re&&ze();function ze(){const Se=oc(p);_e&&(Se.x!==_e.x||Se.y!==_e.y||Se.width!==_e.width||Se.height!==_e.height)&&T(),_e=Se,Pe=requestAnimationFrame(ze)}return T(),()=>{var Se;xe.forEach(st=>{L&&st.removeEventListener("scroll",T),k&&st.removeEventListener("resize",T)}),oe==null||oe(),(Se=be)==null||Se.disconnect(),be=null,re&&cancelAnimationFrame(Pe)}}const HC=TC,qC=SC,ZC=xC,WC=AC,XC=bC,ib=vC,YC=EC,KC=(p,x,T)=>{const C=new Map,L={platform:UC,...T},k={...L.platform,_c:C};return yC(p,x,{...L,platform:k})};var Vf=typeof document<"u"?ha:Ji;function Uf(p,x){if(p===x)return!0;if(typeof p!=typeof x)return!1;if(typeof p=="function"&&p.toString()===x.toString())return!0;let T,C,L;if(p&&x&&typeof p=="object"){if(Array.isArray(p)){if(T=p.length,T!==x.length)return!1;for(C=T;C--!==0;)if(!Uf(p[C],x[C]))return!1;return!0}if(L=Object.keys(p),T=L.length,T!==Object.keys(x).length)return!1;for(C=T;C--!==0;)if(!{}.hasOwnProperty.call(x,L[C]))return!1;for(C=T;C--!==0;){const k=L[C];if(!(k==="_owner"&&p.$$typeof)&&!Uf(p[k],x[k]))return!1}return!0}return p!==p&&x!==x}function rb(p){return typeof window>"u"?1:(p.ownerDocument.defaultView||window).devicePixelRatio||1}function nb(p,x){const T=rb(p);return Math.round(x*T)/T}function ob(p){const x=Oi(p);return Vf(()=>{x.current=p}),x}function JC(p){p===void 0&&(p={});const{placement:x="bottom",strategy:T="absolute",middleware:C=[],platform:L,elements:{reference:k,floating:j}={},transform:o=!0,whileElementsMounted:re,open:fe}=p,[xe,oe]=Ni({x:0,y:0,strategy:T,placement:x,middlewareData:{},isPositioned:!1}),[Ee,be]=Ni(C);Uf(Ee,C)||be(C);const[Pe,_e]=Ni(null),[ze,Se]=Ni(null),st=Ur(ui=>{ui!==xt.current&&(xt.current=ui,_e(ui))},[]),nt=Ur(ui=>{ui!==$t.current&&($t.current=ui,Se(ui))},[]),Xe=k||Pe,ct=j||ze,xt=Oi(null),$t=Oi(null),kt=Oi(xe),Wt=re!=null,Ai=ob(re),mi=ob(L),bi=Ur(()=>{if(!xt.current||!$t.current)return;const ui={placement:x,strategy:T,middleware:Ee};mi.current&&(ui.platform=mi.current),KC(xt.current,$t.current,ui).then(pr=>{const _r={...pr,isPositioned:!0};Jt.current&&!Uf(kt.current,_r)&&(kt.current=_r,td(()=>{oe(_r)}))})},[Ee,x,T,mi]);Vf(()=>{fe===!1&&kt.current.isPositioned&&(kt.current.isPositioned=!1,oe(ui=>({...ui,isPositioned:!1})))},[fe]);const Jt=Oi(!1);Vf(()=>(Jt.current=!0,()=>{Jt.current=!1}),[]),Vf(()=>{if(Xe&&(xt.current=Xe),ct&&($t.current=ct),Xe&&ct){if(Ai.current)return Ai.current(Xe,ct,bi);bi()}},[Xe,ct,bi,Ai,Wt]);const Bt=Pn(()=>({reference:xt,floating:$t,setReference:st,setFloating:nt}),[st,nt]),vi=Pn(()=>({reference:Xe,floating:ct}),[Xe,ct]),ri=Pn(()=>{const ui={position:T,left:0,top:0};if(!vi.floating)return ui;const pr=nb(vi.floating,xe.x),_r=nb(vi.floating,xe.y);return o?{...ui,transform:"translate("+pr+"px, "+_r+"px)",...rb(vi.floating)>=1.5&&{willChange:"transform"}}:{position:T,left:pr,top:_r}},[T,o,vi.floating,xe.x,xe.y]);return Pn(()=>({...xe,update:bi,refs:Bt,elements:vi,floatingStyles:ri}),[xe,bi,Bt,vi,ri])}const QC=p=>{function x(T){return{}.hasOwnProperty.call(T,"current")}return{name:"arrow",options:p,fn(T){const{element:C,padding:L}=typeof p=="function"?p(T):p;return C&&x(C)?C.current!=null?ib({element:C.current,padding:L}).fn(T):{}:C?ib({element:C,padding:L}).fn(T):{}}}},eM=(p,x)=>({...HC(p),options:[p,x]}),tM=(p,x)=>({...qC(p),options:[p,x]}),iM=(p,x)=>({...YC(p),options:[p,x]}),rM=(p,x)=>({...ZC(p),options:[p,x]}),nM=(p,x)=>({...WC(p),options:[p,x]}),oM=(p,x)=>({...XC(p),options:[p,x]}),sM=(p,x)=>({...QC(p),options:[p,x]});function aM(p){const[x,T]=Ni(void 0);return fu(()=>{if(p){T({width:p.offsetWidth,height:p.offsetHeight});const C=new ResizeObserver(L=>{if(!Array.isArray(L)||!L.length)return;const k=L[0];let j,o;if("borderBoxSize"in k){const re=k.borderBoxSize,fe=Array.isArray(re)?re[0]:re;j=fe.inlineSize,o=fe.blockSize}else j=p.offsetWidth,o=p.offsetHeight;T({width:j,height:o})});return C.observe(p,{box:"border-box"}),()=>C.unobserve(p)}else T(void 0)},[p]),x}const sb="Popper",[ab,lb]=Gg(sb),[lM,cb]=ab(sb),cM=p=>{const{__scopePopper:x,children:T}=p,[C,L]=Ni(null);return Kt(lM,{scope:x,anchor:C,onAnchorChange:L},T)},uM="PopperAnchor",hM=on((p,x)=>{const{__scopePopper:T,virtualRef:C,...L}=p,k=cb(uM,T),j=Oi(null),o=Ls(x,j);return Ji(()=>{k.onAnchorChange((C==null?void 0:C.current)||j.current)}),C?null:Kt(Qa.div,sn({},L,{ref:o}))}),ub="PopperContent",[dM,YO]=ab(ub),pM=on((p,x)=>{var T,C,L,k,j,o,re,fe;const{__scopePopper:xe,side:oe="bottom",sideOffset:Ee=0,align:be="center",alignOffset:Pe=0,arrowPadding:_e=0,avoidCollisions:ze=!0,collisionBoundary:Se=[],collisionPadding:st=0,sticky:nt="partial",hideWhenDetached:Xe=!1,updatePositionStrategy:ct="optimized",onPlaced:xt,...$t}=p,kt=cb(ub,xe),[Wt,Ai]=Ni(null),mi=Ls(x,wr=>Ai(wr)),[bi,Jt]=Ni(null),Bt=aM(bi),vi=(T=Bt==null?void 0:Bt.width)!==null&&T!==void 0?T:0,ri=(C=Bt==null?void 0:Bt.height)!==null&&C!==void 0?C:0,ui=oe+(be!=="center"?"-"+be:""),pr=typeof st=="number"?st:{top:0,right:0,bottom:0,left:0,...st},_r=Array.isArray(Se)?Se:[Se],Ii=_r.length>0,$r={padding:pr,boundary:_r.filter(fM),altBoundary:Ii},{refs:gn,floatingStyles:Yn,placement:ho,isPositioned:Ui,middlewareData:Zi}=JC({strategy:"fixed",placement:ui,whileElementsMounted:(...wr)=>GC(...wr,{animationFrame:ct==="always"}),elements:{reference:kt.anchor},middleware:[eM({mainAxis:Ee+ri,alignmentAxis:Pe}),ze&&tM({mainAxis:!0,crossAxis:!1,limiter:nt==="partial"?iM():void 0,...$r}),ze&&rM({...$r}),nM({...$r,apply:({elements:wr,rects:Br,availableWidth:En,availableHeight:Gr})=>{const{width:Dr,height:an}=Br.reference,On=wr.floating.style;On.setProperty("--radix-popper-available-width",`${En}px`),On.setProperty("--radix-popper-available-height",`${Gr}px`),On.setProperty("--radix-popper-anchor-width",`${Dr}px`),On.setProperty("--radix-popper-anchor-height",`${an}px`)}}),bi&&sM({element:bi,padding:_e}),mM({arrowWidth:vi,arrowHeight:ri}),Xe&&oM({strategy:"referenceHidden",...$r})]}),[Lr,Uo]=hb(ho),gr=Ja(xt);fu(()=>{Ui&&(gr==null||gr())},[Ui,gr]);const Kn=(L=Zi.arrow)===null||L===void 0?void 0:L.x,oo=(k=Zi.arrow)===null||k===void 0?void 0:k.y,Qi=((j=Zi.arrow)===null||j===void 0?void 0:j.centerOffset)!==0,[Ei,un]=Ni();return fu(()=>{Wt&&un(window.getComputedStyle(Wt).zIndex)},[Wt]),Kt("div",{ref:gn.setFloating,"data-radix-popper-content-wrapper":"",style:{...Yn,transform:Ui?Yn.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ei,"--radix-popper-transform-origin":[(o=Zi.transformOrigin)===null||o===void 0?void 0:o.x,(re=Zi.transformOrigin)===null||re===void 0?void 0:re.y].join(" ")},dir:p.dir},Kt(dM,{scope:xe,placedSide:Lr,onArrowChange:Jt,arrowX:Kn,arrowY:oo,shouldHideArrow:Qi},Kt(Qa.div,sn({"data-side":Lr,"data-align":Uo},$t,{ref:mi,style:{...$t.style,animation:Ui?void 0:"none",opacity:(fe=Zi.hide)!==null&&fe!==void 0&&fe.referenceHidden?0:void 0}}))))});function fM(p){return p!==null}const mM=p=>({name:"transformOrigin",options:p,fn(x){var T,C,L,k,j;const{placement:o,rects:re,middlewareData:fe}=x,oe=((T=fe.arrow)===null||T===void 0?void 0:T.centerOffset)!==0,Ee=oe?0:p.arrowWidth,be=oe?0:p.arrowHeight,[Pe,_e]=hb(o),ze={start:"0%",center:"50%",end:"100%"}[_e],Se=((C=(L=fe.arrow)===null||L===void 0?void 0:L.x)!==null&&C!==void 0?C:0)+Ee/2,st=((k=(j=fe.arrow)===null||j===void 0?void 0:j.y)!==null&&k!==void 0?k:0)+be/2;let nt="",Xe="";return Pe==="bottom"?(nt=oe?ze:`${Se}px`,Xe=`${-be}px`):Pe==="top"?(nt=oe?ze:`${Se}px`,Xe=`${re.floating.height+be}px`):Pe==="right"?(nt=`${-be}px`,Xe=oe?ze:`${st}px`):Pe==="left"&&(nt=`${re.floating.width+be}px`,Xe=oe?ze:`${st}px`),{data:{x:nt,y:Xe}}}});function hb(p){const[x,T="center"]=p.split("-");return[x,T]}const _M=cM,gM=hM,yM=pM,db="Popover",[pb,KO]=Gg(db,[lb]),py=lb(),[vM,Su]=pb(db),xM=p=>{const{__scopePopover:x,children:T,open:C,defaultOpen:L,onOpenChange:k,modal:j=!1}=p,o=py(x),re=Oi(null),[fe,xe]=Ni(!1),[oe=!1,Ee]=s1({prop:C,defaultProp:L,onChange:k});return Kt(_M,o,Kt(vM,{scope:x,contentId:Ef(),triggerRef:re,open:oe,onOpenChange:Ee,onOpenToggle:Ur(()=>Ee(be=>!be),[Ee]),hasCustomAnchor:fe,onCustomAnchorAdd:Ur(()=>xe(!0),[]),onCustomAnchorRemove:Ur(()=>xe(!1),[]),modal:j},T))},bM="PopoverTrigger",wM=on((p,x)=>{const{__scopePopover:T,...C}=p,L=Su(bM,T),k=py(T),j=Ls(x,L.triggerRef),o=Kt(Qa.button,sn({type:"button","aria-haspopup":"dialog","aria-expanded":L.open,"aria-controls":L.contentId,"data-state":_b(L.open)},C,{ref:j,onClick:ss(p.onClick,L.onOpenToggle)}));return L.hasCustomAnchor?o:Kt(gM,sn({asChild:!0},k),o)}),fb="PopoverPortal",[TM,SM]=pb(fb,{forceMount:void 0}),EM=p=>{const{__scopePopover:x,forceMount:T,children:C,container:L}=p,k=Su(fb,x);return Kt(TM,{scope:x,forceMount:T},Kt(mu,{present:T||k.open},Kt(g1,{asChild:!0,container:L},C)))},dd="PopoverContent",AM=on((p,x)=>{const T=SM(dd,p.__scopePopover),{forceMount:C=T.forceMount,...L}=p,k=Su(dd,p.__scopePopover);return Kt(mu,{present:C||k.open},k.modal?Kt(IM,sn({},L,{ref:x})):Kt(CM,sn({},L,{ref:x})))}),IM=on((p,x)=>{const T=Su(dd,p.__scopePopover),C=Oi(null),L=Ls(x,C),k=Oi(!1);return Ji(()=>{const j=C.current;if(j)return O1(j)},[]),Kt(L1,{as:Af,allowPinchZoom:!0},Kt(mb,sn({},p,{ref:L,trapFocus:T.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ss(p.onCloseAutoFocus,j=>{var o;j.preventDefault(),k.current||(o=T.triggerRef.current)===null||o===void 0||o.focus()}),onPointerDownOutside:ss(p.onPointerDownOutside,j=>{const o=j.detail.originalEvent,re=o.button===0&&o.ctrlKey===!0,fe=o.button===2||re;k.current=fe},{checkForDefaultPrevented:!1}),onFocusOutside:ss(p.onFocusOutside,j=>j.preventDefault(),{checkForDefaultPrevented:!1})})))}),CM=on((p,x)=>{const T=Su(dd,p.__scopePopover),C=Oi(!1),L=Oi(!1);return Kt(mb,sn({},p,{ref:x,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:k=>{var j;if((j=p.onCloseAutoFocus)===null||j===void 0||j.call(p,k),!k.defaultPrevented){var o;C.current||(o=T.triggerRef.current)===null||o===void 0||o.focus(),k.preventDefault()}C.current=!1,L.current=!1},onInteractOutside:k=>{var j,o;(j=p.onInteractOutside)===null||j===void 0||j.call(p,k),k.defaultPrevented||(C.current=!0,k.detail.originalEvent.type==="pointerdown"&&(L.current=!0));const re=k.target;((o=T.triggerRef.current)===null||o===void 0?void 0:o.contains(re))&&k.preventDefault(),k.detail.originalEvent.type==="focusin"&&L.current&&k.preventDefault()}}))}),mb=on((p,x)=>{const{__scopePopover:T,trapFocus:C,onOpenAutoFocus:L,onCloseAutoFocus:k,disableOutsidePointerEvents:j,onEscapeKeyDown:o,onPointerDownOutside:re,onFocusOutside:fe,onInteractOutside:xe,...oe}=p,Ee=Su(dd,T),be=py(T);return y1(),Kt(d1,{asChild:!0,loop:!0,trapped:C,onMountAutoFocus:L,onUnmountAutoFocus:k},Kt(l1,{asChild:!0,disableOutsidePointerEvents:j,onInteractOutside:xe,onEscapeKeyDown:o,onPointerDownOutside:re,onFocusOutside:fe,onDismiss:()=>Ee.onOpenChange(!1)},Kt(yM,sn({"data-state":_b(Ee.open),role:"dialog",id:Ee.contentId},be,oe,{ref:x,style:{...oe.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}))))});function _b(p){return p?"open":"closed"}const MM=xM,PM=wM,DM=EM,RM=AM,gb=p=>{var T;const x=Number((T=p.match(/\d/g))==null?void 0:T.join(""));return Number.isNaN(x)?0:x},zM=(p,x={by:"results-count",order:"descending"})=>{const T=[...p];switch(x.by){case"results-count":T.sort((C,L)=>C.jobs-L.jobs);break;case"alphabetically":T.sort((C,L)=>C.label.localeCompare(L.label));break;case"numerically":T.sort((C,L)=>{const k=gb(C.value),j=gb(L.value);return k-j});break}return x.order==="descending"&&T.reverse(),T},pd=Vo({base:"fr bg-lowest caret-accent-11 selection:bg-accent-4 selection:text-accent-12 placeholder:text-copy-neutral placeholder:opacity-30 ring-width-section ease-expo-out duration-snappy transition-all disabled:opacity-50 rounded-input font-style-input text-style-input font-weight-input",variants:{hasValue:{false:"text-copy-neutral ring-job-card-stroke",true:"text-interactive-accent-text ring-job-card-stroke"},size:{md:"py-2 px-4",unsized:""}},defaultVariants:{size:"md",hasValue:!1}}),yb=Vo({base:"flex-1 gutter-stable group/filter flex-col p-2 bg-app flex max-w-full overflow-y-auto items-stretch",variants:{ring:{default:"border-b-px border-neutral-4",unset:""}},defaultVariants:{ring:"default"}}),vb=Vo({base:"max-w-full origin-top group/tag ease-expo-out transition-all duration-snappy",variants:{type:{pill:"",line:"[&:not(:last-child)]:border-b-px border-neutral-2 has-[[data-current-value=true]]:border-b-accent-3"}}}),xb=Vo({base:"cursor-pointer flex fr gap-2 font-style-tag pointer-fine:group-[&:first-child]/filter:group-[&:first-child]/tag:rounded-t-tag py-2.5 px-2.5 font-family-tag font-weight-tag text-style-tag focus:relative w-full justify-between",variants:{active:{true:"bg-accent-2 text-accent-11",false:"text-neutral-11"},disabled:{true:"opacity-25 pointer-events-none",false:""}},compoundVariants:[{disabled:!1,active:!1,class:"hover:bg-neutral-2"}],defaultVariants:{disabled:!1,active:!1}}),LM=Vo({base:"rounded-job-tag inline-block px-1 border-solid border-px ease-expo-out transition-all duration-snappy",variants:{colorScheme:{accentStrong:"text-accent-11 bg-accent-4 border-tag-accent-strong-stroke",neutralStrong:"text-neutral-11 bg-neutral-2 border-tag-neutral-strong-stroke"}}}),kM=({children:p,colorScheme:x})=>ce("span",{class:LM({colorScheme:x}),children:ce("span",{class:"block w-[3ch] text-center tabular-nums",children:p})}),OM=(p,x)=>{const T=p.indexOf(x);return T===-1?[...p,x]:p.filter((C,L)=>L!==T)},FM=(p,x)=>{if(p===null)return!1;const T=p[x.value];return T===void 0?!0:T===0},BM=(p,x)=>{const T=C=>C>99?"99+":C.toString();return T(p===null?x.jobs:p[x.value]??0)},NM=({value:p,property:x,useQuery:T,isMobile:C,onValueChange:L,onClose:k})=>{const{t:j}=kn(),o=Qh(T()),re=Pn(()=>{switch(o.queryState){case"error":case"idle":case"loading":return null;case"loaded":case"revalidating":{const be=o.data[x.key]??[];return Object.fromEntries(be.map(Pe=>[Pe.value,Pe.jobs]))}default:No(o)}},[o,x.key]),fe=Eb(p),xe=fe.length>0,[oe,Ee]=Ni();return ce("div",{class:"theme-fill:bg-neutral-1 flex min-h-0 w-full flex-1 flex-col",children:[x.searchable&&ce("div",{class:"border-b-px border-neutral-4",children:ce("input",{type:"search",class:"theme-fill:bg-neutral-2 theme-stroke:bg-neutral-1 theme-fill:focus:bg-neutral-1 theme-stroke:focus:bg-lowest focus:ring-px focus:ring-neutral-6 pointer-fine:theme-soft:rounded-t-lg pointer-fine:theme-rounded:rounded-t-lg caret-accent-11 selection:bg-accent-4 selection:text-accent-12 placeholder:text-copy-neutral ease-expo-out duration-snappy font-style-input text-style-input font-weight-input bg-transparent px-4 py-2.5 outline-none transition-all placeholder:opacity-30 disabled:opacity-50",value:oe,onInput:be=>Ee(be.currentTarget.value),placeholder:j("type_to_search")})}),(()=>{switch(o.queryState){case"error":return ce(Xa,{error:new Error(j("filters_loading_error"),{cause:o.error}),class:"flex-1",resetError:()=>o.swr.mutate()});case"idle":case"loading":return ce("div",{"aria-hidden":!0,class:"flex flex-col p-2",children:Array.from({length:10}).map((be,Pe)=>ce("div",{style:{animationDelay:Pe*-.1+"s"},class:"bg-neutral-3 animate-skeleton h-12 w-full"},Pe))});case"revalidating":case"loaded":{const be=o.data[x.key]??[],Pe=oe&&oe.length>1?be.filter(Se=>Se.label.toLowerCase().includes(oe.toLowerCase())):be,_e=[];for(const Se of Pe){if(Se.label.length<1)continue;const st={...Se,results:BM(re,Se),disabled:FM(re,Se)};switch(x.results){case"only-available":st.disabled===!1&&_e.push(st);break;default:_e.push(st)}}return _e.find(Se=>!Se.disabled)?ce("ul",{class:yb(),children:zM(_e,x.sortSuggestions).map(Se=>{const st=fe.includes(Se.value);return ce("li",{class:vb({type:"line"}),children:ce("button",{type:"button",disabled:Se.disabled,"data-filter":!0,"data-current-value":st?"true":void 0,onClick:()=>{switch(p.select){case"many":{const nt=OM(fe,Se.value);L({select:"many",value:nt});break}case"one":L({select:"one",value:st?void 0:Se.value});break;default:No(p)}},class:xb({active:st,disabled:Se.disabled}),children:[ce("span",{class:"max-w-full truncate",children:Se.label})," ",ce(kM,{colorScheme:st?"accentStrong":"neutralStrong",children:Se.results})]})},Se.value)})}):ce("p",{class:"font-style-tag text-style-tag font-weight-tag w-full flex-1 px-4 pb-1 pt-4 text-center",children:j("no_filter_options_available")})}default:No(o)}})(),ce("footer",{class:"flex flex-none justify-end p-2",children:[ce("div",{class:"flex-1",children:xe&&ce("button",{type:"button",class:da({variant:"neutral",icon:"left"}),onClick:()=>{L(void 0)},children:[ce(Sn,{"aria-hidden":!0,name:"x"})," ",j("clear")]})}),p.select==="many"&&C&&ce("div",{class:"flex items-center overflow-hidden",children:ce("p",{class:"theme-light:text-neutral-11 theme-dark:text-neutral-12 font-style-default text-style-tag font-weight-default flex-grow select-none truncate text-center",children:[fe.length," ",j("selected")]})}),ce("div",{class:"flex-1",children:ce("button",{type:"button",class:da({variant:xe?"accent":"neutral",class:"ml-auto"}),onClick:k,children:j(xe?"done":"close")},xe?"done":"close")})]})]})},bb=8,wb={contract_type:"clock",title:"magnifier",city:"mapPin",town:"mapPin",country:"mapPin",company_name:"briefcase",category:"briefcase",pay:"pay",pay_currency:"pay",pay_mask:"pay",pay_display:"pay",pay_max:"pay",pay_min:"pay",pay_type:"pay"},Tb=Vo({base:"theme-fill:fr theme-fill:bg-neutral-2 theme-fill:hover:bg-neutral-3 theme-stroke:fr theme-stroke:hover:fr theme-stroke:ring-px theme-stroke:bg-lowest theme-stroke:ring-neutral-4 theme-stroke:hover:ring-neutral-6 group relative flex cursor-pointer select-none items-center gap-1.5 py-2.5 pl-3.5 pr-3 font-style-filter font-family-filter font-weight-filter text-style-filter duration-snappy outline-none ijs-filter flex-shrink-0 min-w-0 theme-rounded:rounded-md theme-soft:rounded-sm transition-all ease-expo-out active:scale-[0.975] origin-[50%_1.75rem]",variants:{state:{default:"text-copy-neutral-lowcontrast hover:text-copy-neutral",active:"text-copy-neutral"}}}),Sb=Vo({base:"bg-lowest isolate z-50 flex flex-col overflow-hidden ring-neutral-4 ring-px",variants:{mode:{mobile:"fixed bottom-0 w-full h-[80svh] rounded-t-section animate-slide-out-bottom pb-[env(safe-area-inset-bottom)]",desktop:"min-w-64 max-w-xs max-h-[--radix-popover-content-available-height] rounded-section animate-slideDownFade data-[side=top]:animate-slideUpFade shadow-lg"}}}),Eb=p=>typeof p.value=="string"?[p.value]:p.value??[],jM=({selectedValues:p})=>{const x=p.length;return x===0?null:ce("span",{"aria-label":"Current value",class:"animate-appear-tag text-style-job-card-info font-style-tag font-family-tag font-weight-tag text-tag-accent-strong-copy bg-tag-accent-strong-bg min-w-6 min-h-6 absolute -right-1 -top-1 inline-flex items-center justify-center rounded-[999px] px-2 tabular-nums",children:x},x)},VM=({active:p,value:x,onActiveChange:T,property:C,onValueChange:L,unfilteredQuery:k,useQuery:j,theme:o,widgetId:re})=>{const fe=Kl(C.key,wb)?wb[C.key]:void 0,xe=C.icon??fe??"filter",oe=Eb(x),Ee=oe.length>0,be=_x("(pointer: coarse)"),Pe=ce(rr,{children:[ce("div",{class:"flex min-w-0 flex-1 items-center gap-1.5",children:[ce(Sn,{"aria-hidden":!0,class:"flex-none",name:xe}),ce("span",{class:"truncate",children:C.label})]}),ce(Sn,{"aria-hidden":!0,class:"text-neutral-8 flex-shrink-0 rotate-90 transition-transform group-data-[state=open]:-rotate-90",name:"chevron-right"}),ce(jM,{selectedValues:oe})]}),_e=ce(NM,{useQuery:j,onClose:()=>T(!1),onValueChange:L,unfilteredQuery:k,property:C,value:x,isMobile:be});return be?ce(oC,{open:p,onOpenChange:T,children:[ce(sC,{"data-filter-key":C.key,"aria-label":C.label,"aria-selected":p?"true":void 0,class:Tb({state:p||Ee?"active":"default"}),onTouchStart:UM,children:Pe}),ce(aC,{children:ce("div",{class:"inploi-job-search","data-widget-id":re,children:[ce(lC,{class:"animate-fade-in fixed inset-0 z-50 bg-[#0009]"}),ce(cC,{class:Sb({mode:"mobile",class:bg(o)}),children:[ce("header",{class:"theme-fill:bg-neutral-1 text-neutral-12 border-b-px border-neutral-4 flex cursor-default items-center gap-2 p-4",children:[ce(Sn,{name:xe,class:"flex-none"}),ce("p",{class:"font-style-filter font-weight-filter text-style-filter truncate",children:C.label})]}),_e]})]})})]}):ce(MM,{open:p,onOpenChange:ze=>T(ze),modal:be,children:[ce(PM,{"data-filter-key":C.key,"aria-label":C.label,"aria-selected":p?"true":void 0,class:Tb({state:p||Ee?"active":"default"}),children:Pe}),ce(DM,{children:ce("div",{class:"inploi-job-search","data-widget-id":re,children:ce(RM,{side:"bottom",sideOffset:bb,align:"center",collisionPadding:bb,class:Sb({mode:"desktop",class:bg(o)}),children:_e})})})]})};function UM(){}const $M=(p,x)=>{var T,C,L;switch(x.select){case"many":(T=x.value)==null||T.forEach(k=>{var j,o;switch(p.select){case"many":(j=p.value)!=null&&j.includes(k)||(o=p.value)==null||o.push(k);break;case"one":p.value=k}});break;case"one":if(!x.value)break;switch(p.select){case"many":(C=p.value)!=null&&C.includes(x.value)||(L=p.value)==null||L.push(x.value);break;case"one":p.value=x.value}break}},GM=({value:p,activeKey:x})=>{switch(p==null?void 0:p.select){case void 0:return{newValue:void 0,newActiveKey:x};case"one":case"many":return{newValue:p,newActiveKey:x};default:No(p)}},HM=({properties:p,state:x,onFilterValueChange:T,onResetFilters:C,rpcClient:L,theme:k,alerts:j,widgetId:o})=>{const{t:re}=kn(),[fe,xe]=Ni(void 0),oe=Pn(()=>({filters:by(p,"value"),mode:x.mode,query:"",geo:void 0,page:1,view:"list"}),[p,x.mode]),Ee=Qh(ad($g({state:oe,baseKey:"filters"}),()=>Qv({rpcClient:L,state:oe}),mf)),be=Ur(Pe=>()=>{const _e={...x,filters:{...x.filters,[Pe]:oe.filters[Pe]}};return ad($g({state:_e,baseKey:"filters"}),()=>Qv({rpcClient:L,state:_e}),mf)},[L,oe.filters,x]);return Ee.queryState==="error"?ce(Xa,{error:new Error(re("filters_loading_error"),{cause:Ee.error}),resetError:()=>Ee.swr.mutate()}):ce("div",{class:"ijs-filters-section flex w-full flex-col items-stretch justify-center gap-2 overflow-auto px-4 py-2 md:flex-row md:flex-wrap md:items-center",children:[p.filter(Pe=>Pe.hidden!==!0).map(Pe=>{const _e=fe===Pe.key,ze=x.filters[Pe.key]??{select:Pe.select,value:void 0},Se=oe.filters[Pe.key];Se&&$M(ze,Se);const st=ct=>{const{newActiveKey:xt,newValue:$t}=GM({property:Pe,activeKey:fe,value:ct??Se,properties:p,appliedFilters:x.filters});return xe(xt),T(Pe.key,$t)},nt=ct=>xe(ct?Pe.key:void 0),Xe=be(Pe.key);return ce(ed,{Fallback:Xa,children:ce(VM,{unfilteredQuery:Ee,active:_e,property:Pe,onActiveChange:nt,value:ze,useQuery:Xe,onValueChange:st,theme:k,widgetId:o})},Pe.key)}),ce("button",{type:"button",class:da({variant:"neutral"}),onClick:C,children:re("reset")}),j?ce("div",{id:"inploi-job-alerts",class:"min-h-[36px]",children:ce("div",{class:"rounded-job-card bg-neutral-2 flex h-[36px] animate-pulse items-center gap-2 px-2",children:[ce("div",{class:"block h-6 w-6"}),ce("p",{class:"text-style-tag text-neutral-6 pr-2 font-[500]",children:j.params.config.label})]})}):null]})};function qM(p){var x=typeof p;return p!=null&&(x=="object"||x=="function")}var $f=qM,ZM=typeof rd=="object"&&rd&&rd.Object===Object&&rd,WM=ZM,XM=WM,YM=typeof self=="object"&&self&&self.Object===Object&&self,KM=XM||YM||Function("return this")(),Gf=KM,JM=Gf,QM=function(){return JM.Date.now()},eP=QM,tP=/\s/;function iP(p){for(var x=p.length;x--&&tP.test(p.charAt(x)););return x}var rP=iP,nP=rP,oP=/^\s+/;function sP(p){return p&&p.slice(0,nP(p)+1).replace(oP,"")}var aP=sP,lP=Gf,cP=lP.Symbol,fy=cP,Ab=fy,Ib=Object.prototype,uP=Ib.hasOwnProperty,hP=Ib.toString,fd=Ab?Ab.toStringTag:void 0;function dP(p){var x=uP.call(p,fd),T=p[fd];try{p[fd]=void 0;var C=!0}catch{}var L=hP.call(p);return C&&(x?p[fd]=T:delete p[fd]),L}var pP=dP,fP=Object.prototype,mP=fP.toString;function _P(p){return mP.call(p)}var gP=_P,Cb=fy,yP=pP,vP=gP,xP="[object Null]",bP="[object Undefined]",Mb=Cb?Cb.toStringTag:void 0;function wP(p){return p==null?p===void 0?bP:xP:Mb&&Mb in Object(p)?yP(p):vP(p)}var Pb=wP;function TP(p){return p!=null&&typeof p=="object"}var SP=TP,EP=Pb,AP=SP,IP="[object Symbol]";function CP(p){return typeof p=="symbol"||AP(p)&&EP(p)==IP}var Hf=CP,MP=aP,Db=$f,PP=Hf,Rb=0/0,DP=/^[-+]0x[0-9a-f]+$/i,RP=/^0b[01]+$/i,zP=/^0o[0-7]+$/i,LP=parseInt;function kP(p){if(typeof p=="number")return p;if(PP(p))return Rb;if(Db(p)){var x=typeof p.valueOf=="function"?p.valueOf():p;p=Db(x)?x+"":x}if(typeof p!="string")return p===0?p:+p;p=MP(p);var T=RP.test(p);return T||zP.test(p)?LP(p.slice(2),T?2:8):DP.test(p)?Rb:+p}var OP=kP,FP=$f,my=eP,zb=OP,BP="Expected a function",NP=Math.max,jP=Math.min;function VP(p,x,T){var C,L,k,j,o,re,fe=0,xe=!1,oe=!1,Ee=!0;if(typeof p!="function")throw new TypeError(BP);x=zb(x)||0,FP(T)&&(xe=!!T.leading,oe="maxWait"in T,k=oe?NP(zb(T.maxWait)||0,x):k,Ee="trailing"in T?!!T.trailing:Ee);function be(xt){var $t=C,kt=L;return C=L=void 0,fe=xt,j=p.apply(kt,$t),j}function Pe(xt){return fe=xt,o=setTimeout(Se,x),xe?be(xt):j}function _e(xt){var $t=xt-re,kt=xt-fe,Wt=x-$t;return oe?jP(Wt,k-kt):Wt}function ze(xt){var $t=xt-re,kt=xt-fe;return re===void 0||$t>=x||$t<0||oe&&kt>=k}function Se(){var xt=my();if(ze(xt))return st(xt);o=setTimeout(Se,_e(xt))}function st(xt){return o=void 0,Ee&&C?be(xt):(C=L=void 0,j)}function nt(){o!==void 0&&clearTimeout(o),fe=0,C=re=L=o=void 0}function Xe(){return o===void 0?j:st(my())}function ct(){var xt=my(),$t=ze(xt);if(C=arguments,L=this,re=xt,$t){if(o===void 0)return Pe(re);if(oe)return clearTimeout(o),o=setTimeout(Se,x),be(re)}return o===void 0&&(o=setTimeout(Se,x)),j}return ct.cancel=nt,ct.flush=Xe,ct}var UP=VP;const $P=Ig(UP),Lb=(p,x=1e3)=>{const[T,C]=Ni(p),L=Pn(()=>$P(k=>C(k),x),[x]);return Ji(()=>{L(p)},[p,L]),T},GP=on(({disabled:p,error:x,name:T,inputPlaceholder:C,items:L,onItemSelect:k,onQueryChange:j,onBlur:o,onFocus:re,inputProps:fe,menuProps:xe,query:oe},Ee)=>{const[be,Pe]=Ni(!1),[_e,ze]=Ni(),{t:Se}=kn(),st=Oi();Ji(()=>{var Xe;ze((Xe=L[0])==null?void 0:Xe.id)},[L]);const nt=Xe=>{k(Xe),Pe(!1)};return ce("div",{class:"relative h-full",children:[ce("input",{name:T,ref:Ee,disabled:p,"data-active":be?"true":void 0,"aria-controls":`ijs-${T}-menu`,placeholder:C,class:pd({size:"md"}),onFocus:()=>{re==null||re(),Pe(!0)},onBlur:()=>{st.current=window.setTimeout(()=>{o==null||o(),Pe(!1)},100)},value:oe,onChange:Xe=>j(Xe.currentTarget.value),onKeyDown:Xe=>{switch(Pe(!0),Xe.key){case"ArrowDown":case"ArrowUp":{const ct=Xe.key==="ArrowDown"?1:-1;Xe.preventDefault();const xt=L.findIndex(kt=>kt.id===_e);if(xt===-1)return;const $t=L[xt+ct]??L[Xe.key==="ArrowDown"?0:L.length-1];if(!$t)return;ze($t.id);break}case"Enter":{if(Xe.preventDefault(),!_e)return;k(_e)}}},...fe}),!x&&be&&!p&&L.length>0?ce("ul",{className:yb({ring:"unset",className:"ring-width-section rounded-input ring-job-card-stroke absolute left-0 right-0 top-12 z-50 w-full shadow-sm"}),id:`ijs-${T}-menu`,onMouseDown:()=>{st.current&&clearTimeout(st.current)},...xe,children:x?ce("div",{role:"alert",children:Se("geo_suggestions_error")}):L.map(Xe=>ce("li",{class:vb({type:"line",className:"group/tag"}),children:ce("button",{type:"button",onMouseEnter:()=>ze(Xe.id),class:xb({active:Xe.id===_e,className:"line-clamp-1 overflow-hidden truncate"}),onClick:()=>nt(Xe.id),onKeyDown:ct=>{ct.key==="Enter"&&nt(Xe.id)},children:Xe.label})},Xe.id))}):null]})}),HP=(p={})=>new Promise((x,T)=>{var C,L;if((C=p.signal)!=null&&C.aborted){T(new DOMException("Aborted","AbortError"));return}navigator.geolocation.getCurrentPosition(k=>x(k.coords),k=>T(k),p),(L=p.signal)==null||L.addEventListener("abort",()=>{T(new DOMException("Aborted","AbortError"))},{once:!0})}),qP={1:"geo_error_permission_denied",2:"geo_error_position_unavailable",3:"geo_error_timeout"},kb=typeof window<"u"&&"geolocation"in navigator&&window.isSecureContext,ZP=({onLocate:p,onError:x,signal:T})=>{const[C,L]=Ni("idle"),[k,j]=Ni(null),{t:o}=kn(),re=fe=>{L("idle"),j(fe),p(fe)};return ce("button",{"aria-label":o(C==="loading"?"geo_locating":"geo_my_location"),type:"button",onClick:()=>{if(kb){if(L("loading"),k)return re(k);HP({signal:T}).then(fe=>{const xe={lat:fe.latitude,lng:fe.longitude};re(xe)}).catch(fe=>{if(fe instanceof DOMException&&fe.name==="AbortError")return L("idle");L("error");const xe=qP[fe.code];if(!xe)return;const oe=o(xe);x(oe)})}},"data-state":C,class:da({variant:"accent",size:"lg",icon:"only",className:"data-[state=loading]:animate-pulse"}),disabled:!kb||C==="error",children:ce(Sn,{name:"target-location"})})},Eu=Vo({base:"block fr font-style-tag font-family-tag font-weight-tag",variants:{variant:{neutralWeak:"text-tag-neutral-weak-copy bg-tag-neutral-weak-bg border-solid border-px border-tag-neutral-weak-stroke",neutralStrong:"text-tag-neutral-strong-copy bg-tag-neutral-strong-bg border-solid border-px border-tag-neutral-strong-stroke",accentStrong:"text-tag-accent-strong-copy bg-tag-accent-strong-bg border-solid border-px border-tag-accent-strong-stroke",monetaryWeak:"text-tag-monetary-weak-copy bg-tag-monetary-weak-bg border-solid border-px border-tag-monetary-weak-stroke"},interactive:{true:"ease-expo-out rounded-interactive transition-all duration-snappy",false:"rounded-tag"},size:{xs:"px-2 py-0.5 text-style-tag",sm:"px-3 py-1.5 text-style-tag",lg:"px-5 py-2.5 text-style-tag",unsized:""},disabled:{true:"opacity-25 pointer-events-none",false:""}},compoundVariants:[{disabled:!1,interactive:!0,class:"cursor-pointer active:scale-[0.975]"}],defaultVariants:{variant:"neutralWeak",size:"sm",disabled:!1,interactive:!1}}),WP="https://api.mapbox.com/search/geocode/v6/forward",XP="ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==",YP=p=>atob(p).split("").reverse().join(""),KP=So({features:Jh(os(So({properties:So({mapbox_id:Qr(),place_formatted:tc(Qr()),name_preferred:tc(Qr(),"Untitled location"),coordinates:os(So({latitude:ns(),longitude:ns()}),rs(({latitude:p,longitude:x})=>({lat:p,lng:x})))})}),rs(p=>p.properties)))}),JP=(p,x)=>Array.from(new Map(p.map(T=>[typeof x=="function"?x(T):T[x],T])).values()),QP=async p=>{if(!p)return[];const x=new URL(WP);x.searchParams.set("q",p),x.searchParams.set("proximity","ip"),x.searchParams.set("access_token",YP(XP));const T=await fetch(x);if(!T.ok)throw new Error("Failed to get address details");const C=lg(KP,await T.json());if(C.success===!1)throw console.error(C.issues),new Error("Invalid data");const{features:L}=C.output;return JP(L,k=>k.name_preferred+k.place_formatted)},eD=({onSelect:p,onValueChange:x,coords:T,radius:C,onError:L})=>{const{t:k}=kn(),[j,o]=Ni(""),[re,fe]=Ni(),xe=Lb(j,500),[oe,Ee]=Ni(new AbortController),be=ad(xe,QP,{keepPreviousData:!1,revalidateIfStale:!1,revalidateOnFocus:!1}),{data:Pe,queryState:_e,error:ze}=Qh(be),[Se,st]=Ni("view"),nt=Oi(null);return Ji(()=>{if(Se==="edit"){if(!nt.current)return;nt.current.focus()}},[Se]),ce("div",{class:"relative flex-1",children:[Se==="view"&&T?ce("button",{"aria-label":k("geo_search_placeholder"),type:"button",class:pd({size:"unsized",className:"flex h-10 w-full cursor-text items-stretch px-1 py-1"}),onClick:()=>{st("edit")},children:ce("div",{class:Eu({size:"sm",variant:"accentStrong",interactive:!0,class:"truncate"}),children:re??k("location_provided")})}):ce(GP,{ref:nt,error:ze,query:j,name:"location-search",onQueryChange:o,onFocus:()=>{oe.abort(),Ee(new AbortController)},onBlur:()=>{st("view"),o("")},onItemSelect:Xe=>{if(_e!=="loaded")return;const ct=Pe.find(xt=>xt.mapbox_id===Xe);ct&&(p(ct.coordinates),st("view"),fe(ct.name_preferred))},inputPlaceholder:k("geo_search_placeholder"),items:(Pe==null?void 0:Pe.map(Xe=>({id:Xe.mapbox_id,label:ce("div",{class:"flex min-w-0 max-w-full gap-2 overflow-hidden",children:[ce("strong",{class:"truncate",children:Xe.name_preferred})," ",ce("span",{class:"flex-1 truncate opacity-50",children:Xe.place_formatted})]})})))??[]}),ce("div",{class:"absolute bottom-0 right-0 top-0 flex items-center",children:!j&&!T?ce(ZP,{onLocate:Xe=>{st("view"),fe(k("geo_my_location")),x({type:"provided",coords:Xe,radius:C})},onError:L,signal:oe.signal}):ce("button",{type:"button","aria-label":k("geo_clear_search"),onClick:()=>{o(""),fe(void 0),x({radius:C,type:"provided"}),st("edit"),nt.current&&(nt.current.value="",nt.current.focus())},class:da({variant:"neutral",size:"lg",icon:"only"}),children:ce(Sn,{name:"x"})})})]})},tD=[.25,.5,1,3,5,10,15,20,30,40],iD=20,Ob=p=>p*1609.34,rD=new Intl.NumberFormat(void 0,{style:"unit",unit:"mile",unitDisplay:"long",maximumFractionDigits:1,trailingZeroDisplay:"stripIfInteger"}),nD=os(So({type:Ps("provided"),lat:tc(os(Qr(),rs(Number))),lng:tc(os(Qr(),rs(Number))),radius:os(Qr(),rs(Number))}),rs(p=>({radius:p.radius,type:p.type,coords:p.lat&&p.lng?{lat:p.lat,lng:p.lng}:void 0}))),oD=({value:p,onValueChange:x,logger:T})=>{const{t:C}=kn(),L=dg(),k=(p==null?void 0:p.type)==="provided"?p.radius:Ob(iD),[j,o]=Ni();return ce("div",{class:"flex flex-col gap-2",children:[ce("form",{onChange:re=>{const fe=new FormData(re.currentTarget),xe=lg(nD,Object.fromEntries(fe.entries()));if(!xe.success){T.error(xe.issues),o(xe.issues[0].message);return}x(xe.output)},class:"flex flex-col gap-2 md:flex-row",children:[ce("input",{type:"hidden",name:"type",value:"provided"}),(p==null?void 0:p.type)==="provided"&&p.coords?ce(rr,{children:[ce("input",{type:"hidden",name:"lat",value:p.coords.lat}),ce("input",{type:"hidden",name:"lng",value:p.coords.lng})]}):null,ce(eD,{coords:(p==null?void 0:p.type)==="provided"?p.coords:void 0,radius:k,onValueChange:x,onSelect:re=>{o(void 0),x({type:"provided",radius:k,coords:re})},onError:o}),ce("div",{class:"relative",children:[ce("label",{class:"sr-only",for:L,children:C("geo_range_label")}),ce("select",{id:L,name:"radius",class:pd({size:"unsized",className:"w-full appearance-none truncate py-2 pl-3 pr-10"}),value:k,onChange:re=>{o(void 0),x({type:"provided",coords:(p==null?void 0:p.type)==="provided"?p.coords:void 0,radius:Number(re.currentTarget.value)})},children:tD.map(re=>ce("option",{value:Ob(re),class:"truncate",children:rD.format(re)},re))}),ce("div",{class:"text-copy-neutral-lowcontrast pointer-events-none absolute bottom-0 right-0 top-0 flex w-10 items-center justify-center",children:ce(Sn,{name:"chevron-right",class:"h-6 w-6 rotate-90"})})]})]}),j?ce("div",{role:"alert",class:"text-pretty text-copy-neutral font-style-tag font-weight-tag text-style-tag flex gap-1",children:[ce(Sn,{name:"warning",class:"animate-appear-tag size-[1lh] flex-none"}),j]}):null]})},sD=2,aD=({value:p,onValueChange:x})=>{const[T,C]=Ni(p??""),L=T!==""&&T===p,{t:k}=kn();return Ji(()=>{C(p??"")},[p]),Ji(()=>{let j=T.trim();if(j.length<=sD&&(j=null),j===null){x("");return}const o=setTimeout(()=>{x(j)},300);return()=>clearTimeout(o)},[T,x]),ce("div",{class:"flex flex-col gap-3",children:ce("div",{class:"relative",children:[ce("label",{class:"absolute left-0 flex h-full items-center px-2",for:"ijs-keyword",children:[ce(Sn,{"aria-hidden":!0,title:"Search by keyword",name:"magnifierSimple",class:lu({"text-copy-neutral-icon":!L,"text-copy-accent-icon":L})}),ce("span",{class:"sr-only",children:"Keyword"})]}),ce("input",{autoComplete:"off",autocomplete:"off",name:"keyword",id:"ijs-keyword",type:"search",class:pd({hasValue:L,size:"unsized",class:"peer py-2 pl-10 pr-4"}),placeholder:k("type_to_search_jobs"),value:T,onChange:j=>{C(j.currentTarget.value)}}),ce("button",{type:"button",class:da({variant:"neutral",size:"lg",position:"absolute",class:"bottom-0 right-0 top-0 h-full peer-placeholder-shown:hidden",icon:"only"}),onClick:()=>{C("")},children:ce(Sn,{name:"x"})})]})})},lD=({intervalMs:p,strings:x,class:T})=>{const[C,L]=Ni(0),[k,j]=Ni(!0),o=[...x,x[0]];return Ji(()=>{C===o.length&&(j(!1),L(0));const re=setTimeout(()=>{j(!0),L(fe=>fe+1)},p);return()=>clearTimeout(re)},[C,o.length,p]),ce("div",{className:lu("relative h-full w-full overflow-hidden",T),children:ce("div",{className:lu("absolute w-full",{"transition-transform duration-500 ease-in-out":k}),style:{height:`${100*o.length}%`,transform:`translateY(-${C*(100/o.length)}%)`},children:o.map((re,fe)=>ce("div",{className:"flex items-center whitespace-nowrap",style:{height:`${100/o.length}%`},children:re},fe))})})},cD=(p,x)=>{Ji(()=>{const T=C=>{document.activeElement===p.current&&x(C)};return document.addEventListener("selectionchange",T),()=>document.removeEventListener("selectionchange",T)},[p,x])},Fb=3,uD=({value:p,onValueChange:x,options:T})=>{const[C,L]=Ni(p??""),k=C.trim(),j=k!==""&&k===p,{t:o}=kn(),re=k.split("");Ji(()=>{L(p??"")},[p]);const[fe,xe]=Ni(0),oe=Oi(null);return cD(oe,Ee=>{Ee.target instanceof HTMLInputElement&&xe(Ee.target.scrollLeft)}),Ji(()=>{let Ee=C.trim();if(Ee.length<=Fb&&(Ee=null),Ee===null){x("");return}const be=setTimeout(()=>{x(Ee.trim())},1e3);return()=>clearTimeout(be)},[C,x]),ce("div",{class:"mb-2 flex flex-col gap-2",children:[ce("div",{class:"relative",children:[ce("label",{class:"absolute left-0 flex h-full items-center px-2",for:"ijs-keyword",children:[ce(Sn,{"aria-hidden":!0,title:"Search by keyword",name:"ai",class:lu("duration-snappy transition-transform",{"text-copy-neutral-icon scale-90":!j,"text-copy-accent-icon":j})}),ce("span",{class:"sr-only",children:"Keyword"})]}),ce("input",{ref:oe,autoComplete:"off",autocomplete:"off",name:"keyword",id:"ijs-keyword",type:"text",placeholder:T!=null&&T.suggestions?T.suggestions.join(", "):" ",class:pd({hasValue:j,size:"unsized",class:"peer px-10 py-2 tracking-tight !text-transparent placeholder:!text-transparent"}),style:{fontKerning:"none"},value:C,onChange:Ee=>{const be=Ee.currentTarget.value.trim();L(be)},onKeyDown:Ee=>{if(Ee.key==="Enter"){if(Ee.currentTarget.value.trim().length<=Fb)return;Ee.preventDefault(),x(C)}}}),ce("div",{"data-synced":j,class:"font-weight-input text-copy-neutral group pointer-events-none absolute inset-x-10 inset-y-0 flex overflow-hidden tracking-tight peer-placeholder-shown:right-0",children:k.length>0?ce("div",{"aria-hidden":!0,class:"flex items-center whitespace-nowrap",style:{transform:`translateX(${-fe}px)`},children:re.map((Ee,be)=>ce("span",{style:{animationDelay:`${be*300/re.length}ms`},class:"group-data-[synced=true]:animate-ai-letter inline-block",children:Ee===" "?" ":Ee},k+be))}):T!=null&&T.suggestions?ce(lD,{intervalMs:2e3,strings:T.suggestions,class:"opacity-30","aria-hidden":!0}):null}),ce("button",{type:"button",class:da({variant:"neutral",size:"lg",position:"absolute",class:"bottom-0 right-0 top-0 h-full peer-placeholder-shown:hidden",icon:"only"}),onClick:()=>{L(""),x("")},children:ce(Sn,{name:"x"})})]}),ce("p",{class:"font-family-default text-balance font-style-default text-style-job-card-info text-copy-neutral-lowcontrast",children:o("ai_disclaimer")})]})};var hD=Array.isArray,_y=hD,dD=_y,pD=Hf,fD=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mD=/^\w*$/;function _D(p,x){if(dD(p))return!1;var T=typeof p;return T=="number"||T=="symbol"||T=="boolean"||p==null||pD(p)?!0:mD.test(p)||!fD.test(p)||x!=null&&p in Object(x)}var gD=_D,yD=Pb,vD=$f,xD="[object AsyncFunction]",bD="[object Function]",wD="[object GeneratorFunction]",TD="[object Proxy]";function SD(p){if(!vD(p))return!1;var x=yD(p);return x==bD||x==wD||x==xD||x==TD}var ED=SD,AD=Gf,ID=AD["__core-js_shared__"],CD=ID,gy=CD,Bb=function(){var p=/[^.]+$/.exec(gy&&gy.keys&&gy.keys.IE_PROTO||"");return p?"Symbol(src)_1."+p:""}();function MD(p){return!!Bb&&Bb in p}var PD=MD,DD=Function.prototype,RD=DD.toString;function zD(p){if(p!=null){try{return RD.call(p)}catch{}try{return p+""}catch{}}return""}var LD=zD,kD=ED,OD=PD,FD=$f,BD=LD,ND=/[\\^$.*+?()[\]{}|]/g,jD=/^\[object .+?Constructor\]$/,VD=Function.prototype,UD=Object.prototype,$D=VD.toString,GD=UD.hasOwnProperty,HD=RegExp("^"+$D.call(GD).replace(ND,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qD(p){if(!FD(p)||OD(p))return!1;var x=kD(p)?HD:jD;return x.test(BD(p))}var ZD=qD;function WD(p,x){return p==null?void 0:p[x]}var XD=WD,YD=ZD,KD=XD;function JD(p,x){var T=KD(p,x);return YD(T)?T:void 0}var Nb=JD,QD=Nb,eR=QD(Object,"create"),qf=eR,jb=qf;function tR(){this.__data__=jb?jb(null):{},this.size=0}var iR=tR;function rR(p){var x=this.has(p)&&delete this.__data__[p];return this.size-=x?1:0,x}var nR=rR,oR=qf,sR="__lodash_hash_undefined__",aR=Object.prototype,lR=aR.hasOwnProperty;function cR(p){var x=this.__data__;if(oR){var T=x[p];return T===sR?void 0:T}return lR.call(x,p)?x[p]:void 0}var uR=cR,hR=qf,dR=Object.prototype,pR=dR.hasOwnProperty;function fR(p){var x=this.__data__;return hR?x[p]!==void 0:pR.call(x,p)}var mR=fR,_R=qf,gR="__lodash_hash_undefined__";function yR(p,x){var T=this.__data__;return this.size+=this.has(p)?0:1,T[p]=_R&&x===void 0?gR:x,this}var vR=yR,xR=iR,bR=nR,wR=uR,TR=mR,SR=vR;function Au(p){var x=-1,T=p==null?0:p.length;for(this.clear();++x<T;){var C=p[x];this.set(C[0],C[1])}}Au.prototype.clear=xR,Au.prototype.delete=bR,Au.prototype.get=wR,Au.prototype.has=TR,Au.prototype.set=SR;var ER=Au;function AR(){this.__data__=[],this.size=0}var IR=AR;function CR(p,x){return p===x||p!==p&&x!==x}var MR=CR,PR=MR;function DR(p,x){for(var T=p.length;T--;)if(PR(p[T][0],x))return T;return-1}var Zf=DR,RR=Zf,zR=Array.prototype,LR=zR.splice;function kR(p){var x=this.__data__,T=RR(x,p);if(T<0)return!1;var C=x.length-1;return T==C?x.pop():LR.call(x,T,1),--this.size,!0}var OR=kR,FR=Zf;function BR(p){var x=this.__data__,T=FR(x,p);return T<0?void 0:x[T][1]}var NR=BR,jR=Zf;function VR(p){return jR(this.__data__,p)>-1}var UR=VR,$R=Zf;function GR(p,x){var T=this.__data__,C=$R(T,p);return C<0?(++this.size,T.push([p,x])):T[C][1]=x,this}var HR=GR,qR=IR,ZR=OR,WR=NR,XR=UR,YR=HR;function Iu(p){var x=-1,T=p==null?0:p.length;for(this.clear();++x<T;){var C=p[x];this.set(C[0],C[1])}}Iu.prototype.clear=qR,Iu.prototype.delete=ZR,Iu.prototype.get=WR,Iu.prototype.has=XR,Iu.prototype.set=YR;var KR=Iu,JR=Nb,QR=Gf,ez=JR(QR,"Map"),tz=ez,Vb=ER,iz=KR,rz=tz;function nz(){this.size=0,this.__data__={hash:new Vb,map:new(rz||iz),string:new Vb}}var oz=nz;function sz(p){var x=typeof p;return x=="string"||x=="number"||x=="symbol"||x=="boolean"?p!=="__proto__":p===null}var az=sz,lz=az;function cz(p,x){var T=p.__data__;return lz(x)?T[typeof x=="string"?"string":"hash"]:T.map}var Wf=cz,uz=Wf;function hz(p){var x=uz(this,p).delete(p);return this.size-=x?1:0,x}var dz=hz,pz=Wf;function fz(p){return pz(this,p).get(p)}var mz=fz,_z=Wf;function gz(p){return _z(this,p).has(p)}var yz=gz,vz=Wf;function xz(p,x){var T=vz(this,p),C=T.size;return T.set(p,x),this.size+=T.size==C?0:1,this}var bz=xz,wz=oz,Tz=dz,Sz=mz,Ez=yz,Az=bz;function Cu(p){var x=-1,T=p==null?0:p.length;for(this.clear();++x<T;){var C=p[x];this.set(C[0],C[1])}}Cu.prototype.clear=wz,Cu.prototype.delete=Tz,Cu.prototype.get=Sz,Cu.prototype.has=Ez,Cu.prototype.set=Az;var Iz=Cu,Ub=Iz,Cz="Expected a function";function yy(p,x){if(typeof p!="function"||x!=null&&typeof x!="function")throw new TypeError(Cz);var T=function(){var C=arguments,L=x?x.apply(this,C):C[0],k=T.cache;if(k.has(L))return k.get(L);var j=p.apply(this,C);return T.cache=k.set(L,j)||k,j};return T.cache=new(yy.Cache||Ub),T}yy.Cache=Ub;var Mz=yy,Pz=Mz,Dz=500;function Rz(p){var x=Pz(p,function(C){return T.size===Dz&&T.clear(),C}),T=x.cache;return x}var zz=Rz,Lz=zz,kz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Oz=/\\(\\)?/g,Fz=Lz(function(p){var x=[];return p.charCodeAt(0)===46&&x.push(""),p.replace(kz,function(T,C,L,k){x.push(L?k.replace(Oz,"$1"):C||T)}),x}),Bz=Fz;function Nz(p,x){for(var T=-1,C=p==null?0:p.length,L=Array(C);++T<C;)L[T]=x(p[T],T,p);return L}var jz=Nz,$b=fy,Vz=jz,Uz=_y,$z=Hf,Gz=1/0,Gb=$b?$b.prototype:void 0,Hb=Gb?Gb.toString:void 0;function qb(p){if(typeof p=="string")return p;if(Uz(p))return Vz(p,qb)+"";if($z(p))return Hb?Hb.call(p):"";var x=p+"";return x=="0"&&1/p==-Gz?"-0":x}var Hz=qb,qz=Hz;function Zz(p){return p==null?"":qz(p)}var Wz=Zz,Xz=_y,Yz=gD,Kz=Bz,Jz=Wz;function Qz(p,x){return Xz(p)?p:Yz(p,x)?[p]:Kz(Jz(p))}var eL=Qz,tL=Hf,iL=1/0;function rL(p){if(typeof p=="string"||tL(p))return p;var x=p+"";return x=="0"&&1/p==-iL?"-0":x}var nL=rL,oL=eL,sL=nL;function aL(p,x){x=oL(x,p);for(var T=0,C=x.length;p!=null&&T<C;)p=p[sL(x[T++])];return T&&T==C?p:void 0}var lL=aL,cL=lL;function uL(p,x,T){var C=p==null?void 0:cL(p,x);return C===void 0?T:C}var hL=uL;const dL=Ig(hL),md=({chars:p})=>ce("span",{style:{width:p+"ch"},class:"rounded-job-tag block h-[1lh] min-h-[1em] bg-[currentColor] opacity-25"}),Zb=Vo({base:"ijs-job relative rounded-job-card bg-job-card-bg ring-width-job-card ring-job-card-stroke flex gap-4 fr ease-expo-out min-w-0 p-4 transition-all duration-medium",variants:{interactive:{true:"active:bg-job-card-bg-active active:ring-job-card-stroke-active hover:bg-job-card-bg-active hover:ring-job-card-stroke-active active:scale-[0.975]",false:"animate-skeleton"}},defaultVariants:{interactive:!0}}),pL=Vo({base:"font-style-job-heading font-weight-job-heading text-copy-neutral font-family-job-heading text-pretty",variants:{size:{sm:"text-style-filter",default:"text-style-job-heading"}},defaultVariants:{size:"default"}}),vy=({job:p,property:x})=>{if(!x)return null;const T=dL(p.raw,x.key);return x.transform?x.transform(T):T},fL=({job:p,config:x="hidden"})=>x==="hidden"?null:ce("div",{class:"rounded-logo h-12 flex-none overflow-hidden",style:{aspectRatio:x.replace(":","/")},children:p.company.logo?ce("img",{src:p.company.logo,alt:p.company.name,class:"h-full w-full select-none object-contain [-webkit-user-drag:none]"}):null}),Wb=p=>Array.isArray(p)?p:[p],mL=1e3*60*60*24,Xb=({job:p,config:x,onJobClick:T,size:C})=>{var be,Pe,_e;const{t:L}=kn(),k=x.subheading?vy({job:p,property:x.subheading}):null,j=x.infoTags.flatMap(ze=>Wb(vy({job:p,property:ze}))).filter(Boolean),o=Wb((be=x.overrides)!=null&&be.salary?vy({job:p,property:x.overrides.salary}):p.pay).filter(Boolean),re=x.postedDate??"show",fe=(Pe=x.overrides)!=null&&Pe.baseUrl?x.overrides.baseUrl(p.id.toString()):p.href,xe=x.newUnderDays??7,oe=p.createdAt?new Date(p.createdAt).getTime()>Date.now()-xe*mL:!1,Ee=ze=>{var Se,st;T==null||T(p),(st=(Se=x.overrides)==null?void 0:Se.onClick)==null||st.call(Se,ze)};return ce("a",{onMouseEnter:(_e=x.overrides)==null?void 0:_e.onMouseEnter,onClick:Ee,href:fe,target:x.openJob==="redirect-new-tab"?"_blank":void 0,class:Zb(),children:[ce("div",{class:"flex min-w-0 flex-1 flex-col gap-4",children:[ce("div",{class:"gap-logo flex items-center",children:[ce(fL,{job:p,config:C!=="sm"?x.logo:void 0}),ce("div",{class:"flex flex-col items-start gap-1",children:[ce("div",{class:"order-2 flex flex-col gap-1",children:[p.match?ce("p",{class:"text-style-job-card text-tag-accent-strong-bg flex items-center ",children:[ce(Sn,{name:"ai",class:"size-4 inline-block"}),ce("span",{children:p.match})]}):null,ce("p",{class:pL({size:C}),children:[p.title.trim(),oe&&re!=="hide"&&ce(rr,{children:[" ",ce("span",{"aria-hidden":!0,class:"ring-px ring-tag-accent-strong-bg rounded-job-card text-tag-accent-strong-bg font-weight-tag not-sr-only order-1 inline-block px-2 py-1 align-middle text-[10px] leading-none",children:L("new")})]})]}),k?ce("p",{class:"text-style-job-card text-copy-neutral-lowcontrast",children:k}):null]}),re==="show"?ce("p",{class:"text-style-job-card-info text-copy-job-info order-1",children:[L("posted")," ",p.relativePostedDate]}):null]})]}),ce("div",{class:"flex min-w-0 flex-col items-start gap-2",children:[ce("div",{class:"flex min-w-0 max-w-full flex-wrap items-center gap-2",children:o.map((ze,Se)=>ce("span",{class:Eu({variant:"monetaryWeak",size:"xs"}),children:ze},Se))}),j.length>0&&ce("ul",{class:"flex min-w-0 max-w-full flex-wrap items-center gap-2",children:j.map(ze=>ce("li",{class:Eu({size:"xs",class:"max-w-full truncate"}),children:ze},ze))})]})]}),C==="sm"?ce("div",{"aria-hidden":!0,class:"absolute right-1 top-1/2 -translate-y-1/2 transform",children:ce(Sn,{name:"chevron-right",class:"size-5 text-copy-neutral-icon"})}):ce("div",{"aria-hidden":!0,class:"flex items-center",children:ce(Sn,{name:"chevron-right",class:"text-copy-neutral-icon"})})]})},xy=({config:p,animationDelay:x,seed:T})=>{const C=p.logo??"hidden",L=p.postedDate??"show";return ce("div",{"aria-hidden":!0,style:{animationDelay:x+"s"},class:Zb({interactive:!1}),children:[ce("div",{class:"flex flex-1 flex-col gap-4",children:[ce("div",{class:"flex items-center gap-4",children:[C==="hidden"?null:ce("div",{class:"rounded-logo bg-copy-neutral h-12 opacity-25",style:{aspectRatio:C.replace(":","/")}}),ce("div",{class:"flex flex-col items-start gap-1",children:[L==="show"?ce("p",{class:"text-style-job-card-info text-copy-job-info",children:ce(md,{chars:12})}):null,ce("div",{class:"flex flex-col gap-1",children:[ce("p",{class:"text-style-job-heading font-style-job-heading font-weight-job-heading text-copy-neutral font-family-job-heading",children:ce(md,{chars:13+(T+5)*T%7})}),p.subheading!==null?ce("p",{class:"text-style-job-card text-copy-neutral-lowcontrast",children:ce(md,{chars:7+T*T%3})}):null]})]})]}),ce("div",{class:"flex flex-col items-start gap-2",children:[T%2===0&&ce("span",{class:Eu({variant:"neutralWeak",size:"xs",class:"h-[1lh] min-h-[1em] w-[10ch]"})}),ce("div",{class:"flex items-center gap-2",children:[ce("span",{class:Eu({variant:"neutralWeak",size:"xs",class:"h-[1lh] min-h-[1em] w-[6ch]"})}),ce("span",{class:Eu({variant:"neutralWeak",size:"xs",class:"h-[1lh] min-h-[1em] w-[8ch]"})})]})]})]}),ce("div",{"aria-hidden":!0,class:"flex items-center",children:ce(Sn,{name:"chevron-right",class:"text-copy-neutral-icon"})})]})},_L=({state:p,fetchNextPage:x,config:T,remainingItems:C})=>{const{t:L}=kn(),k=Math.min(ic,C);return p==="revalidating"?ce("ul",{class:"flex flex-col gap-3","aria-hidden":!0,children:Array.from({length:ic}).map((j,o)=>ce("li",{children:ce(xy,{seed:o,animationDelay:(o-4)*.1,config:T})},o))}):ce("button",{type:"button",class:da({variant:"neutral",class:"w-full max-w-[45rem] self-center py-2"}),onClick:x,children:[L("load_more_count",{count:k})," ",L("of_remaining_count",{count:C})]})},gL=({state:p,rpcClient:x,jobCardConfig:T,initialData:C,onResultsUpdate:L,onJobClick:k,onPaginate:j,mode:o,afterResults:re})=>ce(rr,{children:Array.from({length:p.page}).map((fe,xe)=>{const oe=xe===p.page-1;return ce(ed,{Fallback:Xa,children:ce(yL,{state:p,rpcClient:x,page:xe+1,isFirst:xe===0,isLast:oe,fetchNextPage:()=>{j(p.page+1)},jobCardConfig:T,initialData:C,onResultsUpdate:L,onJobClick:k,mode:o,afterResults:re},xe)},xe)})}),Yb=({page:p})=>{const{t:x}=kn();return ce("div",{"aria-hidden":!0,class:"text-copy-neutral-lowcontrast mx-auto flex w-full max-w-[45rem] gap-2 py-4",onClick:T=>{T.preventDefault()},children:[ce("span",{class:"bg-wavy bg-neutral-3 flex-1 opacity-10"}),ce("span",{class:"text-style-tag justify-center text-center",children:[x("page")," ",p]}),ce("span",{class:"bg-wavy bg-neutral-3 flex-1 opacity-10"})]})},yL=({state:p,rpcClient:x,page:T,isFirst:C,isLast:L,fetchNextPage:k,jobCardConfig:j,initialData:o,onResultsUpdate:re,onJobClick:fe,afterResults:xe})=>{const{t:oe}=kn(),Ee=T===1?o:void 0,{data:be,error:Pe,queryState:_e,swr:ze}=Qh(ad($g({state:p,baseKey:T.toString()}),()=>ex({rpcClient:x,state:p,page:T,t:oe}),{...mf,fallbackData:Ee}));switch(Ji(()=>{be&&C&&re&&re({totalCount:be.pagination.total})},[be,C,re]),_e){case"idle":return null;case"loading":return ce(rr,{children:[C?ce("div",{class:"flex w-full max-w-[45rem] items-center gap-2 self-center",children:[ce("div",{class:"flex-1"}),ce("p",{class:"animate-skeleton text-copy-neutral-lowcontrast text-style-tag m-0 justify-center p-0 text-center",children:ce(md,{chars:8})}),ce("div",{class:"flex flex-1 justify-end",children:xe})]}):ce(Yb,{page:T}),ce("ul",{class:"flex w-full max-w-[45rem] flex-col gap-3 self-center","aria-hidden":!0,children:Array.from({length:ic}).map((Se,st)=>ce("li",{children:ce(xy,{seed:st,animationDelay:(st-ic)*.1,config:j})},st))})]});case"error":return ce(Xa,{error:new Error(oe("jobs_loading_error"),{cause:Pe}),resetError:()=>ze.mutate()});case"revalidating":case"loaded":{if(Cs(be.pagination.current_page===T,"Received wrong page from server"),be.pagination.total===0)return ce("div",{class:"mx-auto flex flex-col items-center gap-2 px-2 py-4 text-center",children:[ce(Sn,{"aria-hidden":!0,name:"magnifier",class:"text-copy-neutral-lowcontrast"}),ce("div",{class:"flex flex-col items-center gap-1",children:[ce("p",{class:"text-copy-neutral text-style-job-heading",children:oe("no_jobs_found")}),ce("p",{class:"text-copy-neutral-lowcontrast text-style-tag [text-wrap:pretty]",children:oe("no_jobs_found_description")})]})]});const Se=be.pagination.last_page!==be.pagination.current_page,st=T*ic,nt=Math.max(be.pagination.total-st,0),Xe=ct=>{fe(ct,T)};return ce(rr,{children:[C?ce("div",{class:"flex w-full max-w-[45rem] items-center gap-2 self-center",children:[ce("div",{class:"flex-1"}),ce("p",{class:"text-copy-neutral-lowcontrast text-style-tag m-0 justify-center p-0 text-center",children:oe("jobs_found",{count:be.pagination.total})}),ce("div",{class:"flex flex-1 justify-end",children:xe})]}):ce(Yb,{page:T}),ce("ul",{"aria-label":`Page ${T}`,class:"flex w-full max-w-[45rem] flex-col gap-3 self-center",children:be.results.map(ct=>ce("li",{class:"ease-expo-out duration-slow transition-opacity",style:{opacity:_e==="revalidating"?.33:1},children:ce(Xb,{job:ct,onJobClick:Xe,config:j})},ct.id))}),Se&&L&&ce(_L,{state:_e,fetchNextPage:k,config:j,remainingItems:nt})]})}default:No(_e)}},vL=Sg(()=>Promise.resolve().then(()=>ML).then(p=>p.Map)),xL=({state:p,rpcClient:x,mapConfig:T,onGeoChange:C,afterResults:L,onJobClick:k,jobCardConfig:j})=>{var Pe,_e;const{t:o}=kn(),[re,fe]=Ni(new AbortController),xe=_x("(max-width: 767px)"),oe=Ur(ze=>{C(ze),re.abort(),fe(new AbortController)},[C,re]),Ee=Qh(ad(["map",p],()=>IE({rpcClient:x,state:p,t:o,signal:re.signal}),mf));if(Ee.queryState==="error")return ce(Xa,{error:new Error(o("jobs_loading_error"),{cause:Ee.error}),resetError:()=>Ee.swr.mutate()});const be=Ee.queryState==="loaded"||Ee.queryState==="revalidating";return ce(rr,{children:[ce("div",{class:"flex items-center gap-2",children:[ce("div",{class:"flex-1"}),ce("p",{class:"text-copy-neutral-lowcontrast text-style-tag m-0 justify-center p-0 text-center",children:be?Ee.data.results.length!==0&&o("map_jobs_showing",{count:Ee.data.results.length}):ce("div",{class:"animate-skeleton",children:ce(md,{chars:8})})}),ce("div",{class:"flex flex-1 justify-end",children:L})]}),ce("div",{class:"theme-fill:bg-neutral-2 theme-stroke:bg-lowest ring-px theme-fill:ring-neutral-3 theme-stroke:ring-neutral-3 theme-soft:rounded-lg theme-rounded:rounded-xl relative flex h-auto flex-col items-stretch overflow-hidden md:h-[70svh] md:flex-row",children:[ce("div",{class:"md:min-w-80 aspect-square flex-1 md:order-2 md:aspect-auto",children:be?ce(hu,{fallback:ce("div",{class:"animate-skeleton bg-neutral-6 h-full w-full"}),children:ce(vL,{config:T,mapData:Ee,autoFit:((Pe=p.geo)==null?void 0:Pe.type)!=="bounds",onBoundsChange:oe})}):ce("div",{class:"animate-skeleton bg-neutral-6 h-full w-full"})}),ce("ul",{class:"flex h-full w-full snap-x snap-proximity scroll-px-4 gap-3 overflow-auto p-4 md:order-1 md:max-w-xl md:flex-col",children:[((_e=Ee.data)==null?void 0:_e.results.length)===0?ce("div",{class:"mx-auto flex h-full w-full flex-col items-center justify-center gap-2 text-center",children:[ce(Sn,{"aria-hidden":!0,name:"magnifier",class:"text-copy-neutral-lowcontrast"}),ce("div",{class:"flex flex-col items-center gap-1",children:[ce("p",{class:"text-copy-neutral text-style-job-heading",children:o("no_jobs_found")}),ce("p",{class:"text-copy-neutral-lowcontrast text-style-tag [text-wrap:pretty]",children:o("no_jobs_found_description")})]})]}):null,be?Ee.data.results.map(ze=>ce("li",{class:"ease-expo-out duration-slow min-w-[calc(100%-1rem)] snap-start transition-opacity",style:{opacity:Ee.queryState==="revalidating"?.33:1},children:ce(Xb,{job:ze,onJobClick:Se=>k(Se,1),config:j,size:xe?"sm":void 0})},ze.id)):Array.from({length:6}).map((ze,Se)=>ce("li",{children:ce(xy,{seed:Se,animationDelay:(Se-6)*.1,config:j})},Se))]})]})]})},Kb=Vo({base:"flex items-center justify-center cursor-pointer text-style-tag rounded-interactive active:scale-95 transition-all duration-snappy pl-2 pr-2.5 py-1.5 gap-1",variants:{active:{true:"bg-lowest text-neutral-12 shadow-sm animate-appear-tag",false:"text-neutral-10 hover:text-neutral-12"}},defaultVariants:{active:!1}}),bL=({value:p,onValueChange:x})=>{const{t:T}=kn();return ce("div",{class:"bg-neutral-3 rounded-interactive ring-neutral-3 mr-[3px] inline-flex ring-[3px]",children:[ce("button",{type:"button","aria-pressed":p==="list",class:Kb({active:p==="list"}),onClick:()=>x("list"),children:[ce(Sn,{name:"list",class:"size-5"}),ce("span",{children:T("list")})]}),ce("button",{type:"button","aria-pressed":p==="map",class:Kb({active:p==="map"}),onClick:()=>x("map"),children:[ce(Sn,{name:"map",class:"size-5"}),ce("span",{children:T("map")})]})]})},wL=p=>{const x=p.state.view,T=p.mapConfig&&p.mapConfig.enabled?ce(bL,{value:x,onValueChange:p.onViewChange}):null;return x==="list"?ce(gL,{afterResults:T,...p}):ce(xL,{...p,afterResults:T})},by=(p,x="value")=>p.reduce((T,C)=>{switch(C.select){case"one":{const L=C.value??C[x],k=typeof L=="string"?L:L==null?void 0:L[0];T[C.key]={select:C.select,value:k};break}case"many":{const L=C.value??C[x],k=typeof L=="string"?[L]:Array.isArray(L)?L:[];T[C.key]={select:C.select,value:k};break}default:No(C.select)}return T},{}),Mu=p=>Object.fromEntries(Object.entries(p).map(([x,T])=>{const C=T==null?void 0:T.value;return[x,Array.isArray(C)?C:C?[C]:[]]}).filter(([,x])=>x!==void 0&&x.length>0)),Jb=p=>(p==null?void 0:p.type)==="bounds"?void 0:p,TL=({rpcClient:p,logger:x,properties:T,analytics:C,initialData:L,onStateChange:k,params:j})=>{var $t,kt,Wt,Ai,mi;const{t:o}=kn(),re=Oi(null),fe=Pn(()=>by(T,"defaultValue"),[T]),[xe,oe]=Ni(!0),[Ee,be]=Ni(()=>typeof j.initialState=="function"?j.initialState(j):j.initialState),[Pe,_e]=Ni(0),{onJobClick:ze,analyticsPaginate:Se}=SL({appRef:re,analytics:C,state:Ee,hasInteracted:!xe,totalCount:Pe,defaultFilters:fe}),st=Ur(bi=>{be(Jt=>{if(Jt.page===bi)return Jt;const Bt={...Jt,page:bi};return k==null||k(Bt),Bt}),Se(bi)},[Se,k]),nt=Ur(bi=>{be(Jt=>{const Bt={...Jt,view:bi};return k==null||k(Bt),Bt})},[k]),Xe=Ur(bi=>{be(Jt=>{var ri;if(!Jt.query&&!bi||Jt.query===bi)return Jt;oe(!1);const Bt=Jb(Jt.geo),vi={...Jt,query:bi,geo:Bt,page:1,mode:(ri=j.naturalLanguageSearch)!=null&&ri.enabled?"vector":"query"};return k==null||k(vi),vi})},[k,($t=j.naturalLanguageSearch)==null?void 0:$t.enabled]),ct=Ur(bi=>{oe(!1),be(Jt=>{const Bt={...Jt,geo:bi};return k==null||k(Bt),Bt})},[k]),xt=Ur(()=>{be(bi=>{const Jt={...bi,filters:by(T,"defaultValue"),query:"",geo:void 0,page:1};return k==null||k(Jt),Jt})},[k,T]);return ce("div",{ref:re,class:lu("ijs-app font-family-default font-weight-default font-style-default flex min-h-screen flex-col gap-4",{"reduce-motion":(kt=j.theme.accessibility)==null?void 0:kt.reducedMotion},bg(j.theme)),children:[ce(ed,{Fallback:Xa,children:ce("div",{class:"flex flex-col gap-2",children:[ce("div",{class:"px-4",children:ce("div",{class:"bg-section-strong-bg ring-section-weak-stroke rounded-section ring-px lg:ring-width-section flex flex-col gap-4 p-4 md:flex-row",children:[ce("section",{class:"flex flex-1 flex-col gap-1",children:[ce("p",{class:"text-style-filter text-copy-neutral font-style-filter font-weight-filter",children:o("search_label")}),(Wt=j.naturalLanguageSearch)!=null&&Wt.enabled?ce(uD,{value:Ee.query,onValueChange:Xe,options:j.naturalLanguageSearch}):j.enableKeywordSearch?ce(aD,{value:Ee.query,onValueChange:Xe}):null]}),(Ai=j.geolocation)!=null&&Ai.enabled?ce("section",{class:"flex flex-1 flex-col gap-1",children:[ce("p",{class:"text-style-filter text-copy-neutral font-style-filter font-weight-filter",children:o("geo_label")}),ce(oD,{value:Ee.geo,onValueChange:bi=>{oe(!1),be(Jt=>{const Bt={...Jt,geo:bi,page:1};return k==null||k(Bt),Bt}),Se(1)},logger:x})]}):null]})}),ce(HM,{state:Ee,onFilterValueChange:(bi,Jt)=>{oe(!1),be(Bt=>{const vi={...Bt.filters,[bi]:Jt},ri=Jb(Bt.geo),ui={...Bt,filters:vi,geo:ri,page:1};return k==null||k(ui),ui}),Se(1)},onResetFilters:xt,properties:T,rpcClient:p,alerts:j.alerts,theme:j.theme,widgetId:j.widgetId})]})}),ce("section",{class:"flex flex-col gap-4 overflow-hidden px-4 py-4",children:[ce(ed,{Fallback:Xa,children:ce(wL,{state:Ee,rpcClient:p,jobCardConfig:j.jobCard,mapConfig:j.map,initialData:xe?L==null?void 0:L.jobs:void 0,onResultsUpdate:bi=>{_e(bi.totalCount)},onJobClick:ze,onPaginate:st,mode:(mi=j.naturalLanguageSearch)!=null&&mi.enabled?"vector":"query",onGeoChange:ct,onViewChange:nt})}),j.feedback?ce("div",{class:"flex flex-wrap items-center justify-center gap-2",children:[ce("p",{class:"font-family-default text-balance font-style-default text-style-job-card-info text-copy-neutral-lowcontrast",children:o("feedback")}),ce("div",{"data-widget":"inploi-feedback","data-key":"job-search",children:ce("div",{class:"rounded-job-card bg-neutral-2 h-8 w-[72px] animate-pulse"})})]}):null]})]})},SL=({appRef:p,analytics:x,state:T,defaultFilters:C,totalCount:L,hasInteracted:k})=>{const j=Ur((fe=1)=>({query:T.query,mode:T.mode,filters:Mu(T.filters),default_filters:Mu(C),total_count:L,page_size:ic,page:fe}),[T.query,T.mode,T.filters,C,L]);return jE(p,{minViewTime:2e3,onView:()=>{x.log({event:"VIEW_SEARCH",properties:j()})}}),Ji(()=>{const fe=window.setTimeout(()=>{k&&(!T.query&&!Object.keys(Mu(T.filters)).length||L!==0&&x.log({event:"SEARCH_SETTLE",properties:j()}))},5e3);return()=>{clearTimeout(fe)}},[x,k,j,L,T.query,T.filters]),{onJobClick:(fe,xe)=>{x.log({event:"SEARCH_JOB_CLICK",properties:{job_id:fe.id,...j(xe)}})},analyticsPaginate:fe=>{x.log({event:"SEARCH_PAGINATE",properties:j(fe)})}}},EL=`.inploi-job-search{font-size:16px;--tw-content: ""}.inploi-job-search *{box-sizing:border-box;border-style:solid;border-width:0;-webkit-tap-highlight-color:transparent;font-family:inherit;font-style:inherit;font-weight:inherit}.inploi-job-search :before,.inploi-job-search :after{box-sizing:border-box}.inploi-job-search :is(a){text-decoration:none}.inploi-job-search :is(ul,ol){list-style:none;padding:0;margin:0}.inploi-job-search :is(p){margin:0;padding:0}.inploi-job-search :is(li){margin:0;padding:0;list-style:none}.inploi-job-search :is(button),.inploi-job-search :is(a){display:block;margin:0;padding:0;border:unset;background:unset;text-align:unset}.inploi-job-search :is(input),.inploi-job-search :is(textarea){display:block;margin:0;padding:0;min-width:0;max-width:unset;width:100%}.inploi-job-search :is(svg){display:block}.inploi-job-search :is(button){touch-action:manipulation}.inploi-job-search input[type=search]::-webkit-search-decoration,.inploi-job-search input[type=search]::-webkit-search-cancel-button,.inploi-job-search input[type=search]::-webkit-search-results-button,.inploi-job-search input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}@media (prefers-reduced-motion){.inploi-job-search *{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important;animation-delay:0s!important}}.inploi-job-search *,.inploi-job-search :before,.inploi-job-search :after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.inploi-job-search ::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.inploi-job-search .container{width:100%}@media (min-width: 640px){.inploi-job-search .container{max-width:640px}}@media (min-width: 768px){.inploi-job-search .container{max-width:768px}}@media (min-width: 1024px){.inploi-job-search .container{max-width:1024px}}@media (min-width: 1280px){.inploi-job-search .container{max-width:1280px}}@media (min-width: 1536px){.inploi-job-search .container{max-width:1536px}}.inploi-job-search .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.inploi-job-search .not-sr-only{position:static;width:auto;height:auto;padding:0;margin:0;overflow:visible;clip:auto;white-space:normal}.inploi-job-search .pointer-events-none{pointer-events:none}.inploi-job-search .visible{visibility:visible}.inploi-job-search .invisible{visibility:hidden}.inploi-job-search .collapse{visibility:collapse}.inploi-job-search .static{position:static}.inploi-job-search .fixed{position:fixed}.inploi-job-search .absolute{position:absolute}.inploi-job-search .relative{position:relative}.inploi-job-search .sticky{position:sticky}.inploi-job-search .inset-0{top:0;right:0;bottom:0;left:0}.inploi-job-search .inset-x-10{left:2.5rem;right:2.5rem}.inploi-job-search .inset-y-0{top:0;bottom:0}.inploi-job-search .-right-1{right:-.25rem}.inploi-job-search .-top-1{top:-.25rem}.inploi-job-search .bottom-0{bottom:0}.inploi-job-search .left-0{left:0}.inploi-job-search .left-12{left:3rem}.inploi-job-search .right-0{right:0}.inploi-job-search .right-1{right:.25rem}.inploi-job-search .right-12{right:3rem}.inploi-job-search .top-0{top:0}.inploi-job-search .top-1\\/2{top:50%}.inploi-job-search .top-12{top:3rem}.inploi-job-search .top-2{top:.5rem}.inploi-job-search .isolate{isolation:isolate}.inploi-job-search .z-50{z-index:50}.inploi-job-search .order-1{order:1}.inploi-job-search .order-2{order:2}.inploi-job-search .m-0{margin:0}.inploi-job-search .m-1{margin:.25rem}.inploi-job-search .m-10{margin:2.5rem}.inploi-job-search .m-11{margin:2.75rem}.inploi-job-search .m-12{margin:3rem}.inploi-job-search .m-2{margin:.5rem}.inploi-job-search .m-3{margin:.75rem}.inploi-job-search .m-4{margin:1rem}.inploi-job-search .m-5{margin:1.25rem}.inploi-job-search .m-6{margin:1.5rem}.inploi-job-search .m-7{margin:1.75rem}.inploi-job-search .m-8{margin:2rem}.inploi-job-search .m-9{margin:2.25rem}.inploi-job-search .mx-auto{margin-left:auto;margin-right:auto}.inploi-job-search .mb-2{margin-bottom:.5rem}.inploi-job-search .ml-auto{margin-left:auto}.inploi-job-search .mr-\\[3px\\]{margin-right:3px}.inploi-job-search .line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.inploi-job-search .block{display:block}.inploi-job-search .inline-block{display:inline-block}.inploi-job-search .inline{display:inline}.inploi-job-search .flex{display:flex}.inploi-job-search .inline-flex{display:inline-flex}.inploi-job-search .table{display:table}.inploi-job-search .table-row{display:table-row}.inploi-job-search .flow-root{display:flow-root}.inploi-job-search .grid{display:grid}.inploi-job-search .inline-grid{display:inline-grid}.inploi-job-search .contents{display:contents}.inploi-job-search .list-item{display:list-item}.inploi-job-search .\\!hidden{display:none!important}.inploi-job-search .hidden{display:none}.inploi-job-search .aspect-square{aspect-ratio:1 / 1}.inploi-job-search .size-4{width:1rem;height:1rem}.inploi-job-search .size-5{width:1.25rem;height:1.25rem}.inploi-job-search .size-\\[1lh\\]{width:1lh;height:1lh}.inploi-job-search .h-10{height:2.5rem}.inploi-job-search .h-12{height:3rem}.inploi-job-search .h-6{height:1.5rem}.inploi-job-search .h-8{height:2rem}.inploi-job-search .h-\\[1lh\\]{height:1lh}.inploi-job-search .h-\\[36px\\]{height:36px}.inploi-job-search .h-\\[80svh\\]{height:80svh}.inploi-job-search .h-auto{height:auto}.inploi-job-search .h-full{height:100%}.inploi-job-search .max-h-\\[--radix-popover-content-available-height\\]{max-height:var(--radix-popover-content-available-height)}.inploi-job-search .min-h-0{min-height:0px}.inploi-job-search .min-h-6{min-height:1.5rem}.inploi-job-search .min-h-\\[1em\\]{min-height:1em}.inploi-job-search .min-h-\\[36px\\]{min-height:36px}.inploi-job-search .min-h-screen{min-height:100vh}.inploi-job-search .w-10{width:2.5rem}.inploi-job-search .w-6{width:1.5rem}.inploi-job-search .w-\\[10ch\\]{width:10ch}.inploi-job-search .w-\\[3ch\\]{width:3ch}.inploi-job-search .w-\\[6ch\\]{width:6ch}.inploi-job-search .w-\\[72px\\]{width:72px}.inploi-job-search .w-\\[8ch\\]{width:8ch}.inploi-job-search .w-full{width:100%}.inploi-job-search .min-w-0{min-width:0px}.inploi-job-search .min-w-6{min-width:1.5rem}.inploi-job-search .min-w-64{min-width:16rem}.inploi-job-search .min-w-\\[calc\\(100\\%-1rem\\)\\]{min-width:calc(100% - 1rem)}.inploi-job-search .max-w-\\[45rem\\]{max-width:45rem}.inploi-job-search .max-w-full{max-width:100%}.inploi-job-search .max-w-xs{max-width:20rem}.inploi-job-search .flex-1{flex:1 1 0%}.inploi-job-search .flex-none{flex:none}.inploi-job-search .flex-shrink{flex-shrink:1}.inploi-job-search .flex-shrink-0{flex-shrink:0}.inploi-job-search .shrink{flex-shrink:1}.inploi-job-search .flex-grow,.inploi-job-search .grow{flex-grow:1}.inploi-job-search .border-collapse{border-collapse:collapse}.inploi-job-search .origin-\\[50\\%_1\\.75rem\\]{transform-origin:50% 1.75rem}.inploi-job-search .origin-top{transform-origin:top}.inploi-job-search .-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.inploi-job-search .rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.inploi-job-search .scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.inploi-job-search .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes appear-tag{0%{transform:scale(.9)}to{transform:scale(1)}}.inploi-job-search .animate-appear-tag{animation:appear-tag .6s cubic-bezier(.16,1,.3,1) both}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.inploi-job-search .animate-fade-in{animation:fade-in .4s cubic-bezier(.16,1,.3,1) both}.inploi-job-search .animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes selected-tag{0%{transform:scale(1.11)}to{transform:scale(1)}}.inploi-job-search .animate-selected-tag{animation:selected-tag .9s cubic-bezier(.16,1,.3,1)}@keyframes skeleton{0%{opacity:.2}50%{opacity:.6}to{opacity:.25}}.inploi-job-search .animate-skeleton{animation:skeleton 1.2s cubic-bezier(.4,0,.6,1) infinite}@keyframes slide-out-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}.inploi-job-search .animate-slide-out-bottom{animation:slide-out-bottom .4s cubic-bezier(.16,1,.3,1) both}@keyframes slideDownFade{0%{opacity:0;transform:scale(.95) translateY(-16px)}to{opacity:1;transform:scale(1) translateY(0)}}.inploi-job-search .animate-slideDownFade{animation:slideDownFade .2s cubic-bezier(.34,1.56,.64,1)}.inploi-job-search .cursor-default{cursor:default}.inploi-job-search .cursor-pointer{cursor:pointer}.inploi-job-search .cursor-text{cursor:text}.inploi-job-search .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.inploi-job-search .resize{resize:both}.inploi-job-search .snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.inploi-job-search .snap-proximity{--tw-scroll-snap-strictness: proximity}.inploi-job-search .snap-start{scroll-snap-align:start}.inploi-job-search .scroll-px-4{scroll-padding-left:1rem;scroll-padding-right:1rem}.inploi-job-search .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.inploi-job-search .flex-col{flex-direction:column}.inploi-job-search .flex-wrap{flex-wrap:wrap}.inploi-job-search .items-start{align-items:flex-start}.inploi-job-search .items-center{align-items:center}.inploi-job-search .items-stretch{align-items:stretch}.inploi-job-search .justify-end{justify-content:flex-end}.inploi-job-search .justify-center{justify-content:center}.inploi-job-search .justify-between{justify-content:space-between}.inploi-job-search .gap-1{gap:.25rem}.inploi-job-search .gap-1\\.5{gap:.375rem}.inploi-job-search .gap-2{gap:.5rem}.inploi-job-search .gap-3{gap:.75rem}.inploi-job-search .gap-4{gap:1rem}.inploi-job-search .gap-logo{gap:var(--i-logo-gap)}.inploi-job-search .self-center{align-self:center}.inploi-job-search .overflow-auto{overflow:auto}.inploi-job-search .overflow-hidden{overflow:hidden}.inploi-job-search .overflow-y-auto{overflow-y:auto}.inploi-job-search .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.inploi-job-search .whitespace-nowrap{white-space:nowrap}.inploi-job-search .text-balance{text-wrap:balance}.inploi-job-search .text-pretty{text-wrap:pretty}.inploi-job-search .break-words{overflow-wrap:break-word}.inploi-job-search .rounded-\\[999px\\]{border-radius:999px}.inploi-job-search .rounded-input{border-radius:var(--i-radius-input)}.inploi-job-search .rounded-interactive{border-radius:var(--i-radius-interactive)}.inploi-job-search .rounded-job-card{border-radius:var(--i-radius-job-card)}.inploi-job-search .rounded-job-tag{border-radius:var(--i-radius-job-tag)}.inploi-job-search .rounded-logo{border-radius:var(--i-radius-logo)}.inploi-job-search .rounded-section{border-radius:var(--i-radius-section)}.inploi-job-search .rounded-tag{border-radius:var(--i-radius-job-tag)}.inploi-job-search .rounded-t-section{border-top-left-radius:var(--i-radius-section);border-top-right-radius:var(--i-radius-section)}.inploi-job-search .border-px{border-width:1px}.inploi-job-search .border-b-px{border-bottom-width:1px}.inploi-job-search .border-solid{border-style:solid}.inploi-job-search .border-neutral-2{border-color:var(--i-color-n-2)}.inploi-job-search .border-neutral-4{border-color:var(--i-color-n-4)}.inploi-job-search .border-section-weak-stroke{border-color:var(--i-section-weak-stroke-color)}.inploi-job-search .border-tag-accent-strong-stroke{border-color:var(--i-tag-accent-strong-stroke-color)}.inploi-job-search .border-tag-monetary-weak-stroke{border-color:var(--i-tag-monetary-weak-stroke-color)}.inploi-job-search .border-tag-neutral-strong-stroke{border-color:var(--i-tag-neutral-strong-stroke-color)}.inploi-job-search .border-tag-neutral-weak-stroke{border-color:var(--i-tag-neutral-weak-stroke-color)}.inploi-job-search .bg-\\[\\#0009\\]{background-color:#0009}.inploi-job-search .bg-\\[currentColor\\]{background-color:currentColor}.inploi-job-search .bg-accent-2{background-color:var(--i-color-a-2)}.inploi-job-search .bg-accent-4{background-color:var(--i-color-a-4)}.inploi-job-search .bg-app{background-color:var(--i-app-bg)}.inploi-job-search .bg-copy-neutral{background-color:var(--i-copy)}.inploi-job-search .bg-interactive-accent-bg{background-color:var(--i-interactive-accent-bg)}.inploi-job-search .bg-interactive-neutral-bg{background-color:var(--i-interactive-neutral-bg)}.inploi-job-search .bg-job-card-bg{background-color:var(--i-job-card-bg)}.inploi-job-search .bg-lowest{background-color:var(--i-color-lowest)}.inploi-job-search .bg-neutral-12{background-color:var(--i-color-n-12)}.inploi-job-search .bg-neutral-2{background-color:var(--i-color-n-2)}.inploi-job-search .bg-neutral-3{background-color:var(--i-color-n-3)}.inploi-job-search .bg-neutral-6{background-color:var(--i-color-n-6)}.inploi-job-search .bg-section-strong-bg{background-color:var(--i-section-strong-bg)}.inploi-job-search .bg-tag-accent-strong-bg{background-color:var(--i-tag-accent-strong-bg)}.inploi-job-search .bg-tag-monetary-weak-bg{background-color:var(--i-tag-monetary-weak-bg)}.inploi-job-search .bg-tag-neutral-strong-bg{background-color:var(--i-tag-neutral-strong-bg)}.inploi-job-search .bg-tag-neutral-weak-bg{background-color:var(--i-tag-neutral-weak-bg)}.inploi-job-search .bg-transparent{background-color:transparent}.inploi-job-search .object-contain{-o-object-fit:contain;object-fit:contain}.inploi-job-search .p-0{padding:0}.inploi-job-search .p-1{padding:.25rem}.inploi-job-search .p-10{padding:2.5rem}.inploi-job-search .p-11{padding:2.75rem}.inploi-job-search .p-12{padding:3rem}.inploi-job-search .p-2{padding:.5rem}.inploi-job-search .p-3{padding:.75rem}.inploi-job-search .p-4{padding:1rem}.inploi-job-search .p-5{padding:1.25rem}.inploi-job-search .p-6{padding:1.5rem}.inploi-job-search .p-7{padding:1.75rem}.inploi-job-search .p-8{padding:2rem}.inploi-job-search .p-9{padding:2.25rem}.inploi-job-search .px-1{padding-left:.25rem;padding-right:.25rem}.inploi-job-search .px-10{padding-left:2.5rem;padding-right:2.5rem}.inploi-job-search .px-2{padding-left:.5rem;padding-right:.5rem}.inploi-job-search .px-2\\.5{padding-left:.625rem;padding-right:.625rem}.inploi-job-search .px-3{padding-left:.75rem;padding-right:.75rem}.inploi-job-search .px-4{padding-left:1rem;padding-right:1rem}.inploi-job-search .px-5{padding-left:1.25rem;padding-right:1.25rem}.inploi-job-search .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.inploi-job-search .py-1{padding-top:.25rem;padding-bottom:.25rem}.inploi-job-search .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.inploi-job-search .py-2{padding-top:.5rem;padding-bottom:.5rem}.inploi-job-search .py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.inploi-job-search .py-4{padding-top:1rem;padding-bottom:1rem}.inploi-job-search .pb-1{padding-bottom:.25rem}.inploi-job-search .pb-\\[env\\(safe-area-inset-bottom\\)\\]{padding-bottom:env(safe-area-inset-bottom)}.inploi-job-search .pl-1{padding-left:.25rem}.inploi-job-search .pl-10{padding-left:2.5rem}.inploi-job-search .pl-2{padding-left:.5rem}.inploi-job-search .pl-3{padding-left:.75rem}.inploi-job-search .pl-3\\.5{padding-left:.875rem}.inploi-job-search .pl-5{padding-left:1.25rem}.inploi-job-search .pr-1{padding-right:.25rem}.inploi-job-search .pr-10{padding-right:2.5rem}.inploi-job-search .pr-2{padding-right:.5rem}.inploi-job-search .pr-2\\.5{padding-right:.625rem}.inploi-job-search .pr-3{padding-right:.75rem}.inploi-job-search .pr-4{padding-right:1rem}.inploi-job-search .pt-4{padding-top:1rem}.inploi-job-search .text-center{text-align:center}.inploi-job-search .text-justify{text-align:justify}.inploi-job-search .align-middle{vertical-align:middle}.inploi-job-search .font-family-default{font-family:var(--i-font)}.inploi-job-search .font-family-filter{font-family:var(--i-font-filter)}.inploi-job-search .font-family-job-heading{font-family:var(--i-font-job-heading)}.inploi-job-search .font-family-tag{font-family:var(--i-font-tag)}.inploi-job-search .text-\\[10px\\]{font-size:10px}.inploi-job-search .text-style-filter{font-size:1rem;line-height:1.5rem;letter-spacing:-.01em}.inploi-job-search .text-style-input{font-size:1rem;line-height:1.5rem}.inploi-job-search .text-style-job-card{font-size:.875rem;line-height:1.125rem}.inploi-job-search .text-style-job-card-info{font-size:.75rem;line-height:1.125rem}.inploi-job-search .text-style-job-heading{font-size:1.125rem;line-height:1.5rem}.inploi-job-search .text-style-tag{font-size:.875rem;line-height:1.1rem}.inploi-job-search .font-\\[500\\]{font-weight:500}.inploi-job-search .font-weight-default{font-weight:var(--i-weight-default)}.inploi-job-search .font-weight-filter{font-weight:var(--i-weight-filter)}.inploi-job-search .font-weight-input{font-weight:var(--i-weight-input)}.inploi-job-search .font-weight-job-heading{font-weight:var(--i-weight-job-heading)}.inploi-job-search .font-weight-tag{font-weight:var(--i-weight-tag)}.inploi-job-search .uppercase{text-transform:uppercase}.inploi-job-search .lowercase{text-transform:lowercase}.inploi-job-search .capitalize{text-transform:capitalize}.inploi-job-search .italic{font-style:italic}.inploi-job-search .ordinal{--tw-ordinal: ordinal;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.inploi-job-search .tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.inploi-job-search .leading-none{line-height:1}.inploi-job-search .leading-snug{line-height:1.375}.inploi-job-search .tracking-tight{letter-spacing:-.025em}.inploi-job-search .\\!text-transparent{color:transparent!important}.inploi-job-search .text-accent-11{color:var(--i-color-a-11)}.inploi-job-search .text-copy-accent-icon{color:var(--i-copy-accent-icon)}.inploi-job-search .text-copy-job-info{color:var(--i-copy-info)}.inploi-job-search .text-copy-neutral{color:var(--i-copy)}.inploi-job-search .text-copy-neutral-icon{color:var(--i-copy-icon)}.inploi-job-search .text-copy-neutral-lowcontrast{color:var(--i-copy-lowcontrast)}.inploi-job-search .text-interactive-accent-text{color:var(--i-interactive-accent-text)}.inploi-job-search .text-interactive-neutral-bg{color:var(--i-interactive-neutral-bg)}.inploi-job-search .text-interactive-neutral-text{color:var(--i-interactive-neutral-text)}.inploi-job-search .text-neutral-1{color:var(--i-color-n-1)}.inploi-job-search .text-neutral-10{color:var(--i-color-n-10)}.inploi-job-search .text-neutral-11{color:var(--i-color-n-11)}.inploi-job-search .text-neutral-12{color:var(--i-color-n-12)}.inploi-job-search .text-neutral-6{color:var(--i-color-n-6)}.inploi-job-search .text-neutral-8{color:var(--i-color-n-8)}.inploi-job-search .text-tag-accent-strong-bg{color:var(--i-tag-accent-strong-bg)}.inploi-job-search .text-tag-accent-strong-copy{color:var(--i-tag-accent-strong-copy)}.inploi-job-search .text-tag-monetary-weak-copy{color:var(--i-tag-monetary-weak-copy)}.inploi-job-search .text-tag-neutral-strong-copy{color:var(--i-tag-neutral-strong-copy)}.inploi-job-search .text-tag-neutral-weak-copy{color:var(--i-tag-neutral-weak-copy)}.inploi-job-search .underline{text-decoration-line:underline}.inploi-job-search .caret-accent-11{caret-color:var(--i-color-a-11)}.inploi-job-search .opacity-10{opacity:.1}.inploi-job-search .opacity-25{opacity:.25}.inploi-job-search .opacity-30{opacity:.3}.inploi-job-search .opacity-50{opacity:.5}.inploi-job-search .opacity-80{opacity:.8}.inploi-job-search .shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.inploi-job-search .shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.inploi-job-search .shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.inploi-job-search .outline-none{outline:2px solid transparent;outline-offset:2px}.inploi-job-search .outline{outline-style:solid}.inploi-job-search .ring-\\[3px\\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .ring-px{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .ring-width-job-card{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(var(--i-job-card-stroke-width) + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .ring-width-section{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(var(--i-section-stroke-width) + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .ring-job-card-stroke{--tw-ring-color: var(--i-job-card-stroke-color)}.inploi-job-search .ring-neutral-3{--tw-ring-color: var(--i-color-n-3)}.inploi-job-search .ring-neutral-4{--tw-ring-color: var(--i-color-n-4)}.inploi-job-search .ring-section-weak-stroke{--tw-ring-color: var(--i-section-weak-stroke-color)}.inploi-job-search .ring-tag-accent-strong-bg{--tw-ring-color: var(--i-tag-accent-strong-bg)}.inploi-job-search .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.inploi-job-search .grayscale{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.inploi-job-search .invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.inploi-job-search .sepia{--tw-sepia: sepia(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.inploi-job-search .\\!filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)!important}.inploi-job-search .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.inploi-job-search .backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.inploi-job-search .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.inploi-job-search .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.inploi-job-search .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.inploi-job-search .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.inploi-job-search .duration-500{transition-duration:.5s}.inploi-job-search .duration-medium{transition-duration:.6s}.inploi-job-search .duration-slow{transition-duration:.9s}.inploi-job-search .duration-snappy{transition-duration:.4s}.inploi-job-search .ease-expo-out{transition-timing-function:cubic-bezier(.16,1,.3,1)}.inploi-job-search .ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.inploi-job-search .gutter-stable{scrollbar-gutter:stable}.inploi-job-search .font-style-default{font-style:var(--i-font-style)}.inploi-job-search .font-style-filter{font-style:var(--i-style-filter)}.inploi-job-search .font-style-input{font-style:var(--i-style-input)}.inploi-job-search .font-style-job-heading{font-style:var(--i-style-job-heading)}.inploi-job-search .font-style-tag{font-style:var(--i-style-tag)}.inploi-job-search .fr{outline:none}.inploi-job-search .fr:focus{outline:none}.inploi-job-search .fr:focus-visible{outline:none;--tw-ring-offset-width: 1px;--tw-ring-offset-color: var(--i-color-lowest);--tw-ring-opacity: 1;--tw-ring-color: var(--i-color-a-9);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .touch-hitbox:before{content:"";position:absolute;display:block;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;min-height:44px;min-width:44px;z-index:9999}.inploi-job-search .\\[-webkit-user-drag\\:none\\]{-webkit-user-drag:none}.inploi-job-search .\\[a-zA-Z0-9-_\\:\\.\\$\\@\\?\\]{a-z-a--z0-9-_:.$@?}.inploi-job-search .\\[text-wrap\\:balance\\]{text-wrap:balance}.inploi-job-search .\\[text-wrap\\:pretty\\]{text-wrap:pretty}.inploi-job-search .selection\\:bg-accent-4 *::-moz-selection{background-color:var(--i-color-a-4)}.inploi-job-search .selection\\:bg-accent-4 *::selection{background-color:var(--i-color-a-4)}.inploi-job-search .selection\\:text-accent-12 *::-moz-selection{color:var(--i-color-a-12)}.inploi-job-search .selection\\:text-accent-12 *::selection{color:var(--i-color-a-12)}.inploi-job-search .selection\\:bg-accent-4::-moz-selection{background-color:var(--i-color-a-4)}.inploi-job-search .selection\\:bg-accent-4::selection{background-color:var(--i-color-a-4)}.inploi-job-search .selection\\:text-accent-12::-moz-selection{color:var(--i-color-a-12)}.inploi-job-search .selection\\:text-accent-12::selection{color:var(--i-color-a-12)}.inploi-job-search .placeholder\\:\\!text-transparent::-moz-placeholder{color:transparent!important}.inploi-job-search .placeholder\\:\\!text-transparent::placeholder{color:transparent!important}.inploi-job-search .placeholder\\:text-copy-neutral::-moz-placeholder{color:var(--i-copy)}.inploi-job-search .placeholder\\:text-copy-neutral::placeholder{color:var(--i-copy)}.inploi-job-search .placeholder\\:opacity-30::-moz-placeholder{opacity:.3}.inploi-job-search .placeholder\\:opacity-30::placeholder{opacity:.3}.inploi-job-search .hover\\:bg-job-card-bg-active:hover{background-color:var(--i-job-card-bg-active)}.inploi-job-search .hover\\:bg-neutral-2:hover{background-color:var(--i-color-n-2)}.inploi-job-search .hover\\:text-copy-neutral:hover{color:var(--i-copy)}.inploi-job-search .hover\\:text-neutral-12:hover{color:var(--i-color-n-12)}.inploi-job-search .hover\\:ring-job-card-stroke-active:hover{--tw-ring-color: var(--i-job-card-stroke-color-active)}.inploi-job-search .focus\\:relative:focus{position:relative}.inploi-job-search .focus\\:ring-px:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .focus\\:ring-neutral-6:focus{--tw-ring-color: var(--i-color-n-6)}.inploi-job-search .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.inploi-job-search .active\\:scale-\\[0\\.975\\]:active{--tw-scale-x: .975;--tw-scale-y: .975;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.inploi-job-search .active\\:bg-job-card-bg-active:active{background-color:var(--i-job-card-bg-active)}.inploi-job-search .active\\:ring-job-card-stroke-active:active{--tw-ring-color: var(--i-job-card-stroke-color-active)}.inploi-job-search .disabled\\:bg-interactive-neutral-bg:disabled{background-color:var(--i-interactive-neutral-bg)}.inploi-job-search .disabled\\:text-interactive-neutral-bg-hover:disabled{color:var(--i-interactive-neutral-bg-hover)}.inploi-job-search .disabled\\:opacity-50:disabled{opacity:.5}.inploi-job-search .disabled\\:hover\\:disabled\\:bg-interactive-neutral-bg:disabled:hover:disabled{background-color:var(--i-interactive-neutral-bg)}.inploi-job-search .peer:-moz-placeholder-shown~.peer-placeholder-shown\\:right-0{right:0}.inploi-job-search .peer:placeholder-shown~.peer-placeholder-shown\\:right-0{right:0}.inploi-job-search .peer:-moz-placeholder-shown~.peer-placeholder-shown\\:hidden{display:none}.inploi-job-search .peer:placeholder-shown~.peer-placeholder-shown\\:hidden{display:none}.inploi-job-search .has-\\[\\[data-current-value\\=true\\]\\]\\:border-b-accent-3:has([data-current-value=true]){border-bottom-color:var(--i-color-a-3)}@keyframes slideUpFade{0%{opacity:0;transform:scale(.95) translateY(16px)}to{opacity:1;transform:scale(1) translateY(0)}}.inploi-job-search .data-\\[side\\=top\\]\\:animate-slideUpFade[data-side=top]{animation:slideUpFade .2s cubic-bezier(.34,1.56,.64,1)}@keyframes pulse{50%{opacity:.5}}.inploi-job-search .data-\\[state\\=loading\\]\\:animate-pulse[data-state=loading]{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.inploi-job-search .group[data-state=open] .group-data-\\[state\\=open\\]\\:-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes ai-letter{0%{color:var(--i-copy);transform:scale(1)}50%{transform:scale(1.125)}75%{color:var(--i-interactive-accent-text);transform:scale(1.0625)}to{color:var(--i-interactive-accent-text);transform:scale(1)}}.inploi-job-search .group[data-synced=true] .group-data-\\[synced\\=true\\]\\:animate-ai-letter{animation:ai-letter .6s cubic-bezier(.68,-.6,.32,1.6) both}@media (pointer: fine){.inploi-job-search .pointer-fine\\:hover\\:bg-interactive-accent-bg-hover:hover{background-color:var(--i-interactive-accent-bg-hover)}}@media (pointer: fine){.inploi-job-search .pointer-fine\\:hover\\:bg-interactive-neutral-bg-hover:hover{background-color:var(--i-interactive-neutral-bg-hover)}}@media (pointer: fine){.inploi-job-search .group\\/filter:first-child .group\\/tag:first-child .pointer-fine\\:group-\\[\\&\\:first-child\\]\\/filter\\:group-\\[\\&\\:first-child\\]\\/tag\\:rounded-t-tag{border-top-left-radius:var(--i-radius-job-tag);border-top-right-radius:var(--i-radius-job-tag)}}.inploi-job-search .dark .theme-dark\\:text-neutral-12{color:var(--i-color-n-12)}.inploi-job-search .light .theme-light\\:text-neutral-11{color:var(--i-color-n-11)}.inploi-job-search .rounded .theme-rounded\\:rounded-md{border-radius:.75rem}.inploi-job-search .rounded .theme-rounded\\:rounded-xl{border-radius:1.5rem}@media (pointer: fine){.inploi-job-search .rounded .pointer-fine\\:theme-rounded\\:rounded-t-lg{border-top-left-radius:1rem;border-top-right-radius:1rem}}.inploi-job-search .soft .theme-soft\\:rounded-lg{border-radius:1rem}.inploi-job-search .soft .theme-soft\\:rounded-sm{border-radius:.5rem}@media (pointer: fine){.inploi-job-search .soft .pointer-fine\\:theme-soft\\:rounded-t-lg{border-top-left-radius:1rem;border-top-right-radius:1rem}}.inploi-job-search .fill .theme-fill\\:bg-neutral-1{background-color:var(--i-color-n-1)}.inploi-job-search .fill .theme-fill\\:bg-neutral-2{background-color:var(--i-color-n-2)}.inploi-job-search .fill .theme-fill\\:ring-neutral-3{--tw-ring-color: var(--i-color-n-3)}.inploi-job-search .fill .theme-fill\\:fr{outline:none}.inploi-job-search .fill .theme-fill\\:fr:focus{outline:none}.inploi-job-search .fill .theme-fill\\:fr:focus-visible{outline:none;--tw-ring-offset-width: 1px;--tw-ring-offset-color: var(--i-color-lowest);--tw-ring-opacity: 1;--tw-ring-color: var(--i-color-a-9);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .fill .theme-fill\\:hover\\:bg-neutral-3:hover{background-color:var(--i-color-n-3)}.inploi-job-search .fill .theme-fill\\:focus\\:bg-neutral-1:focus{background-color:var(--i-color-n-1)}.inploi-job-search .stroke .theme-stroke\\:bg-lowest{background-color:var(--i-color-lowest)}.inploi-job-search .stroke .theme-stroke\\:bg-neutral-1{background-color:var(--i-color-n-1)}.inploi-job-search .stroke .theme-stroke\\:ring-px{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .stroke .theme-stroke\\:ring-neutral-3{--tw-ring-color: var(--i-color-n-3)}.inploi-job-search .stroke .theme-stroke\\:ring-neutral-4{--tw-ring-color: var(--i-color-n-4)}.inploi-job-search .stroke .theme-stroke\\:fr{outline:none}.inploi-job-search .stroke .theme-stroke\\:fr:focus{outline:none}.inploi-job-search .stroke .theme-stroke\\:fr:focus-visible{outline:none;--tw-ring-offset-width: 1px;--tw-ring-offset-color: var(--i-color-lowest);--tw-ring-opacity: 1;--tw-ring-color: var(--i-color-a-9);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .stroke .theme-stroke\\:hover\\:ring-neutral-6:hover{--tw-ring-color: var(--i-color-n-6)}.inploi-job-search .stroke .theme-stroke\\:hover\\:fr:hover{outline:none}.inploi-job-search .stroke .theme-stroke\\:hover\\:fr:hover:focus{outline:none}.inploi-job-search .stroke .theme-stroke\\:hover\\:fr:hover:focus-visible{outline:none;--tw-ring-offset-width: 1px;--tw-ring-offset-color: var(--i-color-lowest);--tw-ring-opacity: 1;--tw-ring-color: var(--i-color-a-9);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.inploi-job-search .stroke .theme-stroke\\:focus\\:bg-lowest:focus{background-color:var(--i-color-lowest)}@media (min-width: 768px){.inploi-job-search .md\\:order-1{order:1}}@media (min-width: 768px){.inploi-job-search .md\\:order-2{order:2}}@media (min-width: 768px){.inploi-job-search .md\\:aspect-auto{aspect-ratio:auto}}@media (min-width: 768px){.inploi-job-search .md\\:h-\\[70svh\\]{height:70svh}}@media (min-width: 768px){.inploi-job-search .md\\:min-w-80{min-width:20rem}}@media (min-width: 768px){.inploi-job-search .md\\:max-w-xl{max-width:36rem}}@media (min-width: 768px){.inploi-job-search .md\\:flex-row{flex-direction:row}}@media (min-width: 768px){.inploi-job-search .md\\:flex-col{flex-direction:column}}@media (min-width: 768px){.inploi-job-search .md\\:flex-wrap{flex-wrap:wrap}}@media (min-width: 768px){.inploi-job-search .md\\:items-center{align-items:center}}@media (min-width: 1024px){.inploi-job-search .lg\\:ring-width-section{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(var(--i-section-stroke-width) + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}}.inploi-job-search .\\[\\&\\:not\\(\\:last-child\\)\\]\\:border-b-px:not(:last-child){border-bottom-width:1px}.inploi-job-search .bg-wavy{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="8" fill="none" viewBox="0 -2 32 10"><path stroke="%23000" stroke-width="2" d="M0 4c8 0 8-4 16-4s8 4 16 4"/></svg>');background-size:16px 6px;background-repeat:repeat-x;background-position:center}.inploi-job-search .dark .bg-wavy{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="8" fill="none" viewBox="0 -2 32 10"><path stroke="%23fff" stroke-width="2" d="M0 4c8 0 8-4 16-4s8 4 16 4"/></svg>')}
|
|
61
61
|
`,AL=p=>({getRenderTargetElement:x=>{const T=x?`[data-widget-id="${x}"]`:"",C=document.body.querySelectorAll(`*[data-widget=${Yv}]${T}`);if(C.length>1)throw p.error("Please ensure there is only one instance of the widget or provide a data-widget-id attribute to the widget."),new Error("More than one job search widget found on the page.");const L=C[0];if(!L)throw p.error(`Please ensure there is an element with the properties data-widget="${Yv}" ${T}`),new Error("Job search widget didn’t find element");return L}}),IL=()=>JS(({apiClient:p,rpcClient:x,logger:T,analytics:C})=>{const L=AL(T),k=({params:j})=>Kt(ed,{Fallback:FE},[Kt(LE,{terms:j.terms,locale:void 0,children:[Kt("style",{id:"inploi-job-search-styles"},EL),Kt("style",{id:"inploi-job-search-theme"},XE(j)),Kt(NE,{theme:j.theme}),Kt(TL,{properties:j.properties,rpcClient:x,logger:T,analytics:C,initialData:j.initialData,onStateChange:j.onStateChange,params:j})]})]);return{prerender:async j=>{const o=typeof j.initialState=="function"?j.initialState(j):j.initialState,re=j.withData?await ex({state:o,rpcClient:x,t:kE({overrides:j.terms??{},locale:void 0})}).then(fe=>({jobs:fe})).catch(()=>{}):void 0;return{html:hE(Kt(rr,{},Kt(k,{params:{...j,initialData:re}}))),data:re}},render:async j=>{var Ee,be;const o=typeof j.initialState=="function"?j.initialState(j):j.initialState,re=j.initialData?J_:au,fe=L.getRenderTargetElement(j.widgetId);Cs(typeof window<"u","the `render` method of JobSearch cannot be called in non-browser environments. Use `prerender` instead.");let xe;if(re(Kt(k,{params:{...j,onStateChange:Pe=>{j.onStateChange(Pe),xe&&Pe.filters&&xe.setFilters(Mu(Pe.filters))}}}),fe),j.feedback)if(j.feedback.plugin instanceof Promise)j.feedback.plugin.then(({feedbackPlugin:Pe})=>{var ze,Se;if(!j.feedback)return;const _e=Pe()({apiClient:p,logger:T,analytics:C});Qb({instance:_e,theme:{...j.theme,...(ze=j.feedback.params)==null?void 0:ze.theme},terms:((Se=j.feedback.params)==null?void 0:Se.terms)??{}})});else{const Pe=j.feedback.plugin({apiClient:p,logger:T,analytics:C});Qb({instance:Pe,theme:{...j.theme,...(Ee=j.feedback.params)==null?void 0:Ee.theme},terms:((be=j.feedback.params)==null?void 0:be.terms)??{}})}j.alerts&&(j.alerts.plugin instanceof Promise?j.alerts.plugin.then(({jobAlertsPlugin:Pe})=>{if(!j.alerts)return;Pe()({apiClient:p,logger:T,analytics:C}).render({config:j.alerts.params.config,initialFilters:Mu(o.filters),theme:j.theme})}):(xe=j.alerts.plugin({apiClient:p,logger:T,analytics:C}),xe.render({config:j.alerts.params.config,initialFilters:Mu(o.filters),theme:j.theme})))}}});function Qb(p){p.instance.render({key:"job-search",size:"sm",theme:{positive:{hue:180,chroma:1},negative:{hue:33,chroma:1},...p.theme},terms:p.terms})}if(!window.inploi)throw new Error("Please insert the SDK script tag above the plugins.");window.inploi.jobSearchPlugin=IL;var ew={exports:{}};(function(p,x){(function(T,C){p.exports=C()})(rd,function(){var T,C,L;function k(o,re){if(!T)T=re;else if(!C)C=re;else{var fe="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+T+")(sharedChunk); ("+C+")(sharedChunk); self.onerror = null;",xe={};T(xe),L=re(xe),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(L.workerUrl=window.URL.createObjectURL(new Blob([fe],{type:"text/javascript"})))}}k(["exports"],function(o){var re=1e-6,fe=typeof Float32Array<"u"?Float32Array:Array;function xe(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=i*u-a*s;return h?(r[0]=u*(h=1/h),r[1]=-s*h,r[2]=-a*h,r[3]=i*h,r):null}function oe(){var r=new fe(9);return fe!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Ee(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=e[4],m=e[5],g=e[6],v=e[7],w=e[8];return r[0]=h*w-m*v,r[1]=a*v-s*w,r[2]=s*m-a*h,r[3]=m*g-u*w,r[4]=i*w-a*g,r[5]=a*u-i*m,r[6]=u*v-h*g,r[7]=s*g-i*v,r[8]=i*h-s*u,r}function be(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3],m=e[4],g=e[5],v=e[6],w=e[7],S=e[8],A=i[0],D=i[1],R=i[2],O=i[3],$=i[4],H=i[5],K=i[6],W=i[7],F=i[8];return r[0]=A*s+D*h+R*v,r[1]=A*a+D*m+R*w,r[2]=A*u+D*g+R*S,r[3]=O*s+$*h+H*v,r[4]=O*a+$*m+H*w,r[5]=O*u+$*g+H*S,r[6]=K*s+W*h+F*v,r[7]=K*a+W*m+F*w,r[8]=K*u+W*g+F*S,r}function Pe(){var r=new fe(16);return fe!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function _e(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function ze(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=e[4],m=e[5],g=e[6],v=e[7],w=e[8],S=e[9],A=e[10],D=e[11],R=e[12],O=e[13],$=e[14],H=e[15],K=i*m-s*h,W=i*g-a*h,F=i*v-u*h,q=s*g-a*m,Y=s*v-u*m,ee=a*v-u*g,he=w*O-S*R,ye=w*$-A*R,ve=w*H-D*R,Ce=S*$-A*O,Ue=S*H-D*O,et=A*H-D*$,Ye=K*et-W*Ue+F*Ce+q*ve-Y*ye+ee*he;return Ye?(r[0]=(m*et-g*Ue+v*Ce)*(Ye=1/Ye),r[1]=(a*Ue-s*et-u*Ce)*Ye,r[2]=(O*ee-$*Y+H*q)*Ye,r[3]=(A*Y-S*ee-D*q)*Ye,r[4]=(g*ve-h*et-v*ye)*Ye,r[5]=(i*et-a*ve+u*ye)*Ye,r[6]=($*F-R*ee-H*W)*Ye,r[7]=(w*ee-A*F+D*W)*Ye,r[8]=(h*Ue-m*ve+v*he)*Ye,r[9]=(s*ve-i*Ue-u*he)*Ye,r[10]=(R*Y-O*F+H*K)*Ye,r[11]=(S*F-w*Y-D*K)*Ye,r[12]=(m*ye-h*Ce-g*he)*Ye,r[13]=(i*Ce-s*ye+a*he)*Ye,r[14]=(O*W-R*q-$*K)*Ye,r[15]=(w*q-S*W+A*K)*Ye,r):null}function Se(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3],m=e[4],g=e[5],v=e[6],w=e[7],S=e[8],A=e[9],D=e[10],R=e[11],O=e[12],$=e[13],H=e[14],K=e[15],W=i[0],F=i[1],q=i[2],Y=i[3];return r[0]=W*s+F*m+q*S+Y*O,r[1]=W*a+F*g+q*A+Y*$,r[2]=W*u+F*v+q*D+Y*H,r[3]=W*h+F*w+q*R+Y*K,r[4]=(W=i[4])*s+(F=i[5])*m+(q=i[6])*S+(Y=i[7])*O,r[5]=W*a+F*g+q*A+Y*$,r[6]=W*u+F*v+q*D+Y*H,r[7]=W*h+F*w+q*R+Y*K,r[8]=(W=i[8])*s+(F=i[9])*m+(q=i[10])*S+(Y=i[11])*O,r[9]=W*a+F*g+q*A+Y*$,r[10]=W*u+F*v+q*D+Y*H,r[11]=W*h+F*w+q*R+Y*K,r[12]=(W=i[12])*s+(F=i[13])*m+(q=i[14])*S+(Y=i[15])*O,r[13]=W*a+F*g+q*A+Y*$,r[14]=W*u+F*v+q*D+Y*H,r[15]=W*h+F*w+q*R+Y*K,r}function st(r,e,i){var s,a,u,h,m,g,v,w,S,A,D,R,O=i[0],$=i[1],H=i[2];return e===r?(r[12]=e[0]*O+e[4]*$+e[8]*H+e[12],r[13]=e[1]*O+e[5]*$+e[9]*H+e[13],r[14]=e[2]*O+e[6]*$+e[10]*H+e[14],r[15]=e[3]*O+e[7]*$+e[11]*H+e[15]):(a=e[1],u=e[2],h=e[3],m=e[4],g=e[5],v=e[6],w=e[7],S=e[8],A=e[9],D=e[10],R=e[11],r[0]=s=e[0],r[1]=a,r[2]=u,r[3]=h,r[4]=m,r[5]=g,r[6]=v,r[7]=w,r[8]=S,r[9]=A,r[10]=D,r[11]=R,r[12]=s*O+m*$+S*H+e[12],r[13]=a*O+g*$+A*H+e[13],r[14]=u*O+v*$+D*H+e[14],r[15]=h*O+w*$+R*H+e[15]),r}function nt(r,e,i){var s=i[0],a=i[1],u=i[2];return r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r[3]=e[3]*s,r[4]=e[4]*a,r[5]=e[5]*a,r[6]=e[6]*a,r[7]=e[7]*a,r[8]=e[8]*u,r[9]=e[9]*u,r[10]=e[10]*u,r[11]=e[11]*u,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function Xe(r,e,i){var s=Math.sin(i),a=Math.cos(i),u=e[4],h=e[5],m=e[6],g=e[7],v=e[8],w=e[9],S=e[10],A=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=u*a+v*s,r[5]=h*a+w*s,r[6]=m*a+S*s,r[7]=g*a+A*s,r[8]=v*a-u*s,r[9]=w*a-h*s,r[10]=S*a-m*s,r[11]=A*a-g*s,r}function ct(r,e,i){var s=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],m=e[2],g=e[3],v=e[8],w=e[9],S=e[10],A=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a-v*s,r[1]=h*a-w*s,r[2]=m*a-S*s,r[3]=g*a-A*s,r[8]=u*s+v*a,r[9]=h*s+w*a,r[10]=m*s+S*a,r[11]=g*s+A*a,r}function xt(r,e,i){var s=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],m=e[2],g=e[3],v=e[4],w=e[5],S=e[6],A=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a+v*s,r[1]=h*a+w*s,r[2]=m*a+S*s,r[3]=g*a+A*s,r[4]=v*a-u*s,r[5]=w*a-h*s,r[6]=S*a-m*s,r[7]=A*a-g*s,r}function $t(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function kt(r,e,i){var s,a,u,h=i[0],m=i[1],g=i[2],v=Math.hypot(h,m,g);return v<re?null:(h*=v=1/v,m*=v,g*=v,s=Math.sin(e),a=Math.cos(e),r[0]=h*h*(u=1-a)+a,r[1]=m*h*u+g*s,r[2]=g*h*u-m*s,r[3]=0,r[4]=h*m*u-g*s,r[5]=m*m*u+a,r[6]=g*m*u+h*s,r[7]=0,r[8]=h*g*u+m*s,r[9]=m*g*u-h*s,r[10]=g*g*u+a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function Wt(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=i+i,m=s+s,g=a+a,v=i*h,w=s*h,S=s*m,A=a*h,D=a*m,R=a*g,O=u*h,$=u*m,H=u*g;return r[0]=1-S-R,r[1]=w+H,r[2]=A-$,r[3]=0,r[4]=w-H,r[5]=1-v-R,r[6]=D+O,r[7]=0,r[8]=A+$,r[9]=D-O,r[10]=1-v-S,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var Ai=Se;function mi(){var r=new fe(3);return fe!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function bi(r){var e=new fe(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Jt(r){return Math.hypot(r[0],r[1],r[2])}function Bt(r,e,i){var s=new fe(3);return s[0]=r,s[1]=e,s[2]=i,s}function vi(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function ri(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r}function ui(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r}function pr(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r}function _r(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r}function Ii(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function $r(r,e,i,s){return r[0]=e[0]+i[0]*s,r[1]=e[1]+i[1]*s,r[2]=e[2]+i[2]*s,r}function gn(r,e){var i=e[0]-r[0],s=e[1]-r[1],a=e[2]-r[2];return i*i+s*s+a*a}function Yn(r){var e=r[0],i=r[1],s=r[2];return e*e+i*i+s*s}function ho(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function Ui(r,e){var i=e[0],s=e[1],a=e[2],u=i*i+s*s+a*a;return u>0&&(u=1/Math.sqrt(u)),r[0]=e[0]*u,r[1]=e[1]*u,r[2]=e[2]*u,r}function Zi(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Lr(r,e,i){var s=e[0],a=e[1],u=e[2],h=i[0],m=i[1],g=i[2];return r[0]=a*g-u*m,r[1]=u*h-s*g,r[2]=s*m-a*h,r}function Uo(r,e,i,s){var a=e[0],u=e[1],h=e[2];return r[0]=a+s*(i[0]-a),r[1]=u+s*(i[1]-u),r[2]=h+s*(i[2]-h),r}function gr(r,e,i){var s=e[0],a=e[1],u=e[2],h=i[3]*s+i[7]*a+i[11]*u+i[15];return r[0]=(i[0]*s+i[4]*a+i[8]*u+i[12])/(h=h||1),r[1]=(i[1]*s+i[5]*a+i[9]*u+i[13])/h,r[2]=(i[2]*s+i[6]*a+i[10]*u+i[14])/h,r}function Kn(r,e,i){var s=e[0],a=e[1],u=e[2];return r[0]=s*i[0]+a*i[3]+u*i[6],r[1]=s*i[1]+a*i[4]+u*i[7],r[2]=s*i[2]+a*i[5]+u*i[8],r}function oo(r,e,i){var s=i[0],a=i[1],u=i[2],h=e[0],m=e[1],g=e[2],v=a*g-u*m,w=u*h-s*g,S=s*m-a*h,A=a*S-u*w,D=u*v-s*S,R=s*w-a*v,O=2*i[3];return w*=O,S*=O,D*=2,R*=2,r[0]=h+(v*=O)+(A*=2),r[1]=m+w+D,r[2]=g+S+R,r}function Qi(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var Ei=ri,un=ui,wr=Jt;function Br(){var r=new fe(4);return fe!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function En(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r}function Gr(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=i*i+s*s+a*a+u*u;return h>0&&(h=1/Math.sqrt(h)),r[0]=i*h,r[1]=s*h,r[2]=a*h,r[3]=u*h,r}function Dr(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3];return r[0]=i[0]*s+i[4]*a+i[8]*u+i[12]*h,r[1]=i[1]*s+i[5]*a+i[9]*u+i[13]*h,r[2]=i[2]*s+i[6]*a+i[10]*u+i[14]*h,r[3]=i[3]*s+i[7]*a+i[11]*u+i[15]*h,r}function an(){var r=new fe(4);return fe!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function On(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function po(r,e,i){i*=.5;var s=e[0],a=e[1],u=e[2],h=e[3],m=Math.sin(i),g=Math.cos(i);return r[0]=s*g+h*m,r[1]=a*g+u*m,r[2]=u*g-a*m,r[3]=h*g-s*m,r}function $o(r,e,i){i*=.5;var s=e[0],a=e[1],u=e[2],h=e[3],m=Math.sin(i),g=Math.cos(i);return r[0]=s*g-u*m,r[1]=a*g+h*m,r[2]=u*g+s*m,r[3]=h*g-a*m,r}mi(),Br();var Hr,ln,cs,us,Go,Ho=Gr,hs=(Hr=mi(),ln=Bt(1,0,0),cs=Bt(0,1,0),function(r,e,i){var s=Zi(e,i);return s<-.999999?(Lr(Hr,ln,e),wr(Hr)<1e-6&&Lr(Hr,cs,e),Ui(Hr,Hr),function(a,u,h){h*=.5;var m=Math.sin(h);a[0]=m*u[0],a[1]=m*u[1],a[2]=m*u[2],a[3]=Math.cos(h)}(r,Hr,Math.PI),r):s>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Lr(Hr,e,i),r[0]=Hr[0],r[1]=Hr[1],r[2]=Hr[2],r[3]=1+s,Ho(r,r))});function Hn(){var r=new fe(2);return fe!=Float32Array&&(r[0]=0,r[1]=0),r}function ga(r,e){var i=new fe(2);return i[0]=r,i[1]=e,i}function Bs(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r}function qo(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r}function ya(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r}function va(r){return Math.hypot(r[0],r[1])}function sc(r,e){var i=e[0],s=e[1],a=i*i+s*s;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r}function Ar(r,e){return r[0]*e[0]+r[1]*e[1]}function Zo(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}an(),an(),oe(),Hn();var ol,fo,ac=function(){if(Go)return us;function r(e,i,s,a){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=a}return Go=1,us=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,a=0;a<8;a++){var u=this.sampleCurveX(s)-e;if(Math.abs(u)<i)return s;var h=this.sampleCurveDerivativeX(s);if(Math.abs(h)<1e-6)break;s-=u/h}var m=0,g=1;for(s=e,a=0;a<20&&(u=this.sampleCurveX(s),!(Math.abs(u-e)<i));a++)e>u?m=s:g=s,s=.5*(g-m)+m;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},us}(),Pu=Zo(ac);function lc(){if(fo)return ol;function r(e,i){this.x=e,this.y=i}return fo=1,ol=r,r.prototype={clone:function(){return new r(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,i){return this.clone()._rotateAround(e,i)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var i=e.x-this.x,s=e.y-this.y;return i*i+s*s},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,i){return Math.atan2(this.x*i-this.y*e,this.x*e+this.y*i)},_matMult:function(e){var i=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var i=Math.cos(e),s=Math.sin(e),a=s*this.x+i*this.y;return this.x=i*this.x-s*this.y,this.y=a,this},_rotateAround:function(e,i){var s=Math.cos(e),a=Math.sin(e),u=i.y+a*(this.x-i.x)+s*(this.y-i.y);return this.x=i.x+s*(this.x-i.x)-a*(this.y-i.y),this.y=u,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(e){return e instanceof r?e:Array.isArray(e)?new r(e[0],e[1]):e},ol}var ft=Zo(lc());function ds(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!ds(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!ds(r[i],e[i]))return!1;return!0}return r===e}const Du=Math.PI/180,$e=180/Math.PI;function U(r){return r*Du}function Z(r){return r*$e}const se=[[0,0],[1,0],[1,1],[0,1]];function ge(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function pe(r,e,i,s){const a=new Pu(r,e,i,s);return function(u){return a.solve(u)}}const we=pe(.25,.1,.25,1);function Te(r,e,i){return Math.min(i,Math.max(e,r))}function Ae(r,e,i){return(i=Te((i-r)/(e-r),0,1))*i*(3-2*i)}function Be(r,e,i){const s=i-e,a=((r-e)%s+s)%s+e;return a===e?i:a}function qe(r,e,i){if(!r.length)return i(null,[]);let s=r.length;const a=new Array(r.length);let u=null;r.forEach((h,m)=>{e(h,(g,v)=>{g&&(u=g),a[m]=v,--s==0&&i(u,a)})})}function Oe(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}let mt=1;function bt(){return mt++}function Rt(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Qt(r,e){r.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function ni(r,e,i){const s={};for(const a in r)s[a]=e.call(this,r[a],a,r);return s}function hi(r,e,i){const s={};for(const a in r)e.call(this,r[a],a,r)&&(s[a]=r[a]);return s}function _i(r){return Array.isArray(r)?r.map(_i):typeof r=="object"&&r?ni(r,_i):r}const Rr={};function yi(r){Rr[r]||(typeof console<"u"&&console.warn(r),Rr[r]=!0)}function nr(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function Li(r){let e=0;for(let i,s,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],s=r[h],e+=(s.x-i.x)*(i.y+s.y);return e}function or([r,e,i]){const s=U(e+90),a=U(i);return{x:r*Math.cos(s)*Math.sin(a),y:r*Math.sin(s)*Math.sin(a),z:r*Math.cos(a),azimuthal:e,polar:i}}function lr(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function qr(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,s,a,u)=>{const h=a||u;return e[s]=!h||h.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let en=null;function pn(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function bn(r,e,i,s){for(;e<i;){const a=e+i>>1;r[a]<s?e=a+1:i=a}return e}function ps(r,e,i,s){for(;e<i;){const a=e+i>>1;r[a]<=s?e=a+1:i=a}return e}function Dn(r){return r>0?1/(1.001-r):1+r}function Rn(r){return r>0?1-1/(1.001-r):-r}function yn(r,e,i){return(r-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const An={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!An.API_URL)return null;try{const r=new URL(An.API_URL);return r.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":r.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Wo(r){return An.API_URL_REGEX.test(r)}function xa(r){return An.API_SPRITE_REGEX.test(r)}let cc,sl,Ru,uc,ba,hc;function gd(){return cc==null&&(cc=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),cc}const Io={now:()=>uc!==void 0?uc:performance.now(),setNow(r){uc=r},restoreNow(){uc=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:i,height:s}=r;ba||(ba=document.createElement("canvas"));const a=ba.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>ba.width||s>ba.height)&&(ba.width=i,ba.height=s),a.clearRect(-e,-e,i+2*e,s+2*e),a.drawImage(r,0,0,i,s),a.getImageData(-e,-e,i+2*e,s+2*e)},resolveURL:r=>(sl||(sl=document.createElement("a")),sl.href=r,sl.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Ru==null&&(Ru=window.matchMedia("(prefers-reduced-motion: reduce)")),Ru.matches)},hasCanvasFingerprintNoise(){if(hc!==void 0)return hc;if(!gd())return hc=!1,!1;const r=new OffscreenCanvas(85,1),e=r.getContext("2d",{willReadFrequently:!0});let i=0;for(let a=0;a<r.width;++a)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(a,0,1,1);const s=e.getImageData(0,0,r.width,r.height);i=0;for(let a=0;a<s.data.length;++a)if(a%4!=3&&i++!==s.data[a])return hc=!0,!0;return hc=!1,!1}};function yd(r,e){const i=r.indexOf("?");if(i<0)return`${r}?${new URLSearchParams(e).toString()}`;const s=new URLSearchParams(r.slice(i));for(const a in e)s.set(a,e[a]);return`${r.slice(0,i)}?${s.toString()}`}function Jn(r,e={persistentParams:[]}){const i=r.indexOf("?");if(i<0)return r;const s=new URLSearchParams,a=new URLSearchParams(r.slice(i));for(const h of e.persistentParams){const m=a.get(h);m&&s.set(h,m)}const u=s.toString();return`${r.slice(0,i)}${u.length>0?`?${u}`:""}`}const Co="mapbox-tiles";let fs=500,Mo=50;const ms=["language","worldview","jobid"];let mo,dc;function vd(){try{return caches}catch{}}function _s(){const r=vd();r&&mo==null&&(mo=r.open(Co))}let pc=1/0;const xd={supported:!1,testSupport:function(r){!zu&&Fn&&(Lu?Xf(r):fc=r)}};let fc,Fn,zu=!1,Lu=!1;const al=typeof self<"u"?self:{};function Xf(r){const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,Fn),r.isContextLost())return;xd.supported=!0}catch{}r.deleteTexture(e),zu=!0}al.document&&(Fn=al.document.createElement("img"),Fn.onload=function(){fc&&Xf(fc),fc=null,Lu=!0},Fn.onerror=function(){zu=!0,fc=null},Fn.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const ku={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(ku);class Ou extends Error{constructor(e,i,s){i===401&&Wo(s)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=s}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Ri=lr()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,ll=function(r,e){if(!(/^file:/.test(i=r.url)||/^file:/.test(Ri())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(s,a){const u=new AbortController,h=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,referrer:Ri(),referrerPolicy:s.referrerPolicy,signal:u.signal});let m=!1,g=!1;const v=(w=h.url).indexOf("sku=")>0&&Wo(w);var w;s.type==="json"&&h.headers.set("Accept","application/json");const S=(D,R,O)=>{if(g)return;if(D&&D.message!=="SecurityError"&&yi(D.toString()),R&&O)return A(R);const $=Date.now();fetch(h).then(H=>{if(H.ok){const K=v?H.clone():null;return A(H,K,$)}return a(new Ou(H.statusText,H.status,s.url))}).catch(H=>{H.name!=="AbortError"&&a(new Error(`${H.message} ${s.url}`))})},A=(D,R,O)=>{(s.type==="arrayBuffer"?D.arrayBuffer():s.type==="json"?D.json():D.text()).then($=>{g||(R&&O&&function(H,K,W){if(_s(),mo==null)return;const F=qr(K.headers.get("Cache-Control")||"");if(F["no-store"])return;const q={status:K.status,statusText:K.statusText,headers:new Headers};K.headers.forEach((he,ye)=>q.headers.set(ye,he)),F["max-age"]&&q.headers.set("Expires",new Date(W+1e3*F["max-age"]).toUTCString());const Y=q.headers.get("Expires");if(!Y||new Date(Y).getTime()-W<42e4)return;let ee=Jn(H.url,{persistentParams:ms});if(K.status===206){const he=H.headers.get("Range");if(!he)return;q.status=200,ee=yd(ee,{range:he})}(function(he,ye){if(dc===void 0)try{new Response(new ReadableStream),dc=!0}catch{dc=!1}dc?ye(he.body):he.blob().then(ye).catch(ve=>yi(ve.message))})(K,he=>{const ye=new Response((ve=K.status)!==200&&ve!==404&&[101,103,204,205,304].includes(ve)?null:he,q);var ve;_s(),mo!=null&&mo.then(Ce=>Ce.put(ee,ye)).catch(Ce=>yi(Ce.message))})}(h,R,O),m=!0,a(null,$,D.headers.get("Cache-Control"),D.headers.get("Expires")))}).catch($=>{g||a(new Error($.message))})};return v?function(D,R){if(_s(),mo==null)return R(null);mo.then(O=>{let $=Jn(D.url,{persistentParams:ms});const H=D.headers.get("Range");H&&($=yd($,{range:H})),O.match($).then(K=>{const W=function(F){if(!F)return!1;const q=new Date(F.headers.get("Expires")||0),Y=qr(F.headers.get("Cache-Control")||"");return Number(q)>Date.now()&&!Y["no-cache"]}(K);O.delete($).catch(R),W&&O.put($,K.clone()).catch(R),R(null,K,W)}).catch(R)}).catch(R)}(h,S):S(null,null),{cancel:()=>{g=!0,m||u.abort()}}}(r,e);if(lr(self)&&self.worker.actor)return self.worker.actor.send("getResource",r,e,void 0,!0)}var i;return function(s,a){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type==="arrayBuffer"&&(u.responseType="arraybuffer");for(const h in s.headers)u.setRequestHeader(h,s.headers[h]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{a(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let h=u.response;if(s.type==="json")try{h=JSON.parse(u.response)}catch(m){return a(m)}a(null,h,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else a(new Ou(u.statusText,u.status,s.url))},u.send(s.body),{cancel:()=>u.abort()}}(r,e)},cl=function(r,e){return ll(Oe(r,{type:"arrayBuffer"}),e)};function wy(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}const Yf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let wa,Ns;wa=[],Ns=0;const ul=function(r,e){if(xd.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*"),Ns>=An.MAX_PARALLEL_IMAGE_REQUESTS){const u={requestParameters:r,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return wa.push(u),u}Ns++;let i=!1;const s=()=>{if(!i)for(i=!0,Ns--;wa.length&&Ns<An.MAX_PARALLEL_IMAGE_REQUESTS;){const u=wa.shift(),{requestParameters:h,callback:m,cancelled:g}=u;g||(u.cancel=ul(h,m).cancel)}},a=cl(r,(u,h,m,g)=>{s(),u?e(u):h&&(self.createImageBitmap?function(v,w){const S=new Blob([new Uint8Array(v)],{type:"image/png"});createImageBitmap(S).then(A=>{w(null,A)}).catch(A=>{w(new Error(`Could not load image because of ${A.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(h,(v,w)=>e(v,w,m,g)):function(v,w){const S=new Image;S.onload=()=>{w(null,S),URL.revokeObjectURL(S.src),S.onload=null,requestAnimationFrame(()=>{S.src=Yf})},S.onerror=()=>w(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const A=new Blob([new Uint8Array(v)],{type:"image/png"});S.src=v.byteLength?URL.createObjectURL(A):Yf}(h,(v,w)=>e(v,w,m,g)))});return{cancel:()=>{a.cancel(),s()}}};var Kf,bd,Ta,mc={exports:{}},hl={exports:{}},Fu={exports:{}},wd=function(){if(Ta)return mc.exports;Ta=1;var r=(Kf||(Kf=1,hl.exports=function(i,s){var a,u,h,m,g,v,w,S;for(u=i.length-(a=3&i.length),h=s,g=3432918353,v=461845907,S=0;S<u;)w=255&i.charCodeAt(S)|(255&i.charCodeAt(++S))<<8|(255&i.charCodeAt(++S))<<16|(255&i.charCodeAt(++S))<<24,++S,h=27492+(65535&(m=5*(65535&(h=(h^=w=(65535&(w=(w=(65535&w)*g+(((w>>>16)*g&65535)<<16)&4294967295)<<15|w>>>17))*v+(((w>>>16)*v&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(w=0,a){case 3:w^=(255&i.charCodeAt(S+2))<<16;case 2:w^=(255&i.charCodeAt(S+1))<<8;case 1:h^=w=(65535&(w=(w=(65535&(w^=255&i.charCodeAt(S)))*g+(((w>>>16)*g&65535)<<16)&4294967295)<<15|w>>>17))*v+(((w>>>16)*v&65535)<<16)&4294967295}return h^=i.length,h=2246822507*(65535&(h^=h>>>16))+((2246822507*(h>>>16)&65535)<<16)&4294967295,h=3266489909*(65535&(h^=h>>>13))+((3266489909*(h>>>16)&65535)<<16)&4294967295,(h^=h>>>16)>>>0}),hl.exports),e=(bd||(bd=1,Fu.exports=function(i,s){for(var a,u=i.length,h=s^u,m=0;u>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(m)|(255&i.charCodeAt(++m))<<8|(255&i.charCodeAt(++m))<<16|(255&i.charCodeAt(++m))<<24))+((1540483477*(a>>>16)&65535)<<16),h=1540483477*(65535&h)+((1540483477*(h>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),u-=4,++m;switch(u){case 3:h^=(255&i.charCodeAt(m+2))<<16;case 2:h^=(255&i.charCodeAt(m+1))<<8;case 1:h=1540483477*(65535&(h^=255&i.charCodeAt(m)))+((1540483477*(h>>>16)&65535)<<16)}return h=1540483477*(65535&(h^=h>>>13))+((1540483477*(h>>>16)&65535)<<16),(h^=h>>>15)>>>0}),Fu.exports);return mc.exports=r,mc.exports.murmur3=r,mc.exports.murmur2=e,mc.exports}(),Qn=Zo(wd);class js{constructor(e,...i){Oe(this,i[0]||{}),this.type=e}}class Td extends js{constructor(e,i={}){super("error",Oe({error:e},i))}}function Sd(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function Bu(r,e,i){if(i&&i[r]){const s=i[r].indexOf(e);s!==-1&&i[r].splice(s,1)}}class Sa{on(e,i){return this._listeners=this._listeners||{},Sd(e,i,this._listeners),this}off(e,i){return Bu(e,i,this._listeners),Bu(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Sd(e,i,this._oneTimeListeners),this):new Promise(s=>{this.once(e,s)})}fire(e,i){const s=typeof e=="string"?new js(e,i):e,a=s.type;if(this.listens(a)){s.target=this;const u=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const g of u)g.call(this,s);const h=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const g of h)Bu(a,g,this._oneTimeListeners),g.call(this,s);const m=this._eventedParent;m&&(Oe(s,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),m.fire(s))}else s instanceof Td&&console.error(s.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}class eo{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new eo(e)}static toString(e){return e.iconsetId?`${e.name}${e.iconsetId}`:e.name}static parse(e){const[i,s]=e.split("");return new eo({name:i,iconsetId:s})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return eo.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Ed,Nu={},_c=function(){if(Ed)return Nu;Ed=1;var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function e(u){return(u=Math.round(u))<0?0:u>255?255:u}function i(u){return e(u[u.length-1]==="%"?parseFloat(u)/100*255:parseInt(u))}function s(u){return(h=u[u.length-1]==="%"?parseFloat(u)/100:parseFloat(u))<0?0:h>1?1:h;var h}function a(u,h,m){return m<0?m+=1:m>1&&(m-=1),6*m<1?u+(h-u)*m*6:2*m<1?h:3*m<2?u+(h-u)*(2/3-m)*6:u}try{Nu.parseCSSColor=function(u){var h,m=u.replace(/ /g,"").toLowerCase();if(m in r)return r[m].slice();if(m[0]==="#")return m.length===4?(h=parseInt(m.substr(1),16))>=0&&h<=4095?[(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,1]:null:m.length===7&&(h=parseInt(m.substr(1),16))>=0&&h<=16777215?[(16711680&h)>>16,(65280&h)>>8,255&h,1]:null;var g=m.indexOf("("),v=m.indexOf(")");if(g!==-1&&v+1===m.length){var w=m.substr(0,g),S=m.substr(g+1,v-(g+1)).split(","),A=1;switch(w){case"rgba":if(S.length!==4)return null;A=s(S.pop());case"rgb":return S.length!==3?null:[i(S[0]),i(S[1]),i(S[2]),A];case"hsla":if(S.length!==4)return null;A=s(S.pop());case"hsl":if(S.length!==3)return null;var D=(parseFloat(S[0])%360+360)%360/360,R=s(S[1]),O=s(S[2]),$=O<=.5?O*(R+1):O+R-O*R,H=2*O-$;return[e(255*a(H,$,D+1/3)),e(255*a(H,$,D)),e(255*a(H,$,D-1/3)),A];default:return null}}return null}}catch{}return Nu}();class Fi{constructor(e,i,s,a=1){this.r=e,this.g=i,this.b=s,this.a=a}static parse(e){if(!e)return;if(e instanceof Fi)return e;if(typeof e!="string")return;const i=_c.parseCSSColor(e);return i?new Fi(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toStringPremultipliedAlpha(){const[e,i,s,a]=this.a===0?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(e)},${Math.round(i)},${Math.round(s)},${a})`}toString(){const[e,i,s,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*s)},${a})`}toRenderColor(e){const{r:i,g:s,b:a,a:u}=this;return new Jf(e,i,s,a,u)}clone(){return new Fi(this.r,this.g,this.b,this.a)}}class Jf{constructor(e,i,s,a,u){if(e){const h=e.image.height,m=h*h;i=u===0?0:i/u*(h-1),s=u===0?0:s/u*(h-1),a=u===0?0:a/u*(h-1);const g=Math.floor(i),v=Math.floor(s),w=Math.floor(a),S=Math.ceil(i),A=Math.ceil(s),D=Math.ceil(a),R=i-g,O=s-v,$=a-w,H=e.image.data,K=4*(g+v*m+w*h),W=4*(g+v*m+D*h),F=4*(g+A*m+w*h),q=4*(g+A*m+D*h),Y=4*(S+v*m+w*h),ee=4*(S+v*m+D*h),he=4*(S+A*m+w*h),ye=4*(S+A*m+D*h);if(K<0||ye>=H.length)throw new Error("out of range");this.r=Nt(Nt(Nt(H[K],H[W],$),Nt(H[F],H[q],$),O),Nt(Nt(H[Y],H[ee],$),Nt(H[he],H[ye],$),O),R)/255*u,this.g=Nt(Nt(Nt(H[K+1],H[W+1],$),Nt(H[F+1],H[q+1],$),O),Nt(Nt(H[Y+1],H[ee+1],$),Nt(H[he+1],H[ye+1],$),O),R)/255*u,this.b=Nt(Nt(Nt(H[K+2],H[W+2],$),Nt(H[F+2],H[q+2],$),O),Nt(Nt(H[Y+2],H[ee+2],$),Nt(H[he+2],H[ye+2],$),O),R)/255*u,this.a=u}else this.r=i,this.g=s,this.b=a,this.a=u}toArray(){const{r:e,g:i,b:s,a}=this;return a===0?[0,0,0,0]:[255*e/a,255*i/a,255*s/a,a]}toHslaArray(){if(this.a===0)return[0,0,0,0];const{r:e,g:i,b:s,a}=this,u=Math.min(Math.max(e/a,0),1),h=Math.min(Math.max(i/a,0),1),m=Math.min(Math.max(s/a,0),1),g=Math.min(u,h,m),v=Math.max(u,h,m),w=(g+v)/2;if(g===v)return[0,0,100*w,a];const S=v-g,A=w>.5?S/(2-v-g):S/(v+g);let D=0;return v===u?D=(h-m)/S+(h<m?6:0):v===h?D=(m-u)/S+2:v===m&&(D=(u-h)/S+4),D*=60,[Math.min(Math.max(D,0),360),Math.min(Math.max(100*A,0),100),Math.min(Math.max(100*w,0),100),a]}toArray01(){const{r:e,g:i,b:s,a}=this;return a===0?[0,0,0,0]:[e/a,i/a,s/a,a]}toArray01Scaled(e){const{r:i,g:s,b:a,a:u}=this;return u===0?[0,0,0]:[i/u*e,s/u*e,a/u*e]}toArray01PremultipliedAlpha(){const{r:e,g:i,b:s,a}=this;return[e,i,s,a]}toArray01Linear(){const{r:e,g:i,b:s,a}=this;return a===0?[0,0,0,0]:[Math.pow(e/a,2.2),Math.pow(i/a,2.2),Math.pow(s/a,2.2),a]}}function Nt(r,e,i){return r*(1-i)+e*i}function Qf(r,e,i){return r.map((s,a)=>Nt(s,e[a],i))}function ju(r){return r*r*r*r*r}Fi.black=new Fi(0,0,0,1),Fi.white=new Fi(1,1,1,1),Fi.transparent=new Fi(0,0,0,0),Fi.red=new Fi(1,0,0,1),Fi.blue=new Fi(0,0,1,1);var Vu=Object.freeze({__proto__:null,array:Qf,color:function(r,e,i){return new Fi(Nt(r.r,e.r,i),Nt(r.g,e.g,i),Nt(r.b,e.b,i),Nt(r.a,e.a,i))},easeIn:ju,number:Nt});function gc(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}class _o extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Ea{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,a]of i)this.bindings[s]=a}concat(e){return new Ea(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Vs={kind:"null"},Ft={kind:"number"},er={kind:"string"},$i={kind:"boolean"},qn={kind:"color"},Us={kind:"object"},ji={kind:"value"},Aa={kind:"collator"},yc={kind:"formatted"},vc={kind:"resolvedImage"};function Bn(r,e){return{kind:"array",itemType:r,N:e}}function tn(r){if(r.kind==="array"){const e=tn(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Ty=[Vs,Ft,er,$i,qn,yc,Us,Bn(ji),vc];function xc(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!xc(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of Ty)if(!xc(i,e))return null}}return`Expected ${tn(r)} but found ${tn(e)} instead.`}function Ad(r,e){return e.some(i=>i.kind===r.kind)}function dl(r,e){return e.some(i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r)}class $s{constructor(e,i,s){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Uu{constructor(e,i,s,a,u){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=s,this.fontStack=a,this.textColor=u}}class Nn{constructor(e){this.sections=e}static fromString(e){return new Nn([new Uu(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof Nn?e:Nn.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){const a=i.image.getPrimary().id.toString();e.push(["image",a]);continue}e.push(i.text);const s={};i.fontStack&&(s["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(s["font-scale"]=i.scale),i.textColor&&(s["text-color"]=["rgba"].concat(i.textColor.toRenderColor(null).toArray())),e.push(s)}return e}}class Po{constructor(e,i={}){if(this.id=eo.from(e),this.options=Object.assign({},i),i.transform){const{a:s,b:a,c:u,d:h,e:m,f:g}=i.transform;this.options.transform=new DOMMatrix([s,a,u,h,m,g])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){const{a:e,b:i,c:s,d:a,e:u,f:h}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:e,b:i,c:s,d:a,e:u,f:h}})}static parse(e){let i,s,a,u;try{({name:i,iconsetId:s,params:a,transform:u}=JSON.parse(e)||{})}catch{return null}if(!i)return null;const{a:h,b:m,c:g,d:v,e:w,f:S}=u||{};return new Po({name:i,iconsetId:s},{params:a,transform:new DOMMatrix([h,m,g,v,w,S])})}scaleSelf(e,i){return this.options.transform.scaleSelf(e,i),this}}class Zn{constructor(e,i,s,a,u=!1){this.primaryId=eo.from(e),this.primaryOptions=i,s&&(this.secondaryId=eo.from(s)),this.secondaryOptions=a,this.available=u}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Po(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Po(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?Zn.build({name:e}):e}static build(e,i,s,a){return!e||typeof e=="object"&&!("name"in e)?null:new Zn(e,s,i,a)}}function em(r,e,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,i,s]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function pl(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Fi||r instanceof $s||r instanceof Nn||r instanceof Zn)return!0;if(Array.isArray(r)){for(const e of r)if(!pl(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!pl(r[e]))return!1;return!0}return!1}function hn(r){if(r===null)return Vs;if(typeof r=="string")return er;if(typeof r=="boolean")return $i;if(typeof r=="number")return Ft;if(r instanceof Fi)return qn;if(r instanceof $s)return Aa;if(r instanceof Nn)return yc;if(r instanceof Zn)return vc;if(Array.isArray(r)){const e=r.length;let i;for(const s of r){const a=hn(s);if(i){if(i===a)continue;i=ji;break}i=a}return Bn(i||ji,e)}return Us}function jn(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof Fi?r.toStringPremultipliedAlpha():r instanceof Nn||r instanceof Zn?r.toString():JSON.stringify(r)}class di{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!pl(e[1]))return i.error("invalid value");const s=e[1];let a=hn(s);const u=i.expectedType;return a.kind!=="array"||a.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(a=u),new di(a,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Fi?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof Nn?this.value.serialize():this.value}}class It{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const bc={string:er,number:Ft,boolean:$i,object:Us};class qt{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s,a=1;const u=e[0];if(u==="array"){let m,g;if(e.length>2){const v=e[1];if(typeof v!="string"||!(v in bc)||v==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);m=bc[v],a++}else m=ji;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);g=e[2],a++}s=Bn(m,g)}else s=bc[u];const h=[];for(;a<e.length;a++){const m=i.parse(e[a],a,ji);if(!m)return null;h.push(m)}return new qt(s,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!xc(this.type,hn(s)))return s;if(i===this.args.length-1)throw new It(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${tn(hn(s))} but was expected to be of type ${tn(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const s=e.itemType;if(s.kind==="string"||s.kind==="number"||s.kind==="boolean"){i.push(s.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(s=>s.serialize()))}}class Ia{constructor(e){this.type=yc,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const a=[];let u=!1;for(let h=1;h<=e.length-1;++h){const m=e[h];if(u&&typeof m=="object"&&!Array.isArray(m)){u=!1;let g=null;if(m["font-scale"]&&(g=i.parseObjectValue(m["font-scale"],h,"font-scale",Ft),!g))return null;let v=null;if(m["text-font"]&&(v=i.parseObjectValue(m["text-font"],h,"text-font",Bn(er)),!v))return null;let w=null;if(m["text-color"]&&(w=i.parseObjectValue(m["text-color"],h,"text-color",qn),!w))return null;const S=a[a.length-1];S.scale=g,S.font=v,S.textColor=w}else{const g=i.parse(e[h],h,ji);if(!g)return null;const v=g.type.kind;if(v!=="string"&&v!=="value"&&v!=="null"&&v!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,a.push({content:g,scale:null,font:null,textColor:null})}}return new Ia(a)}evaluate(e){return new Nn(this.sections.map(i=>{const s=i.content.evaluate(e);return hn(s)===vc?new Uu("",s,null,null,null):new Uu(jn(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const s={};i.scale&&(s["font-scale"]=i.scale.serialize()),i.font&&(s["text-font"]=i.font.serialize()),i.textColor&&(s["text-color"]=i.textColor.serialize()),e.push(s)}return e}}class fl{constructor(e,i,s,a){this._imageWarnHistory={},this.type=vc,this.namePrimary=e,this.nameSecondary=i,s&&(this.paramsPrimary=s.params,this.iconsetIdPrimary=s.iconset?s.iconset.id:void 0),a&&(this.paramsSecondary=a.params,this.iconsetIdSecondary=a.iconset?a.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let s=1;const a=[];function u(){if(s<e.length){const m=i.parse(e[s],s++,er);return m?(a.push({image:m,options:{}}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function h(){if(s<e.length){const g=e[s];if((m=g)===null||typeof m!="object"||Array.isArray(m))return!0;const v=g.params,w=g.iconset,S=i.concat(s);if(!v&&!w)return s++,!0;if(v){if(typeof v!="object"||v.constructor!==Object)return S.error('Image options "params" should be an object'),!1;const A={},D=S.concat(void 0,"params");for(const R in v){if(!R)return D.error("Image parameter name should be non-empty"),!1;const O=D.concat(void 0,R).parse(v[R],void 0,qn,void 0,{typeAnnotation:"coerce"});if(!O)return!1;A[R]=O}a[a.length-1].options.params=A}if(w){if(typeof w!="object"||w.constructor!==Object)return S.error('Image options "iconset" should be an object'),!1;if(!w.id)return S.error('Image options "iconset" should have an "id" property'),!1;a[a.length-1].options.iconset=w}return s++,!0}var m;return!0}for(let m=0;m<2;m++)if(!u()||!h())return;return new fl(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){const s={};if(i){for(const a in i)if(i[a])try{s[a]=i[a].evaluate(e)}catch{continue}if(Object.keys(s).length!==0)return{params:s}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},s=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=Zn.build(i,s,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){const u=a.getPrimary().id;if(a.available=e.availableImages.some(h=>eo.isEqual(h,u)),a.available){const h=a.getSecondary()?a.getSecondary().id:null;h&&(a.available=e.availableImages.some(m=>eo.isEqual(m,h)))}}return a}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){const s={};if(i&&(s.iconset={id:i}),e){s.params={};for(const a in e)e[a]&&(s.params[a]=e[a].serialize())}return Object.keys(s).length>0?s:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function Zt(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}const tm={"to-boolean":$i,"to-color":qn,"to-number":Ft,"to-string":er};class Do{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[0],a=[];let u=Vs;if(s==="to-array"){if(!Array.isArray(e[1]))return null;const h=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);u=Bn(i.expectedType.itemType,h)}else{if(!(h>0&&pl(e[1][0])))return null;u=Bn(hn(e[1][0]),h)}for(let m=0;m<h;m++){const g=e[1][m];let v;if(Zt(g)==="array")v=i.parse(g,void 0,u.itemType);else{const w=Zt(g);if(w!==u.itemType.kind)return i.error(`Expected ${u.itemType.kind} but found ${w}.`);v=i.registry.literal.parse(["literal",g===void 0?null:g],i)}if(!v)return null;a.push(v)}}else{if((s==="to-boolean"||s==="to-string")&&e.length!==2)return i.error("Expected one argument.");u=tm[s];for(let h=1;h<e.length;h++){const m=i.parse(e[h],h,ji);if(!m)return null;a.push(m)}}return new Do(u,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,s;for(const a of this.args){if(i=a.evaluate(e),s=null,i instanceof Fi)return i;if(typeof i=="string"){const u=e.parseColor(i);if(u)return u}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:em(i[0],i[1],i[2],i[3]),!s))return new Fi(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new It(s||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const s of this.args){if(i=s.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new It(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?Nn.fromString(jn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Zn.build(jn(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):jn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new Ia([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new fl(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const im=["Unknown","Point","LineString","Polygon"];class $u{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?im[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||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:s,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(s*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=Fi.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class zn{constructor(e,i,s,a,u){this.name=e,this.type=i,this._evaluate=s,this.args=a,this._overloadIndex=u}evaluate(e){if(!this._evaluate){const i=zn.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){const s=e[0],a=zn.definitions[s];if(!a)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(a)?a[0]:a.type,h=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,m=[];let g=null,v=-1;for(const[w,S]of h){if(Array.isArray(w)&&w.length!==e.length-1)continue;m.push(w),v++,g=new dm(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const A=[];let D=!1;for(let R=1;R<e.length;R++){const O=e[R],$=Array.isArray(w)?w[R-1]:w.type,H=g.parse(O,1+A.length,$);if(!H){D=!0;break}A.push(H)}if(!D)if(Array.isArray(w)&&w.length!==A.length)g.error(`Expected ${w.length} arguments, but found ${A.length} instead.`);else{for(let R=0;R<A.length;R++){const O=Array.isArray(w)?w[R]:w.type,$=A[R];g.concat(R+1).checkSubtype(O,$.type)}if(g.errors.length===0)return new zn(s,u,S,A,v)}}if(m.length===1)i.errors.push(...g.errors);else{const w=(m.length?m:h.map(([A])=>A)).map(Vn).join(" | "),S=[];for(let A=1;A<e.length;A++){const D=i.parse(e[A],1+S.length);if(!D)return null;S.push(tn(D.type))}i.error(`Expected arguments of type ${w}, but found (${S.join(", ")}) instead.`)}return null}static register(e,i){zn.definitions=i;for(const s in i)e[s]=zn}}function Vn(r){return Array.isArray(r)?`(${r.map(tn).join(", ")})`:`(${tn(r.type)}...)`}class ml{constructor(e,i,s){this.type=Aa,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const a=s["case-sensitive"]===void 0?i.parse(!1,1,$i):i.parseObjectValue(s["case-sensitive"],1,"case-sensitive",$i);if(!a)return null;const u=s["diacritic-sensitive"]===void 0?i.parse(!1,1,$i):i.parseObjectValue(s["diacritic-sensitive"],1,"diacritic-sensitive",$i);if(!u)return null;let h=null;return s.locale&&(h=i.parseObjectValue(s.locale,1,"locale",er),!h)?null:new ml(a,u,h)}evaluate(e){return new $s(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function Gs(r,e,i=0,s=r.length-1,a=Ma){for(;s>i;){if(s-i>600){const g=s-i+1,v=e-i+1,w=Math.log(g),S=.5*Math.exp(2*w/3),A=.5*Math.sqrt(w*S*(g-S)/g)*(v-g/2<0?-1:1);Gs(r,e,Math.max(i,Math.floor(e-v*S/g+A)),Math.min(s,Math.floor(e+(g-v)*S/g+A)),a)}const u=r[e];let h=i,m=s;for(Ca(r,i,e),a(r[s],u)>0&&Ca(r,i,s);h<m;){for(Ca(r,h,m),h++,m--;a(r[h],u)<0;)h++;for(;a(r[m],u)>0;)m--}a(r[i],u)===0?Ca(r,i,m):(m++,Ca(r,m,s)),m<=e&&(i=m+1),e<=m&&(s=m-1)}}function Ca(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Ma(r,e){return r<e?-1:r>e?1:0}function Un(r){let e=0;for(let i,s,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],s=r[h],e+=(s.x-i.x)*(i.y+s.y);return e}function wc(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function Tc(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function Sy(r,e,i){const s=r[0]-e[0],a=r[1]-e[1],u=r[0]-i[0],h=r[1]-i[1];return s*h-u*a==0&&s*u<=0&&a*h<=0}function gs(r,e,i=!1){let s=!1;for(let m=0,g=e.length;m<g;m++){const v=e[m];for(let w=0,S=v.length,A=S-1;w<S;A=w++){const D=v[A],R=v[w];if(Sy(r,D,R))return i;(u=D)[1]>(a=r)[1]!=(h=R)[1]>a[1]&&a[0]<(h[0]-u[0])*(a[1]-u[1])/(h[1]-u[1])+u[0]&&(s=!s)}}var a,u,h;return s}function Id(r,e,i,s){const a=s[0]-i[0],u=s[1]-i[1],h=(r[0]-i[0])*u-a*(r[1]-i[1]),m=(e[0]-i[0])*u-a*(e[1]-i[1]);return h>0&&m<0||h<0&&m>0}function Xo(r,e,i,s){return(a=[s[0]-i[0],s[1]-i[1]])[0]*(u=[e[0]-r[0],e[1]-r[1]])[1]-a[1]*u[0]!=0&&!(!Id(r,e,i,s)||!Id(i,s,r,e));var a,u}function Cd(r){const e=new ft(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new ft(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const s of r[0])e.x>s.x&&(e.x=s.x),e.y>s.y&&(e.y=s.y),i.x<s.x&&(i.x=s.x),i.y<s.y&&(i.y=s.y);return{min:e,max:i}}const Hs=8192;function Ey(r,e){const i=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,a=Math.pow(2,e.z);return[Math.round(i*a*Hs),Math.round(s*a*Hs)]}function Ay(r,e){for(let i=0;i<e.length;i++)if(gs(r,e[i]))return!0;return!1}function rm(r,e,i){for(const s of i)for(let a=0,u=s.length,h=u-1;a<u;h=a++)if(Xo(r,e,s[h],s[a]))return!0;return!1}function nm(r,e){for(let i=0;i<r.length;++i)if(!gs(r[i],e))return!1;for(let i=0;i<r.length-1;++i)if(rm(r[i],r[i+1],e))return!1;return!0}function Iy(r,e){for(let i=0;i<e.length;i++)if(nm(r,e[i]))return!0;return!1}function Gu(r,e,i){const s=[];for(let a=0;a<r.length;a++){const u=[];for(let h=0;h<r[a].length;h++){const m=Ey(r[a][h],i);wc(e,m),u.push(m)}s.push(u)}return s}function om(r,e,i){const s=[];for(let a=0;a<r.length;a++){const u=Gu(r[a],e,i);s.push(u)}return s}function qs(r,e,i,s){if(r[0]<i[0]||r[0]>i[2]){const a=.5*s;let u=r[0]-i[0]>a?-s:i[0]-r[0]>a?s:0;u===0&&(u=r[0]-i[2]>a?-s:i[2]-r[0]>a?s:0),r[0]+=u}wc(e,r)}function sm(r,e,i,s){const a=Math.pow(2,s.z)*Hs,u=[s.x*Hs,s.y*Hs],h=[];if(!r)return h;for(const m of r)for(const g of m){const v=[g.x+u[0],g.y+u[1]];qs(v,e,i,a),h.push(v)}return h}function am(r,e,i,s){const a=Math.pow(2,s.z)*Hs,u=[s.x*Hs,s.y*Hs],h=[];if(!r)return h;for(const g of r){const v=[];for(const w of g){const S=[w.x+u[0],w.y+u[1]];wc(e,S),v.push(S)}h.push(v)}if(e[2]-e[0]<=a/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of h)for(const v of g)qs(v,e,i,a)}var m;return h}class ys{constructor(e,i){this.type=$i,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(pl(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let a=0;a<s.features.length;++a){const u=s.features[a].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new ys(s,s.features[a].geometry)}else if(s.type==="Feature"){const a=s.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new ys(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new ys(s,s)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(i,s){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(s.type==="Polygon"){const m=Gu(s.coordinates,u,h),g=sm(i.geometry(),a,u,h);if(!Tc(a,u))return!1;for(const v of g)if(!gs(v,m))return!1}if(s.type==="MultiPolygon"){const m=om(s.coordinates,u,h),g=sm(i.geometry(),a,u,h);if(!Tc(a,u))return!1;for(const v of g)if(!Ay(v,m))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(i,s){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(s.type==="Polygon"){const m=Gu(s.coordinates,u,h),g=am(i.geometry(),a,u,h);if(!Tc(a,u))return!1;for(const v of g)if(!nm(v,m))return!1}if(s.type==="MultiPolygon"){const m=om(s.coordinates,u,h),g=am(i.geometry(),a,u,h);if(!Tc(a,u))return!1;for(const v of g)if(!Iy(v,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Sc={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Md=1/298.257223563,go=Md*(2-Md),_l=Math.PI/180;class gl{static fromTile(e,i,s){const a=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),u=Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/_l;return new gl(u,s)}static get units(){return Sc}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!Sc[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(Sc).join(", ")}`);const s=6378.137*_l*(i?Sc[i]:1),a=Math.cos(e*_l),u=1/(1-go*(1-a*a)),h=Math.sqrt(u);this.kx=s*h*a,this.ky=s*h*u*(1-go)}distance(e,i){const s=so(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+a*a)}bearing(e,i){const s=so(i[0]-e[0])*this.kx;return Math.atan2(s,(i[1]-e[1])*this.ky)/_l}destination(e,i,s){const a=s*_l;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,s){return[e[0]+i/this.kx,e[1]+s/this.ky]}lineDistance(e){let i=0;for(let s=0;s<e.length-1;s++)i+=this.distance(e[s],e[s+1]);return i}area(e){let i=0;for(let s=0;s<e.length;s++){const a=e[s];for(let u=0,h=a.length,m=h-1;u<h;m=u++)i+=so(a[u][0]-a[m][0])*(a[u][1]+a[m][1])*(s?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let s=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){const u=e[a],h=e[a+1],m=this.distance(u,h);if(s+=m,s>i)return Hu(u,h,(i-(s-m))/m)}return e[e.length-1]}pointToSegmentDistance(e,i,s){let[a,u]=i,h=so(s[0]-a)*this.kx,m=(s[1]-u)*this.ky;if(h!==0||m!==0){const g=(so(e[0]-a)*this.kx*h+(e[1]-u)*this.ky*m)/(h*h+m*m);g>1?(a=s[0],u=s[1]):g>0&&(a+=h/this.kx*g,u+=m/this.ky*g)}return h=so(e[0]-a)*this.kx,m=(e[1]-u)*this.ky,Math.sqrt(h*h+m*m)}pointOnLine(e,i){let s=1/0,a=e[0][0],u=e[0][1],h=0,m=0;for(let g=0;g<e.length-1;g++){let v=e[g][0],w=e[g][1],S=so(e[g+1][0]-v)*this.kx,A=(e[g+1][1]-w)*this.ky,D=0;S===0&&A===0||(D=(so(i[0]-v)*this.kx*S+(i[1]-w)*this.ky*A)/(S*S+A*A),D>1?(v=e[g+1][0],w=e[g+1][1]):D>0&&(v+=S/this.kx*D,w+=A/this.ky*D)),S=so(i[0]-v)*this.kx,A=(i[1]-w)*this.ky;const R=S*S+A*A;R<s&&(s=R,a=v,u=w,h=g,m=D)}return{point:[a,u],index:h,t:Math.max(0,Math.min(1,m))}}lineSlice(e,i,s){let a=this.pointOnLine(s,e),u=this.pointOnLine(s,i);if(a.index>u.index||a.index===u.index&&a.t>u.t){const v=a;a=u,u=v}const h=[a.point],m=a.index+1,g=u.index;!Pd(s[m],h[0])&&m<=g&&h.push(s[m]);for(let v=m+1;v<=g;v++)h.push(s[v]);return Pd(s[g],u.point)||h.push(u.point),h}lineSliceAlong(e,i,s){let a=0;const u=[];for(let h=0;h<s.length-1;h++){const m=s[h],g=s[h+1],v=this.distance(m,g);if(a+=v,a>e&&u.length===0&&u.push(Hu(m,g,(e-(a-v))/v)),a>=i)return u.push(Hu(m,g,(i-(a-v))/v)),u;a>e&&u.push(g)}return u}bufferPoint(e,i){const s=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-s,e[0]+a,e[1]+s]}bufferBBox(e,i){const s=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-s,e[2]+a,e[3]+s]}insideBBox(e,i){return so(e[0]-i[0])>=0&&so(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function Pd(r,e){return r[0]===e[0]&&r[1]===e[1]}function Hu(r,e,i){const s=so(e[0]-r[0]);return[r[0]+s*i,r[1]+(e[1]-r[1])*i]}function so(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}class qu{constructor(e=[],i=(s,a)=>s<a?-1:s>a?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,a=i[e];for(;e>0;){const u=e-1>>1,h=i[u];if(s(a,h)>=0)break;i[e]=h,e=u}i[e]=a}_down(e){const{data:i,compare:s}=this,a=this.length>>1,u=i[e];for(;e<a;){let h=1+(e<<1);const m=h+1;if(m<this.length&&s(i[m],i[h])<0&&(h=m),s(i[h],u)>=0)break;i[e]=i[h],e=h}i[e]=u}}var _t=8192;function Dd(r,e){return e.dist-r.dist}const Zu=100,Wu=50;function Rd(r){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==r.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==r[i])return!1;return!0}function Pa(r){return r[1]-r[0]+1}function yo(r,e){const i=r[1]>=r[0]&&r[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function yl(r,e){if(r[0]>r[1])return[null,null];const i=Pa(r);if(e){if(i===2)return[r,null];const s=Math.floor(i/2);return[[r[0],r[0]+s],[r[0]+s,r[1]]]}{if(i===1)return[r,null];const s=Math.floor(i/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}}function Zs(r,e){const i=[1/0,1/0,-1/0,-1/0];if(!yo(e,r.length))return i;for(let s=e[0];s<=e[1];++s)wc(i,r[s]);return i}function Ec(r){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<r.length;++i)for(let s=0;s<r[i].length;++s)wc(e,r[i][s]);return e}function Da(r,e,i){if(Rd(r)||Rd(e))return NaN;let s=0,a=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(a=r[1]-e[3]),r[3]<e[1]&&(a=e[1]-r[3]),i.distance([0,0],[s,a])}function vl(r){return 360*r-180}function Mi(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function zd(r,e){const i=Math.pow(2,e.z),s=(r.y/_t+e.y)/i;return[vl((r.x/_t+e.x)/i),Mi(s)]}function Cy(r,e){const i=[];for(let s=0;s<r.length;++s)i.push(zd(r[s],e));return i}function lm(r,e,i){const s=i.pointOnLine(e,r).point;return i.distance(r,s)}function Ld(r,e,i,s,a){const u=i.slice(s[0],s[1]+1);let h=1/0;for(let m=e[0];m<=e[1];++m)if((h=Math.min(h,lm(r[m],u,a)))===0)return 0;return h}function kd(r,e,i,s,a){const u=Math.min(a.pointToSegmentDistance(r,i,s),a.pointToSegmentDistance(e,i,s)),h=Math.min(a.pointToSegmentDistance(i,r,e),a.pointToSegmentDistance(s,r,e));return Math.min(u,h)}function zr(r,e,i,s,a){if(!yo(e,r.length)||!yo(s,i.length))return NaN;let u=1/0;for(let h=e[0];h<e[1];++h)for(let m=s[0];m<s[1];++m){if(Xo(r[h],r[h+1],i[m],i[m+1]))return 0;u=Math.min(u,kd(r[h],r[h+1],i[m],i[m+1],a))}return u}function My(r,e,i,s,a){if(!yo(e,r.length)||!yo(s,i.length))return NaN;let u=1/0;for(let h=e[0];h<=e[1];++h)for(let m=s[0];m<=s[1];++m)if((u=Math.min(u,a.distance(r[h],i[m])))===0)return u;return u}function Py(r,e,i){if(gs(r,e,!0))return 0;let s=1/0;for(const a of e){const u=a.length;if(u<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(a[0]!==a[u-1]&&(s=Math.min(s,i.pointToSegmentDistance(r,a[u-1],a[0])))===0||(s=Math.min(s,lm(r,a,i)))===0)return s}return s}function Dy(r,e,i,s){if(!yo(e,r.length))return NaN;for(let u=e[0];u<=e[1];++u)if(gs(r[u],i,!0))return 0;let a=1/0;for(let u=e[0];u<e[1];++u)for(const h of i)for(let m=0,g=h.length,v=g-1;m<g;v=m++){if(Xo(r[u],r[u+1],h[v],h[m]))return 0;a=Math.min(a,kd(r[u],r[u+1],h[v],h[m],s))}return a}function cm(r,e){for(const i of r)for(let s=0;s<=i.length-1;++s)if(gs(i[s],e,!0))return!0;return!1}function Ry(r,e,i,s=1/0){const a=Ec(r),u=Ec(e);if(s!==1/0&&Da(a,u,i)>=s)return s;if(Tc(a,u)){if(cm(r,e))return 0}else if(cm(e,r))return 0;let h=s;for(const m of r)for(let g=0,v=m.length,w=v-1;g<v;w=g++)for(const S of e)for(let A=0,D=S.length,R=D-1;A<D;R=A++){if(Xo(m[w],m[g],S[R],S[A]))return 0;h=Math.min(h,kd(m[w],m[g],S[R],S[A],i))}return h}function Xu(r,e,i,s,a,u,h){if(u===null||h===null)return;const m=Da(Zs(s,u),Zs(a,h),i);m<e&&r.push({dist:m,range1:u,range2:h})}function zy(r,e,i,s,a=1/0){let u=Math.min(s.distance(r[0],i[0][0]),a);if(u===0)return u;const h=new qu([{dist:0,range1:[0,r.length-1],range2:[0,0]}],Dd),m=e?Wu:Zu,g=Ec(i);for(;h.length;){const v=h.pop();if(v.dist>=u)continue;const w=v.range1;if(Pa(w)<=m){if(!yo(w,r.length))return NaN;if(e){const S=Dy(r,w,i,s);if((u=Math.min(u,S))===0)return u}else for(let S=w[0];S<=w[1];++S){const A=Py(r[S],i,s);if((u=Math.min(u,A))===0)return u}}else{const S=yl(w,e);if(S[0]!==null){const A=Da(Zs(r,S[0]),g,s);A<u&&h.push({dist:A,range1:S[0],range2:[0,0]})}if(S[1]!==null){const A=Da(Zs(r,S[1]),g,s);A<u&&h.push({dist:A,range1:S[1],range2:[0,0]})}}}return u}function um(r,e,i,s,a,u=1/0){let h=Math.min(u,a.distance(r[0],i[0]));if(h===0)return h;const m=new qu([{dist:0,range1:[0,r.length-1],range2:[0,i.length-1]}],Dd),g=e?Wu:Zu,v=s?Wu:Zu;for(;m.length;){const w=m.pop();if(w.dist>=h)continue;const S=w.range1,A=w.range2;if(Pa(S)<=g&&Pa(A)<=v){if(!yo(S,r.length)||!yo(A,i.length))return NaN;if(e&&s?h=Math.min(h,zr(r,S,i,A,a)):e||s?e&&!s?h=Math.min(h,Ld(i,A,r,S,a)):!e&&s&&(h=Math.min(h,Ld(r,S,i,A,a))):h=Math.min(h,My(r,S,i,A,a)),h===0)return h}else{const D=yl(S,e),R=yl(A,s);Xu(m,h,a,r,i,D[0],R[0]),Xu(m,h,a,r,i,D[0],R[1]),Xu(m,h,a,r,i,D[1],R[0]),Xu(m,h,a,r,i,D[1],R[1])}}return h}function Od(r,e,i,s,a=1/0){let u=a;const h=Zs(r,[0,r.length-1]);for(const m of i)if(!(u!==1/0&&Da(h,Zs(m,[0,m.length-1]),s)>=u)&&(u=Math.min(u,um(r,e,m,!0,s,u)),u===0))return u;return u}function Yu(r,e,i,s,a=1/0){let u=a;const h=Zs(r,[0,r.length-1]);for(const m of i){if(u!==1/0&&Da(h,Ec(m),s)>=u)continue;const g=zy(r,e,m,s,u);if(isNaN(g))return g;if((u=Math.min(u,g))===0)return u}return u}function Fd(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class Ra{constructor(e,i){this.type=Ft,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(pl(e[1])){const s=e[1];if(s.type==="FeatureCollection"){for(let a=0;a<s.features.length;++a)if(Fd(s.features[a].geometry.type))return new Ra(s,s.features[a].geometry)}else if(s.type==="Feature"){if(Fd(s.geometry.type))return new Ra(s,s.geometry)}else if(Fd(s.type))return new Ra(s,s)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),s=e.canonicalID();if(i!=null&&s!=null){if(e.geometryType()==="Point")return function(a,u,h){const m=[];for(const v of a)for(const w of v)m.push(zd(w,u));const g=new gl(m[0][1],"meters");return h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString"?um(m,!1,h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",g):h.type==="MultiLineString"?Od(m,!1,h.coordinates,g):h.type==="Polygon"||h.type==="MultiPolygon"?Yu(m,!1,h.type==="Polygon"?[h.coordinates]:h.coordinates,g):null}(i,s,this.geometries);if(e.geometryType()==="LineString")return function(a,u,h){const m=[];for(const v of a){const w=[];for(const S of v)w.push(zd(S,u));m.push(w)}const g=new gl(m[0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return Od(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",m,g);if(h.type==="MultiLineString"){let v=1/0;for(let w=0;w<h.coordinates.length;w++){const S=Od(h.coordinates[w],!0,m,g,v);if(isNaN(S))return S;if((v=Math.min(v,S))===0)return v}return v}if(h.type==="Polygon"||h.type==="MultiPolygon"){let v=1/0;for(let w=0;w<m.length;w++){const S=Yu(m[w],!0,h.type==="Polygon"?[h.coordinates]:h.coordinates,g,v);if(isNaN(S))return S;if((v=Math.min(v,S))===0)return v}return v}return null}(i,s,this.geometries);if(e.geometryType()==="Polygon")return function(a,u,h){const m=[];for(const v of function(w,S){const A=w.length;if(A<=1)return[w];const D=[];let R,O;for(let $=0;$<A;$++){const H=Un(w[$]);H!==0&&(w[$].area=Math.abs(H),O===void 0&&(O=H<0),O===H<0?(R&&D.push(R),R=[w[$]]):R.push(w[$]))}return R&&D.push(R),D}(a)){const w=[];for(let S=0;S<v.length;++S)w.push(Cy(v[S],u));m.push(w)}const g=new gl(m[0][0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return Yu(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",m,g);if(h.type==="MultiLineString"){let v=1/0;for(let w=0;w<h.coordinates.length;w++){const S=Yu(h.coordinates[w],!0,m,g,v);if(isNaN(S))return S;if((v=Math.min(v,S))===0)return v}return v}return h.type==="Polygon"||h.type==="MultiPolygon"?function(v,w,S){let A=1/0;for(const D of v)for(const R of w){const O=Ry(D,R,S,A);if(isNaN(O))return O;if((A=Math.min(A,O))===0)return A}return A}(h.type==="Polygon"?[h.coordinates]:h.coordinates,m,g):null}(i,s,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function Bd(r,e){switch(r){case"string":return jn(e);case"number":return+e;case"boolean":return!!e;case"color":return Fi.parse(e);case"formatted":return Nn.fromString(jn(e));case"resolvedImage":return Zn.build(jn(e))}return e}function hm(r,e,i,s){return s!==void 0&&(r=s*Math.round(r/s)),e!==void 0&&r<e&&(r=e),i!==void 0&&r>i&&(r=i),r}class xl{constructor(e,i,s){this.type=e,this.key=i,this.scope=s}static parse(e,i){let s=i.expectedType;if(s==null&&(s=ji),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const a=i.parse(e[1],1);if(!(a instanceof di))return i.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){const u=i.parse(e[2],2);return u instanceof di?new xl(s,jn(a.value),jn(u.value)):i.error("Scope of 'config' expression must be a string literal.")}return new xl(s,jn(a.value))}evaluate(e){const i=[this.key,this.scope,e.scope].filter(Boolean).join(""),s=e.getConfig(i);if(!s)return null;const{type:a,value:u,values:h,minValue:m,maxValue:g,stepValue:v}=s,w=s.default.evaluate(e);let S=w;if(u){const A=e.scope;e.scope=(A||"").split("").slice(1).join(""),S=u.evaluate(e),e.scope=A}return a&&(S=Bd(a,S)),S===void 0||m===void 0&&g===void 0&&v===void 0||(typeof S=="number"?S=hm(S,m,g,v):Array.isArray(S)&&(S=S.map(A=>typeof A=="number"?hm(A,m,g,v):A))),u!==void 0&&S!==void 0&&h&&!h.includes(S)&&(S=w,a&&(S=Bd(a,S))),(a&&a!==this.type||S!==void 0&&hn(S)!==this.type)&&(S=Bd(this.type.kind,S)),S}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.key),e}}function Ac(r){if(r instanceof zn&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof ys||r instanceof Ra)return!1;let e=!0;return r.eachChild(i=>{e&&!Ac(i)&&(e=!1)}),e}function Ku(r){if(r instanceof zn&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(i=>{e&&!Ku(i)&&(e=!1)}),e}function Ju(r){if(r instanceof xl)return new Set([r.key]);let e=new Set;return r.eachChild(i=>{e=new Set([...e,...Ju(i)])}),e}function bl(r,e){if(r instanceof zn&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild(s=>{i&&!bl(s,e)&&(i=!1)}),i}class Qu{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=e[1];return i.scope.has(s)?new Qu(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Nd{constructor(e,i=[],s,a=new Ea,u=[],h,m){this.registry=e,this.path=i,this.key=i.map(g=>typeof g=="string"?`['${g}']`:`[${g}]`).join(""),this.scope=a,this.errors=u,this.expectedType=s,this._scope=h,this.options=m}parse(e,i,s,a,u={}){return i||s?this.concat(i,null,s,a)._parse(e,u):this._parse(e,u)}parseObjectValue(e,i,s,a,u,h={}){return this.concat(i,s,a,u)._parse(e,h)}_parse(e,i){function s(a,u,h){return h==="assert"?new qt(u,[a]):h==="coerce"?new Do(u,[a]):a}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const a=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(a){let u=a.parse(e,this);if(!u)return null;if(this.expectedType){const h=this.expectedType,m=u.type;if(h.kind!=="string"&&h.kind!=="number"&&h.kind!=="boolean"&&h.kind!=="object"&&h.kind!=="array"||m.kind!=="value")if(h.kind!=="color"&&h.kind!=="formatted"&&h.kind!=="resolvedImage"||m.kind!=="value"&&m.kind!=="string"){if(this.checkSubtype(h,m))return null}else u=s(u,h,i.typeAnnotation||"coerce");else u=s(u,h,i.typeAnnotation||"assert")}if(!(u instanceof di)&&u.type.kind!=="resolvedImage"&&jd(u)){const h=new $u(this._scope,this.options);try{u=new di(u.type,u.evaluate(h))}catch(m){return this.error(m.message),null}}return u}return Do.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,s,a){let u=typeof e=="number"?this.path.concat(e):this.path;u=typeof i=="string"?u.concat(i):u;const h=a?this.scope.concat(a):this.scope;return new Nd(this.registry,u,s||null,h,this.errors,this._scope,this.options)}error(e,...i){const s=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new _o(s,e))}checkSubtype(e,i){const s=xc(e,i);return s&&this.error(s),s}}var dm=Nd;function jd(r){if(r instanceof Qu)return jd(r.boundExpression);if(r instanceof zn&&r.name==="error"||r instanceof ml||r instanceof ys||r instanceof Ra||r instanceof xl)return!1;const e=r instanceof Do||r instanceof qt;let i=!0;return r.eachChild(s=>{i=e?i&&jd(s):i&&s instanceof di}),!!i&&Ac(r)&&bl(r,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function eh(r,e){const i=r.length-1;let s,a,u=0,h=i,m=0;for(;u<=h;)if(m=Math.floor((u+h)/2),s=r[m],a=r[m+1],s<=e){if(m===i||e<a)return m;u=m+1}else{if(!(s>e))throw new It("Input is not a number.");h=m-1}return 0}class Ic{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,u]of s)this.labels.push(a),this.outputs.push(u)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const s=i.parse(e[1],1,Ft);if(!s)return null;const a=[];let u=null;i.expectedType&&i.expectedType.kind!=="value"&&(u=i.expectedType);for(let h=1;h<e.length;h+=2){const m=h===1?-1/0:e[h],g=e[h+1],v=h,w=h+1;if(typeof m!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',v);if(a.length&&a[a.length-1][0]>=m)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',v);const S=i.parse(g,w,u);if(!S)return null;u=u||S.type,a.push([m,S])}return new Ic(u,s,a)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return s[0].evaluate(e);const u=i.length;return a>=i[u-1]?s[u-1].evaluate(e):s[eh(i,a)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const pm=.95047,fm=1.08883,mm=4/29,wl=6/29,_m=3*wl*wl,Ly=wl*wl*wl,Vd=Math.PI/180,ky=180/Math.PI;function th(r){return r>Ly?Math.pow(r,1/3):r/_m+mm}function Ud(r){return r>wl?r*r*r:_m*(r-mm)}function $d(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function Gd(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Hd(r){const e=Gd(r.r),i=Gd(r.g),s=Gd(r.b),a=th((.4124564*e+.3575761*i+.1804375*s)/pm),u=th((.2126729*e+.7151522*i+.072175*s)/1);return{l:116*u-16,a:500*(a-u),b:200*(u-th((.0193339*e+.119192*i+.9503041*s)/fm)),alpha:r.a}}function qd(r){let e=(r.l+16)/116,i=isNaN(r.a)?e:e+r.a/500,s=isNaN(r.b)?e:e-r.b/200;return e=1*Ud(e),i=pm*Ud(i),s=fm*Ud(s),new Fi($d(3.2404542*i-1.5371385*e-.4985314*s),$d(-.969266*i+1.8760108*e+.041556*s),$d(.0556434*i-.2040259*e+1.0572252*s),r.alpha)}function Tl(r,e,i){const s=e-r;return r+i*(s>180||s<-180?s-360*Math.round(s/360):s)}const Sl={forward:Hd,reverse:qd,interpolate:function(r,e,i){return{l:Nt(r.l,e.l,i),a:Nt(r.a,e.a,i),b:Nt(r.b,e.b,i),alpha:Nt(r.alpha,e.alpha,i)}}},El={forward:function(r){const{l:e,a:i,b:s}=Hd(r),a=Math.atan2(s,i)*ky;return{h:a<0?a+360:a,c:Math.sqrt(i*i+s*s),l:e,alpha:r.a}},reverse:function(r){const e=r.h*Vd,i=r.c;return qd({l:r.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:r.alpha})},interpolate:function(r,e,i){return{h:Tl(r.h,e.h,i),c:Nt(r.c,e.c,i),l:Nt(r.l,e.l,i),alpha:Nt(r.alpha,e.alpha,i)}}};var gm=Object.freeze({__proto__:null,hcl:El,lab:Sl});class Wn{constructor(e,i,s,a,u){this.type=e,this.operator=i,this.interpolation=s,this.input=a,this.labels=[],this.outputs=[];for(const[h,m]of u)this.labels.push(h),this.outputs.push(m)}static interpolationFactor(e,i,s,a){let u=0;if(e.name==="exponential")u=Cc(i,e.base,s,a);else if(e.name==="linear")u=Cc(i,1,s,a);else if(e.name==="cubic-bezier"){const h=e.controlPoints;u=new Pu(h[0],h[1],h[2],h[3]).solve(Cc(i,1,s,a))}return u}static parse(e,i){let[s,a,u,...h]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const v=a[1];if(typeof v!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:v}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const v=a.slice(1);if(v.length!==4||v.some(w=>typeof w!="number"||w<0||w>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:v}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(u=i.parse(u,2,Ft),!u)return null;const m=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=qn:i.expectedType&&i.expectedType.kind!=="value"&&(g=i.expectedType);for(let v=0;v<h.length;v+=2){const w=h[v],S=h[v+1],A=v+3,D=v+4;if(typeof w!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(m.length&&m[m.length-1][0]>=w)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const R=i.parse(S,D,g);if(!R)return null;g=g||R.type,m.push([w,R])}return g.kind==="number"||g.kind==="color"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new Wn(g,s,a,u,m):i.error(`Type ${tn(g)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return s[0].evaluate(e);const u=i.length;if(a>=i[u-1])return s[u-1].evaluate(e);const h=eh(i,a),m=Wn.interpolationFactor(this.interpolation,a,i[h],i[h+1]),g=s[h].evaluate(e),v=s[h+1].evaluate(e);return this.operator==="interpolate"?Vu[this.type.kind.toLowerCase()](g,v,m):this.operator==="interpolate-hcl"?El.reverse(El.interpolate(El.forward(g),El.forward(v),m)):Sl.reverse(Sl.interpolate(Sl.forward(g),Sl.forward(v),m))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,e,this.input.serialize()];for(let s=0;s<this.labels.length;s++)i.push(this.labels[s],this.outputs[s].serialize());return i}}function Cc(r,e,i,s){const a=s-i,u=r-i;return a===0?0:e===1?u/a:(Math.pow(e,u)-1)/(Math.pow(e,a)-1)}class ih{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let s=null;const a=i.expectedType;a&&a.kind!=="value"&&(s=a);const u=[];for(const m of e.slice(1)){const g=i.parse(m,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,u.push(g)}const h=a&&u.some(m=>xc(a,m.type));return new ih(h?ji:s,u)}evaluate(e){let i,s=null,a=0;for(const u of this.args){if(a++,s=u.evaluate(e),s&&s instanceof Zn&&!s.available&&(i||(i=s),s=null,a===this.args.length))return i;if(s!==null)break}return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class rh{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u<e.length-1;u+=2){const h=e[u];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,u);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",u);const m=i.parse(e[u+1],u+1);if(!m)return null;s.push([h,m])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return a?new rh(s,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,s]of this.bindings)e.push(i,s.serialize());return e.push(this.result.serialize()),e}}class nh{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Ft),a=i.parse(e[2],2,Bn(i.expectedType||ji));return s&&a?new nh(a.type.itemType,s,a):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new It(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new It(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new It(`Array index must be an integer, but found ${i} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return s[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class oh{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Ft),a=i.parse(e[2],2,Bn(i.expectedType||ji));return s&&a?new oh(a.type.itemType,s,a):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new It(`Array index out of bounds: ${i} < 0.`);if(i>s.length-1)throw new It(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i===Math.floor(i))return s[i];const a=Math.floor(i),u=Math.ceil(i),h=s[a],m=s[u];if(typeof h!="number"||typeof m!="number")throw new It(`Cannot interpolate between non-number values at index ${i}.`);const g=i-a;return h*(1-g)+m*g}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Zd{constructor(e,i){this.type=$i,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,ji),a=i.parse(e[2],2,ji);return s&&a?Ad(s.type,[$i,er,Ft,Vs,ji])?new Zd(s,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${tn(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(s==null)return!1;if(!dl(i,["boolean","string","number","null"]))throw new It(`Expected first argument to be of type boolean, string, number or null, but found ${tn(hn(i))} instead.`);if(!dl(s,["string","array"]))throw new It(`Expected second argument to be of type array or string, but found ${tn(hn(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class sh{constructor(e,i,s){this.type=Ft,this.needle=e,this.haystack=i,this.fromIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,ji),a=i.parse(e[2],2,ji);if(!s||!a)return null;if(!Ad(s.type,[$i,er,Ft,Vs,ji]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${tn(s.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,Ft);return u?new sh(s,a,u):null}return new sh(s,a)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!dl(i,["boolean","string","number","null"]))throw new It(`Expected first argument to be of type boolean, string, number or null, but found ${tn(hn(i))} instead.`);if(!dl(s,["string","array"]))throw new It(`Expected second argument to be of type array or string, but found ${tn(hn(s))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return s.indexOf(i,a)}return s.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Wd{constructor(e,i,s,a,u,h){this.inputType=e,this.type=i,this.input=s,this.cases=a,this.outputs=u,this.otherwise=h}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let s,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const u={},h=[];for(let v=2;v<e.length-1;v+=2){let w=e[v];const S=e[v+1];Array.isArray(w)||(w=[w]);const A=i.concat(v);if(w.length===0)return A.error("Expected at least one branch label.");for(const R of w){if(typeof R!="number"&&typeof R!="string")return A.error("Branch labels must be numbers or strings.");if(typeof R=="number"&&Math.abs(R)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof R=="number"&&Math.floor(R)!==R)return A.error("Numeric branch labels must be integer values.");if(s){if(A.checkSubtype(s,hn(R)))return null}else s=hn(R);if(u[String(R)]!==void 0)return A.error("Branch labels must be unique.");u[String(R)]=h.length}const D=i.parse(S,v,a);if(!D)return null;a=a||D.type,h.push(D)}const m=i.parse(e[1],1,ji);if(!m)return null;const g=i.parse(e[e.length-1],e.length-1,a);return g?m.type.kind!=="value"&&i.concat(1).checkSubtype(s,m.type)?null:new Wd(s,a,m,u,h,g):null}evaluate(e){const i=this.input.evaluate(e);return(hn(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),s=[],a={};for(const h of i){const m=a[this.cases[h]];m===void 0?(a[this.cases[h]]=s.length,s.push([this.cases[h],[h]])):s[m][1].push(h)}const u=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,m]of s)e.push(m.length===1?u(m[0]):m.map(u)),e.push(this.outputs[h].serialize());return e.push(this.otherwise.serialize()),e}}class ah{constructor(e,i,s){this.type=e,this.branches=i,this.otherwise=s}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const a=[];for(let h=1;h<e.length-1;h+=2){const m=i.parse(e[h],h,$i);if(!m)return null;const g=i.parse(e[h+1],h+1,s);if(!g)return null;a.push([m,g]),s=s||g.type}const u=i.parse(e[e.length-1],e.length-1,s);return u?new ah(s,a,u):null}evaluate(e){for(const[i,s]of this.branches)if(i.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,s]of this.branches)e(i),e(s);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Mc{constructor(e,i,s,a){this.type=e,this.input=i,this.beginIndex=s,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,ji),a=i.parse(e[2],2,Ft);if(!s||!a)return null;if(!Ad(s.type,[Bn(ji),er,ji]))return i.error(`Expected first argument to be of type array or string, but found ${tn(s.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,Ft);return u?new Mc(s.type,s,a,u):null}return new Mc(s.type,s,a)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!dl(i,["string","array"]))throw new It(`Expected first argument to be of type array or string, but found ${tn(hn(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(s,a)}return i.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function Pc(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function ym(r,e,i,s){return s.compare(e,i)===0}function za(r,e,i){const s=r!=="=="&&r!=="!=";return class WS{constructor(u,h,m){this.type=$i,this.lhs=u,this.rhs=h,this.collator=m,this.hasUntypedArgument=u.type.kind==="value"||h.type.kind==="value"}static parse(u,h){if(u.length!==3&&u.length!==4)return h.error("Expected two or three arguments.");const m=u[0];let g=h.parse(u[1],1,ji);if(!g)return null;if(!Pc(m,g.type))return h.concat(1).error(`"${m}" comparisons are not supported for type '${tn(g.type)}'.`);let v=h.parse(u[2],2,ji);if(!v)return null;if(!Pc(m,v.type))return h.concat(2).error(`"${m}" comparisons are not supported for type '${tn(v.type)}'.`);if(g.type.kind!==v.type.kind&&g.type.kind!=="value"&&v.type.kind!=="value")return h.error(`Cannot compare types '${tn(g.type)}' and '${tn(v.type)}'.`);s&&(g.type.kind==="value"&&v.type.kind!=="value"?g=new qt(v.type,[g]):g.type.kind!=="value"&&v.type.kind==="value"&&(v=new qt(g.type,[v])));let w=null;if(u.length===4){if(g.type.kind!=="string"&&v.type.kind!=="string"&&g.type.kind!=="value"&&v.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(w=h.parse(u[3],3,Aa),!w)return null}return new WS(g,v,w)}evaluate(u){const h=this.lhs.evaluate(u),m=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=hn(h),v=hn(m);if(g.kind!==v.kind||g.kind!=="string"&&g.kind!=="number")throw new It(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${g.kind}, ${v.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=hn(h),v=hn(m);if(g.kind!=="string"||v.kind!=="string")return e(u,h,m)}return this.collator?i(u,h,m,this.collator.evaluate(u)):e(u,h,m)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}serialize(){const u=[r];return this.eachChild(h=>{u.push(h.serialize())}),u}}}const Oy=za("==",function(r,e,i){return e===i},ym),Fy=za("!=",function(r,e,i){return e!==i},function(r,e,i,s){return!ym(0,e,i,s)}),vm=za("<",function(r,e,i){return e<i},function(r,e,i,s){return s.compare(e,i)<0}),xm=za(">",function(r,e,i){return e>i},function(r,e,i,s){return s.compare(e,i)>0}),By=za("<=",function(r,e,i){return e<=i},function(r,e,i,s){return s.compare(e,i)<=0}),Ny=za(">=",function(r,e,i){return e>=i},function(r,e,i,s){return s.compare(e,i)>=0});class Xd{constructor(e,i,s,a,u,h){this.type=er,this.number=e,this.locale=i,this.currency=s,this.unit=a,this.minFractionDigits=u,this.maxFractionDigits=h}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const s=i.parse(e[1],1,Ft);if(!s)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let u=null;if(a.locale&&(u=i.parseObjectValue(a.locale,2,"locale",er),!u))return null;let h=null;if(a.currency&&(h=i.parseObjectValue(a.currency,2,"currency",er),!h))return null;let m=null;if(a.unit&&(m=i.parseObjectValue(a.unit,2,"unit",er),!m))return null;let g=null;if(a["min-fraction-digits"]&&(g=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",Ft),!g))return null;let v=null;return a["max-fraction-digits"]&&(v=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",Ft),!v)?null:new Xd(s,u,h,m,g,v)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Dc{constructor(e){this.type=Ft,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=i.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${tn(s.type)} instead.`):new Dc(s):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new It(`Expected value to be of type string or array, but found ${tn(hn(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function bm(r){return function(){r=1831565813+(r|=0)|0;let e=Math.imul(r^r>>>15,1|r);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const La={"==":Oy,"!=":Fy,">":xm,"<":vm,">=":Ny,"<=":By,array:qt,at:nh,"at-interpolated":oh,boolean:qt,case:ah,coalesce:ih,collator:ml,format:Ia,image:fl,in:Zd,"index-of":sh,interpolate:Wn,"interpolate-hcl":Wn,"interpolate-lab":Wn,length:Dc,let:rh,literal:di,match:Wd,number:qt,"number-format":Xd,object:qt,slice:Mc,step:Ic,string:qt,"to-boolean":Do,"to-color":Do,"to-number":Do,"to-string":Do,var:Qu,within:ys,distance:Ra,config:xl};function wm(r,[e,i,s,a]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const u=a?a.evaluate(r):1,h=em(e,i,s,u);if(h)throw new It(h);return new Fi(e/255*u,i/255*u,s/255*u,u)}function Tm(r,[e,i,s,a]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const u=a?a.evaluate(r):1,h=function(v,w,S,A){return typeof v=="number"&&v>=0&&v<=360?typeof w=="number"&&w>=0&&w<=100&&typeof S=="number"&&S>=0&&S<=100?A===void 0||typeof A=="number"&&A>=0&&A<=1?null:`Invalid hsla value [${[v,w,S,A].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof A=="number"?[v,w,S,A]:[v,w,S]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof A=="number"?[v,w,S,A]:[v,w,S]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,s,u);if(h)throw new It(h);const m=`hsla(${e}, ${i}%, ${s}%, ${u})`,g=Fi.parse(m);if(!g)throw new It(`Failed to parse HSLA color: ${m}`);return g}function Yd(r,e){return r in e}function lh(r,e){const i=e[r];return i===void 0?null:i}function Ws(r){return{type:r}}function Sm(r){return{result:"success",value:r}}function ao(r){return{result:"error",value:r}}function Kd(r,e){return!!r&&!!r.parameters&&r.parameters.indexOf(e)>-1}function ch(r){return r["property-type"]==="data-driven"}function Em(r){return Kd(r.expression,"measure-light")}function Jd(r){return Kd(r.expression,"zoom")}function uh(r){return!!r.expression&&r.expression.interpolated}function hh(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Am(r){return r}function dh(r,e){const i=e.type==="color",s=r.stops&&typeof r.stops[0][0]=="object",a=s||!(s||r.property!==void 0),u=r.type||(uh(e)?"exponential":"interval");if(i&&((r=gc({},r)).stops&&(r.stops=r.stops.map(v=>[v[0],Fi.parse(v[1])])),r.default=Fi.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!gm[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let h,m,g;if(u==="exponential")h=vs;else if(u==="interval")h=jy;else if(u==="categorical"){h=Im,m=Object.create(null);for(const v of r.stops)m[v[0]]=v[1];g=typeof r.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);h=Vy}if(s){const v={},w=[];for(let D=0;D<r.stops.length;D++){const R=r.stops[D],O=R[0].zoom;v[O]===void 0&&(v[O]={zoom:O,type:r.type,property:r.property,default:r.default,stops:[]},w.push(O)),v[O].stops.push([R[0].value,R[1]])}const S=[];for(const D of w)S.push([v[D].zoom,dh(v[D],e)]);const A={name:"linear"};return{kind:"composite",interpolationType:A,interpolationFactor:Wn.interpolationFactor.bind(void 0,A),zoomStops:S.map(D=>D[0]),evaluate:({zoom:D},R)=>vs({stops:S,base:r.base},e,D).evaluate(D,R)}}if(a){const v=u==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:Wn.interpolationFactor.bind(void 0,v),zoomStops:r.stops.map(w=>w[0]),evaluate:({zoom:w})=>h(r,e,w,m,g)}}return{kind:"source",evaluate(v,w){const S=w&&w.properties?w.properties[r.property]:void 0;return S===void 0?ka(r.default,e.default):h(r,e,S,m,g)}}}function ka(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function Im(r,e,i,s,a){return ka(typeof i===a?s[i]:void 0,r.default,e.default)}function jy(r,e,i){if(Zt(i)!=="number")return ka(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const a=eh(r.stops.map(u=>u[0]),i);return r.stops[a][1]}function vs(r,e,i){const s=r.base!==void 0?r.base:1;if(Zt(i)!=="number")return ka(r.default,e.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const u=eh(r.stops.map(w=>w[0]),i),h=function(w,S,A,D){const R=D-A,O=w-A;return R===0?0:S===1?O/R:(Math.pow(S,O)-1)/(Math.pow(S,R)-1)}(i,s,r.stops[u][0],r.stops[u+1][0]),m=r.stops[u][1],g=r.stops[u+1][1];let v=Vu[e.type]||Am;if(r.colorSpace&&r.colorSpace!=="rgb"){const w=gm[r.colorSpace];v=(S,A)=>w.reverse(w.interpolate(w.forward(S),w.forward(A),h))}return typeof m.evaluate=="function"?{evaluate(...w){const S=m.evaluate.apply(void 0,w),A=g.evaluate.apply(void 0,w);if(S!==void 0&&A!==void 0)return v(S,A,h)}}:v(m,g,h)}function Vy(r,e,i){return e.type==="color"?i=Fi.parse(i):e.type==="formatted"?i=Nn.fromString(i.toString()):e.type==="resolvedImage"?i=Zn.build(i.toString()):Zt(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),ka(i,r.default,e.default)}zn.register(La,{error:[{kind:"error"},[er],(r,[e])=>{throw new It(e.evaluate(r))}],typeof:[er,[ji],(r,[e])=>tn(hn(e.evaluate(r)))],"to-rgba":[Bn(Ft,4),[qn],(r,[e])=>e.evaluate(r).toRenderColor(null).toArray()],"to-hsla":[Bn(Ft,4),[qn],(r,[e])=>e.evaluate(r).toRenderColor(null).toHslaArray()],rgb:[qn,[Ft,Ft,Ft],wm],rgba:[qn,[Ft,Ft,Ft,Ft],wm],hsl:[qn,[Ft,Ft,Ft],Tm],hsla:[qn,[Ft,Ft,Ft,Ft],Tm],has:{type:$i,overloads:[[[er],(r,[e])=>Yd(e.evaluate(r),r.properties())],[[er,Us],(r,[e,i])=>Yd(e.evaluate(r),i.evaluate(r))]]},get:{type:ji,overloads:[[[er],(r,[e])=>lh(e.evaluate(r),r.properties())],[[er,Us],(r,[e,i])=>lh(e.evaluate(r),i.evaluate(r))]]},"feature-state":[ji,[er],(r,[e])=>lh(e.evaluate(r),r.featureState||{})],properties:[Us,[],r=>r.properties()],"geometry-type":[er,[],r=>r.geometryType()],id:[ji,[],r=>r.id()],zoom:[Ft,[],r=>r.globals.zoom],pitch:[Ft,[],r=>r.globals.pitch||0],"distance-from-center":[Ft,[],r=>r.distanceFromCenter()],"measure-light":[Ft,[er],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[Ft,[],r=>r.globals.heatmapDensity||0],"line-progress":[Ft,[],r=>r.globals.lineProgress||0],"raster-value":[Ft,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[Ft,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[Ft,[],r=>r.globals.skyRadialProgress||0],accumulated:[ji,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Ft,Ws(Ft),(r,e)=>{let i=0;for(const s of e)i+=s.evaluate(r);return i}],"*":[Ft,Ws(Ft),(r,e)=>{let i=1;for(const s of e)i*=s.evaluate(r);return i}],"-":{type:Ft,overloads:[[[Ft,Ft],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[Ft],(r,[e])=>-e.evaluate(r)]]},"/":[Ft,[Ft,Ft],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[Ft,[Ft,Ft],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[Ft,[],()=>Math.LN2],pi:[Ft,[],()=>Math.PI],e:[Ft,[],()=>Math.E],"^":[Ft,[Ft,Ft],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[Ft,[Ft],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[Ft,[Ft],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[Ft,[Ft],(r,[e])=>Math.log(e.evaluate(r))],log2:[Ft,[Ft],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[Ft,[Ft],(r,[e])=>Math.sin(e.evaluate(r))],cos:[Ft,[Ft],(r,[e])=>Math.cos(e.evaluate(r))],tan:[Ft,[Ft],(r,[e])=>Math.tan(e.evaluate(r))],asin:[Ft,[Ft],(r,[e])=>Math.asin(e.evaluate(r))],acos:[Ft,[Ft],(r,[e])=>Math.acos(e.evaluate(r))],atan:[Ft,[Ft],(r,[e])=>Math.atan(e.evaluate(r))],min:[Ft,Ws(Ft),(r,e)=>Math.min(...e.map(i=>i.evaluate(r)))],max:[Ft,Ws(Ft),(r,e)=>Math.max(...e.map(i=>i.evaluate(r)))],abs:[Ft,[Ft],(r,[e])=>Math.abs(e.evaluate(r))],round:[Ft,[Ft],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[Ft,[Ft],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[Ft,[Ft],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[$i,[er,ji],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[$i,[ji],(r,[e])=>r.id()===e.value],"filter-type-==":[$i,[er],(r,[e])=>r.geometryType()===e.value],"filter-<":[$i,[er,ji],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s<a}],"filter-id-<":[$i,[ji],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[$i,[er,ji],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s>a}],"filter-id->":[$i,[ji],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[$i,[er,ji],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s<=a}],"filter-id-<=":[$i,[ji],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[$i,[er,ji],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s>=a}],"filter-id->=":[$i,[ji],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[$i,[ji],(r,[e])=>e.value in r.properties()],"filter-has-id":[$i,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[$i,[Bn(er)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[$i,[Bn(ji)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[$i,[er,Bn(ji)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[$i,[er,Bn(ji)],(r,[e,i])=>function(s,a,u,h){for(;u<=h;){const m=u+h>>1;if(a[m]===s)return!0;a[m]>s?h=m-1:u=m+1}return!1}(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:$i,overloads:[[[$i,$i],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[Ws($i),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:$i,overloads:[[[$i,$i],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[Ws($i),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[$i,[$i],(r,[e])=>!e.evaluate(r)],"is-supported-script":[$i,[er],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[er,[er],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[er,[er],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[er,Ws(ji),(r,e)=>e.map(i=>jn(i.evaluate(r))).join("")],"resolved-locale":[er,[Aa],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[Ft,[Ft,Ft,ji],(r,e)=>{const[i,s,a]=e.map(h=>h.evaluate(r));if(i>s||i===s)return i;let u;if(typeof a=="string")u=function(h){let m=0;if(h.length===0)return m;for(let g=0;g<h.length;g++)m=(m<<5)-m+h.charCodeAt(g),m|=0;return m}(a);else{if(typeof a!="number")throw new It(`Invalid seed input: ${a}`);u=a}return i+bm(u)()*(s-i)}]});class Qd{constructor(e,i,s,a){this.expression=e,this._warningHistory={},this._evaluator=new $u(s,a),this._defaultValue=i?function(u){return u.type==="color"&&(hh(u.default)||Array.isArray(u.default))?new Fi(0,0,0,0):u.type==="color"?Fi.parse(u.default)||null:u.default===void 0?null:u.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=Ju(e)}evaluateWithoutErrorHandling(e,i,s,a,u,h,m,g){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h,this._evaluator.featureTileCoord=m||null,this._evaluator.featureDistanceData=g||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,s,a,u,h,m,g){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=m||null,this._evaluator.featureDistanceData=g||null;try{const v=this.expression.evaluate(this._evaluator);if(v==null||typeof v=="number"&&v!=v)return this._defaultValue;if(this._enumValues&&!(v in this._enumValues))throw new It(`Expected value to be one of ${Object.keys(this._enumValues).map(w=>JSON.stringify(w)).join(", ")}, but found ${JSON.stringify(v)} instead.`);return v}catch(v){return this._warningHistory[v.message]||(this._warningHistory[v.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${v.message}`)),this._defaultValue}}}function ph(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in La}function Al(r,e,i,s){const a=new dm(La,[],e?function(h){const m={color:qn,string:er,number:Ft,enum:er,boolean:$i,formatted:yc,resolvedImage:vc};return h.type==="array"?Bn(m[h.value]||ji,h.length):m[h.type]}(e):void 0,void 0,void 0,i,s),u=a.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return u?Sm(new Qd(u,e,i,s)):ao(a.errors)}class Oa{constructor(e,i,s,a){this.kind=e,this._styleExpression=i,this.isLightConstant=s,this.isLineProgressConstant=a,this.isStateDependent=e!=="constant"&&!Ku(i.expression),this.configDependencies=Ju(i.expression)}evaluateWithoutErrorHandling(e,i,s,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,s,a,u,h)}evaluate(e,i,s,a,u,h){return this._styleExpression.evaluate(e,i,s,a,u,h)}}class Il{constructor(e,i,s,a,u,h){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Ku(i.expression),this.isLightConstant=u,this.isLineProgressConstant=h,this.configDependencies=Ju(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,s,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,s,a,u,h)}evaluate(e,i,s,a,u,h){return this._styleExpression.evaluate(e,i,s,a,u,h)}interpolationFactor(e,i,s){return this.interpolationType?Wn.interpolationFactor(this.interpolationType,e,i,s):0}}function Rc(r,e,i,s){if((r=Al(r,e,i,s)).result==="error")return r;const a=r.value.expression,u=Ac(a);if(!u&&!ch(e))return ao([new _o("","data expressions not supported")]);const h=bl(a,["zoom","pitch","distance-from-center"]);if(!h&&!Jd(e))return ao([new _o("","zoom expressions not supported")]);const m=bl(a,["measure-light"]);if(!m&&!Em(e))return ao([new _o("","measure-light expression not supported")]);const g=bl(a,["line-progress"]);if(!g&&!function(S){return Kd(S.expression,"line-progress")}(e))return ao([new _o("","line-progress expression not supported")]);const v=e.expression&&e.expression.relaxZoomRestriction,w=fh(a);return w||h||v?w instanceof _o?ao([w]):w instanceof Wn&&!uh(e)?ao([new _o("",'"interpolate" expressions cannot be used with this property')]):Sm(w?new Il(u&&g?"camera":"composite",r.value,w.labels,w instanceof Wn?w.interpolation:void 0,m,g):new Oa(u&&g?"constant":"source",r.value,m,g)):ao([new _o("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class zc{constructor(e,i){this._parameters=e,this._specification=i,gc(this,dh(this._parameters,this._specification))}static deserialize(e){return new zc(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function fh(r){let e=null;if(r instanceof rh)e=fh(r.result);else if(r instanceof ih){for(const i of r.args)if(e=fh(i),e)break}else(r instanceof Ic||r instanceof Wn)&&r.input instanceof zn&&r.input.name==="zoom"&&(e=r);return e instanceof _o||r.eachChild(i=>{const s=fh(i);s instanceof _o?e=s:e&&s&&e!==s&&(e=new _o("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var ep,mh,tp=function(){if(mh)return ep;mh=1,ep=e;var r=3;function e(i,s,a){var u=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var h=new Int32Array(this.arrayBuffer);i=h[0],this.d=(s=h[1])+2*(a=h[2]);for(var m=0;m<this.d*this.d;m++){var g=h[r+m],v=h[r+m+1];u.push(g===v?null:h.subarray(g,v))}var w=h[r+u.length+1];this.keys=h.subarray(h[r+u.length],w),this.bboxes=h.subarray(w),this.insert=this._insertReadonly}else{this.d=s+2*a;for(var S=0;S<this.d*this.d;S++)u.push([]);this.keys=[],this.bboxes=[]}this.n=s,this.extent=i,this.padding=a,this.scale=s/i,this.uid=0;var A=a/s*i;this.min=-A,this.max=i+A}return e.prototype.insert=function(i,s,a,u,h){this._forEachCell(s,a,u,h,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(s),this.bboxes.push(a),this.bboxes.push(u),this.bboxes.push(h)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(i,s,a,u,h,m){this.cells[h].push(m)},e.prototype.query=function(i,s,a,u,h){var m=this.min,g=this.max;if(i<=m&&s<=m&&g<=a&&g<=u&&!h)return Array.prototype.slice.call(this.keys);var v=[];return this._forEachCell(i,s,a,u,this._queryCell,v,{},h),v},e.prototype._queryCell=function(i,s,a,u,h,m,g,v){var w=this.cells[h];if(w!==null)for(var S=this.keys,A=this.bboxes,D=0;D<w.length;D++){var R=w[D];if(g[R]===void 0){var O=4*R;(v?v(A[O+0],A[O+1],A[O+2],A[O+3]):i<=A[O+2]&&s<=A[O+3]&&a>=A[O+0]&&u>=A[O+1])?(g[R]=!0,m.push(S[R])):g[R]=!1}}},e.prototype._forEachCell=function(i,s,a,u,h,m,g,v){for(var w=this._convertToCellCoord(i),S=this._convertToCellCoord(s),A=this._convertToCellCoord(a),D=this._convertToCellCoord(u),R=w;R<=A;R++)for(var O=S;O<=D;O++){var $=this.d*O+R;if((!v||v(this._convertFromCellCoord(R),this._convertFromCellCoord(O),this._convertFromCellCoord(R+1),this._convertFromCellCoord(O+1)))&&h.call(this,i,s,a,u,$,m,g,v))return}},e.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},e.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,s=r+this.cells.length+1+1,a=0,u=0;u<this.cells.length;u++)a+=this.cells[u].length;var h=new Int32Array(s+a+this.keys.length+this.bboxes.length);h[0]=this.extent,h[1]=this.n,h[2]=this.padding;for(var m=s,g=0;g<i.length;g++){var v=i[g];h[r+g]=m,h.set(v,m),m+=v.length}return h[r+i.length]=m,h.set(this.keys,m),h[r+i.length+1]=m+=this.keys.length,h.set(this.bboxes,m),m+=this.bboxes.length,h.buffer},ep}(),Cl=Zo(tp);const Lc={};function Tt(r,e,i={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),Lc[e]={klass:r,omit:i.omit||[]}}Tt(Object,"Object"),Cl.serialize=function(r,e){const i=r.toArrayBuffer();return e&&e.add(i),{buffer:i}},Cl.deserialize=function(r){return new Cl(r.buffer)},Object.defineProperty(Cl,"name",{value:"Grid"}),Tt(Cl,"Grid"),typeof DOMMatrix<"u"&&Tt(DOMMatrix,"DOMMatrix"),Tt(Fi,"Color"),Tt(Error,"Error"),Tt(Nn,"Formatted"),Tt(Uu,"FormattedSection"),Tt(Ou,"AJAXError"),Tt(Zn,"ResolvedImage"),Tt(zc,"StylePropertyFunction"),Tt(Qd,"StyleExpression",{omit:["_evaluator"]}),Tt(eo,"ImageId"),Tt(Po,"ImageVariant"),Tt(Il,"ZoomDependentExpression"),Tt(Oa,"ZoomConstantExpression"),Tt(zn,"CompoundExpression",{omit:["_evaluate"]});for(const r in La)Lc[La[r]._classRegistryKey]||Tt(La[r],`Expression${r}`);function kc(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Fa(r){return self.ImageBitmap&&r instanceof ImageBitmap}function Xs(r,e){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp)return r;if(kc(r)||Fa(r))return e&&e.add(r),r;if(ArrayBuffer.isView(r))return e&&e.add(r.buffer),r;if(r instanceof ImageData)return e&&e.add(r.data.buffer),r;if(Array.isArray(r)){const i=[];for(const s of r)i.push(Xs(s,e));return i}if(r instanceof Map){const i={$name:"Map",entries:[]};for(const[s,a]of r.entries())i.entries.push(Xs(s),Xs(a,e));return i}if(r instanceof Set){const i={$name:"Set"};let s=0;for(const a of r.values())i[++s]=Xs(a);return i}if(r instanceof DOMMatrix){const i={$name:"DOMMatrix"},s=["is2D","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","a","b","c","d","e","f"];for(const a of s)i[a]=r[a];return i}if(typeof r=="bigint")return{$name:"BigInt",value:r.toString()};if(typeof r=="object"){const i=r.constructor,s=i._classRegistryKey;if(!s)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const a=i.serialize?i.serialize(r,e):{};if(!i.serialize){for(const u in r)r.hasOwnProperty(u)&&(Lc[s].omit.indexOf(u)>=0||(a[u]=Xs(r[u],e)));r instanceof Error&&(a.message=r.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(a.$name=s),a}throw new Error("can't serialize object of type "+typeof r)}function Ys(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||kc(r)||Fa(r)||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(Ys);if(typeof r=="object"){const e=r.$name||"Object";if(e==="Map"){const a=r.entries||[],u=new Map;for(let h=0;h<a.length;h+=2)u.set(Ys(a[h]),Ys(a[h+1]));return u}if(e==="Set"){const a=new Set;for(const u of Object.keys(r))u!=="$name"&&a.add(Ys(r[u]));return a}if(e==="DOMMatrix"){let a;return a=r.is2D?[r.a,r.b,r.c,r.d,r.e,r.f]:[r.m11,r.m12,r.m13,r.m14,r.m21,r.m22,r.m23,r.m24,r.m31,r.m32,r.m33,r.m34,r.m41,r.m42,r.m43,r.m44],new DOMMatrix(a)}if(e==="BigInt")return BigInt(r.value);const{klass:i}=Lc[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(r);const s=Object.create(i.prototype);for(const a of Object.keys(r))a!=="$name"&&(s[a]=Ys(r[a]));return s}throw new Error("can't deserialize object of type "+typeof r)}const jt={"Latin-1 Supplement":r=>r>=128&&r<=255,Arabic:r=>r>=1536&&r<=1791,"Arabic Supplement":r=>r>=1872&&r<=1919,"Arabic Extended-A":r=>r>=2208&&r<=2303,"Hangul Jamo":r=>r>=4352&&r<=4607,"Unified Canadian Aboriginal Syllabics":r=>r>=5120&&r<=5759,Khmer:r=>r>=6016&&r<=6143,"Unified Canadian Aboriginal Syllabics Extended":r=>r>=6320&&r<=6399,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"CJK Radicals Supplement":r=>r>=11904&&r<=12031,"Kangxi Radicals":r=>r>=12032&&r<=12255,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Bopomofo:r=>r>=12544&&r<=12591,"Hangul Compatibility Jamo":r=>r>=12592&&r<=12687,Kanbun:r=>r>=12688&&r<=12703,"Bopomofo Extended":r=>r>=12704&&r<=12735,"CJK Strokes":r=>r>=12736&&r<=12783,"Katakana Phonetic Extensions":r=>r>=12784&&r<=12799,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"CJK Unified Ideographs Extension A":r=>r>=13312&&r<=19903,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Yi Syllables":r=>r>=40960&&r<=42127,"Yi Radicals":r=>r>=42128&&r<=42191,"Hangul Jamo Extended-A":r=>r>=43360&&r<=43391,"Hangul Syllables":r=>r>=44032&&r<=55215,"Hangul Jamo Extended-B":r=>r>=55216&&r<=55295,"Private Use Area":r=>r>=57344&&r<=63743,"CJK Compatibility Ideographs":r=>r>=63744&&r<=64255,"Arabic Presentation Forms-A":r=>r>=64336&&r<=65023,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Arabic Presentation Forms-B":r=>r>=65136&&r<=65279,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519,Osage:r=>r>=66736&&r<=66815,"CJK Unified Ideographs Extension B":r=>r>=131072&&r<=173791};function ip(r){for(const e of r)if(Oc(e.charCodeAt(0)))return!0;return!1}function Uy(r){for(const e of r)if(!Cm(e.charCodeAt(0)))return!1;return!0}function Cm(r){return!(jt.Arabic(r)||jt["Arabic Supplement"](r)||jt["Arabic Extended-A"](r)||jt["Arabic Presentation Forms-A"](r)||jt["Arabic Presentation Forms-B"](r))}function Oc(r){return!(r!==746&&r!==747&&(r<4352||!(jt["Bopomofo Extended"](r)||jt.Bopomofo(r)||jt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||jt["CJK Compatibility Ideographs"](r)||jt["CJK Compatibility"](r)||jt["CJK Radicals Supplement"](r)||jt["CJK Strokes"](r)||!(!jt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||jt["CJK Unified Ideographs Extension A"](r)||jt["CJK Unified Ideographs"](r)||jt["Enclosed CJK Letters and Months"](r)||jt["Hangul Compatibility Jamo"](r)||jt["Hangul Jamo Extended-A"](r)||jt["Hangul Jamo Extended-B"](r)||jt["Hangul Jamo"](r)||jt["Hangul Syllables"](r)||jt.Hiragana(r)||jt["Ideographic Description Characters"](r)||jt.Kanbun(r)||jt["Kangxi Radicals"](r)||jt["Katakana Phonetic Extensions"](r)||jt.Katakana(r)&&r!==12540||!(!jt["Halfwidth and Fullwidth Forms"](r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!jt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||jt["Unified Canadian Aboriginal Syllabics"](r)||jt["Unified Canadian Aboriginal Syllabics Extended"](r)||jt["Vertical Forms"](r)||jt["Yijing Hexagram Symbols"](r)||jt["Yi Syllables"](r)||jt["Yi Radicals"](r))))}function Mm(r){return!(Oc(r)||function(e){return!!(jt["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||jt["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||jt["Letterlike Symbols"](e)||jt["Number Forms"](e)||jt["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||jt["Control Pictures"](e)&&e!==9251||jt["Optical Character Recognition"](e)||jt["Enclosed Alphanumerics"](e)||jt["Geometric Shapes"](e)||jt["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||jt["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||jt["CJK Symbols and Punctuation"](e)||jt.Katakana(e)||jt["Private Use Area"](e)||jt["CJK Compatibility Forms"](e)||jt["Small Form Variants"](e)||jt["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(r))}function $y(r){return jt.Arabic(r)||jt["Arabic Supplement"](r)||jt["Arabic Extended-A"](r)||jt["Arabic Presentation Forms-A"](r)||jt["Arabic Presentation Forms-B"](r)}function Pm(r){return r>=1424&&r<=2303||jt["Arabic Presentation Forms-A"](r)||jt["Arabic Presentation Forms-B"](r)}function Gy(r,e){return!(!e&&Pm(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||jt.Khmer(r))}function Hy(r){for(const e of r)if(Pm(e.charCodeAt(0)))return!0;return!1}const rp="deferred",np="loading",op="loaded";let sp=null,to="unavailable",Ks=null;const Ba=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(to="error"),sp&&sp(r)};function _h(){gh.fire(new js("pluginStateChange",{pluginStatus:to,pluginURL:Ks}))}const gh=new Sa,Ml=function(){return to},Dm=function(){if(to!==rp||!Ks)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");to=np,_h(),Ks&&cl({url:Ks},r=>{r?Ba(r):(to=op,_h())})},vo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>to===op||vo.applyArabicShaping!=null,isLoading:()=>to===np,setState(r){to=r.pluginStatus,Ks=r.pluginURL},isParsed:()=>vo.applyArabicShaping!=null&&vo.processBidirectionalText!=null&&vo.processStyledBidirectionalText!=null,getPluginURL:()=>Ks};class Wi{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,s){for(const a of i)if(!Gy(a.charCodeAt(0),s))return!1;return!0}(e,vo.isLoaded())}}class Fc{constructor(e,i,s,a){this.property=e,this.value=i,this.expression=function(u,h,m,g){if(hh(u))return new zc(u,h);if(ph(u)||Array.isArray(u)&&u.length>0){const v=Rc(u,h,m,g);if(v.result==="error")throw new Error(v.value.map(w=>`${w.key}: ${w.message}`).join(", "));return v.value}{let v=u;return typeof u=="string"&&h.type==="color"&&(v=Fi.parse(u)),{kind:"constant",configDependencies:new Set,evaluate:()=>v}}}(i===void 0?e.specification.default:i,e.specification,s,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,s){return this.property.possiblyEvaluate(this,e,i,s)}}class Js{constructor(e,i,s){this.property=e,this.value=new Fc(e,void 0,i,s)}transitioned(e,i){return new zm(this.property,this.value,i,Oe({},e.transition,this.transition),e.now)}untransitioned(){return new zm(this.property,this.value,null,{},0)}}class Rm{constructor(e,i,s){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=s,this.configDependencies=new Set}getValue(e){return _i(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Js(this._values[e].property,this._scope,this._options)),this._values[e].value=new Fc(this._values[e].property,i===null?void 0:_i(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);const s=this._properties.properties;if(e)for(const a in e){const u=e[a];if(a.endsWith("-transition")){const h=a.slice(0,-11);s[h]&&this.setTransition(h,u)}else s.hasOwnProperty(a)&&this.setValue(a,u)}}getTransition(e){return _i(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Js(this._values[e].property)),this._values[e].transition=_i(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const s=new Lm(this._properties);for(const a of Object.keys(this._values))s._values[a]=this._values[a].transitioned(e,i._values[a]);return s}untransitioned(){const e=new Lm(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class zm{constructor(e,i,s,a,u){const h=a.delay||0,m=a.duration||0;u=u||0,this.property=e,this.value=i,this.begin=u+h,this.end=this.begin+m,e.specification.transition&&(a.delay||a.duration)&&(this.prior=s)}possiblyEvaluate(e,i,s){const a=e.now||0,u=this.value.possiblyEvaluate(e,i,s),h=this.prior;if(h){if(a>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(a<this.begin)return h.possiblyEvaluate(e,i,s);{const m=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,s),u,ge(m))}}return u}}class Lm{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,s){const a=new Na(this._properties);for(const u of Object.keys(this._values))a._values[u]=this._values[u].possiblyEvaluate(e,i,s);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class qy{constructor(e,i,s){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=s,this.configDependencies=new Set}getValue(e){return _i(this._values[e].value)}setValue(e,i){this._values[e]=new Fc(this._values[e].property,i===null?void 0:_i(i),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s)}return e}possiblyEvaluate(e,i,s){const a=new Na(this._properties);for(const u of Object.keys(this._values))a._values[u]=this._values[u].possiblyEvaluate(e,i,s);return a}}class Pl{constructor(e,i,s){this.property=e,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,s,a){return this.property.evaluate(this.value,this.parameters,e,i,s,a)}}class Na{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class dt{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,s){const a=Vu[this.specification.type];return a?a(e,i,s):e}}class wt{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,s,a){return new Pl(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},s,a)}:e.expression,i)}interpolate(e,i,s){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Pl(this,{kind:"constant",value:void 0},e.parameters);const a=Vu[this.specification.type];return a?new Pl(this,{kind:"constant",value:a(e.value.value,i.value.value,s)},e.parameters):e}evaluate(e,i,s,a,u,h){return e.kind==="constant"?e.value:e.evaluate(i,s,a,u,h)}}class ja{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,a){return!!e.expression.evaluate(i,null,{},s,a)}interpolate(){return!1}}class Nr{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new Wi(0,{});for(const s in e){const a=e[s];a.specification.overridable&&this.overridableProperties.push(s);const u=this.defaultPropertyValues[s]=new Fc(a,void 0),h=this.defaultTransitionablePropertyValues[s]=new Js(a);this.defaultTransitioningPropertyValues[s]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=u.possiblyEvaluate(i)}}}Tt(wt,"DataDrivenProperty"),Tt(dt,"DataConstantProperty"),Tt(ja,"ColorRampProperty");var Re=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"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_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor":{"floorplanFeaturesetId":{"type":"string","expression":{}},"buildingFeaturesetId":{"type":"string","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"transition":true},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"transition":true},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-wall-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"transition":true},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white"},"sky-atmosphere-color":{"type":"color","default":"white"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Ro(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function yh(r){if(Array.isArray(r))return r.map(yh);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=yh(r[i]);return e}return Ro(r)}function vh(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!vh(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function ap(r,e="",i=null,s="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};vh(r)||(r=xh(r));const a=r;let u=!0;try{u=function(w){if(!Dl(w))return w;let S=yh(w);return Om(S),S=km(S),S}(a)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
|
|
62
62
|
This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
|
|
63
63
|
and paste the contents of this message in the report.
|
|
64
64
|
Thank you!
|
|
65
65
|
Filter Expression:
|
|
66
66
|
${JSON.stringify(a,null,2)}
|
|
67
|
-
`)}let h=null,m=null;if(s!=="background"&&s!=="sky"&&s!=="slot"){m=Re[`filter_${s}`];const w=Al(u,m,e,i);if(w.result==="error")throw new Error(w.value.map(S=>`${S.key}: ${S.message}`).join(", "));h=(S,A,D)=>w.value.evaluate(S,A,{},D)}let g=null,v=null;if(u!==a){const w=Al(a,m,e,i);if(w.result==="error")throw new Error(w.value.map(S=>`${S.key}: ${S.message}`).join(", "));g=(S,A,D,R,O)=>w.value.evaluate(S,A,{},D,void 0,void 0,R,O),v=!Ac(w.value.expression)}return{filter:h,dynamicFilter:g||void 0,needGeometry:Fm(u),needFeature:!!v}}function km(r){if(!Array.isArray(r))return r;const e=function(i){if(Zy.has(i[0])){for(let s=1;s<i.length;s++)if(Dl(i[s]))return!0}return i}(r);return e===!0?e:e.map(i=>km(i))}function Om(r){let e=!1;const i=[];if(r[0]==="case"){for(let s=1;s<r.length-1;s+=2)e=e||Dl(r[s]),i.push(r[s+1]);i.push(r[r.length-1])}else if(r[0]==="match"){e=e||Dl(r[1]);for(let s=2;s<r.length-1;s+=2)i.push(r[s+1]);i.push(r[r.length-1])}else if(r[0]==="step"){e=e||Dl(r[1]);for(let s=1;s<r.length-1;s+=2)i.push(r[s+1])}e&&(r.length=0,r.push("any",...i));for(let s=1;s<r.length;s++)Om(r[s])}function Dl(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;for(let i=1;i<r.length;i++)if(Dl(r[i]))return!0;return!1}const Zy=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Wy(r,e){return r<e?-1:r>e?1:0}function Fm(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(Fm(r[e]))return!0;return!1}function xh(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?lp(r[1],r[2],"=="):e==="!="?bh(lp(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?lp(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(xh))):e==="all"?["all"].concat(r.slice(1).map(xh)):e==="none"?["all"].concat(r.slice(1).map(xh).map(bh)):e==="in"?cp(r[1],r.slice(2)):e==="!in"?bh(cp(r[1],r.slice(2))):e==="has"?Bm(r[1]):e!=="!has"||bh(Bm(r[1]));var i}function lp(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function cp(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",r,["literal",e.sort(Wy)]]:["filter-in-small",r,["literal",e]]}}function Bm(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function bh(r){return["!",r]}const Bc="";function Va(r,e){return e?`${r}${Bc}${e}`:r}const up="-transition",Qs=new Set(["fill","line","background","hillshade","raster"]);class $n extends Sa{constructor(e,i,s,a,u){if(super(),this.id=e.id,this.fqid=Va(this.id,s),this.type=e.type,this.scope=s,this.lut=a,this.options=u,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const h=Al(this.filter,Re[`filter_${e.type}`]);h.result!=="error"&&(this.configDependencies=new Set([...this.configDependencies,...h.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new qy(i.layout,this.scope,u),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint){this._transitionablePaint=new Rm(i.paint,this.scope,u);for(const h in e.paint)this.setPaintProperty(h,e.paint[h]);for(const h in e.layout)this.setLayoutProperty(h,e.layout[h]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Na(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&Qs.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const s=this._unevaluatedLayout;s._properties.properties[e]&&(s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(up)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const s=this._transitionablePaint,a=s._properties.properties;if(e.endsWith(up)){const S=e.slice(0,-11);return a[S]&&s.setTransition(S,i||void 0),!1}if(!a[e])return!1;const u=s._values[e],h=u.value.isDataDriven(),m=u.value;s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const g=s._values[e].value,v=g.isDataDriven(),w=e.endsWith("pattern")||e==="line-dasharray";return v||h||w||this._handleOverridablePaintPropertyUpdate(e,m,g)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,s){return null}_handleOverridablePaintPropertyUpdate(e,i,s){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return hi({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Pl&&ch(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=ap(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,s,a,u,h,m,g,v){}}const Xy={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Nc{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Tr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function ki(r,e=1){let i=0,s=0;return{members:r.map(a=>{const u=Xy[a.type].BYTES_PER_ELEMENT,h=i=hp(i,Math.max(e,u)),m=a.components||1;return s=Math.max(s,u),i+=u*m,{name:a.name,type:a.type,components:m,offset:h}}),size:hp(i,Math.max(s,e)),alignment:e}}function hp(r,e){return Math.ceil(r/e)*e}class xs extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=s,e}}xs.prototype.bytesPerElement=4,Tt(xs,"StructArrayLayout2i4");class wh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=a,e}}wh.prototype.bytesPerElement=6,Tt(wh,"StructArrayLayout3i6");class Ua extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=s,this.int16[h+2]=a,this.int16[h+3]=u,e}}Ua.prototype.bytesPerElement=8,Tt(Ua,"StructArrayLayout4i8");class Rl extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}Rl.prototype.bytesPerElement=4,Tt(Rl,"StructArrayLayout1f4");class Th extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=4*e,h=2*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.float32[h+1]=a,e}}Th.prototype.bytesPerElement=8,Tt(Th,"StructArrayLayout2i1f8");class zl extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=a,e}}zl.prototype.bytesPerElement=8,Tt(zl,"StructArrayLayout3i8");class dp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const m=5*e;return this.int16[m+0]=i,this.int16[m+1]=s,this.int16[m+2]=a,this.int16[m+3]=u,this.int16[m+4]=h,e}}dp.prototype.bytesPerElement=10,Tt(dp,"StructArrayLayout5i10");class pp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,a,u,h,m)}emplace(e,i,s,a,u,h,m,g){const v=6*e,w=12*e,S=3*e;return this.int16[v+0]=i,this.int16[v+1]=s,this.uint8[w+4]=a,this.uint8[w+5]=u,this.uint8[w+6]=h,this.uint8[w+7]=m,this.float32[S+2]=g,e}}pp.prototype.bytesPerElement=12,Tt(pp,"StructArrayLayout2i4ub1f12");class Yo extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.float32[u+0]=i,this.float32[u+1]=s,this.float32[u+2]=a,e}}Yo.prototype.bytesPerElement=12,Tt(Yo,"StructArrayLayout3f12");class bs extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const m=6*e,g=3*e;return this.uint16[m+0]=i,this.uint16[m+1]=s,this.uint16[m+2]=a,this.uint16[m+3]=u,this.float32[g+2]=h,e}}bs.prototype.bytesPerElement=12,Tt(bs,"StructArrayLayout4ui1f12");class Sh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.uint16[h+0]=i,this.uint16[h+1]=s,this.uint16[h+2]=a,this.uint16[h+3]=u,e}}Sh.prototype.bytesPerElement=8,Tt(Sh,"StructArrayLayout4ui8");class $a extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,m){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.int16[g+3]=u,this.int16[g+4]=h,this.int16[g+5]=m,e}}$a.prototype.bytesPerElement=12,Tt($a,"StructArrayLayout6i12");class Ll extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S,A){const D=this.length;return this.resize(D+1),this.emplace(D,e,i,s,a,u,h,m,g,v,w,S,A)}emplace(e,i,s,a,u,h,m,g,v,w,S,A,D){const R=12*e;return this.int16[R+0]=i,this.int16[R+1]=s,this.int16[R+2]=a,this.int16[R+3]=u,this.uint16[R+4]=h,this.uint16[R+5]=m,this.uint16[R+6]=g,this.uint16[R+7]=v,this.int16[R+8]=w,this.int16[R+9]=S,this.int16[R+10]=A,this.int16[R+11]=D,e}}Ll.prototype.bytesPerElement=24,Tt(Ll,"StructArrayLayout4i4ui4i24");class Xn extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,m){const g=10*e,v=5*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.float32[v+2]=u,this.float32[v+3]=h,this.float32[v+4]=m,e}}Xn.prototype.bytesPerElement=20,Tt(Xn,"StructArrayLayout3i3f20");class Ko extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=s,this.float32[h+2]=a,this.float32[h+3]=u,e}}Ko.prototype.bytesPerElement=16,Tt(Ko,"StructArrayLayout4f16");class fp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}fp.prototype.bytesPerElement=4,Tt(fp,"StructArrayLayout1ul4");class ea extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=s,e}}ea.prototype.bytesPerElement=4,Tt(ea,"StructArrayLayout2ui4");class mp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S,A,D){const R=this.length;return this.resize(R+1),this.emplace(R,e,i,s,a,u,h,m,g,v,w,S,A,D)}emplace(e,i,s,a,u,h,m,g,v,w,S,A,D,R){const O=20*e,$=10*e;return this.int16[O+0]=i,this.int16[O+1]=s,this.int16[O+2]=a,this.int16[O+3]=u,this.int16[O+4]=h,this.float32[$+3]=m,this.float32[$+4]=g,this.float32[$+5]=v,this.float32[$+6]=w,this.int16[O+14]=S,this.uint32[$+8]=A,this.uint16[O+18]=D,this.uint16[O+19]=R,e}}mp.prototype.bytesPerElement=40,Tt(mp,"StructArrayLayout5i4f1i1ul2ui40");class Eh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,a,u,h,m)}emplace(e,i,s,a,u,h,m,g){const v=8*e;return this.int16[v+0]=i,this.int16[v+1]=s,this.int16[v+2]=a,this.int16[v+4]=u,this.int16[v+5]=h,this.int16[v+6]=m,this.int16[v+7]=g,e}}Eh.prototype.bytesPerElement=16,Tt(Eh,"StructArrayLayout3i2i2i16");class jc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const m=4*e,g=8*e;return this.float32[m+0]=i,this.float32[m+1]=s,this.float32[m+2]=a,this.int16[g+6]=u,this.int16[g+7]=h,e}}jc.prototype.bytesPerElement=16,Tt(jc,"StructArrayLayout2f1f2i16");class _p extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,m){const g=20*e,v=5*e;return this.uint8[g+0]=i,this.uint8[g+1]=s,this.float32[v+1]=a,this.float32[v+2]=u,this.float32[v+3]=h,this.float32[v+4]=m,e}}_p.prototype.bytesPerElement=20,Tt(_p,"StructArrayLayout2ub4f20");class fn extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.uint16[u+0]=i,this.uint16[u+1]=s,this.uint16[u+2]=a,e}}fn.prototype.bytesPerElement=6,Tt(fn,"StructArrayLayout3ui6");class gp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q){const Y=this.length;return this.resize(Y+1),this.emplace(Y,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q)}emplace(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q,Y){const ee=30*e,he=15*e,ye=60*e;return this.int16[ee+0]=i,this.int16[ee+1]=s,this.int16[ee+2]=a,this.float32[he+2]=u,this.float32[he+3]=h,this.uint16[ee+8]=m,this.uint16[ee+9]=g,this.uint32[he+5]=v,this.uint32[he+6]=w,this.uint32[he+7]=S,this.uint16[ee+16]=A,this.uint16[ee+17]=D,this.uint16[ee+18]=R,this.float32[he+10]=O,this.float32[he+11]=$,this.uint8[ye+48]=H,this.uint8[ye+49]=K,this.uint8[ye+50]=W,this.uint32[he+13]=F,this.int16[ee+28]=q,this.uint8[ye+58]=Y,e}}gp.prototype.bytesPerElement=60,Tt(gp,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class yp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q,Y,ee,he,ye,ve,Ce,Ue,et,Ye,Qe,ot,je){const Je=this.length;return this.resize(Je+1),this.emplace(Je,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q,Y,ee,he,ye,ve,Ce,Ue,et,Ye,Qe,ot,je)}emplace(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q,Y,ee,he,ye,ve,Ce,Ue,et,Ye,Qe,ot,je,Je){const Fe=20*e,Ve=40*e,lt=80*e;return this.float32[Fe+0]=i,this.float32[Fe+1]=s,this.int16[Ve+4]=a,this.int16[Ve+5]=u,this.int16[Ve+6]=h,this.int16[Ve+7]=m,this.int16[Ve+8]=g,this.int16[Ve+9]=v,this.int16[Ve+10]=w,this.int16[Ve+11]=S,this.int16[Ve+12]=A,this.uint16[Ve+13]=D,this.uint16[Ve+14]=R,this.uint16[Ve+15]=O,this.uint16[Ve+16]=$,this.uint16[Ve+17]=H,this.uint16[Ve+18]=K,this.uint16[Ve+19]=W,this.uint16[Ve+20]=F,this.uint16[Ve+21]=q,this.uint16[Ve+22]=Y,this.uint16[Ve+23]=ee,this.uint16[Ve+24]=he,this.uint16[Ve+25]=ye,this.uint16[Ve+26]=ve,this.uint16[Ve+27]=Ce,this.uint32[Fe+14]=Ue,this.float32[Fe+15]=et,this.float32[Fe+16]=Ye,this.float32[Fe+17]=Qe,this.float32[Fe+18]=ot,this.uint8[lt+76]=je,this.uint16[Ve+39]=Je,e}}yp.prototype.bytesPerElement=80,Tt(yp,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class ta extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const m=5*e;return this.float32[m+0]=i,this.float32[m+1]=s,this.float32[m+2]=a,this.float32[m+3]=u,this.float32[m+4]=h,e}}ta.prototype.bytesPerElement=20,Tt(ta,"StructArrayLayout5f20");class Vc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,a,u,h,m)}emplace(e,i,s,a,u,h,m,g){const v=7*e;return this.float32[v+0]=i,this.float32[v+1]=s,this.float32[v+2]=a,this.float32[v+3]=u,this.float32[v+4]=h,this.float32[v+5]=m,this.float32[v+6]=g,e}}Vc.prototype.bytesPerElement=28,Tt(Vc,"StructArrayLayout7f28");class vp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,s,a,u,h,m,g,v,w,S)}emplace(e,i,s,a,u,h,m,g,v,w,S,A){const D=11*e;return this.float32[D+0]=i,this.float32[D+1]=s,this.float32[D+2]=a,this.float32[D+3]=u,this.float32[D+4]=h,this.float32[D+5]=m,this.float32[D+6]=g,this.float32[D+7]=v,this.float32[D+8]=w,this.float32[D+9]=S,this.float32[D+10]=A,e}}vp.prototype.bytesPerElement=44,Tt(vp,"StructArrayLayout11f44");class Ah extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,s,a,u,h,m,g,v)}emplace(e,i,s,a,u,h,m,g,v,w){const S=9*e;return this.float32[S+0]=i,this.float32[S+1]=s,this.float32[S+2]=a,this.float32[S+3]=u,this.float32[S+4]=h,this.float32[S+5]=m,this.float32[S+6]=g,this.float32[S+7]=v,this.float32[S+8]=w,e}}Ah.prototype.bytesPerElement=36,Tt(Ah,"StructArrayLayout9f36");class Ga extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=s,e}}Ga.prototype.bytesPerElement=8,Tt(Ga,"StructArrayLayout2f8");class xp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=6*e;return this.uint32[3*e+0]=i,this.uint16[h+2]=s,this.uint16[h+3]=a,this.uint16[h+4]=u,e}}xp.prototype.bytesPerElement=12,Tt(xp,"StructArrayLayout1ul3ui12");class Uc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}Uc.prototype.bytesPerElement=2,Tt(Uc,"StructArrayLayout1ui2");class kl extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$){const H=this.length;return this.resize(H+1),this.emplace(H,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$)}emplace(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H){const K=16*e;return this.float32[K+0]=i,this.float32[K+1]=s,this.float32[K+2]=a,this.float32[K+3]=u,this.float32[K+4]=h,this.float32[K+5]=m,this.float32[K+6]=g,this.float32[K+7]=v,this.float32[K+8]=w,this.float32[K+9]=S,this.float32[K+10]=A,this.float32[K+11]=D,this.float32[K+12]=R,this.float32[K+13]=O,this.float32[K+14]=$,this.float32[K+15]=H,e}}kl.prototype.bytesPerElement=64,Tt(kl,"StructArrayLayout16f64");class $c extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,a,u,h,m)}emplace(e,i,s,a,u,h,m,g){const v=10*e,w=5*e;return this.uint16[v+0]=i,this.uint16[v+1]=s,this.uint16[v+2]=a,this.uint16[v+3]=u,this.float32[w+2]=h,this.float32[w+3]=m,this.float32[w+4]=g,e}}$c.prototype.bytesPerElement=20,Tt($c,"StructArrayLayout4ui3f20");class bp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}bp.prototype.bytesPerElement=2,Tt(bp,"StructArrayLayout1i2");class Ih extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}Ih.prototype.bytesPerElement=1,Tt(Ih,"StructArrayLayout1ub1");class Nm extends Nc{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Nm.prototype.size=40;class Ch extends mp{get(e){return new Nm(this,e)}}Tt(Ch,"CollisionBoxArray");class jm extends Nc{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}jm.prototype.size=60;class Vm extends gp{get(e){return new jm(this,e)}}Tt(Vm,"PlacedSymbolArray");class Um extends Nc{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Um.prototype.size=80;class $m extends yp{get(e){return new Um(this,e)}}Tt($m,"SymbolInstanceArray");class wp extends Rl{getoffsetX(e){return this.float32[1*e+0]}}Tt(wp,"GlyphOffsetArray");class Gm extends xs{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Tt(Gm,"SymbolLineVertexArray");class Hm extends Nc{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}Hm.prototype.size=12;class qm extends xp{get(e){return new Hm(this,e)}}Tt(qm,"FeatureIndexArray");class Zm extends ea{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Tt(Zm,"FillExtrusionCentroidArray");class Wm extends Nc{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}Wm.prototype.size=6;class Xm extends wh{get(e){return new Wm(this,e)}}Tt(Xm,"FillExtrusionWallArray");const Yy=ki([{name:"a_pos",components:2,type:"Int16"}],4),Ky=ki([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Cr{constructor(e=[]){this.segments=e}_prepareSegment(e,i,s,a){let u=this.segments[this.segments.length-1];return e>Cr.MAX_VERTEX_ARRAY_LENGTH&&yi(`Max vertices per segment is ${Cr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Cr.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==a)&&(u={vertexOffset:i,primitiveOffset:s,vertexLength:0,primitiveLength:0},a!==void 0&&(u.sortKey=a),this.segments.push(u)),u}prepareSegment(e,i,s,a){return this._prepareSegment(e,i.length,s.length,a)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,s,a){return new Cr([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:a,vaos:{},sortKey:0}])}}function Ym(r,e){return 256*(r=Te(Math.floor(r),0,255))+Te(Math.floor(e),0,255)}Cr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Tt(Cr,"SegmentVector");const Jy=ki([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Ol=ki([{name:"a_pattern_b",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Qy=ki([{name:"a_dash",components:4,type:"Uint16"}]);class Fl{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,s,a){this.ids.push(Km(e)),this.positions.push(i,s,a)}eachPosition(e,i){const s=Km(e);let a=0,u=this.ids.length-1;for(;a<u;){const h=a+u>>1;this.ids[h]>=s?u=h:a=h+1}for(;this.ids[a]===s;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const s=new Float64Array(e.ids),a=new Uint32Array(e.positions);return Mh(s,a,0,s.length-1),i&&(i.add(s.buffer),i.add(a.buffer)),{ids:s,positions:a}}static deserialize(e){const i=new Fl;let s;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==s&&i.uniqueIds.push(a),s=a;return i.indexed=!0,i}}function Km(r){const e=+r;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:Qn(String(r))}function Mh(r,e,i,s){for(;i<s;){const a=r[i+s>>1];let u=i-1,h=s+1;for(;;){do u++;while(r[u]<a);do h--;while(r[h]>a);if(u>=h)break;Gc(r,u,h),Gc(e,3*u,3*h),Gc(e,3*u+1,3*h+1),Gc(e,3*u+2,3*h+2)}h-i<s-h?(Mh(r,e,i,h),i=h+1):(Mh(r,e,h+1,s),s=h)}}function Gc(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}Tt(Fl,"FeaturePositionMap");class Jo{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,s){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class Ph extends Jo{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1i(this.location,s))}}class Wr extends Jo{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1f(this.location,s))}}class zo extends Jo{constructor(e){super(e),this.current=[0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]||(this.current=s,this.gl.uniform2f(this.location,s[0],s[1])))}}class Hc extends Jo{constructor(e){super(e),this.current=[0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]||(this.current=s,this.gl.uniform3f(this.location,s[0],s[1],s[2])))}}class Dh extends Jo{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]&&s[3]===this.current[3]||(this.current=s,this.gl.uniform4f(this.location,s[0],s[1],s[2],s[3])))}}class Jm extends Jo{constructor(e){super(e),this.current=Fi.transparent.toRenderColor(null)}set(e,i,s){this.fetchUniformLocation(e,i)&&(s.r===this.current.r&&s.g===this.current.g&&s.b===this.current.b&&s.a===this.current.a||(this.current=s,this.gl.uniform4f(this.location,s.r,s.g,s.b,s.a)))}}const e0=new Float32Array(16);class qc extends Jo{constructor(e){super(e),this.current=e0}set(e,i,s){if(this.fetchUniformLocation(e,i)){if(s[12]!==this.current[12]||s[0]!==this.current[0])return this.current=s,void this.gl.uniformMatrix4fv(this.location,!1,s);for(let a=1;a<16;a++)if(s[a]!==this.current[a]){this.current=s,this.gl.uniformMatrix4fv(this.location,!1,s);break}}}}const Qm=new Float32Array(9),Tp=new Float32Array(4);class xo extends Jo{constructor(e){super(e),this.current=Tp}set(e,i,s){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(s[a]!==this.current[a]){this.current=s,this.gl.uniformMatrix2fv(this.location,!1,s);break}}}}function Zc(r){return[Ym(255*r.r,255*r.g),Ym(255*r.b,255*r.a)]}class Wc{constructor(e,i,s,a){this.value=e,this.uniformNames=i.map(u=>`u_${u}`),this.type=s,this.context=a}setUniform(e,i,s,a,u){const h=a.constantOr(this.value);i.set(e,u,h instanceof Fi?h.toRenderColor(this.lutExpression&&this.lutExpression.value==="none"?null:this.context.lut):h)}getBinding(e,i){return this.type==="color"?new Jm(e):new Wr(e)}}class Bl{constructor(e,i){this.uniformNames=i.map(s=>`u_${s}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,s,a,u){let h=null;u!=="u_pattern"&&u!=="u_dash"||(h=this.pattern),u==="u_pattern_b"&&(h=this.patternTransition),u==="u_pixel_ratio"&&(h=this.pixelRatio),h&&i.set(e,u,h)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new Dh(e):new Wr(e)}}class ws{constructor(e,i,s,a){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,s,a,u,h,m){const g=this.paintVertexArray.length,v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Wi(0,{brightness:h}),i,{},u,a,m):this.expression.kind==="constant"&&this.expression.value,w=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:h}),i,{},u,a,m):this.lutExpression.value)==="none";this.paintVertexArray.resize(e),this._setPaintValue(g,e,v,w?null:this.context.lut)}updatePaintArray(e,i,s,a,u,h,m){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:m},s,a,void 0,u):this.expression.kind==="constant"&&this.expression.value,v=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:m}),s,a,void 0,u):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v?null:this.context.lut)}_setPaintValue(e,i,s,a){if(this.type==="color"){const u=Zc(s.toRenderColor(a));for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,u[0],u[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Lo{constructor(e,i,s,a,u,h){this.expression=e,this.uniformNames=i.map(m=>`u_${m}_t`),this.type=s,this.useIntegerZoom=a,this.context=u,this.maxValue=0,this.paintVertexAttributes=i.map(m=>({name:`a_${m}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,i,s,a,u,h,m){const g=this.expression.evaluate(new Wi(this.context.zoom,{brightness:h}),i,{},u,a,m),v=this.expression.evaluate(new Wi(this.context.zoom+1,{brightness:h}),i,{},u,a,m),w=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:h}),i,{},u,a,m):this.lutExpression.value)==="none",S=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(S,e,g,v,w?null:this.context.lut)}updatePaintArray(e,i,s,a,u,h,m){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:m},s,a,void 0,u),v=this.expression.evaluate({zoom:this.context.zoom+1,brightness:m},s,a,void 0,u),w=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:m}),s,a,void 0,u):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v,w?null:this.context.lut)}_setPaintValue(e,i,s,a,u){if(this.type==="color"){const h=Zc(s.toRenderColor(u)),m=Zc(s.toRenderColor(u));for(let g=e;g<i;g++)this.paintVertexArray.emplace(g,h[0],h[1],m[0],m[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,s,a);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,s,a,u){const h=this.useIntegerZoom?Math.floor(s.zoom):s.zoom,m=Te(this.expression.interpolationFactor(h,this.context.zoom,this.context.zoom+1),0,1);i.set(e,u,m)}getBinding(e,i){return new Wr(e)}}class ko{constructor(e,i,s,a,u){this.expression=e,this.layerId=u,this.paintVertexAttributes=(s==="array"?Qy:Jy).members;for(let h=0;h<i.length;++h);this.paintVertexArray=new a,this.paintTransitionVertexArray=new bs}populatePaintArray(e,i,s,a){const u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(u,e,i.patterns&&i.patterns[this.layerId],s)}updatePaintArray(e,i,s,a,u,h,m){this._setPaintValues(e,i,s.patterns&&s.patterns[this.layerId],h)}_setPaintValues(e,i,s,a){if(!a||!s)return;const u=a[s[0]],h=a[s[1]];if(u){if(u){const{tl:m,br:g,pixelRatio:v}=u;for(let w=e;w<i;w++)this.paintVertexArray.emplace(w,m[0],m[1],g[0],g[1],v)}if(h){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:m,br:g,pixelRatio:v}=h;for(let w=e;w<i;w++)this.paintTransitionVertexArray.emplace(w,m[0],m[1],g[0],g[1],v)}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,Ol.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class ia{constructor(e,i,s=()=>!0){this.binders={},this._buffers=[],this.context=i;const a=[];for(const u in e.paint._values){const h=e.paint.get(u);if(u.endsWith("-use-theme")||!s(u)||!(h instanceof Pl&&ch(h.property.specification)))continue;const m=t(u,e.type),g=h.value,v=h.property.specification.type,w=!!h.property.useIntegerZoom,S=u==="line-dasharray"||u.endsWith("pattern"),A=e.paint.get(`${u}-use-theme`),D=u==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||A&&A.value.kind!=="constant";if(g.kind!=="constant"||D)if(g.kind==="source"||D||S){const R=d(u,v,"source");this.binders[u]=S?new ko(g,m,v,R,e.id):new ws(g,m,v,R),a.push(`/a_${u}`)}else{const R=d(u,v,"composite");this.binders[u]=new Lo(g,m,v,w,i,R),a.push(`/z_${u}`)}else this.binders[u]=S?new Bl(g.value,m):new Wc(g.value,m,v,i),a.push(`/u_${u}`);A&&(this.binders[u].lutExpression=A.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof ws||i instanceof Lo?i.maxValue:0}populatePaintArrays(e,i,s,a,u,h,m){for(const g in this.binders){const v=this.binders[g];v.context=this.context,(v instanceof ws||v instanceof Lo||v instanceof ko)&&v.populatePaintArray(e,i,s,a,u,h,m)}}setConstantPatternPositions(e,i){for(const s in this.binders){const a=this.binders[s];a instanceof Bl&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof ko?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,s,a,u,h,m,g,v){let w=!1;const S=Object.keys(e),A=S.length!==0&&!g,D=A?S:i.uniqueIds;this.context.lut=u.lut;for(const R in this.binders){const O=this.binders[R];if(O.context=this.context,(O instanceof ws||O instanceof Lo||O instanceof ko)&&O.expression&&O.expression.kind&&O.expression.kind!=="constant"&&(O.expression.isStateDependent===!0||O.expression.isLightConstant===!1)){const $=u.paint.get(R);O.expression=$.value;for(const H of D){const K=e[H.toString()];i.eachPosition(H,(W,F,q)=>{const Y=a.feature(W);O.updatePaintArray(F,q,Y,K,h,m,v)})}if(!A)for(const H of s.uniqueIds){const K=e[H.toString()];s.eachPosition(H,(W,F,q)=>{const Y=a.feature(W);O.updatePaintArray(F,q,Y,K,h,m,v)})}w=!0}}return w}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof Wc||s instanceof Bl)&&e.push(...s.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof ws||s instanceof Lo||s instanceof ko)for(let a=0;a<s.paintVertexAttributes.length;a++)e.push(s.paintVertexAttributes[a].name);if(s instanceof ko)for(let a=0;a<Ol.members.length;a++)e.push(Ol.members[a].name)}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Wc||s instanceof Bl||s instanceof Lo)for(const a of s.uniformNames)e.push(a)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const s in this.binders){const a=this.binders[s];if(a instanceof Wc||a instanceof Bl||a instanceof Lo)for(const u of a.uniformNames)i.push({name:u,property:s,binding:a.getBinding(e,u)})}return i}setUniforms(e,i,s,a,u){for(const{name:h,property:m,binding:g}of s)this.binders[m].setUniform(e,g,u,a.get(m),h)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof ws||i instanceof Lo||i instanceof ko)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof ko&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof ws||s instanceof Lo||s instanceof ko)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof ws||i instanceof Lo||i instanceof ko)&&i.destroy()}}}class Ha{constructor(e,i,s=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new ia(a,i,s);this.needsUpload=!1,this._featureMap=new Fl,this._featureMapWithoutIds=new Fl,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,s,a,u,h,m,g){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(e,i,a,u,h,m,g);i.id!==void 0?this._featureMap.add(i.id,s,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,s,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,a,u,h,m){for(const g of s)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,g,a,u,h,m||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const l={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"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"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"]};function t(r,e){return l[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const n={"line-pattern":{source:bs,composite:bs},"fill-pattern":{source:bs,composite:bs},"fill-extrusion-pattern":{source:bs,composite:bs},"line-dasharray":{source:Sh,composite:Sh}},c={color:{source:Ga,composite:Ko},number:{source:Rl,composite:Ga}};function d(r,e,i){const s=n[r];return s&&s[i]||c[e][i]}Tt(Wc,"ConstantBinder"),Tt(Bl,"PatternConstantBinder"),Tt(ws,"SourceExpressionBinder"),Tt(ko,"PatternCompositeBinder"),Tt(Lo,"CompositeExpressionBinder"),Tt(ia,"ProgramConfiguration",{omit:["_buffers"]}),Tt(Ha,"ProgramConfigurationSet");const f=_t/Math.PI/2,_=5,y=6,b=16383,E=64,I=[E,32,16],P=-f,M=f;function z(r,e,i,s=f){return i=U(i),[r*Math.sin(i)*s,-e*s,r*Math.cos(i)*s]}function N(r,e,i){return z(Math.cos(U(r)),Math.sin(U(r)),e,i)}const B=63710088e-1,G=2*Math.PI*B;class V{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new V(Be(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,s=this.lat*i,a=e.lat*i,u=Math.sin(s)*Math.sin(a)+Math.cos(s)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return B*Math.acos(Math.min(u,1))}toBounds(e=0){const i=360*e/40075017,s=i/Math.cos(Math.PI/180*this.lat);return new X({lng:this.lng-s,lat:this.lat-i},{lng:this.lng+s,lat:this.lat+i})}toEcef(e){return N(this.lat,this.lng,f+e*f/B)}static convert(e){if(e instanceof V)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new V(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new V(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class X{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const s=e;this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]])}else{const s=e;this.setSouthWest(s[0]).setNorthEast(s[1])}}setNorthEast(e){return this._ne=e instanceof V?new V(e.lng,e.lat):V.convert(e),this}setSouthWest(e){return this._sw=e instanceof V?new V(e.lng,e.lat):V.convert(e),this}extend(e){const i=this._sw,s=this._ne;let a,u;if(e instanceof V)a=e,u=e;else{if(!(e instanceof X))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(X.convert(e)):this.extend(V.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(V.convert(e)):this;if(a=e._sw,u=e._ne,!a||!u)return this}return i||s?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),s.lng=Math.max(u.lng,s.lng),s.lat=Math.max(u.lat,s.lat)):(this._sw=new V(a.lng,a.lat),this._ne=new V(u.lng,u.lat)),this}getCenter(){return new V((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new V(this.getWest(),this.getNorth())}getSouthEast(){return new V(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=V.convert(e);let a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&a}static convert(e){if(e)return e instanceof X?e:new X(e)}}const Q=0,ie=25.5;function ue(r){return G*Math.cos(r*Math.PI/180)}function ae(r){return(180+r)/360}function le(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function ne(r,e){return r/ue(e)}function de(r){return 360*r-180}function me(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Le(r,e){return r*ue(me(e))}const Me=85.051129;function Ze(r){return Math.cos(U(Te(r,-Me,Me)))}function He(r,e){const i=Te(e,Q,ie),s=Math.pow(2,i);return Ze(r)*G/(512*s)}function ht(r){return 1/Math.cos(r*Math.PI/180)}function De(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/_t)/(1<<r.z)*2));return 80150034*i/(i*i+1)/_t/(1<<r.z)}class ke{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=V.convert(e);return new ke(ae(s.lng),le(s.lat),ne(i,s.lat))}toLngLat(){return new V(de(this.x),me(this.y))}toAltitude(){return Le(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/G*ht(me(this.y))}}function Ie(r,e,i,s,a,u,h,m,g){const v=(e+s)/2,w=(i+a)/2,S=new ft(v,w);m(S),function(A,D,R,O,$,H){const K=R-$,W=O-H;return Math.abs((O-D)*K-(R-A)*W)/Math.hypot(K,W)}(S.x,S.y,u.x,u.y,h.x,h.y)>=g?(Ie(r,e,i,v,w,u,S,m,g),Ie(r,v,w,s,a,S,h,m,g)):r.push(h)}function Ke(r,e,i){let s=r[0],a=s.x,u=s.y;e(s);const h=[s];for(let m=1;m<r.length;m++){const g=r[m],{x:v,y:w}=g;e(g),Ie(h,a,u,v,w,s,g,e,i),a=v,u=w,s=g}return h}function Ne(r,e,i,s){if(s(e,i)){const a=e.add(i)._mult(.5);Ne(r,e,a,s),Ne(r,a,i,s)}else r.push(i)}function tt(r,e){let i=r[0];const s=[i];for(let a=1;a<r.length;a++){const u=r[a];Ne(s,i,u,e),i=u}return s}const We=Math.pow(2,14)-1,it=-We-1;function rt(r,e){const i=Math.round(r.x*e),s=Math.round(r.y*e);return r.x=Te(i,it,We),r.y=Te(s,it,We),(i<r.x||i>r.x+1||s<r.y||s>r.y+1)&&yi("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function At(r,e,i){const s=r.loadGeometry(),a=r.extent,u=_t/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:m,x:g,y:v,projection:w}=i,S=A=>{const D=de((e.x+A.x/a)/h),R=me((e.y+A.y/a)/h),O=w.project(D,R);A.x=(O.x*m-g)*a,A.y=(O.y*m-v)*a};for(let A=0;A<s.length;A++)if(r.type!==1)s[A]=Ke(s[A],S,1);else{const D=[];for(const R of s[A])R.x<0||R.x>=a||R.y<0||R.y>=a||(S(R),D.push(R));s[A]=D}}for(const h of s)for(const m of h)rt(m,u);return s}function Lt(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?At(r):[]}}function St(r,e,i,s,a){r.emplaceBack(2*e+(s+1)/2,2*i+(a+1)/2)}function Ot(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Ct{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new xs,this.indexArray=new fn,this.segments=new Cr,this.programConfigurations=new Ha(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}updateFootprints(e,i){}populate(e,i,s,a){const u=this.layers[0],h=[];let m=null;u.type==="circle"&&(m=u.layout.get("circle-sort-key"));for(const{feature:v,id:w,index:S,sourceLayerIndex:A}of e){const D=this.layers[0]._featureFilter.needGeometry,R=Lt(v,D);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),R,s))continue;const O=m?m.evaluate(R,{},s):void 0,$={id:w,properties:v.properties,type:v.type,sourceLayerIndex:A,index:S,geometry:D?R.geometry:At(v,s,a),patterns:{},sortKey:O};h.push($)}m&&h.sort((v,w)=>v.sortKey-w.sortKey);let g=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new $a,g=a.projection);for(const v of h){const{geometry:w,index:S,sourceLayerIndex:A}=v,D=e[S].feature;this.addFeature(v,w,S,i.availableImages,s,g,i.brightness),i.featureIndex.insert(D,w,S,A,this.index)}}update(e,i,s,a,u,h,m){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Yy.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Ky.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,i,s,a,u,h,m){for(const g of i)for(const v of g){const w=v.x,S=v.y;if(w<0||w>=_t||S<0||S>=_t)continue;if(h){const R=h.projectTilePoint(w,S,u),O=h.upVector(u,w,S),$=this.globeExtVertexArray;Ot($,R,O),Ot($,R,O),Ot($,R,O),Ot($,R,O)}const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),D=A.vertexLength;St(this.layoutVertexArray,w,S,-1,-1),St(this.layoutVertexArray,w,S,1,-1),St(this.layoutVertexArray,w,S,1,1),St(this.layoutVertexArray,w,S,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+2,D+3),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},a,u,m)}}function Vt(r,e){for(let i=0;i<r.length;i++)if(Yi(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Yi(r,e[i]))return!0;return!!Gi(r,e)}function Yt(r,e,i){return!!Yi(r,e)||!!ti(e,r,i)}function gi(r,e){if(r.length===1)return zi(e,r[0]);for(let i=0;i<e.length;i++){const s=e[i];for(let a=0;a<s.length;a++)if(Yi(r,s[a]))return!0}for(let i=0;i<r.length;i++)if(zi(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Gi(r,e[i]))return!0;return!1}function Xi(r,e,i){if(r.length>1){if(Gi(r,e))return!0;for(let s=0;s<e.length;s++)if(ti(e[s],r,i))return!0}for(let s=0;s<r.length;s++)if(ti(r[s],e,i))return!0;return!1}function Gi(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],a=r[i+1];for(let u=0;u<e.length-1;u++)if(xi(s,a,e[u],e[u+1]))return!0}return!1}function xi(r,e,i,s){return nr(r,i,s)!==nr(e,i,s)&&nr(r,e,i)!==nr(r,e,s)}function kr(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function Ir(r,e,i,s){const a=kr(r,e,s),u=kr(r,e,i);if(Math.sign(a)===Math.sign(u))return;const h=kr(i,s,r),m=h+u-a;return Math.sign(h)!==Math.sign(m)?[h/(h-m),u/(u-a)]:void 0}function ti(r,e,i){const s=i*i;if(e.length===1)return r.distSqr(e[0])<s;for(let a=1;a<e.length;a++)if(Ci(r,e[a-1],e[a])<s)return!0;return!1}function Ci(r,e,i){const s=e.distSqr(i);if(s===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/s;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function zi(r,e){let i,s,a,u=!1;for(let h=0;h<r.length;h++){i=r[h];for(let m=0,g=i.length-1;m<i.length;g=m++)s=i[m],a=i[g],s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(u=!u)}return u}function Yi(r,e){let i=!1;for(let s=0,a=r.length-1;s<r.length;a=s++){const u=r[s],h=r[a];u.y>e.y!=h.y>e.y&&e.x<(h.x-u.x)*(e.y-u.y)/(h.y-u.y)+u.x&&(i=!i)}return i}function Kr(r,e,i,s,a){for(const h of r)if(e<=h.x&&i<=h.y&&s>=h.x&&a>=h.y)return!0;const u=[new ft(e,i),new ft(e,a),new ft(s,a),new ft(s,i)];if(r.length>2){for(const h of u)if(Yi(r,h))return!0}for(let h=0;h<r.length-1;h++)if(jr(r[h],r[h+1],u))return!0;return!1}function jr(r,e,i){const s=i[0],a=i[2];if(r.x<s.x&&e.x<s.x||r.x>a.x&&e.x>a.x||r.y<s.y&&e.y<s.y||r.y>a.y&&e.y>a.y)return!1;const u=nr(r,e,i[0]);return u!==nr(r,e,i[1])||u!==nr(r,e,i[2])||u!==nr(r,e,i[3])}function Xr(r,e,i,s,a,u){let h=e.y-r.y,m=r.x-e.x;if(u=u||0){const g=h*h+m*m;if(g===0)return!0;const v=Math.sqrt(g);h/=v,m/=v}return!((i.x-r.x)*h+(i.y-r.y)*m-u<0||(s.x-r.x)*h+(s.y-r.y)*m-u<0||(a.x-r.x)*h+(a.y-r.y)*m-u<0)}function Sr(r,e,i,s,a,u,h){return!(Xr(r,e,s,a,u,h)||Xr(e,i,s,a,u,h)||Xr(i,r,s,a,u,h)||Xr(s,a,r,e,i,h)||Xr(a,u,r,e,i,h)||Xr(u,s,r,e,i,h))}function si(r,e,i){const s=e.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(r)}function yr(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Di(r,e,i,s,a){if(!e[0]&&!e[1])return r;const u=ft.convert(e)._mult(a);i==="viewport"&&u._rotate(-s);const h=[];for(let m=0;m<r.length;m++)h.push(r[m].sub(u));return h}function vr(r,e,i,s){const a=ft.convert(r)._mult(s);return e==="viewport"&&a._rotate(-i),a}let Bi,Er;function mn(r,e,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}Tt(Ct,"CircleBucket",{omit:["layers"]});class cr{constructor(e,i,s){this.z=e,this.x=i,this.y=s,this.key=wn(0,e,e,i,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){const s=function(u,h,m){var g=mn(256*u,256*(h=Math.pow(2,m)-h-1),m),v=mn(256*(u+1),256*(h+1),m);return g[0]+","+g[1]+","+v[0]+","+v[1]}(this.x,this.y,this.z),a=function(u,h,m){let g,v="";for(let w=u;w>0;w--)g=1<<w-1,v+=(h&g?1:0)+(m&g?2:0);return v}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",s)}toString(){return`${this.z}/${this.x}/${this.y}`}}class vn{constructor(e,i){this.wrap=e,this.canonical=i,this.key=wn(e,i.z,i.z,i.x,i.y)}}class Zr{constructor(e,i,s,a,u){this.overscaledZ=e,this.wrap=i,this.canonical=new cr(s,+a,+u),this.key=i===0&&e===s?this.canonical.key:wn(i,e,s,a,u)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new Zr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Zr(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return wn(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const s=this.canonical.z-e;return wn(this.wrap*+i,e,e,this.canonical.x>>s,this.canonical.y>>s)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new Zr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,a=2*this.canonical.y;return[new Zr(i,this.wrap,i,s,a),new Zr(i,this.wrap,i,s+1,a),new Zr(i,this.wrap,i,s,a+1),new Zr(i,this.wrap,i,s+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Zr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Zr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new vn(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function wn(r,e,i,s,a){const u=1<<Math.min(i,22);let h=u*(a%u)+s%u;return r&&i<22&&(h+=u*u*((r<0?-2*r-1:2*r)%(1<<2*(22-i)))),16*(32*h+i)+(e-i)}const Oo=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new Zr(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>{let e=r.canonical.x+1,i=r.wrap;return e===1<<r.canonical.z&&(e=0,i++),new Zr(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new Zr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new Zr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];Tt(cr,"CanonicalTileID"),Tt(Zr,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Ts=ki([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:io}=Ts,bo=ki([{name:"a_pos_3",components:3,type:"Int16"}]);var Qo=ki([{name:"a_pos",type:"Int16",components:2}]);class es{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const a=Ar(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return s[0]=this.pos[0]+this.dir[0]*u,s[1]=this.pos[1]+this.dir[1]*u,!0}}class Fo{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const a=Zi(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return s[0]=this.pos[0]+this.dir[0]*u,s[1]=this.pos[1]+this.dir[1]*u,s[2]=this.pos[2]+this.dir[2]*u,!0}closestPointOnSphere(e,i,s){if(function(D,R){var O=D[0],$=D[1],H=D[2],K=R[0],W=R[1],F=R[2];return Math.abs(O-K)<=re*Math.max(1,Math.abs(O),Math.abs(K))&&Math.abs($-W)<=re*Math.max(1,Math.abs($),Math.abs(W))&&Math.abs(H-F)<=re*Math.max(1,Math.abs(H),Math.abs(F))}(this.pos,e)||i===0)return s[0]=s[1]=s[2]=0,!1;const[a,u,h]=this.dir,m=this.pos[0]-e[0],g=this.pos[1]-e[1],v=this.pos[2]-e[2],w=a*a+u*u+h*h,S=2*(m*a+g*u+v*h),A=S*S-4*w*(m*m+g*g+v*v-i*i);if(A<0){const D=Math.max(-S/2,0),R=m+a*D,O=g+u*D,$=v+h*D,H=Math.hypot(R,O,$);return s[0]=R*i/H,s[1]=O*i/H,s[2]=$*i/H,!1}{const D=(-S-Math.sqrt(A))/(2*w);if(D<0){const R=Math.hypot(m,g,v);return s[0]=m*i/R,s[1]=g*i/R,s[2]=v*i/R,!1}return s[0]=m+a*D,s[1]=g+u*D,s[2]=v+h*D,!0}}}class Nl{constructor(e,i,s,a,u){this.TL=e,this.TR=i,this.BR=s,this.BL=a,this.horizon=u}static fromInvProjectionMatrix(e,i,s){const a=[-1,1,1],u=[1,1,1],h=[1,-1,1],m=[-1,-1,1],g=gr(a,a,e),v=gr(u,u,e),w=gr(h,h,e),S=gr(m,m,e);return new Nl(g,v,w,S,i/s)}}function qa(r,e,i){let s=1/0,a=-1/0;const u=[];for(const h of r){Ei(u,h,e);const m=Zi(u,i);s=Math.min(s,m),a=Math.max(a,m)}return[s,a]}function Rh(r,e){let i=!0;for(let s=0;s<r.planes.length;s++){const a=r.planes[s];let u=0;for(let h=0;h<e.length;h++)u+=Zi(a,e[h])+a[3]>=0;if(u===0)return 0;u!==e.length&&(i=!1)}return i?2:1}function zh(r,e){for(const i of r.projections){const s=qa(e,r.points[0],i.axis);if(i.projection[1]<s[0]||i.projection[0]>s[1])return 0}return 1}function Lh(r,e){let i=0;const s=[0,0,0,0];for(let h=0;h<r.length;h++)s[0]=r[h][0],s[1]=r[h][1],s[2]=r[h][2],s[3]=1,(a=s)[0]*(u=e)[0]+a[1]*u[1]+a[2]*u[2]+a[3]*u[3]>=0&&i++;var a,u;return i}class Xc{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=xr.fromPoints(this.points),this.projections=[],this.frustumEdges=[Ei([],this.points[2],this.points[3]),Ei([],this.points[0],this.points[3]),Ei([],this.points[4],this.points[0]),Ei([],this.points[5],this.points[1]),Ei([],this.points[6],this.points[2]),Ei([],this.points[7],this.points[3])];for(const s of this.frustumEdges){const a=[0,-s[2],s[1]],u=[s[2],0,-s[0]];this.projections.push({axis:a,projection:qa(this.points,this.points[0],a)}),this.projections.push({axis:u,projection:qa(this.points,this.points[0],u)})}}static fromInvProjectionMatrix(e,i,s,a){const u=Math.pow(2,s),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(v=>{const w=Dr([],v,e),S=1/w[3]/i*u;return(A=w)[0]=(D=w)[0]*(R=[S,S,a?1/w[3]:S,S])[0],A[1]=D[1]*R[1],A[2]=D[2]*R[2],A[3]=D[3]*R[3],A;var A,D,R}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(v=>{const w=Ui([],Lr([],Ei([],h[v[0]],h[v[1]]),Ei([],h[v[2]],h[v[1]]))),S=-Zi(w,h[v[1]]);return w.concat(S)}),g=[];for(let v=0;v<h.length;v++)g.push([h[v][0],h[v][1],h[v][2]]);return new Xc(g,m)}intersectsPrecise(e,i,s){for(let a=0;a<i.length;a++)if(!Lh(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!Lh(e,this.planes[a]))return 0;for(const a of s)for(const u of this.frustumEdges){const h=Lr([],a,u),m=Jt(h);if(m===0)continue;Ii(h,h,1/m);const g=qa(this.points,this.points[0],h),v=qa(e,this.points[0],h);if(g[0]>v[1]||v[0]>g[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const s=i[3];if(Zi([i[0],i[1],i[2]],e)+s<0)return!1}return!0}}class xr{static fromPoints(e){const i=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0];for(const a of e)pr(i,i,a),_r(s,s,a);return new xr(i,s)}static fromTileIdAndHeight(e,i,s){const a=1<<e.canonical.z,u=e.canonical.x,h=e.canonical.y;return new xr([u/a,h/a,i],[(u+1)/a,(h+1)/a,s])}static applyTransform(e,i){const s=e.getCorners();for(let a=0;a<s.length;++a)gr(s[a],s[a],i);return xr.fromPoints(s)}static applyTransformFast(e,i){const s=[i[12],i[13],i[14]],a=[...s];for(let u=0;u<3;u++)for(let h=0;h<3;h++){const m=i[4*h+u],g=m*e.min[h],v=m*e.max[h];s[u]+=Math.min(g,v),a[u]+=Math.max(g,v)}return new xr(s,a)}static projectAabbCorners(e,i){const s=e.getCorners();for(let a=0;a<s.length;++a)gr(s[a],s[a],i);return s}constructor(e,i){this.min=e,this.max=i,this.center=Ii([],vi([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],s=bi(this.min),a=bi(this.max);for(let u=0;u<i.length;u++)s[u]=i[u]?this.min[u]:this.center[u],a[u]=i[u]?this.center[u]:this.max[u];return a[2]=this.max[2],new xr(s,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Rh(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Rh(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?zh(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?zh(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}function jl(r){return r*f/B}Tt(xr,"Aabb");const Sp=[new xr([P,P,P],[M,M,M]),new xr([P,P,P],[0,0,M]),new xr([0,P,P],[M,0,M]),new xr([P,0,P],[0,M,M]),new xr([0,0,P],[M,M,M])];function tw(r,e,i,s=!0){const a=Ii([],r._camera.position,r.worldSize),u=[e,i,1,1];Dr(u,u,r.pixelMatrixInverse),En(u,u,1/u[3]);const h=Ui([],Ei([],u,a)),m=r.globeMatrix,g=[m[12],m[13],m[14]],v=Ei([],g,a),w=Jt(v),S=Ui([],v),A=r.worldSize/(2*Math.PI),D=Zi(S,h),R=Math.asin(A/w);if(R<Math.acos(D)){if(!s)return null;const ve=[],Ce=[];Ii(ve,h,w/D),Ui(Ce,Ei(Ce,ve,v)),Ui(h,vi(h,v,Ii(h,Ce,Math.tan(R)*w)))}const O=[];new Fo(a,h).closestPointOnSphere(g,A,O);const $=Ui([],pn(m,0)),H=Ui([],pn(m,1)),K=Ui([],pn(m,2)),W=Zi($,O),F=Zi(H,O),q=Zi(K,O),Y=Z(Math.asin(-F/A));let ee=Z(Math.atan2(W,q));ee=r.center.lng+function(ve,Ce){const Ue=(Ce-ve+180)%360-180;return Ue<-180?Ue+360:Ue}(r.center.lng,ee);const he=ae(ee),ye=Te(le(Y),0,1);return new ke(he,ye)}class PL{constructor(e,i,s){this.a=Ei([],e,s),this.b=Ei([],i,s),this.center=s;const a=Ui([],this.a),u=Ui([],this.b);this.angle=Math.acos(Zi(a,u))}}function t0(r,e){if(r.angle===0)return null;let i;return i=r.a[e]===0?1/r.angle*.5*Math.PI:1/r.angle*Math.atan(r.b[e]/r.a[e]/Math.sin(r.angle)-1/Math.tan(r.angle)),i<0||i>1?null:function(s,a,u,h){const m=Math.sin(u);return s*(Math.sin((1-h)*u)/m)+a*(Math.sin(h*u)/m)}(r.a[e],r.b[e],r.angle,Te(i,0,1))+r.center[e]}function ra(r){if(r.z<=1)return Sp[r.z+2*r.y+r.x];const e=i0(e_(r));return xr.fromPoints(e)}function Za(r,e,i){return Ii(r,r,1-i),$r(r,r,e,i)}function iw(r,e,i){for(const s of r)gr(s,s,e),Ii(s,s,i)}function rw(r,e,i,s){const a=e/r.worldSize,u=r.globeMatrix;if(i.z<=1){const ye=ra(i).getCorners();return iw(ye,u,a),xr.fromPoints(ye)}const h=e_(i,s),m=i0(h,f+jl(r._tileCoverLift));iw(m,u,a);const g=Number.MAX_VALUE,v=[-g,-g,-g],w=[g,g,g];if(h.contains(r.center)){for(const Ce of m)pr(w,w,Ce),_r(v,v,Ce);v[2]=0;const ye=r.point,ve=[ye.x*a,ye.y*a,0];return pr(w,w,ve),_r(v,v,ve),new xr(w,v)}if(r._tileCoverLift>0){for(const ye of m)pr(w,w,ye),_r(v,v,ye);return new xr(w,v)}const S=[u[12]*a,u[13]*a,u[14]*a],A=h.getCenter(),D=Te(r.center.lat,-Me,Me),R=Te(A.lat,-Me,Me),O=ae(r.center.lng),$=le(D);let H=O-ae(A.lng);const K=$-le(R);H>.5?H-=1:H<-.5&&(H+=1);let W=0;Math.abs(H)>Math.abs(K)?W=H>=0?1:3:(W=K>=0?0:2,$r(S,S,[u[4]*a,u[5]*a,u[6]*a],-Math.sin(U(K>=0?h.getSouth():h.getNorth()))*f));const F=m[W],q=m[(W+1)%4],Y=new PL(F,q,S),ee=[t0(Y,0)||F[0],t0(Y,1)||F[1],t0(Y,2)||F[2]],he=Vl(r.zoom);if(he>0){const ye=function({x:Ce,y:Ue,z:et},Ye,Qe,ot,je){const Je=1/(1<<et);let Fe=Ce*Je,Ve=Fe+Je,lt=Ue*Je,ut=lt+Je,zt=0;const Et=(Fe+Ve)/2-ot;return Et>.5?zt=-1:Et<-.5&&(zt=1),Fe=((Fe+zt)*Ye-(ot*=Ye))*Qe+ot,Ve=((Ve+zt)*Ye-ot)*Qe+ot,lt=(lt*Ye-(je*=Ye))*Qe+je,ut=(ut*Ye-je)*Qe+je,[[Fe,ut,0],[Ve,ut,0],[Ve,lt,0],[Fe,lt,0]]}(i,e,r._pixelsPerMercatorPixel,O,$);for(let Ce=0;Ce<m.length;Ce++)Za(m[Ce],ye[Ce],he);const ve=vi([],ye[W],ye[(W+1)%4]);Ii(ve,ve,.5),Za(ee,ve,he)}for(const ye of m)pr(w,w,ye),_r(v,v,ye);return w[2]=Math.min(F[2],q[2]),pr(w,w,ee),_r(v,v,ee),new xr(w,v)}function e_({x:r,y:e,z:i},s=!1){const a=1/(1<<i),u=new V(de(r*a),e===(1<<i)-1&&s?-90:me((e+1)*a)),h=new V(de((r+1)*a),e===0&&s?90:me(e*a));return new X(u,h)}function i0(r,e=f){const i=U(r.getNorth()),s=U(r.getSouth()),a=Math.cos(i),u=Math.cos(s),h=Math.sin(i),m=Math.sin(s),g=r.getWest(),v=r.getEast();return[z(u,m,g,e),z(u,m,v,e),z(a,h,v,e),z(a,h,g,e)]}function Ep(r,e,i,s){const a=1<<i.z,u=(r/_t+i.x)/a;return N(me((e/_t+i.y)/a),de(u),s)}function t_({min:r,max:e}){return b/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const nw=new Float64Array(16);function i_(r){const e=t_(r),i=$t(nw,[e,e,e]);return st(i,i,ho([],r.min))}function r0(r){const e=(s=r.min,(i=nw)[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=s[0],i[13]=s[1],i[14]=s[2],i[15]=1,i);var i,s;const a=1/t_(r);return nt(e,e,[a,a,a])}function n0(r){const e=_t/(2*Math.PI);return r/(2*Math.PI)/e}function ow(r,e){return _t/(512*Math.pow(2,r))*t_(ra(e))}function sw(r,e,i,s,a){const u=n0(i),h=[r,e,-i/(2*Math.PI)],m=_e(new Float64Array(16));return st(m,m,h),nt(m,m,[u,u,u]),Xe(m,m,U(-a)),ct(m,m,U(-s)),m}function Vl(r){return Ae(_,y,r)}function aw(r,e){const i=N(e.lat,e.lng),s=function(R){const O=N(R._center.lat,R._center.lng);let $=Lr([],Bt(0,1,0),O);const H=kt([],-R.angle,O);$=gr($,$,H),kt(H,-R._pitch,$);const K=Ui([],O);return Ii(K,K,jl(R.cameraToCenterDistance/R.pixelsPerMeter)),gr(K,K,H),vi([],O,K)}(r);return h=(a=ri([],s,i))[0],m=a[1],g=a[2],v=(u=i)[0],w=u[1],S=u[2],D=(A=Math.sqrt(h*h+m*m+g*g)*Math.sqrt(v*v+w*w+S*S))&&Zi(a,u)/A,Math.acos(Math.min(Math.max(D,-1),1));var a,u,h,m,g,v,w,S,A,D}function o0(r,e){return aw(r,e)>Math.PI/2*1.01}const lw=U(85),DL=Math.cos(lw),RL=Math.sin(lw),zL=Pe(),cw=r=>{const e=[];return r.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),r.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function uw(r,e,i,s,a,u,h,m,g){if(u&&r.queryGeometry.isAboveHorizon)return!1;u&&(g*=r.pixelToTileUnitsFactor);const v=r.tileID.canonical,w=i.projection.upVectorScale(v,i.center.lat,i.worldSize).metersToTile;for(const S of e)for(const A of S){const D=A.add(m),R=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(D.x,D.y,!0):0,O=i.projection.projectTilePoint(D.x,D.y,v);if(R>0){const W=i.projection.upVector(v,D.x,D.y);O.x+=W[0]*w*R,O.y+=W[1]*w*R,O.z+=W[2]*w*R}const $=u?D:LL(O.x,O.y,O.z,s),H=u?r.tilespaceRays.map(W=>OL(W,R)):r.queryGeometry.screenGeometry,K=Dr([],[O.x,O.y,O.z,1],s);if(!h&&u?g*=K[3]/i.cameraToCenterDistance:h&&!u&&(g*=i.cameraToCenterDistance/K[3]),u){const W=me((A.y/_t+v.y)/(1<<v.z));g/=i.projection.pixelsPerMeter(W,1)/ne(1,W)}if(Yt(H,$,g))return!0}return!1}function LL(r,e,i,s){const a=Dr([],[r,e,i,1],s);return new ft(a[0]/a[3],a[1]/a[3])}const hw=Bt(0,0,0),kL=Bt(0,0,1);function OL(r,e){const i=mi();return hw[2]=e,r.intersectsPlane(hw,kL,i),new ft(i[0],i[1])}class dw extends Ct{}let pw,fw,mw,_w;function gw(r,{width:e,height:i},s,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*s)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*s);return r.width=e,r.height=i,r.data=a,r}function yw(r,e,i){const{width:s,height:a}=e;s===r.width&&a===r.height||(s0(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,s),height:Math.min(r.height,a)},i,null),r.width=s,r.height=a,r.data=e.data)}function s0(r,e,i,s,a,u,h,m){if(a.width===0||a.height===0)return e;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||s.x>e.width-a.width||s.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const g=r.data,v=e.data,w=u===4&&m;for(let S=0;S<a.height;S++){const A=((i.y+S)*r.width+i.x)*u,D=((s.y+S)*e.width+s.x)*u;if(w)for(let R=0;R<a.width;R++){const O=A+R*u+3,$=D+R*u;v[$+0]=255,v[$+1]=255,v[$+2]=255,v[$+3]=g[O]}else if(h)for(let R=0;R<a.width;R++){const O=A+R*u,$=D+R*u,H=g[O+3],K=new Fi(g[O+0]/255*H,g[O+1]/255*H,g[O+2]/255*H,H).toRenderColor(h).toArray();v[$+0]=K[0],v[$+1]=K[1],v[$+2]=K[2],v[$+3]=K[3]}else for(let R=0;R<a.width*u;R++)v[D+R]=g[A+R]}return e}Tt(dw,"HeatmapBucket",{omit:["layers"]});class Ul{constructor(e,i){gw(this,e,1,i)}resize(e){yw(this,new Ul(e),1)}clone(){return new Ul({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,u){s0(e,i,s,a,u,1,null)}}class In{constructor(e,i){gw(this,e,4,i)}resize(e){yw(this,new In(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new In({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,u,h,m){s0(e,i,s,a,u,4,h,m)}}class vw{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function Ap(r){const e={},i=r.resolution||256,s=r.clips?r.clips.length:1,a=r.image||new In({width:i,height:s}),u=(h,m,g)=>{e[r.evaluationKey]=g;const v=r.expression.evaluate(e);v&&(a.data[h+m+0]=Math.floor(255*v.r/v.a),a.data[h+m+1]=Math.floor(255*v.g/v.a),a.data[h+m+2]=Math.floor(255*v.b/v.a),a.data[h+m+3]=Math.floor(255*v.a))};if(r.clips)for(let h=0,m=0;h<s;++h,m+=4*i)for(let g=0,v=0;g<i;g++,v+=4){const w=g/(i-1),{start:S,end:A}=r.clips[h];u(m,v,S*(1-w)+A*w)}else for(let h=0,m=0;h<i;h++,m+=4)u(0,m,h/(i-1));return a}Tt(Ul,"AlphaImage"),Tt(In,"RGBAImage");const FL=ki([{name:"a_pos",components:2,type:"Int16"}],4),BL=ki([{name:"a_road_z_offset",components:1,type:"Float32"}],4),NL=ki([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),jL=ki([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function Ip(r,e,i=2){const s=e&&e.length,a=s?e[0]*i:r.length;let u=xw(r,0,a,i,!0);const h=[];if(!u||u.next===u.prev)return h;let m,g,v;if(s&&(u=function(w,S,A,D){const R=[];for(let O=0,$=S.length;O<$;O++){const H=xw(w,S[O]*D,O<$-1?S[O+1]*D:w.length,D,!1);H===H.next&&(H.steiner=!0),R.push(WL(H))}R.sort(HL);for(let O=0;O<R.length;O++)A=qL(R[O],A);return A}(r,e,u,i)),r.length>80*i){m=1/0,g=1/0;let w=-1/0,S=-1/0;for(let A=i;A<a;A+=i){const D=r[A],R=r[A+1];D<m&&(m=D),R<g&&(g=R),D>w&&(w=D),R>S&&(S=R)}v=Math.max(w-m,S-g),v=v!==0?32767/v:0}return Cp(u,h,i,m,g,v,0),h}function xw(r,e,i,s,a){let u;if(a===function(h,m,g,v){let w=0;for(let S=m,A=g-v;S<g;S+=v)w+=(h[A]-h[S])*(h[S+1]+h[A+1]),A=S;return w}(r,e,i,s)>0)for(let h=e;h<i;h+=s)u=Sw(h/s|0,r[h],r[h+1],u);else for(let h=i-s;h>=e;h-=s)u=Sw(h/s|0,r[h],r[h+1],u);return u&&kh(u,u.next)&&(Dp(u),u=u.next),u}function Yc(r,e){if(!r)return r;e||(e=r);let i,s=r;do if(i=!1,s.steiner||!kh(s,s.next)&&_n(s.prev,s,s.next)!==0)s=s.next;else{if(Dp(s),s=e=s.prev,s===s.next)break;i=!0}while(i||s!==e);return e}function Cp(r,e,i,s,a,u,h){if(!r)return;!h&&u&&function(g,v,w,S){let A=g;do A.z===0&&(A.z=a0(A.x,A.y,v,w,S)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==g);A.prevZ.nextZ=null,A.prevZ=null,function(D){let R,O=1;do{let $,H=D;D=null;let K=null;for(R=0;H;){R++;let W=H,F=0;for(let Y=0;Y<O&&(F++,W=W.nextZ,W);Y++);let q=O;for(;F>0||q>0&&W;)F!==0&&(q===0||!W||H.z<=W.z)?($=H,H=H.nextZ,F--):($=W,W=W.nextZ,q--),K?K.nextZ=$:D=$,$.prevZ=K,K=$;H=W}K.nextZ=null,O*=2}while(R>1)}(A)}(r,s,a,u);let m=r;for(;r.prev!==r.next;){const g=r.prev,v=r.next;if(u?UL(r,s,a,u):VL(r))e.push(g.i,r.i,v.i),Dp(r),r=v.next,m=v.next;else if((r=v)===m){h?h===1?Cp(r=$L(Yc(r),e),e,i,s,a,u,2):h===2&&GL(r,e,i,s,a,u):Cp(Yc(r),e,i,s,a,u,1);break}}}function VL(r){const e=r.prev,i=r,s=r.next;if(_n(e,i,s)>=0)return!1;const a=e.x,u=i.x,h=s.x,m=e.y,g=i.y,v=s.y,w=Math.min(a,u,h),S=Math.min(m,g,v),A=Math.max(a,u,h),D=Math.max(m,g,v);let R=s.next;for(;R!==e;){if(R.x>=w&&R.x<=A&&R.y>=S&&R.y<=D&&Mp(a,m,u,g,h,v,R.x,R.y)&&_n(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function UL(r,e,i,s){const a=r.prev,u=r,h=r.next;if(_n(a,u,h)>=0)return!1;const m=a.x,g=u.x,v=h.x,w=a.y,S=u.y,A=h.y,D=Math.min(m,g,v),R=Math.min(w,S,A),O=Math.max(m,g,v),$=Math.max(w,S,A),H=a0(D,R,e,i,s),K=a0(O,$,e,i,s);let W=r.prevZ,F=r.nextZ;for(;W&&W.z>=H&&F&&F.z<=K;){if(W.x>=D&&W.x<=O&&W.y>=R&&W.y<=$&&W!==a&&W!==h&&Mp(m,w,g,S,v,A,W.x,W.y)&&_n(W.prev,W,W.next)>=0||(W=W.prevZ,F.x>=D&&F.x<=O&&F.y>=R&&F.y<=$&&F!==a&&F!==h&&Mp(m,w,g,S,v,A,F.x,F.y)&&_n(F.prev,F,F.next)>=0))return!1;F=F.nextZ}for(;W&&W.z>=H;){if(W.x>=D&&W.x<=O&&W.y>=R&&W.y<=$&&W!==a&&W!==h&&Mp(m,w,g,S,v,A,W.x,W.y)&&_n(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;F&&F.z<=K;){if(F.x>=D&&F.x<=O&&F.y>=R&&F.y<=$&&F!==a&&F!==h&&Mp(m,w,g,S,v,A,F.x,F.y)&&_n(F.prev,F,F.next)>=0)return!1;F=F.nextZ}return!0}function $L(r,e){let i=r;do{const s=i.prev,a=i.next.next;!kh(s,a)&&ww(s,i,i.next,a)&&Pp(s,a)&&Pp(a,s)&&(e.push(s.i,i.i,a.i),Dp(i),Dp(i.next),i=r=a),i=i.next}while(i!==r);return Yc(i)}function GL(r,e,i,s,a,u){let h=r;do{let m=h.next.next;for(;m!==h.prev;){if(h.i!==m.i&&XL(h,m)){let g=Tw(h,m);return h=Yc(h,h.next),g=Yc(g,g.next),Cp(h,e,i,s,a,u,0),void Cp(g,e,i,s,a,u,0)}m=m.next}h=h.next}while(h!==r)}function HL(r,e){let i=r.x-e.x;return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function qL(r,e){const i=function(a,u){let h=u;const m=a.x,g=a.y;let v,w=-1/0;if(kh(a,h))return h;do{if(kh(a,h.next))return h.next;if(g<=h.y&&g>=h.next.y&&h.next.y!==h.y){const O=h.x+(g-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(O<=m&&O>w&&(w=O,v=h.x<h.next.x?h:h.next,O===m))return v}h=h.next}while(h!==u);if(!v)return null;const S=v,A=v.x,D=v.y;let R=1/0;h=v;do{if(m>=h.x&&h.x>=A&&m!==h.x&&bw(g<D?m:w,g,A,D,g<D?w:m,g,h.x,h.y)){const O=Math.abs(g-h.y)/(m-h.x);Pp(h,a)&&(O<R||O===R&&(h.x>v.x||h.x===v.x&&ZL(v,h)))&&(v=h,R=O)}h=h.next}while(h!==S);return v}(r,e);if(!i)return e;const s=Tw(i,r);return Yc(s,s.next),Yc(i,i.next)}function ZL(r,e){return _n(r.prev,r,e.prev)<0&&_n(e.next,r,r.next)<0}function a0(r,e,i,s,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function WL(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function bw(r,e,i,s,a,u,h,m){return(a-h)*(e-m)>=(r-h)*(u-m)&&(r-h)*(s-m)>=(i-h)*(e-m)&&(i-h)*(u-m)>=(a-h)*(s-m)}function Mp(r,e,i,s,a,u,h,m){return!(r===h&&e===m)&&bw(r,e,i,s,a,u,h,m)}function XL(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!function(i,s){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==s.i&&a.next.i!==s.i&&ww(a,a.next,i,s))return!0;a=a.next}while(a!==i);return!1}(r,e)&&(Pp(r,e)&&Pp(e,r)&&function(i,s){let a=i,u=!1;const h=(i.x+s.x)/2,m=(i.y+s.y)/2;do a.y>m!=a.next.y>m&&a.next.y!==a.y&&h<(a.next.x-a.x)*(m-a.y)/(a.next.y-a.y)+a.x&&(u=!u),a=a.next;while(a!==i);return u}(r,e)&&(_n(r.prev,r,e.prev)||_n(r,e.prev,e))||kh(r,e)&&_n(r.prev,r,r.next)>0&&_n(e.prev,e,e.next)>0)}function _n(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function kh(r,e){return r.x===e.x&&r.y===e.y}function ww(r,e,i,s){const a=n_(_n(r,e,i)),u=n_(_n(r,e,s)),h=n_(_n(i,s,r)),m=n_(_n(i,s,e));return a!==u&&h!==m||!(a!==0||!r_(r,i,e))||!(u!==0||!r_(r,s,e))||!(h!==0||!r_(i,r,s))||!(m!==0||!r_(i,e,s))}function r_(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function n_(r){return r>0?1:r<0?-1:0}function Pp(r,e){return _n(r.prev,r,r.next)<0?_n(r,e,r.next)>=0&&_n(r,r.prev,e)>=0:_n(r,e,r.prev)<0||_n(r,r.next,e)<0}function Tw(r,e){const i=l0(r.i,r.x,r.y),s=l0(e.i,e.x,e.y),a=r.next,u=e.prev;return r.next=e,e.prev=r,i.next=a,a.prev=i,s.next=i,i.prev=s,u.next=s,s.prev=u,s}function Sw(r,e,i,s){const a=l0(r,e,i);return s?(a.next=s.next,a.prev=s,s.next.prev=a,s.next=a):(a.prev=a,a.next=a),a}function Dp(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function l0(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function o_(r,e){const i=r.length;if(i<=1)return[r];const s=[];let a,u;for(let h=0;h<i;h++){const m=Li(r[h]);m!==0&&(r[h].area=Math.abs(m),u===void 0&&(u=m<0),u===m<0?(a&&s.push(a),a=[r[h]]):a.push(r[h]))}if(a&&s.push(a),e>1)for(let h=0;h<s.length;h++)s[h].length<=e||(Gs(s[h],e,1,s[h].length-1,YL),s[h]=s[h].slice(0,e));return s}function YL(r,e){return e.area-r.area}function Ew(r,e,i=1){if(!r)return null;const s=typeof r=="string"?Zn.from(r).getPrimary():r.getPrimary(),a=typeof r=="string"?null:r.getSecondary();for(const u of[s,a]){if(!u)continue;const h=u.id.toString();e.has(h)||e.set(h,[]),u.scaleSelf(i),e.get(h).push(u)}return{primary:s.toString(),secondary:a?a.toString():null}}function c0(r,e,i,s){const a=s.patternDependencies;let u=!1;for(const h of e){const m=h.paint.get(`${r}-pattern`);m.isConstant()||(u=!0),Ew(m.constantOr(null),a,i)&&(u=!0)}return u}function u0(r,e,i,s,a,u){const h=u.patternDependencies;for(const m of e){const g=m.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let v=g.evaluate({zoom:s},i,{},u.availableImages);v=v&&v.name?v.name:v;const w=Ew(v,h,a);if(!w)continue;const{primary:S,secondary:A}=w;S&&(i.patterns[m.id]=[S,A].filter(Boolean))}}return i}var h0,Aw,d0,Iw,p0,Cw,Mw,s_={};function Pw(){if(Aw)return h0;Aw=1;var r=lc();function e(a,u,h,m,g){this.properties={},this.extent=h,this.type=0,this._pbf=a,this._geometry=-1,this._keys=m,this._values=g,a.readFields(i,this,u)}function i(a,u,h){a==1?u.id=h.readVarint():a==2?function(m,g){for(var v=m.readVarint()+m.pos;m.pos<v;){var w=g._keys[m.readVarint()],S=g._values[m.readVarint()];g.properties[w]=S}}(h,u):a==3?u.type=h.readVarint():a==4&&(u._geometry=h.pos)}function s(a){for(var u,h,m=0,g=0,v=a.length,w=v-1;g<v;w=g++)m+=((h=a[w]).x-(u=a[g]).x)*(u.y+h.y);return m}return h0=e,e.types=["Unknown","Point","LineString","Polygon"],e.prototype.loadGeometry=function(){var a=this._pbf;a.pos=this._geometry;for(var u,h=a.readVarint()+a.pos,m=1,g=0,v=0,w=0,S=[];a.pos<h;){if(g<=0){var A=a.readVarint();m=7&A,g=A>>3}if(g--,m===1||m===2)v+=a.readSVarint(),w+=a.readSVarint(),m===1&&(u&&S.push(u),u=[]),u.push(new r(v,w));else{if(m!==7)throw new Error("unknown command "+m);u&&u.push(u[0].clone())}}return u&&S.push(u),S},e.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var u=a.readVarint()+a.pos,h=1,m=0,g=0,v=0,w=1/0,S=-1/0,A=1/0,D=-1/0;a.pos<u;){if(m<=0){var R=a.readVarint();h=7&R,m=R>>3}if(m--,h===1||h===2)(g+=a.readSVarint())<w&&(w=g),g>S&&(S=g),(v+=a.readSVarint())<A&&(A=v),v>D&&(D=v);else if(h!==7)throw new Error("unknown command "+h)}return[w,A,S,D]},e.prototype.toGeoJSON=function(a,u,h){var m,g,v=this.extent*Math.pow(2,h),w=this.extent*a,S=this.extent*u,A=this.loadGeometry(),D=e.types[this.type];function R(H){for(var K=0;K<H.length;K++){var W=H[K];H[K]=[360*(W.x+w)/v-180,360/Math.PI*Math.atan(Math.exp((180-360*(W.y+S)/v)*Math.PI/180))-90]}}switch(this.type){case 1:var O=[];for(m=0;m<A.length;m++)O[m]=A[m][0];R(A=O);break;case 2:for(m=0;m<A.length;m++)R(A[m]);break;case 3:for(A=function(H){var K=H.length;if(K<=1)return[H];for(var W,F,q=[],Y=0;Y<K;Y++){var ee=s(H[Y]);ee!==0&&(F===void 0&&(F=ee<0),F===ee<0?(W&&q.push(W),W=[H[Y]]):W.push(H[Y]))}return W&&q.push(W),q}(A),m=0;m<A.length;m++)for(g=0;g<A[m].length;g++)R(A[m][g])}A.length===1?A=A[0]:D="Multi"+D;var $={type:"Feature",geometry:{type:D,coordinates:A},properties:this.properties};return"id"in this&&($.id=this.id),$},h0}function Dw(){if(Iw)return d0;Iw=1;var r=Pw();function e(s,a){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=s,this._keys=[],this._values=[],this._features=[],s.readFields(i,this,a),this.length=this._features.length}function i(s,a,u){s===15?a.version=u.readVarint():s===1?a.name=u.readString():s===5?a.extent=u.readVarint():s===2?a._features.push(u.pos):s===3?a._keys.push(u.readString()):s===4&&a._values.push(function(h){for(var m=null,g=h.readVarint()+h.pos;h.pos<g;){var v=h.readVarint()>>3;m=v===1?h.readString():v===2?h.readFloat():v===3?h.readDouble():v===4?h.readVarint64():v===5?h.readVarint():v===6?h.readSVarint():v===7?h.readBoolean():null}return m}(u))}return d0=e,e.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var a=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,a,this.extent,this._keys,this._values)},d0}function Rw(){return Mw||(Mw=1,s_.VectorTile=function(){if(Cw)return p0;Cw=1;var r=Dw();function e(i,s,a){if(i===3){var u=new r(a,a.readVarint()+a.pos);u.length&&(s[u.name]=u)}}return p0=function(i,s){this.layers=i.readFields(e,{},s)},p0}(),s_.VectorTileFeature=Pw(),s_.VectorTileLayer=Dw()),s_}var $l=Rw();const Kc="3d_elevation_id",zw="level";class KL{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,s){return this.get(e,!0,i,s)}optional(e,i,s){return this.get(e,!1,i,s)}success(){return this._valid}get(e,i,s,a){const u=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&u!==void 0&&!Number.isNaN(u)?s(a?a(u):u):i&&(this._valid=!1),this}}class Lw{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,s){return this.featureFunc(e,i,s)}parseVertex(e,i,s){return this.vertexFunc(e,i,s)}}const JL=new Lw((r,e,i)=>r.reset(e).require(Kc,s=>{i.id=s}).optional("fixed_height_relative",s=>{i.constantHeight=s},Jc.decodeRelativeHeight).geometry(s=>{i.bounds=s},Cd).success(),(r,e,i)=>r.reset(e).require(Kc,s=>{i.id=s}).require("elevation_idx",s=>{i.idx=s}).require("extent",s=>{i.extent=s}).require("height_relative",s=>{i.height=s},Jc.decodeRelativeHeight).geometry(s=>{i.position=s},Jc.getPoint).success()),QL=new Lw((r,e,i)=>r.reset(e).require(Kc,s=>{i.id=s}).optional("fixed_height",s=>{i.constantHeight=s},Jc.decodeMetricHeight).geometry(s=>{i.bounds=s},Cd).success(),(r,e,i)=>r.reset(e).require(Kc,s=>{i.id=s}).require("elevation_idx",s=>{i.idx=s}).require("extent",s=>{i.extent=s}).require("height",s=>{i.height=s},Jc.decodeMetricHeight).geometry(s=>{i.position=s},Jc.getPoint).success());class Jc{static getPoint(e){return ga(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static parse(e){const i=[],s=[],a=e.length,u=new KL;for(let m=0;m<a;m++){const g=e.feature(m),v=g.properties.hasOwnProperty("version")?String(g.properties.version):void 0,w=(h=v)?h==="1.0.1"?QL:void 0:JL;if(w===void 0){yi(`Unknown elevation feature version number ${v||"(unknown)"}`);continue}const S=g.properties.hasOwnProperty("type")?g.properties.type:void 0;if(S){if($l.VectorTileFeature.types[g.type]==="Point"&&S==="curve_point"){const A={};w.parseVertex(u,g,A)&&i.push(A)}else if($l.VectorTileFeature.types[g.type]==="Polygon"&&S==="curve_meta"){const A={};w.parseFeature(u,g,A)&&s.push(A)}}}var h;return{vertices:i,features:s}}}class kw{constructor(e,i){this.feature=e,this.metersToTile=i,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,s=i[1],a=-i[0],u=(e.extent+1)*this.metersToTile;return[new ft(Math.trunc(e.position[0]+s*u),Math.trunc(e.position[1]+a*u)),new ft(Math.trunc(e.position[0]-s*u),Math.trunc(e.position[1]-a*u))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class f0{constructor(e,i,s,a,u,h){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:s,max:s},this.safeArea=i,this.constantHeight=s,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=u,this.edges=this.edges.filter(m=>{return m.a<this.vertices.length&&m.b<this.vertices.length&&!((g=this.vertices[m.a].position)[0]===(v=this.vertices[m.b].position)[0]&&g[1]===v[1]);var g,v}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const m of this.vertices)this.vertexProps.push({dir:ga(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,m.height),this.heightRange.max=Math.max(this.heightRange.max,m.height);for(const m of this.edges){const g=this.vertices[m.a].position,v=this.vertices[m.b].position,w=qo(Hn(),v,g),S=va(w),A=ya(Hn(),w,1/S);this.edgeProps.push({vec:w,dir:A,len:S});const D=this.vertexProps[m.a].dir,R=this.vertexProps[m.b].dir;Bs(D,D,A),Bs(R,R,A)}for(const m of this.vertexProps)m.dir[0]===0&&m.dir[1]===0||sc(m.dir,m.dir);this.tessellate(h)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[s,a]=i;return((u,h,m)=>(1-m)*u+m*h)(this.vertices[this.edges[s].a].height,this.vertices[this.edges[s].b].height,a)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,s=Number.POSITIVE_INFINITY,a=0;const u=ga(e.x,e.y);for(let h=0;h<this.edges.length;h++){const m=this.edges[h],g=this.edgeProps[h].dir,v=new es(u,this.edgeProps[h].dir),w=this.vertices[m.a].position,S=this.vertices[m.b].position,A=Hn(),D=Hn(),R=v.intersectsPlane(w,this.vertexProps[m.a].dir,A),O=v.intersectsPlane(S,this.vertexProps[m.b].dir,D);if(!R||!O)continue;const $=qo(Hn(),D,A),H=qo(Hn(),u,A),K=Ar($,$),W=K>0?Ar(H,$)/K:0,F=Te(W,0,1),q=Math.abs((W-F)*this.edgeProps[h].len),Y=qo(Hn(),u,w),ee=q+Math.abs(Ar(Y,ga(g[1],-g[0])));ee<s&&(i=h,s=ee,a=F)}return[i,a]}tessellate(e){for(let i=this.edges.length-1;i>=0;--i){const s=this.edges[i].a,a=this.edges[i].b,{position:u,height:h,extent:m}=this.vertices[s],{position:g,height:v,extent:w}=this.vertices[a],S=this.vertexProps[s].dir,A=this.vertexProps[a].dir,D=Bt(u[0]/e,u[1]/e,h),R=Bt(g[0]/e,g[1]/e,v),O=Bt(S[1],-S[0],0);Ii(O,O,m);const $=Bt(A[1],-A[0],0);if(Ii($,$,w),this.distSqLines(Bt(D[0]+.5*O[0],D[1]+.5*O[1],D[2]+.5*O[2]),Bt(R[0]-.5*$[0],R[1]-.5*$[1],R[2]-.5*$[2]),Bt(D[0]-.5*O[0],D[1]-.5*O[1],D[2]-.5*O[2]),Bt(R[0]+.5*$[0],R[1]+.5*$[1],R[2]+.5*$[2]))<=.0025000000000000005)continue;const H=this.vertices.length,K=Bs(Hn(),u,g);this.vertices.push({position:ya(K,K,.5),height:.5*(h+v),extent:.5*(m+w)});const W=Bs(Hn(),S,A);this.vertexProps.push({dir:sc(W,W)}),this.edges.splice(i,1),this.edgeProps.splice(i,1),this.edges.push({a:s,b:H}),this.edges.push({a:H,b:a});const F=qo(Hn(),this.vertices[H].position,u),q=va(F),Y={vec:F,dir:ya(Hn(),F,1/q),len:q};this.edgeProps.push(Y),this.edgeProps.push(Y)}}distSqLines(e,i,s,a){const u=ri(mi(),i,e),h=ri(mi(),a,s),m=ri(mi(),e,s),g=Zi(u,u),v=Zi(u,h),w=Zi(u,m),S=Zi(h,h),A=Zi(h,m),D=g*S-v*v;if(D===0){const $=Zi(m,h)/Zi(h,h);return gn(Uo(mi(),s,a,$),e)}const R=(v*A-w*S)/D,O=(g*A-v*w)/D;return gn(Uo(mi(),e,i,R),Uo(mi(),s,a,O))}}class m0{static parseFrom(e,i){const s=Jc.parse(e);if(!s)return[];let{vertices:a,features:u}=s;const h=1/De(i);u.sort((w,S)=>w.id-S.id),a.sort((w,S)=>w.id-S.id||w.idx-S.idx),a=a.filter((w,S,A)=>S===A.findIndex(D=>D.id===w.id&&D.idx===w.idx));const m=new Array;let g=0;const v=a.length;for(const w of u){if(w.constantHeight){m.push(new f0(w.id,w.bounds,w.constantHeight));continue}for(;g!==v&&a[g].id<w.id;)g++;if(g===v||a[g].id!==w.id)continue;const S=new Array,A=new Array,D=g;for(;g!==v&&a[g].id===w.id;){const R=a[g];if(S.push({position:R.position,height:R.height,extent:R.extent}),g!==D&&a[g-1].idx===R.idx-1){const O=g-D;A.push({a:O-1,b:O})}g++}m.push(new f0(w.id,w.bounds,void 0,S,A,h))}return m}static getElevationFeature(e,i){if(!i)return;const s=+e.properties[Kc];return Number.isNaN(s)?void 0:i.find(a=>a.id===s)}}class Ow{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*_t,this.yOffset=(e.y*this.zScale-i.y)*_t)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,s){const a=this.constantElevation(i,s);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),s))}computeBiasedHeight(e,i){return i<=0?e:e+i*Ae(0,i,e>=0?e:Math.abs(.5*e))}}Tt(f0,"ElevationFeature");class Fw{constructor(){this.polygons=new Map}add(e,...i){this.polygons.has(e)?this.polygons.get(e).push(...i):this.polygons.set(e,i)}merge(e){for(const[i,s]of e.polygons)this.add(i,...s)}}class Qc{constructor(){this.portals=[]}static evaluate(e){if(e.length===0)return new Qc;let i=[];for(const v of e)i.push(...v.portals);if(i.length===0)return new Qc;const s=(v,w)=>v<=0&&w<=0||v>=_t&&w>=_t;for(const v of i){const w=v.va,S=v.vb;(s(w.x,S.x)||s(w.y,S.y))&&(v.type="border")}const a=i.filter(v=>v.type!=="unevaluated"),u=i.filter(v=>v.type==="unevaluated");if(u.length===0)return new Qc;u.sort((v,w)=>v.hash===w.hash?v.isTunnel===w.isTunnel?0:v.isTunnel?-1:1:v.hash<w.hash?1:-1),i=a.concat(u);let h=a.length,m=h,g=h;do if(m++,m===i.length||i[h].hash!==i[m].hash){if(m-h==2){g<h&&(i[g]=i[h],i[h]=null);const v=i[g],w=i[m-1];v.type=v.isTunnel!==w.isTunnel?"tunnel":"polygon",v.connection={a:v.connection.a,b:w.connection.a},g++}h=m}while(h!==i.length);return i.splice(g),i.sort((v,w)=>v.hash<w.hash?1:-1),{portals:i}}}Tt(Qc,"ElevationPortalGraph"),Tt(Fw,"ElevationPolygons");class ek{constructor(e,i,s){this.outPositions=e,this.outNormals=i,this.outIndices=s,this.vertexLookup=new Map,this.buffer=new ArrayBuffer(4),this.view=new DataView(this.buffer)}addVertex(e,i,s){let a=e[2];s!=null&&(a*=s);const u=this.getVec3Bits(e)<<96n|this.getVec3Bits(i),h=this.vertexLookup.get(u);if(h!=null)return h;const m=this.outPositions.length;this.vertexLookup.set(u,m);const g=Math.trunc(16384*i[0]),v=Math.trunc(16384*i[1]),w=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(g,v,w),m}addVertices(e,i,...s){const a=[];for(const u of s){const h=this.addVertex(u,e,i);a.push(h)}return a}addTriangles(e,i,s){if(i&&s){const a=s.length===1,u=Bt(0,0,0);for(let h=0;h<e.length;h+=3){const m=i[e[h+0]],g=i[e[h+1]],v=i[e[h+2]],w=a?s[0]:s[e[h+1]],S=a?s[0]:s[e[h+2]],A=this.addVertex(Bt(m.x,m.y,a?s[0]:s[e[h+0]]),u),D=this.addVertex(Bt(g.x,g.y,w),u),R=this.addVertex(Bt(v.x,v.y,S),u);this.outIndices.emplaceBack(A,D,R)}}else for(let a=0;a<e.length;a+=3)this.outIndices.emplaceBack(e[a+0],e[a+1],e[a+2])}addQuad(e,i){const s=this.addVertices(i,void 0,...e.map(g=>Bt(g.coord.x,g.coord.y,g.height))),[a,u,h,m]=s;this.addTriangles([a,u,h,h,m,a])}getBits(e){return this.view.setFloat32(0,e),BigInt(this.view.getUint32(0))}getVec3Bits(e){return this.getBits(e[0])<<64n|this.getBits(e[1])<<32n|this.getBits(e[2])}}class wo{constructor(e){this.unevaluatedPortals=new Qc,this.portalPolygons=new Fw,this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new Th,this.vertexNormals=new zl,this.indexArray=new fn,this.tileToMeters=De(e)}addVertices(e,i){const s=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return s}addTriangles(e,i,s){const a=s?this.unevalTunnelTriangles:this.unevalTriangles;for(const u of e)a.push(u+i)}addRenderableRing(e,i,s,a,u){const h=[new ft(u.min.x,u.min.y),new ft(u.max.x,u.min.y),new ft(u.max.x,u.max.y),new ft(u.min.x,u.max.y)];for(let m=0;m<s-1;m++){const g=i+m,v=g+1,w=this.unevalVertices[g],S=this.unevalVertices[v];if(!(w.x>=u.min.x&&w.x<=u.max.x&&w.y>=u.min.y&&w.y<=u.max.y||S.x>=u.min.x&&S.x<=u.max.x&&S.y>=u.min.y&&S.y<=u.max.y||jr(w,S,h))||this.isOnBorder(w.x,S.x)||this.isOnBorder(w.y,S.y))continue;const A=wo.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[v]);let D,R=this.vertexHashLookup.get(wo.computePosHash(w));R!=null?D=R.next:(R=this.vertexHashLookup.get(wo.computePosHash(S)),D=R!=null?R.prev:A),this.unevalEdges.push({polygonIdx:e,a:g,b:v,hash:A,portalHash:D,isTunnel:a,type:"unevaluated"})}}addPortalCandidates(e,i,s,a,u){if(i.length===0)return;this.portalPolygons.add(e,{geometry:i,zLevel:u});const h=i[0];this.vertexHashLookup.clear();let m=wo.computeEdgeHash(h[h.length-2],h[h.length-1]);for(let g=0;g<h.length-1;g++){const v=h[g+0],w=h[g+1],S=ga(w.x-v.x,w.y-v.y),A=va(S);if(A===0)continue;let D="unevaluated";const R=a.pointElevation(v),O=a.pointElevation(w);Math.abs(R)<.01&&Math.abs(O)<.01?D="entrance":(this.isOnBorder(v.x,w.x)||this.isOnBorder(v.y,w.y))&&(D="border");const $=wo.computeEdgeHash(v,w);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:v,vb:w,vab:S,length:A,hash:$,isTunnel:s,type:D});const H=wo.computePosHash(v);this.vertexHashLookup.set(H,{prev:m,next:$}),m=$}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),s=S=>{S.primitiveLength=this.indexArray.length-S.primitiveOffset},a=new ek(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const u=i(),h=i(),m=i(),g=(S,A)=>{S.sort((R,O)=>R.type===A&&O.type!==A?-1:R.type!==A&&O.type===A?1:0);const D=S.findIndex(R=>R.type!==A);return D>=0?D:S.length};let v=0;this.unevalEdges.length>0&&(v=g(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:v},this.tileToMeters));const w=i();if(this.unevalEdges.length>0){const S=this.unevalEdges.splice(v),A=g(S,"tunnel")+v;this.unevalEdges.push(...S),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:v},{min:v,max:A})}s(m),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),s(w),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),s(h),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),s(u),this.maskSegments=Cr.simpleSegment(0,w.primitiveOffset,0,w.primitiveLength),this.depthSegments=Cr.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.renderableSegments=Cr.simpleSegment(0,m.primitiveOffset,0,m.primitiveLength),this.shadowCasterSegments=Cr.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,NL.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,jL.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableSegments.destroy(),this.shadowCasterSegments.destroy())}computeVertexConnections(e,i,s,a,u){const h=new Map;for(let m=a;m<u;m++){const g=s[m],v=g.a,w=g.b,S=wo.computePosHash(e[v]),A=wo.computePosHash(e[w]);h.has(S)||h.set(S,{}),h.has(A)||h.set(A,{});const D=h.get(S),R=h.get(A);i[v]<=0&&i[w]<=0||(D.to=w,R.from=v)}return h}constructBridgeStructures(e,i,s,a,u,h){const m=this.computeVertexConnections(i,s,a,u.min,u.max),g=1/h,v=.5*g,w=A=>Bt(i[A].x,i[A].y,s[A]*g),S=A=>{const D=m.get(wo.computePosHash(i[A])),R=D.from,O=D.to;if(!R||!O)return;const $=w(R),H=w(A),K=w(O),W=Bt(0,0,0);if(!Qi($,H)){const q=Ei(mi(),H,$);vi(W,W,Ui(q,q))}if(!Qi(K,H)){const q=Ei(mi(),K,H);vi(W,W,Ui(q,q))}const F=wr(W);return F>0?Ii(W,W,1/F):void 0};for(let A=u.min;A<u.max;A++){const D=a[A],R=this.prepareEdgePoints(i,s,D,(at,Xt)=>at>Xt);if(R==null)continue;const O=R[0],$=R[1],H=Bt(O.coord.x,O.coord.y,g*O.height),K=Bt($.coord.x,$.coord.y,g*$.height);if(Qi(H,K))continue;const W=Ei(mi(),K,H);Ui(W,W);const F=at=>Ui(at,at),q=S(D.a)||W,Y=S(D.b)||W,ee=F(Bt(q[1],-q[0],0)),he=F(Bt(Y[1],-Y[0],0)),ye=F(Lr(mi(),ee,q)),ve=F(Lr(mi(),he,Y)),Ce=mi(),Ue=[vi(mi(),H,Ii(Ce,Ei(Ce,ee,ye),v)),vi(mi(),H,Ii(Ce,vi(Ce,ee,ye),v)),vi(mi(),H,Ii(Ce,ye,v)),H],et=[vi(mi(),K,Ii(Ce,Ei(Ce,he,ve),v)),vi(mi(),K,Ii(Ce,vi(Ce,he,ve),v)),vi(mi(),K,Ii(Ce,ve,v)),K],[Ye,Qe]=e.addVertices(ee,h,Ue[0],Ue[1]),[ot,je]=e.addVertices(he,h,et[0],et[1]);e.addTriangles([Ye,Qe,ot,Qe,je,ot]);const[Je,Fe]=e.addVertices(ye,h,Ue[1],Ue[2]),[Ve,lt]=e.addVertices(ve,h,et[1],et[2]);e.addTriangles([Je,Fe,Ve,Fe,lt,Ve]);const[ut,zt]=e.addVertices(ho(ee,ee),h,Ue[2],Ue[3]),[Et,gt]=e.addVertices(ho(he,he),h,et[2],et[3]);e.addTriangles([ut,zt,Et,zt,gt,Et])}}constructTunnelStructures(e,i,s,a,u,h){const m=g=>Ui(g,g);for(let g=u.min;g<u.max;g++){const v=this.prepareEdgePoints(i,s,a[g],(D,R)=>D<R);if(v==null)continue;const[w,S]=v,A=m(Bt(S.coord.y-w.coord.y,-(S.coord.x-w.coord.x),0));e.addQuad([w,S,{coord:S.coord,height:a[g].isTunnel?-.1:0},{coord:w.coord,height:a[g].isTunnel?-.1:0}],A)}for(let g=h.min;g<h.max;g++){const v=a[g],w=i[v.a],S=i[v.b],A=m(Bt(S.y-w.y,-(S.x-w.x),0));e.addQuad([{coord:S,height:0},{coord:w,height:0},{coord:w,height:s[v.a]+4},{coord:S,height:s[v.b]+4}],A),e.addQuad([{coord:w,height:0},{coord:S,height:0},{coord:S,height:s[v.b]+4},{coord:w,height:s[v.a]+4}],A)}}prepareEdgePoints(e,i,s,a){let u=i[s.a],h=i[s.b];const m=a(u,0),g=a(h,0);if(m&&g)return[{coord:e[s.a],height:u},{coord:e[s.b],height:h}];if(!m&&!g)return;const v=e[s.a].clone(),w=e[s.b].clone();if(m){if(!g){const S=h/(h-u);w.x=Nt(w.x,v.x,S),w.y=Nt(w.y,v.y,S),h=Nt(h,u,S)}}else{const S=u/(u-h);v.x=Nt(v.x,w.x,S),v.y=Nt(v.y,w.y,S),u=Nt(u,h,S)}return[{coord:v,height:u},{coord:w,height:h}]}prepareEdges(e,i){if(i.length===0)return;i.sort((m,g)=>m.hash===g.hash?g.polygonIdx-m.polygonIdx:g.hash>m.hash?1:-1);let s=0,a=0,u=0,h=i[s].polygonIdx;do a++,(a===i.length||i[s].hash!==i[a].hash)&&((a-s==1||i[a-1].polygonIdx!==h)&&(u<s&&(i[u]=i[s],i[s]=null),i[u].type="none",u++),s=a,s!==i.length&&(h=i[s].polygonIdx));while(s!==i.length);if(i.splice(u),i.length!==0&&e.length!==0){i.sort((v,w)=>v.portalHash<w.portalHash?1:-1);let m=0,g=0;for(;m!==i.length&&g!==e.length;){const v=i[m],w=e[g];v.portalHash>w.hash?m++:w.hash>v.portalHash?g++:(v.type=w.type,m++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=_t&&i>=_t}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(wo.computePosHash(e))<<32n|BigInt(wo.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}var Bw,Nw={exports:{}},jw=(Bw||(Bw=1,function(r,e){(function(i){function s(J,te){return J>te?1:J<te?-1:0}var a=function(J,te){J===void 0&&(J=s),te===void 0&&(te=!1),this._compare=J,this._root=null,this._size=0,this._noDuplicates=!!te},u={size:{configurable:!0}};function h(J,te,Ge,pt,vt){var yt=vt-pt;if(yt>0){var Dt=pt+Math.floor(yt/2),Gt={key:te[Dt],data:Ge[Dt],parent:J};return Gt.left=h(Gt,te,Ge,pt,Dt),Gt.right=h(Gt,te,Ge,Dt+1,vt),Gt}return null}function m(J,te,Ge,pt,vt){if(!(Ge>=pt)){for(var yt=J[Ge+pt>>1],Dt=Ge-1,Gt=pt+1;;){do Dt++;while(vt(J[Dt],yt)<0);do Gt--;while(vt(J[Gt],yt)>0);if(Dt>=Gt)break;var wi=J[Dt];J[Dt]=J[Gt],J[Gt]=wi,wi=te[Dt],te[Dt]=te[Gt],te[Gt]=wi}m(J,te,Ge,Gt,vt),m(J,te,Gt+1,pt,vt)}}a.prototype.rotateLeft=function(J){var te=J.right;te&&(J.right=te.left,te.left&&(te.left.parent=J),te.parent=J.parent),J.parent?J===J.parent.left?J.parent.left=te:J.parent.right=te:this._root=te,te&&(te.left=J),J.parent=te},a.prototype.rotateRight=function(J){var te=J.left;te&&(J.left=te.right,te.right&&(te.right.parent=J),te.parent=J.parent),J.parent?J===J.parent.left?J.parent.left=te:J.parent.right=te:this._root=te,te&&(te.right=J),J.parent=te},a.prototype._splay=function(J){for(;J.parent;){var te=J.parent;te.parent?te.left===J&&te.parent.left===te?(this.rotateRight(te.parent),this.rotateRight(te)):te.right===J&&te.parent.right===te?(this.rotateLeft(te.parent),this.rotateLeft(te)):te.left===J&&te.parent.right===te?(this.rotateRight(te),this.rotateLeft(te)):(this.rotateLeft(te),this.rotateRight(te)):te.left===J?this.rotateRight(te):this.rotateLeft(te)}},a.prototype.splay=function(J){for(var te,Ge,pt,vt,yt;J.parent;)(Ge=(te=J.parent).parent)&&Ge.parent?((pt=Ge.parent).left===Ge?pt.left=J:pt.right=J,J.parent=pt):(J.parent=null,this._root=J),vt=J.left,yt=J.right,J===te.left?(Ge&&(Ge.left===te?(te.right?(Ge.left=te.right,Ge.left.parent=Ge):Ge.left=null,te.right=Ge,Ge.parent=te):(vt?(Ge.right=vt,vt.parent=Ge):Ge.right=null,J.left=Ge,Ge.parent=J)),yt?(te.left=yt,yt.parent=te):te.left=null,J.right=te,te.parent=J):(Ge&&(Ge.right===te?(te.left?(Ge.right=te.left,Ge.right.parent=Ge):Ge.right=null,te.left=Ge,Ge.parent=te):(yt?(Ge.left=yt,yt.parent=Ge):Ge.left=null,J.right=Ge,Ge.parent=J)),vt?(te.right=vt,vt.parent=te):te.right=null,J.left=te,te.parent=J)},a.prototype.replace=function(J,te){J.parent?J===J.parent.left?J.parent.left=te:J.parent.right=te:this._root=te,te&&(te.parent=J.parent)},a.prototype.minNode=function(J){if(J===void 0&&(J=this._root),J)for(;J.left;)J=J.left;return J},a.prototype.maxNode=function(J){if(J===void 0&&(J=this._root),J)for(;J.right;)J=J.right;return J},a.prototype.insert=function(J,te){var Ge=this._root,pt=null,vt=this._compare;if(this._noDuplicates)for(;Ge;){if(pt=Ge,vt(Ge.key,J)===0)return;Ge=vt(Ge.key,J)<0?Ge.right:Ge.left}else for(;Ge;)pt=Ge,Ge=vt(Ge.key,J)<0?Ge.right:Ge.left;return Ge={key:J,data:te,left:null,right:null,parent:pt},pt?vt(pt.key,Ge.key)<0?pt.right=Ge:pt.left=Ge:this._root=Ge,this.splay(Ge),this._size++,Ge},a.prototype.find=function(J){for(var te=this._root,Ge=this._compare;te;){var pt=Ge(te.key,J);if(pt<0)te=te.right;else{if(!(pt>0))return te;te=te.left}}return null},a.prototype.contains=function(J){for(var te=this._root,Ge=this._compare;te;){var pt=Ge(J,te.key);if(pt===0)return!0;te=pt<0?te.left:te.right}return!1},a.prototype.remove=function(J){var te=this.find(J);if(!te)return!1;if(this.splay(te),te.left)if(te.right){var Ge=this.minNode(te.right);Ge.parent!==te&&(this.replace(Ge,Ge.right),Ge.right=te.right,Ge.right.parent=Ge),this.replace(te,Ge),Ge.left=te.left,Ge.left.parent=Ge}else this.replace(te,te.left);else this.replace(te,te.right);return this._size--,!0},a.prototype.removeNode=function(J){if(!J)return!1;if(this.splay(J),J.left)if(J.right){var te=this.minNode(J.right);te.parent!==J&&(this.replace(te,te.right),te.right=J.right,te.right.parent=te),this.replace(J,te),te.left=J.left,te.left.parent=te}else this.replace(J,J.left);else this.replace(J,J.right);return this._size--,!0},a.prototype.erase=function(J){var te=this.find(J);if(te){this.splay(te);var Ge=te.left,pt=te.right,vt=null;Ge&&(Ge.parent=null,vt=this.maxNode(Ge),this.splay(vt),this._root=vt),pt&&(Ge?vt.right=pt:this._root=pt,pt.parent=vt),this._size--}},a.prototype.pop=function(){var J=this._root,te=null;if(J){for(;J.left;)J=J.left;te={key:J.key,data:J.data},this.remove(J.key)}return te},a.prototype.next=function(J){var te=J;if(te)if(te.right)for(te=te.right;te&&te.left;)te=te.left;else for(te=J.parent;te&&te.right===J;)J=te,te=te.parent;return te},a.prototype.prev=function(J){var te=J;if(te)if(te.left)for(te=te.left;te&&te.right;)te=te.right;else for(te=J.parent;te&&te.left===J;)J=te,te=te.parent;return te},a.prototype.forEach=function(J){for(var te=this._root,Ge=[],pt=!1,vt=0;!pt;)te?(Ge.push(te),te=te.left):Ge.length>0?(J(te=Ge.pop(),vt++),te=te.right):pt=!0;return this},a.prototype.range=function(J,te,Ge,pt){for(var vt=[],yt=this._compare,Dt=this._root;vt.length!==0||Dt;)if(Dt)vt.push(Dt),Dt=Dt.left;else{if(yt((Dt=vt.pop()).key,te)>0)break;if(yt(Dt.key,J)>=0&&Ge.call(pt,Dt))return this;Dt=Dt.right}return this},a.prototype.keys=function(){for(var J=this._root,te=[],Ge=[],pt=!1;!pt;)J?(te.push(J),J=J.left):te.length>0?(J=te.pop(),Ge.push(J.key),J=J.right):pt=!0;return Ge},a.prototype.values=function(){for(var J=this._root,te=[],Ge=[],pt=!1;!pt;)J?(te.push(J),J=J.left):te.length>0?(J=te.pop(),Ge.push(J.data),J=J.right):pt=!0;return Ge},a.prototype.at=function(J){for(var te=this._root,Ge=[],pt=!1,vt=0;!pt;)if(te)Ge.push(te),te=te.left;else if(Ge.length>0){if(te=Ge.pop(),vt===J)return te;vt++,te=te.right}else pt=!0;return null},a.prototype.load=function(J,te,Ge){if(J===void 0&&(J=[]),te===void 0&&(te=[]),Ge===void 0&&(Ge=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var pt=J.length;return Ge&&m(J,te,0,pt-1,this._compare),this._root=h(null,J,te,0,pt),this._size=pt,this},a.prototype.min=function(){var J=this.minNode(this._root);return J?J.key:null},a.prototype.max=function(){var J=this.maxNode(this._root);return J?J.key:null},a.prototype.isEmpty=function(){return this._root===null},u.size.get=function(){return this._size},a.createTree=function(J,te,Ge,pt,vt){return new a(Ge,vt).load(J,te,pt)},Object.defineProperties(a.prototype,u);var g=0,v=1,w=2,S=3,A=0,D=1,R=2,O=3;function $(J,te,Ge){te===null?(J.inOut=!1,J.otherInOut=!0):(J.isSubject===te.isSubject?(J.inOut=!te.inOut,J.otherInOut=te.otherInOut):(J.inOut=!te.otherInOut,J.otherInOut=te.isVertical()?!te.inOut:te.inOut),te&&(J.prevInResult=!H(te,Ge)||te.isVertical()?te.prevInResult:te));var pt=H(J,Ge);J.resultTransition=pt?function(vt,yt){var Dt,Gt=!vt.inOut,wi=!vt.otherInOut;switch(yt){case A:Dt=Gt&&wi;break;case D:Dt=Gt||wi;break;case O:Dt=Gt^wi;break;case R:Dt=vt.isSubject?Gt&&!wi:wi&&!Gt}return Dt?1:-1}(J,Ge):0}function H(J,te){switch(J.type){case g:switch(te){case A:return!J.otherInOut;case D:return J.otherInOut;case R:return J.isSubject&&J.otherInOut||!J.isSubject&&!J.otherInOut;case O:return!0}break;case w:return te===A||te===D;case S:return te===R;case v:return!1}return!1}var K=function(J,te,Ge,pt,vt){this.left=te,this.point=J,this.otherEvent=Ge,this.isSubject=pt,this.type=vt||g,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},W={inResult:{configurable:!0}};function F(J,te){return J[0]===te[0]&&J[1]===te[1]}K.prototype.isBelow=function(J){var te=this.point,Ge=this.otherEvent.point;return this.left?(te[0]-J[0])*(Ge[1]-J[1])-(Ge[0]-J[0])*(te[1]-J[1])>0:(Ge[0]-J[0])*(te[1]-J[1])-(te[0]-J[0])*(Ge[1]-J[1])>0},K.prototype.isAbove=function(J){return!this.isBelow(J)},K.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},W.inResult.get=function(){return this.resultTransition!==0},K.prototype.clone=function(){var J=new K(this.point,this.left,this.otherEvent,this.isSubject,this.type);return J.contourId=this.contourId,J.resultTransition=this.resultTransition,J.prevInResult=this.prevInResult,J.isExteriorRing=this.isExteriorRing,J.inOut=this.inOut,J.otherInOut=this.otherInOut,J},Object.defineProperties(K.prototype,W);var q=11102230246251565e-32,Y=134217729,ee=(3+8*q)*q;function he(J,te,Ge,pt,vt){var yt,Dt,Gt,wi,Ti=te[0],li=pt[0],Hi=0,sr=0;li>Ti==li>-Ti?(yt=Ti,Ti=te[++Hi]):(yt=li,li=pt[++sr]);var Si=0;if(Hi<J&&sr<Ge)for(li>Ti==li>-Ti?(Gt=yt-((Dt=Ti+yt)-Ti),Ti=te[++Hi]):(Gt=yt-((Dt=li+yt)-li),li=pt[++sr]),yt=Dt,Gt!==0&&(vt[Si++]=Gt);Hi<J&&sr<Ge;)li>Ti==li>-Ti?(Gt=yt-((Dt=yt+Ti)-(wi=Dt-yt))+(Ti-wi),Ti=te[++Hi]):(Gt=yt-((Dt=yt+li)-(wi=Dt-yt))+(li-wi),li=pt[++sr]),yt=Dt,Gt!==0&&(vt[Si++]=Gt);for(;Hi<J;)Gt=yt-((Dt=yt+Ti)-(wi=Dt-yt))+(Ti-wi),Ti=te[++Hi],yt=Dt,Gt!==0&&(vt[Si++]=Gt);for(;sr<Ge;)Gt=yt-((Dt=yt+li)-(wi=Dt-yt))+(li-wi),li=pt[++sr],yt=Dt,Gt!==0&&(vt[Si++]=Gt);return yt===0&&Si!==0||(vt[Si++]=yt),Si}function ye(J){return new Float64Array(J)}var ve=33306690738754716e-32,Ce=22204460492503146e-32,Ue=11093356479670487e-47,et=ye(4),Ye=ye(8),Qe=ye(12),ot=ye(16),je=ye(4);function Je(J,te,Ge){var pt=function(vt,yt,Dt,Gt,wi,Ti){var li=(yt-Ti)*(Dt-wi),Hi=(vt-wi)*(Gt-Ti),sr=li-Hi;if(li===0||Hi===0||li>0!=Hi>0)return sr;var Si=Math.abs(li+Hi);return Math.abs(sr)>=ve*Si?sr:-function(Mr,hr,Vi,Vr,fr,ar,dr){var qi,pi,Ki,Pr,Ut,Pi,mr,Or,br,rn,ir,Jr,ro,Cn,Tn,no,sa,nn,dn=Mr-fr,Mn=Vi-fr,Gn=hr-ar,Ln=Vr-ar;et[0]=(Tn=(Or=dn-(mr=(Pi=Y*dn)-(Pi-dn)))*(rn=Ln-(br=(Pi=Y*Ln)-(Pi-Ln)))-((Cn=dn*Ln)-mr*br-Or*br-mr*rn))-((ir=Tn-(sa=(Or=Gn-(mr=(Pi=Y*Gn)-(Pi-Gn)))*(rn=Mn-(br=(Pi=Y*Mn)-(Pi-Mn)))-((no=Gn*Mn)-mr*br-Or*br-mr*rn)))+(Ut=Tn-ir))+(Ut-sa),et[1]=(ro=Cn-((Jr=Cn+ir)-(Ut=Jr-Cn))+(ir-Ut))-((ir=ro-no)+(Ut=ro-ir))+(Ut-no),et[2]=Jr-((nn=Jr+ir)-(Ut=nn-Jr))+(ir-Ut),et[3]=nn;var Yl=function(e5,HS){for(var qS=HS[0],vv=1;vv<4;vv++)qS+=HS[vv];return qS}(0,et),af=Ce*dr;if(Yl>=af||-Yl>=af||(qi=Mr-(dn+(Ut=Mr-dn))+(Ut-fr),Ki=Vi-(Mn+(Ut=Vi-Mn))+(Ut-fr),pi=hr-(Gn+(Ut=hr-Gn))+(Ut-ar),Pr=Vr-(Ln+(Ut=Vr-Ln))+(Ut-ar),qi===0&&pi===0&&Ki===0&&Pr===0)||(af=Ue*dr+ee*Math.abs(Yl),(Yl+=dn*Pr+Ln*qi-(Gn*Ki+Mn*pi))>=af||-Yl>=af))return Yl;je[0]=(Tn=(Or=qi-(mr=(Pi=Y*qi)-(Pi-qi)))*(rn=Ln-(br=(Pi=Y*Ln)-(Pi-Ln)))-((Cn=qi*Ln)-mr*br-Or*br-mr*rn))-((ir=Tn-(sa=(Or=pi-(mr=(Pi=Y*pi)-(Pi-pi)))*(rn=Mn-(br=(Pi=Y*Mn)-(Pi-Mn)))-((no=pi*Mn)-mr*br-Or*br-mr*rn)))+(Ut=Tn-ir))+(Ut-sa),je[1]=(ro=Cn-((Jr=Cn+ir)-(Ut=Jr-Cn))+(ir-Ut))-((ir=ro-no)+(Ut=ro-ir))+(Ut-no),je[2]=Jr-((nn=Jr+ir)-(Ut=nn-Jr))+(ir-Ut),je[3]=nn;var FO=he(4,et,4,je,Ye);je[0]=(Tn=(Or=dn-(mr=(Pi=Y*dn)-(Pi-dn)))*(rn=Pr-(br=(Pi=Y*Pr)-(Pi-Pr)))-((Cn=dn*Pr)-mr*br-Or*br-mr*rn))-((ir=Tn-(sa=(Or=Gn-(mr=(Pi=Y*Gn)-(Pi-Gn)))*(rn=Ki-(br=(Pi=Y*Ki)-(Pi-Ki)))-((no=Gn*Ki)-mr*br-Or*br-mr*rn)))+(Ut=Tn-ir))+(Ut-sa),je[1]=(ro=Cn-((Jr=Cn+ir)-(Ut=Jr-Cn))+(ir-Ut))-((ir=ro-no)+(Ut=ro-ir))+(Ut-no),je[2]=Jr-((nn=Jr+ir)-(Ut=nn-Jr))+(ir-Ut),je[3]=nn;var BO=he(FO,Ye,4,je,Qe);je[0]=(Tn=(Or=qi-(mr=(Pi=Y*qi)-(Pi-qi)))*(rn=Pr-(br=(Pi=Y*Pr)-(Pi-Pr)))-((Cn=qi*Pr)-mr*br-Or*br-mr*rn))-((ir=Tn-(sa=(Or=pi-(mr=(Pi=Y*pi)-(Pi-pi)))*(rn=Ki-(br=(Pi=Y*Ki)-(Pi-Ki)))-((no=pi*Ki)-mr*br-Or*br-mr*rn)))+(Ut=Tn-ir))+(Ut-sa),je[1]=(ro=Cn-((Jr=Cn+ir)-(Ut=Jr-Cn))+(ir-Ut))-((ir=ro-no)+(Ut=ro-ir))+(Ut-no),je[2]=Jr-((nn=Jr+ir)-(Ut=nn-Jr))+(ir-Ut),je[3]=nn;var NO=he(BO,Qe,4,je,ot);return ot[NO-1]}(vt,yt,Dt,Gt,wi,Ti,Si)}(J[0],J[1],te[0],te[1],Ge[0],Ge[1]);return pt>0?-1:pt<0?1:0}function Fe(J,te){var Ge=J.point,pt=te.point;return Ge[0]>pt[0]?1:Ge[0]<pt[0]?-1:Ge[1]!==pt[1]?Ge[1]>pt[1]?1:-1:function(vt,yt,Dt,Gt){return vt.left!==yt.left?vt.left?1:-1:Je(Dt,vt.otherEvent.point,yt.otherEvent.point)!==0?vt.isBelow(yt.otherEvent.point)?-1:1:!vt.isSubject&&yt.isSubject?1:-1}(J,te,Ge)}function Ve(J,te,Ge){var pt=new K(te,!1,J,J.isSubject),vt=new K(te,!0,J.otherEvent,J.isSubject);return F(J.point,J.otherEvent.point)&&console.warn("what is that, a collapsed segment?",J),pt.contourId=vt.contourId=J.contourId,Fe(vt,J.otherEvent)>0&&(J.otherEvent.left=!0,vt.left=!1),J.otherEvent.otherEvent=vt,J.otherEvent=pt,Ge.push(vt),Ge.push(pt),Ge}function lt(J,te){return J[0]*te[1]-J[1]*te[0]}function ut(J,te){return J[0]*te[0]+J[1]*te[1]}function zt(J,te,Ge){var pt=function(wi,Ti,li,Hi,sr){var Si=[Ti[0]-wi[0],Ti[1]-wi[1]],Mr=[Hi[0]-li[0],Hi[1]-li[1]];function hr(Pi,mr,Or){return[Pi[0]+mr*Or[0],Pi[1]+mr*Or[1]]}var Vi=[li[0]-wi[0],li[1]-wi[1]],Vr=lt(Si,Mr),fr=Vr*Vr,ar=ut(Si,Si);if(fr>0){var dr=lt(Vi,Mr)/Vr;if(dr<0||dr>1)return null;var qi=lt(Vi,Si)/Vr;return qi<0||qi>1?null:dr===0||dr===1?[hr(wi,dr,Si)]:qi===0||qi===1?[hr(li,qi,Mr)]:[hr(wi,dr,Si)]}if((fr=(Vr=lt(Vi,Si))*Vr)>0)return null;var pi=ut(Si,Vi)/ar,Ki=pi+ut(Si,Mr)/ar,Pr=Math.min(pi,Ki),Ut=Math.max(pi,Ki);return Pr<=1&&Ut>=0?Pr===1?[hr(wi,Pr>0?Pr:0,Si)]:Ut===0?[hr(wi,Ut<1?Ut:1,Si)]:[hr(wi,Pr>0?Pr:0,Si),hr(wi,Ut<1?Ut:1,Si)]:null}(J.point,J.otherEvent.point,te.point,te.otherEvent.point),vt=pt?pt.length:0;if(vt===0||vt===1&&(F(J.point,te.point)||F(J.otherEvent.point,te.otherEvent.point))||vt===2&&J.isSubject===te.isSubject)return 0;if(vt===1)return F(J.point,pt[0])||F(J.otherEvent.point,pt[0])||Ve(J,pt[0],Ge),F(te.point,pt[0])||F(te.otherEvent.point,pt[0])||Ve(te,pt[0],Ge),1;var yt=[],Dt=!1,Gt=!1;return F(J.point,te.point)?Dt=!0:Fe(J,te)===1?yt.push(te,J):yt.push(J,te),F(J.otherEvent.point,te.otherEvent.point)?Gt=!0:Fe(J.otherEvent,te.otherEvent)===1?yt.push(te.otherEvent,J.otherEvent):yt.push(J.otherEvent,te.otherEvent),Dt&&Gt||Dt?(te.type=v,J.type=te.inOut===J.inOut?w:S,Dt&&!Gt&&Ve(yt[1].otherEvent,yt[0].point,Ge),2):Gt?(Ve(yt[0],yt[1].point,Ge),3):yt[0]!==yt[3].otherEvent?(Ve(yt[0],yt[1].point,Ge),Ve(yt[1],yt[2].point,Ge),3):(Ve(yt[0],yt[1].point,Ge),Ve(yt[3].otherEvent,yt[2].point,Ge),3)}function Et(J,te){if(J===te)return 0;if(Je(J.point,J.otherEvent.point,te.point)!==0||Je(J.point,J.otherEvent.point,te.otherEvent.point)!==0)return F(J.point,te.point)?J.isBelow(te.otherEvent.point)?-1:1:J.point[0]===te.point[0]?J.point[1]<te.point[1]?-1:1:Fe(J,te)===1?te.isAbove(J.point)?-1:1:J.isBelow(te.point)?-1:1;if(J.isSubject!==te.isSubject)return J.isSubject?-1:1;var Ge=J.point,pt=te.point;return Ge[0]===pt[0]&&Ge[1]===pt[1]?(Ge=J.otherEvent.point)[0]===(pt=te.otherEvent.point)[0]&&Ge[1]===pt[1]?0:J.contourId>te.contourId?1:-1:Fe(J,te)===1?1:-1}var gt=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function at(J,te,Ge,pt){var vt,yt=J+1,Dt=te[J].point,Gt=te.length;for(yt<Gt&&(vt=te[yt].point);yt<Gt&&vt[0]===Dt[0]&&vt[1]===Dt[1];){if(!Ge[yt])return yt;++yt<Gt&&(vt=te[yt].point)}for(yt=J-1;Ge[yt]&&yt>pt;)yt--;return yt}gt.prototype.isExterior=function(){return this.holeOf==null};var Xt=Pt,Mt=Pt;function Pt(J,te){if(!(this instanceof Pt))return new Pt(J,te);if(this.data=J||[],this.length=this.data.length,this.compare=te||Ht,this.length>0)for(var Ge=(this.length>>1)-1;Ge>=0;Ge--)this._down(Ge)}function Ht(J,te){return J<te?-1:J>te?1:0}Pt.prototype={push:function(J){this.data.push(J),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var J=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),J}},peek:function(){return this.data[0]},_up:function(J){for(var te=this.data,Ge=this.compare,pt=te[J];J>0;){var vt=J-1>>1,yt=te[vt];if(Ge(pt,yt)>=0)break;te[J]=yt,J=vt}te[J]=pt},_down:function(J){for(var te=this.data,Ge=this.compare,pt=this.length>>1,vt=te[J];J<pt;){var yt=1+(J<<1),Dt=yt+1,Gt=te[yt];if(Dt<this.length&&Ge(te[Dt],Gt)<0&&(yt=Dt,Gt=te[Dt]),Ge(Gt,vt)>=0)break;te[J]=Gt,J=yt}te[J]=vt}},Xt.default=Mt;var ii=Math.max,oi=Math.min,fi=0;function ci(J,te,Ge,pt,vt,yt){var Dt,Gt,wi,Ti,li,Hi;for(Dt=0,Gt=J.length-1;Dt<Gt;Dt++)if(Ti=J[Dt+1],li=new K(wi=J[Dt],!1,void 0,te),Hi=new K(Ti,!1,li,te),li.otherEvent=Hi,wi[0]!==Ti[0]||wi[1]!==Ti[1]){li.contourId=Hi.contourId=Ge,yt||(li.isExteriorRing=!1,Hi.isExteriorRing=!1),Fe(li,Hi)>0?Hi.left=!0:li.left=!0;var sr=wi[0],Si=wi[1];vt[0]=oi(vt[0],sr),vt[1]=oi(vt[1],Si),vt[2]=ii(vt[2],sr),vt[3]=ii(vt[3],Si),pt.push(li),pt.push(Hi)}}var ai=[];function tr(J,te,Ge){typeof J[0][0][0]=="number"&&(J=[J]),typeof te[0][0][0]=="number"&&(te=[te]);var pt=function(Si,Mr,hr){var Vi=null;return Si.length*Mr.length==0&&(hr===A?Vi=ai:hr===R?Vi=Si:hr!==D&&hr!==O||(Vi=Si.length===0?Mr:Si)),Vi}(J,te,Ge);if(pt)return pt===ai?null:pt;var vt=[1/0,1/0,-1/0,-1/0],yt=[1/0,1/0,-1/0,-1/0],Dt=function(Si,Mr,hr,Vi,Vr){var fr,ar,dr,qi,pi,Ki,Pr=new Xt(null,Fe);for(dr=0,qi=Si.length;dr<qi;dr++)for(pi=0,Ki=(fr=Si[dr]).length;pi<Ki;pi++)(ar=pi===0)&&fi++,ci(fr[pi],!0,fi,Pr,hr,ar);for(dr=0,qi=Mr.length;dr<qi;dr++)for(pi=0,Ki=(fr=Mr[dr]).length;pi<Ki;pi++)ar=pi===0,Vr===R&&(ar=!1),ar&&fi++,ci(fr[pi],!1,fi,Pr,Vi,ar);return Pr}(J,te,vt,yt,Ge);if(pt=function(Si,Mr,hr,Vi,Vr){var fr=null;return(hr[0]>Vi[2]||Vi[0]>hr[2]||hr[1]>Vi[3]||Vi[1]>hr[3])&&(Vr===A?fr=ai:Vr===R?fr=Si:Vr!==D&&Vr!==O||(fr=Si.concat(Mr))),fr}(J,te,vt,yt,Ge))return pt===ai?null:pt;for(var Gt=function(Si){var Mr,hr,Vi=function(dr){var qi,pi,Ki,Pr,Ut=[];for(pi=0,Ki=dr.length;pi<Ki;pi++)((qi=dr[pi]).left&&qi.inResult||!qi.left&&qi.otherEvent.inResult)&&Ut.push(qi);for(var Pi=!1;!Pi;)for(Pi=!0,pi=0,Ki=Ut.length;pi<Ki;pi++)pi+1<Ki&&Fe(Ut[pi],Ut[pi+1])===1&&(Pr=Ut[pi],Ut[pi]=Ut[pi+1],Ut[pi+1]=Pr,Pi=!1);for(pi=0,Ki=Ut.length;pi<Ki;pi++)(qi=Ut[pi]).otherPos=pi;for(pi=0,Ki=Ut.length;pi<Ki;pi++)(qi=Ut[pi]).left||(Pr=qi.otherPos,qi.otherPos=qi.otherEvent.otherPos,qi.otherEvent.otherPos=Pr);return Ut}(Si),Vr={},fr=[],ar=function(){if(!Vr[Mr]){var dr=fr.length,qi=function(Ut,Pi,mr){var Or=new gt;if(Ut.prevInResult!=null){var br=Ut.prevInResult,rn=br.outputContourId;if(br.resultTransition>0){var ir=Pi[rn];if(ir.holeOf!=null){var Jr=ir.holeOf;Pi[Jr].holeIds.push(mr),Or.holeOf=Jr,Or.depth=Pi[rn].depth}else Pi[rn].holeIds.push(mr),Or.holeOf=rn,Or.depth=Pi[rn].depth+1}else Or.holeOf=null,Or.depth=Pi[rn].depth}else Or.holeOf=null,Or.depth=0;return Or}(Vi[Mr],fr,dr),pi=function(Ut){Vr[Ut]=!0,Ut<Vi.length&&Vi[Ut]&&(Vi[Ut].outputContourId=dr)},Ki=Mr,Pr=Mr;for(qi.points.push(Vi[Mr].point);pi(Ki),pi(Ki=Vi[Ki].otherPos),qi.points.push(Vi[Ki].point),!((Ki=at(Ki,Vi,Vr,Pr))==Pr||Ki>=Vi.length)&&Vi[Ki];);fr.push(qi)}};for(Mr=0,hr=Vi.length;Mr<hr;Mr++)ar();return fr}(function(Si,Mr,hr,Vi,Vr,fr){for(var ar,dr,qi,pi=new a(Et),Ki=[],Pr=Math.min(Vi[2],Vr[2]);Si.length!==0;){var Ut=Si.pop();if(Ki.push(Ut),fr===A&&Ut.point[0]>Pr||fr===R&&Ut.point[0]>Vi[2])break;if(Ut.left){dr=ar=pi.insert(Ut),ar=ar!==(qi=pi.minNode())?pi.prev(ar):null,dr=pi.next(dr);var Pi=ar?ar.key:null;if($(Ut,Pi,fr),dr&&zt(Ut,dr.key,Si)===2&&($(Ut,Pi,fr),$(dr.key,Ut,fr)),ar&&zt(ar.key,Ut,Si)===2){var mr=ar;$(Pi,(mr=mr!==qi?pi.prev(mr):null)?mr.key:null,fr),$(Ut,Pi,fr)}}else dr=ar=pi.find(Ut=Ut.otherEvent),ar&&dr&&(ar=ar!==qi?pi.prev(ar):null,dr=pi.next(dr),pi.remove(Ut),dr&&ar&&zt(ar.key,dr.key,Si))}return Ki}(Dt,0,0,vt,yt,Ge)),wi=[],Ti=0;Ti<Gt.length;Ti++){var li=Gt[Ti];if(li.isExterior()){for(var Hi=[li.points],sr=0;sr<li.holeIds.length;sr++)Hi.push(Gt[li.holeIds[sr]].points);wi.push(Hi)}}return wi}var ur={UNION:D,DIFFERENCE:R,INTERSECTION:A,XOR:O};i.diff=function(J,te){return tr(J,te,R)},i.intersection=function(J,te){return tr(J,te,A)},i.operations=ur,i.union=function(J,te){return tr(J,te,D)},i.xor=function(J,te){return tr(J,te,O)},Object.defineProperty(i,"__esModule",{value:!0})})(e)}(0,Nw.exports)),Nw.exports);/**
|
|
67
|
+
`)}let h=null,m=null;if(s!=="background"&&s!=="sky"&&s!=="slot"){m=Re[`filter_${s}`];const w=Al(u,m,e,i);if(w.result==="error")throw new Error(w.value.map(S=>`${S.key}: ${S.message}`).join(", "));h=(S,A,D)=>w.value.evaluate(S,A,{},D)}let g=null,v=null;if(u!==a){const w=Al(a,m,e,i);if(w.result==="error")throw new Error(w.value.map(S=>`${S.key}: ${S.message}`).join(", "));g=(S,A,D,R,O)=>w.value.evaluate(S,A,{},D,void 0,void 0,R,O),v=!Ac(w.value.expression)}return{filter:h,dynamicFilter:g||void 0,needGeometry:Fm(u),needFeature:!!v}}function km(r){if(!Array.isArray(r))return r;const e=function(i){if(Zy.has(i[0])){for(let s=1;s<i.length;s++)if(Dl(i[s]))return!0}return i}(r);return e===!0?e:e.map(i=>km(i))}function Om(r){let e=!1;const i=[];if(r[0]==="case"){for(let s=1;s<r.length-1;s+=2)e=e||Dl(r[s]),i.push(r[s+1]);i.push(r[r.length-1])}else if(r[0]==="match"){e=e||Dl(r[1]);for(let s=2;s<r.length-1;s+=2)i.push(r[s+1]);i.push(r[r.length-1])}else if(r[0]==="step"){e=e||Dl(r[1]);for(let s=1;s<r.length-1;s+=2)i.push(r[s+1])}e&&(r.length=0,r.push("any",...i));for(let s=1;s<r.length;s++)Om(r[s])}function Dl(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;for(let i=1;i<r.length;i++)if(Dl(r[i]))return!0;return!1}const Zy=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Wy(r,e){return r<e?-1:r>e?1:0}function Fm(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(Fm(r[e]))return!0;return!1}function xh(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?lp(r[1],r[2],"=="):e==="!="?bh(lp(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?lp(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(xh))):e==="all"?["all"].concat(r.slice(1).map(xh)):e==="none"?["all"].concat(r.slice(1).map(xh).map(bh)):e==="in"?cp(r[1],r.slice(2)):e==="!in"?bh(cp(r[1],r.slice(2))):e==="has"?Bm(r[1]):e!=="!has"||bh(Bm(r[1]));var i}function lp(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function cp(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",r,["literal",e.sort(Wy)]]:["filter-in-small",r,["literal",e]]}}function Bm(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function bh(r){return["!",r]}const Bc="";function Va(r,e){return e?`${r}${Bc}${e}`:r}const up="-transition",Qs=new Set(["fill","line","background","hillshade","raster"]);class $n extends Sa{constructor(e,i,s,a,u){if(super(),this.id=e.id,this.fqid=Va(this.id,s),this.type=e.type,this.scope=s,this.lut=a,this.options=u,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const h=Al(this.filter,Re[`filter_${e.type}`]);h.result!=="error"&&(this.configDependencies=new Set([...this.configDependencies,...h.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new qy(i.layout,this.scope,u),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint){this._transitionablePaint=new Rm(i.paint,this.scope,u);for(const h in e.paint)this.setPaintProperty(h,e.paint[h]);for(const h in e.layout)this.setLayoutProperty(h,e.layout[h]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Na(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&Qs.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const s=this._unevaluatedLayout;s._properties.properties[e]&&(s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(up)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const s=this._transitionablePaint,a=s._properties.properties;if(e.endsWith(up)){const S=e.slice(0,-11);return a[S]&&s.setTransition(S,i||void 0),!1}if(!a[e])return!1;const u=s._values[e],h=u.value.isDataDriven(),m=u.value;s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const g=s._values[e].value,v=g.isDataDriven(),w=e.endsWith("pattern")||e==="line-dasharray";return v||h||w||this._handleOverridablePaintPropertyUpdate(e,m,g)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,s){return null}_handleOverridablePaintPropertyUpdate(e,i,s){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return hi({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Pl&&ch(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=ap(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,s,a,u,h,m,g,v){}}const Xy={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Nc{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Tr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function ki(r,e=1){let i=0,s=0;return{members:r.map(a=>{const u=Xy[a.type].BYTES_PER_ELEMENT,h=i=hp(i,Math.max(e,u)),m=a.components||1;return s=Math.max(s,u),i+=u*m,{name:a.name,type:a.type,components:m,offset:h}}),size:hp(i,Math.max(s,e)),alignment:e}}function hp(r,e){return Math.ceil(r/e)*e}class xs extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=s,e}}xs.prototype.bytesPerElement=4,Tt(xs,"StructArrayLayout2i4");class wh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=a,e}}wh.prototype.bytesPerElement=6,Tt(wh,"StructArrayLayout3i6");class Ua extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=s,this.int16[h+2]=a,this.int16[h+3]=u,e}}Ua.prototype.bytesPerElement=8,Tt(Ua,"StructArrayLayout4i8");class Rl extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}Rl.prototype.bytesPerElement=4,Tt(Rl,"StructArrayLayout1f4");class Th extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=4*e,h=2*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.float32[h+1]=a,e}}Th.prototype.bytesPerElement=8,Tt(Th,"StructArrayLayout2i1f8");class zl extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=a,e}}zl.prototype.bytesPerElement=8,Tt(zl,"StructArrayLayout3i8");class dp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const m=5*e;return this.int16[m+0]=i,this.int16[m+1]=s,this.int16[m+2]=a,this.int16[m+3]=u,this.int16[m+4]=h,e}}dp.prototype.bytesPerElement=10,Tt(dp,"StructArrayLayout5i10");class pp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,a,u,h,m)}emplace(e,i,s,a,u,h,m,g){const v=6*e,w=12*e,S=3*e;return this.int16[v+0]=i,this.int16[v+1]=s,this.uint8[w+4]=a,this.uint8[w+5]=u,this.uint8[w+6]=h,this.uint8[w+7]=m,this.float32[S+2]=g,e}}pp.prototype.bytesPerElement=12,Tt(pp,"StructArrayLayout2i4ub1f12");class Yo extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.float32[u+0]=i,this.float32[u+1]=s,this.float32[u+2]=a,e}}Yo.prototype.bytesPerElement=12,Tt(Yo,"StructArrayLayout3f12");class bs extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const m=6*e,g=3*e;return this.uint16[m+0]=i,this.uint16[m+1]=s,this.uint16[m+2]=a,this.uint16[m+3]=u,this.float32[g+2]=h,e}}bs.prototype.bytesPerElement=12,Tt(bs,"StructArrayLayout4ui1f12");class Sh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.uint16[h+0]=i,this.uint16[h+1]=s,this.uint16[h+2]=a,this.uint16[h+3]=u,e}}Sh.prototype.bytesPerElement=8,Tt(Sh,"StructArrayLayout4ui8");class $a extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,m){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.int16[g+3]=u,this.int16[g+4]=h,this.int16[g+5]=m,e}}$a.prototype.bytesPerElement=12,Tt($a,"StructArrayLayout6i12");class Ll extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S,A){const D=this.length;return this.resize(D+1),this.emplace(D,e,i,s,a,u,h,m,g,v,w,S,A)}emplace(e,i,s,a,u,h,m,g,v,w,S,A,D){const R=12*e;return this.int16[R+0]=i,this.int16[R+1]=s,this.int16[R+2]=a,this.int16[R+3]=u,this.uint16[R+4]=h,this.uint16[R+5]=m,this.uint16[R+6]=g,this.uint16[R+7]=v,this.int16[R+8]=w,this.int16[R+9]=S,this.int16[R+10]=A,this.int16[R+11]=D,e}}Ll.prototype.bytesPerElement=24,Tt(Ll,"StructArrayLayout4i4ui4i24");class Xn extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,m){const g=10*e,v=5*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.float32[v+2]=u,this.float32[v+3]=h,this.float32[v+4]=m,e}}Xn.prototype.bytesPerElement=20,Tt(Xn,"StructArrayLayout3i3f20");class Ko extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=s,this.float32[h+2]=a,this.float32[h+3]=u,e}}Ko.prototype.bytesPerElement=16,Tt(Ko,"StructArrayLayout4f16");class fp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}fp.prototype.bytesPerElement=4,Tt(fp,"StructArrayLayout1ul4");class ea extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=s,e}}ea.prototype.bytesPerElement=4,Tt(ea,"StructArrayLayout2ui4");class mp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S,A,D){const R=this.length;return this.resize(R+1),this.emplace(R,e,i,s,a,u,h,m,g,v,w,S,A,D)}emplace(e,i,s,a,u,h,m,g,v,w,S,A,D,R){const O=20*e,$=10*e;return this.int16[O+0]=i,this.int16[O+1]=s,this.int16[O+2]=a,this.int16[O+3]=u,this.int16[O+4]=h,this.float32[$+3]=m,this.float32[$+4]=g,this.float32[$+5]=v,this.float32[$+6]=w,this.int16[O+14]=S,this.uint32[$+8]=A,this.uint16[O+18]=D,this.uint16[O+19]=R,e}}mp.prototype.bytesPerElement=40,Tt(mp,"StructArrayLayout5i4f1i1ul2ui40");class Eh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,a,u,h,m)}emplace(e,i,s,a,u,h,m,g){const v=8*e;return this.int16[v+0]=i,this.int16[v+1]=s,this.int16[v+2]=a,this.int16[v+4]=u,this.int16[v+5]=h,this.int16[v+6]=m,this.int16[v+7]=g,e}}Eh.prototype.bytesPerElement=16,Tt(Eh,"StructArrayLayout3i2i2i16");class jc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const m=4*e,g=8*e;return this.float32[m+0]=i,this.float32[m+1]=s,this.float32[m+2]=a,this.int16[g+6]=u,this.int16[g+7]=h,e}}jc.prototype.bytesPerElement=16,Tt(jc,"StructArrayLayout2f1f2i16");class _p extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,m){const g=20*e,v=5*e;return this.uint8[g+0]=i,this.uint8[g+1]=s,this.float32[v+1]=a,this.float32[v+2]=u,this.float32[v+3]=h,this.float32[v+4]=m,e}}_p.prototype.bytesPerElement=20,Tt(_p,"StructArrayLayout2ub4f20");class fn extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.uint16[u+0]=i,this.uint16[u+1]=s,this.uint16[u+2]=a,e}}fn.prototype.bytesPerElement=6,Tt(fn,"StructArrayLayout3ui6");class gp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q){const Y=this.length;return this.resize(Y+1),this.emplace(Y,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q)}emplace(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q,Y){const ee=30*e,he=15*e,ye=60*e;return this.int16[ee+0]=i,this.int16[ee+1]=s,this.int16[ee+2]=a,this.float32[he+2]=u,this.float32[he+3]=h,this.uint16[ee+8]=m,this.uint16[ee+9]=g,this.uint32[he+5]=v,this.uint32[he+6]=w,this.uint32[he+7]=S,this.uint16[ee+16]=A,this.uint16[ee+17]=D,this.uint16[ee+18]=R,this.float32[he+10]=O,this.float32[he+11]=$,this.uint8[ye+48]=H,this.uint8[ye+49]=K,this.uint8[ye+50]=W,this.uint32[he+13]=F,this.int16[ee+28]=q,this.uint8[ye+58]=Y,e}}gp.prototype.bytesPerElement=60,Tt(gp,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class yp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q,Y,ee,he,ye,ve,Ce,Ue,et,Ye,Qe,ot,je){const Je=this.length;return this.resize(Je+1),this.emplace(Je,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q,Y,ee,he,ye,ve,Ce,Ue,et,Ye,Qe,ot,je)}emplace(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W,F,q,Y,ee,he,ye,ve,Ce,Ue,et,Ye,Qe,ot,je,Je){const Fe=20*e,Ve=40*e,lt=80*e;return this.float32[Fe+0]=i,this.float32[Fe+1]=s,this.int16[Ve+4]=a,this.int16[Ve+5]=u,this.int16[Ve+6]=h,this.int16[Ve+7]=m,this.int16[Ve+8]=g,this.int16[Ve+9]=v,this.int16[Ve+10]=w,this.int16[Ve+11]=S,this.int16[Ve+12]=A,this.uint16[Ve+13]=D,this.uint16[Ve+14]=R,this.uint16[Ve+15]=O,this.uint16[Ve+16]=$,this.uint16[Ve+17]=H,this.uint16[Ve+18]=K,this.uint16[Ve+19]=W,this.uint16[Ve+20]=F,this.uint16[Ve+21]=q,this.uint16[Ve+22]=Y,this.uint16[Ve+23]=ee,this.uint16[Ve+24]=he,this.uint16[Ve+25]=ye,this.uint16[Ve+26]=ve,this.uint16[Ve+27]=Ce,this.uint32[Fe+14]=Ue,this.float32[Fe+15]=et,this.float32[Fe+16]=Ye,this.float32[Fe+17]=Qe,this.float32[Fe+18]=ot,this.uint8[lt+76]=je,this.uint16[Ve+39]=Je,e}}yp.prototype.bytesPerElement=80,Tt(yp,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class ta extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const m=5*e;return this.float32[m+0]=i,this.float32[m+1]=s,this.float32[m+2]=a,this.float32[m+3]=u,this.float32[m+4]=h,e}}ta.prototype.bytesPerElement=20,Tt(ta,"StructArrayLayout5f20");class Vc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,a,u,h,m)}emplace(e,i,s,a,u,h,m,g){const v=7*e;return this.float32[v+0]=i,this.float32[v+1]=s,this.float32[v+2]=a,this.float32[v+3]=u,this.float32[v+4]=h,this.float32[v+5]=m,this.float32[v+6]=g,e}}Vc.prototype.bytesPerElement=28,Tt(Vc,"StructArrayLayout7f28");class vp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,s,a,u,h,m,g,v,w,S)}emplace(e,i,s,a,u,h,m,g,v,w,S,A){const D=11*e;return this.float32[D+0]=i,this.float32[D+1]=s,this.float32[D+2]=a,this.float32[D+3]=u,this.float32[D+4]=h,this.float32[D+5]=m,this.float32[D+6]=g,this.float32[D+7]=v,this.float32[D+8]=w,this.float32[D+9]=S,this.float32[D+10]=A,e}}vp.prototype.bytesPerElement=44,Tt(vp,"StructArrayLayout11f44");class Ah extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,s,a,u,h,m,g,v)}emplace(e,i,s,a,u,h,m,g,v,w){const S=9*e;return this.float32[S+0]=i,this.float32[S+1]=s,this.float32[S+2]=a,this.float32[S+3]=u,this.float32[S+4]=h,this.float32[S+5]=m,this.float32[S+6]=g,this.float32[S+7]=v,this.float32[S+8]=w,e}}Ah.prototype.bytesPerElement=36,Tt(Ah,"StructArrayLayout9f36");class Ga extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=s,e}}Ga.prototype.bytesPerElement=8,Tt(Ga,"StructArrayLayout2f8");class xp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=6*e;return this.uint32[3*e+0]=i,this.uint16[h+2]=s,this.uint16[h+3]=a,this.uint16[h+4]=u,e}}xp.prototype.bytesPerElement=12,Tt(xp,"StructArrayLayout1ul3ui12");class Uc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}Uc.prototype.bytesPerElement=2,Tt(Uc,"StructArrayLayout1ui2");class kl extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$){const H=this.length;return this.resize(H+1),this.emplace(H,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$)}emplace(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H){const K=16*e;return this.float32[K+0]=i,this.float32[K+1]=s,this.float32[K+2]=a,this.float32[K+3]=u,this.float32[K+4]=h,this.float32[K+5]=m,this.float32[K+6]=g,this.float32[K+7]=v,this.float32[K+8]=w,this.float32[K+9]=S,this.float32[K+10]=A,this.float32[K+11]=D,this.float32[K+12]=R,this.float32[K+13]=O,this.float32[K+14]=$,this.float32[K+15]=H,e}}kl.prototype.bytesPerElement=64,Tt(kl,"StructArrayLayout16f64");class $c extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,a,u,h,m)}emplace(e,i,s,a,u,h,m,g){const v=10*e,w=5*e;return this.uint16[v+0]=i,this.uint16[v+1]=s,this.uint16[v+2]=a,this.uint16[v+3]=u,this.float32[w+2]=h,this.float32[w+3]=m,this.float32[w+4]=g,e}}$c.prototype.bytesPerElement=20,Tt($c,"StructArrayLayout4ui3f20");class bp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}bp.prototype.bytesPerElement=2,Tt(bp,"StructArrayLayout1i2");class Ih extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}Ih.prototype.bytesPerElement=1,Tt(Ih,"StructArrayLayout1ub1");class Nm extends Nc{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Nm.prototype.size=40;class Ch extends mp{get(e){return new Nm(this,e)}}Tt(Ch,"CollisionBoxArray");class jm extends Nc{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}jm.prototype.size=60;class Vm extends gp{get(e){return new jm(this,e)}}Tt(Vm,"PlacedSymbolArray");class Um extends Nc{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Um.prototype.size=80;class $m extends yp{get(e){return new Um(this,e)}}Tt($m,"SymbolInstanceArray");class wp extends Rl{getoffsetX(e){return this.float32[1*e+0]}}Tt(wp,"GlyphOffsetArray");class Gm extends xs{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Tt(Gm,"SymbolLineVertexArray");class Hm extends Nc{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}Hm.prototype.size=12;class qm extends xp{get(e){return new Hm(this,e)}}Tt(qm,"FeatureIndexArray");class Zm extends ea{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Tt(Zm,"FillExtrusionCentroidArray");class Wm extends Nc{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}Wm.prototype.size=6;class Xm extends wh{get(e){return new Wm(this,e)}}Tt(Xm,"FillExtrusionWallArray");const Yy=ki([{name:"a_pos",components:2,type:"Int16"}],4),Ky=ki([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Cr{constructor(e=[]){this.segments=e}_prepareSegment(e,i,s,a){let u=this.segments[this.segments.length-1];return e>Cr.MAX_VERTEX_ARRAY_LENGTH&&yi(`Max vertices per segment is ${Cr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Cr.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==a)&&(u={vertexOffset:i,primitiveOffset:s,vertexLength:0,primitiveLength:0},a!==void 0&&(u.sortKey=a),this.segments.push(u)),u}prepareSegment(e,i,s,a){return this._prepareSegment(e,i.length,s.length,a)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,s,a){return new Cr([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:a,vaos:{},sortKey:0}])}}function Ym(r,e){return 256*(r=Te(Math.floor(r),0,255))+Te(Math.floor(e),0,255)}Cr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Tt(Cr,"SegmentVector");const Jy=ki([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Ol=ki([{name:"a_pattern_b",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Qy=ki([{name:"a_dash",components:4,type:"Uint16"}]);class Fl{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,s,a){this.ids.push(Km(e)),this.positions.push(i,s,a)}eachPosition(e,i){const s=Km(e);let a=0,u=this.ids.length-1;for(;a<u;){const h=a+u>>1;this.ids[h]>=s?u=h:a=h+1}for(;this.ids[a]===s;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const s=new Float64Array(e.ids),a=new Uint32Array(e.positions);return Mh(s,a,0,s.length-1),i&&(i.add(s.buffer),i.add(a.buffer)),{ids:s,positions:a}}static deserialize(e){const i=new Fl;let s;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==s&&i.uniqueIds.push(a),s=a;return i.indexed=!0,i}}function Km(r){const e=+r;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:Qn(String(r))}function Mh(r,e,i,s){for(;i<s;){const a=r[i+s>>1];let u=i-1,h=s+1;for(;;){do u++;while(r[u]<a);do h--;while(r[h]>a);if(u>=h)break;Gc(r,u,h),Gc(e,3*u,3*h),Gc(e,3*u+1,3*h+1),Gc(e,3*u+2,3*h+2)}h-i<s-h?(Mh(r,e,i,h),i=h+1):(Mh(r,e,h+1,s),s=h)}}function Gc(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}Tt(Fl,"FeaturePositionMap");class Jo{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,s){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class Ph extends Jo{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1i(this.location,s))}}class Wr extends Jo{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1f(this.location,s))}}class zo extends Jo{constructor(e){super(e),this.current=[0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]||(this.current=s,this.gl.uniform2f(this.location,s[0],s[1])))}}class Hc extends Jo{constructor(e){super(e),this.current=[0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]||(this.current=s,this.gl.uniform3f(this.location,s[0],s[1],s[2])))}}class Dh extends Jo{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]&&s[3]===this.current[3]||(this.current=s,this.gl.uniform4f(this.location,s[0],s[1],s[2],s[3])))}}class Jm extends Jo{constructor(e){super(e),this.current=Fi.transparent.toRenderColor(null)}set(e,i,s){this.fetchUniformLocation(e,i)&&(s.r===this.current.r&&s.g===this.current.g&&s.b===this.current.b&&s.a===this.current.a||(this.current=s,this.gl.uniform4f(this.location,s.r,s.g,s.b,s.a)))}}const e0=new Float32Array(16);class qc extends Jo{constructor(e){super(e),this.current=e0}set(e,i,s){if(this.fetchUniformLocation(e,i)){if(s[12]!==this.current[12]||s[0]!==this.current[0])return this.current=s,void this.gl.uniformMatrix4fv(this.location,!1,s);for(let a=1;a<16;a++)if(s[a]!==this.current[a]){this.current=s,this.gl.uniformMatrix4fv(this.location,!1,s);break}}}}const Qm=new Float32Array(9),Tp=new Float32Array(4);class xo extends Jo{constructor(e){super(e),this.current=Tp}set(e,i,s){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(s[a]!==this.current[a]){this.current=s,this.gl.uniformMatrix2fv(this.location,!1,s);break}}}}function Zc(r){return[Ym(255*r.r,255*r.g),Ym(255*r.b,255*r.a)]}class Wc{constructor(e,i,s,a){this.value=e,this.uniformNames=i.map(u=>`u_${u}`),this.type=s,this.context=a}setUniform(e,i,s,a,u){const h=a.constantOr(this.value);i.set(e,u,h instanceof Fi?h.toRenderColor(this.lutExpression&&this.lutExpression.value==="none"?null:this.context.lut):h)}getBinding(e,i){return this.type==="color"?new Jm(e):new Wr(e)}}class Bl{constructor(e,i){this.uniformNames=i.map(s=>`u_${s}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,s,a,u){let h=null;u!=="u_pattern"&&u!=="u_dash"||(h=this.pattern),u==="u_pattern_b"&&(h=this.patternTransition),u==="u_pixel_ratio"&&(h=this.pixelRatio),h&&i.set(e,u,h)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new Dh(e):new Wr(e)}}class ws{constructor(e,i,s,a){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,s,a,u,h,m){const g=this.paintVertexArray.length,v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Wi(0,{brightness:h}),i,{},u,a,m):this.expression.kind==="constant"&&this.expression.value,w=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:h}),i,{},u,a,m):this.lutExpression.value)==="none";this.paintVertexArray.resize(e),this._setPaintValue(g,e,v,w?null:this.context.lut)}updatePaintArray(e,i,s,a,u,h,m){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:m},s,a,void 0,u):this.expression.kind==="constant"&&this.expression.value,v=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:m}),s,a,void 0,u):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v?null:this.context.lut)}_setPaintValue(e,i,s,a){if(this.type==="color"){const u=Zc(s.toRenderColor(a));for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,u[0],u[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Lo{constructor(e,i,s,a,u,h){this.expression=e,this.uniformNames=i.map(m=>`u_${m}_t`),this.type=s,this.useIntegerZoom=a,this.context=u,this.maxValue=0,this.paintVertexAttributes=i.map(m=>({name:`a_${m}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,i,s,a,u,h,m){const g=this.expression.evaluate(new Wi(this.context.zoom,{brightness:h}),i,{},u,a,m),v=this.expression.evaluate(new Wi(this.context.zoom+1,{brightness:h}),i,{},u,a,m),w=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:h}),i,{},u,a,m):this.lutExpression.value)==="none",S=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(S,e,g,v,w?null:this.context.lut)}updatePaintArray(e,i,s,a,u,h,m){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:m},s,a,void 0,u),v=this.expression.evaluate({zoom:this.context.zoom+1,brightness:m},s,a,void 0,u),w=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:m}),s,a,void 0,u):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v,w?null:this.context.lut)}_setPaintValue(e,i,s,a,u){if(this.type==="color"){const h=Zc(s.toRenderColor(u)),m=Zc(s.toRenderColor(u));for(let g=e;g<i;g++)this.paintVertexArray.emplace(g,h[0],h[1],m[0],m[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,s,a);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,s,a,u){const h=this.useIntegerZoom?Math.floor(s.zoom):s.zoom,m=Te(this.expression.interpolationFactor(h,this.context.zoom,this.context.zoom+1),0,1);i.set(e,u,m)}getBinding(e,i){return new Wr(e)}}class ko{constructor(e,i,s,a,u){this.expression=e,this.layerId=u,this.paintVertexAttributes=(s==="array"?Qy:Jy).members;for(let h=0;h<i.length;++h);this.paintVertexArray=new a,this.paintTransitionVertexArray=new bs}populatePaintArray(e,i,s,a){const u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(u,e,i.patterns&&i.patterns[this.layerId],s)}updatePaintArray(e,i,s,a,u,h,m){this._setPaintValues(e,i,s.patterns&&s.patterns[this.layerId],h)}_setPaintValues(e,i,s,a){if(!a||!s)return;const u=a[s[0]],h=a[s[1]];if(u){if(u){const{tl:m,br:g,pixelRatio:v}=u;for(let w=e;w<i;w++)this.paintVertexArray.emplace(w,m[0],m[1],g[0],g[1],v)}if(h){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:m,br:g,pixelRatio:v}=h;for(let w=e;w<i;w++)this.paintTransitionVertexArray.emplace(w,m[0],m[1],g[0],g[1],v)}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,Ol.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class ia{constructor(e,i,s=()=>!0){this.binders={},this._buffers=[],this.context=i;const a=[];for(const u in e.paint._values){const h=e.paint.get(u);if(u.endsWith("-use-theme")||!s(u)||!(h instanceof Pl&&ch(h.property.specification)))continue;const m=t(u,e.type),g=h.value,v=h.property.specification.type,w=!!h.property.useIntegerZoom,S=u==="line-dasharray"||u.endsWith("pattern"),A=e.paint.get(`${u}-use-theme`),D=u==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||A&&A.value.kind!=="constant";if(g.kind!=="constant"||D)if(g.kind==="source"||D||S){const R=d(u,v,"source");this.binders[u]=S?new ko(g,m,v,R,e.id):new ws(g,m,v,R),a.push(`/a_${u}`)}else{const R=d(u,v,"composite");this.binders[u]=new Lo(g,m,v,w,i,R),a.push(`/z_${u}`)}else this.binders[u]=S?new Bl(g.value,m):new Wc(g.value,m,v,i),a.push(`/u_${u}`);A&&(this.binders[u].lutExpression=A.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof ws||i instanceof Lo?i.maxValue:0}populatePaintArrays(e,i,s,a,u,h,m){for(const g in this.binders){const v=this.binders[g];v.context=this.context,(v instanceof ws||v instanceof Lo||v instanceof ko)&&v.populatePaintArray(e,i,s,a,u,h,m)}}setConstantPatternPositions(e,i){for(const s in this.binders){const a=this.binders[s];a instanceof Bl&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof ko?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,s,a,u,h,m,g,v){let w=!1;const S=Object.keys(e),A=S.length!==0&&!g,D=A?S:i.uniqueIds;this.context.lut=u.lut;for(const R in this.binders){const O=this.binders[R];if(O.context=this.context,(O instanceof ws||O instanceof Lo||O instanceof ko)&&O.expression&&O.expression.kind&&O.expression.kind!=="constant"&&(O.expression.isStateDependent===!0||O.expression.isLightConstant===!1)){const $=u.paint.get(R);O.expression=$.value;for(const H of D){const K=e[H.toString()];i.eachPosition(H,(W,F,q)=>{const Y=a.feature(W);O.updatePaintArray(F,q,Y,K,h,m,v)})}if(!A)for(const H of s.uniqueIds){const K=e[H.toString()];s.eachPosition(H,(W,F,q)=>{const Y=a.feature(W);O.updatePaintArray(F,q,Y,K,h,m,v)})}w=!0}}return w}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof Wc||s instanceof Bl)&&e.push(...s.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof ws||s instanceof Lo||s instanceof ko)for(let a=0;a<s.paintVertexAttributes.length;a++)e.push(s.paintVertexAttributes[a].name);if(s instanceof ko)for(let a=0;a<Ol.members.length;a++)e.push(Ol.members[a].name)}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Wc||s instanceof Bl||s instanceof Lo)for(const a of s.uniformNames)e.push(a)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const s in this.binders){const a=this.binders[s];if(a instanceof Wc||a instanceof Bl||a instanceof Lo)for(const u of a.uniformNames)i.push({name:u,property:s,binding:a.getBinding(e,u)})}return i}setUniforms(e,i,s,a,u){for(const{name:h,property:m,binding:g}of s)this.binders[m].setUniform(e,g,u,a.get(m),h)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof ws||i instanceof Lo||i instanceof ko)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof ko&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof ws||s instanceof Lo||s instanceof ko)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof ws||i instanceof Lo||i instanceof ko)&&i.destroy()}}}class Ha{constructor(e,i,s=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new ia(a,i,s);this.needsUpload=!1,this._featureMap=new Fl,this._featureMapWithoutIds=new Fl,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,s,a,u,h,m,g){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(e,i,a,u,h,m,g);i.id!==void 0?this._featureMap.add(i.id,s,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,s,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,a,u,h,m){for(const g of s)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,g,a,u,h,m||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const l={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"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"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"]};function t(r,e){return l[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const n={"line-pattern":{source:bs,composite:bs},"fill-pattern":{source:bs,composite:bs},"fill-extrusion-pattern":{source:bs,composite:bs},"line-dasharray":{source:Sh,composite:Sh}},c={color:{source:Ga,composite:Ko},number:{source:Rl,composite:Ga}};function d(r,e,i){const s=n[r];return s&&s[i]||c[e][i]}Tt(Wc,"ConstantBinder"),Tt(Bl,"PatternConstantBinder"),Tt(ws,"SourceExpressionBinder"),Tt(ko,"PatternCompositeBinder"),Tt(Lo,"CompositeExpressionBinder"),Tt(ia,"ProgramConfiguration",{omit:["_buffers"]}),Tt(Ha,"ProgramConfigurationSet");const f=_t/Math.PI/2,_=5,y=6,b=16383,E=64,I=[E,32,16],P=-f,M=f;function z(r,e,i,s=f){return i=U(i),[r*Math.sin(i)*s,-e*s,r*Math.cos(i)*s]}function N(r,e,i){return z(Math.cos(U(r)),Math.sin(U(r)),e,i)}const B=63710088e-1,G=2*Math.PI*B;class V{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new V(Be(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,s=this.lat*i,a=e.lat*i,u=Math.sin(s)*Math.sin(a)+Math.cos(s)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return B*Math.acos(Math.min(u,1))}toBounds(e=0){const i=360*e/40075017,s=i/Math.cos(Math.PI/180*this.lat);return new X({lng:this.lng-s,lat:this.lat-i},{lng:this.lng+s,lat:this.lat+i})}toEcef(e){return N(this.lat,this.lng,f+e*f/B)}static convert(e){if(e instanceof V)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new V(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new V(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class X{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const s=e;this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]])}else{const s=e;this.setSouthWest(s[0]).setNorthEast(s[1])}}setNorthEast(e){return this._ne=e instanceof V?new V(e.lng,e.lat):V.convert(e),this}setSouthWest(e){return this._sw=e instanceof V?new V(e.lng,e.lat):V.convert(e),this}extend(e){const i=this._sw,s=this._ne;let a,u;if(e instanceof V)a=e,u=e;else{if(!(e instanceof X))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(X.convert(e)):this.extend(V.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(V.convert(e)):this;if(a=e._sw,u=e._ne,!a||!u)return this}return i||s?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),s.lng=Math.max(u.lng,s.lng),s.lat=Math.max(u.lat,s.lat)):(this._sw=new V(a.lng,a.lat),this._ne=new V(u.lng,u.lat)),this}getCenter(){return new V((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new V(this.getWest(),this.getNorth())}getSouthEast(){return new V(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=V.convert(e);let a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&a}static convert(e){if(e)return e instanceof X?e:new X(e)}}const Q=0,ie=25.5;function ue(r){return G*Math.cos(r*Math.PI/180)}function ae(r){return(180+r)/360}function le(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function ne(r,e){return r/ue(e)}function de(r){return 360*r-180}function me(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Le(r,e){return r*ue(me(e))}const Me=85.051129;function Ze(r){return Math.cos(U(Te(r,-Me,Me)))}function He(r,e){const i=Te(e,Q,ie),s=Math.pow(2,i);return Ze(r)*G/(512*s)}function ht(r){return 1/Math.cos(r*Math.PI/180)}function De(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/_t)/(1<<r.z)*2));return 80150034*i/(i*i+1)/_t/(1<<r.z)}class ke{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=V.convert(e);return new ke(ae(s.lng),le(s.lat),ne(i,s.lat))}toLngLat(){return new V(de(this.x),me(this.y))}toAltitude(){return Le(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/G*ht(me(this.y))}}function Ie(r,e,i,s,a,u,h,m,g){const v=(e+s)/2,w=(i+a)/2,S=new ft(v,w);m(S),function(A,D,R,O,$,H){const K=R-$,W=O-H;return Math.abs((O-D)*K-(R-A)*W)/Math.hypot(K,W)}(S.x,S.y,u.x,u.y,h.x,h.y)>=g?(Ie(r,e,i,v,w,u,S,m,g),Ie(r,v,w,s,a,S,h,m,g)):r.push(h)}function Ke(r,e,i){let s=r[0],a=s.x,u=s.y;e(s);const h=[s];for(let m=1;m<r.length;m++){const g=r[m],{x:v,y:w}=g;e(g),Ie(h,a,u,v,w,s,g,e,i),a=v,u=w,s=g}return h}function Ne(r,e,i,s){if(s(e,i)){const a=e.add(i)._mult(.5);Ne(r,e,a,s),Ne(r,a,i,s)}else r.push(i)}function tt(r,e){let i=r[0];const s=[i];for(let a=1;a<r.length;a++){const u=r[a];Ne(s,i,u,e),i=u}return s}const We=Math.pow(2,14)-1,it=-We-1;function rt(r,e){const i=Math.round(r.x*e),s=Math.round(r.y*e);return r.x=Te(i,it,We),r.y=Te(s,it,We),(i<r.x||i>r.x+1||s<r.y||s>r.y+1)&&yi("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function At(r,e,i){const s=r.loadGeometry(),a=r.extent,u=_t/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:m,x:g,y:v,projection:w}=i,S=A=>{const D=de((e.x+A.x/a)/h),R=me((e.y+A.y/a)/h),O=w.project(D,R);A.x=(O.x*m-g)*a,A.y=(O.y*m-v)*a};for(let A=0;A<s.length;A++)if(r.type!==1)s[A]=Ke(s[A],S,1);else{const D=[];for(const R of s[A])R.x<0||R.x>=a||R.y<0||R.y>=a||(S(R),D.push(R));s[A]=D}}for(const h of s)for(const m of h)rt(m,u);return s}function Lt(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?At(r):[]}}function St(r,e,i,s,a){r.emplaceBack(2*e+(s+1)/2,2*i+(a+1)/2)}function Ot(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Ct{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new xs,this.indexArray=new fn,this.segments=new Cr,this.programConfigurations=new Ha(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}updateFootprints(e,i){}populate(e,i,s,a){const u=this.layers[0],h=[];let m=null;u.type==="circle"&&(m=u.layout.get("circle-sort-key"));for(const{feature:v,id:w,index:S,sourceLayerIndex:A}of e){const D=this.layers[0]._featureFilter.needGeometry,R=Lt(v,D);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),R,s))continue;const O=m?m.evaluate(R,{},s):void 0,$={id:w,properties:v.properties,type:v.type,sourceLayerIndex:A,index:S,geometry:D?R.geometry:At(v,s,a),patterns:{},sortKey:O};h.push($)}m&&h.sort((v,w)=>v.sortKey-w.sortKey);let g=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new $a,g=a.projection);for(const v of h){const{geometry:w,index:S,sourceLayerIndex:A}=v,D=e[S].feature;this.addFeature(v,w,S,i.availableImages,s,g,i.brightness),i.featureIndex.insert(D,w,S,A,this.index)}}update(e,i,s,a,u,h,m){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Yy.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Ky.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,i,s,a,u,h,m){for(const g of i)for(const v of g){const w=v.x,S=v.y;if(w<0||w>=_t||S<0||S>=_t)continue;if(h){const R=h.projectTilePoint(w,S,u),O=h.upVector(u,w,S),$=this.globeExtVertexArray;Ot($,R,O),Ot($,R,O),Ot($,R,O),Ot($,R,O)}const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),D=A.vertexLength;St(this.layoutVertexArray,w,S,-1,-1),St(this.layoutVertexArray,w,S,1,-1),St(this.layoutVertexArray,w,S,1,1),St(this.layoutVertexArray,w,S,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+2,D+3),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},a,u,m)}}function Vt(r,e){for(let i=0;i<r.length;i++)if(Yi(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Yi(r,e[i]))return!0;return!!Gi(r,e)}function Yt(r,e,i){return!!Yi(r,e)||!!ti(e,r,i)}function gi(r,e){if(r.length===1)return zi(e,r[0]);for(let i=0;i<e.length;i++){const s=e[i];for(let a=0;a<s.length;a++)if(Yi(r,s[a]))return!0}for(let i=0;i<r.length;i++)if(zi(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Gi(r,e[i]))return!0;return!1}function Xi(r,e,i){if(r.length>1){if(Gi(r,e))return!0;for(let s=0;s<e.length;s++)if(ti(e[s],r,i))return!0}for(let s=0;s<r.length;s++)if(ti(r[s],e,i))return!0;return!1}function Gi(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],a=r[i+1];for(let u=0;u<e.length-1;u++)if(xi(s,a,e[u],e[u+1]))return!0}return!1}function xi(r,e,i,s){return nr(r,i,s)!==nr(e,i,s)&&nr(r,e,i)!==nr(r,e,s)}function kr(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function Ir(r,e,i,s){const a=kr(r,e,s),u=kr(r,e,i);if(Math.sign(a)===Math.sign(u))return;const h=kr(i,s,r),m=h+u-a;return Math.sign(h)!==Math.sign(m)?[h/(h-m),u/(u-a)]:void 0}function ti(r,e,i){const s=i*i;if(e.length===1)return r.distSqr(e[0])<s;for(let a=1;a<e.length;a++)if(Ci(r,e[a-1],e[a])<s)return!0;return!1}function Ci(r,e,i){const s=e.distSqr(i);if(s===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/s;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function zi(r,e){let i,s,a,u=!1;for(let h=0;h<r.length;h++){i=r[h];for(let m=0,g=i.length-1;m<i.length;g=m++)s=i[m],a=i[g],s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(u=!u)}return u}function Yi(r,e){let i=!1;for(let s=0,a=r.length-1;s<r.length;a=s++){const u=r[s],h=r[a];u.y>e.y!=h.y>e.y&&e.x<(h.x-u.x)*(e.y-u.y)/(h.y-u.y)+u.x&&(i=!i)}return i}function Kr(r,e,i,s,a){for(const h of r)if(e<=h.x&&i<=h.y&&s>=h.x&&a>=h.y)return!0;const u=[new ft(e,i),new ft(e,a),new ft(s,a),new ft(s,i)];if(r.length>2){for(const h of u)if(Yi(r,h))return!0}for(let h=0;h<r.length-1;h++)if(jr(r[h],r[h+1],u))return!0;return!1}function jr(r,e,i){const s=i[0],a=i[2];if(r.x<s.x&&e.x<s.x||r.x>a.x&&e.x>a.x||r.y<s.y&&e.y<s.y||r.y>a.y&&e.y>a.y)return!1;const u=nr(r,e,i[0]);return u!==nr(r,e,i[1])||u!==nr(r,e,i[2])||u!==nr(r,e,i[3])}function Xr(r,e,i,s,a,u){let h=e.y-r.y,m=r.x-e.x;if(u=u||0){const g=h*h+m*m;if(g===0)return!0;const v=Math.sqrt(g);h/=v,m/=v}return!((i.x-r.x)*h+(i.y-r.y)*m-u<0||(s.x-r.x)*h+(s.y-r.y)*m-u<0||(a.x-r.x)*h+(a.y-r.y)*m-u<0)}function Sr(r,e,i,s,a,u,h){return!(Xr(r,e,s,a,u,h)||Xr(e,i,s,a,u,h)||Xr(i,r,s,a,u,h)||Xr(s,a,r,e,i,h)||Xr(a,u,r,e,i,h)||Xr(u,s,r,e,i,h))}function si(r,e,i){const s=e.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(r)}function yr(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Di(r,e,i,s,a){if(!e[0]&&!e[1])return r;const u=ft.convert(e)._mult(a);i==="viewport"&&u._rotate(-s);const h=[];for(let m=0;m<r.length;m++)h.push(r[m].sub(u));return h}function vr(r,e,i,s){const a=ft.convert(r)._mult(s);return e==="viewport"&&a._rotate(-i),a}let Bi,Er;function mn(r,e,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}Tt(Ct,"CircleBucket",{omit:["layers"]});class cr{constructor(e,i,s){this.z=e,this.x=i,this.y=s,this.key=wn(0,e,e,i,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){const s=function(u,h,m){var g=mn(256*u,256*(h=Math.pow(2,m)-h-1),m),v=mn(256*(u+1),256*(h+1),m);return g[0]+","+g[1]+","+v[0]+","+v[1]}(this.x,this.y,this.z),a=function(u,h,m){let g,v="";for(let w=u;w>0;w--)g=1<<w-1,v+=(h&g?1:0)+(m&g?2:0);return v}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",s)}toString(){return`${this.z}/${this.x}/${this.y}`}}class vn{constructor(e,i){this.wrap=e,this.canonical=i,this.key=wn(e,i.z,i.z,i.x,i.y)}}class Zr{constructor(e,i,s,a,u){this.overscaledZ=e,this.wrap=i,this.canonical=new cr(s,+a,+u),this.key=i===0&&e===s?this.canonical.key:wn(i,e,s,a,u)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new Zr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Zr(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return wn(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const s=this.canonical.z-e;return wn(this.wrap*+i,e,e,this.canonical.x>>s,this.canonical.y>>s)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new Zr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,a=2*this.canonical.y;return[new Zr(i,this.wrap,i,s,a),new Zr(i,this.wrap,i,s+1,a),new Zr(i,this.wrap,i,s,a+1),new Zr(i,this.wrap,i,s+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Zr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Zr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new vn(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function wn(r,e,i,s,a){const u=1<<Math.min(i,22);let h=u*(a%u)+s%u;return r&&i<22&&(h+=u*u*((r<0?-2*r-1:2*r)%(1<<2*(22-i)))),16*(32*h+i)+(e-i)}const Oo=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new Zr(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>{let e=r.canonical.x+1,i=r.wrap;return e===1<<r.canonical.z&&(e=0,i++),new Zr(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new Zr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new Zr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];Tt(cr,"CanonicalTileID"),Tt(Zr,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Ts=ki([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:io}=Ts,bo=ki([{name:"a_pos_3",components:3,type:"Int16"}]);var Qo=ki([{name:"a_pos",type:"Int16",components:2}]);class es{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const a=Ar(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return s[0]=this.pos[0]+this.dir[0]*u,s[1]=this.pos[1]+this.dir[1]*u,!0}}class Fo{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const a=Zi(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return s[0]=this.pos[0]+this.dir[0]*u,s[1]=this.pos[1]+this.dir[1]*u,s[2]=this.pos[2]+this.dir[2]*u,!0}closestPointOnSphere(e,i,s){if(function(D,R){var O=D[0],$=D[1],H=D[2],K=R[0],W=R[1],F=R[2];return Math.abs(O-K)<=re*Math.max(1,Math.abs(O),Math.abs(K))&&Math.abs($-W)<=re*Math.max(1,Math.abs($),Math.abs(W))&&Math.abs(H-F)<=re*Math.max(1,Math.abs(H),Math.abs(F))}(this.pos,e)||i===0)return s[0]=s[1]=s[2]=0,!1;const[a,u,h]=this.dir,m=this.pos[0]-e[0],g=this.pos[1]-e[1],v=this.pos[2]-e[2],w=a*a+u*u+h*h,S=2*(m*a+g*u+v*h),A=S*S-4*w*(m*m+g*g+v*v-i*i);if(A<0){const D=Math.max(-S/2,0),R=m+a*D,O=g+u*D,$=v+h*D,H=Math.hypot(R,O,$);return s[0]=R*i/H,s[1]=O*i/H,s[2]=$*i/H,!1}{const D=(-S-Math.sqrt(A))/(2*w);if(D<0){const R=Math.hypot(m,g,v);return s[0]=m*i/R,s[1]=g*i/R,s[2]=v*i/R,!1}return s[0]=m+a*D,s[1]=g+u*D,s[2]=v+h*D,!0}}}class Nl{constructor(e,i,s,a,u){this.TL=e,this.TR=i,this.BR=s,this.BL=a,this.horizon=u}static fromInvProjectionMatrix(e,i,s){const a=[-1,1,1],u=[1,1,1],h=[1,-1,1],m=[-1,-1,1],g=gr(a,a,e),v=gr(u,u,e),w=gr(h,h,e),S=gr(m,m,e);return new Nl(g,v,w,S,i/s)}}function qa(r,e,i){let s=1/0,a=-1/0;const u=[];for(const h of r){Ei(u,h,e);const m=Zi(u,i);s=Math.min(s,m),a=Math.max(a,m)}return[s,a]}function Rh(r,e){let i=!0;for(let s=0;s<r.planes.length;s++){const a=r.planes[s];let u=0;for(let h=0;h<e.length;h++)u+=Zi(a,e[h])+a[3]>=0;if(u===0)return 0;u!==e.length&&(i=!1)}return i?2:1}function zh(r,e){for(const i of r.projections){const s=qa(e,r.points[0],i.axis);if(i.projection[1]<s[0]||i.projection[0]>s[1])return 0}return 1}function Lh(r,e){let i=0;const s=[0,0,0,0];for(let h=0;h<r.length;h++)s[0]=r[h][0],s[1]=r[h][1],s[2]=r[h][2],s[3]=1,(a=s)[0]*(u=e)[0]+a[1]*u[1]+a[2]*u[2]+a[3]*u[3]>=0&&i++;var a,u;return i}class Xc{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=xr.fromPoints(this.points),this.projections=[],this.frustumEdges=[Ei([],this.points[2],this.points[3]),Ei([],this.points[0],this.points[3]),Ei([],this.points[4],this.points[0]),Ei([],this.points[5],this.points[1]),Ei([],this.points[6],this.points[2]),Ei([],this.points[7],this.points[3])];for(const s of this.frustumEdges){const a=[0,-s[2],s[1]],u=[s[2],0,-s[0]];this.projections.push({axis:a,projection:qa(this.points,this.points[0],a)}),this.projections.push({axis:u,projection:qa(this.points,this.points[0],u)})}}static fromInvProjectionMatrix(e,i,s,a){const u=Math.pow(2,s),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(v=>{const w=Dr([],v,e),S=1/w[3]/i*u;return(A=w)[0]=(D=w)[0]*(R=[S,S,a?1/w[3]:S,S])[0],A[1]=D[1]*R[1],A[2]=D[2]*R[2],A[3]=D[3]*R[3],A;var A,D,R}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(v=>{const w=Ui([],Lr([],Ei([],h[v[0]],h[v[1]]),Ei([],h[v[2]],h[v[1]]))),S=-Zi(w,h[v[1]]);return w.concat(S)}),g=[];for(let v=0;v<h.length;v++)g.push([h[v][0],h[v][1],h[v][2]]);return new Xc(g,m)}intersectsPrecise(e,i,s){for(let a=0;a<i.length;a++)if(!Lh(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!Lh(e,this.planes[a]))return 0;for(const a of s)for(const u of this.frustumEdges){const h=Lr([],a,u),m=Jt(h);if(m===0)continue;Ii(h,h,1/m);const g=qa(this.points,this.points[0],h),v=qa(e,this.points[0],h);if(g[0]>v[1]||v[0]>g[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const s=i[3];if(Zi([i[0],i[1],i[2]],e)+s<0)return!1}return!0}}class xr{static fromPoints(e){const i=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0];for(const a of e)pr(i,i,a),_r(s,s,a);return new xr(i,s)}static fromTileIdAndHeight(e,i,s){const a=1<<e.canonical.z,u=e.canonical.x,h=e.canonical.y;return new xr([u/a,h/a,i],[(u+1)/a,(h+1)/a,s])}static applyTransform(e,i){const s=e.getCorners();for(let a=0;a<s.length;++a)gr(s[a],s[a],i);return xr.fromPoints(s)}static applyTransformFast(e,i){const s=[i[12],i[13],i[14]],a=[...s];for(let u=0;u<3;u++)for(let h=0;h<3;h++){const m=i[4*h+u],g=m*e.min[h],v=m*e.max[h];s[u]+=Math.min(g,v),a[u]+=Math.max(g,v)}return new xr(s,a)}static projectAabbCorners(e,i){const s=e.getCorners();for(let a=0;a<s.length;++a)gr(s[a],s[a],i);return s}constructor(e,i){this.min=e,this.max=i,this.center=Ii([],vi([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],s=bi(this.min),a=bi(this.max);for(let u=0;u<i.length;u++)s[u]=i[u]?this.min[u]:this.center[u],a[u]=i[u]?this.center[u]:this.max[u];return a[2]=this.max[2],new xr(s,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Rh(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Rh(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?zh(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?zh(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}function jl(r){return r*f/B}Tt(xr,"Aabb");const Sp=[new xr([P,P,P],[M,M,M]),new xr([P,P,P],[0,0,M]),new xr([0,P,P],[M,0,M]),new xr([P,0,P],[0,M,M]),new xr([0,0,P],[M,M,M])];function tw(r,e,i,s=!0){const a=Ii([],r._camera.position,r.worldSize),u=[e,i,1,1];Dr(u,u,r.pixelMatrixInverse),En(u,u,1/u[3]);const h=Ui([],Ei([],u,a)),m=r.globeMatrix,g=[m[12],m[13],m[14]],v=Ei([],g,a),w=Jt(v),S=Ui([],v),A=r.worldSize/(2*Math.PI),D=Zi(S,h),R=Math.asin(A/w);if(R<Math.acos(D)){if(!s)return null;const ve=[],Ce=[];Ii(ve,h,w/D),Ui(Ce,Ei(Ce,ve,v)),Ui(h,vi(h,v,Ii(h,Ce,Math.tan(R)*w)))}const O=[];new Fo(a,h).closestPointOnSphere(g,A,O);const $=Ui([],pn(m,0)),H=Ui([],pn(m,1)),K=Ui([],pn(m,2)),W=Zi($,O),F=Zi(H,O),q=Zi(K,O),Y=Z(Math.asin(-F/A));let ee=Z(Math.atan2(W,q));ee=r.center.lng+function(ve,Ce){const Ue=(Ce-ve+180)%360-180;return Ue<-180?Ue+360:Ue}(r.center.lng,ee);const he=ae(ee),ye=Te(le(Y),0,1);return new ke(he,ye)}class PL{constructor(e,i,s){this.a=Ei([],e,s),this.b=Ei([],i,s),this.center=s;const a=Ui([],this.a),u=Ui([],this.b);this.angle=Math.acos(Zi(a,u))}}function t0(r,e){if(r.angle===0)return null;let i;return i=r.a[e]===0?1/r.angle*.5*Math.PI:1/r.angle*Math.atan(r.b[e]/r.a[e]/Math.sin(r.angle)-1/Math.tan(r.angle)),i<0||i>1?null:function(s,a,u,h){const m=Math.sin(u);return s*(Math.sin((1-h)*u)/m)+a*(Math.sin(h*u)/m)}(r.a[e],r.b[e],r.angle,Te(i,0,1))+r.center[e]}function ra(r){if(r.z<=1)return Sp[r.z+2*r.y+r.x];const e=i0(e_(r));return xr.fromPoints(e)}function Za(r,e,i){return Ii(r,r,1-i),$r(r,r,e,i)}function iw(r,e,i){for(const s of r)gr(s,s,e),Ii(s,s,i)}function rw(r,e,i,s){const a=e/r.worldSize,u=r.globeMatrix;if(i.z<=1){const ye=ra(i).getCorners();return iw(ye,u,a),xr.fromPoints(ye)}const h=e_(i,s),m=i0(h,f+jl(r._tileCoverLift));iw(m,u,a);const g=Number.MAX_VALUE,v=[-g,-g,-g],w=[g,g,g];if(h.contains(r.center)){for(const Ce of m)pr(w,w,Ce),_r(v,v,Ce);v[2]=0;const ye=r.point,ve=[ye.x*a,ye.y*a,0];return pr(w,w,ve),_r(v,v,ve),new xr(w,v)}if(r._tileCoverLift>0){for(const ye of m)pr(w,w,ye),_r(v,v,ye);return new xr(w,v)}const S=[u[12]*a,u[13]*a,u[14]*a],A=h.getCenter(),D=Te(r.center.lat,-Me,Me),R=Te(A.lat,-Me,Me),O=ae(r.center.lng),$=le(D);let H=O-ae(A.lng);const K=$-le(R);H>.5?H-=1:H<-.5&&(H+=1);let W=0;Math.abs(H)>Math.abs(K)?W=H>=0?1:3:(W=K>=0?0:2,$r(S,S,[u[4]*a,u[5]*a,u[6]*a],-Math.sin(U(K>=0?h.getSouth():h.getNorth()))*f));const F=m[W],q=m[(W+1)%4],Y=new PL(F,q,S),ee=[t0(Y,0)||F[0],t0(Y,1)||F[1],t0(Y,2)||F[2]],he=Vl(r.zoom);if(he>0){const ye=function({x:Ce,y:Ue,z:et},Ye,Qe,ot,je){const Je=1/(1<<et);let Fe=Ce*Je,Ve=Fe+Je,lt=Ue*Je,ut=lt+Je,zt=0;const Et=(Fe+Ve)/2-ot;return Et>.5?zt=-1:Et<-.5&&(zt=1),Fe=((Fe+zt)*Ye-(ot*=Ye))*Qe+ot,Ve=((Ve+zt)*Ye-ot)*Qe+ot,lt=(lt*Ye-(je*=Ye))*Qe+je,ut=(ut*Ye-je)*Qe+je,[[Fe,ut,0],[Ve,ut,0],[Ve,lt,0],[Fe,lt,0]]}(i,e,r._pixelsPerMercatorPixel,O,$);for(let Ce=0;Ce<m.length;Ce++)Za(m[Ce],ye[Ce],he);const ve=vi([],ye[W],ye[(W+1)%4]);Ii(ve,ve,.5),Za(ee,ve,he)}for(const ye of m)pr(w,w,ye),_r(v,v,ye);return w[2]=Math.min(F[2],q[2]),pr(w,w,ee),_r(v,v,ee),new xr(w,v)}function e_({x:r,y:e,z:i},s=!1){const a=1/(1<<i),u=new V(de(r*a),e===(1<<i)-1&&s?-90:me((e+1)*a)),h=new V(de((r+1)*a),e===0&&s?90:me(e*a));return new X(u,h)}function i0(r,e=f){const i=U(r.getNorth()),s=U(r.getSouth()),a=Math.cos(i),u=Math.cos(s),h=Math.sin(i),m=Math.sin(s),g=r.getWest(),v=r.getEast();return[z(u,m,g,e),z(u,m,v,e),z(a,h,v,e),z(a,h,g,e)]}function Ep(r,e,i,s){const a=1<<i.z,u=(r/_t+i.x)/a;return N(me((e/_t+i.y)/a),de(u),s)}function t_({min:r,max:e}){return b/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const nw=new Float64Array(16);function i_(r){const e=t_(r),i=$t(nw,[e,e,e]);return st(i,i,ho([],r.min))}function r0(r){const e=(s=r.min,(i=nw)[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=s[0],i[13]=s[1],i[14]=s[2],i[15]=1,i);var i,s;const a=1/t_(r);return nt(e,e,[a,a,a])}function n0(r){const e=_t/(2*Math.PI);return r/(2*Math.PI)/e}function ow(r,e){return _t/(512*Math.pow(2,r))*t_(ra(e))}function sw(r,e,i,s,a){const u=n0(i),h=[r,e,-i/(2*Math.PI)],m=_e(new Float64Array(16));return st(m,m,h),nt(m,m,[u,u,u]),Xe(m,m,U(-a)),ct(m,m,U(-s)),m}function Vl(r){return Ae(_,y,r)}function aw(r,e){const i=N(e.lat,e.lng),s=function(R){const O=N(R._center.lat,R._center.lng);let $=Lr([],Bt(0,1,0),O);const H=kt([],-R.angle,O);$=gr($,$,H),kt(H,-R._pitch,$);const K=Ui([],O);return Ii(K,K,jl(R.cameraToCenterDistance/R.pixelsPerMeter)),gr(K,K,H),vi([],O,K)}(r);return h=(a=ri([],s,i))[0],m=a[1],g=a[2],v=(u=i)[0],w=u[1],S=u[2],D=(A=Math.sqrt(h*h+m*m+g*g)*Math.sqrt(v*v+w*w+S*S))&&Zi(a,u)/A,Math.acos(Math.min(Math.max(D,-1),1));var a,u,h,m,g,v,w,S,A,D}function o0(r,e){return aw(r,e)>Math.PI/2*1.01}const lw=U(85),DL=Math.cos(lw),RL=Math.sin(lw),zL=Pe(),cw=r=>{const e=[];return r.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),r.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function uw(r,e,i,s,a,u,h,m,g){if(u&&r.queryGeometry.isAboveHorizon)return!1;u&&(g*=r.pixelToTileUnitsFactor);const v=r.tileID.canonical,w=i.projection.upVectorScale(v,i.center.lat,i.worldSize).metersToTile;for(const S of e)for(const A of S){const D=A.add(m),R=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(D.x,D.y,!0):0,O=i.projection.projectTilePoint(D.x,D.y,v);if(R>0){const W=i.projection.upVector(v,D.x,D.y);O.x+=W[0]*w*R,O.y+=W[1]*w*R,O.z+=W[2]*w*R}const $=u?D:LL(O.x,O.y,O.z,s),H=u?r.tilespaceRays.map(W=>OL(W,R)):r.queryGeometry.screenGeometry,K=Dr([],[O.x,O.y,O.z,1],s);if(!h&&u?g*=K[3]/i.cameraToCenterDistance:h&&!u&&(g*=i.cameraToCenterDistance/K[3]),u){const W=me((A.y/_t+v.y)/(1<<v.z));g/=i.projection.pixelsPerMeter(W,1)/ne(1,W)}if(Yt(H,$,g))return!0}return!1}function LL(r,e,i,s){const a=Dr([],[r,e,i,1],s);return new ft(a[0]/a[3],a[1]/a[3])}const hw=Bt(0,0,0),kL=Bt(0,0,1);function OL(r,e){const i=mi();return hw[2]=e,r.intersectsPlane(hw,kL,i),new ft(i[0],i[1])}class dw extends Ct{}let pw,fw,mw,_w;function gw(r,{width:e,height:i},s,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*s)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*s);return r.width=e,r.height=i,r.data=a,r}function yw(r,e,i){const{width:s,height:a}=e;s===r.width&&a===r.height||(s0(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,s),height:Math.min(r.height,a)},i,null),r.width=s,r.height=a,r.data=e.data)}function s0(r,e,i,s,a,u,h,m){if(a.width===0||a.height===0)return e;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||s.x>e.width-a.width||s.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const g=r.data,v=e.data,w=u===4&&m;for(let S=0;S<a.height;S++){const A=((i.y+S)*r.width+i.x)*u,D=((s.y+S)*e.width+s.x)*u;if(w)for(let R=0;R<a.width;R++){const O=A+R*u+3,$=D+R*u;v[$+0]=255,v[$+1]=255,v[$+2]=255,v[$+3]=g[O]}else if(h)for(let R=0;R<a.width;R++){const O=A+R*u,$=D+R*u,H=g[O+3],K=new Fi(g[O+0]/255*H,g[O+1]/255*H,g[O+2]/255*H,H).toRenderColor(h).toArray();v[$+0]=K[0],v[$+1]=K[1],v[$+2]=K[2],v[$+3]=K[3]}else for(let R=0;R<a.width*u;R++)v[D+R]=g[A+R]}return e}Tt(dw,"HeatmapBucket",{omit:["layers"]});class Ul{constructor(e,i){gw(this,e,1,i)}resize(e){yw(this,new Ul(e),1)}clone(){return new Ul({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,u){s0(e,i,s,a,u,1,null)}}class In{constructor(e,i){gw(this,e,4,i)}resize(e){yw(this,new In(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new In({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,u,h,m){s0(e,i,s,a,u,4,h,m)}}class vw{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function Ap(r){const e={},i=r.resolution||256,s=r.clips?r.clips.length:1,a=r.image||new In({width:i,height:s}),u=(h,m,g)=>{e[r.evaluationKey]=g;const v=r.expression.evaluate(e);v&&(a.data[h+m+0]=Math.floor(255*v.r/v.a),a.data[h+m+1]=Math.floor(255*v.g/v.a),a.data[h+m+2]=Math.floor(255*v.b/v.a),a.data[h+m+3]=Math.floor(255*v.a))};if(r.clips)for(let h=0,m=0;h<s;++h,m+=4*i)for(let g=0,v=0;g<i;g++,v+=4){const w=g/(i-1),{start:S,end:A}=r.clips[h];u(m,v,S*(1-w)+A*w)}else for(let h=0,m=0;h<i;h++,m+=4)u(0,m,h/(i-1));return a}Tt(Ul,"AlphaImage"),Tt(In,"RGBAImage");const FL=ki([{name:"a_pos",components:2,type:"Int16"}],4),BL=ki([{name:"a_road_z_offset",components:1,type:"Float32"}],4),NL=ki([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),jL=ki([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function Ip(r,e,i=2){const s=e&&e.length,a=s?e[0]*i:r.length;let u=xw(r,0,a,i,!0);const h=[];if(!u||u.next===u.prev)return h;let m,g,v;if(s&&(u=function(w,S,A,D){const R=[];for(let O=0,$=S.length;O<$;O++){const H=xw(w,S[O]*D,O<$-1?S[O+1]*D:w.length,D,!1);H===H.next&&(H.steiner=!0),R.push(WL(H))}R.sort(HL);for(let O=0;O<R.length;O++)A=qL(R[O],A);return A}(r,e,u,i)),r.length>80*i){m=1/0,g=1/0;let w=-1/0,S=-1/0;for(let A=i;A<a;A+=i){const D=r[A],R=r[A+1];D<m&&(m=D),R<g&&(g=R),D>w&&(w=D),R>S&&(S=R)}v=Math.max(w-m,S-g),v=v!==0?32767/v:0}return Cp(u,h,i,m,g,v,0),h}function xw(r,e,i,s,a){let u;if(a===function(h,m,g,v){let w=0;for(let S=m,A=g-v;S<g;S+=v)w+=(h[A]-h[S])*(h[S+1]+h[A+1]),A=S;return w}(r,e,i,s)>0)for(let h=e;h<i;h+=s)u=Sw(h/s|0,r[h],r[h+1],u);else for(let h=i-s;h>=e;h-=s)u=Sw(h/s|0,r[h],r[h+1],u);return u&&kh(u,u.next)&&(Dp(u),u=u.next),u}function Yc(r,e){if(!r)return r;e||(e=r);let i,s=r;do if(i=!1,s.steiner||!kh(s,s.next)&&_n(s.prev,s,s.next)!==0)s=s.next;else{if(Dp(s),s=e=s.prev,s===s.next)break;i=!0}while(i||s!==e);return e}function Cp(r,e,i,s,a,u,h){if(!r)return;!h&&u&&function(g,v,w,S){let A=g;do A.z===0&&(A.z=a0(A.x,A.y,v,w,S)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==g);A.prevZ.nextZ=null,A.prevZ=null,function(D){let R,O=1;do{let $,H=D;D=null;let K=null;for(R=0;H;){R++;let W=H,F=0;for(let Y=0;Y<O&&(F++,W=W.nextZ,W);Y++);let q=O;for(;F>0||q>0&&W;)F!==0&&(q===0||!W||H.z<=W.z)?($=H,H=H.nextZ,F--):($=W,W=W.nextZ,q--),K?K.nextZ=$:D=$,$.prevZ=K,K=$;H=W}K.nextZ=null,O*=2}while(R>1)}(A)}(r,s,a,u);let m=r;for(;r.prev!==r.next;){const g=r.prev,v=r.next;if(u?UL(r,s,a,u):VL(r))e.push(g.i,r.i,v.i),Dp(r),r=v.next,m=v.next;else if((r=v)===m){h?h===1?Cp(r=$L(Yc(r),e),e,i,s,a,u,2):h===2&&GL(r,e,i,s,a,u):Cp(Yc(r),e,i,s,a,u,1);break}}}function VL(r){const e=r.prev,i=r,s=r.next;if(_n(e,i,s)>=0)return!1;const a=e.x,u=i.x,h=s.x,m=e.y,g=i.y,v=s.y,w=Math.min(a,u,h),S=Math.min(m,g,v),A=Math.max(a,u,h),D=Math.max(m,g,v);let R=s.next;for(;R!==e;){if(R.x>=w&&R.x<=A&&R.y>=S&&R.y<=D&&Mp(a,m,u,g,h,v,R.x,R.y)&&_n(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function UL(r,e,i,s){const a=r.prev,u=r,h=r.next;if(_n(a,u,h)>=0)return!1;const m=a.x,g=u.x,v=h.x,w=a.y,S=u.y,A=h.y,D=Math.min(m,g,v),R=Math.min(w,S,A),O=Math.max(m,g,v),$=Math.max(w,S,A),H=a0(D,R,e,i,s),K=a0(O,$,e,i,s);let W=r.prevZ,F=r.nextZ;for(;W&&W.z>=H&&F&&F.z<=K;){if(W.x>=D&&W.x<=O&&W.y>=R&&W.y<=$&&W!==a&&W!==h&&Mp(m,w,g,S,v,A,W.x,W.y)&&_n(W.prev,W,W.next)>=0||(W=W.prevZ,F.x>=D&&F.x<=O&&F.y>=R&&F.y<=$&&F!==a&&F!==h&&Mp(m,w,g,S,v,A,F.x,F.y)&&_n(F.prev,F,F.next)>=0))return!1;F=F.nextZ}for(;W&&W.z>=H;){if(W.x>=D&&W.x<=O&&W.y>=R&&W.y<=$&&W!==a&&W!==h&&Mp(m,w,g,S,v,A,W.x,W.y)&&_n(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;F&&F.z<=K;){if(F.x>=D&&F.x<=O&&F.y>=R&&F.y<=$&&F!==a&&F!==h&&Mp(m,w,g,S,v,A,F.x,F.y)&&_n(F.prev,F,F.next)>=0)return!1;F=F.nextZ}return!0}function $L(r,e){let i=r;do{const s=i.prev,a=i.next.next;!kh(s,a)&&ww(s,i,i.next,a)&&Pp(s,a)&&Pp(a,s)&&(e.push(s.i,i.i,a.i),Dp(i),Dp(i.next),i=r=a),i=i.next}while(i!==r);return Yc(i)}function GL(r,e,i,s,a,u){let h=r;do{let m=h.next.next;for(;m!==h.prev;){if(h.i!==m.i&&XL(h,m)){let g=Tw(h,m);return h=Yc(h,h.next),g=Yc(g,g.next),Cp(h,e,i,s,a,u,0),void Cp(g,e,i,s,a,u,0)}m=m.next}h=h.next}while(h!==r)}function HL(r,e){let i=r.x-e.x;return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function qL(r,e){const i=function(a,u){let h=u;const m=a.x,g=a.y;let v,w=-1/0;if(kh(a,h))return h;do{if(kh(a,h.next))return h.next;if(g<=h.y&&g>=h.next.y&&h.next.y!==h.y){const O=h.x+(g-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(O<=m&&O>w&&(w=O,v=h.x<h.next.x?h:h.next,O===m))return v}h=h.next}while(h!==u);if(!v)return null;const S=v,A=v.x,D=v.y;let R=1/0;h=v;do{if(m>=h.x&&h.x>=A&&m!==h.x&&bw(g<D?m:w,g,A,D,g<D?w:m,g,h.x,h.y)){const O=Math.abs(g-h.y)/(m-h.x);Pp(h,a)&&(O<R||O===R&&(h.x>v.x||h.x===v.x&&ZL(v,h)))&&(v=h,R=O)}h=h.next}while(h!==S);return v}(r,e);if(!i)return e;const s=Tw(i,r);return Yc(s,s.next),Yc(i,i.next)}function ZL(r,e){return _n(r.prev,r,e.prev)<0&&_n(e.next,r,r.next)<0}function a0(r,e,i,s,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function WL(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function bw(r,e,i,s,a,u,h,m){return(a-h)*(e-m)>=(r-h)*(u-m)&&(r-h)*(s-m)>=(i-h)*(e-m)&&(i-h)*(u-m)>=(a-h)*(s-m)}function Mp(r,e,i,s,a,u,h,m){return!(r===h&&e===m)&&bw(r,e,i,s,a,u,h,m)}function XL(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!function(i,s){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==s.i&&a.next.i!==s.i&&ww(a,a.next,i,s))return!0;a=a.next}while(a!==i);return!1}(r,e)&&(Pp(r,e)&&Pp(e,r)&&function(i,s){let a=i,u=!1;const h=(i.x+s.x)/2,m=(i.y+s.y)/2;do a.y>m!=a.next.y>m&&a.next.y!==a.y&&h<(a.next.x-a.x)*(m-a.y)/(a.next.y-a.y)+a.x&&(u=!u),a=a.next;while(a!==i);return u}(r,e)&&(_n(r.prev,r,e.prev)||_n(r,e.prev,e))||kh(r,e)&&_n(r.prev,r,r.next)>0&&_n(e.prev,e,e.next)>0)}function _n(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function kh(r,e){return r.x===e.x&&r.y===e.y}function ww(r,e,i,s){const a=n_(_n(r,e,i)),u=n_(_n(r,e,s)),h=n_(_n(i,s,r)),m=n_(_n(i,s,e));return a!==u&&h!==m||!(a!==0||!r_(r,i,e))||!(u!==0||!r_(r,s,e))||!(h!==0||!r_(i,r,s))||!(m!==0||!r_(i,e,s))}function r_(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function n_(r){return r>0?1:r<0?-1:0}function Pp(r,e){return _n(r.prev,r,r.next)<0?_n(r,e,r.next)>=0&&_n(r,r.prev,e)>=0:_n(r,e,r.prev)<0||_n(r,r.next,e)<0}function Tw(r,e){const i=l0(r.i,r.x,r.y),s=l0(e.i,e.x,e.y),a=r.next,u=e.prev;return r.next=e,e.prev=r,i.next=a,a.prev=i,s.next=i,i.prev=s,u.next=s,s.prev=u,s}function Sw(r,e,i,s){const a=l0(r,e,i);return s?(a.next=s.next,a.prev=s,s.next.prev=a,s.next=a):(a.prev=a,a.next=a),a}function Dp(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function l0(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function o_(r,e){const i=r.length;if(i<=1)return[r];const s=[];let a,u;for(let h=0;h<i;h++){const m=Li(r[h]);m!==0&&(r[h].area=Math.abs(m),u===void 0&&(u=m<0),u===m<0?(a&&s.push(a),a=[r[h]]):a.push(r[h]))}if(a&&s.push(a),e>1)for(let h=0;h<s.length;h++)s[h].length<=e||(Gs(s[h],e,1,s[h].length-1,YL),s[h]=s[h].slice(0,e));return s}function YL(r,e){return e.area-r.area}function Ew(r,e,i=1){if(!r)return null;const s=typeof r=="string"?Zn.from(r).getPrimary():r.getPrimary(),a=typeof r=="string"?null:r.getSecondary();for(const u of[s,a]){if(!u)continue;const h=u.id.toString();e.has(h)||e.set(h,[]),u.scaleSelf(i),e.get(h).push(u)}return{primary:s.toString(),secondary:a?a.toString():null}}function c0(r,e,i,s){const a=s.patternDependencies;let u=!1;for(const h of e){const m=h.paint.get(`${r}-pattern`);m.isConstant()||(u=!0),Ew(m.constantOr(null),a,i)&&(u=!0)}return u}function u0(r,e,i,s,a,u){const h=u.patternDependencies;for(const m of e){const g=m.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let v=g.evaluate({zoom:s},i,{},u.availableImages);v=v&&v.name?v.name:v;const w=Ew(v,h,a);if(!w)continue;const{primary:S,secondary:A}=w;S&&(i.patterns[m.id]=[S,A].filter(Boolean))}}return i}var h0,Aw,d0,Iw,p0,Cw,Mw,s_={};function Pw(){if(Aw)return h0;Aw=1;var r=lc();function e(a,u,h,m,g){this.properties={},this.extent=h,this.type=0,this._pbf=a,this._geometry=-1,this._keys=m,this._values=g,a.readFields(i,this,u)}function i(a,u,h){a==1?u.id=h.readVarint():a==2?function(m,g){for(var v=m.readVarint()+m.pos;m.pos<v;){var w=g._keys[m.readVarint()],S=g._values[m.readVarint()];g.properties[w]=S}}(h,u):a==3?u.type=h.readVarint():a==4&&(u._geometry=h.pos)}function s(a){for(var u,h,m=0,g=0,v=a.length,w=v-1;g<v;w=g++)m+=((h=a[w]).x-(u=a[g]).x)*(u.y+h.y);return m}return h0=e,e.types=["Unknown","Point","LineString","Polygon"],e.prototype.loadGeometry=function(){var a=this._pbf;a.pos=this._geometry;for(var u,h=a.readVarint()+a.pos,m=1,g=0,v=0,w=0,S=[];a.pos<h;){if(g<=0){var A=a.readVarint();m=7&A,g=A>>3}if(g--,m===1||m===2)v+=a.readSVarint(),w+=a.readSVarint(),m===1&&(u&&S.push(u),u=[]),u.push(new r(v,w));else{if(m!==7)throw new Error("unknown command "+m);u&&u.push(u[0].clone())}}return u&&S.push(u),S},e.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var u=a.readVarint()+a.pos,h=1,m=0,g=0,v=0,w=1/0,S=-1/0,A=1/0,D=-1/0;a.pos<u;){if(m<=0){var R=a.readVarint();h=7&R,m=R>>3}if(m--,h===1||h===2)(g+=a.readSVarint())<w&&(w=g),g>S&&(S=g),(v+=a.readSVarint())<A&&(A=v),v>D&&(D=v);else if(h!==7)throw new Error("unknown command "+h)}return[w,A,S,D]},e.prototype.toGeoJSON=function(a,u,h){var m,g,v=this.extent*Math.pow(2,h),w=this.extent*a,S=this.extent*u,A=this.loadGeometry(),D=e.types[this.type];function R(H){for(var K=0;K<H.length;K++){var W=H[K];H[K]=[360*(W.x+w)/v-180,360/Math.PI*Math.atan(Math.exp((180-360*(W.y+S)/v)*Math.PI/180))-90]}}switch(this.type){case 1:var O=[];for(m=0;m<A.length;m++)O[m]=A[m][0];R(A=O);break;case 2:for(m=0;m<A.length;m++)R(A[m]);break;case 3:for(A=function(H){var K=H.length;if(K<=1)return[H];for(var W,F,q=[],Y=0;Y<K;Y++){var ee=s(H[Y]);ee!==0&&(F===void 0&&(F=ee<0),F===ee<0?(W&&q.push(W),W=[H[Y]]):W.push(H[Y]))}return W&&q.push(W),q}(A),m=0;m<A.length;m++)for(g=0;g<A[m].length;g++)R(A[m][g])}A.length===1?A=A[0]:D="Multi"+D;var $={type:"Feature",geometry:{type:D,coordinates:A},properties:this.properties};return"id"in this&&($.id=this.id),$},h0}function Dw(){if(Iw)return d0;Iw=1;var r=Pw();function e(s,a){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=s,this._keys=[],this._values=[],this._features=[],s.readFields(i,this,a),this.length=this._features.length}function i(s,a,u){s===15?a.version=u.readVarint():s===1?a.name=u.readString():s===5?a.extent=u.readVarint():s===2?a._features.push(u.pos):s===3?a._keys.push(u.readString()):s===4&&a._values.push(function(h){for(var m=null,g=h.readVarint()+h.pos;h.pos<g;){var v=h.readVarint()>>3;m=v===1?h.readString():v===2?h.readFloat():v===3?h.readDouble():v===4?h.readVarint64():v===5?h.readVarint():v===6?h.readSVarint():v===7?h.readBoolean():null}return m}(u))}return d0=e,e.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var a=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,a,this.extent,this._keys,this._values)},d0}function Rw(){return Mw||(Mw=1,s_.VectorTile=function(){if(Cw)return p0;Cw=1;var r=Dw();function e(i,s,a){if(i===3){var u=new r(a,a.readVarint()+a.pos);u.length&&(s[u.name]=u)}}return p0=function(i,s){this.layers=i.readFields(e,{},s)},p0}(),s_.VectorTileFeature=Pw(),s_.VectorTileLayer=Dw()),s_}var $l=Rw();const Kc="3d_elevation_id",zw="level";class KL{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,s){return this.get(e,!0,i,s)}optional(e,i,s){return this.get(e,!1,i,s)}success(){return this._valid}get(e,i,s,a){const u=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&u!==void 0&&!Number.isNaN(u)?s(a?a(u):u):i&&(this._valid=!1),this}}class Lw{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,s){return this.featureFunc(e,i,s)}parseVertex(e,i,s){return this.vertexFunc(e,i,s)}}const JL=new Lw((r,e,i)=>r.reset(e).require(Kc,s=>{i.id=s}).optional("fixed_height_relative",s=>{i.constantHeight=s},Jc.decodeRelativeHeight).geometry(s=>{i.bounds=s},Cd).success(),(r,e,i)=>r.reset(e).require(Kc,s=>{i.id=s}).require("elevation_idx",s=>{i.idx=s}).require("extent",s=>{i.extent=s}).require("height_relative",s=>{i.height=s},Jc.decodeRelativeHeight).geometry(s=>{i.position=s},Jc.getPoint).success()),QL=new Lw((r,e,i)=>r.reset(e).require(Kc,s=>{i.id=s}).optional("fixed_height",s=>{i.constantHeight=s},Jc.decodeMetricHeight).geometry(s=>{i.bounds=s},Cd).success(),(r,e,i)=>r.reset(e).require(Kc,s=>{i.id=s}).require("elevation_idx",s=>{i.idx=s}).require("extent",s=>{i.extent=s}).require("height",s=>{i.height=s},Jc.decodeMetricHeight).geometry(s=>{i.position=s},Jc.getPoint).success());class Jc{static getPoint(e){return ga(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static parse(e){const i=[],s=[],a=e.length,u=new KL;for(let m=0;m<a;m++){const g=e.feature(m),v=g.properties.hasOwnProperty("version")?String(g.properties.version):void 0,w=(h=v)?h==="1.0.1"?QL:void 0:JL;if(w===void 0){yi(`Unknown elevation feature version number ${v||"(unknown)"}`);continue}const S=g.properties.hasOwnProperty("type")?g.properties.type:void 0;if(S){if($l.VectorTileFeature.types[g.type]==="Point"&&S==="curve_point"){const A={};w.parseVertex(u,g,A)&&i.push(A)}else if($l.VectorTileFeature.types[g.type]==="Polygon"&&S==="curve_meta"){const A={};w.parseFeature(u,g,A)&&s.push(A)}}}var h;return{vertices:i,features:s}}}class kw{constructor(e,i){this.feature=e,this.metersToTile=i,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,s=i[1],a=-i[0],u=(e.extent+1)*this.metersToTile;return[new ft(Math.trunc(e.position[0]+s*u),Math.trunc(e.position[1]+a*u)),new ft(Math.trunc(e.position[0]-s*u),Math.trunc(e.position[1]-a*u))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class f0{constructor(e,i,s,a,u,h){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:s,max:s},this.safeArea=i,this.constantHeight=s,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=u,this.edges=this.edges.filter(m=>{return m.a<this.vertices.length&&m.b<this.vertices.length&&!((g=this.vertices[m.a].position)[0]===(v=this.vertices[m.b].position)[0]&&g[1]===v[1]);var g,v}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const m of this.vertices)this.vertexProps.push({dir:ga(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,m.height),this.heightRange.max=Math.max(this.heightRange.max,m.height);for(const m of this.edges){const g=this.vertices[m.a].position,v=this.vertices[m.b].position,w=qo(Hn(),v,g),S=va(w),A=ya(Hn(),w,1/S);this.edgeProps.push({vec:w,dir:A,len:S});const D=this.vertexProps[m.a].dir,R=this.vertexProps[m.b].dir;Bs(D,D,A),Bs(R,R,A)}for(const m of this.vertexProps)m.dir[0]===0&&m.dir[1]===0||sc(m.dir,m.dir);this.tessellate(h)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[s,a]=i;return((u,h,m)=>(1-m)*u+m*h)(this.vertices[this.edges[s].a].height,this.vertices[this.edges[s].b].height,a)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,s=Number.POSITIVE_INFINITY,a=0;const u=ga(e.x,e.y);for(let h=0;h<this.edges.length;h++){const m=this.edges[h],g=this.edgeProps[h].dir,v=new es(u,this.edgeProps[h].dir),w=this.vertices[m.a].position,S=this.vertices[m.b].position,A=Hn(),D=Hn(),R=v.intersectsPlane(w,this.vertexProps[m.a].dir,A),O=v.intersectsPlane(S,this.vertexProps[m.b].dir,D);if(!R||!O)continue;const $=qo(Hn(),D,A),H=qo(Hn(),u,A),K=Ar($,$),W=K>0?Ar(H,$)/K:0,F=Te(W,0,1),q=Math.abs((W-F)*this.edgeProps[h].len),Y=qo(Hn(),u,w),ee=q+Math.abs(Ar(Y,ga(g[1],-g[0])));ee<s&&(i=h,s=ee,a=F)}return[i,a]}tessellate(e){for(let i=this.edges.length-1;i>=0;--i){const s=this.edges[i].a,a=this.edges[i].b,{position:u,height:h,extent:m}=this.vertices[s],{position:g,height:v,extent:w}=this.vertices[a],S=this.vertexProps[s].dir,A=this.vertexProps[a].dir,D=Bt(u[0]/e,u[1]/e,h),R=Bt(g[0]/e,g[1]/e,v),O=Bt(S[1],-S[0],0);Ii(O,O,m);const $=Bt(A[1],-A[0],0);if(Ii($,$,w),this.distSqLines(Bt(D[0]+.5*O[0],D[1]+.5*O[1],D[2]+.5*O[2]),Bt(R[0]-.5*$[0],R[1]-.5*$[1],R[2]-.5*$[2]),Bt(D[0]-.5*O[0],D[1]-.5*O[1],D[2]-.5*O[2]),Bt(R[0]+.5*$[0],R[1]+.5*$[1],R[2]+.5*$[2]))<=.0025000000000000005)continue;const H=this.vertices.length,K=Bs(Hn(),u,g);this.vertices.push({position:ya(K,K,.5),height:.5*(h+v),extent:.5*(m+w)});const W=Bs(Hn(),S,A);this.vertexProps.push({dir:sc(W,W)}),this.edges.splice(i,1),this.edgeProps.splice(i,1),this.edges.push({a:s,b:H}),this.edges.push({a:H,b:a});const F=qo(Hn(),this.vertices[H].position,u),q=va(F),Y={vec:F,dir:ya(Hn(),F,1/q),len:q};this.edgeProps.push(Y),this.edgeProps.push(Y)}}distSqLines(e,i,s,a){const u=ri(mi(),i,e),h=ri(mi(),a,s),m=ri(mi(),e,s),g=Zi(u,u),v=Zi(u,h),w=Zi(u,m),S=Zi(h,h),A=Zi(h,m),D=g*S-v*v;if(D===0){const $=Zi(m,h)/Zi(h,h);return gn(Uo(mi(),s,a,$),e)}const R=(v*A-w*S)/D,O=(g*A-v*w)/D;return gn(Uo(mi(),e,i,R),Uo(mi(),s,a,O))}}class m0{static parseFrom(e,i){const s=Jc.parse(e);if(!s)return[];let{vertices:a,features:u}=s;const h=1/De(i);u.sort((w,S)=>w.id-S.id),a.sort((w,S)=>w.id-S.id||w.idx-S.idx),a=a.filter((w,S,A)=>S===A.findIndex(D=>D.id===w.id&&D.idx===w.idx));const m=new Array;let g=0;const v=a.length;for(const w of u){if(w.constantHeight){m.push(new f0(w.id,w.bounds,w.constantHeight));continue}for(;g!==v&&a[g].id<w.id;)g++;if(g===v||a[g].id!==w.id)continue;const S=new Array,A=new Array,D=g;for(;g!==v&&a[g].id===w.id;){const R=a[g];if(S.push({position:R.position,height:R.height,extent:R.extent}),g!==D&&a[g-1].idx===R.idx-1){const O=g-D;A.push({a:O-1,b:O})}g++}m.push(new f0(w.id,w.bounds,void 0,S,A,h))}return m}static getElevationFeature(e,i){if(!i)return;const s=+e.properties[Kc];return Number.isNaN(s)?void 0:i.find(a=>a.id===s)}}class Ow{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*_t,this.yOffset=(e.y*this.zScale-i.y)*_t)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,s){const a=this.constantElevation(i,s);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),s))}computeBiasedHeight(e,i){return i<=0?e:e+i*Ae(0,i,e>=0?e:Math.abs(.5*e))}}Tt(f0,"ElevationFeature");class Fw{constructor(){this.polygons=new Map}add(e,...i){this.polygons.has(e)?this.polygons.get(e).push(...i):this.polygons.set(e,i)}merge(e){for(const[i,s]of e.polygons)this.add(i,...s)}}class Qc{constructor(){this.portals=[]}static evaluate(e){if(e.length===0)return new Qc;let i=[];for(const v of e)i.push(...v.portals);if(i.length===0)return new Qc;const s=(v,w)=>v<=0&&w<=0||v>=_t&&w>=_t;for(const v of i){const w=v.va,S=v.vb;(s(w.x,S.x)||s(w.y,S.y))&&(v.type="border")}const a=i.filter(v=>v.type!=="unevaluated"),u=i.filter(v=>v.type==="unevaluated");if(u.length===0)return new Qc;u.sort((v,w)=>v.hash===w.hash?v.isTunnel===w.isTunnel?0:v.isTunnel?-1:1:v.hash<w.hash?1:-1),i=a.concat(u);let h=a.length,m=h,g=h;do if(m++,m===i.length||i[h].hash!==i[m].hash){if(m-h==2){g<h&&(i[g]=i[h],i[h]=null);const v=i[g],w=i[m-1];v.type=v.isTunnel!==w.isTunnel?"tunnel":"polygon",v.connection={a:v.connection.a,b:w.connection.a},g++}h=m}while(h!==i.length);return i.splice(g),i.sort((v,w)=>v.hash<w.hash?1:-1),{portals:i}}}Tt(Qc,"ElevationPortalGraph"),Tt(Fw,"ElevationPolygons");class e3{constructor(e,i,s){this.outPositions=e,this.outNormals=i,this.outIndices=s,this.vertexLookup=new Map,this.buffer=new ArrayBuffer(4),this.view=new DataView(this.buffer)}addVertex(e,i,s){let a=e[2];s!=null&&(a*=s);const u=this.getVec3Bits(e)<<96n|this.getVec3Bits(i),h=this.vertexLookup.get(u);if(h!=null)return h;const m=this.outPositions.length;this.vertexLookup.set(u,m);const g=Math.trunc(16384*i[0]),v=Math.trunc(16384*i[1]),w=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(g,v,w),m}addVertices(e,i,...s){const a=[];for(const u of s){const h=this.addVertex(u,e,i);a.push(h)}return a}addTriangles(e,i,s){if(i&&s){const a=s.length===1,u=Bt(0,0,0);for(let h=0;h<e.length;h+=3){const m=i[e[h+0]],g=i[e[h+1]],v=i[e[h+2]],w=a?s[0]:s[e[h+1]],S=a?s[0]:s[e[h+2]],A=this.addVertex(Bt(m.x,m.y,a?s[0]:s[e[h+0]]),u),D=this.addVertex(Bt(g.x,g.y,w),u),R=this.addVertex(Bt(v.x,v.y,S),u);this.outIndices.emplaceBack(A,D,R)}}else for(let a=0;a<e.length;a+=3)this.outIndices.emplaceBack(e[a+0],e[a+1],e[a+2])}addQuad(e,i){const s=this.addVertices(i,void 0,...e.map(g=>Bt(g.coord.x,g.coord.y,g.height))),[a,u,h,m]=s;this.addTriangles([a,u,h,h,m,a])}getBits(e){return this.view.setFloat32(0,e),BigInt(this.view.getUint32(0))}getVec3Bits(e){return this.getBits(e[0])<<64n|this.getBits(e[1])<<32n|this.getBits(e[2])}}class wo{constructor(e){this.unevaluatedPortals=new Qc,this.portalPolygons=new Fw,this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new Th,this.vertexNormals=new zl,this.indexArray=new fn,this.tileToMeters=De(e)}addVertices(e,i){const s=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return s}addTriangles(e,i,s){const a=s?this.unevalTunnelTriangles:this.unevalTriangles;for(const u of e)a.push(u+i)}addRenderableRing(e,i,s,a,u){const h=[new ft(u.min.x,u.min.y),new ft(u.max.x,u.min.y),new ft(u.max.x,u.max.y),new ft(u.min.x,u.max.y)];for(let m=0;m<s-1;m++){const g=i+m,v=g+1,w=this.unevalVertices[g],S=this.unevalVertices[v];if(!(w.x>=u.min.x&&w.x<=u.max.x&&w.y>=u.min.y&&w.y<=u.max.y||S.x>=u.min.x&&S.x<=u.max.x&&S.y>=u.min.y&&S.y<=u.max.y||jr(w,S,h))||this.isOnBorder(w.x,S.x)||this.isOnBorder(w.y,S.y))continue;const A=wo.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[v]);let D,R=this.vertexHashLookup.get(wo.computePosHash(w));R!=null?D=R.next:(R=this.vertexHashLookup.get(wo.computePosHash(S)),D=R!=null?R.prev:A),this.unevalEdges.push({polygonIdx:e,a:g,b:v,hash:A,portalHash:D,isTunnel:a,type:"unevaluated"})}}addPortalCandidates(e,i,s,a,u){if(i.length===0)return;this.portalPolygons.add(e,{geometry:i,zLevel:u});const h=i[0];this.vertexHashLookup.clear();let m=wo.computeEdgeHash(h[h.length-2],h[h.length-1]);for(let g=0;g<h.length-1;g++){const v=h[g+0],w=h[g+1],S=ga(w.x-v.x,w.y-v.y),A=va(S);if(A===0)continue;let D="unevaluated";const R=a.pointElevation(v),O=a.pointElevation(w);Math.abs(R)<.01&&Math.abs(O)<.01?D="entrance":(this.isOnBorder(v.x,w.x)||this.isOnBorder(v.y,w.y))&&(D="border");const $=wo.computeEdgeHash(v,w);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:v,vb:w,vab:S,length:A,hash:$,isTunnel:s,type:D});const H=wo.computePosHash(v);this.vertexHashLookup.set(H,{prev:m,next:$}),m=$}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),s=S=>{S.primitiveLength=this.indexArray.length-S.primitiveOffset},a=new e3(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const u=i(),h=i(),m=i(),g=(S,A)=>{S.sort((R,O)=>R.type===A&&O.type!==A?-1:R.type!==A&&O.type===A?1:0);const D=S.findIndex(R=>R.type!==A);return D>=0?D:S.length};let v=0;this.unevalEdges.length>0&&(v=g(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:v},this.tileToMeters));const w=i();if(this.unevalEdges.length>0){const S=this.unevalEdges.splice(v),A=g(S,"tunnel")+v;this.unevalEdges.push(...S),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:v},{min:v,max:A})}s(m),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),s(w),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),s(h),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),s(u),this.maskSegments=Cr.simpleSegment(0,w.primitiveOffset,0,w.primitiveLength),this.depthSegments=Cr.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.renderableSegments=Cr.simpleSegment(0,m.primitiveOffset,0,m.primitiveLength),this.shadowCasterSegments=Cr.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,NL.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,jL.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableSegments.destroy(),this.shadowCasterSegments.destroy())}computeVertexConnections(e,i,s,a,u){const h=new Map;for(let m=a;m<u;m++){const g=s[m],v=g.a,w=g.b,S=wo.computePosHash(e[v]),A=wo.computePosHash(e[w]);h.has(S)||h.set(S,{}),h.has(A)||h.set(A,{});const D=h.get(S),R=h.get(A);i[v]<=0&&i[w]<=0||(D.to=w,R.from=v)}return h}constructBridgeStructures(e,i,s,a,u,h){const m=this.computeVertexConnections(i,s,a,u.min,u.max),g=1/h,v=.5*g,w=A=>Bt(i[A].x,i[A].y,s[A]*g),S=A=>{const D=m.get(wo.computePosHash(i[A])),R=D.from,O=D.to;if(!R||!O)return;const $=w(R),H=w(A),K=w(O),W=Bt(0,0,0);if(!Qi($,H)){const q=Ei(mi(),H,$);vi(W,W,Ui(q,q))}if(!Qi(K,H)){const q=Ei(mi(),K,H);vi(W,W,Ui(q,q))}const F=wr(W);return F>0?Ii(W,W,1/F):void 0};for(let A=u.min;A<u.max;A++){const D=a[A],R=this.prepareEdgePoints(i,s,D,(at,Xt)=>at>Xt);if(R==null)continue;const O=R[0],$=R[1],H=Bt(O.coord.x,O.coord.y,g*O.height),K=Bt($.coord.x,$.coord.y,g*$.height);if(Qi(H,K))continue;const W=Ei(mi(),K,H);Ui(W,W);const F=at=>Ui(at,at),q=S(D.a)||W,Y=S(D.b)||W,ee=F(Bt(q[1],-q[0],0)),he=F(Bt(Y[1],-Y[0],0)),ye=F(Lr(mi(),ee,q)),ve=F(Lr(mi(),he,Y)),Ce=mi(),Ue=[vi(mi(),H,Ii(Ce,Ei(Ce,ee,ye),v)),vi(mi(),H,Ii(Ce,vi(Ce,ee,ye),v)),vi(mi(),H,Ii(Ce,ye,v)),H],et=[vi(mi(),K,Ii(Ce,Ei(Ce,he,ve),v)),vi(mi(),K,Ii(Ce,vi(Ce,he,ve),v)),vi(mi(),K,Ii(Ce,ve,v)),K],[Ye,Qe]=e.addVertices(ee,h,Ue[0],Ue[1]),[ot,je]=e.addVertices(he,h,et[0],et[1]);e.addTriangles([Ye,Qe,ot,Qe,je,ot]);const[Je,Fe]=e.addVertices(ye,h,Ue[1],Ue[2]),[Ve,lt]=e.addVertices(ve,h,et[1],et[2]);e.addTriangles([Je,Fe,Ve,Fe,lt,Ve]);const[ut,zt]=e.addVertices(ho(ee,ee),h,Ue[2],Ue[3]),[Et,gt]=e.addVertices(ho(he,he),h,et[2],et[3]);e.addTriangles([ut,zt,Et,zt,gt,Et])}}constructTunnelStructures(e,i,s,a,u,h){const m=g=>Ui(g,g);for(let g=u.min;g<u.max;g++){const v=this.prepareEdgePoints(i,s,a[g],(D,R)=>D<R);if(v==null)continue;const[w,S]=v,A=m(Bt(S.coord.y-w.coord.y,-(S.coord.x-w.coord.x),0));e.addQuad([w,S,{coord:S.coord,height:a[g].isTunnel?-.1:0},{coord:w.coord,height:a[g].isTunnel?-.1:0}],A)}for(let g=h.min;g<h.max;g++){const v=a[g],w=i[v.a],S=i[v.b],A=m(Bt(S.y-w.y,-(S.x-w.x),0));e.addQuad([{coord:S,height:0},{coord:w,height:0},{coord:w,height:s[v.a]+4},{coord:S,height:s[v.b]+4}],A),e.addQuad([{coord:w,height:0},{coord:S,height:0},{coord:S,height:s[v.b]+4},{coord:w,height:s[v.a]+4}],A)}}prepareEdgePoints(e,i,s,a){let u=i[s.a],h=i[s.b];const m=a(u,0),g=a(h,0);if(m&&g)return[{coord:e[s.a],height:u},{coord:e[s.b],height:h}];if(!m&&!g)return;const v=e[s.a].clone(),w=e[s.b].clone();if(m){if(!g){const S=h/(h-u);w.x=Nt(w.x,v.x,S),w.y=Nt(w.y,v.y,S),h=Nt(h,u,S)}}else{const S=u/(u-h);v.x=Nt(v.x,w.x,S),v.y=Nt(v.y,w.y,S),u=Nt(u,h,S)}return[{coord:v,height:u},{coord:w,height:h}]}prepareEdges(e,i){if(i.length===0)return;i.sort((m,g)=>m.hash===g.hash?g.polygonIdx-m.polygonIdx:g.hash>m.hash?1:-1);let s=0,a=0,u=0,h=i[s].polygonIdx;do a++,(a===i.length||i[s].hash!==i[a].hash)&&((a-s==1||i[a-1].polygonIdx!==h)&&(u<s&&(i[u]=i[s],i[s]=null),i[u].type="none",u++),s=a,s!==i.length&&(h=i[s].polygonIdx));while(s!==i.length);if(i.splice(u),i.length!==0&&e.length!==0){i.sort((v,w)=>v.portalHash<w.portalHash?1:-1);let m=0,g=0;for(;m!==i.length&&g!==e.length;){const v=i[m],w=e[g];v.portalHash>w.hash?m++:w.hash>v.portalHash?g++:(v.type=w.type,m++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=_t&&i>=_t}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(wo.computePosHash(e))<<32n|BigInt(wo.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}var Bw,Nw={exports:{}},jw=(Bw||(Bw=1,function(r,e){(function(i){function s(J,te){return J>te?1:J<te?-1:0}var a=function(J,te){J===void 0&&(J=s),te===void 0&&(te=!1),this._compare=J,this._root=null,this._size=0,this._noDuplicates=!!te},u={size:{configurable:!0}};function h(J,te,Ge,pt,vt){var yt=vt-pt;if(yt>0){var Dt=pt+Math.floor(yt/2),Gt={key:te[Dt],data:Ge[Dt],parent:J};return Gt.left=h(Gt,te,Ge,pt,Dt),Gt.right=h(Gt,te,Ge,Dt+1,vt),Gt}return null}function m(J,te,Ge,pt,vt){if(!(Ge>=pt)){for(var yt=J[Ge+pt>>1],Dt=Ge-1,Gt=pt+1;;){do Dt++;while(vt(J[Dt],yt)<0);do Gt--;while(vt(J[Gt],yt)>0);if(Dt>=Gt)break;var wi=J[Dt];J[Dt]=J[Gt],J[Gt]=wi,wi=te[Dt],te[Dt]=te[Gt],te[Gt]=wi}m(J,te,Ge,Gt,vt),m(J,te,Gt+1,pt,vt)}}a.prototype.rotateLeft=function(J){var te=J.right;te&&(J.right=te.left,te.left&&(te.left.parent=J),te.parent=J.parent),J.parent?J===J.parent.left?J.parent.left=te:J.parent.right=te:this._root=te,te&&(te.left=J),J.parent=te},a.prototype.rotateRight=function(J){var te=J.left;te&&(J.left=te.right,te.right&&(te.right.parent=J),te.parent=J.parent),J.parent?J===J.parent.left?J.parent.left=te:J.parent.right=te:this._root=te,te&&(te.right=J),J.parent=te},a.prototype._splay=function(J){for(;J.parent;){var te=J.parent;te.parent?te.left===J&&te.parent.left===te?(this.rotateRight(te.parent),this.rotateRight(te)):te.right===J&&te.parent.right===te?(this.rotateLeft(te.parent),this.rotateLeft(te)):te.left===J&&te.parent.right===te?(this.rotateRight(te),this.rotateLeft(te)):(this.rotateLeft(te),this.rotateRight(te)):te.left===J?this.rotateRight(te):this.rotateLeft(te)}},a.prototype.splay=function(J){for(var te,Ge,pt,vt,yt;J.parent;)(Ge=(te=J.parent).parent)&&Ge.parent?((pt=Ge.parent).left===Ge?pt.left=J:pt.right=J,J.parent=pt):(J.parent=null,this._root=J),vt=J.left,yt=J.right,J===te.left?(Ge&&(Ge.left===te?(te.right?(Ge.left=te.right,Ge.left.parent=Ge):Ge.left=null,te.right=Ge,Ge.parent=te):(vt?(Ge.right=vt,vt.parent=Ge):Ge.right=null,J.left=Ge,Ge.parent=J)),yt?(te.left=yt,yt.parent=te):te.left=null,J.right=te,te.parent=J):(Ge&&(Ge.right===te?(te.left?(Ge.right=te.left,Ge.right.parent=Ge):Ge.right=null,te.left=Ge,Ge.parent=te):(yt?(Ge.left=yt,yt.parent=Ge):Ge.left=null,J.right=Ge,Ge.parent=J)),vt?(te.right=vt,vt.parent=te):te.right=null,J.left=te,te.parent=J)},a.prototype.replace=function(J,te){J.parent?J===J.parent.left?J.parent.left=te:J.parent.right=te:this._root=te,te&&(te.parent=J.parent)},a.prototype.minNode=function(J){if(J===void 0&&(J=this._root),J)for(;J.left;)J=J.left;return J},a.prototype.maxNode=function(J){if(J===void 0&&(J=this._root),J)for(;J.right;)J=J.right;return J},a.prototype.insert=function(J,te){var Ge=this._root,pt=null,vt=this._compare;if(this._noDuplicates)for(;Ge;){if(pt=Ge,vt(Ge.key,J)===0)return;Ge=vt(Ge.key,J)<0?Ge.right:Ge.left}else for(;Ge;)pt=Ge,Ge=vt(Ge.key,J)<0?Ge.right:Ge.left;return Ge={key:J,data:te,left:null,right:null,parent:pt},pt?vt(pt.key,Ge.key)<0?pt.right=Ge:pt.left=Ge:this._root=Ge,this.splay(Ge),this._size++,Ge},a.prototype.find=function(J){for(var te=this._root,Ge=this._compare;te;){var pt=Ge(te.key,J);if(pt<0)te=te.right;else{if(!(pt>0))return te;te=te.left}}return null},a.prototype.contains=function(J){for(var te=this._root,Ge=this._compare;te;){var pt=Ge(J,te.key);if(pt===0)return!0;te=pt<0?te.left:te.right}return!1},a.prototype.remove=function(J){var te=this.find(J);if(!te)return!1;if(this.splay(te),te.left)if(te.right){var Ge=this.minNode(te.right);Ge.parent!==te&&(this.replace(Ge,Ge.right),Ge.right=te.right,Ge.right.parent=Ge),this.replace(te,Ge),Ge.left=te.left,Ge.left.parent=Ge}else this.replace(te,te.left);else this.replace(te,te.right);return this._size--,!0},a.prototype.removeNode=function(J){if(!J)return!1;if(this.splay(J),J.left)if(J.right){var te=this.minNode(J.right);te.parent!==J&&(this.replace(te,te.right),te.right=J.right,te.right.parent=te),this.replace(J,te),te.left=J.left,te.left.parent=te}else this.replace(J,J.left);else this.replace(J,J.right);return this._size--,!0},a.prototype.erase=function(J){var te=this.find(J);if(te){this.splay(te);var Ge=te.left,pt=te.right,vt=null;Ge&&(Ge.parent=null,vt=this.maxNode(Ge),this.splay(vt),this._root=vt),pt&&(Ge?vt.right=pt:this._root=pt,pt.parent=vt),this._size--}},a.prototype.pop=function(){var J=this._root,te=null;if(J){for(;J.left;)J=J.left;te={key:J.key,data:J.data},this.remove(J.key)}return te},a.prototype.next=function(J){var te=J;if(te)if(te.right)for(te=te.right;te&&te.left;)te=te.left;else for(te=J.parent;te&&te.right===J;)J=te,te=te.parent;return te},a.prototype.prev=function(J){var te=J;if(te)if(te.left)for(te=te.left;te&&te.right;)te=te.right;else for(te=J.parent;te&&te.left===J;)J=te,te=te.parent;return te},a.prototype.forEach=function(J){for(var te=this._root,Ge=[],pt=!1,vt=0;!pt;)te?(Ge.push(te),te=te.left):Ge.length>0?(J(te=Ge.pop(),vt++),te=te.right):pt=!0;return this},a.prototype.range=function(J,te,Ge,pt){for(var vt=[],yt=this._compare,Dt=this._root;vt.length!==0||Dt;)if(Dt)vt.push(Dt),Dt=Dt.left;else{if(yt((Dt=vt.pop()).key,te)>0)break;if(yt(Dt.key,J)>=0&&Ge.call(pt,Dt))return this;Dt=Dt.right}return this},a.prototype.keys=function(){for(var J=this._root,te=[],Ge=[],pt=!1;!pt;)J?(te.push(J),J=J.left):te.length>0?(J=te.pop(),Ge.push(J.key),J=J.right):pt=!0;return Ge},a.prototype.values=function(){for(var J=this._root,te=[],Ge=[],pt=!1;!pt;)J?(te.push(J),J=J.left):te.length>0?(J=te.pop(),Ge.push(J.data),J=J.right):pt=!0;return Ge},a.prototype.at=function(J){for(var te=this._root,Ge=[],pt=!1,vt=0;!pt;)if(te)Ge.push(te),te=te.left;else if(Ge.length>0){if(te=Ge.pop(),vt===J)return te;vt++,te=te.right}else pt=!0;return null},a.prototype.load=function(J,te,Ge){if(J===void 0&&(J=[]),te===void 0&&(te=[]),Ge===void 0&&(Ge=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var pt=J.length;return Ge&&m(J,te,0,pt-1,this._compare),this._root=h(null,J,te,0,pt),this._size=pt,this},a.prototype.min=function(){var J=this.minNode(this._root);return J?J.key:null},a.prototype.max=function(){var J=this.maxNode(this._root);return J?J.key:null},a.prototype.isEmpty=function(){return this._root===null},u.size.get=function(){return this._size},a.createTree=function(J,te,Ge,pt,vt){return new a(Ge,vt).load(J,te,pt)},Object.defineProperties(a.prototype,u);var g=0,v=1,w=2,S=3,A=0,D=1,R=2,O=3;function $(J,te,Ge){te===null?(J.inOut=!1,J.otherInOut=!0):(J.isSubject===te.isSubject?(J.inOut=!te.inOut,J.otherInOut=te.otherInOut):(J.inOut=!te.otherInOut,J.otherInOut=te.isVertical()?!te.inOut:te.inOut),te&&(J.prevInResult=!H(te,Ge)||te.isVertical()?te.prevInResult:te));var pt=H(J,Ge);J.resultTransition=pt?function(vt,yt){var Dt,Gt=!vt.inOut,wi=!vt.otherInOut;switch(yt){case A:Dt=Gt&&wi;break;case D:Dt=Gt||wi;break;case O:Dt=Gt^wi;break;case R:Dt=vt.isSubject?Gt&&!wi:wi&&!Gt}return Dt?1:-1}(J,Ge):0}function H(J,te){switch(J.type){case g:switch(te){case A:return!J.otherInOut;case D:return J.otherInOut;case R:return J.isSubject&&J.otherInOut||!J.isSubject&&!J.otherInOut;case O:return!0}break;case w:return te===A||te===D;case S:return te===R;case v:return!1}return!1}var K=function(J,te,Ge,pt,vt){this.left=te,this.point=J,this.otherEvent=Ge,this.isSubject=pt,this.type=vt||g,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},W={inResult:{configurable:!0}};function F(J,te){return J[0]===te[0]&&J[1]===te[1]}K.prototype.isBelow=function(J){var te=this.point,Ge=this.otherEvent.point;return this.left?(te[0]-J[0])*(Ge[1]-J[1])-(Ge[0]-J[0])*(te[1]-J[1])>0:(Ge[0]-J[0])*(te[1]-J[1])-(te[0]-J[0])*(Ge[1]-J[1])>0},K.prototype.isAbove=function(J){return!this.isBelow(J)},K.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},W.inResult.get=function(){return this.resultTransition!==0},K.prototype.clone=function(){var J=new K(this.point,this.left,this.otherEvent,this.isSubject,this.type);return J.contourId=this.contourId,J.resultTransition=this.resultTransition,J.prevInResult=this.prevInResult,J.isExteriorRing=this.isExteriorRing,J.inOut=this.inOut,J.otherInOut=this.otherInOut,J},Object.defineProperties(K.prototype,W);var q=11102230246251565e-32,Y=134217729,ee=(3+8*q)*q;function he(J,te,Ge,pt,vt){var yt,Dt,Gt,wi,Ti=te[0],li=pt[0],Hi=0,sr=0;li>Ti==li>-Ti?(yt=Ti,Ti=te[++Hi]):(yt=li,li=pt[++sr]);var Si=0;if(Hi<J&&sr<Ge)for(li>Ti==li>-Ti?(Gt=yt-((Dt=Ti+yt)-Ti),Ti=te[++Hi]):(Gt=yt-((Dt=li+yt)-li),li=pt[++sr]),yt=Dt,Gt!==0&&(vt[Si++]=Gt);Hi<J&&sr<Ge;)li>Ti==li>-Ti?(Gt=yt-((Dt=yt+Ti)-(wi=Dt-yt))+(Ti-wi),Ti=te[++Hi]):(Gt=yt-((Dt=yt+li)-(wi=Dt-yt))+(li-wi),li=pt[++sr]),yt=Dt,Gt!==0&&(vt[Si++]=Gt);for(;Hi<J;)Gt=yt-((Dt=yt+Ti)-(wi=Dt-yt))+(Ti-wi),Ti=te[++Hi],yt=Dt,Gt!==0&&(vt[Si++]=Gt);for(;sr<Ge;)Gt=yt-((Dt=yt+li)-(wi=Dt-yt))+(li-wi),li=pt[++sr],yt=Dt,Gt!==0&&(vt[Si++]=Gt);return yt===0&&Si!==0||(vt[Si++]=yt),Si}function ye(J){return new Float64Array(J)}var ve=33306690738754716e-32,Ce=22204460492503146e-32,Ue=11093356479670487e-47,et=ye(4),Ye=ye(8),Qe=ye(12),ot=ye(16),je=ye(4);function Je(J,te,Ge){var pt=function(vt,yt,Dt,Gt,wi,Ti){var li=(yt-Ti)*(Dt-wi),Hi=(vt-wi)*(Gt-Ti),sr=li-Hi;if(li===0||Hi===0||li>0!=Hi>0)return sr;var Si=Math.abs(li+Hi);return Math.abs(sr)>=ve*Si?sr:-function(Mr,hr,Vi,Vr,fr,ar,dr){var qi,pi,Ki,Pr,Ut,Pi,mr,Or,br,rn,ir,Jr,ro,Cn,Tn,no,sa,nn,dn=Mr-fr,Mn=Vi-fr,Gn=hr-ar,Ln=Vr-ar;et[0]=(Tn=(Or=dn-(mr=(Pi=Y*dn)-(Pi-dn)))*(rn=Ln-(br=(Pi=Y*Ln)-(Pi-Ln)))-((Cn=dn*Ln)-mr*br-Or*br-mr*rn))-((ir=Tn-(sa=(Or=Gn-(mr=(Pi=Y*Gn)-(Pi-Gn)))*(rn=Mn-(br=(Pi=Y*Mn)-(Pi-Mn)))-((no=Gn*Mn)-mr*br-Or*br-mr*rn)))+(Ut=Tn-ir))+(Ut-sa),et[1]=(ro=Cn-((Jr=Cn+ir)-(Ut=Jr-Cn))+(ir-Ut))-((ir=ro-no)+(Ut=ro-ir))+(Ut-no),et[2]=Jr-((nn=Jr+ir)-(Ut=nn-Jr))+(ir-Ut),et[3]=nn;var Yl=function(e5,HS){for(var qS=HS[0],vv=1;vv<4;vv++)qS+=HS[vv];return qS}(0,et),af=Ce*dr;if(Yl>=af||-Yl>=af||(qi=Mr-(dn+(Ut=Mr-dn))+(Ut-fr),Ki=Vi-(Mn+(Ut=Vi-Mn))+(Ut-fr),pi=hr-(Gn+(Ut=hr-Gn))+(Ut-ar),Pr=Vr-(Ln+(Ut=Vr-Ln))+(Ut-ar),qi===0&&pi===0&&Ki===0&&Pr===0)||(af=Ue*dr+ee*Math.abs(Yl),(Yl+=dn*Pr+Ln*qi-(Gn*Ki+Mn*pi))>=af||-Yl>=af))return Yl;je[0]=(Tn=(Or=qi-(mr=(Pi=Y*qi)-(Pi-qi)))*(rn=Ln-(br=(Pi=Y*Ln)-(Pi-Ln)))-((Cn=qi*Ln)-mr*br-Or*br-mr*rn))-((ir=Tn-(sa=(Or=pi-(mr=(Pi=Y*pi)-(Pi-pi)))*(rn=Mn-(br=(Pi=Y*Mn)-(Pi-Mn)))-((no=pi*Mn)-mr*br-Or*br-mr*rn)))+(Ut=Tn-ir))+(Ut-sa),je[1]=(ro=Cn-((Jr=Cn+ir)-(Ut=Jr-Cn))+(ir-Ut))-((ir=ro-no)+(Ut=ro-ir))+(Ut-no),je[2]=Jr-((nn=Jr+ir)-(Ut=nn-Jr))+(ir-Ut),je[3]=nn;var FO=he(4,et,4,je,Ye);je[0]=(Tn=(Or=dn-(mr=(Pi=Y*dn)-(Pi-dn)))*(rn=Pr-(br=(Pi=Y*Pr)-(Pi-Pr)))-((Cn=dn*Pr)-mr*br-Or*br-mr*rn))-((ir=Tn-(sa=(Or=Gn-(mr=(Pi=Y*Gn)-(Pi-Gn)))*(rn=Ki-(br=(Pi=Y*Ki)-(Pi-Ki)))-((no=Gn*Ki)-mr*br-Or*br-mr*rn)))+(Ut=Tn-ir))+(Ut-sa),je[1]=(ro=Cn-((Jr=Cn+ir)-(Ut=Jr-Cn))+(ir-Ut))-((ir=ro-no)+(Ut=ro-ir))+(Ut-no),je[2]=Jr-((nn=Jr+ir)-(Ut=nn-Jr))+(ir-Ut),je[3]=nn;var BO=he(FO,Ye,4,je,Qe);je[0]=(Tn=(Or=qi-(mr=(Pi=Y*qi)-(Pi-qi)))*(rn=Pr-(br=(Pi=Y*Pr)-(Pi-Pr)))-((Cn=qi*Pr)-mr*br-Or*br-mr*rn))-((ir=Tn-(sa=(Or=pi-(mr=(Pi=Y*pi)-(Pi-pi)))*(rn=Ki-(br=(Pi=Y*Ki)-(Pi-Ki)))-((no=pi*Ki)-mr*br-Or*br-mr*rn)))+(Ut=Tn-ir))+(Ut-sa),je[1]=(ro=Cn-((Jr=Cn+ir)-(Ut=Jr-Cn))+(ir-Ut))-((ir=ro-no)+(Ut=ro-ir))+(Ut-no),je[2]=Jr-((nn=Jr+ir)-(Ut=nn-Jr))+(ir-Ut),je[3]=nn;var NO=he(BO,Qe,4,je,ot);return ot[NO-1]}(vt,yt,Dt,Gt,wi,Ti,Si)}(J[0],J[1],te[0],te[1],Ge[0],Ge[1]);return pt>0?-1:pt<0?1:0}function Fe(J,te){var Ge=J.point,pt=te.point;return Ge[0]>pt[0]?1:Ge[0]<pt[0]?-1:Ge[1]!==pt[1]?Ge[1]>pt[1]?1:-1:function(vt,yt,Dt,Gt){return vt.left!==yt.left?vt.left?1:-1:Je(Dt,vt.otherEvent.point,yt.otherEvent.point)!==0?vt.isBelow(yt.otherEvent.point)?-1:1:!vt.isSubject&&yt.isSubject?1:-1}(J,te,Ge)}function Ve(J,te,Ge){var pt=new K(te,!1,J,J.isSubject),vt=new K(te,!0,J.otherEvent,J.isSubject);return F(J.point,J.otherEvent.point)&&console.warn("what is that, a collapsed segment?",J),pt.contourId=vt.contourId=J.contourId,Fe(vt,J.otherEvent)>0&&(J.otherEvent.left=!0,vt.left=!1),J.otherEvent.otherEvent=vt,J.otherEvent=pt,Ge.push(vt),Ge.push(pt),Ge}function lt(J,te){return J[0]*te[1]-J[1]*te[0]}function ut(J,te){return J[0]*te[0]+J[1]*te[1]}function zt(J,te,Ge){var pt=function(wi,Ti,li,Hi,sr){var Si=[Ti[0]-wi[0],Ti[1]-wi[1]],Mr=[Hi[0]-li[0],Hi[1]-li[1]];function hr(Pi,mr,Or){return[Pi[0]+mr*Or[0],Pi[1]+mr*Or[1]]}var Vi=[li[0]-wi[0],li[1]-wi[1]],Vr=lt(Si,Mr),fr=Vr*Vr,ar=ut(Si,Si);if(fr>0){var dr=lt(Vi,Mr)/Vr;if(dr<0||dr>1)return null;var qi=lt(Vi,Si)/Vr;return qi<0||qi>1?null:dr===0||dr===1?[hr(wi,dr,Si)]:qi===0||qi===1?[hr(li,qi,Mr)]:[hr(wi,dr,Si)]}if((fr=(Vr=lt(Vi,Si))*Vr)>0)return null;var pi=ut(Si,Vi)/ar,Ki=pi+ut(Si,Mr)/ar,Pr=Math.min(pi,Ki),Ut=Math.max(pi,Ki);return Pr<=1&&Ut>=0?Pr===1?[hr(wi,Pr>0?Pr:0,Si)]:Ut===0?[hr(wi,Ut<1?Ut:1,Si)]:[hr(wi,Pr>0?Pr:0,Si),hr(wi,Ut<1?Ut:1,Si)]:null}(J.point,J.otherEvent.point,te.point,te.otherEvent.point),vt=pt?pt.length:0;if(vt===0||vt===1&&(F(J.point,te.point)||F(J.otherEvent.point,te.otherEvent.point))||vt===2&&J.isSubject===te.isSubject)return 0;if(vt===1)return F(J.point,pt[0])||F(J.otherEvent.point,pt[0])||Ve(J,pt[0],Ge),F(te.point,pt[0])||F(te.otherEvent.point,pt[0])||Ve(te,pt[0],Ge),1;var yt=[],Dt=!1,Gt=!1;return F(J.point,te.point)?Dt=!0:Fe(J,te)===1?yt.push(te,J):yt.push(J,te),F(J.otherEvent.point,te.otherEvent.point)?Gt=!0:Fe(J.otherEvent,te.otherEvent)===1?yt.push(te.otherEvent,J.otherEvent):yt.push(J.otherEvent,te.otherEvent),Dt&&Gt||Dt?(te.type=v,J.type=te.inOut===J.inOut?w:S,Dt&&!Gt&&Ve(yt[1].otherEvent,yt[0].point,Ge),2):Gt?(Ve(yt[0],yt[1].point,Ge),3):yt[0]!==yt[3].otherEvent?(Ve(yt[0],yt[1].point,Ge),Ve(yt[1],yt[2].point,Ge),3):(Ve(yt[0],yt[1].point,Ge),Ve(yt[3].otherEvent,yt[2].point,Ge),3)}function Et(J,te){if(J===te)return 0;if(Je(J.point,J.otherEvent.point,te.point)!==0||Je(J.point,J.otherEvent.point,te.otherEvent.point)!==0)return F(J.point,te.point)?J.isBelow(te.otherEvent.point)?-1:1:J.point[0]===te.point[0]?J.point[1]<te.point[1]?-1:1:Fe(J,te)===1?te.isAbove(J.point)?-1:1:J.isBelow(te.point)?-1:1;if(J.isSubject!==te.isSubject)return J.isSubject?-1:1;var Ge=J.point,pt=te.point;return Ge[0]===pt[0]&&Ge[1]===pt[1]?(Ge=J.otherEvent.point)[0]===(pt=te.otherEvent.point)[0]&&Ge[1]===pt[1]?0:J.contourId>te.contourId?1:-1:Fe(J,te)===1?1:-1}var gt=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function at(J,te,Ge,pt){var vt,yt=J+1,Dt=te[J].point,Gt=te.length;for(yt<Gt&&(vt=te[yt].point);yt<Gt&&vt[0]===Dt[0]&&vt[1]===Dt[1];){if(!Ge[yt])return yt;++yt<Gt&&(vt=te[yt].point)}for(yt=J-1;Ge[yt]&&yt>pt;)yt--;return yt}gt.prototype.isExterior=function(){return this.holeOf==null};var Xt=Pt,Mt=Pt;function Pt(J,te){if(!(this instanceof Pt))return new Pt(J,te);if(this.data=J||[],this.length=this.data.length,this.compare=te||Ht,this.length>0)for(var Ge=(this.length>>1)-1;Ge>=0;Ge--)this._down(Ge)}function Ht(J,te){return J<te?-1:J>te?1:0}Pt.prototype={push:function(J){this.data.push(J),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var J=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),J}},peek:function(){return this.data[0]},_up:function(J){for(var te=this.data,Ge=this.compare,pt=te[J];J>0;){var vt=J-1>>1,yt=te[vt];if(Ge(pt,yt)>=0)break;te[J]=yt,J=vt}te[J]=pt},_down:function(J){for(var te=this.data,Ge=this.compare,pt=this.length>>1,vt=te[J];J<pt;){var yt=1+(J<<1),Dt=yt+1,Gt=te[yt];if(Dt<this.length&&Ge(te[Dt],Gt)<0&&(yt=Dt,Gt=te[Dt]),Ge(Gt,vt)>=0)break;te[J]=Gt,J=yt}te[J]=vt}},Xt.default=Mt;var ii=Math.max,oi=Math.min,fi=0;function ci(J,te,Ge,pt,vt,yt){var Dt,Gt,wi,Ti,li,Hi;for(Dt=0,Gt=J.length-1;Dt<Gt;Dt++)if(Ti=J[Dt+1],li=new K(wi=J[Dt],!1,void 0,te),Hi=new K(Ti,!1,li,te),li.otherEvent=Hi,wi[0]!==Ti[0]||wi[1]!==Ti[1]){li.contourId=Hi.contourId=Ge,yt||(li.isExteriorRing=!1,Hi.isExteriorRing=!1),Fe(li,Hi)>0?Hi.left=!0:li.left=!0;var sr=wi[0],Si=wi[1];vt[0]=oi(vt[0],sr),vt[1]=oi(vt[1],Si),vt[2]=ii(vt[2],sr),vt[3]=ii(vt[3],Si),pt.push(li),pt.push(Hi)}}var ai=[];function tr(J,te,Ge){typeof J[0][0][0]=="number"&&(J=[J]),typeof te[0][0][0]=="number"&&(te=[te]);var pt=function(Si,Mr,hr){var Vi=null;return Si.length*Mr.length==0&&(hr===A?Vi=ai:hr===R?Vi=Si:hr!==D&&hr!==O||(Vi=Si.length===0?Mr:Si)),Vi}(J,te,Ge);if(pt)return pt===ai?null:pt;var vt=[1/0,1/0,-1/0,-1/0],yt=[1/0,1/0,-1/0,-1/0],Dt=function(Si,Mr,hr,Vi,Vr){var fr,ar,dr,qi,pi,Ki,Pr=new Xt(null,Fe);for(dr=0,qi=Si.length;dr<qi;dr++)for(pi=0,Ki=(fr=Si[dr]).length;pi<Ki;pi++)(ar=pi===0)&&fi++,ci(fr[pi],!0,fi,Pr,hr,ar);for(dr=0,qi=Mr.length;dr<qi;dr++)for(pi=0,Ki=(fr=Mr[dr]).length;pi<Ki;pi++)ar=pi===0,Vr===R&&(ar=!1),ar&&fi++,ci(fr[pi],!1,fi,Pr,Vi,ar);return Pr}(J,te,vt,yt,Ge);if(pt=function(Si,Mr,hr,Vi,Vr){var fr=null;return(hr[0]>Vi[2]||Vi[0]>hr[2]||hr[1]>Vi[3]||Vi[1]>hr[3])&&(Vr===A?fr=ai:Vr===R?fr=Si:Vr!==D&&Vr!==O||(fr=Si.concat(Mr))),fr}(J,te,vt,yt,Ge))return pt===ai?null:pt;for(var Gt=function(Si){var Mr,hr,Vi=function(dr){var qi,pi,Ki,Pr,Ut=[];for(pi=0,Ki=dr.length;pi<Ki;pi++)((qi=dr[pi]).left&&qi.inResult||!qi.left&&qi.otherEvent.inResult)&&Ut.push(qi);for(var Pi=!1;!Pi;)for(Pi=!0,pi=0,Ki=Ut.length;pi<Ki;pi++)pi+1<Ki&&Fe(Ut[pi],Ut[pi+1])===1&&(Pr=Ut[pi],Ut[pi]=Ut[pi+1],Ut[pi+1]=Pr,Pi=!1);for(pi=0,Ki=Ut.length;pi<Ki;pi++)(qi=Ut[pi]).otherPos=pi;for(pi=0,Ki=Ut.length;pi<Ki;pi++)(qi=Ut[pi]).left||(Pr=qi.otherPos,qi.otherPos=qi.otherEvent.otherPos,qi.otherEvent.otherPos=Pr);return Ut}(Si),Vr={},fr=[],ar=function(){if(!Vr[Mr]){var dr=fr.length,qi=function(Ut,Pi,mr){var Or=new gt;if(Ut.prevInResult!=null){var br=Ut.prevInResult,rn=br.outputContourId;if(br.resultTransition>0){var ir=Pi[rn];if(ir.holeOf!=null){var Jr=ir.holeOf;Pi[Jr].holeIds.push(mr),Or.holeOf=Jr,Or.depth=Pi[rn].depth}else Pi[rn].holeIds.push(mr),Or.holeOf=rn,Or.depth=Pi[rn].depth+1}else Or.holeOf=null,Or.depth=Pi[rn].depth}else Or.holeOf=null,Or.depth=0;return Or}(Vi[Mr],fr,dr),pi=function(Ut){Vr[Ut]=!0,Ut<Vi.length&&Vi[Ut]&&(Vi[Ut].outputContourId=dr)},Ki=Mr,Pr=Mr;for(qi.points.push(Vi[Mr].point);pi(Ki),pi(Ki=Vi[Ki].otherPos),qi.points.push(Vi[Ki].point),!((Ki=at(Ki,Vi,Vr,Pr))==Pr||Ki>=Vi.length)&&Vi[Ki];);fr.push(qi)}};for(Mr=0,hr=Vi.length;Mr<hr;Mr++)ar();return fr}(function(Si,Mr,hr,Vi,Vr,fr){for(var ar,dr,qi,pi=new a(Et),Ki=[],Pr=Math.min(Vi[2],Vr[2]);Si.length!==0;){var Ut=Si.pop();if(Ki.push(Ut),fr===A&&Ut.point[0]>Pr||fr===R&&Ut.point[0]>Vi[2])break;if(Ut.left){dr=ar=pi.insert(Ut),ar=ar!==(qi=pi.minNode())?pi.prev(ar):null,dr=pi.next(dr);var Pi=ar?ar.key:null;if($(Ut,Pi,fr),dr&&zt(Ut,dr.key,Si)===2&&($(Ut,Pi,fr),$(dr.key,Ut,fr)),ar&&zt(ar.key,Ut,Si)===2){var mr=ar;$(Pi,(mr=mr!==qi?pi.prev(mr):null)?mr.key:null,fr),$(Ut,Pi,fr)}}else dr=ar=pi.find(Ut=Ut.otherEvent),ar&&dr&&(ar=ar!==qi?pi.prev(ar):null,dr=pi.next(dr),pi.remove(Ut),dr&&ar&&zt(ar.key,dr.key,Si))}return Ki}(Dt,0,0,vt,yt,Ge)),wi=[],Ti=0;Ti<Gt.length;Ti++){var li=Gt[Ti];if(li.isExterior()){for(var Hi=[li.points],sr=0;sr<li.holeIds.length;sr++)Hi.push(Gt[li.holeIds[sr]].points);wi.push(Hi)}}return wi}var ur={UNION:D,DIFFERENCE:R,INTERSECTION:A,XOR:O};i.diff=function(J,te){return tr(J,te,R)},i.intersection=function(J,te){return tr(J,te,A)},i.operations=ur,i.union=function(J,te){return tr(J,te,D)},i.xor=function(J,te){return tr(J,te,O)},Object.defineProperty(i,"__esModule",{value:!0})})(e)}(0,Nw.exports)),Nw.exports);/**
|
|
68
68
|
* martinez v0.7.4
|
|
69
69
|
* Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor
|
|
70
70
|
*
|
|
71
71
|
* @author Alex Milevski <info@w8r.name>
|
|
72
72
|
* @license MIT
|
|
73
73
|
* @preserve
|
|
74
|
-
*/function a_(r,e,i,s){const a=[],u=s===0?(h,m,g,v,w,S)=>{h.push(new ft(S,g+(S-m)/(v-m)*(w-g)))}:(h,m,g,v,w,S)=>{h.push(new ft(m+(S-g)/(w-g)*(v-m),S))};for(const h of r){const m=[];for(const g of h){if(g.length<=2)continue;const v=[];for(let A=0;A<g.length-1;A++){const D=g[A].x,R=g[A].y,O=g[A+1].x,$=g[A+1].y,H=s===0?D:R,K=s===0?O:$;H<e?K>e&&u(v,D,R,O,$,e):H>i?K<i&&u(v,D,R,O,$,i):v.push(g[A]),K<e&&H>=e&&u(v,D,R,O,$,e),K>i&&H<=i&&u(v,D,R,O,$,i)}let w=g[g.length-1];const S=s===0?w.x:w.y;S>=e&&S<=i&&v.push(w),v.length&&(w=v[v.length-1],v[0].x===w.x&&v[0].y===w.y||v.push(v[0]),m.push(v))}m.length&&a.push(m)}return a}function tk(r,e){const i=_0(r),s=_0([e]),a=jw.intersection(i,s);return a==null?[]:Vw(a)}function ik(r,e){let s=_0(r,65536);for(;e.valid();e.next()){const[a,u]=e.get(),h=a.x*65536,m=a.y*65536,g=u.x*65536,v=u.y*65536,w=g-h,S=v-m,A=Math.hypot(w,S),D=Math.trunc(S/A*3),R=-Math.trunc(w/A*3);s=jw.diff(s,[[[h,m],[g,v],[g+D,v+R],[h+D,m+R],[h,m]]])}return Vw(s,1/65536)}function _0(r,e=1){return[r.map(i=>i.map(s=>[s.x*e,s.y*e]))]}function Vw(r,e=1){return r.map(i=>i.map((s,a)=>{const u=s.map(h=>new ft(h[0]*e,h[1]*e).round());return a>0&&u.reverse(),u}))}class g0{constructor(e,i){this.layoutVertexArray=new xs,this.indexArray=new fn,this.lineIndexArray=new ea,this.triangleSegments=new Cr,this.lineSegments=new Cr,this.programConfigurations=new Ha(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new Rl)}update(e,i,s,a,u,h,m){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,FL.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,BL.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,s,a,u,h){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,s,a,u,h)}}class y0{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.bufferData=new g0(e,!1),this.elevationBufferData=new g0(e,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference")}updateFootprints(e,i){}populate(e,i,s,a){this.hasPattern=c0("fill",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:m,id:g,index:v,sourceLayerIndex:w}of e){const S=this.layers[0]._featureFilter.needGeometry,A=Lt(m,S);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),A,s))continue;const D=u?u.evaluate(A,{},s,i.availableImages):void 0,R={id:g,properties:m.properties,type:m.type,sourceLayerIndex:w,index:v,geometry:S?A.geometry:At(m,s,a),patterns:{},sortKey:D};h.push(R)}u&&h.sort((m,g)=>m.sortKey-g.sortKey);for(const m of h){const{geometry:g,index:v,sourceLayerIndex:w}=m;if(this.hasPattern){const S=u0("fill",this.layers,m,this.zoom,this.pixelRatio,i);this.patternFeatures.push(S)}else this.addFeature(m,g,v,s,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[v].feature,g,v,w,this.index)}}update(e,i,s,a,u,h,m){this.bufferData.update(e,i,s,a,u,h,m),this.elevationBufferData.update(e,i,s,a,u,h,m)}addFeatures(e,i,s,a,u,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,i,s,a,h,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,i,s,a,u,h=[],m,g){const v=o_(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,v,a,s,g):this.addGeometry(v,this.bufferData),this.bufferData.populatePaintArrays(e,s,u,h,a,m),this.elevationBufferData.populatePaintArrays(e,s,u,h,a,m)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e){this.elevatedStructures&&this.elevatedStructures.construct(e)}addElevatedRoadFeature(e,i,s,a,u){const h=new Array,m=m0.getElevationFeature(e,u);if(m){{const g=this.clipPolygonsToTile(i,1);g.length>0&&h.push({polygons:g,elevationFeature:m,elevationTileID:s})}for(const g of h)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new wo(g.elevationTileID));const w=g.elevationFeature.isTunnel();let S=0;e.properties.hasOwnProperty(zw)&&(S=+e.properties[zw]);for(const A of g.polygons)this.elevatedStructures.addPortalCandidates(g.elevationFeature.id,A,w,g.elevationFeature,S)}g.elevationFeature.constantHeight==null&&(g.polygons=this.prepareElevatedPolygons(g.polygons,g.elevationFeature,g.elevationTileID));const v=new Ow(s,g.elevationTileID);this.addElevatedGeometry(g.polygons,v,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,a)}}else this.addGeometry(i,this.bufferData)}addElevatedGeometry(e,i,s,a,u){const h={elevation:s,elevationSampler:i,bias:a,index:u},[m,g]=this.addGeometry(e,this.elevationBufferData,h);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:m,max:g}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,m),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,g))}addGeometry(e,i,s){let a=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,h=null;s&&(h=s.elevationSampler.constantElevation(s.elevation,s.bias),h!=null&&(a=h,u=h));const m=(g,v,w)=>{if(s!=null)if(v.push(g),h!=null)i.elevatedLayoutVertexArray.emplaceBack(h),w.push(h);else{const S=s.elevationSampler.pointElevation(g,s.elevation,s.bias);i.elevatedLayoutVertexArray.emplaceBack(S),w.push(S),a=Math.min(a,S),u=Math.max(u,S)}};for(const g of e){let v=0;for(const W of g)v+=W.length;const w=i.triangleSegments.prepareSegment(v,i.layoutVertexArray,i.indexArray),S=w.vertexLength,A=[],D=[],R=[],O=[],$=[],H=i.layoutVertexArray.length;for(const W of g){if(W.length===0)continue;W!==g[0]&&D.push(A.length/2);const F=i.lineSegments.prepareSegment(W.length,i.layoutVertexArray,i.lineIndexArray),q=F.vertexLength;s&&$.push(i.layoutVertexArray.length-H),m(W[0],R,O),i.layoutVertexArray.emplaceBack(W[0].x,W[0].y),i.lineIndexArray.emplaceBack(q+W.length-1,q),A.push(W[0].x),A.push(W[0].y);for(let Y=1;Y<W.length;Y++)m(W[Y],R,O),i.layoutVertexArray.emplaceBack(W[Y].x,W[Y].y),i.lineIndexArray.emplaceBack(q+Y-1,q+Y),A.push(W[Y].x),A.push(W[Y].y);F.vertexLength+=W.length,F.primitiveLength+=W.length}const K=Ip(A,D);for(let W=0;W<K.length;W+=3)i.indexArray.emplaceBack(S+K[W],S+K[W+1],S+K[W+2]);if(K.length>0&&s&&this.elevationMode==="hd-road-base"){const W=s.elevation.isTunnel(),F=s.elevation.safeArea,q=this.elevatedStructures.addVertices(R,O);this.elevatedStructures.addTriangles(K,q,W);const Y=$.length;if(Y>0){for(let ee=0;ee<Y-1;ee++)this.elevatedStructures.addRenderableRing(s.index,$[ee]+q,$[ee+1]-$[ee],W,F);this.elevatedStructures.addRenderableRing(s.index,$[Y-1]+q,R.length-$[Y-1],W,F)}}w.vertexLength+=v,w.primitiveLength+=K.length/3}return[a,u]}prepareElevatedPolygons(e,i,s){const a=1/De(s),u=[];for(const h of e){const m=ik(h,new kw(i,a));u.push(...m)}return u}clipPolygonsToTile(e,i){const s=-i,a=-i,u=_t+i,h=_t+i;let m=0;const g=[],v=[];for(;m<e.length;m++){const A=e[m],D=Cd(A);(D.min.x>=s&&D.max.x<=u&&D.min.y>=a&&D.max.y<=h?g:v).push(A)}if(g.length===e.length)return e;const w=[new ft(s,a),new ft(u,a),new ft(u,h),new ft(s,h),new ft(s,a)],S=g;for(const A of v)S.push(...tk(A,w));return S}}let Uw,$w,Gw,Hw;Tt(y0,"FillBucket",{omit:["layers","patternFeatures"]}),Tt(g0,"FillBufferData"),Tt(wo,"ElevatedStructures");class v0{constructor(e,i,s,a){if(this.triangleCount=i.length/3,this.min=new ft(0,0),this.max=new ft(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[u,h]=[e[0].clone(),e[0].clone()];for(let S=1;S<e.length;++S){const A=e[S];u.x=Math.min(u.x,A.x),u.y=Math.min(u.y,A.y),h.x=Math.max(h.x,A.x),h.y=Math.max(h.y,A.y)}if(a){const S=Math.ceil(Math.max(h.x-u.x,h.y-u.y)/a);s=Math.max(s,S)}if(s===0)return;this.min=u,this.max=h;const m=this.max.sub(this.min);m.x=Math.max(m.x,1),m.y=Math.max(m.y,1);const g=Math.max(m.x,m.y)/s;this.cellsX=Math.max(1,Math.ceil(m.x/g)),this.cellsY=Math.max(1,Math.ceil(m.y/g)),this.xScale=1/g,this.yScale=1/g;const v=[];for(let S=0;S<this.triangleCount;S++){const A=e[i[3*S+0]].sub(this.min),D=e[i[3*S+1]].sub(this.min),R=e[i[3*S+2]].sub(this.min),O=na(Math.floor(Math.min(A.x,D.x,R.x)),this.xScale,this.cellsX),$=na(Math.floor(Math.max(A.x,D.x,R.x)),this.xScale,this.cellsX),H=na(Math.floor(Math.min(A.y,D.y,R.y)),this.yScale,this.cellsY),K=na(Math.floor(Math.max(A.y,D.y,R.y)),this.yScale,this.cellsY),W=new ft(0,0),F=new ft(0,0),q=new ft(0,0),Y=new ft(0,0);for(let ee=H;ee<=K;++ee){W.y=F.y=ee*g,q.y=Y.y=(ee+1)*g;for(let he=O;he<=$;++he)W.x=q.x=he*g,F.x=Y.x=(he+1)*g,(Sr(A,D,R,W,F,Y)||Sr(A,D,R,W,Y,q))&&v.push({cellIdx:ee*this.cellsX+he,triIdx:S})}}if(v.length===0)return;v.sort((S,A)=>S.cellIdx-A.cellIdx||S.triIdx-A.triIdx);let w=0;for(;w<v.length;){const S=v[w].cellIdx,A={start:this.payload.length,len:0};for(;w<v.length&&v[w].cellIdx===S;)++A.len,this.payload.push(v[w++].triIdx);this.cells[S]=A}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const s=na(e.x-this.min.x,this.xScale,this.cellsX),a=na(e.y-this.min.y,this.yScale,this.cellsY),u=this.cells[a*this.cellsX+s];if(u){this._lazyInitLookup();for(let h=0;h<u.len;h++){const m=this.payload[u.start+h],g=Math.floor(m/8),v=1<<m%8;if(!(this.lookup[g]&v)&&(this.lookup[g]|=v,i.push(m),i.length===this.triangleCount))return}}}query(e,i,s){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const a=na(e.x-this.min.x,this.xScale,this.cellsX),u=na(i.x-this.min.x,this.xScale,this.cellsX),h=na(e.y-this.min.y,this.yScale,this.cellsY),m=na(i.y-this.min.y,this.yScale,this.cellsY);for(let g=h;g<=m;g++)for(let v=a;v<=u;v++){const w=this.cells[g*this.cellsX+v];if(w)for(let S=0;S<w.len;S++){const A=this.payload[w.start+S],D=Math.floor(A/8),R=1<<A%8;if(!(this.lookup[D]&R)&&(this.lookup[D]|=R,s.push(A),s.length===this.triangleCount))return}}}}function na(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}Tt(v0,"TriangleGridIndex");class qw{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[]}updateFootprints(e,i){for(const s of this.footprints)i.push({footprint:s,id:e})}populate(e,i,s,a){const u=[];for(const{feature:h,id:m,index:g,sourceLayerIndex:v}of e){const w=this.layers[0]._featureFilter.needGeometry,S=Lt(h,w);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),S,s))continue;const A={id:m,properties:h.properties,type:h.type,sourceLayerIndex:v,index:g,geometry:w?S.geometry:At(h,s,a),patterns:{}};u.push(A)}for(const h of u){const{geometry:m,index:g,sourceLayerIndex:v}=h;this.addFeature(h,m,g,s,{},i.availableImages,i.brightness),i.featureIndex.insert(e[g].feature,m,g,v,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,s,a,u,h,m){}destroy(){}addFeature(e,i,s,a,u,h=[],m){for(const g of o_(i,2)){const v=[],w=[],S=[],A=new ft(1/0,1/0),D=new ft(-1/0,-1/0);for(const $ of g)if($.length!==0){$!==g[0]&&S.push(w.length/2);for(let H=0;H<$.length;H++)w.push($[H].x),w.push($[H].y),v.push($[H]),A.x=Math.min(A.x,$[H].x),A.y=Math.min(A.y,$[H].y),D.x=Math.max(D.x,$[H].x),D.y=Math.max(D.y,$[H].y)}const R=Ip(w,S),O=new v0(v,R,8,256);this.footprints.push({vertices:v,indices:R,grid:O,min:A,max:D})}}}Tt(qw,"ClipBucket",{omit:["layers"]});const rk=ki([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),nk=ki([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),ok=ki([{name:"a_centroid_pos",components:2,type:"Uint16"}]),sk=ki([{name:"a_join_normal_inside",components:3,type:"Int16"}]),ak=ki([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),lk=ki([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:ck}=rk,l_=Number.MAX_SAFE_INTEGER;function Zw(r,e,i,s){return r.order<e||r.order===l_||!(r.clipMask&i)||function(a,u){return u.length!==0&&u.find(h=>h===a)===void 0}(s,r.clipScope)}function c_(r,e){return r.x-e.x||r.y-e.y}function Ww(r,e){return c_(r.min,e.min)===0&&c_(r.max,e.max)===0}function x0(r,e){return!(r.min.x>e.max.x||r.max.x<e.min.x||r.min.y>e.max.y||r.max.y<e.min.y)}function b0(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!Ww(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!ds(r[i].clipScope,e[i].clipScope))return!1;return!0}function Xw(r,e,i){const s=1/_t,a=1/(1<<i.canonical.z),u=(e.x*s+i.canonical.x)*a+i.wrap,h=(e.y*s+i.canonical.y)*a;return{min:new ft((r.x*s+i.canonical.x)*a+i.wrap,(r.y*s+i.canonical.y)*a),max:new ft(u,h)}}function uk(r,e,i){const s=1<<i.canonical.z,a=((e.x-i.wrap)*s-i.canonical.x)*_t,u=(e.y*s-i.canonical.y)*_t;return{min:new ft(((r.x-i.wrap)*s-i.canonical.x)*_t,(r.y*s-i.canonical.y)*_t),max:new ft(a,u)}}function Yw(r,e,i,s,a,u,h){const m=r.indices,g=r.vertices,v=[];for(let w=s;w<s+a;w+=3){const S=e[i[w+0]+u],A=e[i[w+1]+u],D=e[i[w+2]+u],R=Math.min(S.x,A.x,D.x),O=Math.max(S.x,A.x,D.x),$=Math.min(S.y,A.y,D.y),H=Math.max(S.y,A.y,D.y);v.length=0,r.grid.query(new ft(R,$),new ft(O,H),v);for(let K=0;K<v.length;K++){const W=v[K];if(Sr(g[m[3*W+0]],g[m[3*W+1]],g[m[3*W+2]],S,A,D,h))return!0}}return!1}function Kw(r,e,i,s){if(!r||!i)return!1;let a=r.vertices;if(!e.canonical.equals(s.canonical)||e.wrap!==s.wrap){if(i.vertices.length<r.vertices.length)return Kw(i,s,r,e);const u=e.canonical,h=s.canonical,m=Math.pow(2,h.z-u.z);a=r.vertices.map(g=>new ft((g.x+u.x*_t)*m-h.x*_t,(g.y+u.y*_t)*m-h.y*_t))}return Yw(i,a,r.indices,0,r.indices.length,0,0)}function Jw(r,e,i,s){const a=Math.pow(2,s.z-i.z);return new ft((r+i.x*_t)*a-s.x*_t,(e+i.y*_t)*a-s.y*_t)}function Qw(r,e){const i=[];e.grid.queryPoint(r,i);const s=e.indices,a=e.vertices;for(let u=0;u<i.length;u++){const h=i[u];if(Yi([a[s[3*h+0]],a[s[3*h+1]],a[s[3*h+2]]],r))return!0}return!1}const w0=[new ft(0,0),new ft(_t,0),new ft(_t,_t),new ft(0,_t)];function e2(r,e){const i=[];let s=[];if(!e||r.length<2)return[r];if(r.length===2)return jr(r[0],r[1],w0)?[r]:[];for(let a=0;a<r.length+2;a++){const u=r[a%r.length],h=r[(a+1)%r.length],m=jr(a===0?r[r.length-1]:r[(a-1)%r.length],u,w0),g=jr(u,h,w0),v=m||g;v&&s.push(u),v&&g||s.length>0&&(s.length>1&&i.push(s),s=[])}return s.length>1&&i.push(s),i}const T0=$l.VectorTileFeature.types,hk=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],dk=["fill-extrusion-flood-light-ground-radius"],pk=Math.pow(2,13),fk=Math.pow(2,15)-1,t2=new ft(0,1),Gl=2147483648;function Rp(r,e,i,s,a,u,h,m){r.emplaceBack((e<<1)+h,(i<<1)+u,(Math.floor(s*pk)<<1)+a,Math.round(m))}function zp(r,e,i){r.emplaceBack(e.x*_t,e.y*_t,i?1:0)}function u_(r,e,i,s,a,u){r.emplaceBack(e.x,e.y,(i.x<<1)+s,(i.y<<1)+a,u)}function Lp(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class i2{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class r2{constructor(){this.centroidXY=new ft(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new ft(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new ft(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new ft(this.max.x-this.min.x,this.max.y-this.min.y)}}class n2{constructor(){this.acc=new ft(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,s){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((i.x===0||i.x===_t)&&i.x===s.x)!=((i.y===0||i.y===_t)&&i.y===s.y)&&this.processBorderOverlap(i,s),a&&this.checkBorderIntersection(i,s)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,Nt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>_t!=e.x>_t&&this.addBorderIntersection(1,Nt(i.y,e.y,(_t-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,Nt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>_t!=e.y>_t&&this.addBorderIntersection(3,Nt(i.x,e.x,(_t-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const s=this.borders[e];i<s[0]&&(s[0]=i),i>s[1]&&(s[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const s=e.x===0?0:1;this.addBorderIntersection(s,i.y),this.addBorderIntersection(s,e.y)}else{const s=e.y===0?2:3;this.addBorderIntersection(s,i.x),this.addBorderIntersection(s,e.x)}}centroid(){return this.accCount===0?new ft(0,0):new ft(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function o2(r,e){const i=r.add(e)._unit(),s=Te(r.x*i.x+r.y*i.y,-1,1);var a,u,h;return a=Math.acos(s),Math.min(4,Math.max(-4,Math.tan(a)))/4*fk*((u=r).x*(h=e).y-u.y*h.x<0?-1:1)}const mk=[r=>r.x<0,r=>r.x>_t,r=>r.y<0,r=>r.y>_t];function _k(r,e,i,s){const a=[4];if(s===0)return a;i._mult(s);const u=r.sub(i),h=e.sub(i),m=[r,e,u,h];for(let g=0;g<4;g++)for(const v of m)if(mk[g](v)){a.push(g);break}return a}class s2{constructor(e){this.vertexArray=new dp,this.indexArray=new fn,this.programConfigurations=new Ha(e.layers,{zoom:e.zoom,lut:e.lut},i=>dk.includes(i)),this._segments=new Cr,this.hiddenByLandmarkVertexArray=new Ih,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Cr}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,s,a=!1){const u=e.length;if(u>2){let h=Math.max(0,this._segments.get().length-1);const m=this._segments._prepareSegment(4*u,this.vertexArray.length,2*this._segmentToGroundQuads[h].length);let g;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const v=e[0],w=e[1];g=o2(v.sub(e[u-1])._perp()._unit(),w.sub(v)._perp()._unit())}for(let v=0;v<u;v++){const w=v===u-1?0:v+1,S=e[v],A=e[w],D=e[w===u-1?0:w+1],R=A.sub(S)._perp()._unit(),O=o2(R,D.sub(A)._perp()._unit()),$=g,H=O;if(S0(S,A,i)||a&&c2(S,i)&&c2(A,i)){g=O;continue}const K=m.vertexLength;u_(this.vertexArray,S,A,1,1,$),u_(this.vertexArray,S,A,1,0,$),u_(this.vertexArray,S,A,0,1,H),u_(this.vertexArray,S,A,0,0,H),m.vertexLength+=4;const W=_k(S,A,R,s);for(const F of W)this._segmentToGroundQuads[h].push({id:K,region:F}),this._segmentToRegionTriCounts[h][F]+=2,m.primitiveLength+=2;g=O}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let s=0;s<i;s++)this._segmentToGroundQuads[s].sort((a,u)=>a.region-u.region);for(let s=0;s<i;s++){const a=this._segmentToGroundQuads[s],u=e[s],h=this._segmentToRegionTriCounts[s];h.reduce((g,v)=>g+v,0);let m=0;for(let g=0;g<=4;g++){const v=h[g];if(v!==0){let w=this.regionSegments[g];w||(w=this.regionSegments[g]=new Cr);const S={vertexOffset:u.vertexOffset,primitiveOffset:u.primitiveOffset+m,vertexLength:u.vertexLength,primitiveLength:v};w.get().push(S)}m+=v}for(let g=0;g<a.length;g++){const v=a[g].id;this.indexArray.emplaceBack(v,v+1,v+3),this.indexArray.emplaceBack(v,v+3,v+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,s,a,u,h){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,s,a,u,h)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,nk.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,s,a,u,h,m){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,s,a,u,h,m)}updateHiddenByLandmark(e){if(!this.hasData())return;const i=e.groundVertexCount+e.groundVertexArrayOffset;if(e.groundVertexCount===0)return;const s=e.flags&Gl?1:0;for(let a=e.groundVertexArrayOffset;a<i;++a)this.hiddenByLandmarkVertexArray.emplace(a,s);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,ak.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class h_{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new fn,this.footprintVertices=new xs,this.footprintSegments=[],this.layoutVertexArray=new Ua,this.centroidVertexArray=new Zm,this.wallVertexArray=new Xm,this.indexArray=new fn,this.programConfigurations=new Ha(e.layers,{zoom:e.zoom,lut:e.lut},i=>hk.includes(i)),this.segments=new Cr,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new s2(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,i){}populate(e,i,s,a){this.features=[],this.hasPattern=c0("fill-extrusion",this.layers,this.pixelRatio,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=De(s),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:u,id:h,index:m,sourceLayerIndex:g}of e){const v=this.layers[0]._featureFilter.needGeometry,w=Lt(u,v);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),w,s))continue;const S={id:h,sourceLayerIndex:g,index:m,geometry:v?w.geometry:At(u,s,a),properties:u.properties,type:u.type,patterns:{}},A=this.layoutVertexArray.length,D=T0[S.type]==="Polygon";if(this.hasPattern)this.features.push(u0("fill-extrusion",this.layers,S,this.zoom,this.pixelRatio,i));else if(this.wallMode)for(const R of S.geometry)for(const O of e2(R,D))this.addFeature(S,[O],m,s,{},i.availableImages,a,i.brightness);else this.addFeature(S,S.geometry,m,s,{},i.availableImages,a,i.brightness);i.featureIndex.insert(u,S.geometry,m,g,this.index,A)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,s,a,u,h){for(const m of this.features){const g=T0[m.type]==="Polygon",{geometry:v}=m;if(this.wallMode)for(const w of v)for(const S of e2(w,g))this.addFeature(m,[S],m.index,i,s,a,u,h);else this.addFeature(m,v,m.index,i,s,a,u,h)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,s,a,u,h,m){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m),this.groundEffect.update(e,i,u,s,a,h,m)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ck),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,sk.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,lk.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ok.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,s,a,u,h,m,g){const v=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,w=[new ft(0,0),new ft(_t,_t)],S=m.projection,A=S.name==="globe",D=this.wallMode||T0[e.type]==="Polygon",R=new n2;R.centroidDataIndex=this.centroidData.length;const O=new r2,$=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},a)<=0,H=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},a);let K;if(O.height=H,O.vertexArrayOffset=this.layoutVertexArray.length,O.groundVertexArrayOffset=this.groundEffect.vertexArray.length,A&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new $a),this.wallMode){if(A)return void yi("Non zero fill-extrusion-line-width is not yet supported on globe.");if(i.length!==1)return;K=function(ve){const Ce=ve[0].x===ve[ve.length-1].x&&ve[0].y===ve[ve.length-1].y;(function(gt){let at=0;const Xt=gt.length;for(let Mt=0;Mt<Xt;Mt++)at+=(gt[(Mt+1)%Xt].x-gt[Mt].x)*(gt[(Mt+1)%Xt].y+gt[Mt].y);return at>=0})(ve)||(ve=ve.reverse());const et={geometry:[],joinNormals:[],indices:[]},Ye=[],Qe=[],ot=[];let je=ve.length;for(;je>=2&&ve[je-1].equals(ve[je-2]);)je--;if(je<(Ce?3:2))return et;let Je,Fe,Ve,lt,ut,zt=0;for(;zt<je-1&&ve[zt].equals(ve[zt+1]);)zt++;Ce&&(Je=ve[je-2],ut=ve[zt].sub(Je)._unit()._perp());for(let gt=zt;gt<je;gt++){if(Ve=gt===je-1?Ce?ve[zt+1]:void 0:ve[gt+1],Ve&&ve[gt].equals(Ve))continue;ut&&(lt=ut),Je&&(Fe=Je),Je=ve[gt],ut=Ve?Ve.sub(Je)._unit()._perp():lt,lt=lt||ut;let at=lt.add(ut);at.x===0&&at.y===0||at._unit();const Xt=at.x*ut.x+at.y*ut.y,Mt=Xt!==0?1/Xt:1/0,Pt=lt.x*ut.y-lt.y*ut.x>0;let Ht="miter";const ii=2;Ht==="miter"&&Mt>ii&&(Ht="bevel"),Ht==="bevel"&&(Mt>100&&(Ht="flipbevel"),Mt<ii&&(Ht="miter"));const oi=(fi,ci,ai,tr)=>{const ur=new ft(fi.x,fi.y),J=new ft(fi.x,fi.y);ur.x+=ci.x*tr,ur.y+=ci.y*tr,J.x-=ci.x*Math.max(ai,1),J.y-=ci.y*Math.max(ai,1),ot.push(ci),Ye.push(ur),Qe.push(J)};if(Ht==="miter")at._mult(Mt),oi(Je,at,0,0);else if(Ht==="flipbevel")at=ut.mult(-1),oi(Je,at,0,0),oi(Je,at.mult(-1),0,0);else{const fi=-Math.sqrt(Mt*Mt-1),ci=Pt?fi:0,ai=Pt?0:fi;Fe&&oi(Je,lt,ci,ai),Ve&&oi(Je,ut,ci,ai)}}et.geometry=[...Ye,...Qe.reverse(),Ye[0]],et.joinNormals=[...ot,...ot.reverse(),ot[ot.length-1]];const Et=et.geometry.length-1;for(let gt=0;gt<Et/2;gt++)if(gt+1<Et/2){let at=gt,Xt=gt+1,Mt=Et-1-gt,Pt=Et-2-gt;at=at===0?Et-1:at-1,Xt=Xt===0?Et-1:Xt-1,Mt=Mt===0?Et-1:Mt-1,Pt=Pt===0?Et-1:Pt-1,et.indices.push(Mt),et.indices.push(Xt),et.indices.push(at),et.indices.push(Mt),et.indices.push(Pt),et.indices.push(Xt)}return et}(i[0]),i=[K.geometry]}const W=(ve,Ce)=>ve<(Ce.length-1)/2||ve===Ce.length-1,F=this.wallMode?[i]:o_(i,500);for(let ve=F.length-1;ve>=0;ve--){const Ce=F[ve];(Ce.length===0||(q=Ce[0]).every(Ue=>Ue.x<=0)||q.every(Ue=>Ue.x>=_t)||q.every(Ue=>Ue.y<=0)||q.every(Ue=>Ue.y>=_t))&&F.splice(ve,1)}var q;let Y;if(A)Y=p2(F,w,a);else{Y=[];for(const ve of F)Y.push({polygon:ve,bounds:w})}const ee=D?this.edgeRadius:0,he=ee>0&&this.zoom<17,ye=(ve,Ce)=>{if(ve.length===0)return!1;const Ue=ve[ve.length-1];return Ce.x===Ue.x&&Ce.y===Ue.y};for(const{polygon:ve,bounds:Ce}of Y){let Ue=0,et=0;for(const je of ve)D&&!je[0].equals(je[je.length-1])&&je.push(je[0]),et+=D?je.length-1:je.length;const Ye=this.segments.prepareSegment((D?5:4)*et,this.layoutVertexArray,this.indexArray);O.footprintSegIdx<0&&(O.footprintSegIdx=this.footprintSegments.length),O.polygonSegIdx<0&&(O.polygonSegIdx=this.polygonSegments.length);const Qe={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},ot=new i2;if(ot.vertexOffset=this.footprintVertices.length,ot.indexOffset=3*this.footprintIndices.length,ot.ringIndices=[],D){const je=[],Je=[];Ue=Ye.vertexLength;for(let Ve=0;Ve<ve.length;Ve++){const lt=ve[Ve];lt.length&&Ve!==0&&Je.push(je.length/2);const ut=[];let zt,Et;zt=lt[1].sub(lt[0])._perp()._unit(),ot.ringIndices.push(lt.length-1);for(let gt=1;gt<lt.length;gt++){const at=lt[gt],Xt=lt[gt===lt.length-1?1:gt+1],Mt=at.clone();if(ee){Et=Xt.sub(at)._perp()._unit();const Pt=zt.add(Et)._unit(),Ht=ee*Math.min(4,1/(zt.x*Pt.x+zt.y*Pt.y));Mt.x+=Ht*Pt.x,Mt.y+=Ht*Pt.y,Mt.x=Math.round(Mt.x),Mt.y=Math.round(Mt.y),zt=Et}if(!$||ee!==0&&!he||ye(ut,Mt)||ut.push(Mt),Rp(this.layoutVertexArray,Mt.x,Mt.y,0,0,1,1,0),this.wallMode){const Pt=W(gt,lt);zp(this.wallVertexArray,K.joinNormals[gt],!Pt)}Ye.vertexLength++,this.footprintVertices.emplaceBack(at.x,at.y),je.push(at.x,at.y),A&&Lp(this.layoutVertexExtArray,S.projectTilePoint(Mt.x,Mt.y,a),S.upVector(a,Mt.x,Mt.y))}$&&(ee===0||he)&&(ut.length!==0&&ye(ut,ut[0])&&ut.pop(),this.groundEffect.addData(ut,Ce,v))}const Fe=this.wallMode?K.indices:Ip(je,Je);for(let Ve=0;Ve<Fe.length;Ve+=3)this.footprintIndices.emplaceBack(ot.vertexOffset+Fe[Ve+0],ot.vertexOffset+Fe[Ve+1],ot.vertexOffset+Fe[Ve+2]),this.indexArray.emplaceBack(Ue+Fe[Ve],Ue+Fe[Ve+2],Ue+Fe[Ve+1]),Ye.primitiveLength++;ot.indexCount+=Fe.length,ot.vertexCount+=this.footprintVertices.length-ot.vertexOffset}for(let je=0;je<ve.length;je++){const Je=ve[je];R.startRing(O,Je[0]);let Fe=Je.length>4&&u2(Je[Je.length-2],Je[0],Je[1]),Ve=ee?gk(Je[Je.length-2],Je[0],Je[1],ee):0;const lt=[];let ut,zt,Et;zt=Je[1].sub(Je[0])._perp()._unit();let gt=!0;for(let at=1,Xt=0;at<Je.length;at++){let Mt=Je[at-1],Pt=Je[at];const Ht=Je[at===Je.length-1?1:at+1];if(R.appendEdge(O,Pt,Mt),S0(Pt,Mt,Ce)){ee&&(zt=Ht.sub(Pt)._perp()._unit(),gt=!gt);continue}const ii=Pt.sub(Mt)._perp(),oi=ii.x/(Math.abs(ii.x)+Math.abs(ii.y)),fi=ii.y>0?1:0,ci=Mt.dist(Pt);if(Xt+ci>32768&&(Xt=0),ee){Et=Ht.sub(Pt)._perp()._unit();let J=l2(Mt,Pt,Ht,a2(zt,Et),ee);isNaN(J)&&(J=0);const te=Pt.sub(Mt)._unit();Mt=Mt.add(te.mult(Ve))._round(),Pt=Pt.add(te.mult(-J))._round(),Ve=J,zt=Et,$&&this.zoom>=17&&(ye(lt,Mt)||lt.push(Mt),ye(lt,Pt)||lt.push(Pt))}const ai=Ye.vertexLength,tr=Je.length>4&&u2(Mt,Pt,Ht);let ur=h2(Xt,Fe,gt);if(Rp(this.layoutVertexArray,Mt.x,Mt.y,oi,fi,0,0,ur),Rp(this.layoutVertexArray,Mt.x,Mt.y,oi,fi,0,1,ur),this.wallMode){const J=W(at-1,Je),te=K.joinNormals[at-1];zp(this.wallVertexArray,te,J),zp(this.wallVertexArray,te,J)}if(Xt+=ci,ur=h2(Xt,tr,!gt),Fe=tr,Rp(this.layoutVertexArray,Pt.x,Pt.y,oi,fi,0,0,ur),Rp(this.layoutVertexArray,Pt.x,Pt.y,oi,fi,0,1,ur),this.wallMode){const J=W(at,Je),te=K.joinNormals[at];zp(this.wallVertexArray,te,J),zp(this.wallVertexArray,te,J)}if(Ye.vertexLength+=4,this.indexArray.emplaceBack(ai+0,ai+1,ai+2),this.indexArray.emplaceBack(ai+1,ai+3,ai+2),Ye.primitiveLength+=2,ee){const J=Ue+(at===1?Je.length-2:at-2),te=at===1?Ue:J+1;if(this.indexArray.emplaceBack(ai+1,J,ai+3),this.indexArray.emplaceBack(J,te,ai+3),Ye.primitiveLength+=2,ut===void 0&&(ut=ai),!S0(Ht,Je[at],Ce)){const Ge=at===Je.length-1?ut:Ye.vertexLength;this.indexArray.emplaceBack(ai+2,ai+3,Ge),this.indexArray.emplaceBack(ai+3,Ge+1,Ge),this.indexArray.emplaceBack(ai+3,te,Ge+1),Ye.primitiveLength+=3}gt=!gt}if(A){const J=this.layoutVertexExtArray,te=S.projectTilePoint(Mt.x,Mt.y,a),Ge=S.projectTilePoint(Pt.x,Pt.y,a),pt=S.upVector(a,Mt.x,Mt.y),vt=S.upVector(a,Pt.x,Pt.y);Lp(J,te,pt),Lp(J,te,pt),Lp(J,Ge,vt),Lp(J,Ge,vt)}}D&&(Ue+=Je.length-1),$&&ee&&this.zoom>=17&&(lt.length!==0&&ye(lt,lt[0])&<.pop(),this.groundEffect.addData(lt,Ce,v,ee>0))}this.footprintSegments.push(ot),Qe.triangleCount=this.indexArray.length-Qe.triangleArrayOffset,this.polygonSegments.push(Qe),++O.footprintSegLen,++O.polygonSegLen}if(O.vertexCount=this.layoutVertexArray.length-O.vertexArrayOffset,O.groundVertexCount=this.groundEffect.vertexArray.length-O.groundVertexArrayOffset,O.vertexCount!==0){if(O.centroidXY=R.borders?t2:this.encodeCentroid(R,O),this.centroidData.push(O),R.borders){this.featuresOnBorder.push(R);const ve=this.featuresOnBorder.length-1;for(let Ce=0;Ce<R.borders.length;Ce++)R.borders[Ce][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[Ce].push(ve)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,h,a,g),this.groundEffect.addPaintPropertiesData(e,s,u,h,a,g),this.maxHeight=Math.max(this.maxHeight,H)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,s)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[s].borders[e][0])}splitToSubtiles(){const e=[];for(let m=0;m<this.centroidData.length;m++){const g=this.centroidData[m],v=+(g.min.y+g.max.y>_t),w=2*v+(+(g.min.x+g.max.x>_t)^v);for(let S=0;S<g.polygonSegLen;S++){const A=g.polygonSegIdx+S;e.push({centroidIdx:m,subtile:w,polygonSegmentIdx:A,triangleSegmentIdx:this.polygonSegments[A].triangleSegIdx})}}const i=new fn;e.sort((m,g)=>m.triangleSegmentIdx===g.triangleSegmentIdx?m.subtile-g.subtile:m.triangleSegmentIdx-g.triangleSegmentIdx);let s=0,a=0,u=0;for(const m of e){if(m.triangleSegmentIdx!==s)break;u++}const h=e.length;for(;a!==e.length;){s=e[a].triangleSegmentIdx;let m=0,g=a,v=a;for(let w=g;w<u&&e[w].subtile===m;w++)v++;for(;g!==u;){const w=e[g];m=w.subtile;const S=this.centroidData[w.centroidIdx].min.clone(),A=this.centroidData[w.centroidIdx].max.clone(),D={vertexOffset:this.segments.segments[s].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[s].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let R=g;R<v;R++){const O=e[R],$=this.polygonSegments[O.polygonSegmentIdx],H=this.centroidData[O.centroidIdx].min,K=this.centroidData[O.centroidIdx].max,W=this.indexArray.uint16;for(let F=$.triangleArrayOffset;F<$.triangleArrayOffset+$.triangleCount;F++)i.emplaceBack(W[3*F],W[3*F+1],W[3*F+2]);D.primitiveLength+=$.triangleCount,S.x=Math.min(S.x,H.x),S.y=Math.min(S.y,H.y),A.x=Math.max(A.x,K.x),A.y=Math.max(A.y,K.y)}D.primitiveLength>0&&this.triangleSubSegments.push({segment:D,min:S,max:A}),g=v;for(let R=g;R<u&&e[R].subtile===e[g].subtile;R++)v++}a=u;for(let w=a;w<h&&e[w].triangleSegmentIdx===e[a].triangleSegmentIdx;w++)u++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,s){const a=new Cr;if(this.wallMode){for(const O of this.triangleSubSegments)a.segments.push(O.segment);return a}let u=0,h=0;const m=1<<e.canonical.z;if(i){const O=i.getMinMaxForTile(e);O&&(u=O.min,h=O.max)}h+=this.maxHeight;const g=e.toUnwrapped();let v;const w=[g.canonical.x/m+g.wrap,g.canonical.y/m],S=[(g.canonical.x+1)/m+g.wrap,(g.canonical.y+1)/m],A=(O,$,H)=>[O[0]*(1-H[0])+$[0]*H[0],O[1]*(1-H[1])+$[1]*H[1]],D=[],R=[];for(const O of this.triangleSubSegments){D[0]=O.min.x/_t,D[1]=O.min.y/_t,R[0]=O.max.x/_t,R[1]=O.max.y/_t;const $=A(w,S,D),H=A(w,S,R);if(new xr([$[0],$[1],u],[H[0],H[1],h]).intersectsPrecise(s)===0){v&&(a.segments.push(v),v=void 0);continue}const K=O.segment;v&&v.vertexOffset!==K.vertexOffset&&(a.segments.push(v),v=void 0),v?(v.vertexLength+=K.vertexLength,v.primitiveLength+=K.primitiveLength):v={vertexOffset:K.vertexOffset,primitiveLength:K.primitiveLength,vertexLength:K.vertexLength,primitiveOffset:K.primitiveOffset,sortKey:void 0,vaos:{}}}return v&&a.segments.push(v),a}encodeCentroid(e,i){const s=e.centroid(),a=i.span(),u=Math.min(7,Math.round(a.x*this.tileToMeter/10)),h=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new ft(Te(s.x,1,_t-1)<<3|u,Te(s.y,1,_t-1)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new ft(0,0);const i=e.borders,s=Number.MAX_VALUE;if(i[0][0]!==s||i[1][0]!==s){const a=i[0][0]!==s?0:1;return new ft(6|(i[0][0]!==s?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==s?2:3;return new ft((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==s?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=Gl,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,s=e.vertexCount+e.vertexArrayOffset,a=e.flags&Gl?t2:e.centroidXY,u=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||u!==a.x){for(let h=i;h<s;++h)this.centroidVertexArray.emplace(h,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i,s){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(b0(this.activeReplacements,a))return;if(this.activeReplacements=a,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const h of this.centroidData)h.flags&=2147483647;const u=[];for(const h of this.activeReplacements){if(h.order<s)continue;const m=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));for(const g of this.centroidData)if(!(g.flags&Gl||h.min.x>g.max.x||g.min.x>h.max.x||h.min.y>g.max.y||g.min.y>h.max.y))for(let v=0;v<g.footprintSegLen;v++){const w=this.footprintSegments[g.footprintSegIdx+v];if(u.length=0,yk(this.footprintVertices,w.vertexOffset,w.vertexCount,h.footprintTileId.canonical,e.canonical,u),Yw(h.footprint,u,this.footprintIndices.uint16,w.indexOffset,w.indexCount,-w.vertexOffset,-m)){g.flags|=Gl;break}}}for(const h of this.centroidData)this.writeCentroidToBuffer(h);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,s){let a=!1;for(let u=0;u<s.footprintSegLen;u++){const h=this.footprintSegments[s.footprintSegIdx+u];let m=0;for(const g of h.ringIndices){for(let v=m,w=g+m-1;v<g+m;w=v++){const S=this.footprintVertices.int16[2*(v+h.vertexOffset)+0],A=this.footprintVertices.int16[2*(v+h.vertexOffset)+1],D=this.footprintVertices.int16[2*(w+h.vertexOffset)+1];A>i!=D>i&&e<(this.footprintVertices.int16[2*(w+h.vertexOffset)+0]-S)*(i-A)/(D-A)+S&&(a=!a)}m=g}}return a}getHeightAtTileCoord(e,i){let s=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+_t)*_t+(i+_t);if(this.partLookup.hasOwnProperty(u)){const h=this.partLookup[u];return h?{height:h.height,hidden:!!(h.flags&Gl)}:void 0}for(const h of this.centroidData)e>h.max.x||h.min.x>e||i>h.max.y||h.min.y>i||this.footprintContainsPoint(e,i,h)&&h&&h.height>s&&(s=h.height,this.partLookup[u]=h,a=!!(h.flags&Gl));if(s!==Number.NEGATIVE_INFINITY)return{height:s,hidden:a};this.partLookup[u]=void 0}}function a2(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function gk(r,e,i,s){const a=e.sub(r)._perp()._unit(),u=i.sub(e)._perp()._unit();return l2(r,e,i,a2(a,u),s)}function l2(r,e,i,s,a){const u=Math.sqrt(1-s*s);return Math.min(r.dist(e)/3,e.dist(i)/3,a*u/s)}function S0(r,e,i){return r.x<i[0].x&&e.x<i[0].x||r.x>i[1].x&&e.x>i[1].x||r.y<i[0].y&&e.y<i[0].y||r.y>i[1].y&&e.y>i[1].y}function c2(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function u2(r,e,i){if(r.x<0||r.x>=_t||e.x<0||e.x>=_t||i.x<0||i.x>=_t)return!1;const s=i.sub(e),a=s.perp(),u=r.sub(e);return(s.x*u.x+s.y*u.y)/Math.sqrt((s.x*s.x+s.y*s.y)*(u.x*u.x+u.y*u.y))>-.866&&a.x*u.x+a.y*u.y<0}function h2(r,e,i){const s=e?2|r:-3&r;return i?1|s:-2&s}function d2(){const r=Math.PI/32,e=Math.tan(r),i=B;return i*Math.sqrt(1+2*e*e)-i}function p2(r,e,i){const s=1<<i.z,a=de(i.x/s),u=de((i.x+1)/s),h=me(i.y/s),m=me((i.y+1)/s);return function(g,v,w,S,A=0,D){const R=[];if(!g.length||!w||!S)return R;const O=(Y,ee)=>{for(const he of Y)R.push({polygon:he,bounds:ee})},$=Math.ceil(Math.log2(w)),H=Math.ceil(Math.log2(S)),K=$-H,W=[];for(let Y=0;Y<Math.abs(K);Y++)W.push(K>0?0:1);for(let Y=0;Y<Math.min($,H);Y++)W.push(0),W.push(1);let F=g;if(F=a_(F,v[0].y-A,v[1].y+A,1),F=a_(F,v[0].x-A,v[1].x+A,0),!F.length)return R;const q=[];for(W.length?q.push({polygons:F,bounds:v,depth:0}):O(F,v);q.length;){const Y=q.pop(),ee=Y.depth,he=W[ee],ye=Y.bounds[0],ve=Y.bounds[1],Ce=he===0?ye.x:ye.y,Ue=he===0?ve.x:ve.y,et=D?D(he,Ce,Ue):.5*(Ce+Ue),Ye=a_(Y.polygons,Ce-A,et+A,he),Qe=a_(Y.polygons,et-A,Ue+A,he);if(Ye.length){const ot=[ye,new ft(he===0?et:ve.x,he===1?et:ve.y)];W.length>ee+1?q.push({polygons:Ye,bounds:ot,depth:ee+1}):O(Ye,ot)}if(Qe.length){const ot=[new ft(he===0?et:ye.x,he===1?et:ye.y),ve];W.length>ee+1?q.push({polygons:Qe,bounds:ot,depth:ee+1}):O(Qe,ot)}}return R}(r,e,Math.ceil((u-a)/11.25),Math.ceil((h-m)/11.25),1,(g,v,w)=>{if(g===0)return .5*(v+w);{const S=me((i.y+v/_t)/s);return(le(.5*(me((i.y+w/_t)/s)+S))*s-i.y)*_t}})}function yk(r,e,i,s,a,u){const h=Math.pow(2,s.z-a.z);for(let m=0;m<i;m++){let g=r.int16[2*(m+e)+0],v=r.int16[2*(m+e)+1];g=(g+a.x*_t)*h-s.x*_t,v=(v+a.y*_t)*h-s.y*_t,u.push(new ft(g,v))}}let f2,m2;Tt(h_,"FillExtrusionBucket",{omit:["layers","features"]}),Tt(r2,"PartData"),Tt(i2,"FootprintSegment"),Tt(n2,"BorderCentroidData"),Tt(s2,"GroundEffect");class eu extends ft{constructor(e,i,s){super(e,i),this.z=s}}class _2 extends eu{constructor(e,i,s,a){super(e,i,s),this.w=a}}function g2(r,e,i,s){const a=i==="x"?"y":"x",u=(s-r[i])/(e[i]-r[i]);r[a]=Math.round(r[a]+(e[a]-r[a])*u),r[i]=s,r.hasOwnProperty("z")&&(r.z=Nt(r.z,e.z,u)),r.hasOwnProperty("w")&&(r.w=Nt(r.w,e.w,u))}function y2(r,e,i,s){const a=i,u=s;for(const h of["x","y"]){let m=r,g=e;m[h]>=g[h]&&(m=e,g=r),m[h]<a&&g[h]>a&&g2(m,g,h,a),m[h]<u&&g[h]>u&&g2(g,m,h,u)}}function d_(r,e,i,s,a,u){const h=[];for(let m=0;m<r.length;m++){const g=r[m];let v;const w=h.length;let S=0;for(let A=0;A<g.length-1;A++){let D=g[A],R=g[A+1],O=0;const $=S;let H,K;u&&(O=Math.hypot(R.x-D.x,R.y-D.y),S+=O,H=D,K=R),D.x<e&&R.x<e||(D.x<e?D=new ft(e,D.y+(e-D.x)/(R.x-D.x)*(R.y-D.y))._round():R.x<e&&(R=new ft(e,D.y+(e-D.x)/(R.x-D.x)*(R.y-D.y))._round()),D.y<i&&R.y<i||(D.y<i?D=new ft(D.x+(i-D.y)/(R.y-D.y)*(R.x-D.x),i)._round():R.y<i&&(R=new ft(D.x+(i-D.y)/(R.y-D.y)*(R.x-D.x),i)._round()),D.x>=s&&R.x>=s||(D.x>=s?D=new ft(s,D.y+(s-D.x)/(R.x-D.x)*(R.y-D.y))._round():R.x>=s&&(R=new ft(s,D.y+(s-D.x)/(R.x-D.x)*(R.y-D.y))._round()),D.y>=a&&R.y>=a||(D.y>=a?D=new ft(D.x+(a-D.y)/(R.y-D.y)*(R.x-D.x),a)._round():R.y>=a&&(R=new ft(D.x+(a-D.y)/(R.y-D.y)*(R.x-D.x),a)._round()),v&&D.equals(v[v.length-1])||(v=[D],h.push(v),u&&u.push({progress:{min:$+v2(H,K,D)*O,max:1},parentIndex:m,prevPoint:H,nextPoint:K})),v.push(R),u&&(u[u.length-1].progress.max=$+v2(H,K,R)*O,u[u.length-1].nextPoint=K)))))}if(u&&S>0)for(let A=w;A<h.length;A++)u[A].progress.min/=S,u[A].progress.max/=S}return h}function vk(r,e,i,s,a){if(r.length<2)return void s.push(r);const u=[];for(;e.valid();){const[v,w]=e.get();for(let S=0;S<r.length-1;S++){const A=r[S],D=r[S+1],R=Ir(A,D,v,w);if(R){const[O]=R,$=new ft(Nt(A.x,D.x,O),Nt(A.y,D.y,O));u.push({t:S+O,distance:0,point:$})}}e.next()}if(u.length===0)return void s.push(r);u.sort((v,w)=>v.t-w.t);let h=0,m=0,g=[];for(s.push(g);h!==r.length;){if(m===u.length){for(;h!==r.length;)g.length!==0&&g[g.length-1].equals(r[h])||g.push(r[h]),h++;break}u[m].t<=h?(g.length!==0&&g[g.length-1].equals(u[m].point)||g.push(u[m].point),Math.trunc(u[m].t),m++):(g.length!==0&&g[g.length-1].equals(r[h])||g.push(r[h]),h++)}}function v2(r,e,i){return r.x!==e.x?(i.x-r.x)/(e.x-r.x):r.y!==e.y?(i.y-r.y)/(e.y-r.y):0}function kp(r,e){return r.x*e.x+r.y*e.y}function x2(r,e){if(r.length===1){let i=0;const s=e[i++];let a;for(;!a||s.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const u=e[i],h=r[0],m=a.sub(s),g=u.sub(s),v=h.sub(s),w=kp(m,m),S=kp(m,g),A=kp(g,g),D=kp(v,m),R=kp(v,g),O=w*A-S*S,$=(A*D-S*R)/O,H=(w*R-S*D)/O,K=s.z*(1-$-H)+a.z*$+u.z*H;if(isFinite(K))return K}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}function b2(r,e,i,s,a,u,h,m){const g=h*a.getElevationAt(r,e,!0,!0),v=u[0]!==0,w=v?u[1]===0?h*(u[0]/7-450):h*function(S,A,D){const R=Math.floor(A[0]/8),O=Math.floor(A[1]/8),$=10*(A[0]-8*R),H=10*(A[1]-8*O),K=S.getElevationAt(R,O,!0,!0),W=S.getMeterToDEM(D),F=Math.floor(.5*($*W-1)),q=Math.floor(.5*(H*W-1)),Y=S.tileCoordToPixel(R,O),ee=2*F+1,he=2*q+1,ye=function(Qe,ot,je,Je,Fe){return[Qe.getElevationAtPixel(ot,je,!0),Qe.getElevationAtPixel(ot+Fe,je,!0),Qe.getElevationAtPixel(ot,je+Fe,!0),Qe.getElevationAtPixel(ot+Je,je+Fe,!0)]}(S,Y.x-F,Y.y-q,ee,he),ve=Math.abs(ye[0]-ye[1]),Ce=Math.abs(ye[2]-ye[3]),Ue=Math.abs(ye[0]-ye[2])+Math.abs(ye[1]-ye[3]),et=Math.min(.25,.5*W*(ve+Ce)/ee),Ye=Math.min(.25,.5*W*Ue/he);return K+Math.max(et*$,Ye*H)}(a,u,m):g;return{base:g+(i===0?-1:i),top:v?Math.max(w+s,g+i+2):g+s}}const xk=ki([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),bk=ki([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:wk}=xk,Tk=ki([{name:"a_packed",components:3,type:"Float32"}]),{members:Sk}=Tk,Ek=ki([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:Ak}=Ek;class w2{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new Ul({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const s=this.getKey(e,i);return this.positions[s]}trim(){const e=this.width,i=this.height=Rt(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,s){const a=[];let u=e.length%2==1?-e[e.length-1]*s:0,h=e[0]*s,m=!0;a.push({left:u,right:h,isDash:m,zeroLength:e[0]===0});let g=e[0];for(let v=1;v<e.length;v++){m=!m;const w=e[v];u=g*s,g+=w,h=g*s,a.push({left:u,right:h,isDash:m,zeroLength:w===0})}return a}addRoundDash(e,i,s){const a=i/2;for(let u=-s;u<=s;u++){const h=this.width*(this.nextRow+s+u);let m=0,g=e[m];for(let v=0;v<this.width;v++){v/g.right>1&&(g=e[++m]);const w=Math.abs(v-g.left),S=Math.abs(v-g.right),A=Math.min(w,S);let D;const R=u/s*(a+1);if(g.isDash){const O=a-Math.abs(R);D=Math.sqrt(A*A+O*O)}else D=a-Math.sqrt(A*A+R*R);this.image.data[h+v]=Math.max(0,Math.min(255,D+128))}}}addRegularDash(e,i){for(let g=e.length-1;g>=0;--g){const v=e[g],w=e[g+1];v.zeroLength?e.splice(g,1):w&&w.isDash===v.isDash&&(w.left=v.left,e.splice(g,1))}const s=e[0],a=e[e.length-1];s.isDash===a.isDash&&(s.left=a.left-this.width,a.right=s.right+this.width);const u=this.width*this.nextRow;let h=0,m=e[h];for(let g=0;g<this.width;g++){g/m.right>1&&(m=e[++h]);const v=Math.abs(g-m.left),w=Math.abs(g-m.right),S=Math.min(v,w);this.image.data[u+g]=Math.max(0,Math.min(255,(m.isDash?S:-S)+i+128))}}addDash(e,i){const s=this.getKey(e,i);if(this.positions[s])return this.positions[s];const a=i==="round",u=a?7:0,h=2*u+1;if(this.nextRow+h>this.height)return yi("LineAtlas out of space"),null;e.length===0&&e.push(1);let m=0;for(let w=0;w<e.length;w++)e[w]<0&&(yi("Negative value is found in line dasharray, replacing values with 0"),e[w]=0),m+=e[w];if(m!==0){const w=this.width/m,S=this.getDashRanges(e,this.width,w);a?this.addRoundDash(S,w,u):this.addRegularDash(S,i==="square"?.5*w:0)}const g=this.nextRow+u;this.nextRow+=h;const v={tl:[g,u],br:[m,0]};return this.positions[s]=v,v}}Tt(w2,"LineAtlas");const Ik=$l.VectorTileFeature.types,Ck=Math.cos(Math.PI/180*37.5),Mk=Math.cos(Math.PI/180*5);class E0{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new pp,this.layoutVertexArray2=new Yo,this.patternVertexArray=new Yo,this.indexArray=new fn,this.programConfigurations=new Ha(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Cr,this.maxLineLength=0,this.zOffsetVertexArray=new Yo,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:_t/64}updateFootprints(e,i){}populate(e,i,s,a){this.hasPattern=c0("line",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("line-sort-key");this.tileToMeter=De(s);const h=this.layers[0].layout.get("line-elevation-reference");if(h==="hd-road-markup")this.elevationType="road";else{const A=this.layers[0].layout.get("line-z-offset"),D=A.isConstant()&&!A.constantOr(0);this.elevationType=h!=="sea"&&h!=="ground"&&D?"none":"offset",this.elevationType==="offset"&&h==="none"&&yi(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const m=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&m!==void 0;const g=[];for(const{feature:A,id:D,index:R,sourceLayerIndex:O}of e){const $=this.layers[0]._featureFilter.needGeometry,H=Lt(A,$);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),H,s))continue;const K=u?u.evaluate(H,{},s):void 0,W={id:D,properties:A.properties,type:A.type,sourceLayerIndex:O,index:R,geometry:$?H.geometry:At(A,s,a),patterns:{},sortKey:K};g.push(W)}u&&g.sort((A,D)=>A.sortKey-D.sortKey);const{lineAtlas:v,featureIndex:w}=i,S=this.addConstantDashes(v);for(const A of g){const{geometry:D,index:R,sourceLayerIndex:O}=A;if(S&&this.addFeatureDashes(A,v),this.hasPattern){const $=u0("line",this.layers,A,this.zoom,this.pixelRatio,i);this.patternFeatures.push($)}else this.addFeature(A,D,R,s,v.positions,i.availableImages,i.brightness,i.elevationFeatures);w.insert(e[R].feature,D,R,O,this.index)}}addConstantDashes(e){let i=!1;for(const s of this.layers){const a=s.paint.get("line-dasharray").value,u=s.layout.get("line-cap").value;if(a.kind!=="constant"||u.kind!=="constant")i=!0;else{const h=u.value,m=a.value;if(!m)continue;e.addDash(m,h)}}return i}addFeatureDashes(e,i){const s=this.zoom;for(const a of this.layers){const u=a.paint.get("line-dasharray").value,h=a.layout.get("line-cap").value;if(u.kind==="constant"&&h.kind==="constant")continue;let m,g;if(u.kind==="constant"){if(m=u.value,!m)continue}else m=u.evaluate({zoom:s},e);g=h.kind==="constant"?h.value:h.evaluate({zoom:s},e),i.addDash(m,g),e.patterns[a.id]=[i.getKey(m,g)]}}update(e,i,s,a,u,h,m){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m)}addFeatures(e,i,s,a,u,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,i,s,a,h)}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,Sk)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,Ak)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,bk.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,wk),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,s,a,u,h,m,g){const v=this.layers[0].layout,w=v.get("line-join").evaluate(e,{}),S=v.get("line-cap").evaluate(e,{}),A=v.get("line-miter-limit"),D=v.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=v.get("line-z-offset").value;const R=this.layers[0].paint.get("line-width").value;if(R.kind!=="constant"&&R.isLineProgressConstant===!1&&(this.variableWidthValue=R),this.elevationType==="road"){const O=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,g,w,S,A,D)){const[$,H]=this.clipRuntimeLinesToTile(i,1);for(let K=0;K<$.length;K++){const W=$[K],F=H[K],q={progress:{min:F.progress.min,max:F.progress.max},nextDir:this.computeSegNextDir(F,W),prevDir:this.computeSegPrevDir(F,W)};this.addLine(W,e,a,w,S,A,D,q)}this.fillNonElevatedRoadSegment(O)}}else for(const O of i)this.addLine(O,e,a,w,S,A,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,h,a,m)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return d_(e,-i,-i,_t+i,_t+i)}clipRuntimeLinesToTile(e,i){const s=[];return[d_(e,-i,-i,_t+i,_t+i,s),s]}addElevatedRoadFeature(e,i,s,a,u,h,m,g){const v=[],w=m0.getElevationFeature(e,a);if(w){const S=this.clipLinesToTile(i,1),A=this.prepareElevatedLines(S,w,s);for(const D of A)v.push({geometry:D,elevation:w,elevationTileID:s,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(v.length===0)return!1;for(const S of v){const A=this.layoutVertexArray.length;this.addLine(S.geometry,e,s,u,h,m,g);const D=new Ow(s,S.elevationTileID);if(S.elevation)for(let R=A;R<this.layoutVertexArray.length;R++){const O=new ft(this.layoutVertexArray.int16[6*R]>>1,this.layoutVertexArray.int16[6*R+1]>>1),$=D.pointElevation(O,S.elevation,.05);this.updateHeightRange($),this.zOffsetVertexArray.emplaceBack($,0,0)}else this.fillNonElevatedRoadSegment(A)}return!0}prepareElevatedLines(e,i,s){if(i.constantHeight!=null)return e;const a=[],u=1/De(s);for(const h of e)vk(h,new kw(i,u),0,a);return a}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,i,s,a,u,h,m,g){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0;const v=a==="none";this.patternJoinNone=this.hasPattern&&v,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const w=g&&g.progress.min>0,S=g&&g.progress.max<1;if(this.lineClips){let he={min:this.lineClips.start,max:this.lineClips.end},ye=1;if(g){const Ue=this.lineClips.end-this.lineClips.start;he=function(et,Ye,Qe){return{min:yn(et.min,Ye,Qe),max:yn(et.max,Ye,Qe)}}(g.progress,{min:0,max:1},he),Ue>0&&(ye=(he.max-he.min)/Ue)}const ve=+i.properties.mapbox_clip_feature_len,Ce=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(ve)||Number.isNaN(Ce)){for(let et=0;et<e.length-1;et++)this.totalDistance+=e[et].dist(e[et+1]);const Ue=this.totalDistance/(he.max-he.min);this.totalFeatureLength=Number.isFinite(Ue)?Ue:0,this.lineClips.start=he.min,this.lineClips.end=he.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=ve,this.distance=Ce*ye,this.lineClips.start=he.min,this.lineClips.end=he.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const A=Ik[i.type]==="Polygon";let D=e.length;for(;D>=2&&e[D-1].equals(e[D-2]);)D--;let R=0;for(;R<D-1&&e[R].equals(e[R+1]);)R++;if(D<(A?3:2))return;a==="bevel"&&(h=1.05);const O=this.segments.prepareSegment(10*D,this.layoutVertexArray,this.indexArray);let $,H,K,W,F,q,Y,ee;g&&g.prevDir&&(q=g.prevDir.perp()),g&&g.nextDir&&(Y=g.nextDir.perp()),this.e1=this.e2=-1,A&&($=e[D-2],F=e[R].sub($)._unit()._perp());for(let he=R;he<D;he++){if(K=he===D-1?A?e[R+1]:void 0:e[he+1],K&&e[he].equals(K))continue;F&&(W=F),$&&(H=$),$=e[he],ee=this.evaluateLineProgressFeatures(H?H.dist($):0),F=K?K.sub($)._unit()._perp():W,W=W||F;const ye=H&&K;let ve=ye?a:A||v?"butt":u;const Ce=W.x*F.x+W.y*F.y;if(v){const Fe=function(Ve){if(Ve.patternJoinNone){const lt=Ve.segmentPoints.length/2,ut=Ve.lineSoFar-Ve.segmentStart;for(let zt=0;zt<lt;++zt){const Et=Ve.segmentPoints[2*zt+1],gt=Math.round(Ve.segmentPoints[2*zt])+.5+.25*Et;Ve.patternVertexArray.emplaceBack(gt,ut,Ve.segmentStart),Ve.patternVertexArray.emplaceBack(gt,ut,Ve.segmentStart)}Ve.segmentPoints.length=0}Ve.e1=Ve.e2=-1};if(ye&&Ce<Mk){this.updateDistance(H,$),this.addCurrentVertex($,W,1,1,O,ee),Fe(this),this.addCurrentVertex($,F,-1,-1,O,ee);continue}if(H){if(!K){this.updateDistance(H,$),this.addCurrentVertex($,W,1,1,O,ee),Fe(this);continue}ve="miter"}}let Ue=W.add(F);Ue.x===0&&Ue.y===0||Ue._unit();const et=Ue.x*F.x+Ue.y*F.y,Ye=et!==0?1/et:1/0,Qe=2*Math.sqrt(2-2*et),ot=et<Ck&&H&&K,je=W.x*F.y-W.y*F.x>0,Je=this.overscaling<=16?15*_t/(512*this.overscaling):0;if(ye&&ve==="round"){if(Ye<m)ve="miter";else if(Ye<=2){const Fe=A0($,-10,_t+10);ve=this.elevationType==="offset"&&(Fe||this.hasCrossSlope)?"miter":"fakeround"}}if(ve==="miter"&&Ye>h&&(ve="bevel"),ve==="bevel"&&(Ye>2&&(ve="flipbevel"),Ye<h&&(ve="miter")),H&&!(ve==="miter"&&ot)&&this.updateDistance(H,$),ve==="miter")if(ot){const Fe=$.dist(H);if(Fe>2*Je){const lt=$.sub($.sub(H)._mult(Je/Fe)._round());this.updateDistance(H,lt),this.addCurrentVertex(lt,W,0,0,O,ee),H=lt}this.updateDistance(H,$),Ue._mult(Ye),this.addCurrentVertex($,Ue,0,0,O,ee);const Ve=$.dist(K);if(Ve>2*Je){const lt=$.add(K.sub($)._mult(Je/Ve)._round());this.updateDistance($,lt),this.addCurrentVertex(lt,F,0,0,O,ee),$=lt}}else Ue._mult(Ye),this.addCurrentVertex($,Ue,0,0,O,ee);else if(ve==="flipbevel"){if(Ye>100)Ue=F.mult(-1);else{const Fe=Ye*W.add(F).mag()/W.sub(F).mag();Ue._perp()._mult(Fe*(je?-1:1))}this.addCurrentVertex($,Ue,0,0,O,ee),this.addCurrentVertex($,Ue.mult(-1),0,0,O,ee)}else if(ve==="bevel"||ve==="fakeround"){ee!=null&&H&&this.addCurrentVertex($,Y||W,-1,-1,O,ee);const Fe=$.dist(H)<=2*Je&&ve!=="bevel",Ve=Ue.mult(je?1:-1);Ve._mult(Ye);const lt=F.mult(je?-1:1),ut=W.mult(je?-1:1),zt=this.evaluateLineProgressFeatures(this.distance);if(ee==null&&(this.addHalfVertex($,Ve.x,Ve.y,!1,!je,0,O,zt),Fe||this.addHalfVertex($,Ve.x+2*ut.x,Ve.y+2*ut.y,!1,je,0,O,zt)),ve==="fakeround"){const Et=Math.round(180*Qe/Math.PI/20);this.addHalfVertex($,ut.x,ut.y,!1,je,0,O,zt);for(let gt=0;gt<Et;gt++){let at=gt/Et;if(at!==.5){const Mt=at-.5;at+=at*Mt*(at-1)*((1.0904+Ce*(Ce*(3.55645-1.43519*Ce)-3.2452))*Mt*Mt+(.848013+Ce*(.215638*Ce-1.06021)))}const Xt=lt.sub(ut)._mult(at)._add(ut)._unit();this.addHalfVertex($,Xt.x,Xt.y,!1,je,0,O,zt)}this.addHalfVertex($,lt.x,lt.y,!1,je,0,O,zt)}Fe||ee!=null||this.addHalfVertex($,Ve.x+2*lt.x,Ve.y+2*lt.y,!1,je,0,O,zt),ee!=null&&K&&this.addCurrentVertex($,q||F,1,1,O,ee)}else if(ve==="butt")this.addCurrentVertex($,Ue,0,0,O,ee);else if(ve==="square"){if(!H){const Fe=w?0:-1;this.addCurrentVertex($,Ue,Fe,Fe,O,ee)}if(this.addCurrentVertex($,Ue,0,0,O,ee),H){const Fe=S?0:1;this.addCurrentVertex($,Ue,Fe,Fe,O,ee)}}else if(ve==="round"){if(H){const Fe=!ye&&Y?Y:W;this.addCurrentVertex($,Fe,0,0,O,ee),!ye&&S||this.addCurrentVertex($,Fe,1,1,O,ee,!0)}if(K){const Fe=!ye&&q?q:F;!ye&&w||this.addCurrentVertex($,Fe,-1,-1,O,ee,!0),this.addCurrentVertex($,Fe,0,0,O,ee)}}}}addVerticesTo(e,i,s,a,u,h,m,g,v,w){const S=(i.w-e.w)/this.tessellationStep|0;let A=0;const D=this.scaledDistance;if(S>1){this.lineSoFar=e.w;const O=(i.x-e.x)/S,$=(i.y-e.y)/S,H=(i.z-e.z)/S,K=(i.w-e.w)/S;for(let W=1;W<S;++W){e.x+=O,e.y+=$,e.z+=H,this.lineSoFar+=K,A+=K;const F=this.evaluateLineProgressFeatures(this.prevDistance+A);this.scaledDistance=(this.prevDistance+A)/this.totalDistance,this.addHalfVertex(e,s,a,w,!1,m,v,F),this.addHalfVertex(e,u,h,w,!0,-g,v,F)}}this.lineSoFar=i.w,this.scaledDistance=D;const R=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,s,a,w,!1,m,v,R),this.addHalfVertex(i,u,h,w,!0,-g,v,R)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):yi(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:i}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}}addCurrentVertex(e,i,s,a,u,h,m=!1){const g=i.x+i.y*s,v=i.y-i.x*s,w=i.y*a-i.x,S=-i.y-i.x*a;if(h!=null){const A=this.elevationType==="offset",D=-10,R=_t+10,O=h.zOffset,$=new _2(e.x,e.y,O,this.lineSoFar),H=!!A&&A0(e,D,R),K=this.lineSoFar,W=this.distance;if(this.currentVertex)if(H){const F=this.currentVertexIsOutside,q=this.currentVertex,Y=new _2(e.x,e.y,O,this.lineSoFar);if(y2(q,Y,D,R),!A0(Y,D,R)){if(F){this.e1=this.e2=-1,this.distance-=q.dist($),this.lineSoFar=q.w;const ee=this.evaluateLineProgressFeatures(q.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(q,g,v,m,!1,s,u,ee),this.addHalfVertex(q,w,S,m,!0,-a,u,ee),this.prevDistance=this.distance}this.distance=this.prevDistance+q.dist(Y),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(q,Y,g,v,w,S,s,a,u,m),this.distance=W,this.scaledDistance=this.distance/this.totalDistance}}else{const F=this.currentVertex;if(this.currentVertexIsOutside){y2(F,$,D,R),this.e1=this.e2=-1,this.distance-=F.dist($),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=F.w;const q=this.evaluateLineProgressFeatures(F.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(F,g,v,m,!1,s,u,q),this.addHalfVertex(F,w,S,m,!0,-a,u,q),this.prevDistance=this.distance,this.distance=W,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(F,$,g,v,w,S,s,a,u,m)}else H||(this.addHalfVertex(e,g,v,m,!1,s,u,h),this.addHalfVertex(e,w,S,m,!0,-a,u,h));this.currentVertex=$,this.currentVertexIsOutside=H,this.lineSoFar=K}else this.addHalfVertex(e,g,v,m,!1,s,u,h),this.addHalfVertex(e,w,S,m,!0,-a,u,h)}addHalfVertex({x:e,y:i},s,a,u,h,m,g,v){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),h||this.segmentPoints.push(this.lineSoFar-this.segmentStart,m)),this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(i<<1)+(h?1:0),Math.round(63*s)+128,Math.round(63*a)+128,1+(m===0?0:m<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const S=Nt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,S)}const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),h?this.e2=w:this.e1=w,v!=null&&this.zOffsetVertexArray.emplaceBack(v.zOffset,v.variableWidth,v.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function A0(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}let T2,S2;function E2(r,e,i){return e*(_t/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}Tt(E0,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const A2=(r,e,i)=>(1-i)*r+i*e;function I2(r,e){return 1/E2(r,1,e.tileZoom)}function C2(r,e,i,s){return r.translatePosMatrix(s||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const M2=r=>{const e=[];P2(r)&&e.push("RENDER_LINE_DASH"),r.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=r.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),r.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const s=r.layout.get("line-join").constantOr("miter")==="none",a=!!r.paint.get("line-pattern").constantOr(1);return s&&a&&e.push("LINE_JOIN_NONE"),e};function P2(r){const e=r.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}let I0;const D2=()=>I0||(I0={layout:T2||(T2=new Nr({"line-cap":new wt(Re.layout_line["line-cap"]),"line-join":new wt(Re.layout_line["line-join"]),"line-miter-limit":new dt(Re.layout_line["line-miter-limit"]),"line-round-limit":new dt(Re.layout_line["line-round-limit"]),"line-sort-key":new wt(Re.layout_line["line-sort-key"]),"line-z-offset":new wt(Re.layout_line["line-z-offset"]),"line-elevation-reference":new dt(Re.layout_line["line-elevation-reference"]),"line-cross-slope":new dt(Re.layout_line["line-cross-slope"]),visibility:new dt(Re.layout_line.visibility),"line-width-unit":new dt(Re.layout_line["line-width-unit"])})),paint:S2||(S2=new Nr({"line-opacity":new wt(Re.paint_line["line-opacity"]),"line-color":new wt(Re.paint_line["line-color"]),"line-translate":new dt(Re.paint_line["line-translate"]),"line-translate-anchor":new dt(Re.paint_line["line-translate-anchor"]),"line-width":new wt(Re.paint_line["line-width"]),"line-gap-width":new wt(Re.paint_line["line-gap-width"]),"line-offset":new wt(Re.paint_line["line-offset"]),"line-blur":new wt(Re.paint_line["line-blur"]),"line-dasharray":new wt(Re.paint_line["line-dasharray"]),"line-pattern":new wt(Re.paint_line["line-pattern"]),"line-pattern-cross-fade":new dt(Re.paint_line["line-pattern-cross-fade"]),"line-gradient":new ja(Re.paint_line["line-gradient"]),"line-trim-offset":new dt(Re.paint_line["line-trim-offset"]),"line-trim-fade-range":new dt(Re.paint_line["line-trim-fade-range"]),"line-trim-color":new dt(Re.paint_line["line-trim-color"]),"line-emissive-strength":new dt(Re.paint_line["line-emissive-strength"]),"line-border-width":new wt(Re.paint_line["line-border-width"]),"line-border-color":new wt(Re.paint_line["line-border-color"]),"line-occlusion-opacity":new dt(Re.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},I0);class Pk extends wt{possiblyEvaluate(e,i){return i=new Wi(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,a){return i=Oe({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,a)}}let Op;function R2(r,e){return e>0?e+2*r:r}const Dk=ki([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Rk=ki([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),zk=ki([{name:"a_projected_pos",components:4,type:"Float32"}],4);ki([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Lk=ki([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),kk=ki([{name:"a_texb",components:2,type:"Uint16"}]),Ok=ki([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),Fk=ki([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);ki([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const z2=ki([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Bk=ki([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ki([{name:"triangle",components:3,type:"Uint16"}]),ki([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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:"Uint8",name:"flipState"}]),ki([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}]),ki([{type:"Float32",name:"offsetX"}]),ki([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var xn=24;function Nk(r,e,i){return r.sections.forEach(s=>{s.text=function(a,u,h){const m=u.layout.get("text-transform").evaluate(h,{});return m==="uppercase"?a=a.toLocaleUpperCase():m==="lowercase"&&(a=a.toLocaleLowerCase()),vo.applyArabicShaping&&(a=vo.applyArabicShaping(a)),a}(s.text,e,i)}),r}const Fp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function jk(r){return r==="︶"||r==="﹈"||r==="︸"||r==="﹄"||r==="﹂"||r==="︾"||r==="︼"||r==="︺"||r==="︘"||r==="﹀"||r==="︐"||r==="︓"||r==="︔"||r==="`"||r===" ̄"||r==="︑"||r==="︒"}function Vk(r){return r==="︵"||r==="﹇"||r==="︷"||r==="﹃"||r==="﹁"||r==="︽"||r==="︻"||r==="︹"||r==="︗"||r==="︿"}var L2,C0,k2,M0={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function Uk(){return L2||(L2=1,M0.read=function(r,e,i,s,a){var u,h,m=8*a-s-1,g=(1<<m)-1,v=g>>1,w=-7,S=i?a-1:0,A=i?-1:1,D=r[e+S];for(S+=A,u=D&(1<<-w)-1,D>>=-w,w+=m;w>0;u=256*u+r[e+S],S+=A,w-=8);for(h=u&(1<<-w)-1,u>>=-w,w+=s;w>0;h=256*h+r[e+S],S+=A,w-=8);if(u===0)u=1-v;else{if(u===g)return h?NaN:1/0*(D?-1:1);h+=Math.pow(2,s),u-=v}return(D?-1:1)*h*Math.pow(2,u-s)},M0.write=function(r,e,i,s,a,u){var h,m,g,v=8*u-a-1,w=(1<<v)-1,S=w>>1,A=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=s?0:u-1,R=s?1:-1,O=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,h=w):(h=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-h))<1&&(h--,g*=2),(e+=h+S>=1?A/g:A*Math.pow(2,1-S))*g>=2&&(h++,g/=2),h+S>=w?(m=0,h=w):h+S>=1?(m=(e*g-1)*Math.pow(2,a),h+=S):(m=e*Math.pow(2,S-1)*Math.pow(2,a),h=0));a>=8;r[i+D]=255&m,D+=R,m/=256,a-=8);for(h=h<<a|m,v+=a;v>0;r[i+D]=255&h,D+=R,h/=256,v-=8);r[i+D-R]|=128*O}),M0}function O2(){if(k2)return C0;k2=1,C0=e;var r=Uk();function e(F){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(F)?F:new Uint8Array(F||0),this.pos=0,this.type=0,this.length=this.buf.length}e.Varint=0,e.Fixed64=1,e.Bytes=2,e.Fixed32=5;var i=4294967296,s=1/i,a=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function u(F){return F.type===e.Bytes?F.readVarint()+F.pos:F.pos+1}function h(F,q,Y){return Y?4294967296*q+(F>>>0):4294967296*(q>>>0)+(F>>>0)}function m(F,q,Y){var ee=q<=16383?1:q<=2097151?2:q<=268435455?3:Math.floor(Math.log(q)/(7*Math.LN2));Y.realloc(ee);for(var he=Y.pos-1;he>=F;he--)Y.buf[he+ee]=Y.buf[he]}function g(F,q){for(var Y=0;Y<F.length;Y++)q.writeVarint(F[Y])}function v(F,q){for(var Y=0;Y<F.length;Y++)q.writeSVarint(F[Y])}function w(F,q){for(var Y=0;Y<F.length;Y++)q.writeFloat(F[Y])}function S(F,q){for(var Y=0;Y<F.length;Y++)q.writeDouble(F[Y])}function A(F,q){for(var Y=0;Y<F.length;Y++)q.writeBoolean(F[Y])}function D(F,q){for(var Y=0;Y<F.length;Y++)q.writeFixed32(F[Y])}function R(F,q){for(var Y=0;Y<F.length;Y++)q.writeSFixed32(F[Y])}function O(F,q){for(var Y=0;Y<F.length;Y++)q.writeFixed64(F[Y])}function $(F,q){for(var Y=0;Y<F.length;Y++)q.writeSFixed64(F[Y])}function H(F,q){return(F[q]|F[q+1]<<8|F[q+2]<<16)+16777216*F[q+3]}function K(F,q,Y){F[Y]=q,F[Y+1]=q>>>8,F[Y+2]=q>>>16,F[Y+3]=q>>>24}function W(F,q){return(F[q]|F[q+1]<<8|F[q+2]<<16)+(F[q+3]<<24)}return e.prototype={destroy:function(){this.buf=null},readFields:function(F,q,Y){for(Y=Y||this.length;this.pos<Y;){var ee=this.readVarint(),he=ee>>3,ye=this.pos;this.type=7&ee,F(he,q,this),this.pos===ye&&this.skip(ee)}return q},readMessage:function(F,q){return this.readFields(F,q,this.readVarint()+this.pos)},readFixed32:function(){var F=H(this.buf,this.pos);return this.pos+=4,F},readSFixed32:function(){var F=W(this.buf,this.pos);return this.pos+=4,F},readFixed64:function(){var F=H(this.buf,this.pos)+H(this.buf,this.pos+4)*i;return this.pos+=8,F},readSFixed64:function(){var F=H(this.buf,this.pos)+W(this.buf,this.pos+4)*i;return this.pos+=8,F},readFloat:function(){var F=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,F},readDouble:function(){var F=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,F},readVarint:function(F){var q,Y,ee=this.buf;return q=127&(Y=ee[this.pos++]),Y<128?q:(q|=(127&(Y=ee[this.pos++]))<<7,Y<128?q:(q|=(127&(Y=ee[this.pos++]))<<14,Y<128?q:(q|=(127&(Y=ee[this.pos++]))<<21,Y<128?q:function(he,ye,ve){var Ce,Ue,et=ve.buf;if(Ce=(112&(Ue=et[ve.pos++]))>>4,Ue<128||(Ce|=(127&(Ue=et[ve.pos++]))<<3,Ue<128)||(Ce|=(127&(Ue=et[ve.pos++]))<<10,Ue<128)||(Ce|=(127&(Ue=et[ve.pos++]))<<17,Ue<128)||(Ce|=(127&(Ue=et[ve.pos++]))<<24,Ue<128)||(Ce|=(1&(Ue=et[ve.pos++]))<<31,Ue<128))return h(he,Ce,ye);throw new Error("Expected varint not more than 10 bytes")}(q|=(15&(Y=ee[this.pos]))<<28,F,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var F=this.readVarint();return F%2==1?(F+1)/-2:F/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var F=this.readVarint()+this.pos,q=this.pos;return this.pos=F,F-q>=12&&a?function(Y,ee,he){return a.decode(Y.subarray(ee,he))}(this.buf,q,F):function(Y,ee,he){for(var ye="",ve=ee;ve<he;){var Ce,Ue,et,Ye=Y[ve],Qe=null,ot=Ye>239?4:Ye>223?3:Ye>191?2:1;if(ve+ot>he)break;ot===1?Ye<128&&(Qe=Ye):ot===2?(192&(Ce=Y[ve+1]))==128&&(Qe=(31&Ye)<<6|63&Ce)<=127&&(Qe=null):ot===3?(Ue=Y[ve+2],(192&(Ce=Y[ve+1]))==128&&(192&Ue)==128&&((Qe=(15&Ye)<<12|(63&Ce)<<6|63&Ue)<=2047||Qe>=55296&&Qe<=57343)&&(Qe=null)):ot===4&&(Ue=Y[ve+2],et=Y[ve+3],(192&(Ce=Y[ve+1]))==128&&(192&Ue)==128&&(192&et)==128&&((Qe=(15&Ye)<<18|(63&Ce)<<12|(63&Ue)<<6|63&et)<=65535||Qe>=1114112)&&(Qe=null)),Qe===null?(Qe=65533,ot=1):Qe>65535&&(Qe-=65536,ye+=String.fromCharCode(Qe>>>10&1023|55296),Qe=56320|1023&Qe),ye+=String.fromCharCode(Qe),ve+=ot}return ye}(this.buf,q,F)},readBytes:function(){var F=this.readVarint()+this.pos,q=this.buf.subarray(this.pos,F);return this.pos=F,q},readPackedVarint:function(F,q){if(this.type!==e.Bytes)return F.push(this.readVarint(q));var Y=u(this);for(F=F||[];this.pos<Y;)F.push(this.readVarint(q));return F},readPackedSVarint:function(F){if(this.type!==e.Bytes)return F.push(this.readSVarint());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readSVarint());return F},readPackedBoolean:function(F){if(this.type!==e.Bytes)return F.push(this.readBoolean());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readBoolean());return F},readPackedFloat:function(F){if(this.type!==e.Bytes)return F.push(this.readFloat());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readFloat());return F},readPackedDouble:function(F){if(this.type!==e.Bytes)return F.push(this.readDouble());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readDouble());return F},readPackedFixed32:function(F){if(this.type!==e.Bytes)return F.push(this.readFixed32());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readFixed32());return F},readPackedSFixed32:function(F){if(this.type!==e.Bytes)return F.push(this.readSFixed32());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readSFixed32());return F},readPackedFixed64:function(F){if(this.type!==e.Bytes)return F.push(this.readFixed64());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readFixed64());return F},readPackedSFixed64:function(F){if(this.type!==e.Bytes)return F.push(this.readSFixed64());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readSFixed64());return F},skip:function(F){var q=7&F;if(q===e.Varint)for(;this.buf[this.pos++]>127;);else if(q===e.Bytes)this.pos=this.readVarint()+this.pos;else if(q===e.Fixed32)this.pos+=4;else{if(q!==e.Fixed64)throw new Error("Unimplemented type: "+q);this.pos+=8}},writeTag:function(F,q){this.writeVarint(F<<3|q)},realloc:function(F){for(var q=this.length||16;q<this.pos+F;)q*=2;if(q!==this.length){var Y=new Uint8Array(q);Y.set(this.buf),this.buf=Y,this.length=q}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(F){this.realloc(4),K(this.buf,F,this.pos),this.pos+=4},writeSFixed32:function(F){this.realloc(4),K(this.buf,F,this.pos),this.pos+=4},writeFixed64:function(F){this.realloc(8),K(this.buf,-1&F,this.pos),K(this.buf,Math.floor(F*s),this.pos+4),this.pos+=8},writeSFixed64:function(F){this.realloc(8),K(this.buf,-1&F,this.pos),K(this.buf,Math.floor(F*s),this.pos+4),this.pos+=8},writeVarint:function(F){(F=+F||0)>268435455||F<0?function(q,Y){var ee,he;if(q>=0?(ee=q%4294967296|0,he=q/4294967296|0):(he=~(-q/4294967296),4294967295^(ee=~(-q%4294967296))?ee=ee+1|0:(ee=0,he=he+1|0)),q>=18446744073709552e3||q<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");Y.realloc(10),function(ye,ve,Ce){Ce.buf[Ce.pos++]=127&ye|128,ye>>>=7,Ce.buf[Ce.pos++]=127&ye|128,ye>>>=7,Ce.buf[Ce.pos++]=127&ye|128,ye>>>=7,Ce.buf[Ce.pos++]=127&ye|128,Ce.buf[Ce.pos]=127&(ye>>>=7)}(ee,0,Y),function(ye,ve){var Ce=(7&ye)<<4;ve.buf[ve.pos++]|=Ce|((ye>>>=3)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye)))))}(he,Y)}(F,this):(this.realloc(4),this.buf[this.pos++]=127&F|(F>127?128:0),F<=127||(this.buf[this.pos++]=127&(F>>>=7)|(F>127?128:0),F<=127||(this.buf[this.pos++]=127&(F>>>=7)|(F>127?128:0),F<=127||(this.buf[this.pos++]=F>>>7&127))))},writeSVarint:function(F){this.writeVarint(F<0?2*-F-1:2*F)},writeBoolean:function(F){this.writeVarint(!!F)},writeString:function(F){F=String(F),this.realloc(4*F.length),this.pos++;var q=this.pos;this.pos=function(ee,he,ye){for(var ve,Ce,Ue=0;Ue<he.length;Ue++){if((ve=he.charCodeAt(Ue))>55295&&ve<57344){if(!Ce){ve>56319||Ue+1===he.length?(ee[ye++]=239,ee[ye++]=191,ee[ye++]=189):Ce=ve;continue}if(ve<56320){ee[ye++]=239,ee[ye++]=191,ee[ye++]=189,Ce=ve;continue}ve=Ce-55296<<10|ve-56320|65536,Ce=null}else Ce&&(ee[ye++]=239,ee[ye++]=191,ee[ye++]=189,Ce=null);ve<128?ee[ye++]=ve:(ve<2048?ee[ye++]=ve>>6|192:(ve<65536?ee[ye++]=ve>>12|224:(ee[ye++]=ve>>18|240,ee[ye++]=ve>>12&63|128),ee[ye++]=ve>>6&63|128),ee[ye++]=63&ve|128)}return ye}(this.buf,F,this.pos);var Y=this.pos-q;Y>=128&&m(q,Y,this),this.pos=q-1,this.writeVarint(Y),this.pos+=Y},writeFloat:function(F){this.realloc(4),r.write(this.buf,F,this.pos,!0,23,4),this.pos+=4},writeDouble:function(F){this.realloc(8),r.write(this.buf,F,this.pos,!0,52,8),this.pos+=8},writeBytes:function(F){var q=F.length;this.writeVarint(q),this.realloc(q);for(var Y=0;Y<q;Y++)this.buf[this.pos++]=F[Y]},writeRawMessage:function(F,q){this.pos++;var Y=this.pos;F(q,this);var ee=this.pos-Y;ee>=128&&m(Y,ee,this),this.pos=Y-1,this.writeVarint(ee),this.pos+=ee},writeMessage:function(F,q,Y){this.writeTag(F,e.Bytes),this.writeRawMessage(q,Y)},writePackedVarint:function(F,q){q.length&&this.writeMessage(F,g,q)},writePackedSVarint:function(F,q){q.length&&this.writeMessage(F,v,q)},writePackedBoolean:function(F,q){q.length&&this.writeMessage(F,A,q)},writePackedFloat:function(F,q){q.length&&this.writeMessage(F,w,q)},writePackedDouble:function(F,q){q.length&&this.writeMessage(F,S,q)},writePackedFixed32:function(F,q){q.length&&this.writeMessage(F,D,q)},writePackedSFixed32:function(F,q){q.length&&this.writeMessage(F,R,q)},writePackedFixed64:function(F,q){q.length&&this.writeMessage(F,O,q)},writePackedSFixed64:function(F,q){q.length&&this.writeMessage(F,$,q)},writeBytesField:function(F,q){this.writeTag(F,e.Bytes),this.writeBytes(q)},writeFixed32Field:function(F,q){this.writeTag(F,e.Fixed32),this.writeFixed32(q)},writeSFixed32Field:function(F,q){this.writeTag(F,e.Fixed32),this.writeSFixed32(q)},writeFixed64Field:function(F,q){this.writeTag(F,e.Fixed64),this.writeFixed64(q)},writeSFixed64Field:function(F,q){this.writeTag(F,e.Fixed64),this.writeSFixed64(q)},writeVarintField:function(F,q){this.writeTag(F,e.Varint),this.writeVarint(q)},writeSVarintField:function(F,q){this.writeTag(F,e.Varint),this.writeSVarint(q)},writeStringField:function(F,q){this.writeTag(F,e.Bytes),this.writeString(q)},writeFloatField:function(F,q){this.writeTag(F,e.Fixed32),this.writeFloat(q)},writeDoubleField:function(F,q){this.writeTag(F,e.Fixed64),this.writeDouble(q)},writeBooleanField:function(F,q){this.writeVarintField(F,!!q)}},C0}var p_=Zo(O2());const P0=3;function $k(r,e,i){e.glyphs=[],r===1&&i.readMessage(Gk,e)}function Gk(r,e,i){if(r===3){const{id:s,bitmap:a,width:u,height:h,left:m,top:g,advance:v}=i.readMessage(Hk,{});e.glyphs.push({id:s,bitmap:new Ul({width:u+2*P0,height:h+2*P0},a),metrics:{width:u,height:h,left:m,top:g,advance:v}})}else r===4?e.ascender=i.readSVarint():r===5&&(e.descender=i.readSVarint())}function Hk(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}const F2=P0,lo={horizontal:1,vertical:2,horizontalOnly:3};class Bp{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const s=new Bp;return s.scale=e||1,s.fontStack=i,s}static forImage(e){const i=new Bp;return i.image=e,i}}class Oh{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,s){const a=new Oh;for(let u=0;u<e.sections.length;u++){const h=e.sections[u];h.image?a.addImageSection(h,s):a.addTextSection(h,i)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(i,s){let a="";for(let u=0;u<i.length;u++){const h=i.charCodeAt(u+1)||null,m=i.charCodeAt(u-1)||null;a+=!s&&(h&&Mm(h)&&!Fp[i[u+1]]||m&&Mm(m)&&!Fp[i[u-1]])||!Fp[i[u]]?i[u]:Fp[i[u]]}return a}(this.text,e)}trim(){let e=0;for(let s=0;s<this.text.length&&f_[this.text.charCodeAt(s)];s++)e++;let i=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&f_[this.text.charCodeAt(s)];s--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const s=new Oh;return s.text=this.text.substring(e,i),s.sectionIndex=this.sectionIndex.slice(e,i),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(Bp.forText(e.scale,e.fontStack||i));const s=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(s)}addImageSection(e,i){const s=e.image?e.image.getPrimary():null;if(!s)return void yi("Can't add FormattedSection with an empty image.");s.scaleSelf(i);const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(Bp.forImage(s)),this.sectionIndex.push(this.sections.length-1)):yi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function D0(r,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O=1){const $=Oh.fromFeature(r,a,O);S===lo.vertical&&$.verticalizePunctuation(A);let H=[];const K=function(ee,he,ye,ve,Ce,Ue){if(!ee)return[];const et=[],Ye=function(Je,Fe,Ve,lt,ut,zt){let Et=0;for(let gt=0;gt<Je.length();gt++){const at=Je.getSection(gt);Et+=B2(Je.getCodePoint(gt),at,lt,ut,Fe,zt)}return Et/Math.max(1,Math.ceil(Et/Ve))}(ee,he,ye,ve,Ce,Ue),Qe=ee.text.indexOf("")>=0;let ot=0;for(let Je=0;Je<ee.length();Je++){const Fe=ee.getSection(Je),Ve=ee.getCodePoint(Je);if(f_[Ve]||(ot+=B2(Ve,Fe,ve,Ce,he,Ue)),Je<ee.length()-1){const lt=!((je=Ve)<11904||!(jt["Bopomofo Extended"](je)||jt.Bopomofo(je)||jt["CJK Compatibility Forms"](je)||jt["CJK Compatibility Ideographs"](je)||jt["CJK Compatibility"](je)||jt["CJK Radicals Supplement"](je)||jt["CJK Strokes"](je)||jt["CJK Symbols and Punctuation"](je)||jt["CJK Unified Ideographs Extension A"](je)||jt["CJK Unified Ideographs"](je)||jt["Enclosed CJK Letters and Months"](je)||jt["Halfwidth and Fullwidth Forms"](je)||jt.Hiragana(je)||jt["Ideographic Description Characters"](je)||jt["Kangxi Radicals"](je)||jt["Katakana Phonetic Extensions"](je)||jt.Katakana(je)||jt["Vertical Forms"](je)||jt["Yi Radicals"](je)||jt["Yi Syllables"](je)));(qk[Ve]||lt||Fe.image)&&et.push(j2(Je+1,ot,Ye,et,Zk(Ve,ee.getCodePoint(Je+1),lt&&Qe),!1))}}var je;return V2(j2(ee.length(),ot,Ye,et,0,!0))}($,v,u,e,s,D),{processBidirectionalText:W,processStyledBidirectionalText:F}=vo;if(W&&$.sections.length===1){const ee=W($.toString(),K);for(const he of ee){const ye=new Oh;ye.text=he,ye.sections=$.sections;for(let ve=0;ve<he.length;ve++)ye.sectionIndex.push(0);H.push(ye)}}else if(F){const ee=F($.text,$.sectionIndex,K);for(const he of ee){const ye=new Oh;ye.text=he[0],ye.sectionIndex=he[1],ye.sections=$.sections,H.push(ye)}}else H=function(ee,he){const ye=[],ve=ee.text;let Ce=0;for(const Ue of he)ye.push(ee.substring(Ce,Ue)),Ce=Ue;return Ce<ve.length&&ye.push(ee.substring(Ce,ve.length)),ye}($,K);const q=[],Y={positionedLines:q,text:$.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:S,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(ee,he,ye,ve,Ce,Ue,et,Ye,Qe,ot,je,Je){let Fe=0,Ve=0,lt=0;const ut=Ye==="right"?1:Ye==="left"?0:.5;let zt=!1;for(const Pt of Ce){const Ht=Pt.getSections();for(const ii of Ht){if(ii.image)continue;const oi=he[ii.fontStack];if(oi&&(zt=oi.ascender!==void 0&&oi.descender!==void 0,!zt))break}if(!zt)break}let Et=0;for(const Pt of Ce){Pt.trim();const Ht=Pt.getMaxScale(),ii=(Ht-1)*xn,oi={positionedGlyphs:[],lineOffset:0};ee.positionedLines[Et]=oi;const fi=oi.positionedGlyphs;let ci=0;if(!Pt.length()){Ve+=Ue,++Et;continue}let ai=0,tr=0;for(let J=0;J<Pt.length();J++){const te=Pt.getSection(J),Ge=Pt.getSectionIndex(J),pt=Pt.getCodePoint(J);let vt=te.scale,yt=null,Dt=null,Gt=null,wi=xn,Ti=0;Qe===lo.vertical&&((gt=pt)===12312||gt===12313||gt===12316||gt===12540||gt===12448)&&(Qe=lo.horizontal);const li=!(Qe===lo.horizontal||!je&&!Oc(pt)||je&&(f_[pt]||$y(pt)));if(te.image){const Hi=ve.get(te.image.toString());if(!Hi)continue;Gt=te.image,ee.iconsInText=ee.iconsInText||!0,Dt=Hi.paddedRect;const sr=Hi.displaySize;vt=vt*xn/Je,yt={width:sr[0],height:sr[1],left:0,top:-F2,advance:li?sr[1]:sr[0],localGlyph:!1},Ti=zt?-yt.height*vt:Ht*xn-17-sr[1]*vt,wi=yt.advance;const Si=(li?sr[0]:sr[1])*vt-xn*Ht;Si>0&&Si>ci&&(ci=Si)}else{const Hi=ye[te.fontStack];if(!Hi)continue;Hi[pt]&&(Dt=Hi[pt]);const sr=he[te.fontStack];if(!sr)continue;const Si=sr.glyphs[pt];if(!Si)continue;if(yt=Si.metrics,wi=pt!==8203?xn:0,zt){const Mr=sr.ascender!==void 0?Math.abs(sr.ascender):0,hr=sr.descender!==void 0?Math.abs(sr.descender):0,Vi=(Mr+hr)*vt;ai<Vi&&(ai=Vi,tr=(Mr-hr)/2*vt),Ti=-Mr*vt}else Ti=(Ht-vt)*xn-17}li?(ee.verticalizable=!0,fi.push({glyph:pt,image:Gt,x:Fe,y:Ve+Ti,vertical:li,scale:vt,localGlyph:yt.localGlyph,fontStack:te.fontStack,sectionIndex:Ge,metrics:yt,rect:Dt}),Fe+=wi*vt+ot):(fi.push({glyph:pt,image:Gt,x:Fe,y:Ve+Ti,vertical:li,scale:vt,localGlyph:yt.localGlyph,fontStack:te.fontStack,sectionIndex:Ge,metrics:yt,rect:Dt}),Fe+=yt.advance*vt+ot)}fi.length!==0&&(lt=Math.max(Fe-ot,lt),zt?U2(fi,ut,ci,tr,Ue*Ht/2):U2(fi,ut,ci,0,Ue/2)),Fe=0;const ur=Ue*Ht+ci;oi.lineOffset=Math.max(ci,ii),Ve+=ur,++Et}var gt;const at=Ve,{horizontalAlign:Xt,verticalAlign:Mt}=R0(et);(function(Pt,Ht,ii,oi,fi,ci){const ai=(Ht-ii)*fi,tr=-ci*oi;for(const ur of Pt)for(const J of ur.positionedGlyphs)J.x+=ai,J.y+=tr})(ee.positionedLines,ut,Xt,Mt,lt,at),ee.top+=-Mt*at,ee.bottom=ee.top+at,ee.left+=-Xt*lt,ee.right=ee.left+lt,ee.hasBaseline=zt}(Y,e,i,s,H,h,m,g,S,v,A,R),!function(ee){for(const he of ee)if(he.positionedGlyphs.length!==0)return!1;return!0}(q))return Y}const f_={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},qk={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function B2(r,e,i,s,a,u){if(e.image){const h=s.get(e.image.toString());return h?h.displaySize[0]*e.scale*xn/u+a:0}{const h=i[e.fontStack],m=h&&h.glyphs[r];return m?m.metrics.advance*e.scale+a:0}}function N2(r,e,i,s){const a=Math.pow(r-e,2);return s?r<e?a/2:2*a:a+Math.abs(i)*i}function Zk(r,e,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function j2(r,e,i,s,a,u){let h=null,m=N2(e,i,a,u);for(const g of s){const v=N2(e-g.x,i,a,u)+g.badness;v<=m&&(h=g,m=v)}return{index:r,x:e,priorBreak:h,badness:m}}function V2(r){return r?V2(r.priorBreak).concat(r.index):[]}function R0(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function U2(r,e,i,s,a){if(!(e||i||s||a))return;const u=r.length-1,h=r[u],m=(h.x+h.metrics.advance*h.scale)*e;for(let g=0;g<=u;g++)r[g].x-=m,r[g].y+=i+s+a}function $2(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function Wk(r,e,i,s){const{horizontalAlign:a,verticalAlign:u}=R0(s),h=i[0]-r.displaySize[0]*a,m=i[1]-r.displaySize[1]*u;return{imagePrimary:r,imageSecondary:e,top:m,bottom:m+r.displaySize[1],left:h,right:h+r.displaySize[0]}}function G2(r,e,i,s,a,u){const h=r.imagePrimary;let m;if(h.content){const $=h.content,H=h.pixelRatio||1;m=[$[0]/H,$[1]/H,h.displaySize[0]-$[2]/H,h.displaySize[1]-$[3]/H]}const g=e.left*u,v=e.right*u;let w,S,A,D;i==="width"||i==="both"?(D=a[0]+g-s[3],S=a[0]+v+s[1]):(D=a[0]+(g+v-h.displaySize[0])/2,S=D+h.displaySize[0]);const R=e.top*u,O=e.bottom*u;return i==="height"||i==="both"?(w=a[1]+R-s[0],A=a[1]+O+s[2]):(w=a[1]+(R+O-h.displaySize[1])/2,A=w+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:w,right:S,bottom:A,left:D,collisionPadding:m}}function H2(r){return!r.imagePrimary.stretchX}function q2(r){return!r.imagePrimary.stretchY}function Z2(r){return{width:r.right-r.left,height:r.bottom-r.top}}const oa=128;function W2(r,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new Wi(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:a}=i;let u=0;for(;u<s.length&&s[u]<=r;)u++;u=Math.max(0,u-1);let h=u;for(;h<s.length&&s[h]<r+1;)h++;h=Math.min(s.length-1,h);const m=s[u],g=s[h];return i.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:a}:{kind:"camera",minZoom:m,maxZoom:g,minSize:i.evaluate(new Wi(m)),maxSize:i.evaluate(new Wi(g)),interpolationType:a}}}function z0(r,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:a}){return r.kind==="source"?s/oa:r.kind==="composite"?Nt(s/oa,a/oa,i):e}function Np(r,e,i=1){let s=0,a=0;if(r.kind==="constant")a=r.layoutSize*i;else if(r.kind!=="source"){const{interpolationType:u,minZoom:h,maxZoom:m}=r,g=u?Te(Wn.interpolationFactor(u,e,h,m),0,1):0;r.kind==="camera"?a=Nt(r.minSize,r.maxSize,g)*i:s=g*i}return{uSizeT:s,uSize:a}}class Wa extends ft{constructor(e,i,s,a,u){super(e,i),this.angle=a,this.z=s,u!==void 0&&(this.segment=u)}clone(){return new Wa(this.x,this.y,this.z,this.angle,this.segment)}}function X2(r,e,i,s,a){if(e.segment===void 0)return!0;let u=e,h=e.segment+1,m=0;for(;m>-i/2;){if(h--,h<0)return!1;m-=r[h].dist(u),u=r[h]}m+=r[h].dist(r[h+1]),h++;const g=[];let v=0;for(;m<i/2;){const w=r[h],S=r[h+1];if(!S)return!1;let A=r[h-1].angleTo(w)-w.angleTo(S);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:A}),v+=A;m-g[0].distance>s;)v-=g.shift().angleDelta;if(v>a)return!1;h++,m+=w.dist(S)}return!0}function Y2(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function K2(r,e,i){return r?.6*e*i:0}function J2(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function Xk(r,e,i,s,a,u){const h=K2(i,a,u),m=J2(i,s)*u;let g=0;const v=Y2(r)/2;for(let w=0;w<r.length-1;w++){const S=r[w],A=r[w+1],D=S.dist(A);if(g+D>v){const R=(v-g)/D,O=Nt(S.x,A.x,R),$=Nt(S.y,A.y,R),H=new Wa(O,$,0,A.angleTo(S),w);return!h||X2(r,H,m,h,e)?H:void 0}g+=D}}function Yk(r,e,i,s,a,u,h,m,g){const v=K2(s,u,h),w=J2(s,a),S=w*h,A=r[0].x===0||r[0].x===g||r[0].y===0||r[0].y===g;return e-S<e/4&&(e=S+e/4),Q2(r,A?e/2*m%e:(w/2+2*u)*h*m%e,e,v,i,S,A,!1,g)}function Q2(r,e,i,s,a,u,h,m,g){const v=u/2,w=Y2(r);let S=0,A=e-i,D=[];for(let R=0;R<r.length-1;R++){const O=r[R],$=r[R+1],H=O.dist($),K=$.angleTo(O);for(;A+i<S+H;){A+=i;const W=(A-S)/H,F=Nt(O.x,$.x,W),q=Nt(O.y,$.y,W);if(F>=0&&F<g&&q>=0&&q<g&&A-v>=0&&A+v<=w){const Y=new Wa(F,q,0,K,R);s&&!X2(r,Y,u,s,a)||D.push(Y)}}S+=H}return m||D.length||h||(D=Q2(r,S/2,i,s,a,u,h,!0,g)),D}function eT(r){let e=0,i=0;for(const h of r)e+=h.w*h.h,i=Math.max(i,h.w);r.sort((h,m)=>m.h-h.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,u=0;for(const h of r)for(let m=s.length-1;m>=0;m--){const g=s[m];if(!(h.w>g.w||h.h>g.h)){if(h.x=g.x,h.y=g.y,u=Math.max(u,h.y+h.h),a=Math.max(a,h.x+h.w),h.w===g.w&&h.h===g.h){const v=s.pop();m<s.length&&(s[m]=v)}else h.h===g.h?(g.x+=h.w,g.w-=h.w):h.w===g.w?(g.y+=h.h,g.h-=h.h):(s.push({x:g.x+h.w,y:g.y,w:g.w-h.w,h:h.h}),g.y+=h.h,g.h-=h.h);break}}return{w:a,h:u,fill:e/(a*u)||0}}Tt(Wa,"Anchor");const tu=1;class jp{static getImagePositionScale(e,i,s){if(i&&e&&e.options&&e.options.transform){const a=e.options.transform;return{x:a.a,y:a.d}}return{x:s,y:s}}constructor(e,i,s,a){this.paddedRect=e;const{pixelRatio:u,version:h,stretchX:m,stretchY:g,content:v,sdf:w,usvg:S}=i;this.pixelRatio=u,this.stretchX=m,this.stretchY=g,this.content=v,this.version=h,this.padding=s,this.sdf=w,this.scale=jp.getImagePositionScale(a,S,u)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function L0(r,e,i){const s=Po.parse(r),a=function(u,h,m=[1,1]){return{x:0,y:0,w:(u.data?u.data.width:u.width*m[0])+2*h,h:(u.data?u.data.height:u.height*m[1])+2*h}}(e,i,[s.options.transform.a,s.options.transform.d]);return{bin:a,imagePosition:new jp(a,e,i,s),imageVariant:s}}class tT{constructor(e,i,s){const a=new Map,u=new Map;this.haveRenderCallbacks=[];const h=[];this.addImages(e,a,tu,h),this.addImages(i,u,2,h);const{w:m,h:g}=eT(h),v=new In({width:m||1,height:g||1});for(const[w,S]of e.entries()){const A=a.get(w).paddedRect;In.copy(S.data,v,{x:0,y:0},{x:A.x+tu,y:A.y+tu},S.data,s,S.sdf)}for(const[w,S]of i.entries()){const A=u.get(w),D=A.paddedRect;let R=A.padding;const O=D.x+R,$=D.y+R,H=S.data.width,K=S.data.height;R=R>1?R-1:R,In.copy(S.data,v,{x:0,y:0},{x:O,y:$},S.data,s),In.copy(S.data,v,{x:0,y:K-R},{x:O,y:$-R},{width:H,height:R},s),In.copy(S.data,v,{x:0,y:0},{x:O,y:$+K},{width:H,height:R},s),In.copy(S.data,v,{x:H-R,y:0},{x:O-R,y:$},{width:R,height:K},s),In.copy(S.data,v,{x:0,y:0},{x:O+H,y:$},{width:R,height:K},s),In.copy(S.data,v,{x:H-R,y:K-R},{x:O-R,y:$-R},{width:R,height:R},s),In.copy(S.data,v,{x:0,y:K-R},{x:O+H,y:$-R},{width:R,height:R},s),In.copy(S.data,v,{x:0,y:0},{x:O+H,y:$+K},{width:R,height:R},s),In.copy(S.data,v,{x:H-R,y:0},{x:O-R,y:$+K},{width:R,height:R},s)}this.lut=s,this.image=v,this.iconPositions=a,this.patternPositions=u}addImages(e,i,s,a){for(const[u,h]of e.entries()){const{bin:m,imagePosition:g,imageVariant:v}=L0(u,h,s);i.set(u,g),a.push(m),h.hasRenderCallback&&this.haveRenderCallbacks.push(v.id)}}patchUpdatedImages(e,i,s){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(a=>e.hasImage(a,s)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,s);for(const a of e.getUpdatedImages(s)){for(const u of this.iconPositions.keys()){const h=Po.parse(u);if(eo.isEqual(h.id,a)){const m=e.getImage(a,s);this.patchUpdatedImage(this.iconPositions.get(u),m,i)}}for(const u of this.patternPositions.keys()){const h=Po.parse(u);if(eo.isEqual(h.id,a)){const m=e.getImage(a,s);this.patchUpdatedImage(this.patternPositions.get(u),m,i)}}}}patchUpdatedImage(e,i,s){if(!e||!i||e.version===i.version)return;e.version=i.version;const[a,u]=e.tl,h=e.sdf;if(this.lut||h){const m={width:i.data.width,height:i.data.height},g=new In(m);In.copy(i.data,g,{x:0,y:0},{x:0,y:0},m,this.lut,h),s.update(g,{position:{x:a,y:u}})}else s.update(i.data,{position:{x:a,y:u}})}}Tt(jp,"ImagePosition"),Tt(tT,"ImageAtlas");const Vp=1e20;function iT(r,e,i,s,a,u,h,m,g){for(let v=e;v<e+s;v++)rT(r,i*u+v,u,a,h,m,g);for(let v=i;v<i+a;v++)rT(r,v*u+e,1,s,h,m,g)}function rT(r,e,i,s,a,u,h){u[0]=0,h[0]=-Vp,h[1]=Vp,a[0]=r[e];for(let m=1,g=0,v=0;m<s;m++){a[m]=r[e+m*i];const w=m*m;do{const S=u[g];v=(a[m]-a[S]+w-S*S)/(m-S)/2}while(v<=h[g]&&--g>-1);g++,u[g]=m,h[g]=v,h[g+1]=Vp}for(let m=0,g=0;m<s;m++){for(;h[g+1]<m;)g++;const v=u[g],w=m-v;r[e+m*i]=a[v]+w*w}}const Ss=2,k0={none:0,ideographs:1,all:2};class Fh{constructor(e,i,s){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=s,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,s){const a=[],u=this.urls[i]||An.GLYPHS_URL;for(const h in e)for(const m of e[h])a.push({stack:h,id:m});qe(a,({stack:h,id:m},g)=>{let v=this.entries[h];v||(v=this.entries[h]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let w=v.glyphs[m];if(w!==void 0)return void g(null,{stack:h,id:m,glyph:w});if(w=this._tinySDF(v,h,m),w)return v.glyphs[m]=w,void g(null,{stack:h,id:m,glyph:w});const S=Math.floor(m/256);if(256*S>65535)return yi("glyphs > 65535 not supported"),void g(null,{stack:h,id:m,glyph:w});if(v.ranges[S])return void g(null,{stack:h,id:m,glyph:w});let A=v.requests[S];A||(A=v.requests[S]=[],Fh.loadGlyphRange(h,S,u,this.requestManager,(D,R)=>{if(R){v.ascender=R.ascender,v.descender=R.descender;for(const O in R.glyphs)this._doesCharSupportLocalGlyph(+O)||(v.glyphs[+O]=R.glyphs[+O]);v.ranges[S]=!0}for(const O of A)O(D,R);delete v.requests[S]})),A.push((D,R)=>{D?g(D):R&&g(null,{stack:h,id:m,glyph:R.glyphs[m]||null})})},(h,m)=>{if(h)s(h);else if(m){const g={};for(const{stack:v,id:w,glyph:S}of m)g[v]===void 0&&(g[v]={}),g[v].glyphs===void 0&&(g[v].glyphs={}),g[v].glyphs[w]=S&&{id:S.id,bitmap:S.bitmap.clone(),metrics:S.metrics},g[v].ascender=this.entries[v].ascender,g[v].descender=this.entries[v].descender;s(null,g)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==k0.none&&(this.localGlyphMode===k0.all?!!this.localFontFamily:!!this.localFontFamily&&(jt["CJK Unified Ideographs"](e)||jt["Hangul Syllables"](e)||jt.Hiragana(e)||jt.Katakana(e)||jt["CJK Symbols and Punctuation"](e)||jt["CJK Unified Ideographs Extension A"](e)||jt["CJK Unified Ideographs Extension B"](e)||jt.Osage(e)))}_tinySDF(e,i,s){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(s))return;let u=e.tinySDF;if(!u){let O="400";/bold/i.test(i)?O="900":/medium/i.test(i)?O="500":/light/i.test(i)&&(O="200"),u=e.tinySDF=new Fh.TinySDF({fontFamily:a,fontWeight:O,fontSize:24*Ss,buffer:3*Ss,radius:8*Ss}),u.fontWeight=O}if(this.localGlyphs[u.fontWeight][s])return this.localGlyphs[u.fontWeight][s];const h=String.fromCodePoint(s),{data:m,width:g,height:v,glyphWidth:w,glyphHeight:S,glyphLeft:A,glyphTop:D,glyphAdvance:R}=u.draw(h);return this.localGlyphs[u.fontWeight][s]={id:s,bitmap:new Ul({width:g,height:v},m),metrics:{width:w/Ss,height:S/Ss,left:A/Ss,top:D/Ss-27,advance:R/Ss,localGlyph:!0}}}}Fh.loadGlyphRange=function(r,e,i,s,a){const u=256*e,h=u+255,m=s.transformRequest(s.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${u}-${h}`),ku.Glyphs);cl(m,(g,v)=>{if(g)a(g);else if(v){const w={},S=function(A){return new p_(A).readFields($k,{})}(v);for(const A of S.glyphs)w[A.id]=A;a(null,{glyphs:w,ascender:S.ascender,descender:S.descender})}})},Fh.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:a="sans-serif",fontWeight:u="normal",fontStyle:h="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const m=this.size=r+4*e,g=this._createCanvas(m),v=this.ctx=g.getContext("2d",{willReadFrequently:!0});v.font=`${h} ${u} ${r}px ${a}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(m*m),this.gridInner=new Float64Array(m*m),this.f=new Float64Array(m),this.z=new Float64Array(m+1),this.v=new Uint16Array(m)}_createCanvas(r){const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:a,actualBoundingBoxRight:u}=this.ctx.measureText(r),h=Math.ceil(i),m=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-a))),g=Math.min(this.size-this.buffer,h+Math.ceil(s)),v=m+2*this.buffer,w=g+2*this.buffer,S=Math.max(v*w,0),A=new Uint8ClampedArray(S),D={data:A,width:v,height:w,glyphWidth:m,glyphHeight:g,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(m===0||g===0)return D;const{ctx:R,buffer:O,gridInner:$,gridOuter:H}=this;R.clearRect(O,O,m,g),R.fillText(r,O,O+h);const K=R.getImageData(O,O,m,g);H.fill(Vp,0,S),$.fill(0,0,S);for(let W=0;W<g;W++)for(let F=0;F<m;F++){const q=K.data[4*(W*m+F)+3]/255;if(q===0)continue;const Y=(W+O)*v+F+O;if(q===1)H[Y]=0,$[Y]=Vp;else{const ee=.5-q;H[Y]=ee>0?ee*ee:0,$[Y]=ee<0?ee*ee:0}}iT(H,0,0,v,w,v,this.f,this.v,this.z),iT($,O,O,m,g,v,this.f,this.v,this.z);for(let W=0;W<S;W++){const F=Math.sqrt(H[W])-Math.sqrt($[W]);A[W]=Math.round(255-255*(F/this.radius+this.cutoff))}return D}};const Hl=tu;function nT(r,e){return r+e[1]-e[0]}function oT(r,e,i,s,a=1){const u=[],h=r.imagePrimary,m=h.pixelRatio,g=h.paddedRect.w-2*Hl,v=h.paddedRect.h-2*Hl,w=(r.right-r.left)*a,S=(r.bottom-r.top)*a,A=h.stretchX||[[0,g]],D=h.stretchY||[[0,v]],R=A.reduce(nT,0),O=D.reduce(nT,0),$=g-R,H=v-O;let K=0,W=R,F=0,q=O,Y=0,ee=$,he=0,ye=H;if(h.content&&s){const Ce=h.content;K=m_(A,0,Ce[0]),F=m_(D,0,Ce[1]),W=m_(A,Ce[0],Ce[2]),q=m_(D,Ce[1],Ce[3]),Y=Ce[0]-K,he=Ce[1]-F,ee=Ce[2]-Ce[0]-W,ye=Ce[3]-Ce[1]-q}const ve=(Ce,Ue,et,Ye)=>{const Qe=__(Ce.stretch-K,W,w,r.left*a),ot=g_(Ce.fixed-Y,ee,Ce.stretch,R),je=__(Ue.stretch-F,q,S,r.top*a),Je=g_(Ue.fixed-he,ye,Ue.stretch,O),Fe=__(et.stretch-K,W,w,r.left*a),Ve=g_(et.fixed-Y,ee,et.stretch,R),lt=__(Ye.stretch-F,q,S,r.top*a),ut=g_(Ye.fixed-he,ye,Ye.stretch,O),zt=new ft(Qe,je),Et=new ft(Fe,je),gt=new ft(Fe,lt),at=new ft(Qe,lt),Xt=new ft(ot/m,Je/m),Mt=new ft(Ve/m,ut/m),Pt=e*Math.PI/180;if(Pt){const ai=Math.sin(Pt),tr=Math.cos(Pt),ur=[tr,-ai,ai,tr];zt._matMult(ur),Et._matMult(ur),at._matMult(ur),gt._matMult(ur)}const Ht=Ce.stretch+Ce.fixed,ii=et.stretch+et.fixed,oi=Ue.stretch+Ue.fixed,fi=Ye.stretch+Ye.fixed,ci=r.imageSecondary;return{tl:zt,tr:Et,bl:at,br:gt,texPrimary:{x:h.paddedRect.x+Hl+Ht,y:h.paddedRect.y+Hl+oi,w:ii-Ht,h:fi-oi},texSecondary:ci?{x:ci.paddedRect.x+Hl+Ht,y:ci.paddedRect.y+Hl+oi,w:ii-Ht,h:fi-oi}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Xt,pixelOffsetBR:Mt,minFontScaleX:ee/m/w,minFontScaleY:ye/m/S,isSDF:i}};if(s&&(h.stretchX||h.stretchY)){const Ce=sT(A,$,R),Ue=sT(D,H,O);for(let et=0;et<Ce.length-1;et++){const Ye=Ce[et],Qe=Ce[et+1];for(let ot=0;ot<Ue.length-1;ot++)u.push(ve(Ye,Ue[ot],Qe,Ue[ot+1]))}}else u.push(ve({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:g+1},{fixed:0,stretch:v+1}));return u}function m_(r,e,i){let s=0;for(const a of r)s+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return s}function sT(r,e,i){const s=[{fixed:-Hl,stretch:0}];for(const[a,u]of r){const h=s[s.length-1];s.push({fixed:a-h.stretch,stretch:h.stretch}),s.push({fixed:a-h.stretch,stretch:h.stretch+(u-a)})}return s.push({fixed:e+Hl,stretch:i}),s}function __(r,e,i,s){return r/e*i+s}function g_(r,e,i,s){return r-e*i/s}function Kk(r,e,i,s){const a=e+r.positionedLines[s].lineOffset;return s===0?i+a/2:i+(a+(e+r.positionedLines[s-1].lineOffset))/2}function Jk(r,e=1,i=!1){let s=1/0,a=1/0,u=-1/0,h=-1/0;const m=r[0];for(let D=0;D<m.length;D++){const R=m[D];(!D||R.x<s)&&(s=R.x),(!D||R.y<a)&&(a=R.y),(!D||R.x>u)&&(u=R.x),(!D||R.y>h)&&(h=R.y)}const g=Math.min(u-s,h-a);let v=g/2;const w=new qu([],Qk);if(g===0)return new ft(s,a);for(let D=s;D<u;D+=g)for(let R=a;R<h;R+=g)w.push(new Bh(D+v,R+v,v,r));let S=function(D){let R=0,O=0,$=0;const H=D[0];for(let K=0,W=H.length,F=W-1;K<W;F=K++){const q=H[K],Y=H[F],ee=q.x*Y.y-Y.x*q.y;O+=(q.x+Y.x)*ee,$+=(q.y+Y.y)*ee,R+=3*ee}return new Bh(O/R,$/R,0,D)}(r),A=w.length;for(;w.length;){const D=w.pop();(D.d>S.d||!S.d)&&(S=D,i&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,A)),D.max-S.d<=e||(v=D.h/2,w.push(new Bh(D.p.x-v,D.p.y-v,v,r)),w.push(new Bh(D.p.x+v,D.p.y-v,v,r)),w.push(new Bh(D.p.x-v,D.p.y+v,v,r)),w.push(new Bh(D.p.x+v,D.p.y+v,v,r)),A+=4)}return i&&(console.log(`num probes: ${A}`),console.log(`best distance: ${S.d}`)),S.p}function Qk(r,e){return e.max-r.max}class Bh{constructor(e,i,s,a){this.p=new ft(e,i),this.h=s,this.d=function(u,h){let m=!1,g=1/0;for(let v=0;v<h.length;v++){const w=h[v];for(let S=0,A=w.length,D=A-1;S<A;D=S++){const R=w[S],O=w[D];R.y>u.y!=O.y>u.y&&u.x<(O.x-R.x)*(u.y-R.y)/(O.y-R.y)+R.x&&(m=!m),g=Math.min(g,Ci(u,R,O))}}return(m?1:-1)*Math.sqrt(g)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const e3=Object.keys,O0=Number.POSITIVE_INFINITY,t3=Math.sqrt(2);function aT(r,[e,i]){let s=0,a=0;if(i===O0){e<0&&(e=0);const u=e/t3;switch(r){case"top-right":case"top-left":a=u-7;break;case"bottom-right":case"bottom-left":a=7-u;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(r){case"top-right":case"bottom-right":s=-u;break;case"top-left":case"bottom-left":s=u;break;case"left":s=e;break;case"right":s=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),r){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(r){case"top-right":case"bottom-right":case"right":s=-e;break;case"top-left":case"bottom-left":case"left":s=e}}return[s,a]}function y_(r,e,i,s,a,u,h,m,g){if(!e||!e.usvg)return;const v=Z2(s),w=Z2(a),S=u!=="both"&&u!=="width"||!H2(s)?1:Math.max(1,w.width/v.width),A=u!=="both"&&u!=="height"||!q2(s)?1:Math.max(1,w.height/v.height);i.scaleSelf(S,A);const D=i.toString();h.set(D,i),m.set(D,e);const{imagePosition:R}=L0(D,e,tu);g.set(D,R)}function lT(r,e,i,s,a,u,h,m){if(!r)return;const g=function(v,w,S,A,D){if(v.kind==="camera")return v.maxSize;if(v.kind==="composite"){const R=w.possiblyEvaluate(new Wi(v.maxZoom),S).evaluate(D,{},S),O=w.possiblyEvaluate(new Wi(v.minZoom),S).evaluate(D,{},S);return Math.max(R,O)}return w.possiblyEvaluate(new Wi(A)).evaluate(D,{},S)}(e,i,s,a,u);return r.scaleSelf(g*m*h)}function cT(r,e,i,s,a,u,h,m){return{iconPrimary:lT(r.getPrimary(),e,i,s,a,u,h,m),iconSecondary:lT(r.getSecondary(),e,i,s,a,u,h,m)}}function uT(r,e,i,s){if(!r)return;const a=e.get(i.toString());if(r.imagePrimary=a,s){const u=e.get(s.toString());r.imageSecondary=u}}function i3(r,e){for(const i in r.horizontal)hT(r.horizontal[i],e);hT(r.vertical,e)}function hT(r,e){if(r){for(const i of r.positionedLines)for(const s of i.positionedGlyphs)if(s.image!==null){const a=s.image.toString();s.rect=e.get(a).paddedRect}}}function F0(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function r3(r,e,i,s,a,u,h,m,g){const v=B0(u.horizontal)||u.vertical,w=i.get("icon-text-fit-padding").evaluate(s,{},a);let S,A=e;return e&&g!=="none"&&(r.allowVerticalPlacement&&u.vertical&&(S=G2(e,u.vertical,g,w,m,h)),v&&(A=G2(e,v,g,w,m,h))),{defaultShapedIcon:A,verticallyShapedIcon:S}}function n3(r,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W){let F=h.textMaxSize.evaluate(e,{},A);F===void 0?F=m*h.textScaleFactor:F*=h.textScaleFactor;const q=r.layers[0].layout,Y=B0(i.horizontal)||i.vertical,ee=D.name==="globe",he=xn,ye=r.tilePixelRatio*F/he,ve=(ot=r.overscaling,r.zoom>18&&ot>2&&(ot>>=1),Math.max(_t/(512*ot),1)*q.get("symbol-spacing")),Ce=q.get("text-padding")*r.tilePixelRatio,Ue=q.get("icon-padding")*r.tilePixelRatio,et=U(q.get("text-max-angle")),Ye=q.get("icon-rotation-alignment")==="map"&&W!=="point",Qe=ve/2;var ot;r.hasAnyIconTextFit===!1&&$!=="none"&&(r.hasAnyIconTextFit=!0);const je=e.properties?+e.properties[Kc]:null,Je=je&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(je):65535,Fe=(Ve,lt,ut)=>{if(lt.x<0||lt.x>=_t||lt.y<0||lt.y>=_t)return;let zt=null;if(ee){const{x:Et,y:gt,z:at}=D.projectTilePoint(lt.x,lt.y,ut);zt={anchor:new Wa(Et,gt,at,0,void 0),up:D.upVector(ut,lt.x,lt.y)}}(function(Et,gt,at,Xt,Mt,Pt,Ht,ii,oi,fi,ci,ai,tr,ur,J,te,Ge,pt,vt,yt,Dt,Gt,wi,Ti,li,Hi,sr,Si,Mr){const hr=Et.addToLineVertexArray(gt,Xt);let Vi,Vr,fr,ar,dr,qi,pi,Ki=0,Pr=0,Ut=0,Pi=0,mr=-1,Or=-1;const br={};let rn=Qn("");const ir=at?at.anchor:gt,Jr=Si!=="none";let ro=0,Cn=0;if(oi._unevaluatedLayout.getValue("text-radial-offset")===void 0){const nn=oi.layout.get("text-offset").evaluate(Dt,{},li);ro=nn[0]*xn,Cn=nn[1]*xn}else ro=oi.layout.get("text-radial-offset").evaluate(Dt,{},li)*xn,Cn=O0;if(Et.allowVerticalPlacement&&Mt.vertical){const nn=Mt.vertical;if(J)qi=N0(nn),ii&&(pi=N0(ii));else{const dn=oi.layout.get("text-rotate").evaluate(Dt,{},li)+90;fr=v_(fi,ir,gt,ci,ai,tr,nn,ur,dn,te),ii&&(ar=v_(fi,ir,gt,ci,ai,tr,ii,pt,dn))}}if(Pt){const nn=Et.iconSizeData,dn=oi.layout.get("icon-rotate").evaluate(Dt,{},li),Mn=oT(Pt,dn,wi,Jr,Gt.iconScaleFactor),Gn=ii?oT(ii,dn,wi,Jr,Gt.iconScaleFactor):void 0;Vr=v_(fi,ir,gt,ci,ai,tr,Pt,pt,dn,null),Ki=4*Mn.length;let Ln=null;nn.kind==="source"?(Ln=[oa*oi.layout.get("icon-size").evaluate(Dt,{},li)*Gt.iconScaleFactor],Ln[0]>ql&&yi(`${Et.layerIds[0]}: Value for "icon-size" is >= ${Up}. Reduce your "icon-size".`)):nn.kind==="composite"&&(Ln=[oa*Gt.compositeIconSizes[0].evaluate(Dt,{},li)*Gt.iconScaleFactor,oa*Gt.compositeIconSizes[1].evaluate(Dt,{},li)*Gt.iconScaleFactor],(Ln[0]>ql||Ln[1]>ql)&&yi(`${Et.layerIds[0]}: Value for "icon-size" is >= ${Up}. Reduce your "icon-size".`)),Et.addSymbols(Et.icon,Mn,Ln,yt,vt,Dt,void 0,at,gt,hr.lineStartIndex,hr.lineLength,-1,Ti,li,Hi,sr),mr=Et.icon.placedSymbolArray.length-1,Gn&&(Pr=4*Gn.length,Et.addSymbols(Et.icon,Gn,Ln,yt,vt,Dt,lo.vertical,at,gt,hr.lineStartIndex,hr.lineLength,-1,Ti,li,Hi,sr),Or=Et.icon.placedSymbolArray.length-1)}for(const nn in Mt.horizontal){const dn=nn,Mn=Mt.horizontal[dn];Vi||(rn=Qn(Mn.text),J?dr=N0(Mn):Vi=v_(fi,ir,gt,ci,ai,tr,Mn,ur,oi.layout.get("text-rotate").evaluate(Dt,{},li),te));const Gn=Mn.positionedLines.length===1;if(Ut+=dT(Et,at,gt,Mn,Ht,oi,J,Dt,te,hr,Mt.vertical?lo.horizontal:lo.horizontalOnly,Gn?e3(Mt.horizontal):[dn],br,mr,Gt,Ti,li,Hi),Gn)break}Mt.vertical&&(Pi+=dT(Et,at,gt,Mt.vertical,Ht,oi,J,Dt,te,hr,lo.vertical,["vertical"],br,Or,Gt,Ti,li,Hi));let Tn=-1;const no=(nn,dn)=>nn?Math.max(nn,dn):dn;Tn=no(dr,Tn),Tn=no(qi,Tn),Tn=no(pi,Tn);const sa=Tn>-1?1:0;Et.glyphOffsetArray.length>=65535&&yi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Dt.sortKey!==void 0&&Et.addToSortKeyRanges(Et.symbolInstances.length,Dt.sortKey),Et.symbolInstances.emplaceBack(gt.x,gt.y,ir.x,ir.y,ir.z,br.right>=0?br.right:-1,br.center>=0?br.center:-1,br.left>=0?br.left:-1,br.vertical>=0?br.vertical:-1,mr,Or,rn,Vi!==void 0?Vi:Et.collisionBoxArray.length,Vi!==void 0?Vi+1:Et.collisionBoxArray.length,fr!==void 0?fr:Et.collisionBoxArray.length,fr!==void 0?fr+1:Et.collisionBoxArray.length,Vr!==void 0?Vr:Et.collisionBoxArray.length,Vr!==void 0?Vr+1:Et.collisionBoxArray.length,ar||Et.collisionBoxArray.length,ar?ar+1:Et.collisionBoxArray.length,ci,Ut,Pi,Ki,Pr,sa,0,ro,Cn,Tn,0,Jr?1:0,Mr)})(r,lt,zt,Ve,i,s,u,a,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,Ce,K,v,0,Ue,Ye,H,e,h,w,S,A,R,O,$,Je)};if(W==="line")for(const Ve of d_(e.geometry,0,0,_t,_t)){const lt=Yk(Ve,ve,et,i.vertical||Y,s,he,ye,r.overscaling,_t);for(const ut of lt)Y&&o3(r,Y.text,Qe,ut)||Fe(Ve,ut,A)}else if(W==="line-center"){for(const Ve of e.geometry)if(Ve.length>1){const lt=Xk(Ve,et,i.vertical||Y,s,he,ye);lt&&Fe(Ve,lt,A)}}else if(e.type==="Polygon")for(const Ve of o_(e.geometry,0)){const lt=Jk(Ve,16);Fe(Ve[0],new Wa(lt.x,lt.y,0,0,void 0),A)}else if(e.type==="LineString")for(const Ve of e.geometry)Fe(Ve,new Wa(Ve[0].x,Ve[0].y,0,0,void 0),A);else if(e.type==="Point")for(const Ve of e.geometry)for(const lt of Ve)Fe([lt],new Wa(lt.x,lt.y,0,0,void 0),A)}const Up=255,ql=Up*oa;function dT(r,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H){const K=function(q,Y,ee,he,ye,ve,Ce,Ue){const et=[];if(Y.positionedLines.length===0)return et;const Ye=he.layout.get("text-rotate").evaluate(ve,{})*Math.PI/180,Qe=function(Ve){const lt=Ve[0],ut=Ve[1],zt=lt*ut;return zt>0?[lt,-ut]:zt<0?[-lt,ut]:lt===0?[ut,lt]:[ut,-lt]}(ee);let ot=Math.abs(Y.top-Y.bottom);for(const Ve of Y.positionedLines)ot-=Ve.lineOffset;const je=Y.positionedLines.length,Je=ot/je;let Fe=Y.top-ee[1];for(let Ve=0;Ve<je;++Ve){const lt=Y.positionedLines[Ve];Fe=Kk(Y,Je,Fe,Ve);for(const ut of lt.positionedGlyphs){if(!ut.rect)continue;const zt=ut.rect||{};let Et=F2+1,gt=!0,at=1,Xt=0;if(ut.image){const Dt=Ce.get(ut.image.toString());if(!Dt)continue;if(Dt.sdf){yi("SDF images are not supported in formatted text and will be ignored.");continue}gt=!1,at=Dt.pixelRatio,Et=tu/at}const Mt=(ye||Ue)&&ut.vertical,Pt=ut.metrics.advance*ut.scale/2,Ht=ut.metrics,ii=ut.rect;if(ii===null)continue;Ue&&Y.verticalizable&&(Xt=ut.image?Pt-ut.metrics.width*ut.scale/2:0);const oi=ye?[ut.x+Pt,ut.y]:[0,0];let fi=[0,0],ci=[0,0],ai=!1;ye||(Mt?(ci=[ut.x+Pt+Qe[0],ut.y+Qe[1]-Xt],ai=!0):fi=[ut.x+Pt+ee[0],ut.y+ee[1]-Xt]);const tr=ii.w*ut.scale/(at*(ut.localGlyph?Ss:1)),ur=ii.h*ut.scale/(at*(ut.localGlyph?Ss:1));let J,te,Ge,pt;if(Mt){const Dt=ut.y-Fe,Gt=new ft(-Pt,Pt-Dt),wi=-Math.PI/2,Ti=new ft(...ci);J=new ft(-Pt+fi[0],fi[1]),J._rotateAround(wi,Gt)._add(Ti),J.x+=-Dt+Pt,J.y-=(Ht.left-Et)*ut.scale;const li=ut.image?Ht.advance*ut.scale:xn*ut.scale,Hi=String.fromCodePoint(ut.glyph);jk(Hi)?J.x+=(1-Et)*ut.scale:Vk(Hi)?J.x+=li-Ht.height*ut.scale+(-Et-1)*ut.scale:J.x+=ut.image||Ht.width+2*Et===ii.w&&Ht.height+2*Et===ii.h?(li-ur)/2:(li-(Ht.height+2*Et)*ut.scale)/2,te=new ft(J.x,J.y-tr),Ge=new ft(J.x+ur,J.y),pt=new ft(J.x+ur,J.y-tr)}else{const Dt=(Ht.left-Et)*ut.scale-Pt+fi[0],Gt=(-Ht.top-Et)*ut.scale+fi[1],wi=Dt+tr,Ti=Gt+ur;J=new ft(Dt,Gt),te=new ft(wi,Gt),Ge=new ft(Dt,Ti),pt=new ft(wi,Ti)}if(Ye){let Dt;Dt=ye?new ft(0,0):ai?new ft(Qe[0],Qe[1]):new ft(ee[0],ee[1]),J._rotateAround(Ye,Dt),te._rotateAround(Ye,Dt),Ge._rotateAround(Ye,Dt),pt._rotateAround(Ye,Dt)}const vt=new ft(0,0),yt=new ft(0,0);et.push({tl:J,tr:te,bl:Ge,br:pt,texPrimary:zt,texSecondary:void 0,writingMode:Y.writingMode,glyphOffset:oi,sectionIndex:ut.sectionIndex,isSDF:gt,pixelOffsetTL:vt,pixelOffsetBR:yt,minFontScaleX:0,minFontScaleY:0})}}return et}(0,s,g,u,h,m,a,r.allowVerticalPlacement),W=r.textSizeData;let F=null;W.kind==="source"?(F=[oa*u.layout.get("text-size").evaluate(m,{},$)*R.textScaleFactor],F[0]>ql&&yi(`${r.layerIds[0]}: Value for "text-size" is >= ${Up}. Reduce your "text-size".`)):W.kind==="composite"&&(F=[oa*R.compositeTextSizes[0].evaluate(m,{},$)*R.textScaleFactor,oa*R.compositeTextSizes[1].evaluate(m,{},$)*R.textScaleFactor],(F[0]>ql||F[1]>ql)&&yi(`${r.layerIds[0]}: Value for "text-size" is >= ${Up}. Reduce your "text-size".`)),r.addSymbols(r.text,K,F,g,h,m,w,e,i,v.lineStartIndex,v.lineLength,D,O,$,H,!1);for(const q of S)A[q]=r.text.placedSymbolArray.length-1;return 4*K.length}function B0(r){for(const e in r)return r[e];return null}function v_(r,e,i,s,a,u,h,m,g,v){let w=h.top,S=h.bottom,A=h.left,D=h.right;if($2(h)&&h.collisionPadding){const R=h.collisionPadding;A-=R[0],w-=R[1],D+=R[2],S+=R[3]}if(g){const R=new ft(A,w),O=new ft(D,w),$=new ft(A,S),H=new ft(D,S),K=U(g);let W=new ft(0,0);v&&(W=new ft(v[0],v[1])),R._rotateAround(K,W),O._rotateAround(K,W),$._rotateAround(K,W),H._rotateAround(K,W),A=Math.min(R.x,O.x,$.x,H.x),D=Math.max(R.x,O.x,$.x,H.x),w=Math.min(R.y,O.y,$.y,H.y),S=Math.max(R.y,O.y,$.y,H.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,A,w,D,S,m,s,a,u),r.length-1}function N0(r){$2(r)&&r.collisionPadding&&(r.top-=r.collisionPadding[1],r.bottom+=r.collisionPadding[3]);const e=r.bottom-r.top;return e>0?Math.max(10,e):null}function o3(r,e,i,s){const a=r.compareText;if(e in a){const u=a[e];for(let h=u.length-1;h>=0;h--)if(s.dist(u[h])<i)return!0}else a[e]=[];return a[e].push(s),!1}function pT(r,e){const i=r.fovAboveCenter,s=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,a=(r._camera.position[2]*r.worldSize-s)/Math.cos(r._pitch),u=Math.sin(i)*a/Math.sin(Math.max(Math.PI/2-r._pitch-i,.01));let h=Math.sin(r._pitch)*u+a;const m=a*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let g=Math.max(r.zoom-17,0);r.isOrthographic&&(g/=10),h*=1+g}return Math.min(1.01*h,m)}function $p(r,e){if(!e.isReprojectedInTileSpace)return{scale:1<<r.z,x:r.x,y:r.y,x2:r.x+1,y2:r.y+1,projection:e};const i=Math.pow(2,-r.z),s=r.x*i,a=(r.x+1)*i,u=r.y*i,h=(r.y+1)*i,m=de(s),g=de(a),v=me(u),w=me(h),S=e.project(m,v),A=e.project(g,v),D=e.project(g,w),R=e.project(m,w);let O=Math.min(S.x,A.x,D.x,R.x),$=Math.min(S.y,A.y,D.y,R.y),H=Math.max(S.x,A.x,D.x,R.x),K=Math.max(S.y,A.y,D.y,R.y);const W=i/16;function F(Y,ee,he,ye,ve,Ce){const Ue=(he+ve)/2,et=(ye+Ce)/2,Ye=e.project(de(Ue),me(et)),Qe=Math.max(0,O-Ye.x,$-Ye.y,Ye.x-H,Ye.y-K);O=Math.min(O,Ye.x),H=Math.max(H,Ye.x),$=Math.min($,Ye.y),K=Math.max(K,Ye.y),Qe>W&&(F(Y,Ye,he,ye,Ue,et),F(Ye,ee,Ue,et,ve,Ce))}F(S,A,s,u,a,u),F(A,D,a,u,a,h),F(D,R,a,h,s,h),F(R,S,s,h,s,u),O-=W,$-=W,H+=W,K+=W;const q=1/Math.max(H-O,K-$);return{scale:q,x:O*q,y:$*q,x2:H*q,y2:K*q,projection:e}}function fT(r,{x:e,y:i},s=0){return new ft(((e-s)*r.scale-r.x)*_t,(i*r.scale-r.y)*_t)}const s3=_e(new Float32Array(16));class Zl{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new V(0,0)}projectTilePoint(e,i,s){return{x:e,y:i,z:0}}locationPoint(e,i,s,a=!0){return e._coordinatePoint(e.locationCoordinate(i,s),a)}pixelsPerMeter(e,i){return ne(1,e)*i}pixelSpaceConversion(e,i,s){return 1}farthestPixelDistance(e){return pT(e,e.pixelsPerMeter)}pointCoordinate(e,i,s,a){const u=e.horizonLineFromTop(!1),h=new ft(i,Math.max(u,s));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,a))}pointCoordinate3D(e,i,s){const a=new ft(i,s);if(e.elevation)return e.elevation.pointCoordinate(a);{const u=this.pointCoordinate(e,a.x,a.y,0);return[u.x,u.y,u.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const s=e.horizonLineFromTop();return i.y<s}createInversionMatrix(e,i){return s3}createTileMatrix(e,i,s){let a,u,h;const m=s.canonical,g=_e(new Float64Array(16));if(this.isReprojectedInTileSpace){const v=$p(m,this);a=1,u=v.x+s.wrap*v.scale,h=v.y,nt(g,g,[a/v.scale,a/v.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(m.z),u=(m.x+Math.pow(2,m.z)*s.wrap)*a,h=m.y*a;return st(g,g,[u,h,0]),nt(g,g,[a/_t,a/_t,1]),g}upVector(e,i,s){return[0,0,1]}upVectorScale(e,i,s){return{metersToTile:1}}}class a3 extends Zl{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,s]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(U(i));this.n=(a+Math.sin(U(s)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:s,c:a,r0:u}=this,h=U(e-this.center[0]),m=U(i),g=Math.sqrt(a-2*s*Math.sin(m))/s;return{x:g*Math.sin(h*s),y:g*Math.cos(h*s)-u,z:0}}unproject(e,i){const{n:s,c:a,r0:u}=this,h=u+i;let m=Math.atan2(e,Math.abs(h))*Math.sign(h);h*s<0&&(m-=Math.PI*Math.sign(e)*Math.sign(h));const g=U(this.center[0])*s;m=Be(m,-Math.PI-g,Math.PI-g);const v=Te(Z(m/s)+this.center[0],-180,180),w=Math.asin(Te((a-(e*e+h*h)*s*s)/(2*s),-1,1)),S=Te(Z(w),-Me,Me);return new V(v,S)}}const Gp=1.340264,Hp=-.081106,qp=893e-6,Zp=.003796,x_=Math.sqrt(3)/2;class l3 extends Zl{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const s=Math.asin(x_*Math.sin(i)),a=s*s,u=a*a*a;return{x:.5*(e*Math.cos(s)/(x_*(Gp+3*Hp*a+u*(7*qp+9*Zp*a)))/Math.PI+.5),y:1-.5*(s*(Gp+Hp*a+u*(qp+Zp*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,a=s*s,u=a*a*a;for(let w,S,A,D=0;D<12&&(S=s*(Gp+Hp*a+u*(qp+Zp*a))-i,A=Gp+3*Hp*a+u*(7*qp+9*Zp*a),w=S/A,s=Te(s-w,-Math.PI/3,Math.PI/3),a=s*s,u=a*a*a,!(Math.abs(w)<1e-12));++D);const h=x_*e*(Gp+3*Hp*a+u*(7*qp+9*Zp*a))/Math.cos(s),m=Math.asin(Math.sin(s)/x_),g=Te(180*h/Math.PI,-180,180),v=Te(180*m/Math.PI,-Me,Me);return new V(g,v)}}class c3 extends Zl{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const s=360*(e-.5),a=Te(360*(.5-i),-Me,Me);return new V(s,a)}}const Nh=Math.PI/2;function b_(r){return Math.tan((Nh+r)/2)}class u3 extends Zl{constructor(e){super(e),this.center=e.center||[0,30];const[i,s]=this.parallels=e.parallels||[30,30];let a=U(i),u=U(s);this.southernCenter=a+u<0,this.southernCenter&&(a=-a,u=-u);const h=Math.cos(a),m=b_(a);this.n=a===u?Math.sin(a):Math.log(h/Math.cos(u))/Math.log(b_(u)/m),this.f=h*Math.pow(b_(a),this.n)/this.n}project(e,i){i=U(i),this.southernCenter&&(i=-i),e=U(e-this.center[0]);const s=1e-6,{n:a,f:u}=this;u>0?i<-Nh+s&&(i=-Nh+s):i>Nh-s&&(i=Nh-s);const h=u/Math.pow(b_(i),a);let m=h*Math.sin(a*e),g=u-h*Math.cos(a*e);return m=.5*(m/Math.PI+.5),g=.5*(g/Math.PI+.5),{x:m,y:this.southernCenter?g:1-g,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n:s,f:a}=this,u=a-i,h=Math.sign(u),m=Math.sign(s)*Math.sqrt(e*e+u*u);let g=Math.atan2(e,Math.abs(u))*h;u*s<0&&(g-=Math.PI*Math.sign(e)*h);const v=Te(Z(g/s)+this.center[0],-180,180),w=Te(Z(2*Math.atan(Math.pow(a/m,1/s))-Nh),-Me,Me);return new V(v,this.southernCenter?-w:w)}}class mT extends Zl{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:ae(e),y:le(i),z:0}}unproject(e,i){const s=de(e),a=me(i);return new V(s,a)}}const _T=U(Me);class h3 extends Zl{project(e,i){const s=(i=U(i))*i,a=s*s;return{x:.5*((e=U(e))*(.8707-.131979*s+a*(a*(.003971*s-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+s*(.015085+a*(.028874*s-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,a=25,u=0,h=s*s;do{h=s*s;const v=h*h;u=(s*(1.007226+h*(.015085+v*(.028874*h-.044475-.005916*v)))-i)/(1.007226+h*(.045255+v*(.259866*h-.311325-.005916*11*v))),s=Te(s-u,-_T,_T)}while(Math.abs(u)>1e-6&&--a>0);h=s*s;const m=Te(Z(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),g=Z(s);return new V(m,g)}}const gT=U(Me);class d3 extends Zl{project(e,i){i=U(i),e=U(e);const s=Math.cos(i),a=2/Math.PI,u=Math.acos(s*Math.cos(e/2)),h=Math.sin(u)/u,m=.5*(e*a+2*s*Math.sin(e/2)/h)||0,g=.5*(i+Math.sin(i)/h)||0;return{x:.5*(m/Math.PI+.5),y:1-.5*(g/Math.PI+1),z:0}}unproject(e,i){let s=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,u=25;const h=1e-6;let m=0,g=0;do{const v=Math.cos(a),w=Math.sin(a),S=2*w*v,A=w*w,D=v*v,R=Math.cos(s/2),O=Math.sin(s/2),$=2*R*O,H=O*O,K=1-D*R*R,W=K?1/K:0,F=K?Math.acos(v*R)*Math.sqrt(1/K):0,q=.5*(2*F*v*O+2*s/Math.PI)-e,Y=.5*(F*w+a)-i,ee=.5*W*(D*H+F*v*R*A)+1/Math.PI,he=W*($*S/4-F*w*O),ye=.125*W*(S*O-F*w*D*$),ve=.5*W*(A*R+F*H*v)+.5,Ce=he*ye-ve*ee;m=(Y*he-q*ve)/Ce,g=(q*ye-Y*ee)/Ce,s=Te(s-m,-Math.PI,Math.PI),a=Te(a-g,-gT,gT)}while((Math.abs(m)>h||Math.abs(g)>h)&&--u>0);return new V(Z(s),Z(a))}}class yT extends Zl{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(U(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:s,cosPhi:a}=this;return{x:U(e)*a*s+.5,y:-Math.sin(U(i))/a*s+.5,z:0}}unproject(e,i){const{scale:s,cosPhi:a}=this,u=-(i-.5)/s,h=Te(Z((e-.5)/s)/a,-180,180),m=Math.asin(Te(u*a,-1,1)),g=Te(Z(m),-Me,Me);return new V(h,g)}}class p3 extends mT{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,s){const a=Ep(e,i,s);return gr(a,a,i_(ra(s))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,s){const a=N(i.lat,i.lng),u=Ui([],a),h=s?e._centerAltitude+s:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;$r(a,a,u,ne(1,0)*_t*h);const m=_e(new Float64Array(16));return Se(m,e.pixelMatrix,e.globeMatrix),gr(a,a,m),new ft(a[0],a[1])}pixelsPerMeter(e,i){return ne(1,0)*i}pixelSpaceConversion(e,i,s){const a=ne(1,e)*i,u=Nt(ne(1,45)*i,a,s);return this.pixelsPerMeter(e,i)/u}createTileMatrix(e,i,s){const a=r0(ra(s.canonical));return Se(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:s}=e,a=i_(ra(i));return ct(a,a,U(s.lng)),Xe(a,a,U(s.lat)),nt(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,s,a){return tw(e,i,s,!0)||new ke(0,0)}pointCoordinate3D(e,i,s){const a=this.pointCoordinate(e,i,s,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!tw(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(a,u){const h=a.cameraToCenterDistance,m=a._centerAltitude*u,g=a._camera,v=a._camera.forward(),w=vi([],Ii([],v,-h),[0,0,m]),S=a.worldSize/(2*Math.PI),A=[0,0,-S],D=a.width/a.height,R=Math.tan(a.fovAboveCenter),O=Ii([],g.up(),R),$=Ii([],g.right(),R*D),H=Ui([],vi([],vi([],v,O),$)),K=[];let W;if(new Fo(w,H).closestPointOnSphere(A,S,K)){const F=vi([],K,A),q=Ei([],F,w);W=Math.cos(a.fovAboveCenter)*Jt(q)}else{const F=Ei([],w,A),q=Ei([],A,w);Ui(q,q);const Y=Jt(F)-S;W=Math.sqrt(Y*(Y+2*S));const ee=Math.acos(W/(S+Y))-Math.acos(Zi(v,q));W*=Math.cos(ee)}return 1.01*W}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),s=Vl(e.zoom);if(s>0){const a=pT(e,ne(1,e.center.lat)*e.worldSize),u=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Nt(i,a+u*(1-Math.cos(h)),Math.pow(s,10))}return i}upVector(e,i,s){return Ep(i,s,e,1)}upVectorScale(e){return{metersToTile:jl(t_(ra(e)))}}}function vT(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(r.name){case"mercator":return new mT(r);case"equirectangular":return new c3(r);case"naturalEarth":return new h3(r);case"equalEarth":return new l3(r);case"winkelTripel":return new d3(r);case"albers":return i?new yT(r):new a3(r);case"lambertConformalConic":return i?new yT(r):new u3(r);case"globe":return new p3(r)}throw new Error(`Invalid projection name: ${r.name}`)}const f3=$l.VectorTileFeature.types,m3=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function w_(r,e,i,s,a,u,h,m,g,v,w,S,A){const D=m?Math.min(ql,Math.round(m[0])):0,R=m?Math.min(ql,Math.round(m[1])):0;r.emplaceBack(e,i,Math.round(32*s),Math.round(32*a),u,h,(D<<1)+(g?1:0),R,16*v,16*w,256*S,256*A)}function T_(r,e,i){r.emplaceBack(e,i)}function S_(r,e,i,s,a,u,h){r.emplaceBack(e,i,s,a,u,h)}function E_(r,e,i,s,a){r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a)}function _3(r){for(const e of r.sections)if(Hy(e.text))return!0;return!1}class j0{constructor(e){this.layoutVertexArray=new Ll,this.indexArray=new fn,this.programConfigurations=e,this.segments=new Cr,this.dynamicLayoutVertexArray=new Ko,this.opacityVertexArray=new fp,this.placedSymbolArray=new Vm,this.iconTransitioningVertexArray=new ea,this.globeExtVertexArray=new Xn,this.zOffsetVertexArray=new Rl}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,s,a,u){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Dk.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,zk.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,m3,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,kk.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Rk.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||u)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Lk.members,!0)),this.opacityVertexBuffer.itemSize=1),(s||a)&&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(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}Tt(j0,"SymbolBuffers");class V0{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new Cr,this.collisionVertexArray=new _p,this.collisionVertexArrayExt=new Ko}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Ok.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Fk.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Tt(V0,"CollisionBuffers");class A_{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=_e([]),this.placementViewportMatrix=_e([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=W2(this.zoom,i["text-size"]),this.iconSizeData=W2(this.zoom,i["icon-size"]);const s=this.layers[0].layout,a=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=s.get("text-allow-overlap")||s.get("icon-allow-overlap")||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=s.get("text-writing-mode").map(h=>lo[h]),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new j0(new Ha(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new j0(new Ha(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new wp,this.lineVertexArray=new Gm,this.symbolInstances=new $m}calculateGlyphDependencies(e,i,s,a,u){for(const h of e){const m=h.codePointAt(0);if(m===void 0)break;if(i[m]=!0,a&&u&&m<=65535){const g=Fp[h];g&&(i[g.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!b0(this.activeReplacements,s)&&(this.activeReplacements=s,!0)}populate(e,i,s,a){const u=this.layers[0],h=u.layout,m=this.projection.name==="globe",g=h.get("text-font"),v=h.get("text-field"),w=h.get("icon-image"),[S,A]=h.get("icon-size-scale-range"),D=Te(i.scaleFactor||1,S,A),R=(v.value.kind!=="constant"||v.value.value instanceof Nn&&!v.value.value.isEmpty()||v.value.value.toString().length>0)&&(g.value.kind!=="constant"||g.value.value.length>0),O=w.value.kind!=="constant"||!!w.value.value||Object.keys(w.parameters).length>0,$=h.get("symbol-sort-key");if(this.features=[],!R&&!O)return;const H=i.iconDependencies,K=i.glyphDependencies,W=i.availableImages,F=new Wi(this.zoom);for(const{feature:q,id:Y,index:ee,sourceLayerIndex:he}of e){const ye=u._featureFilter.needGeometry,ve=Lt(q,ye);if(!u._featureFilter.filter(F,ve,s))continue;if(ye||(ve.geometry=At(q,s,a)),m&&q.type!==1&&s.z<=5){const Qe=ve.geometry,ot=.98078528056,je=(Je,Fe)=>Zi(Ep(Je.x,Je.y,s,1),Ep(Fe.x,Fe.y,s,1))<ot;for(let Je=0;Je<Qe.length;Je++)Qe[Je]=tt(Qe[Je],je)}let Ce,Ue;if(R){const Qe=u.getValueAndResolveTokens("text-field",ve,s,W),ot=Nn.factory(Qe);_3(ot)&&(this.hasRTLText=!0),(!this.hasRTLText||Ml()==="unavailable"||this.hasRTLText&&vo.isParsed())&&(Ce=Nk(ot,u,ve))}if(O){const Qe=u.getValueAndResolveTokens("icon-image",ve,s,W);Ue=typeof Qe=="string"?Zn.build(Qe):Qe}if(!Ce&&!Ue)continue;const et=this.sortFeaturesByKey?$.evaluate(ve,{},s):void 0,Ye={id:Y,text:Ce,icon:Ue,index:ee,sourceLayerIndex:he,geometry:ve.geometry,properties:q.properties,type:f3[q.type],sortKey:et};if(this.features.push(Ye),Ue){const Qe=this.layers[0]._unevaluatedLayout._values,{iconPrimary:ot,iconSecondary:je}=cT(Ue,this.iconSizeData,Qe["icon-size"],s,this.zoom,Ye,this.pixelRatio,D),Je=ot.id.toString();if(H.has(Je)?H.get(Je).push(ot):H.set(Je,[ot]),je){const Fe=je.id.toString();H.has(Fe)?H.get(Fe).push(je):H.set(Fe,[je])}}if(Ce){const Qe=g.evaluate(ve,{},s).join(","),ot=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(lo.vertical)>=0;for(const je of Ce.sections)if(je.image){const Je=je.image.getPrimary().scaleSelf(this.pixelRatio),Fe=Je.id.toString(),Ve=H.get(Fe)||[];Ve.push(Je),H.set(Fe,Ve)}else{const Je=ip(Ce.toString()),Fe=je.fontStack||Qe,Ve=K[Fe]=K[Fe]||{};this.calculateGlyphDependencies(je.text,Ve,ot,this.allowVerticalPlacement,Je)}}}if(h.get("symbol-placement")==="line"&&(this.features=function(q){const Y={},ee={},he=[];let ye=0;function ve(Ye){he.push(q[Ye]),ye++}function Ce(Ye,Qe,ot){const je=ee[Ye];return delete ee[Ye],ee[Qe]=je,he[je].geometry[0].pop(),he[je].geometry[0]=he[je].geometry[0].concat(ot[0]),je}function Ue(Ye,Qe,ot){const je=Y[Qe];return delete Y[Qe],Y[Ye]=je,he[je].geometry[0].shift(),he[je].geometry[0]=ot[0].concat(he[je].geometry[0]),je}function et(Ye,Qe,ot){const je=ot?Qe[0][Qe[0].length-1]:Qe[0][0];return`${Ye}:${je.x}:${je.y}`}for(let Ye=0;Ye<q.length;Ye++){const Qe=q[Ye],ot=Qe.geometry,je=Qe.text?Qe.text.toString():null;if(!je){ve(Ye);continue}const Je=et(je,ot),Fe=et(je,ot,!0);if(Je in ee&&Fe in Y&&ee[Je]!==Y[Fe]){const Ve=Ue(Je,Fe,ot),lt=Ce(Je,Fe,he[Ve].geometry);delete Y[Je],delete ee[Fe],ee[et(je,he[lt].geometry,!0)]=lt,he[Ve].geometry=null}else Je in ee?Ce(Je,Fe,ot):Fe in Y?Ue(Je,Fe,ot):(ve(Ye),Y[Je]=ye-1,ee[Fe]=ye-1)}return he.filter(Ye=>Ye.geometry)}(this.features)),h.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const q of i.elevationFeatures)this.elevationFeatureIdToIndex.set(q.id,this.elevationFeatures.length),this.elevationFeatures.push(q)}}else h.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((q,Y)=>q.sortKey-Y.sortKey)}update(e,i,s,a,u,h,m){this.text.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m),this.icon.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m)}updateRoadElevation(){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let e=!1;for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);if(s.elevationFeatureIndex===65535)continue;const a=this.elevationFeatures[s.elevationFeatureIndex];if(a){const u=.05+a.pointElevation(new ft(s.tileAnchorX,s.tileAnchorY));s.zOffset!==u&&(e=!0,s.zOffset=u)}}e&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(u,h,m)=>{s+=h,s>u.length&&u.resize(s);for(let g=-h;g<0;g++)u.emplace(g+s,m)},i=(u,h,m)=>{a+=h,a>u.length&&u.resize(a);for(let g=-h;g<0;g++)u.emplace(g+a,m)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let s=0,a=0;for(let u=0;u<this.symbolInstances.length;u++){const h=this.symbolInstances.get(u),{numHorizontalGlyphVertices:m,numVerticalGlyphVertices:g,numIconVertices:v}=h,w=h.zOffset,S=v>0;if((m>0||g>0)&&(e(this.text.zOffsetVertexArray,m,w),e(this.text.zOffsetVertexArray,g,w)),S){const{placedIconSymbolIndex:A,verticalPlacedIconSymbolIndex:D}=h;A>=0&&i(this.icon.zOffsetVertexArray,v,w),D>=0&&i(this.icon.zOffsetVertexArray,h.numVerticalIconVertices,w)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}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.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=vT(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const s=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:u}of i)this.lineVertexArray.emplaceBack(a,u);return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$){const H=e.indexArray,K=e.layoutVertexArray,W=e.globeExtVertexArray,F=e.segments.prepareSegment(4*i.length,K,H,this.canOverlap?h.sortKey:void 0),q=this.glyphOffsetArray.length,Y=F.vertexLength,ee=this.allowVerticalPlacement&&m===lo.vertical?Math.PI/2:0,he=h.text&&h.text.sections;for(let ve=0;ve<i.length;ve++){const{tl:Ce,tr:Ue,bl:et,br:Ye,texPrimary:Qe,texSecondary:ot,pixelOffsetTL:je,pixelOffsetBR:Je,minFontScaleX:Fe,minFontScaleY:Ve,glyphOffset:lt,isSDF:ut,sectionIndex:zt}=i[ve],Et=F.vertexLength,gt=lt[1];if(w_(K,v.x,v.y,Ce.x,gt+Ce.y,Qe.x,Qe.y,s,ut,je.x,je.y,Fe,Ve),w_(K,v.x,v.y,Ue.x,gt+Ue.y,Qe.x+Qe.w,Qe.y,s,ut,Je.x,je.y,Fe,Ve),w_(K,v.x,v.y,et.x,gt+et.y,Qe.x,Qe.y+Qe.h,s,ut,je.x,Je.y,Fe,Ve),w_(K,v.x,v.y,Ye.x,gt+Ye.y,Qe.x+Qe.w,Qe.y+Qe.h,s,ut,Je.x,Je.y,Fe,Ve),g){const{x:at,y:Xt,z:Mt}=g.anchor,[Pt,Ht,ii]=g.up;S_(W,at,Xt,Mt,Pt,Ht,ii),S_(W,at,Xt,Mt,Pt,Ht,ii),S_(W,at,Xt,Mt,Pt,Ht,ii),S_(W,at,Xt,Mt,Pt,Ht,ii),E_(e.dynamicLayoutVertexArray,at,Xt,Mt,ee)}else E_(e.dynamicLayoutVertexArray,v.x,v.y,v.z,ee);if($){const at=ot||Qe;T_(e.iconTransitioningVertexArray,at.x,at.y),T_(e.iconTransitioningVertexArray,at.x+at.w,at.y),T_(e.iconTransitioningVertexArray,at.x,at.y+at.h),T_(e.iconTransitioningVertexArray,at.x+at.w,at.y+at.h)}H.emplaceBack(Et,Et+1,Et+2),H.emplaceBack(Et+1,Et+2,Et+3),F.vertexLength+=4,F.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(lt[0]),ve!==i.length-1&&zt===i[ve+1].sectionIndex||e.programConfigurations.populatePaintArrays(K.length,h,h.index,{},D,R,O,he&&he[zt])}const ye=g?g.anchor:v;e.placedSymbolArray.emplaceBack(ye.x,ye.y,ye.z,v.x,v.y,q,this.glyphOffsetArray.length-q,Y,w,S,v.segment,s?s[0]:0,s?s[1]:0,a[0],a[1],m,0,0,0,A,0)}_commitLayoutVertex(e,i,s,a,u,h,m){e.emplaceBack(i,s,a,u,h,Math.round(m.x),Math.round(m.y))}_addCollisionDebugVertices(e,i,s,a,u,h,m){const g=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),v=g.vertexLength,w=m.tileAnchorX,S=m.tileAnchorY;for(let D=0;D<4;D++)s.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(s.collisionVertexArrayExt,i,e.padding,m.zOffset),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,w,S,new ft(e.x1,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,w,S,new ft(e.x2,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,w,S,new ft(e.x2,e.y2)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,w,S,new ft(e.x1,e.y2)),g.vertexLength+=4;const A=s.indexArray;A.emplaceBack(v,v+1),A.emplaceBack(v+1,v+2),A.emplaceBack(v+2,v+3),A.emplaceBack(v+3,v),g.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,s,a,u,h){for(let m=a;m<u;m++){const g=s.get(m),v=this.getSymbolInstanceTextSize(e,h,i,m);this._addCollisionDebugVertices(g,v,this.textCollisionBox,g.projectedAnchorX,g.projectedAnchorY,g.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,i,s,a,u,h){for(let m=a;m<u;m++){const g=s.get(m),v=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._addCollisionDebugVertices(g,v,this.iconCollisionBox,g.projectedAnchorX,g.projectedAnchorY,g.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,i,s){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new V0(Eh,z2.members,ea),this.iconCollisionBox=new V0(Eh,z2.members,ea);const a=Np(this.iconSizeData,e),u=Np(this.textSizeData,e,s);for(let h=0;h<this.symbolInstances.length;h++){const m=this.symbolInstances.get(h);this._addTextDebugCollisionBoxes(u,e,i,m.textBoxStartIndex,m.textBoxEndIndex,m),this._addTextDebugCollisionBoxes(u,e,i,m.verticalTextBoxStartIndex,m.verticalTextBoxEndIndex,m),this._addIconDebugCollisionBoxes(a,e,i,m.iconBoxStartIndex,m.iconBoxEndIndex,m),this._addIconDebugCollisionBoxes(a,e,i,m.verticalIconBoxStartIndex,m.verticalIconBoxEndIndex,m)}}getSymbolInstanceTextSize(e,i,s,a){const u=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),h=z0(this.textSizeData,e,u)/xn;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,i,s){const a=this.icon.placedSymbolArray.get(s),u=z0(this.iconSizeData,e,a);return this.tilePixelRatio*u}_commitDebugCollisionVertexUpdate(e,i,s,a){e.emplaceBack(i,-s,-s,a),e.emplaceBack(i,s,-s,a),e.emplaceBack(i,s,s,a),e.emplaceBack(i,-s,s,a)}_updateTextDebugCollisionBoxes(e,i,s,a,u,h,m){for(let g=a;g<u;g++){const v=s.get(g),w=this.getSymbolInstanceTextSize(e,h,i,g);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,w,v.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,i,s,a,u,h,m){for(let g=a;g<u;g++){const v=s.get(g),w=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,w,v.padding,h.zOffset)}}updateCollisionDebugBuffers(e,i,s,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const u=Np(this.iconSizeData,e,a),h=Np(this.textSizeData,e,s);for(let m=0;m<this.symbolInstances.length;m++){const g=this.symbolInstances.get(m);this._updateTextDebugCollisionBoxes(h,e,i,g.textBoxStartIndex,g.textBoxEndIndex,g,s),this._updateTextDebugCollisionBoxes(h,e,i,g.verticalTextBoxStartIndex,g.verticalTextBoxEndIndex,g,s),this._updateIconDebugCollisionBoxes(u,e,i,g.iconBoxStartIndex,g.iconBoxEndIndex,g,a),this._updateIconDebugCollisionBoxes(u,e,i,g.verticalIconBoxStartIndex,g.verticalIconBoxEndIndex,g,a)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,s,a,u,h,m,g,v){const w={};if(i<s){const{x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F,featureIndex:q}=e.get(i);w.textBox={x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F},w.textFeatureIndex=q}if(a<u){const{x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F,featureIndex:q}=e.get(a);w.verticalTextBox={x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F},w.verticalTextFeatureIndex=q}if(h<m){const{x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F,featureIndex:q}=e.get(h);w.iconBox={x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F},w.iconFeatureIndex=q}if(g<v){const{x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F,featureIndex:q}=e.get(g);w.verticalIconBox={x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F},w.verticalIconFeatureIndex=q}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const s=e.placedSymbolArray.get(i),a=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;u<a;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),s=Math.cos(e),a=[],u=[],h=[];for(let m=0;m<this.symbolInstances.length;++m){h.push(m);const g=this.symbolInstances.get(m);a.push(0|Math.round(i*g.tileAnchorX+s*g.tileAnchorY)),u.push(g.featureIndex)}return h.sort((m,g)=>a[m]-a[g]||u[g]-u[m]),h}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,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(const i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:u,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:m,placedIconSymbolIndex:g,verticalPlacedIconSymbolIndex:v}=s;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),u>=0&&u!==a&&this.addIndicesForPlacedSymbol(this.text,u),h>=0&&h!==u&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),m>=0&&this.addIndicesForPlacedSymbol(this.text,m),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g),v>=0&&this.addIndicesForPlacedSymbol(this.icon,v)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let xT,bT,U0;Tt(A_,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),A_.addDynamicAttributes=E_;class wT{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Vs,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Tt(wT,"FormatSectionOverride",{omit:["defaultValue"]});const $0=()=>U0||(U0={layout:xT||(xT=new Nr({"symbol-placement":new dt(Re.layout_symbol["symbol-placement"]),"symbol-spacing":new dt(Re.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new dt(Re.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new wt(Re.layout_symbol["symbol-sort-key"]),"symbol-z-order":new dt(Re.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new dt(Re.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new dt(Re.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new dt(Re.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new dt(Re.layout_symbol["icon-ignore-placement"]),"icon-optional":new dt(Re.layout_symbol["icon-optional"]),"icon-rotation-alignment":new dt(Re.layout_symbol["icon-rotation-alignment"]),"icon-size":new wt(Re.layout_symbol["icon-size"]),"icon-size-scale-range":new dt(Re.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new wt(Re.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new wt(Re.layout_symbol["icon-text-fit-padding"]),"icon-image":new wt(Re.layout_symbol["icon-image"]),"icon-rotate":new wt(Re.layout_symbol["icon-rotate"]),"icon-padding":new dt(Re.layout_symbol["icon-padding"]),"icon-keep-upright":new dt(Re.layout_symbol["icon-keep-upright"]),"icon-offset":new wt(Re.layout_symbol["icon-offset"]),"icon-anchor":new wt(Re.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new dt(Re.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new dt(Re.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new dt(Re.layout_symbol["text-rotation-alignment"]),"text-field":new wt(Re.layout_symbol["text-field"]),"text-font":new wt(Re.layout_symbol["text-font"]),"text-size":new wt(Re.layout_symbol["text-size"]),"text-size-scale-range":new dt(Re.layout_symbol["text-size-scale-range"]),"text-max-width":new wt(Re.layout_symbol["text-max-width"]),"text-line-height":new wt(Re.layout_symbol["text-line-height"]),"text-letter-spacing":new wt(Re.layout_symbol["text-letter-spacing"]),"text-justify":new wt(Re.layout_symbol["text-justify"]),"text-radial-offset":new wt(Re.layout_symbol["text-radial-offset"]),"text-variable-anchor":new dt(Re.layout_symbol["text-variable-anchor"]),"text-anchor":new wt(Re.layout_symbol["text-anchor"]),"text-max-angle":new dt(Re.layout_symbol["text-max-angle"]),"text-writing-mode":new dt(Re.layout_symbol["text-writing-mode"]),"text-rotate":new wt(Re.layout_symbol["text-rotate"]),"text-padding":new dt(Re.layout_symbol["text-padding"]),"text-keep-upright":new dt(Re.layout_symbol["text-keep-upright"]),"text-transform":new wt(Re.layout_symbol["text-transform"]),"text-offset":new wt(Re.layout_symbol["text-offset"]),"text-allow-overlap":new dt(Re.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new dt(Re.layout_symbol["text-ignore-placement"]),"text-optional":new dt(Re.layout_symbol["text-optional"]),visibility:new dt(Re.layout_symbol.visibility)})),paint:bT||(bT=new Nr({"icon-opacity":new wt(Re.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new wt(Re.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new wt(Re.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new wt(Re.paint_symbol["text-emissive-strength"]),"icon-color":new wt(Re.paint_symbol["icon-color"]),"icon-halo-color":new wt(Re.paint_symbol["icon-halo-color"]),"icon-halo-width":new wt(Re.paint_symbol["icon-halo-width"]),"icon-halo-blur":new wt(Re.paint_symbol["icon-halo-blur"]),"icon-translate":new dt(Re.paint_symbol["icon-translate"]),"icon-translate-anchor":new dt(Re.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new dt(Re.paint_symbol["icon-image-cross-fade"]),"text-opacity":new wt(Re.paint_symbol["text-opacity"]),"text-occlusion-opacity":new wt(Re.paint_symbol["text-occlusion-opacity"]),"text-color":new wt(Re.paint_symbol["text-color"],{runtimeType:qn,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new wt(Re.paint_symbol["text-halo-color"]),"text-halo-width":new wt(Re.paint_symbol["text-halo-width"]),"text-halo-blur":new wt(Re.paint_symbol["text-halo-blur"]),"text-translate":new dt(Re.paint_symbol["text-translate"]),"text-translate-anchor":new dt(Re.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new dt(Re.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new dt(Re.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new dt(Re.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new dt(Re.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new wt(Re.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},U0);class I_ extends $n{constructor(e,i,s,a){super(e,$0(),i,s,a),this._colorAdjustmentMatrix=_e([]),this.hasInitialOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const s=this.layout.get("text-writing-mode");if(s){const a=[];for(const u of s)a.indexOf(u)<0&&a.push(u);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,s,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===s&&this._brightnessMax===a||(this._colorAdjustmentMatrix=function(u,h,m,g){u=Rn(u),h=Dn(h);const v=Pe(),w=u/3,S=1-2*w,A=[S,w,w,0,w,S,w,0,w,w,S,0,0,0,0,1],D=.5-.5*h,R=g-m;return Se(v,[R,0,0,0,0,R,0,0,0,0,R,0,m,m,m,1],[h,0,0,0,0,h,0,0,0,0,h,0,D,D,D,1]),Se(v,v,A),v}(e,i,s,a),this._saturation=e,this._contrast=i,this._brightnessMin=s,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,s,a){const u=this.layout.get(e).evaluate(i,{},s,a),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||ph(h.value)||!u?u:function(m,g){return g.replace(/{([^{}]+)}/g,(v,w)=>w in m?String(m[w]):"")}(i.properties,u)}createBucket(e){return new A_(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of $0().paint.overridableProperties){if(!I_.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new wT(i),a=new Qd(s,i.property.specification,this.scope,this.options);let u=null;u=i.value.kind==="constant"||i.value.kind==="source"?new Oa("source",a):new Il("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new Pl(i.property,u,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&I_.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),a=$0().paint.properties[i];let u=!1;const h=m=>{for(const g of m)if(a.overrides&&a.overrides.hasOverride(g))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Nn)h(s.value.value.sections);else if(s.value.kind==="source"){const m=v=>{u||(v instanceof di&&hn(v.value)===yc?h(v.value.sections):v instanceof Ia?h(v.sections):v.eachChild(m))},g=s.value;g._styleExpression&&m(g._styleExpression.expression)}return u}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,s){return{config:new ia(this,{zoom:i,lut:s}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let TT,ST,ET,AT;var G0=ki([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function H0(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function q0(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class Z0{constructor(e,i,s,a){this.context=e,this.format=s,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const s=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:u}=this,{gl:h}=u,{x:m,y:g}=i&&i.position?i.position:{x:0,y:0},v=m+s,w=g+a;!this.size||this.size[0]===v&&this.size[1]===w||(h.bindTexture(h.TEXTURE_2D,null),h.deleteTexture(this.texture),this.texture=h.createTexture(),this.size=null),h.bindTexture(h.TEXTURE_2D,this.texture),u.pixelStoreUnpackFlipY.set(!1),u.pixelStoreUnpack.set(1),u.pixelStoreUnpackPremultiplyAlpha.set(this.format===h.RGBA8&&(!i||i.premultiply!==!1));const S=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&v>0&&w>0){const A=this.useMipmap?Math.floor(Math.log2(Math.max(v,w)))+1:1;h.texStorage2D(h.TEXTURE_2D,A,this.format,v,w),this.size=[v,w]}if(this.size)if(S)h.texSubImage2D(h.TEXTURE_2D,0,m,g,H0(this.format),q0(this.format),e);else{const A=e.data;A&&h.texSubImage2D(h.TEXTURE_2D,0,m,g,s,a,H0(this.format),q0(this.format),A)}this.useMipmap&&h.generateMipmap(h.TEXTURE_2D)}bind(e,i,s=!1){const{context:a}=this,{gl:u}=a;u.bindTexture(u.TEXTURE_2D,this.texture),e!==this.minFilter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,this.useMipmap&&!s?e===u.NEAREST?u.NEAREST_MIPMAP_NEAREST:u.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,s,a){const{context:u}=this,{gl:h}=u;h.bindTexture(h.TEXTURE_2D,this.texture),i!==this.magFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,this.useMipmap?e===h.NEAREST?h.NEAREST_MIPMAP_NEAREST:h.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),s!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,s),this.wrapS=s),a!==this.wrapT&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,a),this.wrapT=a)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class C_{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:s}=this,{gl:a}=s;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}function M_(r,e,i,s,a,u,h,m){const g=[r,e,1,i,s,1,a,u,1],v=[h,m,1],w=Ee([],g),[S,A,D]=Kn(v,v,w);return be(g,g,[S,0,0,0,A,0,0,0,D])}function IT(r,e,i,s,a,u,h,m){const g=function(v,w,S,A,D,R,O,$){const H=M_(0,0,1,0,1,1,0,1),K=M_(v,w,S,A,D,R,O,$);return be(K,K,Ee([],H))}(r,e,i,s,a,u,h,m);return[g[2]/g[8]/_t,g[5]/g[8]/_t]}function P_(r){return[r[0],Math.min(Math.max(r[1],-Me),Me)]}class CT extends Sa{constructor(e,i,s,a){super(),this.id=e,this.dispatcher=s,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new js("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=ul(this.map._requestManager.transformRequest(this.url,ku.Image),(s,a)=>{this._imageRequest=null,this._loaded=!0,s?this.fire(new Td(s)):a&&(this.image=a instanceof HTMLImageElement?Io.getImageData(a):a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new C_(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new js("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof C_||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],s=e[0][1];for(const u of e)u[1]>s&&(s=u[1]),u[1]<i&&(i=u[1]);const a=(s+i)/2;if(a>Me?this.onNorthPole=!0:a<-Me&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const u=e.map(ke.fromLngLat);this.tileID=function(h){let m=1/0,g=1/0,v=-1/0,w=-1/0;for(const O of h)m=Math.min(m,O.x),g=Math.min(g,O.y),v=Math.max(v,O.x),w=Math.max(w,O.y);const S=Math.max(v-m,w-g),A=Math.max(0,Math.floor(-Math.log(S)/Math.LN2)),D=Math.pow(2,A);let R=Math.floor((m+v)/2*D);return R>1&&(R-=1),new cr(A,R,Math.floor((g+w)/2*D))}(u),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new js("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const H in this.tiles){const K=this.tiles[H];K.state!=="loaded"&&(K.state="loaded",K.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=$p(new cr(0,0,0),this.map.transform.projection),s=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(H){const K=H[1].x-H[0].x,W=H[1].y-H[0].y,F=H[2].x-H[1].x,q=H[2].y-H[1].y,Y=H[3].x-H[2].x,ee=H[3].y-H[2].y,he=H[0].x-H[3].x,ye=H[0].y-H[3].y,ve=K*q-F*W,Ce=F*ee-Y*q,Ue=Y*ye-he*ee,et=he*W-K*ye;return ve>0&&Ce>0&&Ue>0&&et>0||ve<0&&Ce<0&&Ue<0&&et<0}(s))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=$p(this.tileID,this.map.transform.projection),[u,h,m,g]=this.coordinates.map(H=>{const K=a.projection.project(H[0],H[1]);return fT(a,K)._round()});this.perspectiveTransform=IT(u.x,u.y,h.x,h.y,m.x,m.y,g.x,g.y);const v=this._boundsArray=new Ua;v.emplaceBack(u.x,u.y,0,0),v.emplaceBack(h.x,h.y,_t,0),v.emplaceBack(g.x,g.y,0,_t),v.emplaceBack(m.x,m.y,_t,_t),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(v,G0.members),this.boundsSegments=Cr.simpleSegment(0,0,4,2);const w=[],S=[P_((A=this.coordinates)[0]),P_(A[1]),P_(A[2]),P_(A[3])];var A;const[D,R,O,$]=function(H){let K=H[0][0],W=K,F=H[0][1],q=F;for(let Y=1;Y<H.length;Y++)H[Y][0]<K?K=H[Y][0]:H[Y][0]>W&&(W=H[Y][0]),H[Y][1]<F?F=H[Y][1]:H[Y][1]>q&&(q=H[Y][1]);return[K,F,W-K,q-F]}(S);{const H=new Ua,[K,W,F,q]=function(je){let Je=je[0].x,Fe=Je,Ve=je[0].y,lt=Ve;for(let ut=1;ut<je.length;ut++)je[ut].x<Je?Je=je[ut].x:je[ut].x>Fe&&(Fe=je[ut].x),je[ut].y<Ve?Ve=je[ut].y:je[ut].y>lt&&(lt=je[ut].y);return[Je,Ve,Fe-Je,lt-Ve]}(s),Y=je=>[(je.x-K)/F,(je.y-W)/q],[ee,he,ye,ve]=s.map(Y),Ce=function(je,Je,Fe,Ve,lt,ut,zt,Et){const gt=M_(0,0,1,0,1,1,0,1);return be(gt,gt,Ee([],M_(je,Je,Fe,Ve,lt,ut,zt,Et)))}(ee[0],ee[1],he[0],he[1],ye[0],ye[1],ve[0],ve[1]);this.elevatedGlobePerspectiveTransform=IT(ee[0],ee[1],he[0],he[1],ye[0],ye[1],ve[0],ve[1]);const Ue=(je,Je)=>{w.push(je.lng);const Fe=Math.round((je.lng-D)/O*_t),Ve=Math.round((je.lat-R)/$*_t),lt=Y(Je),ut=Kn([],[lt[0],lt[1],1],Ce),zt=Math.round(ut[0]/ut[2]*_t),Et=Math.round(ut[1]/ut[2]*_t);H.emplaceBack(Fe,Ve,zt,Et)},et=s[3].x-s[0].x,Ye=s[3].y-s[0].y,Qe=s[2].x-s[1].x,ot=s[2].y-s[1].y;for(let je=0;je<65;je++){const Je=je/64,Fe=[s[0].x+Je*et,s[0].y+Je*Ye],Ve=[s[1].x+Je*Qe,s[1].y+Je*ot],lt=Ve[0]-Fe[0],ut=Ve[1]-Fe[1];for(let zt=0;zt<65;zt++){const Et=zt/64,gt={x:Fe[0]+lt*Et,y:Fe[1]+ut*Et,z:0};Ue(i.projection.unproject(gt.x,gt.y),gt)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(H,G0.members)}{this.maxLongitudeTriangleSize=0;let H=[],K=new fn;const W=(F,q,Y)=>{K.emplaceBack(F,q,Y);const ee=w[F],he=w[q],ye=w[Y],ve=Math.min(Math.min(ee,he),ye),Ce=Math.max(Math.max(ee,he),ye)-ve;Ce>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Ce),H.push(ve+Ce/2)};for(let F=0;F<64;F++)for(let q=0;q<64;q++){const Y=65*F+q,ee=Y+1,he=Y+65,ye=he+1;W(Y,he,ee),W(ee,he,ye)}[H,K]=function(F,q){const Y=Array.from({length:F.length},(ye,ve)=>ve);Y.sort((ye,ve)=>F[ye]-F[ve]);const ee=[],he=new fn;for(let ye=0;ye<Y.length;ye++){const ve=Y[ye];ee.push(F[ve]);const Ce=3*ve,Ue=Ce+1;he.emplaceBack(q.uint16[Ce],q.uint16[Ue],q.uint16[Ue+1])}return[ee,he]}(H,K),this.elevatedGlobeTrianglesCenterLongitudes=H,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(K)}this.elevatedGlobeSegments=Cr.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,O/_t,0,$/_t,0,0,R,D,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,s=i.gl;!this._dirty||this.texture instanceof C_||(this.texture?this.texture.update(this.image):(this.texture=new Z0(i,this.image,s.RGBA8),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const s=this.elevatedGlobeTrianglesCenterLongitudes;let a=(u=e+180)+360*Math.round((s[0]-u)/360);var u;const h=new Cr,m=(S,A)=>{h.segments.push({vertexOffset:0,primitiveOffset:S,vertexLength:i.segments[0].vertexLength,primitiveLength:A,sortKey:void 0,vaos:{}})},g=.51*this.maxLongitudeTriangleSize;if(Math.abs(s[0]-a)<=g){const S=ps(s,0,s.length,a+g);return S===s.length||m(S,bn(s,S+1,s.length,a+360-g)-S),h}a<s[0]&&(a+=360);const v=bn(s,0,s.length,a-g);if(v===s.length)return m(0,s.length),h;m(0,v-0);const w=ps(s,v+1,s.length,a+g);return w!==s.length&&m(w,s.length-w),h}}const g3=(Math.pow(256,2)-1)/16907520;class MT extends $n{constructor(e,i,s,a){super(e,{layout:ET||(ET=new Nr({visibility:new dt(Re.layout_raster.visibility)})),paint:AT||(AT=new Nr({"raster-opacity":new dt(Re.paint_raster["raster-opacity"]),"raster-color":new ja(Re.paint_raster["raster-color"]),"raster-color-mix":new dt(Re.paint_raster["raster-color-mix"]),"raster-color-range":new dt(Re.paint_raster["raster-color-range"]),"raster-hue-rotate":new dt(Re.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new dt(Re.paint_raster["raster-brightness-min"]),"raster-brightness-max":new dt(Re.paint_raster["raster-brightness-max"]),"raster-saturation":new dt(Re.paint_raster["raster-saturation"]),"raster-contrast":new dt(Re.paint_raster["raster-contrast"]),"raster-resampling":new dt(Re.paint_raster["raster-resampling"]),"raster-fade-duration":new dt(Re.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new dt(Re.paint_raster["raster-emissive-strength"]),"raster-array-band":new dt(Re.paint_raster["raster-array-band"]),"raster-elevation":new dt(Re.paint_raster["raster-elevation"]),"raster-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},i,s,a),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof CT&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[s,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(s)&&isNaN(a)||s===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=Ap({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:s,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[s,a])}}let PT,DT,RT,zT,LT;class kT extends $n{constructor(e,i,s,a){super(e,{layout:PT||(PT=new Nr({visibility:new dt(Re["layout_raster-particle"].visibility)})),paint:DT||(DT=new Nr({"raster-particle-array-band":new dt(Re["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new dt(Re["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new ja(Re["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new dt(Re["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new dt(Re["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new dt(Re["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new dt(Re["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new dt(Re["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},i,s,a),this._updateColorRamp(),this.lastInvalidatedAt=Io.now()}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Ap({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Io.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class y3 extends $n{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function W0(r,e,i){const s=[0,0,1],a=On([]);return $o(a,a,i?-U(r)+Math.PI:U(r)),po(a,a,-U(e)),oo(s,s,a),Ui(s,s)}function OT(r,e){const i=D_(r.projection,r.zoom,r.width,r.height),s=function(u,h,m,g,v){const w=new V(m.lng-180*Wl,m.lat),S=new V(m.lng+180*Wl,m.lat),A=u.project(w.lng,w.lat),D=u.project(S.lng,S.lat),R=-Math.atan2(D.y-A.y,D.x-A.x),O=ke.fromLngLat(m);O.y=Te(O.y,-1+Wl,1-Wl);const $=O.toLngLat(),H=u.project($.lng,$.lat),K=ke.fromLngLat($);K.x+=Wl;const W=K.toLngLat(),F=u.project(W.lng,W.lat),q=BT(F.x-H.x,F.y-H.y,R),Y=ke.fromLngLat($);Y.y+=Wl;const ee=Y.toLngLat(),he=u.project(ee.lng,ee.lat),ye=BT(he.x-H.x,he.y-H.y,R),ve=Math.abs(q.x)/Math.abs(ye.y),Ce=_e([]);xt(Ce,Ce,-R*(1-(v?0:g)));const Ue=_e([]);return nt(Ue,Ue,[1,1-(1-ve)*g,1]),Ue[4]=-ye.x/ye.y*g,xt(Ue,Ue,R),Se(Ue,Ce,Ue),Ue}(r.projection,0,r.center,i,e),a=FT(r);return nt(s,s,[a,a,1]),s}function FT(r){const e=r.projection,i=D_(r.projection,r.zoom,r.width,r.height),s=X0(e,r.center),a=X0(e,V.convert(e.center));return Math.pow(2,s*i+(1-i)*a)}function D_(r,e,i,s,a=1/0){const u=r.range;if(!u)return 0;const h=Math.min(a,Math.max(i,s)),m=Math.log(h/1024)/Math.LN2;return Ae(u[0]+m,u[1]+m,e)}const Wl=1/4e4;function X0(r,e){const i=Te(e.lat,-Me,Me),s=new V(e.lng-180*Wl,i),a=new V(e.lng+180*Wl,i),u=r.project(s.lng,i),h=r.project(a.lng,i),m=ke.fromLngLat(s),g=ke.fromLngLat(a),v=h.x-u.x,w=h.y-u.y,S=g.x-m.x,A=g.y-m.y,D=Math.sqrt((S*S+A*A)/(v*v+w*w));return Math.log(D)/Math.LN2}function BT(r,e,i){const s=Math.cos(i),a=Math.sin(i);return{x:r*s-e*a,y:r*a+e*s}}function NT(r,e,i){_e(r),xt(r,r,U(e[2])),Xe(r,r,U(e[0])),ct(r,r,U(e[1])),nt(r,r,i),Se(r,r,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function R_(r,e,i,s,a,u,h,m){const g=[i[0]-e[0],i[1]-e[1],0],v=[s[0]-e[0],s[1]-e[1],0];if(Jt(g)<1e-12||Jt(v)<1e-12)return On(r);const w=Lr([],g,v);Ui(w,w),ri(v,s,e),g[2]=(u-a)*m,v[2]=(h-a)*m;const S=g;return Lr(S,g,v),Ui(S,S),hs(r,w,S)}function Y0(r,e,i=!1){const s=Vl(e.zoom),a=function(u,h,m){const g=h.worldSize,v=[u[12],u[13],u[14]],w=me(v[1]/g),S=de(v[0]/g),A=_e([]),D=ne(1,w)*g,R=ne(1,0)*g*He(w,h.zoom),O=1/n0(g);let $=R*O;if(m){const F=D_(h.projection,h.zoom,h.width,h.height,1024);$=O*h.projection.pixelSpaceConversion(h.center.lat,g,F)}const H=N(w,S);vi(H,H,Ii([],Ui([],H),D*$*v[2]));const K=function(F){const q=[F[0],F[1],F[2]];let Y=[0,1,0];const ee=Lr([],Y,q);return Lr(Y,q,ee),Yn(Y)===0&&(Y=[0,1,0],Lr(ee,q,Y)),Ui(ee,ee),Ui(Y,Y),Ui(q,q),[ee[0],ee[1],ee[2],0,Y[0],Y[1],Y[2],0,q[0],q[1],q[2],0,F[0],F[1],F[2],1]}(H);nt(A,A,[$,$,$*D]),st(A,A,[-v[0],-v[1],-v[2]]);const W=Se([],h.globeMatrix,K);return Se(W,W,A),Se(W,W,u),W}(r,e,i);if(s>0){const u=function(h,m){const g=m.worldSize,v=ne(1,0)*g*He(m.center.lat,m.zoom)/n0(g),w=ne(1,m.center.lat)*g,S=_e([]);return ct(S,S,U(m.center.lng)),Xe(S,S,U(m.center.lat)),st(S,S,[0,0,f]),nt(S,S,[v,v,v*w]),st(S,S,[m.point.x-.5*g,m.point.y-.5*g,0]),Se(S,S,h),Se(S,m.globeMatrix,S)}(r,e);return function(h,m,g){const v=(R,O,$)=>{const H=Jt(R),K=Jt(O),W=Za(R,O,$);return Ii(W,W,1/Jt(W)*Nt(H,K,$))},w=v([h[0],h[1],h[2]],[m[0],m[1],m[2]],g),S=v([h[4],h[5],h[6]],[m[4],m[5],m[6]],g),A=v([h[8],h[9],h[10]],[m[8],m[9],m[10]],g),D=Za([h[12],h[13],h[14]],[m[12],m[13],m[14]],g);return[w[0],w[1],w[2],0,S[0],S[1],S[2],0,A[0],A[1],A[2],0,D[0],D[1],D[2],1]}(a,u,s)}return a}function jT(r,e,i,s){const a=xr.projectAabbCorners(s,i);let u=Number.MAX_VALUE,h=-1;for(let v=0;v<a.length;++v){const w=a[v];w[0]=(.5*w[0]+.5)*e.width,w[1]=(.5-.5*w[1])*e.height,w[2]<u&&(h=v,u=w[2])}const m=v=>new ft(a[v][0],a[v][1]);let g;switch(h){case 0:case 6:g=[m(1),m(5),m(4),m(7),m(3),m(2),m(1)];break;case 1:case 7:g=[m(0),m(4),m(5),m(6),m(2),m(3),m(0)];break;case 3:case 5:g=[m(1),m(0),m(4),m(7),m(6),m(2),m(1)];break;default:g=[m(1),m(5),m(6),m(7),m(3),m(0),m(1)]}if(Vt(r,g))return u}const v3=ki([{name:"a_pos_3f",components:3,type:"Float32"}]),x3=ki([{name:"a_color_3f",components:3,type:"Float32"}]),b3=ki([{name:"a_color_4f",components:4,type:"Float32"}]),w3=ki([{name:"a_uv_2f",components:2,type:"Float32"}]),T3=ki([{name:"a_normal_3f",components:3,type:"Float32"}]),S3=ki([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),E3=ki([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),VT={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7};class z_{constructor(e,i,s,a){this.message=(e?`${e}: `:"")+s,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function K0(r,e){const i=r.indexOf("://")===-1;try{return new URL(r,i&&e?"http://example.com":void 0),!0}catch{return!1}}class UT{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class $T{constructor(){this.instancedDataArray=new kl,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class J0{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs}updateFootprints(e,i){}populate(e,i,s,a){this.tileToMeter=De(s);const u=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:h,id:m,index:g,sourceLayerIndex:v}of e){const w=m??(h.properties&&h.properties.hasOwnProperty("id")?h.properties.id:void 0),S=Lt(h,u);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),S,s))continue;const A={id:w,sourceLayerIndex:v,index:g,geometry:u?S.geometry:At(h,s,a),properties:h.properties,type:h.type,patterns:{}},D=this.addFeature(A,A.geometry,S);D&&i.featureIndex.insert(h,A.geometry,g,v,this.index,this.instancesPerModel[D].instancedDataArray.length,_t/32)}this.lookup=null}update(e,i,s,a){for(const u in this.instancesPerModel){const h=this.instancesPerModel[u];for(const m in e)h.idToFeaturesIndex.hasOwnProperty(m)&&(this.evaluate(h.features[h.idToFeaturesIndex[m]],e[m],h,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];for(const a of s.features){const u=this.layers[0],h=a.feature,m=this.canonical,g=u.paint.get("model-rotation").evaluate(h,{},m),v=u.paint.get("model-scale").evaluate(h,{},m),w=u.paint.get("model-translation").evaluate(h,{},m);Qi(a.rotation,g)&&Qi(a.scale,v)&&Qi(a.translation,w)||(this.evaluate(a,a.featureStates,s,!0),e=!0)}}return e}updateReplacement(e,i,s,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const u=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(b0(this.activeReplacements,u))return!1;this.activeReplacements=u;let h=!1;for(const m in this.instancesPerModel){const g=this.instancesPerModel[m],v=g.instancedDataArray;for(const w of g.features){const S=w.instancedDataOffset,A=w.instancedDataCount;for(let D=0;D<A;D++){const R=16*(D+S);let O=v.float32[R+0];const $=O>_t;O=$?O-_t:O;const H=Math.floor(O),K=v.float32[R+1];let W=!1;for(const F of this.activeReplacements)if(!Zw(F,s,VT.Model,a)&&!(F.min.x>H||H>F.max.x||F.min.y>K||K>F.max.y)&&(W=Qw(Jw(H,K,e.canonical,F.footprintTileId.canonical),F.footprint),W))break;v.float32[R]=W?O+_t:O,h=h||W!==$}}}return h}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];s.instancedDataArray.length<0||s.instancedDataArray.length===0||(s.instancedDataBuffer?s.instancedDataBuffer.updateData(s.instancedDataArray):s.instancedDataBuffer=e.createVertexBuffer(s.instancedDataArray,S3.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];s.instancedDataArray.length!==0&&s.instancedDataBuffer&&s.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris&&this.modelsRequested)for(const i of this.modelUris)e.removeModel(i,"",!0)}addFeature(e,i,s){const a=this.layers[0],u=a.layout.get("model-id").evaluate(s,{},this.canonical);if(!u)return yi(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),u;(K0(u,!1)||this.styleDefinedModelURLs[u]!==void 0)&&(this.modelUris.includes(u)||this.modelUris.push(u)),this.instancesPerModel[u]||(this.instancesPerModel[u]=new $T);const h=this.instancesPerModel[u],m=h.instancedDataArray,g=new UT(s,m.length);for(const v of i)for(const w of v){if(w.x<0||w.x>=_t||w.y<0||w.y>=_t)continue;const S=(this.lookupDim-1)/_t,A=this.lookupDim*(w.y*S|0)+w.x*S|0;if(this.lookup){if(this.lookup[A]!==0)continue;this.lookup[A]=1}this.instanceCount++;const D=m.length;m.resize(D+1),h.instancesEvaluatedElevation.push(0),m.float32[16*D]=w.x,m.float32[16*D+1]=w.y}return g.instancedDataCount=h.instancedDataArray.length-g.instancedDataOffset,g.instancedDataCount>0&&(e.id&&(h.idToFeaturesIndex[e.id]=h.features.length),h.features.push(g),this.evaluate(g,{},h,!1)),u}getModelUris(){return this.modelUris}evaluate(e,i,s,a){const u=this.layers[0],h=e.feature,m=this.canonical,g=e.rotation=u.paint.get("model-rotation").evaluate(h,i,m),v=e.scale=u.paint.get("model-scale").evaluate(h,i,m),w=e.translation=u.paint.get("model-translation").evaluate(h,i,m),S=u.paint.get("model-color").evaluate(h,i,m);S.a=u.paint.get("model-color-mix-intensity").evaluate(h,i,m);const A=[];this.maxVerticalOffset<w[2]&&(this.maxVerticalOffset=w[2]),this.maxScale=Math.max(Math.max(this.maxScale,v[0]),Math.max(v[1],v[2])),NT(A,g,v);const D=Math.round(100*S.a)+S.b/1.05;for(let R=0;R<e.instancedDataCount;++R){const O=e.instancedDataOffset+R,$=16*O,H=s.instancedDataArray.float32;let K=0;a&&(K=H[$+6]-s.instancesEvaluatedElevation[O]);const W=0|H[$+1];H[$]=(0|H[$])+S.r/1.05,H[$+1]=W+S.g/1.05,H[$+2]=D,H[$+3]=1/(m.z>10?this.tileToMeter:De(m,W)),H[$+4]=w[0],H[$+5]=w[1],H[$+6]=w[2]+K,H[$+7]=A[0],H[$+8]=A[1],H[$+9]=A[2],H[$+10]=A[4],H[$+11]=A[5],H[$+12]=A[6],H[$+13]=A[8],H[$+14]=A[9],H[$+15]=A[10],s.instancesEvaluatedElevation[O]=w[2]}}}let GT,HT;Tt(J0,"ModelBucket",{omit:["layers"]}),Tt($T,"PerModelAttributes"),Tt(UT,"ModelFeature");const iu=64,jh={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function qT(r,e,i,s,a,u,h,m,g,v=!1){const w=i.zoom,S=i.project(s),A=He(s.lat,w),D=1/A;_e(r),st(r,r,[S.x+h[0]*D,S.y+h[1]*D,h[2]]);let R=1,O=1;const $=i.worldSize;if(v){if(i.projection.name==="mercator"){let F=0;i.elevation&&(F=i.elevation.getAtPointOrZero(new ke(S.x/$,S.y/$),0));const q=Dr([],[S.x,S.y,F,1],i.projMatrix)[3]/i.cameraToCenterDistance;R=q,O=q*He(i.center.lat,w)}else if(i.projection.name==="globe"){const F=Y0(r,i),q=[0,0,0,1];Dr(q,q,Se([],i.projMatrix,F));const Y=q[3]/i.cameraToCenterDistance,ee=Vl(w),he=i.projection.pixelsPerMeter(s.lat,$)*He(s.lat,w),ye=i.projection.pixelsPerMeter(i.center.lat,$)*He(i.center.lat,w);R=Y/Nt(he,Ze(i.center.lat),ee),O=Y*A/he,R*=ye,O*=ye}}else R=D;nt(r,r,[R,R,O]);const H=[...r],K=e.orientation,W=[];if(NT(W,[K[0]+a[0],K[1]+a[1],K[2]+a[2]],u),Se(r,H,W),m&&i.elevation){let F=0;const q=[];if(g&&i.elevation){F=function(ee,he,ye,ve,Ce){const Ue=he.elevation;if(!Ue)return 0;const et=xr.projectAabbCorners(ye,ve),Ye=ne(1,Ce.lat)*he.worldSize,Qe=function(at,Xt){const Mt=[0,0,1],Pt=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const Ht of Pt){const ii=at[Ht.corners[0]],oi=at[Ht.corners[1]],fi=at[Ht.corners[2]],ci=[oi[0]-ii[0],oi[1]-ii[1],Xt*(oi[2]-ii[2])],ai=Lr(ci,ci,[fi[0]-ii[0],fi[1]-ii[1],Xt*(fi[2]-ii[2])]);Ui(ai,ai),Ht.dotProductWithUp=Zi(ai,Mt)}return Pt.sort((Ht,ii)=>Ht.dotProductWithUp-ii.dotProductWithUp),Pt[0].corners}(et,Ye),ot=et[Qe[0]],je=et[Qe[1]],Je=et[Qe[2]],Fe=et[Qe[3]],Ve=Ue.getAtPointOrZero(new ke(ot[0]/he.worldSize,ot[1]/he.worldSize),0),lt=Ue.getAtPointOrZero(new ke(je[0]/he.worldSize,je[1]/he.worldSize),0),ut=Ue.getAtPointOrZero(new ke(Je[0]/he.worldSize,Je[1]/he.worldSize),0),zt=Ue.getAtPointOrZero(new ke(Fe[0]/he.worldSize,Fe[1]/he.worldSize),0),Et=(Ve+zt)/2,gt=(lt+ut)/2;return Et>gt?lt<ut?R_(ee,je,Fe,ot,lt,zt,Ve,Ye):R_(ee,Je,ot,Fe,ut,Ve,zt,Ye):Ve<zt?R_(ee,ot,je,Je,Ve,lt,ut,Ye):R_(ee,Fe,Je,je,zt,ut,lt,Ye),Math.max(Et,gt)}(q,i,e.aabb,r,s);const Y=Se([],Wt([],q),W);Se(r,H,Y)}else F=i.elevation.getAtPointOrZero(new ke(S.x/$,S.y/$),0);F!==0&&(r[14]+=F)}}function Wp(r,e,i=!1){r.uploaded||(r.gfxTexture=new Z0(e,r.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:r.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),r.uploaded=!0,r.image=null)}function A3(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,v3.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,T3.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,w3.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?x3:b3).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,E3.members,!0)),r.segments=Cr.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const s=r.material;s.pbrMetallicRoughness.baseColorTexture&&Wp(s.pbrMetallicRoughness.baseColorTexture,e),s.pbrMetallicRoughness.metallicRoughnessTexture&&Wp(s.pbrMetallicRoughness.metallicRoughnessTexture,e),s.normalTexture&&Wp(s.normalTexture,e),s.occlusionTexture&&Wp(s.occlusionTexture,e,i),s.emissionTexture&&Wp(s.emissionTexture,e)}function Q0(r,e,i){if(r.meshes)for(const s of r.meshes)A3(s,e,i);if(r.children)for(const s of r.children)Q0(s,e,i)}function L_(r){if(r.meshes)for(const e of r.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(r.children)for(const e of r.children)L_(e)}function ev(r){if(r.meshes)for(const i of r.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(r.children)for(const i of r.children)ev(i)}class Vh{constructor(e,i,s){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=s}static create(e,i,s){const a=s||e.findDEMTileFor(i);if(!a||!a.dem)return;const u=a.dem,h=a.tileID,m=1<<i.canonical.z-h.canonical.z;return new Vh(a,u.dim/_t/m,[(i.canonical.x/m-h.canonical.x)*u.dim,(i.canonical.y/m-h.canonical.y)*u.dim])}tileCoordToPixel(e,i){const s=i*this._scale+this._offset[1],a=Math.floor(e*this._scale+this._offset[0]),u=Math.floor(s);return new ft(a,u)}getElevationAt(e,i,s,a){const u=e*this._scale+this._offset[0],h=i*this._scale+this._offset[1],m=Math.floor(u),g=Math.floor(h),v=this._dem;return a=!!a,s?Nt(Nt(v.get(m,g,a),v.get(m,g+1,a),h-g),Nt(v.get(m+1,g,a),v.get(m+1,g+1,a),h-g),u-m):v.get(m,g,a)}getElevationAtPixel(e,i,s){return this._dem.get(e,i,!!s)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*ne(1,e)*this._dem.stride}}const tv=new Float32Array(262144),ru=new Uint8Array(262144);function ZT(r){let e=0;if(r.meshes)for(const i of r.meshes)e=Math.max(e,i.aabb.max[2]);if(r.children)for(const i of r.children)e=Math.max(e,ZT(i));return e}function WT(r,e,i){if(r.meshes)for(const s of r.meshes){if(s.aabb.min[0]===1/0)continue;const a=xr.applyTransform(s.aabb,r.matrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(r.children)for(const s of r.children)WT(s,e,i)}const XT=["","wall","door","roof","window","lamp","logo"];class YT{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:ZT(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new xr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new xr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const s of this.node.meshes)this.node.lightMeshIndex!==e&&(s.transformedAabb=xr.applyTransformFast(s.aabb,this.node.matrix),i.encapsulate(s.transformedAabb)),e++;this.aabb=i}return this.aabb}}class k_{constructor(e,i,s,a,u,h,m){this.id=s,this.layers=e,this.layerIds=this.layers.map(g=>g.fqid),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.modelTraits|=jh.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=jh.HasMapboxMeshFeatures),u&&(this.modelTraits|=jh.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=h,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of i)this.nodesInfo.push(new YT(g)),WT(g,m.featureIndexArray.length,m.grid),m.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,m.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,i){for(const s of this.getNodesInfo()){const a=s.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const s=i?this.stateDependentLayers:this.layers;if(!ds(e,this.states))for(const a of s)this.evaluate(a,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const s of i){const a=s.node;this.uploaded?this.updatePbrBuffer(a):Q0(a,e,!0)}for(const s of i)L_(s.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const s of e.meshes)s.pbrBuffer&&(s.pbrBuffer.updateData(s.featureArray),i=!0);return i}needsReEvaluation(e,i,s){const a=e.transform.projectionOptions,u=e.style.getBrightness(),h=this.brightness!==u;if(!this.uploaded||this.dirty||a.name!==this.projection.name||Xp(s.paint.get("model-color").value,h)||Xp(s.paint.get("model-color-mix-intensity").value,h)||Xp(s.paint.get("model-roughness").value,h)||Xp(s.paint.get("model-emissive-strength").value,h)||Xp(s.paint.get("model-height-based-emissive-strength-multiplier").value,h)){this.projection=a,this.brightness=u;const m=this.getNodesInfo();for(const g of m)g.state=null;return!0}return!1}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const s=this.getNodesInfo(),a=this.id.canonical;for(const u of s){const h=u.feature;u.evaluatedScale=i.paint.get("model-scale").evaluate(h,{},a)}}evaluate(e,i){const s=this.getNodesInfo();for(const a of s){if(!a.node.meshes)continue;const u=a.feature,h=i&&i[u.id];if(ds(h,a.state))continue;a.state=structuredClone(h);const m=a.node.meshes&&a.node.meshes[0].featureData,g=a.evaluatedColor[2],v=a.evaluatedRMEA[2],w=this.id.canonical;if(a.hasTranslucentParts=!1,m){for(let S=0;S<XT.length;S++){const A=XT[S];A.length&&(u.properties.part=A);const D=e.paint.get("model-color").evaluate(u,h,w).toRenderColor(null),R=e.paint.get("model-color-mix-intensity").evaluate(u,h,w);a.evaluatedColor[S]=[D.r,D.g,D.b,R],a.evaluatedRMEA[S][0]=e.paint.get("model-roughness").evaluate(u,h,w),a.evaluatedRMEA[S][2]=e.paint.get("model-emissive-strength").evaluate(u,h,w),a.evaluatedRMEA[S][3]=D.a,a.emissionHeightBasedParams[S]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(u,h,w),!a.hasTranslucentParts&&D.a<1&&(a.hasTranslucentParts=!0)}delete u.properties.part,C3(a,g!==a.evaluatedColor[2]||v!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(u,h,w);a.evaluatedScale=e.paint.get("model-scale").evaluate(u,h,w),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,s,a){const u=e.findDEMTileFor(s);if(u&&(u.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(u.dem&&u.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=u.tileID.overscaledZ;const h=Vh.create(e,s,u);if(!h)return;this.modelTraits&jh.HasMapboxMeshFeatures&&this.updateDEM(e,h,s,a);for(const m of this.getNodesInfo()){const g=m.node;if(!g.footprint||!g.footprint.vertices||!g.footprint.vertices.length)continue;const v=g.footprint.vertices;let w=h.getElevationAt(v[0].x,v[0].y,!0,!0);for(let S=1;S<v.length;S++)w=Math.min(w,h.getElevationAt(v[S].x,v[S].y,!0,!0));g.elevation=w}}this.terrainTile=u.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,s,a){let u=i._dem._modifiedForSources[a];if(u===void 0&&(i._dem._modifiedForSources[a]=[],u=i._dem._modifiedForSources[a]),u.includes(s.canonical))return;const h=i._dem.dim;u.push(s.canonical);let m=!1;for(const g of this.getNodesInfo()){const v=g.node;if(!v.footprint||!v.footprint.grid)continue;const w=v.footprint.grid,S=i.tileCoordToPixel(w.min.x,w.min.y),A=i.tileCoordToPixel(w.max.x,w.max.y),D=Math.min(Math.min(h-A.y,S.x),Math.min(S.y,h-A.x));if(D<0)continue;const R=Te(D,2,5);let O=Math.max(0,S.x-R),$=Math.max(0,S.y-R),H=Math.min(A.x+R,h-1),K=Math.min(A.y+R,h-1);for(let Y=$;Y<=K;++Y)for(let ee=O;ee<=H;++ee)ru[Y*h+ee]=255;let W=0,F=0;for(let Y=0;Y<w.cellsY;++Y)for(let ee=0;ee<w.cellsX;++ee){if(!w.cells[Y*w.cellsX+ee])continue;const he=i.tileCoordToPixel(w.min.x+ee/w.xScale,w.min.y+Y/w.yScale),ye=i.tileCoordToPixel(w.min.x+(ee+1)/w.xScale,w.min.y+(Y+1)/w.yScale);for(let ve=he.y;ve<=Math.min(ye.y+1,h-1);++ve)for(let Ce=he.x;Ce<=Math.min(ye.x+1,h-1);++Ce)ru[ve*h+Ce]===255&&(ru[ve*h+Ce]=0,W+=i.getElevationAtPixel(Ce,ve),F++)}const q=W/F;O=Math.max(1,S.x-R),$=Math.max(1,S.y-R),H=Math.min(A.x+R,h-2),K=Math.min(A.y+R,h-2),m=!0;for(let Y=$;Y<=K;++Y)for(let ee=O;ee<=H;++ee)ru[Y*h+ee]===0&&(tv[Y*h+ee]=i._dem.set(ee,Y,q));for(let Y=1;Y<R;++Y){O=Math.max(1,S.x-Y),$=Math.max(1,S.y-Y),H=Math.min(A.x+Y,h-2),K=Math.min(A.y+Y,h-2);for(let ee=$;ee<=K;++ee)for(let he=O;he<=H;++he){const ye=ee*h+he;if(ru[ye]===255){let ve=0,Ce=0,Ue=-1,et=-1;for(let Ye=-1;Ye<=1;++Ye)for(let Qe=-1;Qe<=1;++Qe){const ot=(ee+Ye)*h+he+Qe;if(ru[ot]>=Y)continue;const je=tv[ot],Je=Math.abs(je);Je>Ce&&(ve=je,Ce=Je,Ue=Qe,et=Ye)}if(Ce>.1){const Ye=1-(Y+.5*Math.abs(Ue*et))/R;let Qe=i._dem.get(he,ee)+ve*Ye;const ot=i._dem.get(he+Ue,ee+et),je=i._dem.get(he-Ue,ee-et,!0);(Qe-ot)*(Qe-je)>0&&(Qe=(ot+je)/2),tv[ye]=i._dem.set(he,ee,Qe),ru[ye]=Y}}}}}m&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Io.now())}setFilter(e){this.filter=e?ap(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new Wi(this.id.overscaledZ),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)L_(i.node),ev(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped()),a=this.getNodesInfo();for(let u=0;u<this.nodesInfo.length;u++){const h=a[u].node;a[u].hiddenByReplacement=!!h.footprint&&!s.find(m=>m.footprint===h.footprint)}}getHeightAtTileCoord(e,i){const s=this.getNodesInfo(),a=[],u=[0,0,0],h=_e([]);for(let m=0;m<this.nodesInfo.length;m++){const g=s[m],v=g.node.meshes[0],w=v.transformedAabb;if(e<w.min[0]||i<w.min[1]||e>w.max[0]||i>w.max[1])continue;if(g.node.hidden===!0)return{height:1/0,maxHeight:g.feature.properties.height,hidden:!1,verticalScale:g.evaluatedScale[2]};ze(h,g.node.matrix),u[0]=e,u[1]=i,gr(u,u,h);const S=(u[0]-v.aabb.min[0])/(v.aabb.max[0]-v.aabb.min[0])*iu|0,A=Math.min(63,(u[1]-v.aabb.min[1])/(v.aabb.max[1]-v.aabb.min[1])*iu|0)*iu+Math.min(63,S),D=v.heightmap[A];if(!(D<0&&g.node.footprint))return g.hiddenByReplacement?void 0:{height:D,maxHeight:g.feature.properties.height,hidden:!1,verticalScale:g.evaluatedScale[2]};if(g.node.footprint.grid.query(new ft(e,i),new ft(e,i),a),a.length>0)return{height:void 0,maxHeight:g.feature.properties.height,hidden:g.hiddenByReplacement,verticalScale:g.evaluatedScale[2]}}}}function Xp(r,e){return r instanceof Oa&&!r.isLightConstant&&e}function I3(r,e,i,s,a,u,h,m){let g=(61440&e|(61440&e)>>4)>>8,v=(3840&e|(3840&e)>>4)>>4,w=240&e|(240&e)>>4;i[3]>0&&(g=Nt(g,255*i[0],i[3]),v=Nt(v,255*i[1],i[3]),w=Nt(w,255*i[2],i[3]));const S=g<<8|v,A=w<<8|Math.floor(255*s[3]),D=function(Y){const ee=Te(Y,0,2);return Math.min(Math.round(.5*ee*255),255)}(s[2])<<8|15*s[0]<<4|15*s[1],R=Te(a[0],0,1),O=Te(a[1],0,1),$=Te(a[2],0,1),H=Te(a[3],0,1);let K,W,F,q;if(R!==O&&h!==u&&O!==R){const Y=h-u;W=1/(Y*(O-R)),F=-(u+Y*R)/(Y*(O-R));const ee=Te(a[4],-1,1);q=Math.pow(10,ee),K=255*$<<8|255*H}else K=65535,W=0,F=1,q=1;if(r.emplaceBack(S,A,D,K,W,F,q),m){const Y=m.length;m.clear();for(let ee=0;ee<Y;ee++)m.emplaceBack(S,A,D,K,W,F,q)}}function C3(r,e,i){const s=r.node;let a=0;const u=i&jh.HasMeshoptCompression;for(const h of s.meshes){if(s.lights&&s.lightMeshIndex===a||!h.featureData)continue;h.featureArray=new $c,h.featureArray.reserve(h.featureData.length);let m=e;for(const g of h.featureData){const v=u?65535&g:g>>16&65535,w=u?g>>16&65535:65535&g,S=(15&w)<8?15&w:0,A=r.evaluatedRMEA[S],D=r.evaluatedColor[S],R=r.emissionHeightBasedParams[S];let O;if(m&&S===2&&s.lights&&(O=new $c,O.resize(10*s.lights.length)),I3(h.featureArray,v,D,A,R,h.aabb.min[2],h.aabb.max[2],O),O&&m){m=!1;const $=s.meshes[s.lightMeshIndex];$.featureArray=O,$.featureArray._trim()}}h.featureArray._trim(),a++}}function KT(r,e,i,s){const a=1<<r.z;e.lat=me((s/_t+r.y)/a),e.lng=de((i/_t+r.x)/a)}Tt(k_,"Tiled3dModelBucket",{omit:["layers"]}),Tt(YT,"Tiled3dModelFeature");const M3={circle:class extends $n{constructor(r,e,i,s){super(r,{layout:Bi||(Bi=new Nr({"circle-sort-key":new wt(Re.layout_circle["circle-sort-key"]),"circle-elevation-reference":new dt(Re.layout_circle["circle-elevation-reference"]),visibility:new dt(Re.layout_circle.visibility)})),paint:Er||(Er=new Nr({"circle-radius":new wt(Re.paint_circle["circle-radius"]),"circle-color":new wt(Re.paint_circle["circle-color"]),"circle-blur":new wt(Re.paint_circle["circle-blur"]),"circle-opacity":new wt(Re.paint_circle["circle-opacity"]),"circle-translate":new dt(Re.paint_circle["circle-translate"]),"circle-translate-anchor":new dt(Re.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new dt(Re.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new dt(Re.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new wt(Re.paint_circle["circle-stroke-width"]),"circle-stroke-color":new wt(Re.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new wt(Re.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new dt(Re.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}createBucket(r){return new Ct(r)}queryRadius(r){const e=r;return si("circle-radius",this,e)+si("circle-stroke-width",this,e)+yr(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,s,a,u,h,m){const g=vr(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),v=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return uw(r,s,u,h,m,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",g,v)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const s=cw(this);return{config:new ia(this,{zoom:e,lut:i}),defines:s,overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends $n{createBucket(r){return new dw(r)}constructor(r,e,i,s){super(r,{layout:pw||(pw=new Nr({visibility:new dt(Re.layout_heatmap.visibility)})),paint:fw||(fw=new Nr({"heatmap-radius":new wt(Re.paint_heatmap["heatmap-radius"]),"heatmap-weight":new wt(Re.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new dt(Re.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ja(Re.paint_heatmap["heatmap-color"]),"heatmap-opacity":new dt(Re.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ap({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(r){return si("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,s,a,u,h,m){const g=this.paint.get("heatmap-radius").evaluate(e,i);return uw(r,s,u,h,m,!0,!0,new ft(0,0),g)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(r,e,i){return r==="heatmap"?{config:new ia(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends $n{constructor(r,e,i,s){super(r,{layout:mw||(mw=new Nr({visibility:new dt(Re.layout_hillshade.visibility)})),paint:_w||(_w=new Nr({"hillshade-illumination-direction":new dt(Re.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new dt(Re.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new dt(Re.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new dt(Re.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new dt(Re.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new dt(Re.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new dt(Re.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}},fill:class extends $n{constructor(r,e,i,s){super(r,{layout:Uw||(Uw=new Nr({"fill-sort-key":new wt(Re.layout_fill["fill-sort-key"]),visibility:new dt(Re.layout_fill.visibility),"fill-elevation-reference":new dt(Re.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new wt(Re.layout_fill["fill-construct-bridge-guard-rail"])})),paint:$w||($w=new Nr({"fill-antialias":new dt(Re.paint_fill["fill-antialias"]),"fill-opacity":new wt(Re.paint_fill["fill-opacity"]),"fill-color":new wt(Re.paint_fill["fill-color"]),"fill-outline-color":new wt(Re.paint_fill["fill-outline-color"]),"fill-translate":new dt(Re.paint_fill["fill-translate"]),"fill-translate-anchor":new dt(Re.paint_fill["fill-translate-anchor"]),"fill-pattern":new wt(Re.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new dt(Re.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new dt(Re.paint_fill["fill-emissive-strength"]),"fill-z-offset":new wt(Re.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new wt(Re.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new wt(Re.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}getProgramIds(){const r=this.paint.get("fill-pattern"),e=r&&r.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(r,e,i){return{config:new ia(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(r,e){super.recalculate(r,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(r){return new y0(r)}queryRadius(){return yr(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,s,a,u){return!r.queryGeometry.isAboveHorizon&&gi(Di(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),s)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(r){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return r!=null?e&&!r:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends $n{constructor(r,e,i,s){super(r,{layout:f2||(f2=new Nr({visibility:new dt(Re["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new dt(Re["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:m2||(m2=new Nr({"fill-extrusion-opacity":new dt(Re["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new wt(Re["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new dt(Re["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new dt(Re["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new wt(Re["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new dt(Re["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new wt(Re["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new wt(Re["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new dt(Re["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new dt(Re["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new dt(Re["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new dt(Re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new dt(Re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new dt(Re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new dt(Re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new dt(Re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new dt(Re["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new dt(Re["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new wt(Re["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new wt(Re["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new dt(Re["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new dt(Re["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new dt(Re["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new dt(Re["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new wt(Re["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new wt(Re["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new dt(Re["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new h_(r)}queryRadius(){return yr(this.paint.get("fill-extrusion-translate"))}is3D(r){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(r,e,i,s,a,u,h,m,g){const v=vr(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),w=this.paint.get("fill-extrusion-height").evaluate(e,i),S=this.paint.get("fill-extrusion-base").evaluate(e,i),A=[0,0],D=m&&u.elevation,R=u.elevation?u.elevation.exaggeration():1,O=r.tile.getBucket(this);if(D&&O instanceof h_){const F=O.centroidVertexArray,q=g+1;q<F.length&&(A[0]=F.geta_centroid_pos0(q),A[1]=F.geta_centroid_pos1(q))}if(A[0]===0&&A[1]===1)return!1;u.projection.name==="globe"&&(s=p2([s],[new ft(0,0),new ft(_t,_t)],r.tileID.canonical).map(F=>F.polygon).flat());const $=D?m:null,[H,K]=function(F,q,Y,ee,he,ye,ve,Ce,Ue,et,Ye){return F.projection.name==="globe"?function(Qe,ot,je,Je,Fe,Ve,lt,ut,zt,Et,gt){const at=[],Xt=[],Mt=Qe.projection.upVectorScale(gt,Qe.center.lat,Qe.worldSize).metersToTile,Pt=[0,0,0,1],Ht=[0,0,0,1],ii=(fi,ci,ai,tr)=>{fi[0]=ci,fi[1]=ai,fi[2]=tr,fi[3]=1},oi=d2();je>0&&(je+=oi),Je+=oi;for(const fi of ot){const ci=[],ai=[];for(const tr of fi){const ur=tr.x+Fe.x,J=tr.y+Fe.y,te=Qe.projection.projectTilePoint(ur,J,gt),Ge=Qe.projection.upVector(gt,tr.x,tr.y);let pt=je,vt=Je;if(lt){const yt=b2(ur,J,je,Je,lt,ut,zt,Et);pt+=yt.base,vt+=yt.top}je!==0?ii(Pt,te.x+Ge[0]*Mt*pt,te.y+Ge[1]*Mt*pt,te.z+Ge[2]*Mt*pt):ii(Pt,te.x,te.y,te.z),ii(Ht,te.x+Ge[0]*Mt*vt,te.y+Ge[1]*Mt*vt,te.z+Ge[2]*Mt*vt),gr(Pt,Pt,Ve),gr(Ht,Ht,Ve),ci.push(new eu(Pt[0],Pt[1],Pt[2])),ai.push(new eu(Ht[0],Ht[1],Ht[2]))}at.push(ci),Xt.push(ai)}return[at,Xt]}(F,q,Y,ee,he,ye,ve,Ce,Ue,et,Ye):ve?function(Qe,ot,je,Je,Fe,Ve,lt,ut,zt){const Et=[],gt=[],at=[0,0,0,1];for(const Xt of Qe){const Mt=[],Pt=[];for(const Ht of Xt){const ii=Ht.x+Je.x,oi=Ht.y+Je.y,fi=b2(ii,oi,ot,je,Ve,lt,ut,zt);at[0]=ii,at[1]=oi,at[2]=fi.base,at[3]=1,Dr(at,at,Fe),at[3]=Math.max(at[3],1e-5);const ci=new eu(at[0]/at[3],at[1]/at[3],at[2]/at[3]);at[0]=ii,at[1]=oi,at[2]=fi.top,at[3]=1,Dr(at,at,Fe),at[3]=Math.max(at[3],1e-5);const ai=new eu(at[0]/at[3],at[1]/at[3],at[2]/at[3]);Mt.push(ci),Pt.push(ai)}Et.push(Mt),gt.push(Pt)}return[Et,gt]}(q,Y,ee,he,ye,ve,Ce,Ue,et):function(Qe,ot,je,Je,Fe){const Ve=[],lt=[],ut=Fe[8]*ot,zt=Fe[9]*ot,Et=Fe[10]*ot,gt=Fe[11]*ot,at=Fe[8]*je,Xt=Fe[9]*je,Mt=Fe[10]*je,Pt=Fe[11]*je;for(const Ht of Qe){const ii=[],oi=[];for(const fi of Ht){const ci=fi.x+Je.x,ai=fi.y+Je.y,tr=Fe[0]*ci+Fe[4]*ai+Fe[12],ur=Fe[1]*ci+Fe[5]*ai+Fe[13],J=Fe[2]*ci+Fe[6]*ai+Fe[14],te=Fe[3]*ci+Fe[7]*ai+Fe[15],Ge=tr+ut,pt=ur+zt,vt=J+Et,yt=Math.max(te+gt,1e-5),Dt=tr+at,Gt=ur+Xt,wi=J+Mt,Ti=Math.max(te+Pt,1e-5);ii.push(new eu(Ge/yt,pt/yt,vt/yt)),oi.push(new eu(Dt/Ti,Gt/Ti,wi/Ti))}Ve.push(ii),lt.push(oi)}return[Ve,lt]}(q,Y,ee,he,ye)}(u,s,S,w,v,h,$,A,R,u.center.lat,r.tileID.canonical),W=r.queryGeometry;return function(F,q,Y){let ee=1/0;gi(Y,q)&&(ee=x2(Y,q[0]));for(let he=0;he<q.length;he++){const ye=q[he],ve=F[he];for(let Ce=0;Ce<ye.length-1;Ce++){const Ue=ye[Ce],et=[Ue,ye[Ce+1],ve[Ce+1],ve[Ce],Ue];Vt(Y,et)&&(ee=Math.min(ee,x2(Y,et)))}}return ee!==1/0&&ee}(H,K,W.isPointQuery()?W.screenBounds:W.screenGeometry)}},line:class extends $n{constructor(r,e,i,s){const a=D2();super(r,a,e,i,s),a.layout&&(this.layout=new Na(a.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Ic,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(r,e){super.recalculate(r,e),this.paint._values["line-floorwidth"]=(()=>{if(Op)return Op;const i=D2();return Op=new Pk(i.paint.properties["line-width"].specification),Op.useIntegerZoom=!0,Op})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new E0(r)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(r,e,i){const s=M2(this);return{config:new ia(this,{zoom:e,lut:i}),defines:s,overrideFog:!1}}queryRadius(r){const e=r,i=R2(si("line-width",this,e),si("line-gap-width",this,e)),s=si("line-offset",this,e);return i/2+Math.abs(s)+yr(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,s,a,u){if(r.queryGeometry.isAboveHorizon)return!1;const h=Di(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),m=r.pixelToTileUnitsFactor/2*R2(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),g=this.paint.get("line-offset").evaluate(e,i);return g&&(s=function(v,w){const S=[],A=new ft(0,0);for(let D=0;D<v.length;D++){const R=v[D],O=[];for(let $=0;$<R.length;$++){const H=R[$],K=R[$+1],W=$===0?A:H.sub(R[$-1])._unit()._perp(),F=$===R.length-1?A:K.sub(H)._unit()._perp(),q=W._add(F)._unit();q._mult(1/(q.x*F.x+q.y*F.y)),O.push(q._mult(w)._add(H))}S.push(O)}return S}(s,g*r.pixelToTileUnitsFactor)),function(v,w,S){for(let A=0;A<w.length;A++){const D=w[A];if(v.length>=3){for(let R=0;R<D.length;R++)if(Yi(v,D[R]))return!0}if(Xi(v,D,S))return!0}return!1}(h,s,m)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(r){return!this.hasElevatedBuckets}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:I_,background:class extends $n{constructor(r,e,i,s){super(r,{layout:TT||(TT=new Nr({visibility:new dt(Re.layout_background.visibility)})),paint:ST||(ST=new Nr({"background-pitch-alignment":new dt(Re.paint_background["background-pitch-alignment"]),"background-color":new dt(Re.paint_background["background-color"]),"background-pattern":new dt(Re.paint_background["background-pattern"]),"background-opacity":new dt(Re.paint_background["background-opacity"]),"background-emissive-strength":new dt(Re.paint_background["background-emissive-strength"]),"background-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}is3D(r){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:MT,"raster-particle":kT,sky:class extends $n{constructor(r,e,i,s){super(r,{layout:RT||(RT=new Nr({visibility:new dt(Re.layout_sky.visibility)})),paint:zT||(zT=new Nr({"sky-type":new dt(Re.paint_sky["sky-type"]),"sky-atmosphere-sun":new dt(Re.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new dt(Re.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new dt(Re.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new dt(Re.paint_sky["sky-gradient-radius"]),"sky-gradient":new ja(Re.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new dt(Re.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new dt(Re.paint_sky["sky-atmosphere-color"]),"sky-opacity":new dt(Re.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="sky-gradient"?this._updateColorRamp():r!=="sky-atmosphere-sun"&&r!=="sky-atmosphere-halo-color"&&r!=="sky-atmosphere-color"&&r!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Ap({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(r){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=r.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(r,e){if(this.paint.get("sky-type")==="atmosphere"){const s=this.paint.get("sky-atmosphere-sun"),a=!s,u=r.style.light,h=u.properties.get("position");return a&&u.properties.get("anchor")==="viewport"&&yi("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?W0(h.azimuthal,90-h.polar,e):W0(s[0],90-s[1],e)}const i=this.paint.get("sky-gradient-center");return W0(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(r){this._skyboxInvalidated=!1,this._lightPosition=r.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const r=this.paint.get("sky-type");return r==="atmosphere"?["skyboxCapture","skybox"]:r==="gradient"?["skyboxGradient"]:null}},slot:class extends $n{constructor(r,e,i,s){super(r,{paint:LT||(LT=new Nr({}))},e,null)}},model:class extends $n{constructor(r,e,i,s){super(r,{layout:GT||(GT=new Nr({visibility:new dt(Re.layout_model.visibility),"model-id":new wt(Re.layout_model["model-id"])})),paint:HT||(HT=new Nr({"model-opacity":new wt(Re.paint_model["model-opacity"]),"model-rotation":new wt(Re.paint_model["model-rotation"]),"model-scale":new wt(Re.paint_model["model-scale"]),"model-translation":new wt(Re.paint_model["model-translation"]),"model-color":new wt(Re.paint_model["model-color"]),"model-color-mix-intensity":new wt(Re.paint_model["model-color-mix-intensity"]),"model-type":new dt(Re.paint_model["model-type"]),"model-cast-shadows":new dt(Re.paint_model["model-cast-shadows"]),"model-receive-shadows":new dt(Re.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new dt(Re.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new wt(Re.paint_model["model-emissive-strength"]),"model-roughness":new wt(Re.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new wt(Re.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new dt(Re.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new dt(Re.paint_model["model-front-cutoff"]),"model-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new J0(r)}getProgramIds(){return["model"]}is3D(r){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(r){return r instanceof k_?_t-1:0}queryIntersectsFeature(r,e,i,s,a,u){if(!this.modelManager)return!1;const h=this.modelManager,m=r.tile.getBucket(this);if(!(m&&m instanceof J0))return!1;for(const g in m.instancesPerModel){const v=m.instancesPerModel[g],w=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(v.idToFeaturesIndex.hasOwnProperty(w)){const S=v.features[v.idToFeaturesIndex[w]],A=h.getModel(g,this.scope);if(!A)return!1;let D=Pe();const R=new V(0,0),O=m.canonical;let $=Number.MAX_VALUE;for(let H=0;H<S.instancedDataCount;++H){const K=16*(S.instancedDataOffset+H),W=v.instancedDataArray.float32,F=[W[K+4],W[K+5],W[K+6]];KT(O,R,W[K],0|W[K+1]),qT(D,A,u,R,S.rotation,S.scale,F,!1,!1,!1),u.projection.name==="globe"&&(D=Y0(D,u));const q=Se([],u.projMatrix,D),Y=r.queryGeometry,ee=jT(Y.isPointQuery()?Y.screenBounds:Y.screenGeometry,u,q,A.aabb);ee!=null&&($=Math.min(ee,$))}return $!==Number.MAX_VALUE&&$}}return!1}_handleOverridablePaintPropertyUpdate(r,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||r!=="model-color"&&r!=="model-color-mix-intensity"&&r!=="model-rotation"&&r!=="model-scale"&&r!=="model-translation"&&r!=="model-emissive-strength")}_isPropertyZoomDependent(r){const e=this._transitionablePaint._values[r];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof Il}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends $n{constructor(r,e,i,s){super(r,{layout:Gw||(Gw=new Nr({"clip-layer-types":new dt(Re.layout_clip["clip-layer-types"]),"clip-layer-scope":new dt(Re.layout_clip["clip-layer-scope"])})),paint:Hw||(Hw=new Nr({}))},e,i,s)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new qw(r)}is3D(r){return!0}}};class P3{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class D3{constructor(){this.tasks={},this.taskQueue=[],Qt(["process"],this),this.invoker=new P3(this.process),this.nextId=0}add(e,i){const s=this.nextId++,a=function({type:u,isSymbolTile:h,zoom:m}){return m=m||0,u==="message"?0:u!=="maybePrepare"||h?u!=="parseTile"||h?u==="parseTile"&&h?300-m:u==="maybePrepare"&&h?400-m:500:200-m:100-m}(i);if(a===0){try{e()}finally{}return null}return this.tasks[s]={fn:e,metadata:i,priority:a,id:s},this.taskQueue.push(s),this.invoker.trigger(),{cancel:()=>{delete this.tasks[s]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(s=>!!this.tasks[s]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let a=0;a<this.taskQueue.length;a++){const u=this.tasks[this.taskQueue[a]];u.priority<i&&(i=u.priority,e=a)}if(e===null)return null;const s=this.taskQueue[e];return this.taskQueue.splice(e,1),s}remove(){this.invoker.remove()}}class JT{constructor(e,i,s){this.target=e,this.parent=i,this.mapId=s,this.callbacks={},this.cancelCallbacks={},Qt(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new D3}send(e,i,s,a,u=!1,h){const m=Math.round(1e18*Math.random()).toString(36).substring(0,10);s&&(s.metadata=h,this.callbacks[m]=s);const g=new Set;return this.target.postMessage({id:m,type:e,hasCallback:!!s,targetMapId:a,mustQueue:u,sourceMapId:this.mapId,data:Xs(i,g)},g),{cancel:()=>{s&&delete this.callbacks[m],this.target.postMessage({id:m,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const s=i.id;if(s&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[s];delete this.cancelCallbacks[s],a&&a.cancel()}else if(i.mustQueue||lr(self)){const a=this.callbacks[s],u=this.scheduler.add(()=>this.processTask(s,i),a&&a.metadata||{type:"message"});u&&(this.cancelCallbacks[s]=u)}else this.processTask(s,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const s=this.callbacks[e];delete this.callbacks[e],s&&(i.error?s(Ys(i.error)):s(null,Ys(i.data)))}else{const s=new Set,a=i.hasCallback?(h,m)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:h?Xs(h):null,data:Xs(m,s)},s)}:()=>{},u=Ys(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,u,a);else if(this.parent.getWorkerSource){const h=i.type.split("."),{source:m,scope:g}=u;this.parent.getWorkerSource(i.sourceMapId,h[0],m,g)[h[1]](u,a)}else a(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Yp={workerUrl:"",workerClass:null,workerParams:void 0};const iv="mapboxgl_preloaded_worker_pool";class nu{constructor(){this.active={}}acquire(e,i=nu.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;)this.workers.push(Yp.workerClass!=null?new Yp.workerClass:new self.Worker(Yp.workerUrl,Yp.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[iv]}numActive(){return Object.keys(this.active).length}}nu.workerCount=2;class Uh{constructor(e,i,s="Worker",a=nu.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=bt();const u=this.workerPool.acquire(this.id,a);for(let h=0;h<u.length;h++){const m=new Uh.Actor(u[h],i,this.id);m.name=`${s} ${h}`,this.actors.push(m)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,s){qe(this.actors,(a,u)=>{a.send(e,i,u)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let Kp,rv;function O_(){return Kp||(Kp=new nu),Kp}Uh.Actor=JT;const nv=new Fi(0,0,0),ov={PATH_RULE_UNSPECIFIED:0,PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},sv={LINE_CAP_UNSPECIFIED:0,LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},F_={LINE_JOIN_UNSPECIFIED:0,LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},R3={PAINT_ORDER_UNSPECIFIED:0,PAINT_ORDER_FILL_AND_STROKE:1,PAINT_ORDER_STROKE_AND_FILL:2},Jp={PATH_COMMAND_UNSPECIFIED:0,PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},QT={MASK_TYPE_UNSPECIFIED:0,MASK_TYPE_LUMINANCE:1,MASK_TYPE_ALPHA:2};function z3(r,e,i){r===1&&e.icons.push(function(s,a){return function(u){if(u.usvg_tree.height||(u.usvg_tree.height=u.usvg_tree.width),!u.metadata)return u;const{metadata:h}=u;if(h.content_area){const{content_area:m}=h;m.top==null&&(m.top=m.left),m.width==null&&(m.width=u.usvg_tree.width),m.height==null&&(m.height=m.width)}return h.stretch_x&&h.stretch_x.length&&eS(h,"x"),h.stretch_y&&h.stretch_y.length&&eS(h,"y"),u}(s.readFields(L3,{name:void 0},a))}(i,i.readVarint()+i.pos))}function eS(r,e){const i=[],s=r[`stretch_${e}`];let a=null;for(let u=0;u<s.length;u++)a===null?a=i.length===0?s[0]:i[i.length-1][1]+s[u]:(i.push([a,a+s[u]]),a=null);r[`stretch_${e}_areas`]=i}function L3(r,e,i){r===1?e.name=i.readString():r===2?e.metadata=function(s,a){return s.readFields(k3,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},a)}(i,i.readVarint()+i.pos):r===3&&(e.usvg_tree=function(s,a){return s.readFields(B3,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},a)}(i,i.readVarint()+i.pos),e.data="usvg_tree")}function k3(r,e,i){r===1?e.stretch_x=i.readPackedVarint():r===2?e.stretch_y=i.readPackedVarint():r===3?e.content_area=function(s,a){return s.readFields(O3,{left:0},a)}(i,i.readVarint()+i.pos):r===4&&e.variables.push(function(s,a){return s.readFields(F3,{name:void 0},a)}(i,i.readVarint()+i.pos))}function O3(r,e,i){r===1?e.left=i.readVarint():r===2?e.width=i.readVarint():r===3?e.top=i.readVarint():r===4&&(e.height=i.readVarint())}function F3(r,e,i){r===1?e.name=i.readString():r===2&&(e.rgb_color=j_(i.readVarint()),e.value="rgb_color")}function B3(r,e,i){r===1?e.width=e.height=i.readVarint():r===2?e.height=i.readVarint():r===3?e.children.push(B_(i,i.readVarint()+i.pos)):r===4?e.linear_gradients.push(function(s,a){return s.readFields(H3,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},a)}(i,i.readVarint()+i.pos)):r===5?e.radial_gradients.push(function(s,a){return s.readFields(Z3,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},a)}(i,i.readVarint()+i.pos)):r===7?e.clip_paths.push(function(s,a){return s.readFields(W3,{children:[]},a)}(i,i.readVarint()+i.pos)):r===8&&e.masks.push(function(s,a){const u=s.readFields(X3,{left:0,width:20,mask_type:QT.MASK_TYPE_LUMINANCE,children:[]},a);return u.height==null&&(u.height=u.width),u.top==null&&(u.top=u.left),u}(i,i.readVarint()+i.pos))}function B_(r,e){return r.readFields(N3,{},e)}function N3(r,e,i){r===1?(e.group=function(s,a){return s.readFields(j3,{opacity:255,children:[]},a)}(i,i.readVarint()+i.pos),e.node="group"):r===2&&(e.path=function(s,a){return s.readFields(U3,{paint_order:1,commands:[],step:1,diffs:[],rule:ov.PATH_RULE_NON_ZERO},a)}(i,i.readVarint()+i.pos),e.node="path")}function j3(r,e,i){r===1?e.transform=N_(i,i.readVarint()+i.pos):r===2?e.opacity=i.readVarint():r===5?e.clip_path_idx=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(B_(i,i.readVarint()+i.pos))}function N_(r,e){return r.readFields(V3,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function V3(r,e,i){r===1?e.sx=i.readFloat():r===2?e.ky=i.readFloat():r===3?e.kx=i.readFloat():r===4?e.sy=i.readFloat():r===5?e.tx=i.readFloat():r===6&&(e.ty=i.readFloat())}function U3(r,e,i){r===1?e.fill=function(s,a){return s.readFields($3,{rgb_color:nv,paint:"rgb_color",opacity:255},a)}(i,i.readVarint()+i.pos):r===2?e.stroke=function(s,a){return s.readFields(G3,{rgb_color:nv,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},a)}(i,i.readVarint()+i.pos):r===3?e.paint_order=i.readVarint():r===5?i.readPackedVarint(e.commands):r===6?e.step=i.readFloat():r===7?i.readPackedSVarint(e.diffs):r===8&&(e.rule=i.readVarint())}function $3(r,e,i){r===1?(e.rgb_color=j_(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5&&(e.opacity=i.readVarint())}function j_(r){return new Fi((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function G3(r,e,i){r===1?(e.rgb_color=j_(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5?i.readPackedFloat(e.dasharray):r===6?e.dashoffset=i.readFloat():r===7?e.miterlimit=i.readFloat():r===8?e.opacity=i.readVarint():r===9?e.width=i.readFloat():r===10?e.linecap=i.readVarint():r===11&&(e.linejoin=i.readVarint())}function H3(r,e,i){r===1?e.transform=N_(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(tS(i,i.readVarint()+i.pos)):r===4?e.x1=i.readFloat():r===5?e.y1=i.readFloat():r===6?e.x2=i.readFloat():r===7&&(e.y2=i.readFloat())}function tS(r,e){return r.readFields(q3,{offset:0,opacity:255,rgb_color:nv},e)}function q3(r,e,i){r===1?e.offset=i.readFloat():r===2?e.opacity=i.readVarint():r===3&&(e.rgb_color=j_(i.readVarint()))}function Z3(r,e,i){r===1?e.transform=N_(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(tS(i,i.readVarint()+i.pos)):r===4?e.cx=i.readFloat():r===5?e.cy=i.readFloat():r===6?e.r=i.readFloat():r===7?e.fx=i.readFloat():r===8?e.fy=i.readFloat():r===9&&(e.fr=i.readFloat())}function W3(r,e,i){r===1?e.transform=N_(i,i.readVarint()+i.pos):r===2?e.clip_path_idx=i.readVarint():r===3&&e.children.push(B_(i,i.readVarint()+i.pos))}function X3(r,e,i){r===1?e.left=e.top=i.readFloat():r===2?e.width=e.height=i.readFloat():r===3?e.top=i.readFloat():r===4?e.height=i.readFloat():r===5?e.mask_type=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(B_(i,i.readVarint()+i.pos))}class Y3{static calculate(e={},i=[]){const s=new Map,a=new Map;if(Object.keys(e).length===0)return s;i.forEach(u=>{a.set(u.name,u.rgb_color||new Fi(0,0,0))});for(const[u,h]of Object.entries(e))a.has(u)?s.set(a.get(u).toStringPremultipliedAlpha(),h):console.warn(`Ignoring unknown image variable "${u}"`);return s}}function $h(r,e=255,i){const s=e/255,a=r.toStringPremultipliedAlpha(),u=i.has(a)?i.get(a).clone():r.clone();return u.a*=s,u.toString()}function Qp(r,e){if(!gd()){const i=document.createElement("canvas");return i.width=r,i.height=e,i}return new OffscreenCanvas(r,e)}function K3(r,e){const i=Y3.calculate(e.params,r.metadata?r.metadata.variables:[]),s=r.usvg_tree,a=s.width,u=s.height,h=e.transform?e.transform:new DOMMatrix,m=Math.max(1,Math.round(a*h.a)),g=Math.max(1,Math.round(u*h.d)),v=new DOMMatrix([m/a,0,0,g/u,0,0]),w=Qp(m,g).getContext("2d");return av(w,v,s,s,i),w.getImageData(0,0,m,g)}function av(r,e,i,s,a){for(const u of s.children)iS(r,e,i,u,a)}function iS(r,e,i,s,a){s.group?(r.save(),function(u,h,m,g,v){const w=g.mask_idx!=null?m.masks[g.mask_idx]:null,S=g.clip_path_idx!=null?m.clip_paths[g.clip_path_idx]:null;if(g.transform&&(h=V_(g.transform).preMultiplySelf(h)),!function(R,O,$){return R.opacity!==255||O||$}(g,S!=null,w!=null))return void av(u,h,m,g,v);const A=Qp(u.canvas.width,u.canvas.height),D=A.getContext("2d");av(D,h,m,g,v),S&&cS(D,h,m,S),w&&uS(D,h,m,w,v),u.globalAlpha=g.opacity/255,u.drawImage(A,0,0)}(r,e,i,s.group,a),r.restore()):s.path&&(r.save(),function(u,h,m,g,v){const w=hS(g);u.setTransform(h),g.paint_order===R3.PAINT_ORDER_FILL_AND_STROKE?(rS(u,m,g,w,v),oS(u,m,g,w,v)):(oS(u,m,g,w,v),rS(u,m,g,w,v))}(r,e,i,s.path,a),r.restore())}function rS(r,e,i,s,a){const u=i.fill;if(!u)return;const h=u.opacity/255;switch(u.paint){case"rgb_color":r.fillStyle=$h(u.rgb_color,u.opacity,a);break;case"linear_gradient_idx":r.fillStyle=sS(r,e.linear_gradients[u.linear_gradient_idx],h,a);break;case"radial_gradient_idx":r.fillStyle=aS(r,e.radial_gradients[u.radial_gradient_idx],h,a)}r.fill(s,nS(i))}function nS(r){return r.rule===ov.PATH_RULE_NON_ZERO?"nonzero":r.rule===ov.PATH_RULE_EVEN_ODD?"evenodd":void 0}function oS(r,e,i,s,a){const u=i.stroke;if(!u)return;r.lineWidth=u.width,r.miterLimit=u.miterlimit,r.setLineDash(u.dasharray),r.lineDashOffset=u.dashoffset;const h=u.opacity/255;switch(u.paint){case"rgb_color":r.strokeStyle=$h(u.rgb_color,u.opacity,a);break;case"linear_gradient_idx":r.strokeStyle=sS(r,e.linear_gradients[u.linear_gradient_idx],h,a);break;case"radial_gradient_idx":r.strokeStyle=aS(r,e.radial_gradients[u.radial_gradient_idx],h,a)}switch(u.linejoin){case F_.LINE_JOIN_MITER_CLIP:case F_.LINE_JOIN_MITER:r.lineJoin="miter";break;case F_.LINE_JOIN_ROUND:r.lineJoin="round";break;case F_.LINE_JOIN_BEVEL:r.lineJoin="bevel"}switch(u.linecap){case sv.LINE_CAP_BUTT:r.lineCap="butt";break;case sv.LINE_CAP_ROUND:r.lineCap="round";break;case sv.LINE_CAP_SQUARE:r.lineCap="square"}r.stroke(s)}function sS(r,e,i,s){if(e.stops.length===1){const A=e.stops[0];return $h(A.rgb_color,A.opacity*i,s)}const a=V_(e.transform),{x1:u,y1:h,x2:m,y2:g}=e,v=a.transformPoint(new DOMPoint(u,h)),w=a.transformPoint(new DOMPoint(m,g)),S=r.createLinearGradient(v.x,v.y,w.x,w.y);for(const A of e.stops)S.addColorStop(A.offset,$h(A.rgb_color,A.opacity*i,s));return S}function aS(r,e,i,s){if(e.stops.length===1){const A=e.stops[0];return $h(A.rgb_color,A.opacity*i,s)}const a=V_(e.transform),{fx:u,fy:h,cx:m,cy:g}=e,v=a.transformPoint(new DOMPoint(u,h)),w=a.transformPoint(new DOMPoint(m,g)),S=r.createRadialGradient(v.x,v.y,0,w.x,w.y,e.r*((a.a+a.d)/2));for(const A of e.stops)S.addColorStop(A.offset,$h(A.rgb_color,A.opacity*i,s));return S}function lS(r,e,i,s){const a=s.transform?V_(s.transform).preMultiplySelf(e):e,u=Qp(r.canvas.width,r.canvas.height),h=u.getContext("2d");for(const g of s.children)if(g.group)lS(h,a,i,g.group);else if(g.path){const v=g.path,w=new Path2D;w.addPath(hS(v),a),h.fill(w,nS(v))}const m=s.clip_path_idx!=null?i.clip_paths[s.clip_path_idx]:null;m&&cS(h,a,i,m),r.globalCompositeOperation="source-over",r.drawImage(u,0,0)}function cS(r,e,i,s){const a=Qp(r.canvas.width,r.canvas.height);lS(a.getContext("2d"),e,i,s),r.globalCompositeOperation="destination-in",r.drawImage(a,0,0)}function uS(r,e,i,s,a){if(s.children.length===0)return;const u=s.mask_idx!=null?i.masks[s.mask_idx]:null;u&&uS(r,e,i,u,a);const h=r.canvas.width,m=r.canvas.height,g=Qp(h,m),v=g.getContext("2d"),w=s.width,S=s.height,A=s.left,D=s.top,R=new Path2D,O=new Path2D;O.rect(A,D,w,S),R.addPath(O,e),v.clip(R);for(const K of s.children)iS(v,e,i,K,a);const $=v.getImageData(0,0,h,m),H=$.data;if(s.mask_type===QT.MASK_TYPE_LUMINANCE)for(let K=0;K<H.length;K+=4)H[K+3]=H[K+3]/255*(.2126*H[K]+.7152*H[K+1]+.0722*H[K+2]);v.putImageData($,0,0),r.globalCompositeOperation="destination-in",r.drawImage(g,0,0)}function V_(r){return r?new DOMMatrix([r.sx,r.ky,r.kx,r.sy,r.tx,r.ty]):new DOMMatrix}function hS(r){const e=new Path2D,i=r.step;let s=r.diffs[0]*i,a=r.diffs[1]*i;e.moveTo(s,a);for(let u=0,h=2;u<r.commands.length;u++)switch(r.commands[u]){case Jp.PATH_COMMAND_MOVE:s+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.moveTo(s,a);break;case Jp.PATH_COMMAND_LINE:s+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.lineTo(s,a);break;case Jp.PATH_COMMAND_QUAD:{const m=s+r.diffs[h++]*i,g=a+r.diffs[h++]*i;s=m+r.diffs[h++]*i,a=g+r.diffs[h++]*i,e.quadraticCurveTo(m,g,s,a);break}case Jp.PATH_COMMAND_CUBIC:{const m=s+r.diffs[h++]*i,g=a+r.diffs[h++]*i,v=m+r.diffs[h++]*i,w=g+r.diffs[h++]*i;s=v+r.diffs[h++]*i,a=w+r.diffs[h++]*i,e.bezierCurveTo(m,g,v,w,s,a);break}case Jp.PATH_COMMAND_CLOSE:e.closePath()}return e}class U_{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}delete(e){this.cache.delete(e)}}Tt(U_,"LRUCache");class lv{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new In(e,e.data)}getFromCache(e,i,s){return this.cacheMap.has(s)||this.cacheMap.set(s,new U_(150)),this.cacheMap.get(s).get(Va(e.toString(),i))}setInCache(e,i,s,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new U_(150));const u=this.cacheDependenciesMap.get(a),h=Va(e.id.toString(),s);u.get(h)||u.set(h,new Set);const m=this.cacheMap.get(a),g=e.toString();u.get(h).add(g),m.put(Va(e.toString(),s),i)}removeImagesFromCacheByIds(e,i,s=0){if(!this.cacheMap.has(s)||!this.cacheDependenciesMap.has(s))return;const a=this.cacheMap.get(s),u=this.cacheDependenciesMap.get(s);for(const h of e){const m=Va(h.toString(),i);if(u.has(m)){for(const g of u.get(m))a.delete(g);u.delete(m)}}}rasterize(e,i,s,a,u=K3){const h=this.getFromCache(e,s,a);if(h)return h.clone();const m=u(i.icon,e.options),g=lv._getImage(m);return this.setInCache(e,g,s,a),g.clone()}}class dS{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const s=this.toIdx(e,i);return{min:this.minimums[s],max:this.maximums[s]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function pS(r,e,i,s){let a=0,u=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(s[h])<1e-15){if(i[h]<r[h]||i[h]>e[h])return null}else{const m=1/s[h];let g=(r[h]-i[h])*m,v=(e[h]-i[h])*m;if(g>v){const w=g;g=v,v=w}if(g>a&&(a=g),v<u&&(u=v),a>u)return null}return a}function fS(r,e,i,s,a,u,h,m,g,v,w){const S=s-r,A=a-e,D=u-i,R=h-r,O=m-e,$=g-i,H=w[1]*$-w[2]*O,K=w[2]*R-w[0]*$,W=w[0]*O-w[1]*R,F=S*H+A*K+D*W;if(Math.abs(F)<1e-15)return null;const q=1/F,Y=v[0]-r,ee=v[1]-e,he=v[2]-i,ye=(Y*H+ee*K+he*W)*q;if(ye<0||ye>1)return null;const ve=ee*D-he*A,Ce=he*S-Y*D,Ue=Y*A-ee*S,et=(w[0]*ve+w[1]*Ce+w[2]*Ue)*q;return et<0||ye+et>1?null:(R*ve+O*Ce+$*Ue)*q}function mS(r,e,i){return(r-e)/(i-e)}function _S(r,e,i,s,a,u,h,m,g){const v=1<<i,w=u-s,S=h-a,A=(r+1)/v*w+s,D=(e+0)/v*S+a,R=(e+1)/v*S+a;m[0]=(r+0)/v*w+s,m[1]=D,g[0]=A,g[1]=R}class gS{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(u){const h=Math.ceil(Math.log2(u.dim/8)),m=[];let g=Math.ceil(Math.pow(2,h));const v=1/g,w=(D,R,O,$,H)=>{const K=$?1:0,W=(D+1)*O-K,F=R*O,q=(R+1)*O-K;H[0]=D*O,H[1]=F,H[2]=W,H[3]=q};let S=new dS(g);const A=[];for(let D=0;D<g*g;D++){w(D%g,Math.floor(D/g),v,!1,A);const R=Xl(A[0],A[1],u),O=Xl(A[2],A[1],u),$=Xl(A[2],A[3],u),H=Xl(A[0],A[3],u);S.minimums.push(Math.min(R,O,$,H)),S.maximums.push(Math.max(R,O,$,H)),S.leaves.push(1)}for(m.push(S),g/=2;g>=1;g/=2){const D=m[m.length-1];S=new dS(g);for(let R=0;R<g*g;R++){w(R%g,Math.floor(R/g),2,!0,A);const O=D.getElevation(A[0],A[1]),$=D.getElevation(A[2],A[1]),H=D.getElevation(A[2],A[3]),K=D.getElevation(A[0],A[3]),W=D.isLeaf(A[0],A[1]),F=D.isLeaf(A[2],A[1]),q=D.isLeaf(A[2],A[3]),Y=D.isLeaf(A[0],A[3]),ee=Math.min(O.min,$.min,H.min,K.min),he=Math.max(O.max,$.max,H.max,K.max),ye=W&&F&&q&&Y;S.maximums.push(he),S.minimums.push(ee),S.leaves.push(he-ee<=5&&ye?1:0)}m.push(S)}return m}(this.dem),s=i.length-1,a=i[s];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,s,0)}raycastRoot(e,i,s,a,u,h,m=1){return pS([e,i,-100],[s,a,this.maximums[0]*m],u,h)}raycast(e,i,s,a,u,h,m=1){if(!this.nodeCount)return null;const g=this.raycastRoot(e,i,s,a,u,h,m);if(g==null)return null;const v=[],w=[],S=[],A=[],D=[{idx:0,t:g,nodex:0,nodey:0,depth:0}];for(;D.length>0;){const{idx:R,t:O,nodex:$,nodey:H,depth:K}=D.pop();if(this.leaves[R]){_S($,H,K,e,i,s,a,S,A);const F=1<<K,q=($+0)/F,Y=($+1)/F,ee=(H+0)/F,he=(H+1)/F,ye=Xl(q,ee,this.dem)*m,ve=Xl(Y,ee,this.dem)*m,Ce=Xl(Y,he,this.dem)*m,Ue=Xl(q,he,this.dem)*m,et=fS(S[0],S[1],ye,A[0],S[1],ve,A[0],A[1],Ce,u,h),Ye=fS(A[0],A[1],Ce,S[0],A[1],Ue,S[0],S[1],ye,u,h),Qe=Math.min(et!==null?et:Number.MAX_VALUE,Ye!==null?Ye:Number.MAX_VALUE);if(Qe!==Number.MAX_VALUE)return Qe;{const ot=$r([],u,h,O);if(yS(ye,ve,Ue,Ce,mS(ot[0],S[0],A[0]),mS(ot[1],S[1],A[1]))>=ot[2])return O}continue}let W=0;for(let F=0;F<this._siblingOffset.length;F++){_S(($<<1)+this._siblingOffset[F][0],(H<<1)+this._siblingOffset[F][1],K+1,e,i,s,a,S,A),S[2]=-100,A[2]=this.maximums[this.childOffsets[R]+F]*m;const q=pS(S,A,u,h);if(q!=null){const Y=q;v[F]=Y;let ee=!1;for(let he=0;he<W&&!ee;he++)Y>=v[w[he]]&&(w.splice(he,0,F),ee=!0);ee||(w[W]=F),W++}}for(let F=0;F<W;F++){const q=w[F];D.push({idx:this.childOffsets[R]+q,t:v[q],nodex:($<<1)+this._siblingOffset[q][0],nodey:(H<<1)+this._siblingOffset[q][1],depth:K+1})}}return null}_addNode(e,i,s){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(s),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,s,a,u){if(e[a].isLeaf(i,s)===1)return;this.childOffsets[u]||(this.childOffsets[u]=this.nodeCount);const h=a-1,m=e[h];let g=0,v=0;for(let w=0;w<this._siblingOffset.length;w++){const S=2*i+this._siblingOffset[w][0],A=2*s+this._siblingOffset[w][1],D=m.getElevation(S,A),R=m.isLeaf(S,A),O=this._addNode(D.min,D.max,R);R&&(g|=1<<w),v||(v=O)}for(let w=0;w<this._siblingOffset.length;w++)g&1<<w||this._construct(e,2*i+this._siblingOffset[w][0],2*s+this._siblingOffset[w][1],h,v+w)}}function yS(r,e,i,s,a,u){return Nt(Nt(r,i,u),Nt(e,s,u),a)}function Xl(r,e,i){const s=i.dim,a=Te(r*s-.5,0,s-1),u=Te(e*s-.5,0,s-1),h=Math.floor(a),m=Math.floor(u),g=Math.min(h+1,s-1),v=Math.min(m+1,s-1);return yS(i.get(h,m),i.get(g,m),i.get(h,v),i.get(g,v),a-h,u-m)}const J3={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function Q3(r,e,i){return(256*r*256+256*e+i)/10-1e4}function eO(r,e,i){return 256*r+e+i/256-32768}class $_{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,s,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&s!=="mapbox"&&s!=="terrarium")return void yi(`"${s}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const u=this.dim=i.height-2,h=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let g=0;g<u;g++)h[this._idx(-1,g)]=h[this._idx(0,g)],h[this._idx(u,g)]=h[this._idx(u-1,g)],h[this._idx(g,-1)]=h[this._idx(g,0)],h[this._idx(g,u)]=h[this._idx(g,u-1)];h[this._idx(-1,-1)]=h[this._idx(0,0)],h[this._idx(u,-1)]=h[this._idx(u-1,0)],h[this._idx(-1,u)]=h[this._idx(0,u-1)],h[this._idx(u,u)]=h[this._idx(u-1,u-1)]}const m=s==="terrarium"?eO:Q3;for(let g=0;g<h.length;++g){const v=4*g;this.floatView[g]=m(this.pixels[v],this.pixels[v+1],this.pixels[v+2])}this._timestamp=Io.now()}_buildQuadTree(){this._tree=new gS(this)}get(e,i,s=!1){s&&(e=Te(e,-1,this.dim),i=Te(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,s){const a=this._idx(e,i),u=this.floatView[a];return this.floatView[a]=s,s-u}static getUnpackVector(e){return J3[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const s=[0,0,0,0],a=$_.getUnpackVector(i);let u=Math.floor((e+a[3])/a[2]);return s[2]=u%256,u=Math.floor(u/256),s[1]=u%256,u=Math.floor(u/256),s[0]=u,s}getPixels(){return new vw({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,u=i*this.dim+this.dim,h=s*this.dim,m=s*this.dim+this.dim;switch(i){case-1:a=u-1;break;case 1:u=a+1}switch(s){case-1:h=m-1;break;case 1:m=h+1}const g=-i*this.dim,v=-s*this.dim;for(let w=h;w<m;w++)for(let S=a;S<u;S++){const A=4*this._idx(S,w),D=4*this._idx(S+g,w+v);this.pixels[A+0]=e.pixels[D+0],this.pixels[A+1]=e.pixels[D+1],this.pixels[A+2]=e.pixels[D+2],this.pixels[A+3]=e.pixels[D+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function tO(r,e,i){r===1?e.headerLength=i.readFixed32():r===2?e.x=i.readVarint():r===3?e.y=i.readVarint():r===4?e.z=i.readVarint():r===5&&e.layers.push(function(s,a){return s.readFields(sO,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)}(i,i.readVarint()+i.pos))}function iO(r,e,i){r===1?(e.delta_filter=function(s,a){return s.readFields(rO,{blockSize:0},a)}(i,i.readVarint()+i.pos),e.filter="delta_filter"):r===2?(i.readVarint(),e.filter="zigzag_filter"):r===3?(i.readVarint(),e.filter="bitshuffle_filter"):r===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function rO(r,e,i){r===1&&(e.blockSize=i.readVarint())}function nO(r,e,i){r===1?(i.readVarint(),e.codec="gzip_data"):r===2?(i.readVarint(),e.codec="jpeg_image"):r===3?(i.readVarint(),e.codec="webp_image"):r===4&&(i.readVarint(),e.codec="png_image")}function oO(r,e,i){let s=0,a=0;r===1?e.firstByte=i.readFixed64():r===2?e.lastByte=i.readFixed64():r===3?e.filters.push(function(u,h){return u.readFields(iO,{},h)}(i,i.readVarint()+i.pos)):r===4?e.codec=function(u,h){return u.readFields(nO,{},h)}(i,i.readVarint()+i.pos):r===5?a=i.readFloat():r===6?s=i.readFloat():r===7?e.bands.push(i.readString()):r===8?e.offset=i.readDouble():r===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=a),e.scale===0&&(e.scale=s)}function sO(r,e,i){r===1?e.version=i.readVarint():r===2?e.name=i.readString():r===3?e.units=i.readString():r===4?e.tileSize=i.readVarint():r===5?e.buffer=i.readVarint():r===6?e.pixelFormat=i.readVarint():r===7&&e.dataIndex.push(function(s,a){return s.readFields(oO,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)}(i,i.readVarint()+i.pos))}function aO(r,e,i){if(r===2)(function(s,a,u){s.readFields(lO,u,a)})(i,i.readVarint()+i.pos,e);else if(r===3)throw new Error("Not implemented")}function lO(r,e,i){if(r===1){let s=0;const a=i.readVarint()+i.pos;for(;i.pos<a;)e[s++]=i.readVarint()}}function cO(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let s=2;s>=1;s--){const a=s===1?1:0,u=s===2?1:0;for(let h=0;h<e[0];h++){const m=e[1]*h;for(let g=a;g<e[1];g++){const v=e[2]*(g+m);for(let w=u;w<e[2];w++){const S=e[3]*(w+v);for(let A=0;A<e[3];A++){const D=S+A;r[D]+=r[D-i]}}}}i*=e[s]}return r}function uO(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function hO(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const s=r[i],a=r[i+1];r[i]=(240&s)>>4|(61440&s)>>8|(240&a)<<4|61440&a,r[i+1]=15&s|(3840&s)>>4|(15&a)<<8|(3840&a)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const s=r[i],a=r[i+1],u=r[i+2],h=r[i+3];r[i+0]=(192&s)>>6|(192&a)>>4|(192&u)>>2|192&h,r[i+1]=(48&s)>>4|(48&a)>>2|48&u|(48&h)<<2,r[i+2]=(12&s)>>2|12&a|(12&u)<<2|(12&h)<<4,r[i+3]=3&s|(3&a)<<2|(3&u)<<4|(3&h)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}Tt($_,"DEMData"),Tt(gS,"DemMinMaxQuadTree",{omit:["dem"]});var Bo=Uint8Array,ef=Uint16Array,dO=Int32Array,vS=new Bo([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),xS=new Bo([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pO=new Bo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bS=function(r,e){for(var i=new ef(31),s=0;s<31;++s)i[s]=e+=1<<r[s-1];var a=new dO(i[30]);for(s=1;s<30;++s)for(var u=i[s];u<i[s+1];++u)a[u]=u-i[s]<<5|s;return{b:i,r:a}},wS=bS(vS,2),TS=wS.b,fO=wS.r;TS[28]=258,fO[258]=28;for(var mO=bS(xS,0).b,SS=new ef(32768),cn=0;cn<32768;++cn){var Gh=(43690&cn)>>1|(21845&cn)<<1;SS[cn]=((65280&(Gh=(61680&(Gh=(52428&Gh)>>2|(13107&Gh)<<2))>>4|(3855&Gh)<<4))>>8|(255&Gh)<<8)>>1}var tf=function(r,e,i){for(var s=r.length,a=0,u=new ef(e);a<s;++a)r[a]&&++u[r[a]-1];var h,m=new ef(e);for(a=1;a<e;++a)m[a]=m[a-1]+u[a-1]<<1;h=new ef(1<<e);var g=15-e;for(a=0;a<s;++a)if(r[a])for(var v=a<<4|r[a],w=e-r[a],S=m[r[a]-1]++<<w,A=S|(1<<w)-1;S<=A;++S)h[SS[S]>>g]=v;return h},rf=new Bo(288);for(cn=0;cn<144;++cn)rf[cn]=8;for(cn=144;cn<256;++cn)rf[cn]=9;for(cn=256;cn<280;++cn)rf[cn]=7;for(cn=280;cn<288;++cn)rf[cn]=8;var ES=new Bo(32);for(cn=0;cn<32;++cn)ES[cn]=5;var _O=tf(rf,9),gO=tf(ES,5),cv=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},Es=function(r,e,i){var s=e/8|0;return(r[s]|r[s+1]<<8)>>(7&e)&i},uv=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)},yO=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],As=function(r,e,i){var s=new Error(e||yO[r]);if(s.code=r,Error.captureStackTrace&&Error.captureStackTrace(s,As),!i)throw s;return s},vO=new Bo(0),xO=typeof TextDecoder<"u"&&new TextDecoder;try{xO.decode(vO,{stream:!0})}catch{}const bO={gzip_data:"gzip"};class ts extends Error{constructor(e){super(e),this.name="MRTError"}}const wO={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},AS={uint32:1,uint16:2,uint8:4},TO={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let hv;class G_{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new ts(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),s=new DataView(e);if(i[0]!==13)throw new ts("File is not a valid MRT.");return s.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),s=this.getHeaderLength(e);if(i.length<s)throw new ts(`Expected header with length >= ${s} but got buffer of length ${i.length}`);const a=function(u,h){return u.readFields(tO,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0)}(new hv(i.subarray(0,s)));if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new ts(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=a.x,this.y=a.y,this.z=a.z;for(const u of a.layers)this.layers[u.name]=new IS(u,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],s=this.getLayer(e.layerName);for(let a of e.blockIndices){const u=s.dataIndex[a],h=u.firstByte-e.firstByte,m=u.lastByte-e.firstByte;if(s._blocksInProgress.has(a))continue;const g={layerName:s.name,firstByte:h,lastByte:m,pixelFormat:s.pixelFormat,blockIndex:a,blockShape:[u.bands.length].concat(s.bandShape),buffer:s.buffer,codec:u.codec.codec,filters:u.filters.map(v=>v.filter)};s._blocksInProgress.add(a),i.push(g)}return new CS(i,()=>{i.forEach(a=>s._blocksInProgress.delete(a.blockIndex))},(a,u)=>{if(i.forEach(h=>s._blocksInProgress.delete(h.blockIndex)),a)throw a;u.forEach(h=>{this.getLayer(h.layerName).processDecodedData(h)})})}}class IS{constructor({version:e,name:i,units:s,tileSize:a,pixelFormat:u,buffer:h,dataIndex:m},g){if(this.version=e,this.version!==1)throw new ts(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=s,this.tileSize=a,this.buffer=h,this.pixelFormat=wO[u],this.dataIndex=m,this.bandShape=[a+2*h,a+2*h,AS[this.pixelFormat]],this._decodedBlocks=new U_(g?g.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return AS[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[s,a]of this.dataIndex.entries()){for(const[u,h]of a.bands.entries())if(h===e)return{bandIndex:i+u,blockIndex:s,blockBandIndex:u};i+=a.bands.length}break;case"number":for(const[s,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:s,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new ts(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,s=-1/0;const a=[],u=new Set;for(const h of e){const{blockIndex:m}=this.getBlockForBand(h);if(m<0)throw new ts(`Invalid band: ${JSON.stringify(h)}`);const g=this.dataIndex[m];a.includes(m)||a.push(m),u.add(m),i=Math.min(i,g.firstByte),s=Math.max(s,g.lastByte)}if(u.size>this.cacheSize)throw new ts(`Number of blocks to decode (${u.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:s,blockIndices:a}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:s}=this.getBlockForBand(e);if(i<0)throw new ts(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new ts(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const u=this.dataIndex[i],h=this.bandShape.reduce((v,w)=>v*w,1),m=s*h,g=a.subarray(m,m+h);return{data:g,bytes:new Uint8Array(g.buffer).subarray(g.byteOffset,g.byteOffset+g.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:u.offset,scale:u.scale}}}G_.setPbf=function(r){hv=r};class CS{constructor(e,i,s){this.tasks=e,this._onCancel=i,this._onComplete=s,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}G_.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map(s=>{const{layerName:a,firstByte:u,lastByte:h,pixelFormat:m,blockShape:g,blockIndex:v,filters:w,codec:S}=s,A=i.subarray(u,h+1),D=new Uint32Array(g[0]*g[1]*g[2]);let R;if(S!=="gzip_data")throw new ts(`Unhandled codec: ${S}`);return R=function(O,$){if(!globalThis.DecompressionStream&&$==="gzip_data")return Promise.resolve(((F=function(ee){ee[0]==31&&ee[1]==139&&ee[2]==8||As(6,"invalid gzip data");var he=ee[3],ye=10;4&he&&(ye+=2+(ee[10]|ee[11]<<8));for(var ve=(he>>3&1)+(he>>4&1);ve>0;ve-=!ee[ye++]);return ye+(2&he)}(W=O))+8>W.length&&As(6,"invalid gzip data"),function(ee,he,ye,ve){var Ce=ee.length;if(!Ce||he.f&&!he.l)return ye||new Bo(0);var Ue=!ye,et=Ue||he.i!=2,Ye=he.i;Ue&&(ye=new Bo(3*Ce));var Qe,ot,je=function(Vr){var fr=ye.length;if(Vr>fr){var ar=new Bo(Math.max(2*fr,Vr));ar.set(ye),ye=ar}},Je=he.f||0,Fe=he.p||0,Ve=he.b||0,lt=he.l,ut=he.d,zt=he.m,Et=he.n,gt=8*Ce;do{if(!lt){Je=Es(ee,Fe,1);var at=Es(ee,Fe+1,3);if(Fe+=3,!at){var Xt=ee[(J=4+((Fe+7)/8|0))-4]|ee[J-3]<<8,Mt=J+Xt;if(Mt>Ce){Ye&&As(0);break}et&&je(Ve+Xt),ye.set(ee.subarray(J,Mt),Ve),he.b=Ve+=Xt,he.p=Fe=8*Mt,he.f=Je;continue}if(at==1)lt=_O,ut=gO,zt=9,Et=5;else if(at==2){var Pt=Es(ee,Fe,31)+257,Ht=Es(ee,Fe+10,15)+4,ii=Pt+Es(ee,Fe+5,31)+1;Fe+=14;for(var oi=new Bo(ii),fi=new Bo(19),ci=0;ci<Ht;++ci)fi[pO[ci]]=Es(ee,Fe+3*ci,7);Fe+=3*Ht;var ai=cv(fi),tr=(1<<ai)-1,ur=tf(fi,ai);for(ci=0;ci<ii;){var J,te=ur[Es(ee,Fe,tr)];if(Fe+=15&te,(J=te>>4)<16)oi[ci++]=J;else{var Ge=0,pt=0;for(J==16?(pt=3+Es(ee,Fe,3),Fe+=2,Ge=oi[ci-1]):J==17?(pt=3+Es(ee,Fe,7),Fe+=3):J==18&&(pt=11+Es(ee,Fe,127),Fe+=7);pt--;)oi[ci++]=Ge}}var vt=oi.subarray(0,Pt),yt=oi.subarray(Pt);zt=cv(vt),Et=cv(yt),lt=tf(vt,zt),ut=tf(yt,Et)}else As(1);if(Fe>gt){Ye&&As(0);break}}et&&je(Ve+131072);for(var Dt=(1<<zt)-1,Gt=(1<<Et)-1,wi=Fe;;wi=Fe){var Ti=(Ge=lt[uv(ee,Fe)&Dt])>>4;if((Fe+=15&Ge)>gt){Ye&&As(0);break}if(Ge||As(2),Ti<256)ye[Ve++]=Ti;else{if(Ti==256){wi=Fe,lt=null;break}var li=Ti-254;Ti>264&&(li=Es(ee,Fe,(1<<(Si=vS[ci=Ti-257]))-1)+TS[ci],Fe+=Si);var Hi=ut[uv(ee,Fe)&Gt],sr=Hi>>4;if(Hi||As(3),Fe+=15&Hi,yt=mO[sr],sr>3){var Si=xS[sr];yt+=uv(ee,Fe)&(1<<Si)-1,Fe+=Si}if(Fe>gt){Ye&&As(0);break}et&&je(Ve+131072);var Mr=Ve+li;if(Ve<yt){var hr=0-yt,Vi=Math.min(yt,Mr);for(hr+Ve<0&&As(3);Ve<Vi;++Ve)ye[Ve]=(void 0)[hr+Ve]}for(;Ve<Mr;++Ve)ye[Ve]=ye[Ve-yt]}}he.l=lt,he.p=wi,he.b=Ve,he.f=Je,lt&&(Je=1,he.m=zt,he.d=ut,he.n=Et)}while(!Je);return Ve!=ye.length&&Ue?(Qe=ye,((ot=Ve)==null||ot>Qe.length)&&(ot=Qe.length),new Bo(Qe.subarray(0,ot))):ye.subarray(0,Ve)}(W.subarray(F,-8),{i:2},new Bo(((H=W)[(K=H.length)-4]|H[K-3]<<8|H[K-2]<<16|H[K-1]<<24)>>>0))));var H,K,W,F;const q=bO[$];if(!q)throw new Error(`Unhandled codec: ${$}`);const Y=new globalThis.DecompressionStream(q);return new Response(new Blob([O]).stream().pipeThrough(Y)).arrayBuffer().then(ee=>new Uint8Array(ee))}(A,S).then(O=>(function($,H){$.readFields(aO,H)}(new hv(O),D),new TO[m](D.buffer))),R.then(O=>{for(let $=w.length-1;$>=0;$--)switch(w[$]){case"delta_filter":cO(O,g);break;case"zigzag_filter":uO(O);break;case"bitshuffle_filter":hO(O,m);break;default:throw new ts(`Unhandled filter "${w[$]}"`)}return{layerName:a,blockIndex:v,data:O}}).catch(O=>{throw O})}))},Tt(CS,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Tt(G_,"MapboxRasterTile"),Tt(IS,"MapboxRasterLayer",{omit:["_blocksInProgress"]});let nf,dv,Is,Hh,pv,qh=null;function MS(){return lr(self)&&self.worker.dracoUrl?self.worker.dracoUrl:dv||An.DRACO_URL}function PS(){if(lr(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Hh)return Hh;const r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return Hh=WebAssembly.validate(r)?An.MESHOPT_SIMD_URL:An.MESHOPT_URL,Hh}const H_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},SO={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},of={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function DS(r,e,i){const s=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=s,i.json.bufferViews[s]={buffer:a,byteLength:r.byteLength},i.buffers[a]=r}const fv="KHR_draco_mesh_compression";function EO(r,e){const i=r.extensions&&r.extensions[fv];if(!i)return;const s=new Is.Decoder,a=kS(e,i.bufferView),u=new Is.Mesh;if(!s.DecodeArrayToMesh(a,a.byteLength,u))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[r.indices],m=H_[h.componentType],g=h.count*m.BYTES_PER_ELEMENT,v=Is._malloc(g);m===Uint16Array?s.GetTrianglesUInt16Array(u,g,v):s.GetTrianglesUInt32Array(u,g,v),DS(Is.memory.buffer.slice(v,v+g),h,e),Is._free(v);for(const w of Object.keys(i.attributes)){const S=s.GetAttributeByUniqueId(u,i.attributes[w]),A=e.json.accessors[r.attributes[w]],D=SO[A.componentType],R=A.count*of[A.type]*H_[A.componentType].BYTES_PER_ELEMENT,O=Is._malloc(R);s.GetAttributeDataArrayForAllPoints(u,S,Is[D],R,O),DS(Is.memory.buffer.slice(O,O+R),A,e),Is._free(O)}s.destroy(),u.destroy(),delete r.extensions[fv]}const q_="EXT_meshopt_compression";function AO(r,e){if(!r.extensions||!r.extensions[q_])return;const i=r.extensions[q_],s=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);pv.decodeGltfBuffer(a,i.count,i.byteStride,s,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=a.buffer,delete r.extensions[q_]}const RS=1179937895,zS=new TextDecoder("utf8");function LS(r,e){return new URL(r,e).href}function IO(r,e,i,s){return fetch(LS(r.uri,s)).then(a=>a.arrayBuffer()).then(a=>{e.buffers[i]=a})}function kS(r,e){const i=r.json.bufferViews[e];return new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function CO(r,e,i,s){if(r.uri){const a=LS(r.uri,s);return fetch(a).then(u=>u.blob()).then(u=>createImageBitmap(u)).then(u=>{e.images[i]=u})}if(r.bufferView!==void 0){const a=kS(e,r.bufferView),u=new Blob([a],{type:r.mimeType});return createImageBitmap(u).then(h=>{e.images[i]=h})}}function OS(r,e=0,i){const s={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===RS){const w=new Uint32Array(r,e);let S=2;const A=(w[S++]>>2)-3,D=w[S++]>>2;if(S++,s.json=JSON.parse(zS.decode(w.subarray(S,S+D))),S+=D,S<A){const R=w[S++];S++;const O=e+(S<<2);s.buffers[0]=r.slice(O,O+R)}}else s.json=JSON.parse(zS.decode(new Uint8Array(r,e)));const{buffers:a,images:u,meshes:h,extensionsUsed:m,bufferViews:g}=s.json;let v=Promise.resolve();if(a){const w=[];for(let S=0;S<a.length;S++){const A=a[S];A.uri?w.push(IO(A,s,S,i)):s.buffers[S]||(s.buffers[S]=null)}v=Promise.all(w)}return v.then(()=>{const w=[],S=m&&m.includes(fv),A=m&&m.includes(q_);if(S&&w.push(function(){if(!Is)return nf??(nf=function(D){let R,O=null;function $(){R=new Uint8Array(O.buffer)}function H(){throw new Error("Unexpected Draco error.")}const K={a:{a:H,d:function(W,F,q){return R.copyWithin(W,F,F+q)},c:function(W){const F=R.length,q=Math.max(W>>>0,Math.ceil(1.2*F)),Y=Math.ceil((q-F)/65536);try{return O.grow(Y),$(),!0}catch{return!1}},b:H}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(D,K):D.then(W=>W.arrayBuffer()).then(W=>WebAssembly.instantiate(W,K))).then(W=>{const{Rb:F,Qb:q,P:Y,T:ee,X:he,Ja:ye,La:ve,Qa:Ce,Va:Ue,Wa:et,eb:Ye,jb:Qe,f:ot,e:je,yb:Je,zb:Fe,Ab:Ve,Bb:lt,Db:ut,Gb:zt}=W.instance.exports;O=je;const Et=(()=>{let gt=0,at=0,Xt=0,Mt=0;return Pt=>{Xt&&(F(Mt),F(gt),at+=Xt,Xt=gt=0),gt||(at+=128,gt=q(at));const Ht=Pt.length+7&-8;let ii=gt;Ht>=at&&(Xt=Ht,ii=Mt=q(Ht));for(let oi=0;oi<Pt.length;oi++)R[ii+oi]=Pt[oi];return ii}})();return $(),ot(),{memory:je,_free:F,_malloc:q,Mesh:class{constructor(){this.ptr=Y()}destroy(){ee(this.ptr)}},Decoder:class{constructor(){this.ptr=ye()}destroy(){Qe(this.ptr)}DecodeArrayToMesh(gt,at,Xt){const Mt=Et(gt),Pt=ve(this.ptr,Mt,at,Xt.ptr);return!!he(Pt)}GetAttributeByUniqueId(gt,at){return{ptr:Ce(this.ptr,gt.ptr,at)}}GetTrianglesUInt16Array(gt,at,Xt){Ue(this.ptr,gt.ptr,at,Xt)}GetTrianglesUInt32Array(gt,at,Xt){et(this.ptr,gt.ptr,at,Xt)}GetAttributeDataArrayForAllPoints(gt,at,Xt,Mt,Pt){Ye(this.ptr,gt.ptr,at.ptr,Xt,Mt,Pt)}},DT_INT8:Je(),DT_UINT8:Fe(),DT_INT16:Ve(),DT_UINT16:lt(),DT_UINT32:ut(),DT_FLOAT32:zt()}})}(fetch(MS())),nf.then(D=>{Is=D,nf=void 0}))}()),A&&w.push(function(){if(pv)return;const D=function(R){let O;const $=WebAssembly.instantiateStreaming(R,{}).then(W=>{O=W.instance,O.exports.__wasm_call_ctors()}),H={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},K={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:$,supported:!0,decodeGltfBuffer(W,F,q,Y,ee,he){(function(ye,ve,Ce,Ue,et,Ye,Qe){const ot=ye.exports.sbrk,je=Ue+3&-4,Je=ot(je*et),Fe=ot(Ye.length),Ve=new Uint8Array(ye.exports.memory.buffer);Ve.set(Ye,Fe);const lt=ve(Je,Ue,et,Fe,Ye.length);if(lt===0&&Qe&&Qe(Je,je,et),Ce.set(Ve.subarray(Je,Je+Ue*et)),ot(Je-ot(0)),lt!==0)throw new Error(`Malformed buffer data: ${lt}`)})(O,O.exports[K[ee]],W,F,q,Y,O.exports[H[he]])}}}(fetch(PS()));return D.ready.then(()=>{pv=D})}()),u)for(let D=0;D<u.length;D++)w.push(CO(u[D],s,D,i));return(w.length?Promise.all(w):Promise.resolve()).then(()=>{if(S&&h)for(const{primitives:D}of h)for(const R of D)EO(R,s);if(A&&h&&g)for(const D of g)AO(D,s);return s})})}function ou(r,e){const i=r.json.bufferViews[e.bufferView],s=H_[e.componentType];return new s(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==of[e.type]*s.BYTES_PER_ELEMENT?i.byteStride/s.BYTES_PER_ELEMENT:of[e.type]))}function mv(r,e,i,s){const a=H_[e.componentType],u=function(w){switch(w){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(a),h=r.json.bufferViews[e.bufferView],m=h.byteStride?h.byteStride/a.BYTES_PER_ELEMENT:of[e.type],g=i.float32,v=g.length/i.capacity;for(let w=0,S=0;w<e.count*m;w+=m,S+=v)for(let A=0;A<v;A++)g[S+A]=s[w+A]*u;i._trim()}function MO(r,e,i){const s=r.indices,a=r.attributes,u={};u.indexArray=new fn;const h=e.json.accessors[s],m=h.count/3;u.indexArray.reserve(m);const g=ou(e,h);for(let A=0;A<m;A++)u.indexArray.emplaceBack(g[3*A],g[3*A+1],g[3*A+2]);u.indexArray._trim(),u.vertexArray=new Yo;const v=e.json.accessors[a.POSITION];u.vertexArray.reserve(v.count);const w=ou(e,v);for(let A=0;A<v.count;A++)u.vertexArray.emplaceBack(w[3*A],w[3*A+1],w[3*A+2]);if(u.vertexArray._trim(),u.aabb=new xr(v.min,v.max),u.centroid=function(A,D){const R=[0,0,0],O=A.length;if(O>0){for(let $=0;$<O;$++){const H=3*A[$];R[0]+=D[H],R[1]+=D[H+1],R[2]+=D[H+2]}R[0]/=O,R[1]/=O,R[2]/=O}return R}(g,w),a.COLOR_0!==void 0){const A=e.json.accessors[a.COLOR_0],D=of[A.type],R=ou(e,A);u.colorArray=D===3?new Yo:new Ko,u.colorArray.resize(A.count),mv(e,A,u.colorArray,R)}if(a.NORMAL!==void 0){u.normalArray=new Yo;const A=e.json.accessors[a.NORMAL];u.normalArray.resize(A.count);const D=ou(e,A);mv(e,A,u.normalArray,D)}if(a.TEXCOORD_0!==void 0&&i.length>0){u.texcoordArray=new Ga;const A=e.json.accessors[a.TEXCOORD_0];u.texcoordArray.resize(A.count);const D=ou(e,A);mv(e,A,u.texcoordArray,D)}if(a._FEATURE_ID_RGBA4444!==void 0){const A=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(u.featureData=ou(e,A))}a._FEATURE_RGBA4444!==void 0&&(u.featureData=new Uint32Array(ou(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const S=r.material;return u.material=function(A,D){const{emissiveFactor:R=[0,0,0],alphaMode:O="OPAQUE",alphaCutoff:$=.5,normalTexture:H,occlusionTexture:K,emissiveTexture:W,doubleSided:F}=A,{baseColorFactor:q=[1,1,1,1],metallicFactor:Y=1,roughnessFactor:ee=1,baseColorTexture:he,metallicRoughnessTexture:ye}=A.pbrMetallicRoughness||{},ve=K?D[K.index]:void 0;if(K&&K.extensions&&K.extensions.KHR_texture_transform&&ve){const Ce=K.extensions.KHR_texture_transform;ve.offsetScale=[Ce.offset[0],Ce.offset[1],Ce.scale[0],Ce.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Fi(...q),metallicFactor:Y,roughnessFactor:ee,baseColorTexture:he?D[he.index]:void 0,metallicRoughnessTexture:ye?D[ye.index]:void 0},doubleSided:F,emissiveFactor:R,alphaMode:O,alphaCutoff:$,normalTexture:H?D[H.index]:void 0,occlusionTexture:ve,emissionTexture:W?D[W.index]:void 0,defined:A.defined===void 0}}(S!==void 0?e.json.materials[S]:{defined:!1},i),u}function FS(r,e,i){const{matrix:s,rotation:a,translation:u,scale:h,mesh:m,extras:g,children:v}=r,w={};if(w.matrix=s||function(S,A,D,R){var O=A[0],$=A[1],H=A[2],K=A[3],W=O+O,F=$+$,q=H+H,Y=O*W,ee=O*F,he=O*q,ye=$*F,ve=$*q,Ce=H*q,Ue=K*W,et=K*F,Ye=K*q,Qe=R[0],ot=R[1],je=R[2];return S[0]=(1-(ye+Ce))*Qe,S[1]=(ee+Ye)*Qe,S[2]=(he-et)*Qe,S[3]=0,S[4]=(ee-Ye)*ot,S[5]=(1-(Y+Ce))*ot,S[6]=(ve+Ue)*ot,S[7]=0,S[8]=(he+et)*je,S[9]=(ve-Ue)*je,S[10]=(1-(Y+ye))*je,S[11]=0,S[12]=D[0],S[13]=D[1],S[14]=D[2],S[15]=1,S}([],a||[0,0,0,1],u||[0,0,0],h||[1,1,1]),m!==void 0){w.meshes=i[m];const S=w.anchor=[0,0];for(const A of w.meshes){const{min:D,max:R}=A.aabb;S[0]+=D[0]+R[0],S[1]+=D[1]+R[1]}S[0]=Math.floor(S[0]/w.meshes.length/2),S[1]=Math.floor(S[1]/w.meshes.length/2)}if(g&&(g.id&&(w.id=g.id),g.lights&&(w.lights=function(S){if(!S.length)return[];const A=function(H){const K=atob(H),W=new Uint8Array(K.length);for(let F=0;F<K.length;F++)W[F]=K.codePointAt(F);return W}(S),D=[],R=A.length/24,O=new Uint16Array(A.buffer),$=new Float32Array(A.buffer);for(let H=0;H<R;H++){const K=O[2*H*6]/30,W=O[2*H*6+1]/30,F=O[2*H*6+10]/100,q=$[6*H+1],Y=$[6*H+2],ee=$[6*H+3],he=$[6*H+4],ye=ee-q,ve=he-Y,Ce=Math.hypot(ye,ve);D.push({pos:[q+.5*ye,Y+.5*ve,W],normal:[ve/Ce,-ye/Ce,0],width:Ce,height:K,depth:F,points:[q,Y,ee,he]})}return D}(g.lights))),v){const S=[];for(const A of v)S.push(FS(e.json.nodes[A],e,i));w.children=S}return w}function PO(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new v0(r.vertices,r.indices,8,256),[i,s]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:s}}function DO(r){if(!r.extras||!r.extras.ground)return null;const e=r.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const s=[];for(const h of i){if(!Array.isArray(h)||h.length!==2)continue;const m=h[0],g=h[1];typeof m=="number"&&typeof g=="number"&&s.push(new ft(m,g))}if(s.length<3)return null;s.length>1&&s[s.length-1].equals(s[0])&&s.pop();let a=0;for(let h=0;h<s.length;h++){const m=s[h],g=s[(h+1)%s.length],v=s[(h+2)%s.length];a+=(m.x-g.x)*(v.y-g.y)-(v.x-g.x)*(m.y-g.y)}a>0&&s.reverse();const u=Ip(s.flatMap(h=>[h.x,h.y]),[]);return u.length===0?null:{vertices:s,indices:u}}function RO(r,e){const i=[],s=[];let a=0;const u=[];for(const h of r){a=i.length;const m=h.vertexArray.float32,g=h.indexArray.uint16;for(let v=0;v<h.vertexArray.length;v++)u[0]=m[3*v+0],u[1]=m[3*v+1],u[2]=m[3*v+2],gr(u,u,e),i.push(new ft(u[0],u[1]));for(let v=0;v<3*h.indexArray.length;v++)s.push(g[v]+a)}if(s.length%3!=0)return null;for(let h=0;h<s.length;h+=3){const m=i[s[h+0]],g=i[s[h+1]],v=i[s[h+2]];(m.x-g.x)*(v.y-g.y)-(v.x-g.x)*(m.y-g.y)>0&&([s[h+1],s[h+2]]=[s[h+2],s[h+1]])}return{vertices:i,indices:s}}function BS(r){const e=function(g,v){const w=[],S=WebGL2RenderingContext;if(g.json.textures)for(const A of g.json.textures){const D={magFilter:S.LINEAR,minFilter:S.NEAREST,wrapS:S.REPEAT,wrapT:S.REPEAT};A.sampler!==void 0&&Object.assign(D,g.json.samplers[A.sampler]),w.push({image:v[A.source],sampler:D,uploaded:!1})}return w}(r,r.images),i=function(g,v){const w=[];for(const S of g.json.meshes){const A=[];for(const D of S.primitives)A.push(MO(D,g,v));w.push(A)}return w}(r,e),{scenes:s,scene:a,nodes:u}=r.json,h=s?s[a||0].nodes:u,m=[];for(const g of h)m.push(FS(u[g],r,i));return function(g,v,w){const S={},A=new Set;for(let D=0;D<g.length;D++){const R=w[v[D]];if(!R.extras)continue;const O=R.extras["mapbox:footprint:version"],$=R.extras["mapbox:footprint:id"];(O||$)&&A.add(D),O==="1.0.0"&&$&&(S[$]=D)}for(let D=0;D<g.length;D++){if(A.has(D))continue;const R=g[D],O=w[v[D]];if(!O.extras)continue;let $=null;R.id in S&&($=RO(g[S[R.id]].meshes,R.matrix)),$||($=DO(O)),$&&(R.footprint=PO($))}if(A.size>0){const D=Array.from(A.values()).sort((R,O)=>R-O);for(let R=D.length-1;R>=0;R--)g.splice(D[R],1)}}(m,h,r.json.nodes),m}function zO(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,s=r.aabb.min[1]-1,a=iu/(r.aabb.max[0]-i+2),u=iu/(r.aabb.max[1]-s+2);for(let h=0;h<e.length;h+=3){const m=e[h+2],g=(e[h+0]-i)*a|0,v=(e[h+1]-s)*u|0;m>r.heightmap[v*iu+g]&&(r.heightmap[v*iu+g]=m)}}function LO(r,e){const i={};i.indexArray=new fn,i.indexArray.reserve(4*r.length),i.vertexArray=new Yo,i.vertexArray.reserve(10*r.length),i.colorArray=new Ko,i.vertexArray.reserve(10*r.length);let s=0;for(const h of r){const m=Math.min(10,Math.max(4,1.3*h.height))*e,g=[-h.normal[1],h.normal[0],0],v=Math.min(.29,.1*h.width/h.depth),w=h.width-2*h.depth*e*(v+.01),S=$r([],h.pos,g,w/2),A=$r([],h.pos,g,-w/2),D=[S[0],S[1],S[2]+h.height],R=[A[0],A[1],A[2]+h.height],O=$r([],h.normal,g,v);Ii(O,O,m);const $=$r([],h.normal,g,-v);Ii($,$,m),vi(O,S,O),vi($,A,$),S[2]+=.1,A[2]+=.1,i.vertexArray.emplaceBack(O[0],O[1],O[2]),i.vertexArray.emplaceBack($[0],$[1],$[2]),i.vertexArray.emplaceBack(S[0],S[1],S[2]),i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(D[0],D[1],D[2]),i.vertexArray.emplaceBack(R[0],R[1],R[2]),i.vertexArray.emplaceBack(S[0],S[1],S[2]),i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(O[0],O[1],O[2]),i.vertexArray.emplaceBack($[0],$[1],$[2]);const H=w/m/2;i.colorArray.emplaceBack(-H-v,-1,H,.8),i.colorArray.emplaceBack(H+v,-1,H,.8),i.colorArray.emplaceBack(-H,0,H,1.3),i.colorArray.emplaceBack(H,0,H,1.3),i.colorArray.emplaceBack(H+v,-.8,H,.7),i.colorArray.emplaceBack(H+v,-.8,H,.7),i.colorArray.emplaceBack(0,0,H,1.3),i.colorArray.emplaceBack(0,0,H,1.3),i.colorArray.emplaceBack(H+v,-1.2,H,.8),i.colorArray.emplaceBack(H+v,-1.2,H,.8),i.indexArray.emplaceBack(6+s,4+s,8+s),i.indexArray.emplaceBack(7+s,9+s,5+s),i.indexArray.emplaceBack(0+s,1+s,2+s),i.indexArray.emplaceBack(1+s,3+s,2+s),s+=10}const a={defined:!0,emissiveFactor:[0,0,0]},u={};return u.baseColorFactor=Fi.white,a.pbrMetallicRoughness=u,i.material=a,i.aabb=new xr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}class NS{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const s=e[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const kO=["id","tile","layer","source","sourceLayer","state"];class Zh{constructor(e,i,s,a,u){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=s,this._y=a,this.properties=e.properties,this.id=u}clone(){const e=new Zh(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of kO)this[i]!==void 0&&(e[i]=this[i]);return e}}class jS{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Cl(_t,16,0),this.featureIndexArray=new qm,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,s,a,u,h=0,m=0){const g=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,a,u,h);const v=this.grid;for(let w=0;w<i.length;w++){const S=i[w],A=[1/0,1/0,-1/0,-1/0];for(let D=0;D<S.length;D++){const R=S[D];A[0]=Math.min(A[0],R.x),A[1]=Math.min(A[1],R.y),A[2]=Math.max(A[2],R.x),A[3]=Math.max(A[3],R.y)}m!==0&&(A[0]-=m,A[1]-=m,A[2]+=m,A[3]+=m),A[0]<_t&&A[1]<_t&&A[2]>=0&&A[3]>=0&&v.insert(g,A[0],A[1],A[2],A[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new $l.VectorTile(new p_(this.rawTileData)).layers,this.sourceLayerCoder=new NS(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:s,transform:a,tileTransform:u,pixelPosMatrix:h,availableImages:m}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const g=s.bufferedTilespaceBounds,v=this.grid.query(g.min.x,g.min.y,g.max.x,g.max.y,(D,R,O,$)=>Kr(s.bufferedTilespaceGeometry,D,R,O,$));v.sort(OO);let w=null;a.elevation&&v.length>0&&(w=Vh.create(a.elevation,this.tileID));const S={};let A;for(let D=0;D<v.length;D++){const R=v[D];if(R===A)continue;A=R;const O=this.featureIndexArray.get(R);let $=null;this.is3DTile?this.loadMatchingModelFeature(S,O,e,s,a):this.loadMatchingFeature(S,O,e,m,(H,K,W,F=0)=>($||($=At(H,this.tileID.canonical,u)),K.queryIntersectsFeature(s,H,W,$,this.z,a,h,w,F)))}return S}loadMatchingFeature(e,i,s,a,u){const{featureIndex:h,bucketIndex:m,sourceLayerIndex:g,layoutVertexArrayOffset:v}=i,w=this.bucketLayerIDs[m],S=s.layers,A=Object.keys(S);if(A.length&&!function(H,K){for(let W=0;W<H.length;W++)if(K.indexOf(H[W])>=0)return!0;return!1}(A,w))return;const D=s.sourceCache,R=this.sourceLayerCoder.decode(g),O=this.vtLayers[R].feature(h),$=this.getId(O,R);for(let H=0;H<w.length;H++){const K=w[H];if(!S[K])continue;const{styleLayer:W,targets:F}=S[K];let q={};$!==void 0&&(q=D.getFeatureState(W.sourceLayer,$));const Y=!u||u(O,W,q,v);if(!Y)continue;const ee=new Zh(O,this.z,this.x,this.y,$);ee.tile=this.tileID.canonical,ee.state=q;let he=this.serializedLayersCache.get(K);he||(he=W.serialize(),he.id=K,this.serializedLayersCache.set(K,he)),ee.source=he.source,ee.sourceLayer=he["source-layer"],ee.layer=Oe({},he),ee.layer.paint=VS(he.paint,W.paint,O,q,a),ee.layer.layout=VS(he.layout,W.layout,O,q,a);let ye=!1;for(const ve of F){this.updateFeatureProperties(ee,ve);const{filter:Ce}=ve;if(Ce){if(O.properties=ee.properties,Ce.needGeometry){const Ue=Lt(O,!0);if(!Ce.filter(new Wi(this.tileID.overscaledZ),Ue,this.tileID.canonical))continue}else if(!Ce.filter(new Wi(this.tileID.overscaledZ),O))continue}ye=!0,ve.targetId&&this.addFeatureVariant(ee,ve)}ye&&this.appendToResult(e,K,h,ee,Y)}}loadMatchingModelFeature(e,i,s,a,u){const h=this.bucketLayerIDs[0][0],m=s.layers;if(!m[h])return;const{styleLayer:g,targets:v}=m[h];if(g.type!=="model")return;const w=a.tile,S=i.featureIndex,A=w.getBucket(g);if(!(A&&A instanceof k_))return;const D=function(he,ye,ve,Ce){const Ue=he.getNodesInfo()[ye];if(Ue.hiddenByReplacement||!Ue.node.meshes)return;let et=Number.MAX_VALUE;const Ye=Ue.node,Qe=ve.tile,ot=Ce.calculatePosMatrix(Qe.tileID.toUnwrapped(),Ce.worldSize),je=Ue.evaluatedScale;let Je=0;Ce.elevation&&Ye.elevation&&(Je=Ye.elevation*Ce.elevation.exaggeration()),st(ot,ot,[(Ye.anchor?Ye.anchor[0]:0)*(je[0]-1),(Ye.anchor?Ye.anchor[1]:0)*(je[1]-1),Je]),nt(ot,ot,je);const Fe=ve.queryGeometry,Ve=Fe.isPointQuery()?Fe.screenBounds:Fe.screenGeometry,lt=function(zt){const Et=Se([],ot,zt.matrix);Se(Et,Ce.expandedFarZProjMatrix,Et);for(let gt=0;gt<zt.meshes.length;++gt){const at=zt.meshes[gt];if(gt===zt.lightMeshIndex)continue;const Xt=jT(Ve,Ce,Et,at.aabb);Xt!=null&&(et=Math.min(Xt,et))}if(zt.children)for(const gt of zt.children)lt(gt)};if(lt(Ye),et===Number.MAX_VALUE)return;const ut=new V(0,0);return KT(Qe.tileID.canonical,ut,Ue.node.anchor[0],Ue.node.anchor[1]),{intersectionZ:et,position:ut,feature:Ue.feature}}(A,S,a,u);if(!D)return;const{z:R,x:O,y:$}=w.tileID.canonical,{feature:H,intersectionZ:K,position:W}=D;let F={};H.id!==void 0&&(F=s.sourceCache.getFeatureState(g.sourceLayer,H.id));const q=new Zh({},R,O,$,H.id);q.tile=this.tileID.canonical,q.state=F,q.properties=H.properties,q.geometry={type:"Point",coordinates:[W.lng,W.lat]};let Y=this.serializedLayersCache.get(h);Y||(Y=g.serialize(),Y.id=h,this.serializedLayersCache.set(h,Y)),q.source=Y.source,q.sourceLayer=Y["source-layer"],q.layer=Oe({},Y);let ee=!1;for(const he of v){this.updateFeatureProperties(q,he);const{filter:ye}=he;if(ye){if(H.properties=q.properties,ye.needGeometry){if(!ye.filter(new Wi(this.tileID.overscaledZ),H,this.tileID.canonical))continue}else if(!ye.filter(new Wi(this.tileID.overscaledZ),H))continue}ee=!0,he.targetId&&this.addFeatureVariant(q,he)}ee&&this.appendToResult(e,h,S,q,K)}updateFeatureProperties(e,i,s){if(i.properties){const a={};for(const u in i.properties){const h=i.properties[u].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,s);h!=null&&(a[u]=h)}e.properties=a}}addFeatureVariant(e,i,s){const a={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,s,a,u){let h=e[i];h===void 0&&(h=e[i]=[]),h.push({featureIndex:s,feature:a,intersectionZ:u})}lookupSymbolFeatures(e,i,s,a,u){const h={};this.loadVTLayers();for(const m of e)this.loadMatchingFeature(h,{bucketIndex:i,sourceLayerIndex:s,featureIndex:m,layoutVertexArrayOffset:0},a,u);return h}loadFeature(e){const{featureIndex:i,sourceLayerIndex:s}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(s),u=this.vtFeatures[a];if(u[i])return u[i];const h=this.vtLayers[a].feature(i);return u[i]=h,h}hasLayer(e){for(const i of this.bucketLayerIDs)for(const s of i)if(e===s)return!0;return!1}getId(e,i){let s=e.id;if(this.promoteId){const a=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(a!=null)if(Array.isArray(a)){if(!this.promoteIdExpression){const u=Al(a);if(u.result!=="success"){const h=u.value.map(m=>`${m.key}: ${m.message}`).join(", ");return void yi(`Failed to create expression for promoteId: ${h}`)}this.promoteIdExpression=u.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new $u),s=this.promoteIdExpression.evaluate({zoom:0},e)}else s=e.properties[a];typeof s=="boolean"&&(s=Number(s))}return s}}function VS(r,e,i,s,a){return ni(r,(u,h)=>{const m=e instanceof Na?e.get(h):null;return m&&m.evaluate?m.evaluate(i,s,void 0,a):m})}function OO(r,e){return e-r}Tt(jS,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const US=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class _v{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=s>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const u=US[15&s];if(!u)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[m]=new Uint32Array(e,4,1);return new _v(m,h,u,e)}constructor(e,i=64,s=Float64Array,a){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=US.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,m=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-m%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+m+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=i,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return gv(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:h,nodeSize:m}=this,g=[0,u.length-1,0],v=[];for(;g.length;){const w=g.pop()||0,S=g.pop()||0,A=g.pop()||0;if(S-A<=m){for(let $=A;$<=S;$++){const H=h[2*$],K=h[2*$+1];H>=e&&H<=s&&K>=i&&K<=a&&v.push(u[$])}continue}const D=A+S>>1,R=h[2*D],O=h[2*D+1];R>=e&&R<=s&&O>=i&&O<=a&&v.push(u[D]),(w===0?e<=R:i<=O)&&(g.push(A),g.push(D-1),g.push(1-w)),(w===0?s>=R:a>=O)&&(g.push(D+1),g.push(S),g.push(1-w))}return v}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:u,nodeSize:h}=this,m=[0,a.length-1,0],g=[],v=s*s;for(;m.length;){const w=m.pop()||0,S=m.pop()||0,A=m.pop()||0;if(S-A<=h){for(let $=A;$<=S;$++)GS(u[2*$],u[2*$+1],e,i)<=v&&g.push(a[$]);continue}const D=A+S>>1,R=u[2*D],O=u[2*D+1];GS(R,O,e,i)<=v&&g.push(a[D]),(w===0?e-s<=R:i-s<=O)&&(m.push(A),m.push(D-1),m.push(1-w)),(w===0?e+s>=R:i+s>=O)&&(m.push(D+1),m.push(S),m.push(1-w))}return g}}function gv(r,e,i,s,a,u){if(a-s<=i)return;const h=s+a>>1;$S(r,e,h,s,a,u),gv(r,e,i,s,h-1,1-u),gv(r,e,i,h+1,a,1-u)}function $S(r,e,i,s,a,u){for(;a>s;){if(a-s>600){const v=a-s+1,w=i-s+1,S=Math.log(v),A=.5*Math.exp(2*S/3),D=.5*Math.sqrt(S*A*(v-A)/v)*(w-v/2<0?-1:1);$S(r,e,i,Math.max(s,Math.floor(i-w*A/v+D)),Math.min(a,Math.floor(i+(v-w)*A/v+D)),u)}const h=e[2*i+u];let m=s,g=a;for(sf(r,e,s,i),e[2*a+u]>h&&sf(r,e,s,a);m<g;){for(sf(r,e,m,g),m++,g--;e[2*m+u]<h;)m++;for(;e[2*g+u]>h;)g--}e[2*s+u]===h?sf(r,e,s,g):(g++,sf(r,e,g,a)),g<=i&&(s=g+1),i<=g&&(a=g-1)}}function sf(r,e,i,s){yv(r,i,s),yv(e,2*i,2*s),yv(e,2*i+1,2*s+1)}function yv(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function GS(r,e,i,s){const a=r-i,u=e-s;return a*a+u*u}o.$=zn,o.A=js,o.B=Po,o.C=Va,o.D=Uh,o.E=Sa,o.F=2,o.G=jp,o.H=eT,o.I=eo,o.J=class extends z_{},o.K=Zt,o.L=gc,o.M=Ro,o.N=uh,o.O=ch,o.P=ft,o.Q=Jd,o.R=ku,o.S=ph,o.T=Z0,o.U=yh,o.V=z_,o.W=Rc,o.X=Al,o.Y=Ku,o.Z=bl,o._=Ac,o.a=function(r){return An.API_CDN_URL_REGEX.test(r)},o.a$=bt,o.a0=_c,o.a1=vh,o.a2=hh,o.a3=Em,o.a4=function(r){const e=r.value;let i=[];if(!e)return i;const s=Zt(e);return s!=="string"?(i=i.concat([new z_(r.key,e,`string expected, "${s}" found`)]),i):(K0(e,!0)||(i=i.concat([new z_(r.key,e,`invalid url "${e}"`)])),i)},o.a5=Re,o.a6=Rm,o.a7=Nr,o.a8=dt,o.a9=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return or(r.expression.evaluate(e))}interpolate(r,e,i){return{x:Nt(r.x,e.x,i),y:Nt(r.y,e.y,i),z:Nt(r.z,e.z,i),azimuthal:Nt(r.azimuthal,e.azimuthal,i),polar:Nt(r.polar,e.polar,i)}}},o.aA=Dr,o.aB=Yi,o.aC=Ke,o.aD=Te,o.aE=f,o.aF=function(r,e){const i={};for(let s=0;s<e.length;s++){const a=e[s];a in r&&(i[a]=r[a])}return i},o.aG=X,o.aH=le,o.aI=class{constructor(r){this.entries={},this.scheduler=r}request(r,e,i,s){const a=this.entries[r]=this.entries[r]||{callbacks:[]};if(a.result){const[u,h]=a.result;return this.scheduler?this.scheduler.add(()=>{s(u,h)},e):s(u,h),()=>{}}return a.callbacks.push(s),a.cancel||(a.cancel=i((u,h)=>{a.result=[u,h];for(const m of a.callbacks)this.scheduler?this.scheduler.add(()=>{m(u,h)},e):m(u,h);setTimeout(()=>delete this.entries[r],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(u=>u!==s),a.callbacks.length||(a.cancel(),delete this.entries[r]))}}},o.aJ=function(r,e,i){const s=JSON.stringify(r.request);return r.data&&(this.deduped.entries[s]={result:[null,r.data]}),this.deduped.request(s,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom},a=>{const u=cl(r.request,(h,m,g,v)=>{h?a(h):m&&a(null,{vectorTile:i?void 0:new $l.VectorTile(new p_(m)),rawData:m,cacheControl:g,expires:v})});return()=>{u.cancel(),a()}},e)},o.aK=function(r){pc++,pc>Mo&&(r.getActor().send("enforceCacheSizeLimit",fs),pc=0)},o.aL=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log(r)/Math.LN2))},o.aM=Zr,o.aN=MT,o.aO=kT,o.aP=CT,o.aQ=function(r,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let s=0;s<r.length;s++){const a=document.createElement("source");wy(r[s])||(i.crossOrigin="Anonymous"),a.src=r[s],i.appendChild(a)}return{cancel:()=>{}}},o.aR=C_,o.aS=function(r){return fetch(r).then(e=>e.arrayBuffer()).then(e=>OS(e,0,r))},o.aT=BS,o.aU=class{constructor(r,e,i,s){this.id=r,this.position=e!=null?new V(e[0],e[1]):new V(0,0),this.orientation=i??[0,0,0],this.nodes=s,this.uploaded=!1,this.aabb=new xr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(r,e){if(Se(r.matrix,e,r.matrix),r.meshes)for(const i of r.meshes){const s=xr.applyTransformFast(i.aabb,r.matrix);this.aabb.encapsulate(s)}if(r.children)for(const i of r.children)this._applyTransformations(i,r.matrix)}computeBoundsAndApplyParent(){const r=_e([]);for(const e of this.nodes)this._applyTransformations(e,r)}computeModelMatrix(r,e,i,s,a,u,h=!1){qT(this.matrix,this,r.transform,this.position,e,i,s,a,u,h)}upload(r){if(!this.uploaded){for(const e of this.nodes)Q0(e,r);for(const e of this.nodes)L_(e);this.uploaded=!0}}destroy(){for(const r of this.nodes)ev(r)}},o.aV=Qt,o.aW=$p,o.aX=de,o.aY=me,o.aZ=Ua,o.a_=fn,o.aa=Wi,o.ab=Il,o.ac=ke,o.ad=gr,o.ae=Jt,o.af=Ae,o.ag=Na,o.ah=Vl,o.ai=Nt,o.aj=_t,o.ak=Qf,o.al=U,o.am=Fi,o.an=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return function([i,s]){const a=or([1,i,s]);return{x:a.x,y:a.y,z:a.z}}(r.expression.evaluate(e))}interpolate(r,e,i){return{x:Nt(r.x,e.x,i),y:Nt(r.y,e.y,i),z:Nt(r.z,e.z,i)}}},o.ao=function(r,e,i=0,s=!0){const a=new ft(i,i),u=r.sub(a),h=e.add(a),m=[u,new ft(h.x,u.y),h,new ft(u.x,h.y)];return s&&m.push(u.clone()),m},o.ap=function(r,e){const i=[];for(let s=0;s<r.length;s++){const a=Be(s-1,-1,r.length-1),u=Be(s+1,-1,r.length-1),h=r[s],m=r[u],g=r[a].sub(h).unit(),v=m.sub(h).unit(),w=v.angleWithSep(g.x,g.y),S=g.add(v).unit().mult(-1*e/Math.sin(w/2));i.push(h.add(S))}return i},o.aq=fT,o.ar=Kr,o.as=function(r,e,i=0){return Bt(((e.x-i)*r.scale-r.x)*_t,(e.y*r.scale-r.y)*_t,Le(e.z,e.y))},o.at=Ei,o.au=Ui,o.av=Fo,o.aw=E2,o.ax=function(r){let e=1/0,i=1/0,s=-1/0,a=-1/0;for(const u of r)e=Math.min(e,u.x),i=Math.min(i,u.y),s=Math.max(s,u.x),a=Math.max(a,u.y);return{min:new ft(e,i),max:new ft(s,a)}},o.ay=ae,o.az=Se,o.b=function(r){return An.API_FONTS_REGEX.test(r)},o.b$=Ii,o.b0=Ch,o.b1=A_,o.b2=function(){vo.isLoading()||vo.isLoaded()||Ml()!=="deferred"||Dm()},o.b3=ap,o.b4=Lt,o.b5=Zh,o.b6=qr,o.b7=E0,o.b8=y0,o.b9=At,o.bA=function(r,e){const{x:i,y:s}=r.point,a=sw(i,s,r.worldSize/r._pixelsPerMercatorPixel,0,0);return Se(a,a,r0(ra(e)))},o.bB=xe,o.bC=function(r){return r[0]=0,r[1]=0,r[2]=0,r},o.bD=function(r,e){return Math.hypot(e[0]-r[0],e[1]-r[1],e[2]-r[2])},o.bE=Zi,o.bF=$r,o.bG=Lr,o.bH=Np,o.bI=lo,o.bJ=z0,o.bK=function(r,e,i,s,a){const u=5*e+2;r.float32[u+0]=i,r.float32[u+1]=s,r.float32[u+2]=a},o.bL=E_,o.bM=d_,o.bN=Vt,o.bO=xn,o.bP=Zw,o.bQ=VT,o.bR=Jw,o.bS=Qw,o.bT=F0,o.bU=aT,o.bV=R0,o.bW=_v,o.bX=Be,o.bY=On,o.bZ=function(r,e,i){i*=.5;var s=e[0],a=e[1],u=e[2],h=e[3],m=Math.sin(i),g=Math.cos(i);return r[0]=s*g+a*m,r[1]=a*g-s*m,r[2]=u*g+h*m,r[3]=h*g-u*m,r},o.b_=po,o.ba=xs,o.bb=Uc,o.bc=Qo,o.bd=Cr,o.be=Ip,o.bf=G0,o.bg=function(r,e){const i=Vl(e.zoom);if(i===0)return ra(r);const s=e_(r),a=i0(s),u=ae(s.getWest())*e.worldSize,h=ae(s.getEast())*e.worldSize,m=le(s.getNorth())*e.worldSize,g=le(s.getSouth())*e.worldSize,v=[u,m,0],w=[h,m,0],S=[u,g,0],A=[h,g,0],D=ze([],e.globeMatrix);return gr(v,v,D),gr(w,w,D),gr(S,S,D),gr(A,A,D),a[0]=Za(a[0],S,i),a[1]=Za(a[1],A,i),a[2]=Za(a[2],w,i),a[3]=Za(a[3],v,i),xr.fromPoints(a)},o.bh=i_,o.bi=ze,o.bj=Ep,o.bk=Za,o.bl=wh,o.bm=bo,o.bn=$t,o.bo=st,o.bp=G_,o.bq=p_,o.br=cl,o.bs=function(r,e){const i=[];for(const s in r)s in e||i.push(s);return i},o.bt=qe,o.bu=["type","source","source-layer","minzoom","maxzoom","filter","layout"],o.bv=ds,o.bw=function(r){var e=new fe(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},o.bx=_e,o.by=xt,o.bz=Pe,o.c=xa,o.c$=function(r){return r({pluginStatus:to,pluginURL:Ks}),gh.on("pluginStateChange",r),r},o.c0=wr,o.c1=pn,o.c2=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},o.c3=Wt,o.c4=function(r,e,i,s,a){var u,h=1/Math.tan(e/2);return r[0]=h/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0?(r[10]=(a+s)*(u=1/(s-a)),r[14]=2*a*s*u):(r[10]=-1,r[14]=-2*s),r},o.c5=function(r,e,i,s,a,u,h){var m=1/(e-i),g=1/(s-a),v=1/(u-h);return r[0]=-2*m,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*g,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*v,r[11]=0,r[12]=(e+i)*m,r[13]=(a+s)*g,r[14]=(h+u)*v,r[15]=1,r},o.c6=ne,o.c7=function(r,e,i){r[4*e+0]=i[0],r[4*e+1]=i[1],r[4*e+2]=i[2],r[4*e+3]=i[3]},o.c8=qc,o.c9=zo,o.cA=D_,o.cB=Ai,o.cC=OT,o.cD=function(r){const e=OT(r,!0);return xe([],[e[0],e[1],e[4],e[5]])},o.cE=nt,o.cF=Nl,o.cG=Xe,o.cH=function(r){const{x:e,y:i}=r.point,{lng:s,lat:a}=r._center;return sw(e,i,r.worldSize,s,a)},o.cI=ui,o.cJ=Z,o.cK=wn,o.cL=_,o.cM=function(r,e,i){let s=0;for(let a=0;a<2;++a)r[a]>0&&(s+=(r[a]-0)*(r[a]-0)),e[a]<0&&(s+=(0-e[a])*(0-e[a]));return s},o.cN=45,o.cO=ju,o.cP=ue,o.cQ=Dh,o.cR=function(r,e,i){const s=Math.sqrt(r*r+e*e+i*i),a=s>0?Math.acos(i/s)*$e:0;let u=r!==0||e!==0?Math.atan2(-e,-r)*$e+90:0;return u<0&&(u+=360),[s,u,a]},o.cS=Bt,o.cT=De,o.cU=vi,o.cV=xr,o.cW=or,o.cX=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},o.cY=ri,o.cZ=K0,o.c_=function(r,e){return r.readFields(z3,{icons:[]},e)},o.ca=Hc,o.cb=Wr,o.cc=Ph,o.cd=V,o.ce=vT,o.cf=function(){var r=new fe(4);return fe!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r},o.cg=function(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3],m=Math.sin(i),g=Math.cos(i);return r[0]=s*g+u*m,r[1]=a*g+h*m,r[2]=s*-m+u*g,r[3]=a*-m+h*g,r},o.ch=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},o.ci=Qi,o.cj=function(r){return Math.hypot(r[0],r[1],r[2],r[3])},o.ck=Ho,o.cl=oo,o.cm=vn,o.cn=Xc,o.co=FT,o.cp=cr,o.cq=rw,o.cr=function(r,e,i,s,a,u,h,m,g){if(g.name==="globe")return rw(r,e,new cr(i,s,a),!1);const v=$p({z:i,x:s,y:a},g);return new xr([(u+v.x/v.scale)*e,e*(v.y/v.scale),h],[(u+v.x2/v.scale)*e,e*(v.y2/v.scale),m])},o.cs=function(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r[3]=Math.min(e[3],i[3]),r},o.ct=function(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r[3]=Math.max(e[3],i[3]),r},o.cu=function(r){const e=Math.round((r+45+360)%360/90)%4;return se[e]},o.cv=Me,o.cw=En,o.cx=y,o.cy=function(r){const e=_e(new Float64Array(16));Se(e,r.pixelMatrix,r.globeMatrix);const i=[0,P,0],s=[0,M,0];return gr(i,i,e),gr(s,s,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!o0(r,new V(r.center.lat,90)),s[0]>0&&s[0]<=r.width&&s[1]>0&&s[1]<=r.height&&!o0(r,new V(r.center.lat,-90))]},o.cz=function(r,e){const{scale:i}=r.tileTransform,s=i*_t/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return function(a,u,h){var m=u[1],g=u[2],v=u[3],w=h[0],S=h[1];return a[0]=u[0]*w,a[1]=m*w,a[2]=g*S,a[3]=v*S,a}(new Float32Array(4),e.inverseAdjustmentMatrix,[s,s])},o.d=function(r){return An.API_TILEJSON_REGEX.test(r)},o.d$=bp,o.d0=O_,o.d1=Fh,o.d2=k0,o.d3=Ri,o.d4=Ba,o.d5=Jn,o.d6=Qn,o.d7=_i,o.d8=function(r){const e=r.indexOf(Bc);return e>=0?r.slice(0,e):r},o.d9=function(r){return r.indexOf(Bc)>=0},o.dA=ow,o.dB=Rn,o.dC=Dn,o.dD=256,o.dE=function(r,e){const i=[0,0,0];return gr(i,i,i_(ra(e.canonical))),gr(i,i,r),i},o.dF=r=>({u_camera_to_center_distance:new Wr(r),u_extrude_scale:new xo(r),u_device_pixel_ratio:new Wr(r),u_matrix:new qc(r),u_inv_rot_matrix:new qc(r),u_merc_center:new zo(r),u_tile_id:new Hc(r),u_zoom_transition:new Wr(r),u_up_dir:new Hc(r),u_emissive_strength:new Wr(r)}),o.dG=r=>({u_matrix:new qc(r),u_pixels_to_tile_units:new xo(r),u_device_pixel_ratio:new Wr(r),u_width_scale:new Wr(r),u_floor_width_scale:new Wr(r),u_units_to_pixels:new zo(r),u_dash_image:new Ph(r),u_gradient_image:new Ph(r),u_image_height:new Wr(r),u_texsize:new zo(r),u_tile_units_to_pixels:new Wr(r),u_alpha_discard_threshold:new Wr(r),u_trim_offset:new zo(r),u_trim_fade_range:new zo(r),u_trim_color:new Dh(r),u_emissive_strength:new Wr(r),u_zbias_factor:new Wr(r),u_tile_to_meter:new Wr(r),u_ground_shadow_factor:new Hc(r)}),o.dH=r=>({u_matrix:new qc(r),u_texsize:new zo(r),u_pixels_to_tile_units:new xo(r),u_device_pixel_ratio:new Wr(r),u_width_scale:new Wr(r),u_floor_width_scale:new Wr(r),u_image:new Ph(r),u_units_to_pixels:new zo(r),u_tile_units_to_pixels:new Wr(r),u_alpha_discard_threshold:new Wr(r),u_trim_offset:new zo(r),u_trim_fade_range:new zo(r),u_trim_color:new Dh(r),u_emissive_strength:new Wr(r),u_zbias_factor:new Wr(r),u_tile_to_meter:new Wr(r),u_ground_shadow_factor:new Hc(r),u_pattern_transition:new Wr(r)}),o.dI=jc,o.dJ=Bk,o.dK=cw,o.dL=(r,e,i,s,a,u)=>{const h=r.transform,m=h.projection.name==="globe";let g;if(u.paint.get("circle-pitch-alignment")==="map")if(m){const w=ow(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;g=Float32Array.from([w,0,0,w])}else g=h.calculatePixelsToTileUnitsMatrix(i);else g=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const v={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(h.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Io.devicePixelRatio,u_extrude_scale:g,u_inv_rot_matrix:zL,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:u.paint.get("circle-emissive-strength")};if(m){v.u_inv_rot_matrix=s,v.u_merc_center=a,v.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],v.u_zoom_transition=Vl(h.zoom);const w=a[0]*_t,S=a[1]*_t;v.u_up_dir=h.projection.upVector(new cr(0,0,0),w,S)}return v},o.dM=M2,o.dN=Zn,o.dO=(r,e,i,s,a,u,h,m,g,v)=>{const w=r.transform,S=w.pitch<15?A2(.07,.7,Te((14-w.zoom)/5,0,1)):.07,A=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:C2(r,e,i,s),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:w.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_width_scale:u,u_floor_width_scale:h,u_image:0,u_tile_units_to_pixels:I2(e,w),u_units_to_pixels:[1/w.pixelsToGLUnits[0],1/w.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:m,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(A?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:S,u_tile_to_meter:De(e.tileID.canonical,0),u_ground_shadow_factor:g,u_pattern_transition:v}},o.dP=(r,e,i,s,a,u,h,m,g,v)=>{const w=r.transform,S=w.calculatePixelsToTileUnitsMatrix(e),A=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",D=w.pitch<15?A2(.07,.7,Te((14-w.zoom)/5,0,1)):.07;return{u_matrix:C2(r,e,i,s),u_pixels_to_tile_units:S,u_device_pixel_ratio:u,u_width_scale:h,u_floor_width_scale:m,u_units_to_pixels:[1/w.pixelsToGLUnits[0],1/w.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:P2(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:I2(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:g,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(A?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:D,u_tile_to_meter:De(e.tileID.canonical,0),u_ground_shadow_factor:v}},o.dQ=Rt,o.dR=Ap,o.dS=Le,o.dT=d2,o.dU=Oo,o.dV=h_,o.dW=Gl,o.dX=450,o.dY=7,o.dZ=g3,o.d_=ki,o.da=function(r){const e=r.lastIndexOf(Bc);return e>=0?r.slice(e+1):""},o.db=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},o.dc=function(r,e,i,s){return r.type==="custom"?new y3(r,e):new M3[r.type](r,e,i,s)},o.dd=hi,o.de=function(r){const e=r.indexOf(Bc);return e>=0?r.slice(e+1):""},o.df=class extends Zh{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state=Object.assign({},r.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=r.source,this.sourceLayer=r.sourceLayer,this.layer=r.layer)}toJSON(){const r=super.toJSON();return r.target=this.target,r.namespace=this.namespace,r}},o.dg=gh,o.dh=ll,o.di=Jm,o.dj=class extends Jo{constructor(r){super(r),this.current=Qm}set(r,e,i){if(this.fetchUniformLocation(r,e)){for(let s=0;s<9;s++)if(i[s]!==this.current[s]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},o.dk=ge,o.dl=function(r,e,i){const s=Vl(i.zoom),a=r.style.map._antialias,u=r.terrain&&r.terrain.exaggeration()>0;return s===0&&!a&&!u},o.dm=function(r){const e=r.pixelsPerMeter,i=e/ne(1,r.center.lat),s=_e(new Float64Array(16));return st(s,s,[r.point.x,r.point.y,0]),nt(s,s,[i,i,e]),Float32Array.from(s)},o.dn=e_,o.dp=function(r){const e=Me-5;r=Te(r,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(U(r))),3);return Math.round(i*(I.length-1))},o.dq=function(r,e,i,s){const a=e.getNorth(),u=e.getSouth(),h=e.getWest(),m=e.getEast(),g=1<<r.z,v=m-h,w=a-u,S=v/E,A=-w/I[i],D=[0,S,0,A,0,0,a,h,0];if(r.z>0){const R=180/s;be(D,D,[R/v+1,0,0,0,R/w+1,0,-.5*R/S,.5*R/A,1])}return D[2]=g,D[5]=r.x,D[8]=r.y,D},o.dr=ra,o.ds=function(r,e,i){const s=_e(new Float64Array(16)),a=(e/(1<<r)-.5)*Math.PI*2;return ct(s,i.globeMatrix,a),Float32Array.from(s)},o.dt=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,s=1<<i,a=Math.floor(r.x),u=Math.floor((r.x-a)*s),h=Math.floor(r.y*s),m=this.findDEMTileFor(new Zr(i,a,i,u,h));return!(!m||!m.dem)}getAtPointOrZero(r,e=0){return this.getAtPoint(r,e)||0}getAtPoint(r,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const s=this._source();if(!s||r.y<0||r.y>1)return e;const a=s.getSource().maxzoom,u=1<<a,h=Math.floor(r.x),m=r.x-h,g=new Zr(a,h,a,Math.floor(m*u),Math.floor(r.y*u)),v=this.findDEMTileFor(g);if(!v||!v.dem)return e;const w=v.dem,S=1<<v.tileID.canonical.z,A=(m*S-v.tileID.canonical.x)*w.dim,D=(r.y*S-v.tileID.canonical.y)*w.dim,R=Math.floor(A),O=Math.floor(D);return(i?this.exaggeration():1)*Nt(Nt(w.get(R,O),w.get(R,O+1),D-O),Nt(w.get(R+1,O),w.get(R+1,O+1),D-O),A-R)}getAtTileOffset(r,e,i){const s=1<<r.canonical.z;return this.getAtPointOrZero(new ke(r.wrap+(r.canonical.x+e/_t)/s,(r.canonical.y+i/_t)/s))}getAtTileOffsetFunc(r,e,i,s){return a=>{const u=this.getAtTileOffset(r,a.x,a.y),h=s.upVector(r.canonical,a.x,a.y);return Ii(h,h,u*s.upVectorScale(r.canonical,e,i).metersToTile),h}}getForTilePoints(r,e,i,s){if(this.isUsingMockSource())return!1;const a=Vh.create(this,r,s);return!!a&&(e.forEach(u=>{u[2]=this.exaggeration()*a.getElevationAt(u[0],u[1],i)}),!0)}getMinMaxForTile(r){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(r);if(!e||!e.dem)return null;const i=e.dem.tree,s=e.tileID,a=1<<r.canonical.z-s.canonical.z;let u=r.canonical.x/a-s.canonical.x,h=r.canonical.y/a-s.canonical.y,m=0;for(let g=0;g<r.canonical.z-s.canonical.z&&!i.leaves[m];g++){u*=2,h*=2;const v=2*Math.floor(h)+Math.floor(u);m=i.childOffsets[m]+v,u%=1,h%=1}return{min:this.exaggeration()*i.minimums[m],max:this.exaggeration()*i.maximums[m]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(r,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(r){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(r){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const r=this.visibleDemTiles;if(r.length===0)return null;let e=!1,i=Number.MAX_VALUE,s=Number.MIN_VALUE;for(const a of r){const u=this.getMinMaxForTile(a.tileID);u&&(i=Math.min(i,u.min),s=Math.max(s,u.max),e=!0)}return e?{min:i,max:s}:null}},o.du=vw,o.dv=jl,o.dw=function(r,e){return[Math.pow(r[0],2.2)*e,Math.pow(r[1],2.2)*e,Math.pow(r[2],2.2)*e]},o.dx=oe,o.dy=function(r,e){var i=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=i,r[2]=0,r[3]=-i,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},o.dz=Kn,o.e=An,o.e$=NS,o.e0=256,o.e1=r0,o.e2=Yo,o.e3=ct,o.e4=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r},o.e5=ta,o.e6=Vc,o.e7=function(r,e,i,s,a){return Te((r-e)/(i-e)*(a-s)+s,s,a)},o.e8=$o,o.e9=function(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=e[4],m=e[5],g=e[6],v=e[7],w=e[8],S=w*h-m*v,A=-w*u+m*g,D=v*u-h*g,R=i*S+s*A+a*D;return R?(r[0]=S*(R=1/R),r[1]=(-w*s+a*v)*R,r[2]=(m*s-a*h)*R,r[3]=A*R,r[4]=(w*i-a*g)*R,r[5]=(-m*i+a*u)*R,r[6]=D*R,r[7]=(-v*i+s*g)*R,r[8]=(h*i-s*u)*R,r):null},o.eA=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},o.eB=un,o.eC=N,o.eD=Yn,o.eE=function(r,e,i,s){return r[0]=e,r[1]=i,r[2]=s,r},o.eF=function([r,e,i]){const s=Math.hypot(r,e,i),a=Math.atan2(r,i),u=.5*Math.PI-Math.acos(-e/s);return new V(Z(a),Z(u))},o.eG=Gr,o.eH=X0,o.eI=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!function(i){if(en==null){const s=i.navigator?i.navigator.userAgent:null;en=!!i.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return en}(r)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},o.eJ=function(r,e){fs=r,Mo=e},o.eK=o0,o.eL=aw,o.eM=function(r){const e=[0,0,0],i=_e(new Float64Array(16));return Se(i,r.pixelMatrix,r.globeMatrix),gr(e,e,i),new ft(e[0],e[1])},o.eN=function(r,e,i=!1){if(to===rp||to===np||to===op)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ks=Io.resolveURL(r),to=rp,sp=e,_h(),i||Dm()},o.eO=Ml,o.eP=function(){O_().acquire(iv)},o.eQ=function(){const r=Kp;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(iv),Kp=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},o.eR=nu,o.eS=function(r){const e=vd();if(!e)return;const i=e.delete(Co);r&&i.then(()=>r()).catch(r)},o.eT=Yp,o.eU=MS,o.eV=function(r){dv=Io.resolveURL(r),qh||(qh=new Uh(O_(),new Sa)),qh.broadcast("setDracoUrl",dv)},o.eW=PS,o.eX=function(r){Hh=Io.resolveURL(r),qh||(qh=new Uh(O_(),new Sa)),qh.broadcast("setMeshoptUrl",Hh)},o.eY=Tt,o.eZ=Ul,o.e_=Ss,o.ea=bm,o.eb=ho,o.ec=He,o.ed=class{constructor(r,e,i,s){this.context=r,this.format=s,this.size=i,this.texture=r.gl.createTexture();const[a,u,h]=this.size,{gl:m}=r;m.bindTexture(m.TEXTURE_3D,this.texture),r.pixelStoreUnpackFlipY.set(!1),r.pixelStoreUnpack.set(1),r.pixelStoreUnpackPremultiplyAlpha.set(!1),m.texImage3D(m.TEXTURE_3D,0,this.format,a,u,h,0,H0(this.format),q0(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:s}=i;s.bindTexture(s.TEXTURE_3D,this.texture),r!==this.minFilter&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MAG_FILTER,r),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_S,e),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},o.ee=function(r,e){if(r===e){var i=e[1],s=e[2],a=e[3],u=e[6],h=e[7],m=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=i,r[6]=e[9],r[7]=e[13],r[8]=s,r[9]=u,r[11]=e[14],r[12]=a,r[13]=h,r[14]=m}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r},o.ef=Y0,o.eg=mi,o.eh=[1,1,1],o.ei=function(r,e,i,s){var a=new fe(4);return a[0]=r,a[1]=e,a[2]=i,a[3]=s,a},o.ej=Br,o.ek=function(r,e,i,s){var a=e[0],u=e[1],h=e[2],m=e[3];return r[0]=a+s*(i[0]-a),r[1]=u+s*(i[1]-u),r[2]=h+s*(i[2]-h),r[3]=m+s*(i[3]-m),r},o.el=Vh,o.em=jh,o.en=ea,o.eo=Ga,o.ep=function(r,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O){var $=new fe(16);return $[0]=r,$[1]=e,$[2]=i,$[3]=s,$[4]=a,$[5]=u,$[6]=h,$[7]=m,$[8]=g,$[9]=v,$[10]=w,$[11]=S,$[12]=A,$[13]=D,$[14]=R,$[15]=O,$},o.eq=B,o.er=Ah,o.es=vp,o.et=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new ft(1/0,1/0),max:new ft(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(r,e=!1){const i=Xw(new ft(0,0),new ft(_t,_t),r),s=[];if(e&&!x0(i,this._globalClipBounds))return s;for(const a of this._activeRegions){if(a.hiddenByOverlap||!x0(i,a))continue;const u=uk(a.min,a.max,r);s.push({min:u.min,max:u.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId,order:a.order,clipMask:a.clipMask,clipScope:a.clipScope})}return s}setSources(r){this._setSources(r.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const s of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(s).buckets[e.layer];a&&a.updateFootprints(s.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(r){const e=r.getFootprints();if(e.length===0)return;const i=r.getOrder(),s=r.getClipMask(),a=r.getClipScope();for(const u of e){if(!u.footprint)continue;const h=Xw(u.footprint.min,u.footprint.max,u.id);this._activeRegions.push({min:h.min,max:h.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:u.id,footprint:u.footprint,order:i,clipMask:s,clipScope:a})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||c_(e.min,i.min)||c_(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(s,a){const u=(h,m)=>h+m;return s.length-a.length||s.reduce(u,"").localeCompare(a.reduce(u,""))}(e.clipScope,i.clipScope));let r=this._activeRegions.length!==this._prevRegions.length;if(!r){let e=0;for(;!r&&e!==this._activeRegions.length;){const i=this._activeRegions[e],s=this._prevRegions[e];r=i.priority!==s.priority||!Ww(i,s)||i.order!==s.order||i.clipMask!==s.clipMask||!ds(i.clipScope,s.clipScope),++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==l_&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const s=this._activeRegions;if(i>=s.length)return i;const a=s[i].priority;for(;i<s.length&&s[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,s=e(i);for(;i!==s;){let a=i;const u=i;for(;a!==s;){const h=this._activeRegions[a];h.hiddenByOverlap=!1;for(let m=0;m<u;m++){const g=this._activeRegions[m];if(!g.hiddenByOverlap&&h.order===l_&&x0(h,g)&&(h.hiddenByOverlap=Kw(h.footprint,h.tileId,g.footprint,g.tileId),h.hiddenByOverlap))break}++a}i=s,s=e(i)}}}}_setSources(r){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=r.length-1;e>=0;e--)this._addSource(r[e]);this._computeReplacement()}},o.eu=class{constructor(r){this._createGrid(r),this._createPoles(r)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const r of this._poleSegments)r.destroy();for(const r of this._gridSegments)r.withSkirts.destroy(),r.withoutSkirts.destroy()}_fillGridMeshWithLods(r,e){const i=new xs,s=new fn,a=[],u=r+1+2,h=e[0]+1,m=e[0]+1+(1+e.length),g=(v,w,S)=>{let A=v===u-1?v-2:v===0?v:v-1;return A+=S?24575:0,[A,w]};for(let v=0;v<u;++v)i.emplaceBack(...g(v,0,!0));for(let v=0;v<h;++v)for(let w=0;w<u;++w)i.emplaceBack(...g(w,v,(w===0||w===u-1)&&!0));for(let v=0;v<e.length;++v){const w=e[v];for(let S=0;S<u;++S)i.emplaceBack(...g(S,w,!0))}for(let v=0;v<e.length;++v){const w=s.length,S=e[v]+1+2,A=new fn;for(let O=0;O<S-1;O++){const $=O===S-2,H=$?u*(m-e.length+v-O):u;for(let K=0;K<u-1;K++){const W=O*u+K;O===0||$||K===0||K===u-2?(A.emplaceBack(W+1,W,W+H),A.emplaceBack(W+H,W+H+1,W+1)):(s.emplaceBack(W+1,W,W+H),s.emplaceBack(W+H,W+H+1,W+1))}}const D=Cr.simpleSegment(0,w,i.length,s.length-w);for(let O=0;O<A.uint16.length;O+=3)s.emplaceBack(A.uint16[O],A.uint16[O+1],A.uint16[O+2]);const R=Cr.simpleSegment(0,w,i.length,s.length-w);a.push({withoutSkirts:D,withSkirts:R})}return{vertices:i,indices:s,segments:a}}_createGrid(r){const e=this._fillGridMeshWithLods(E,I);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,Qo.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new fn;for(let h=0;h<=E;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new ta,s=new ta,a=new ta,u=new ta;this._poleSegments=[];for(let h=0,m=0;h<_;h++){const g=360/(1<<h);i.emplaceBack(0,-f,0,.5,0),s.emplaceBack(0,-f,0,.5,1),a.emplaceBack(0,-f,0,.5,.5),u.emplaceBack(0,-f,0,.5,.5);for(let v=0;v<=E;v++){let w=v/E,S=0;const A=Nt(0,g,w),[D,R,O]=z(DL,RL,A,f);i.emplaceBack(D,R,O,w,S),s.emplaceBack(D,R,O,w,1-S);const $=U(A);w=.5+.5*Math.sin($),S=.5+.5*Math.cos($),a.emplaceBack(D,R,O,w,S),u.emplaceBack(D,R,O,w,1-S)}this._poleSegments.push(Cr.simpleSegment(m,0,66,64)),m+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,io,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(s,io,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(a,io,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(u,io,!1)}getGridBuffers(r,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[r].withSkirts:this._gridSegments[r].withoutSkirts]}getPoleBuffers(r,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[r]]}},o.ev=l_,o.ew=pe,o.ex=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},o.ey=we,o.ez=ht,o.f=function(r){return r.indexOf("mapbox:")===0},o.f0=jS,o.f1=w2,o.f2=Kc,o.f3="hd_road_elevation",o.f4=m0,o.f5=ni,o.f6=Qc,o.f7=L0,o.f8=tu,o.f9=function(r,e,i,s,a,u,h,m=1,g,v){r.createArrays(),r.tilePixelRatio=_t/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const w=r.layers[0].layout,S=r.layers[0]._unevaluatedLayout._values,A={};A.scaleFactor=m,A.textSizeScaleRange=w.get("text-size-scale-range"),A.iconSizeScaleRange=w.get("icon-size-scale-range");const[D,R]=A.textSizeScaleRange,[O,$]=A.iconSizeScaleRange;A.textScaleFactor=Te(A.scaleFactor,D,R),A.iconScaleFactor=Te(A.scaleFactor,O,$);const H=S["text-size"],K=S["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:he,maxZoom:ye}=r.textSizeData;A.compositeTextSizes=[H.possiblyEvaluate(new Wi(he),u),H.possiblyEvaluate(new Wi(ye),u)]}if(r.iconSizeData.kind==="composite"){const{minZoom:he,maxZoom:ye}=r.iconSizeData;A.compositeIconSizes=[K.possiblyEvaluate(new Wi(he),u),K.possiblyEvaluate(new Wi(ye),u)]}A.layoutTextSize=H.possiblyEvaluate(new Wi(h+1),u),A.layoutIconSize=K.possiblyEvaluate(new Wi(h+1),u),A.textMaxSize=H.possiblyEvaluate(new Wi(18),u);const W=w.get("symbol-placement"),F=w.get("text-rotation-alignment")==="map"&&W!=="point",q=w.get("text-size");let Y=!1;const ee=[];for(const he of r.features){const ye=w.get("text-font").evaluate(he,{},u).join(","),ve=q.evaluate(he,{},u)*A.textScaleFactor,Ce=A.layoutTextSize.evaluate(he,{},u)*A.textScaleFactor,Ue=A.layoutIconSize.evaluate(he,{},u)*A.iconScaleFactor,et={horizontal:{},vertical:void 0},Ye=he.text;let Qe,ot=[0,0];if(Ye){const Pt=Ye.toString(),Ht=w.get("text-letter-spacing").evaluate(he,{},u)*xn,ii=w.get("text-line-height").evaluate(he,{},u)*xn,oi=Uy(Pt)?Ht:0,fi=w.get("text-anchor").evaluate(he,{},u),ci=w.get("text-variable-anchor");if(!ci){const te=w.get("text-radial-offset").evaluate(he,{},u);if(te)ot=aT(fi,[te*xn,O0]);else{const Ge=w.get("text-offset").evaluate(he,{},u);ot=[Ge[0]*xn,Ge[1]*xn]}}let ai=F?"center":w.get("text-justify").evaluate(he,{},u);const tr=W==="point",ur=tr?w.get("text-max-width").evaluate(he,{},u)*xn:1/0,J=te=>{r.allowVerticalPlacement&&ip(Pt)&&(et.vertical=D0(Ye,e,i,a,ye,ur,ii,fi,te,oi,ot,lo.vertical,!0,Ce,ve,g))};if(!F&&ci){const te=ai==="auto"?ci.map(pt=>F0(pt)):[ai];let Ge=!1;for(let pt=0;pt<te.length;pt++){const vt=te[pt];if(!et.horizontal[vt])if(Ge)et.horizontal[vt]=et.horizontal[0];else{const yt=D0(Ye,e,i,a,ye,ur,ii,"center",vt,oi,ot,lo.horizontal,!1,Ce,ve,g);yt&&(et.horizontal[vt]=yt,Ge=yt.positionedLines.length===1)}}J("left")}else{if(ai==="auto"&&(ai=F0(fi)),tr||w.get("text-writing-mode").indexOf("horizontal")>=0||!ip(Pt)){const te=D0(Ye,e,i,a,ye,ur,ii,fi,ai,oi,ot,lo.horizontal,!1,Ce,ve,g);te&&(et.horizontal[ai]=te)}J(tr?"left":ai)}}let je,Je,Fe,Ve,lt,ut,zt,Et=!1;if(he.icon&&he.icon.hasPrimary()){const Pt=cT(he.icon,r.iconSizeData,S["icon-size"],u,r.zoom,he,g,A.iconScaleFactor);je=Pt.iconPrimary,Fe=Pt.iconSecondary;const Ht=je.toString();if(Je=s.get(Ht),Je&&(lt=w.get("icon-offset").evaluate(he,{},u),ut=w.get("icon-anchor").evaluate(he,{},u),zt=w.get("icon-text-fit").evaluate(he,{},u),Qe=Wk(a.get(Ht),Fe?a.get(Fe.toString()):void 0,lt,ut),Et=Je.sdf,r.sdfIcons===void 0?r.sdfIcons=Je.sdf:r.sdfIcons!==Je.sdf&&yi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Je.pixelRatio!==r.pixelRatio||w.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),Fe){const ii=Fe.toString();Ve=s.get(ii)}}Y=Y||!(!he.icon||!he.icon.hasSecondary());const gt=B0(et.horizontal)||et.vertical;r.iconsInText||(r.iconsInText=!!gt&>.iconsInText);const at=Ce*A.textScaleFactor/xn,{defaultShapedIcon:Xt,verticallyShapedIcon:Mt}=r3(r,Qe,w,he,u,et,at,lt,zt);zt!=="none"&&Qe&&(H2(Qe)||q2(Qe))&&(y_(0,Je,je,Qe,Xt,zt,v,s,a),y_(0,Ve,Fe,Qe,Xt,zt,v,s,a),Mt&&(y_(0,Je,je,Qe,Mt,zt,v,s,a),y_(0,Ve,Fe,Qe,Mt,zt,v,s,a))),Qe=Xt,ee.push({feature:he,shapedTextOrientations:et,shapedText:gt,shapedIcon:Qe,iconPrimary:je,iconSecondary:Fe,iconOffset:lt,iconAnchor:ut,verticallyShapedIcon:Mt,layoutTextSize:Ce,layoutIconSize:Ue,textOffset:ot,isSDFIcon:Et,iconTextFit:zt})}return{featureData:ee,sizes:A,hasAnySecondaryIcon:Y,textAlongLine:F,symbolPlacement:W}},o.fa=tT,o.fb=function(r,e,i,s,a,u,h,m,g,v){const{featureData:w,hasAnySecondaryIcon:S,sizes:A,textAlongLine:D,symbolPlacement:R}=e;for(const O of w){const{shapedIcon:$,verticallyShapedIcon:H,feature:K,shapedTextOrientations:W,shapedText:F,layoutTextSize:q,textOffset:Y,isSDFIcon:ee,iconPrimary:he,iconSecondary:ye,iconTextFit:ve,iconOffset:Ce}=O;uT($,v.iconPositions,he,ye),uT(H,v.iconPositions,he,ye),i3(W,v.iconPositions),(F||$)&&n3(r,K,W,$,H,g,A,q,0,Y,ee,s,a,h,m,S,ve,Ce,D,R)}i&&r.generateCollisionDebugBuffers(u,r.collisionBoxArray,A.textScaleFactor)},o.fc=$l,o.fd=$_,o.fe=lc,o.ff=Rw,o.fg=O2,o.fh=Zo,o.fi=function(r){let e=0;if(new Uint32Array(r,0,1)[0]!==RS){const i=new Uint32Array(r,0,7),[,,s,a,u,h]=i;e=i.byteLength+a+u+h+u,(s!==r.byteLength||e>=r.byteLength)&&yi("Invalid b3dm header information.")}return OS(r,e)},o.fj=function(r,e){const i=BS(r);for(const s of i){for(const a of s.meshes)zO(a);s.lights&&(s.lightMeshIndex=s.meshes.length,s.meshes.push(LO(s.lights,e)))}return i},o.fk=k_,o.fl=lr,o.fm=JT,o.fn=vo,o.fo=function(r){_s(),mo!=null&&mo.then(e=>{e.keys().then(i=>{for(let s=0;s<i.length-r;s++)e.delete(i[s]).catch(a=>yi(a.message))}).catch(i=>yi(i.message))}).catch(e=>yi(e.message))},o.g=function(r,e){return ll(Oe(r,{method:"GET"}),e)},o.h=Wo,o.i=function(r){return An.API_STYLE_REGEX.test(r)&&!xa(r)},o.j=function(r){return decodeURIComponent(atob(r).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},o.k=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},o.l=Oe,o.m=xd,o.n=function(r,e){return ll(Oe(r,{type:"json"}),e)},o.o=ul,o.p=function(r,e){return ll(Oe(r,{method:"POST"}),e)},o.q=Io,o.r=In,o.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},o.t=gd,o.u=function(){return function r(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,r)}()},o.v=function(r){return!!r&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)},o.w=yi,o.x=function(){return rv||(rv=new nu),rv},o.y=lv,o.z=Td}),k(["./shared"],function(o){function re($e){const U=$e?$e.url.toString():void 0;return U?performance.getEntriesByName(U):[]}function fe($e){if(typeof $e=="number"||typeof $e=="boolean"||typeof $e=="string"||$e==null)return JSON.stringify($e);if(Array.isArray($e)){let Z="[";for(const se of $e)Z+=`${fe(se)},`;return`${Z}]`}let U="{";for(const Z of Object.keys($e).sort())U+=`${Z}:${fe($e[Z])},`;return`${U}}`}function xe($e){let U="";for(const Z of o.bu)($e.type!=="model"||Z!=="minzoom"&&Z!=="maxzoom")&&(U+=`/${fe($e[Z])}`);return U}class oe{constructor(U){this.keyCache={},this._layers={},this._layerConfigs={},U&&this.replace(U)}replace(U,Z){this._layerConfigs={},this._layers={},this.update(U,[],Z)}update(U,Z,se){this._options=se;for(const pe of U)this._layerConfigs[pe.id]=pe,(this._layers[pe.id]=o.dc(pe,this.scope,null,this._options)).compileFilter(se),this.keyCache[pe.id]&&delete this.keyCache[pe.id];for(const pe of Z)delete this.keyCache[pe],delete this._layerConfigs[pe],delete this._layers[pe];this.familiesBySource={};const ge=function(pe,we){const Te={};for(let Be=0;Be<pe.length;Be++){const qe=pe[Be];let Oe=we&&we[qe.id];Oe||(qe.type==="symbol"?Oe=qe.id:(Oe=xe(qe),qe.type==="line"&&qe.paint&&function bt(Rt){return typeof Rt=="string"&&Rt==="line-progress"||(Array.isArray(Rt)?Rt.some(bt):!(!Rt||typeof Rt!="object")&&Object.values(Rt).some(bt))}(qe.paint["line-width"])&&(Oe+=`/${fe(qe.paint["line-width"])}`))),we&&(we[qe.id]=Oe);let mt=Te[Oe];mt||(mt=Te[Oe]=[]),mt.push(qe)}const Ae=[];for(const Be in Te)Ae.push(Te[Be]);return Ae}(Object.values(this._layerConfigs),this.keyCache);for(const pe of ge){const we=pe.map(mt=>this._layers[mt.id]),Te=we[0];if(Te.visibility==="none")continue;const Ae=Te.source||"";let Be=this.familiesBySource[Ae];Be||(Be=this.familiesBySource[Ae]={});const qe=Te.sourceLayer||"_geojsonTileLayer";let Oe=Be[qe];Oe||(Oe=Be[qe]=[]),Oe.push(we)}}}const Ee=1*o.e_;class be{constructor(U){const Z={},se=[];for(const Te in U){const Ae=U[Te],Be=Z[Te]={};for(const qe in Ae.glyphs){const Oe=Ae.glyphs[+qe];if(!Oe||Oe.bitmap.width===0||Oe.bitmap.height===0)continue;const mt=Oe.metrics.localGlyph?Ee:1,bt={x:0,y:0,w:Oe.bitmap.width+2*mt,h:Oe.bitmap.height+2*mt};se.push(bt),Be[qe]=bt}}const{w:ge,h:pe}=o.H(se),we=new o.eZ({width:ge||1,height:pe||1});for(const Te in U){const Ae=U[Te];for(const Be in Ae.glyphs){const qe=Ae.glyphs[+Be];if(!qe||qe.bitmap.width===0||qe.bitmap.height===0)continue;const Oe=Z[Te][Be],mt=qe.metrics.localGlyph?Ee:1;o.eZ.copy(qe.bitmap,we,{x:0,y:0},{x:Oe.x+mt,y:Oe.y+mt},qe.bitmap)}}this.image=we,this.positions=Z}}o.eY(be,"GlyphAtlas");class Pe{constructor(U){this.tileID=new o.aM(U.tileID.overscaledZ,U.tileID.wrap,U.tileID.canonical.z,U.tileID.canonical.x,U.tileID.canonical.y),this.tileZoom=U.tileZoom,this.uid=U.uid,this.zoom=U.zoom,this.lut=U.lut,this.canonical=U.tileID.canonical,this.pixelRatio=U.pixelRatio,this.tileSize=U.tileSize,this.source=U.source,this.scope=U.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=U.showCollisionBoxes,this.collectResourceTiming=!!U.request&&U.request.collectResourceTiming,this.promoteId=U.promoteId,this.isSymbolTile=U.isSymbolTile,this.tileTransform=o.aW(U.tileID.canonical,U.projection),this.projection=U.projection,this.worldview=U.worldview,this.localizableLayerIds=U.localizableLayerIds,this.brightness=U.brightness,this.extraShadowCaster=!!U.extraShadowCaster,this.tessellationStep=U.tessellationStep,this.scaleFactor=U.scaleFactor}parse(U,Z,se,ge,pe,we){this.status="parsing",this.data=U,this.collisionBoxArray=new o.b0;const Te=new o.e$(Object.keys(U.layers).sort()),Ae=new o.f0(this.tileID,this.promoteId);Ae.bucketLayerIDs=[];const Be={},qe=new o.f1(256,256),Oe={featureIndex:Ae,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:qe,availableImages:se,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},mt=Z.familiesBySource[this.source];for(const Li in mt){const or=U.layers[Li];if(!or)continue;let lr=!1,qr=!1,en=!1;for(const Dn of mt[Li])Dn[0].type==="symbol"?lr=!0:qr=!0,Dn[0].is3D()&&Dn[0].type!=="model"&&(en=!0);if(this.extraShadowCaster&&!en||this.isSymbolTile===!0&&!lr||this.isSymbolTile===!1&&!qr)continue;or.version===1&&o.w(`Vector tile source "${this.source}" layer "${Li}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const pn=Te.encode(Li),bn=[];let ps=!1;for(let Dn=0,Rn=0;Dn<or.length;Dn++){const yn=or.feature(Dn),An=Ae.getId(yn,Li);if(this.localizableLayerIds&&this.localizableLayerIds.has(Li)){const Wo=yn.properties?yn.properties.worldview:null;if(this.worldview&&typeof Wo=="string")if(Wo==="all")yn.properties.$localized=!0;else{if(!Wo.split(",").includes(this.worldview))continue;yn.properties.$localized=!0,yn.properties.worldview=this.worldview}}!ps&&yn.properties&&yn.properties.hasOwnProperty(o.f2)&&(ps=!0),bn.push({feature:yn,id:An,index:Rn,sourceLayerIndex:pn}),Rn++}ps&&!Oe.elevationFeatures&&U.layers.hasOwnProperty(o.f3)&&(Oe.elevationFeatures=o.f4.parseFrom(U.layers[o.f3],this.canonical));for(const Dn of mt[Li]){const Rn=Dn[0];(!this.extraShadowCaster||Rn.is3D()&&Rn.type!=="model")&&(this.isSymbolTile!==void 0&&Rn.type==="symbol"!==this.isSymbolTile||Rn.minzoom&&this.zoom<Math.floor(Rn.minzoom)||Rn.maxzoom&&this.zoom>=Rn.maxzoom||Rn.visibility!=="none"&&(_e(Dn,this.zoom,Oe.brightness,se),(Be[Rn.id]=Rn.createBucket({index:Ae.bucketLayerIDs.length,layers:Dn,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:pn,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:ge})).populate(bn,Oe,this.tileID.canonical,this.tileTransform),Ae.bucketLayerIDs.push(Dn.map(yn=>o.C(yn.id,yn.scope)))))}}let bt,Rt,Qt,ni,hi,_i;qe.trim();const Rr={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},yi=()=>{if(bt)return this.status="done",we(bt);if(this.extraShadowCaster)this.status="done",we(null,{buckets:Object.values(Be).filter(Li=>!Li.isEmpty()),featureIndex:Ae,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Oe.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Rt&&Qt&&ni){const Li=new be(Rt),or=new Map;for(const[en,pn]of Qt.entries()){const{imagePosition:bn}=o.f7(en,pn,o.f8);or.set(en,bn)}const lr={};for(const en in Be){const pn=Be[en];pn instanceof o.b1&&(_e(pn.layers,this.zoom,Oe.brightness,se),lr[en]=o.f9(pn,Rt,Li.positions,Qt,or,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,hi))}const qr={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(pe,Qt,hi,()=>{qr.iconsPending=!1,nr(lr,Li,qr)}),this.rasterizeIfNeeded(pe,ni,_i,()=>{qr.patternsPending=!1,nr(lr,Li,qr)})}},nr=(Li,or,lr,qr)=>{if(lr.iconsPending||lr.patternsPending)return;const en=new o.fa(Qt,ni,this.lut);for(const pn in Be){const bn=Be[pn];if(pn in Li)o.fb(bn,Li[pn],this.showCollisionBoxes,se,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Qt,en);else if(bn.hasPattern&&(bn instanceof o.b7||bn instanceof o.b8||bn instanceof o.dV)){_e(bn.layers,this.zoom,Oe.brightness,se);const ps=Object.fromEntries(en.patternPositions);bn.addFeatures(Oe,this.tileID.canonical,ps,se,this.tileTransform,this.brightness)}}this.status="done",we(null,{buckets:Object.values(Be).filter(pn=>!pn.isEmpty()),featureIndex:Ae,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:or.image,lineAtlas:qe,imageAtlas:en,brightness:Oe.brightness})};if(!this.extraShadowCaster){const Li=o.f5(Oe.glyphDependencies,qr=>Object.keys(qr).map(Number));Object.keys(Li).length?pe.send("getGlyphs",{uid:this.uid,stacks:Li,scope:this.scope},(qr,en)=>{bt||(bt=qr,Rt=en,yi())},void 0,!1,Rr):Rt={};const or=Array.from(Oe.iconDependencies.keys()).map(qr=>o.I.parse(qr));or.length?pe.send("getImages",{images:or,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(qr,en)=>{bt||(bt=qr,Qt=new Map,hi=this.updateImageMapAndGetImageTaskQueue(Qt,en,Oe.iconDependencies),yi())},void 0,!1,Rr):(Qt=new Map,hi=new Map);const lr=Array.from(Oe.patternDependencies.keys()).map(qr=>o.I.parse(qr));lr.length?pe.send("getImages",{images:lr,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(qr,en)=>{bt||(bt=qr,ni=new Map,_i=this.updateImageMapAndGetImageTaskQueue(ni,en,Oe.patternDependencies),yi())},void 0,!1,Rr):(ni=new Map,_i=new Map)}if(Oe.elevationFeatures&&Oe.elevationFeatures.length>0){const Li=[];for(const lr of Object.values(Be))if(lr instanceof o.b8){const qr=lr.getUnevaluatedPortalGraph();qr&&Li.push(qr)}const or=o.f6.evaluate(Li);for(const lr of Object.values(Be))lr instanceof o.b8&&lr.setEvaluatedPortalGraph(or)}yi()}rasterizeIfNeeded(U,Z,se,ge){Array.from(Z.values()).some(pe=>pe.usvg)?this.rasterize(U,Z,se,ge):ge()}updateImageMapAndGetImageTaskQueue(U,Z,se){const ge=new Map;for(const pe of Z.keys()){const we=se.get(pe)||[];for(const Te of we){const Ae=Te.toString(),Be=Z.get(Te.id.toString());Be.usvg?ge.has(Ae)||(ge.set(Ae,Te),U.set(Ae,Object.assign({},Be))):U.set(Ae,Be)}}return ge}rasterize(U,Z,se,ge){this.rasterizeTask=U.send("rasterizeImages",{scope:this.scope,tasks:se},(pe,we)=>{if(!pe)for(const[Te,Ae]of we.entries()){const Be=Object.assign(Z.get(Te),{data:Ae});Z.set(Te,Be)}ge()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function _e($e,U,Z,se){const ge=new o.aa(U,{brightness:Z});for(const pe of $e)pe.recalculate(ge,se)}class ze extends o.E{constructor(U,Z,se,ge,pe,we,Te){super(),this.actor=U,this.layerIndex=Z,this.availableImages=se,this.availableModels=ge,this.loadVectorData=we||o.aJ,this.loading={},this.loaded={},this.deduped=new o.aI(U.scheduler),this.isSpriteLoaded=pe,this.scheduler=U.scheduler,this.brightness=Te}loadTile(U,Z){const se=U.uid,ge=U&&U.request,pe=ge&&ge.collectResourceTiming,we=this.loading[se]=new Pe(U);we.abort=this.loadVectorData(U,(Te,Ae)=>{const Be=!this.loading[se];if(delete this.loading[se],we.cancelRasterize(),Be||Te||!Ae)return we.status="done",Be||(this.loaded[se]=we),Z(Te);const qe=Ae.rawData,Oe={};Ae.expires&&(Oe.expires=Ae.expires),Ae.cacheControl&&(Oe.cacheControl=Ae.cacheControl),we.vectorTile=Ae.vectorTile||new o.fc.VectorTile(new o.bq(qe));const mt=()=>{we.parse(we.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(bt,Rt)=>{if(bt||!Rt)return Z(bt);const Qt={};if(pe){const ni=re(ge);ni.length>0&&(Qt.resourceTiming=JSON.parse(JSON.stringify(ni)))}Z(null,o.l({rawTileData:qe.slice(0)},Rt,Oe,Qt))})};this.isSpriteLoaded?mt():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(mt,{type:"parseTile",isSymbolTile:U.isSymbolTile,zoom:U.tileZoom}):mt()}),this.loaded=this.loaded||{},this.loaded[se]=we})}reloadTile(U,Z){const se=this.loaded,ge=U.uid;if(se&&se[ge]){const pe=se[ge];pe.scaleFactor=U.scaleFactor,pe.showCollisionBoxes=U.showCollisionBoxes,pe.projection=U.projection,pe.brightness=U.brightness,pe.tileTransform=o.aW(U.tileID.canonical,U.projection),pe.extraShadowCaster=U.extraShadowCaster,pe.lut=U.lut;const we=(Te,Ae)=>{const Be=pe.reloadCallback;Be&&(delete pe.reloadCallback,pe.parse(pe.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Be)),Z(Te,Ae)};pe.status==="parsing"?pe.reloadCallback=we:pe.status==="done"&&(pe.vectorTile?pe.parse(pe.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,we):we())}else Z(null,void 0)}abortTile(U,Z){const se=U.uid,ge=this.loading[se];ge&&(ge.abort&&ge.abort(),delete this.loading[se]),Z()}removeTile(U,Z){const se=this.loaded,ge=U.uid;se&&se[ge]&&delete se[ge],Z()}}class Se{loadTile(U,Z){const{uid:se,encoding:ge,rawImageData:pe,padding:we}=U,Te=ImageBitmap&&pe instanceof ImageBitmap?this.getImageData(pe,we):pe;Z(null,new o.fd(se,Te,ge,we<1))}reloadTile(U,Z){Z(null,null)}abortTile(U,Z){Z()}removeTile(U,Z){Z()}getImageData(U,Z){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(U.width,U.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=U.width,this.offscreenCanvas.height=U.height,this.offscreenCanvasContext.drawImage(U,0,0,U.width,U.height);const se=this.offscreenCanvasContext.getImageData(-Z,-Z,U.width+2*Z,U.height+2*Z);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),se}}o.bp.setPbf(o.bq);class st{constructor(U){this._mrt=new o.bp(U.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=U.uid,this.tileID=U.tileID,this.source=U.source}parse(U,Z){const se=this._mrt;this.status="parsing",this._entireBuffer=U;try{se.parseHeader(U),this._isHeaderLoaded=!0;const ge=[];for(const pe in se.layers){const we=se.getLayer(pe),Te=we.getDataRange(we.getBandList()),Ae=se.createDecodingTask(Te),Be=U.slice(Te.firstByte,Te.lastByte+1),qe=o.bp.performDecoding(Be,Ae).then(Oe=>Ae.complete(null,Oe)).catch(Oe=>Ae.complete(Oe,null));ge.push(qe)}Promise.allSettled(ge).then(()=>Z(null,se)).catch(pe=>Z(pe))}catch(ge){Z(ge)}}}class nt{constructor(U){this.actor=U,this.loading={},this.loaded={}}loadTile(U,Z){const se=U.uid,ge=U.request,pe=this.loading[se]=new st(U),{cancel:we}=o.br(ge,(Te,Ae,Be,qe)=>{const Oe=!this.loading[se];if(delete this.loading[se],Oe||Te||!Ae)return pe.status="done",Oe||(this.loaded[se]=pe),Z(Te);pe.parse(Ae,(mt,bt)=>{if(mt||!bt)return Z(mt);Z(null,bt,Be,qe)}),this.loaded[se]=pe});pe.abort=we}reloadTile(U,Z){Z(null,void 0)}abortTile(U,Z){const se=U.uid,ge=this.loading[se];ge&&(ge.abort&&ge.abort(),delete this.loading[se]),Z()}removeTile(U,Z){const se=U.uid;this.loaded[se]&&delete this.loaded[se],Z()}decodeRasterArray(U,Z){o.bp.performDecoding(U.buffer,U.task).then(se=>Z(null,se)).catch(se=>Z(se))}}const Xe=o.fc.VectorTileFeature.prototype.toGeoJSON;class ct{constructor(U){this._feature=U,this.extent=o.aj,this.type=U.type,this.properties=U.tags,"id"in U&&!isNaN(U.id)&&(this.id=parseInt(U.id,10))}loadGeometry(){if(this._feature.type===1){const U=[];for(const Z of this._feature.geometry)U.push([new o.P(Z[0],Z[1])]);return U}{const U=[];for(const Z of this._feature.geometry){const se=[];for(const ge of Z)se.push(new o.P(ge[0],ge[1]));U.push(se)}return U}}toGeoJSON(U,Z,se){return Xe.call(this,U,Z,se)}}class xt{constructor(U){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=o.aj,this.length=U.length,this._features=U}feature(U){return new ct(this._features[U])}}const $t=64/4096,kt=128;class Wt{constructor(){this.features=new Map}clear(){this.features.clear()}load(U=[],Z){for(const se of U){const ge=se.id;if(ge==null)continue;let pe=this.features.get(ge);pe&&this.updateCache(pe,Z),se.geometry?(pe=mi(se),this.updateCache(pe,Z),this.features.set(ge,pe)):this.features.delete(ge),this.updateCache(pe,Z)}}updateCache(U,Z){for(const{canonical:se,uid:ge}of Object.values(Z)){const{z:pe,x:we,y:Te}=se;Ai(U,Math.pow(2,pe),we,Te)&&delete Z[ge]}}getTile(U,Z,se){const ge=Math.pow(2,U),pe=[];for(const we of this.features.values())Ai(we,ge,Z,se)&&pe.push(vi(we,ge,Z,se));return{features:pe}}getFeatures(){return[...this.features.values()]}}function Ai({minX:$e,minY:U,maxX:Z,maxY:se},ge,pe,we){return $e<(pe+1+$t)/ge&&U<(we+1+$t)/ge&&Z>(pe-$t)/ge&&se>(we-$t)/ge}function mi($e){const{id:U,geometry:Z,properties:se}=$e;if(!Z)return;if(Z.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:ge,coordinates:pe}=Z,we={id:U,type:1,geometry:[],tags:se,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Te=we.geometry;if(ge==="Point")bi(pe,Te,we);else if(ge==="MultiPoint")for(const Ae of pe)bi(Ae,Te,we);else if(ge==="LineString")we.type=2,Jt(pe,Te,we);else if(ge==="MultiLineString")we.type=2,Bt(pe,Te,we);else if(ge==="Polygon")we.type=3,Bt(pe,Te,we,!0);else{if(ge!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");we.type=3;for(const Ae of pe)Bt(Ae,Te,we,!0)}return we}function bi([$e,U],Z,se){const ge=o.ay($e);let pe=o.aH(U);pe=pe<0?0:pe>1?1:pe,Z.push(ge,pe),se.minX=Math.min(se.minX,ge),se.minY=Math.min(se.minY,pe),se.maxX=Math.max(se.maxX,ge),se.maxY=Math.max(se.maxY,pe)}function Jt($e,U,Z,se=!1,ge=!1){const pe=[];for(const we of $e)bi(we,pe,Z);U.push(pe),se&&function(we,Te){let Ae=0;for(let Be=0,qe=we.length,Oe=qe-2;Be<qe;Oe=Be,Be+=2)Ae+=(we[Be]-we[Oe])*(we[Be+1]+we[Oe+1]);if(Ae>0===Te)for(let Be=0,qe=we.length;Be<qe/2;Be+=2){const Oe=we[Be],mt=we[Be+1];we[Be]=we[qe-2-Be],we[Be+1]=we[qe-1-Be],we[qe-2-Be]=Oe,we[qe-1-Be]=mt}}(pe,ge)}function Bt($e,U,Z,se=!1){for(let ge=0;ge<$e.length;ge++)Jt($e[ge],U,Z,se,ge===0)}function vi($e,U,Z,se){const{id:ge,type:pe,geometry:we,tags:Te}=$e,Ae=[];if(pe===1)(function(Be,qe,Oe,mt,bt){for(let Rt=0;Rt<Be.length;Rt+=2){const Qt=Math.round(o.aj*(Be[Rt+0]*qe-Oe)),ni=Math.round(o.aj*(Be[Rt+1]*qe-mt));bt.push([Qt,ni])}})(we,U,Z,se,Ae);else for(const Be of we)ri(Be,U,Z,se,Ae);return{id:ge,type:pe,geometry:Ae,tags:Te}}function ri($e,U,Z,se,ge){const pe=-kt,we=o.aj+kt;let Te;for(let Ae=0;Ae<$e.length-2;Ae+=2){let Be=Math.round(o.aj*($e[Ae+0]*U-Z)),qe=Math.round(o.aj*($e[Ae+1]*U-se)),Oe=Math.round(o.aj*($e[Ae+2]*U-Z)),mt=Math.round(o.aj*($e[Ae+3]*U-se));const bt=Oe-Be,Rt=mt-qe;Be<pe&&Oe<pe||(Be<pe?(qe+=Math.round(Rt*((pe-Be)/bt)),Be=pe):Oe<pe&&(mt=qe+Math.round(Rt*((pe-Be)/bt)),Oe=pe),qe<pe&&mt<pe||(qe<pe?(Be+=Math.round(bt*((pe-qe)/Rt)),qe=pe):mt<pe&&(Oe=Be+Math.round(bt*((pe-qe)/Rt)),mt=pe),Be>=we&&Oe>=we||(Be>=we?(qe+=Math.round(Rt*((we-Be)/bt)),Be=we):Oe>=we&&(mt=qe+Math.round(Rt*((we-Be)/bt)),Oe=we),qe>=we&&mt>=we||(qe>=we?(Be+=Math.round(bt*((we-qe)/Rt)),qe=we):mt>=we&&(Oe=Be+Math.round(bt*((we-qe)/Rt)),mt=we),Te&&Be===Te[Te.length-1][0]&&qe===Te[Te.length-1][1]||(Te=[[Be,qe]],ge.push(Te)),Te.push([Oe,mt])))))}}var ui,pr,_r,Ii={exports:{}},$r=function(){if(_r)return Ii.exports;_r=1;var $e=o.fg(),U=function(){if(pr)return ui;pr=1;var qe=o.fe(),Oe=o.ff().VectorTileFeature;function mt(Rt,Qt){this.options=Qt||{},this.features=Rt,this.length=Rt.length}function bt(Rt,Qt){this.id=typeof Rt.id=="number"?Rt.id:void 0,this.type=Rt.type,this.rawGeometry=Rt.type===1?[Rt.geometry]:Rt.geometry,this.properties=Rt.tags,this.extent=Qt||4096}return ui=mt,mt.prototype.feature=function(Rt){return new bt(this.features[Rt],this.options.extent)},bt.prototype.loadGeometry=function(){var Rt=this.rawGeometry;this.geometry=[];for(var Qt=0;Qt<Rt.length;Qt++){for(var ni=Rt[Qt],hi=[],_i=0;_i<ni.length;_i++)hi.push(new qe(ni[_i][0],ni[_i][1]));this.geometry.push(hi)}return this.geometry},bt.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Rt=this.geometry,Qt=1/0,ni=-1/0,hi=1/0,_i=-1/0,Rr=0;Rr<Rt.length;Rr++)for(var yi=Rt[Rr],nr=0;nr<yi.length;nr++){var Li=yi[nr];Qt=Math.min(Qt,Li.x),ni=Math.max(ni,Li.x),hi=Math.min(hi,Li.y),_i=Math.max(_i,Li.y)}return[Qt,hi,ni,_i]},bt.prototype.toGeoJSON=Oe.prototype.toGeoJSON,ui}();function Z(qe){var Oe=new $e;return function(mt,bt){for(var Rt in mt.layers)bt.writeMessage(3,se,mt.layers[Rt])}(qe,Oe),Oe.finish()}function se(qe,Oe){var mt;Oe.writeVarintField(15,qe.version||1),Oe.writeStringField(1,qe.name||""),Oe.writeVarintField(5,qe.extent||4096);var bt={keys:[],values:[],keycache:{},valuecache:{}};for(mt=0;mt<qe.length;mt++)bt.feature=qe.feature(mt),Oe.writeMessage(2,ge,bt);var Rt=bt.keys;for(mt=0;mt<Rt.length;mt++)Oe.writeStringField(3,Rt[mt]);var Qt=bt.values;for(mt=0;mt<Qt.length;mt++)Oe.writeMessage(4,Be,Qt[mt])}function ge(qe,Oe){var mt=qe.feature;mt.id!==void 0&&Oe.writeVarintField(1,mt.id),Oe.writeMessage(2,pe,qe),Oe.writeVarintField(3,mt.type),Oe.writeMessage(4,Ae,mt)}function pe(qe,Oe){var mt=qe.feature,bt=qe.keys,Rt=qe.values,Qt=qe.keycache,ni=qe.valuecache;for(var hi in mt.properties){var _i=mt.properties[hi],Rr=Qt[hi];if(_i!==null){Rr===void 0&&(bt.push(hi),Qt[hi]=Rr=bt.length-1),Oe.writeVarint(Rr);var yi=typeof _i;yi!=="string"&&yi!=="boolean"&&yi!=="number"&&(_i=JSON.stringify(_i));var nr=yi+":"+_i,Li=ni[nr];Li===void 0&&(Rt.push(_i),ni[nr]=Li=Rt.length-1),Oe.writeVarint(Li)}}}function we(qe,Oe){return(Oe<<3)+(7&qe)}function Te(qe){return qe<<1^qe>>31}function Ae(qe,Oe){for(var mt=qe.loadGeometry(),bt=qe.type,Rt=0,Qt=0,ni=mt.length,hi=0;hi<ni;hi++){var _i=mt[hi],Rr=1;bt===1&&(Rr=_i.length),Oe.writeVarint(we(1,Rr));for(var yi=bt===3?_i.length-1:_i.length,nr=0;nr<yi;nr++){nr===1&&bt!==1&&Oe.writeVarint(we(2,yi-1));var Li=_i[nr].x-Rt,or=_i[nr].y-Qt;Oe.writeVarint(Te(Li)),Oe.writeVarint(Te(or)),Rt+=Li,Qt+=or}bt===3&&Oe.writeVarint(we(7,1))}}function Be(qe,Oe){var mt=typeof qe;mt==="string"?Oe.writeStringField(1,qe):mt==="boolean"?Oe.writeBooleanField(7,qe):mt==="number"&&(qe%1!=0?Oe.writeDoubleField(3,qe):qe<0?Oe.writeSVarintField(6,qe):Oe.writeVarintField(5,qe))}return Ii.exports=Z,Ii.exports.fromVectorTileJs=Z,Ii.exports.fromGeojsonVt=function(qe,Oe){Oe=Oe||{};var mt={};for(var bt in qe)mt[bt]=new U(qe[bt].features,Oe),mt[bt].name=bt,mt[bt].version=Oe.version,mt[bt].extent=Oe.extent;return Z({layers:mt})},Ii.exports.GeoJSONWrapper=U,Ii.exports}(),gn=o.fh($r);const Yn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:$e=>$e},ho=Math.fround||(Ui=new Float32Array(1),$e=>(Ui[0]=+$e,Ui[0]));var Ui;const Zi=3,Lr=5,Uo=6;class gr{constructor(U){this.options=Object.assign(Object.create(Yn),U),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(U){const{log:Z,minZoom:se,maxZoom:ge}=this.options;Z&&console.time("total time");const pe=`prepare ${U.length} points`;Z&&console.time(pe),this.points=U;const we=[];for(let Ae=0;Ae<U.length;Ae++){const Be=U[Ae];if(!Be.geometry)continue;const[qe,Oe]=Be.geometry.coordinates,mt=ho(Qi(qe)),bt=ho(Ei(Oe));we.push(mt,bt,1/0,Ae,-1,1),this.options.reduce&&we.push(0)}let Te=this.trees[ge+1]=this._createTree(we);Z&&console.timeEnd(pe);for(let Ae=ge;Ae>=se;Ae--){const Be=+Date.now();Te=this.trees[Ae]=this._createTree(this._cluster(Te,Ae)),Z&&console.log("z%d: %d clusters in %dms",Ae,Te.numItems,+Date.now()-Be)}return Z&&console.timeEnd("total time"),this}getClusters(U,Z){let se=((U[0]+180)%360+360)%360-180;const ge=Math.max(-90,Math.min(90,U[1]));let pe=U[2]===180?180:((U[2]+180)%360+360)%360-180;const we=Math.max(-90,Math.min(90,U[3]));if(U[2]-U[0]>=360)se=-180,pe=180;else if(se>pe){const Oe=this.getClusters([se,ge,180,we],Z),mt=this.getClusters([-180,ge,pe,we],Z);return Oe.concat(mt)}const Te=this.trees[this._limitZoom(Z)],Ae=Te.range(Qi(se),Ei(we),Qi(pe),Ei(ge)),Be=Te.data,qe=[];for(const Oe of Ae){const mt=this.stride*Oe;qe.push(Be[mt+Lr]>1?Kn(Be,mt,this.clusterProps):this.points[Be[mt+Zi]])}return qe}getChildren(U){const Z=this._getOriginId(U),se=this._getOriginZoom(U),ge="No cluster with the specified id.",pe=this.trees[se];if(!pe)throw new Error(ge);const we=pe.data;if(Z*this.stride>=we.length)throw new Error(ge);const Te=this.options.radius/(this.options.extent*Math.pow(2,se-1)),Ae=pe.within(we[Z*this.stride],we[Z*this.stride+1],Te),Be=[];for(const qe of Ae){const Oe=qe*this.stride;we[Oe+4]===U&&Be.push(we[Oe+Lr]>1?Kn(we,Oe,this.clusterProps):this.points[we[Oe+Zi]])}if(Be.length===0)throw new Error(ge);return Be}getLeaves(U,Z,se){const ge=[];return this._appendLeaves(ge,U,Z=Z||10,se=se||0,0),ge}getTile(U,Z,se){const ge=this.trees[this._limitZoom(U)],pe=Math.pow(2,U),{extent:we,radius:Te}=this.options,Ae=Te/we,Be=(se-Ae)/pe,qe=(se+1+Ae)/pe,Oe={features:[]};return this._addTileFeatures(ge.range((Z-Ae)/pe,Be,(Z+1+Ae)/pe,qe),ge.data,Z,se,pe,Oe),Z===0&&this._addTileFeatures(ge.range(1-Ae/pe,Be,1,qe),ge.data,pe,se,pe,Oe),Z===pe-1&&this._addTileFeatures(ge.range(0,Be,Ae/pe,qe),ge.data,-1,se,pe,Oe),Oe.features.length?Oe:null}getClusterExpansionZoom(U){let Z=this._getOriginZoom(U)-1;for(;Z<=this.options.maxZoom;){const se=this.getChildren(U);if(Z++,se.length!==1)break;U=se[0].properties.cluster_id}return Z}_appendLeaves(U,Z,se,ge,pe){const we=this.getChildren(Z);for(const Te of we){const Ae=Te.properties;if(Ae&&Ae.cluster?pe+Ae.point_count<=ge?pe+=Ae.point_count:pe=this._appendLeaves(U,Ae.cluster_id,se,ge,pe):pe<ge?pe++:U.push(Te),U.length===se)break}return pe}_createTree(U){const Z=new o.bW(U.length/this.stride|0,this.options.nodeSize,Float32Array);for(let se=0;se<U.length;se+=this.stride)Z.add(U[se],U[se+1]);return Z.finish(),Z.data=U,Z}_addTileFeatures(U,Z,se,ge,pe,we){for(const Te of U){const Ae=Te*this.stride,Be=Z[Ae+Lr]>1;let qe,Oe,mt;if(Be)qe=oo(Z,Ae,this.clusterProps),Oe=Z[Ae],mt=Z[Ae+1];else{const Qt=this.points[Z[Ae+Zi]];qe=Qt.properties;const[ni,hi]=Qt.geometry.coordinates;Oe=Qi(ni),mt=Ei(hi)}const bt={type:1,geometry:[[Math.round(this.options.extent*(Oe*pe-se)),Math.round(this.options.extent*(mt*pe-ge))]],tags:qe};let Rt;Rt=Be||this.options.generateId?Z[Ae+Zi]:this.points[Z[Ae+Zi]].id,Rt!==void 0&&(bt.id=Rt),we.features.push(bt)}}_limitZoom(U){return Math.max(this.options.minZoom,Math.min(Math.floor(+U),this.options.maxZoom+1))}_cluster(U,Z){const{radius:se,extent:ge,reduce:pe,minPoints:we}=this.options,Te=se/(ge*Math.pow(2,Z)),Ae=U.data,Be=[],qe=this.stride;for(let Oe=0;Oe<Ae.length;Oe+=qe){if(Ae[Oe+2]<=Z)continue;Ae[Oe+2]=Z;const mt=Ae[Oe],bt=Ae[Oe+1],Rt=U.within(Ae[Oe],Ae[Oe+1],Te),Qt=Ae[Oe+Lr];let ni=Qt;for(const hi of Rt){const _i=hi*qe;Ae[_i+2]>Z&&(ni+=Ae[_i+Lr])}if(ni>Qt&&ni>=we){let hi,_i=mt*Qt,Rr=bt*Qt,yi=-1;const nr=(Oe/qe<<5)+(Z+1)+this.points.length;for(const Li of Rt){const or=Li*qe;if(Ae[or+2]<=Z)continue;Ae[or+2]=Z;const lr=Ae[or+Lr];_i+=Ae[or]*lr,Rr+=Ae[or+1]*lr,Ae[or+4]=nr,pe&&(hi||(hi=this._map(Ae,Oe,!0),yi=this.clusterProps.length,this.clusterProps.push(hi)),pe(hi,this._map(Ae,or)))}Ae[Oe+4]=nr,Be.push(_i/ni,Rr/ni,1/0,nr,-1,ni),pe&&Be.push(yi)}else{for(let hi=0;hi<qe;hi++)Be.push(Ae[Oe+hi]);if(ni>1)for(const hi of Rt){const _i=hi*qe;if(!(Ae[_i+2]<=Z)){Ae[_i+2]=Z;for(let Rr=0;Rr<qe;Rr++)Be.push(Ae[_i+Rr])}}}}return Be}_getOriginId(U){return U-this.points.length>>5}_getOriginZoom(U){return(U-this.points.length)%32}_map(U,Z,se){if(U[Z+Lr]>1){const we=this.clusterProps[U[Z+Uo]];return se?Object.assign({},we):we}const ge=this.points[U[Z+Zi]].properties,pe=this.options.map(ge);return se&&pe===ge?Object.assign({},pe):pe}}function Kn($e,U,Z){return{type:"Feature",id:$e[U+Zi],properties:oo($e,U,Z),geometry:{type:"Point",coordinates:[(se=$e[U],360*(se-.5)),un($e[U+1])]}};var se}function oo($e,U,Z){const se=$e[U+Lr],ge=se>=1e4?`${Math.round(se/1e3)}k`:se>=1e3?Math.round(se/100)/10+"k":se,pe=$e[U+Uo],we=pe===-1?{}:Object.assign({},Z[pe]);return Object.assign(we,{cluster:!0,cluster_id:$e[U+Zi],point_count:se,point_count_abbreviated:ge})}function Qi($e){return $e/360+.5}function Ei($e){const U=Math.sin($e*Math.PI/180),Z=.5-.25*Math.log((1+U)/(1-U))/Math.PI;return Z<0?0:Z>1?1:Z}function un($e){const U=(180-360*$e)*Math.PI/180;return 360*Math.atan(Math.exp(U))/Math.PI-90}function wr($e,U,Z,se){let ge=se;const pe=U+(Z-U>>1);let we,Te=Z-U;const Ae=$e[U],Be=$e[U+1],qe=$e[Z],Oe=$e[Z+1];for(let mt=U+3;mt<Z;mt+=3){const bt=Br($e[mt],$e[mt+1],Ae,Be,qe,Oe);if(bt>ge)we=mt,ge=bt;else if(bt===ge){const Rt=Math.abs(mt-pe);Rt<Te&&(we=mt,Te=Rt)}}ge>se&&(we-U>3&&wr($e,U,we,se),$e[we+2]=ge,Z-we>3&&wr($e,we,Z,se))}function Br($e,U,Z,se,ge,pe){let we=ge-Z,Te=pe-se;if(we!==0||Te!==0){const Ae=(($e-Z)*we+(U-se)*Te)/(we*we+Te*Te);Ae>1?(Z=ge,se=pe):Ae>0&&(Z+=we*Ae,se+=Te*Ae)}return we=$e-Z,Te=U-se,we*we+Te*Te}function En($e,U,Z,se){const ge={id:$e??null,type:U,geometry:Z,tags:se,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(U==="Point"||U==="MultiPoint"||U==="LineString")Gr(ge,Z);else if(U==="Polygon")Gr(ge,Z[0]);else if(U==="MultiLineString")for(const pe of Z)Gr(ge,pe);else if(U==="MultiPolygon")for(const pe of Z)Gr(ge,pe[0]);return ge}function Gr($e,U){for(let Z=0;Z<U.length;Z+=3)$e.minX=Math.min($e.minX,U[Z]),$e.minY=Math.min($e.minY,U[Z+1]),$e.maxX=Math.max($e.maxX,U[Z]),$e.maxY=Math.max($e.maxY,U[Z+1])}function Dr($e,U,Z,se){if(!U.geometry)return;const ge=U.geometry.coordinates;if(ge&&ge.length===0)return;const pe=U.geometry.type,we=Math.pow(Z.tolerance/((1<<Z.maxZoom)*Z.extent),2);let Te=[],Ae=U.id;if(Z.promoteId?Ae=U.properties[Z.promoteId]:Z.generateId&&(Ae=se||0),pe==="Point")an(ge,Te);else if(pe==="MultiPoint")for(const Be of ge)an(Be,Te);else if(pe==="LineString")On(ge,Te,we,!1);else if(pe==="MultiLineString"){if(Z.lineMetrics){for(const Be of ge)Te=[],On(Be,Te,we,!1),$e.push(En(Ae,"LineString",Te,U.properties));return}po(ge,Te,we,!1)}else if(pe==="Polygon")po(ge,Te,we,!0);else{if(pe!=="MultiPolygon"){if(pe==="GeometryCollection"){for(const Be of U.geometry.geometries)Dr($e,{id:Ae,geometry:Be,properties:U.properties},Z,se);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Be of ge){const qe=[];po(Be,qe,we,!0),Te.push(qe)}}$e.push(En(Ae,pe,Te,U.properties))}function an($e,U){U.push($o($e[0]),Hr($e[1]),0)}function On($e,U,Z,se){let ge,pe,we=0;for(let Ae=0;Ae<$e.length;Ae++){const Be=$o($e[Ae][0]),qe=Hr($e[Ae][1]);U.push(Be,qe,0),Ae>0&&(we+=se?(ge*qe-Be*pe)/2:Math.sqrt(Math.pow(Be-ge,2)+Math.pow(qe-pe,2))),ge=Be,pe=qe}const Te=U.length-3;U[2]=1,wr(U,0,Te,Z),U[Te+2]=1,U.size=Math.abs(we),U.start=0,U.end=U.size}function po($e,U,Z,se){for(let ge=0;ge<$e.length;ge++){const pe=[];On($e[ge],pe,Z,se),U.push(pe)}}function $o($e){return $e/360+.5}function Hr($e){const U=Math.sin($e*Math.PI/180),Z=.5-.25*Math.log((1+U)/(1-U))/Math.PI;return Z<0?0:Z>1?1:Z}function ln($e,U,Z,se,ge,pe,we,Te){if(se/=U,pe>=(Z/=U)&&we<se)return $e;if(we<Z||pe>=se)return null;const Ae=[];for(const Be of $e){const qe=Be.geometry;let Oe=Be.type;const mt=ge===0?Be.minX:Be.minY,bt=ge===0?Be.maxX:Be.maxY;if(mt>=Z&&bt<se){Ae.push(Be);continue}if(bt<Z||mt>=se)continue;let Rt=[];if(Oe==="Point"||Oe==="MultiPoint")cs(qe,Rt,Z,se,ge);else if(Oe==="LineString")us(qe,Rt,Z,se,ge,!1,Te.lineMetrics);else if(Oe==="MultiLineString")Ho(qe,Rt,Z,se,ge,!1);else if(Oe==="Polygon")Ho(qe,Rt,Z,se,ge,!0);else if(Oe==="MultiPolygon")for(const Qt of qe){const ni=[];Ho(Qt,ni,Z,se,ge,!0),ni.length&&Rt.push(ni)}if(Rt.length){if(Te.lineMetrics&&Oe==="LineString"){for(const Qt of Rt)Ae.push(En(Be.id,Oe,Qt,Be.tags));continue}Oe!=="LineString"&&Oe!=="MultiLineString"||(Rt.length===1?(Oe="LineString",Rt=Rt[0]):Oe="MultiLineString"),Oe!=="Point"&&Oe!=="MultiPoint"||(Oe=Rt.length===3?"Point":"MultiPoint"),Ae.push(En(Be.id,Oe,Rt,Be.tags))}}return Ae.length?Ae:null}function cs($e,U,Z,se,ge){for(let pe=0;pe<$e.length;pe+=3){const we=$e[pe+ge];we>=Z&&we<=se&&hs(U,$e[pe],$e[pe+1],$e[pe+2])}}function us($e,U,Z,se,ge,pe,we){let Te=Go($e);const Ae=ge===0?Hn:ga;let Be,qe,Oe=$e.start;for(let ni=0;ni<$e.length-3;ni+=3){const hi=$e[ni],_i=$e[ni+1],Rr=$e[ni+2],yi=$e[ni+3],nr=$e[ni+4],Li=ge===0?hi:_i,or=ge===0?yi:nr;let lr=!1;we&&(Be=Math.sqrt(Math.pow(hi-yi,2)+Math.pow(_i-nr,2))),Li<Z?or>Z&&(qe=Ae(Te,hi,_i,yi,nr,Z),we&&(Te.start=Oe+Be*qe)):Li>se?or<se&&(qe=Ae(Te,hi,_i,yi,nr,se),we&&(Te.start=Oe+Be*qe)):hs(Te,hi,_i,Rr),or<Z&&Li>=Z&&(qe=Ae(Te,hi,_i,yi,nr,Z),lr=!0),or>se&&Li<=se&&(qe=Ae(Te,hi,_i,yi,nr,se),lr=!0),!pe&&lr&&(we&&(Te.end=Oe+Be*qe),U.push(Te),Te=Go($e)),we&&(Oe+=Be)}let mt=$e.length-3;const bt=$e[mt],Rt=$e[mt+1],Qt=ge===0?bt:Rt;Qt>=Z&&Qt<=se&&hs(Te,bt,Rt,$e[mt+2]),mt=Te.length-3,pe&&mt>=3&&(Te[mt]!==Te[0]||Te[mt+1]!==Te[1])&&hs(Te,Te[0],Te[1],Te[2]),Te.length&&U.push(Te)}function Go($e){const U=[];return U.size=$e.size,U.start=$e.start,U.end=$e.end,U}function Ho($e,U,Z,se,ge,pe){for(const we of $e)us(we,U,Z,se,ge,pe,!1)}function hs($e,U,Z,se){$e.push(U,Z,se)}function Hn($e,U,Z,se,ge,pe){const we=(pe-U)/(se-U);return hs($e,pe,Z+(ge-Z)*we,1),we}function ga($e,U,Z,se,ge,pe){const we=(pe-Z)/(ge-Z);return hs($e,U+(se-U)*we,pe,1),we}function Bs($e,U){const Z=[];for(let se=0;se<$e.length;se++){const ge=$e[se],pe=ge.type;let we;if(pe==="Point"||pe==="MultiPoint"||pe==="LineString")we=qo(ge.geometry,U);else if(pe==="MultiLineString"||pe==="Polygon"){we=[];for(const Te of ge.geometry)we.push(qo(Te,U))}else if(pe==="MultiPolygon"){we=[];for(const Te of ge.geometry){const Ae=[];for(const Be of Te)Ae.push(qo(Be,U));we.push(Ae)}}Z.push(En(ge.id,pe,we,ge.tags))}return Z}function qo($e,U){const Z=[];Z.size=$e.size,$e.start!==void 0&&(Z.start=$e.start,Z.end=$e.end);for(let se=0;se<$e.length;se+=3)Z.push($e[se]+U,$e[se+1],$e[se+2]);return Z}function ya($e,U){if($e.transformed)return $e;const Z=1<<$e.z,se=$e.x,ge=$e.y;for(const pe of $e.features){const we=pe.geometry,Te=pe.type;if(pe.geometry=[],Te===1)for(let Ae=0;Ae<we.length;Ae+=2)pe.geometry.push(va(we[Ae],we[Ae+1],U,Z,se,ge));else for(let Ae=0;Ae<we.length;Ae++){const Be=[];for(let qe=0;qe<we[Ae].length;qe+=2)Be.push(va(we[Ae][qe],we[Ae][qe+1],U,Z,se,ge));pe.geometry.push(Be)}}return $e.transformed=!0,$e}function va($e,U,Z,se,ge,pe){return[Math.round(Z*($e*se-ge)),Math.round(Z*(U*se-pe))]}function sc($e,U,Z,se,ge){const pe=U===ge.maxZoom?0:ge.tolerance/((1<<U)*ge.extent),we={features:[],numPoints:0,numSimplified:0,numFeatures:$e.length,source:null,x:Z,y:se,z:U,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Te of $e)Ar(we,Te,pe,ge);return we}function Ar($e,U,Z,se){const ge=U.geometry,pe=U.type,we=[];if($e.minX=Math.min($e.minX,U.minX),$e.minY=Math.min($e.minY,U.minY),$e.maxX=Math.max($e.maxX,U.maxX),$e.maxY=Math.max($e.maxY,U.maxY),pe==="Point"||pe==="MultiPoint")for(let Te=0;Te<ge.length;Te+=3)we.push(ge[Te],ge[Te+1]),$e.numPoints++,$e.numSimplified++;else if(pe==="LineString")Zo(we,ge,$e,Z,!1,!1);else if(pe==="MultiLineString"||pe==="Polygon")for(let Te=0;Te<ge.length;Te++)Zo(we,ge[Te],$e,Z,pe==="Polygon",Te===0);else if(pe==="MultiPolygon")for(let Te=0;Te<ge.length;Te++){const Ae=ge[Te];for(let Be=0;Be<Ae.length;Be++)Zo(we,Ae[Be],$e,Z,!0,Be===0)}if(we.length){let Te=U.tags||null;if(pe==="LineString"&&se.lineMetrics){Te={};for(const Be in U.tags)Te[Be]=U.tags[Be];Te.mapbox_clip_start=ge.start/ge.size,Te.mapbox_clip_end=ge.end/ge.size}const Ae={geometry:we,type:pe==="Polygon"||pe==="MultiPolygon"?3:pe==="LineString"||pe==="MultiLineString"?2:1,tags:Te};U.id!==null&&(Ae.id=U.id),$e.features.push(Ae)}}function Zo($e,U,Z,se,ge,pe){const we=se*se;if(se>0&&U.size<(ge?we:se))return void(Z.numPoints+=U.length/3);const Te=[];for(let Ae=0;Ae<U.length;Ae+=3)(se===0||U[Ae+2]>we)&&(Z.numSimplified++,Te.push(U[Ae],U[Ae+1])),Z.numPoints++;ge&&function(Ae,Be){let qe=0;for(let Oe=0,mt=Ae.length,bt=mt-2;Oe<mt;bt=Oe,Oe+=2)qe+=(Ae[Oe]-Ae[bt])*(Ae[Oe+1]+Ae[bt+1]);if(qe>0===Be)for(let Oe=0,mt=Ae.length;Oe<mt/2;Oe+=2){const bt=Ae[Oe],Rt=Ae[Oe+1];Ae[Oe]=Ae[mt-2-Oe],Ae[Oe+1]=Ae[mt-1-Oe],Ae[mt-2-Oe]=bt,Ae[mt-1-Oe]=Rt}}(Te,pe),$e.push(Te)}const ol={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class fo{constructor(U,Z){const se=(Z=this.options=function(pe,we){for(const Te in we)pe[Te]=we[Te];return pe}(Object.create(ol),Z)).debug;if(se&&console.time("preprocess data"),Z.maxZoom<0||Z.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Z.promoteId&&Z.generateId)throw new Error("promoteId and generateId cannot be used together.");let ge=function(pe,we){const Te=[];if(pe.type==="FeatureCollection")for(let Ae=0;Ae<pe.features.length;Ae++)Dr(Te,pe.features[Ae],we,Ae);else Dr(Te,pe.type==="Feature"?pe:{geometry:pe},we);return Te}(U,Z);this.tiles={},this.tileCoords=[],se&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Z.indexMaxZoom,Z.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ge=function(pe,we){const Te=we.buffer/we.extent;let Ae=pe;const Be=ln(pe,1,-1-Te,Te,0,-1,2,we),qe=ln(pe,1,1-Te,2+Te,0,-1,2,we);return(Be||qe)&&(Ae=ln(pe,1,-Te,1+Te,0,-1,2,we)||[],Be&&(Ae=Bs(Be,1).concat(Ae)),qe&&(Ae=Ae.concat(Bs(qe,-1)))),Ae}(ge,Z),ge.length&&this.splitTile(ge,0,0,0),se&&(ge.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(U,Z,se,ge,pe,we,Te){const Ae=[U,Z,se,ge],Be=this.options,qe=Be.debug;for(;Ae.length;){ge=Ae.pop(),se=Ae.pop(),Z=Ae.pop(),U=Ae.pop();const Oe=1<<Z,mt=ac(Z,se,ge);let bt=this.tiles[mt];if(!bt&&(qe>1&&console.time("creation"),bt=this.tiles[mt]=sc(U,Z,se,ge,Be),this.tileCoords.push({z:Z,x:se,y:ge}),qe)){qe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Z,se,ge,bt.numFeatures,bt.numPoints,bt.numSimplified),console.timeEnd("creation"));const lr=`z${Z}`;this.stats[lr]=(this.stats[lr]||0)+1,this.total++}if(bt.source=U,pe==null){if(Z===Be.indexMaxZoom||bt.numPoints<=Be.indexMaxPoints)continue}else{if(Z===Be.maxZoom||Z===pe)continue;if(pe!=null){const lr=pe-Z;if(se!==we>>lr||ge!==Te>>lr)continue}}if(bt.source=null,U.length===0)continue;qe>1&&console.time("clipping");const Rt=.5*Be.buffer/Be.extent,Qt=.5-Rt,ni=.5+Rt,hi=1+Rt;let _i=null,Rr=null,yi=null,nr=null,Li=ln(U,Oe,se-Rt,se+ni,0,bt.minX,bt.maxX,Be),or=ln(U,Oe,se+Qt,se+hi,0,bt.minX,bt.maxX,Be);U=null,Li&&(_i=ln(Li,Oe,ge-Rt,ge+ni,1,bt.minY,bt.maxY,Be),Rr=ln(Li,Oe,ge+Qt,ge+hi,1,bt.minY,bt.maxY,Be),Li=null),or&&(yi=ln(or,Oe,ge-Rt,ge+ni,1,bt.minY,bt.maxY,Be),nr=ln(or,Oe,ge+Qt,ge+hi,1,bt.minY,bt.maxY,Be),or=null),qe>1&&console.timeEnd("clipping"),Ae.push(_i||[],Z+1,2*se,2*ge),Ae.push(Rr||[],Z+1,2*se,2*ge+1),Ae.push(yi||[],Z+1,2*se+1,2*ge),Ae.push(nr||[],Z+1,2*se+1,2*ge+1)}}getTile(U,Z,se){U=+U,Z=+Z,se=+se;const ge=this.options,{extent:pe,debug:we}=ge;if(U<0||U>24)return null;const Te=1<<U,Ae=ac(U,Z=Z+Te&Te-1,se);if(this.tiles[Ae])return ya(this.tiles[Ae],pe);we>1&&console.log("drilling down to z%d-%d-%d",U,Z,se);let Be,qe=U,Oe=Z,mt=se;for(;!Be&&qe>0;)qe--,Oe>>=1,mt>>=1,Be=this.tiles[ac(qe,Oe,mt)];return Be&&Be.source?(we>1&&(console.log("found parent tile z%d-%d-%d",qe,Oe,mt),console.time("drilling down")),this.splitTile(Be.source,qe,Oe,mt,U,Z,se),we>1&&console.timeEnd("drilling down"),this.tiles[Ae]?ya(this.tiles[Ae],pe):null):null}}function ac($e,U,Z){return 32*((1<<$e)*Z+U)+$e}function Pu($e,U){const Z=$e.tileID.canonical;if(!this._geoJSONIndex)return void U(null,null);const se=this._geoJSONIndex.getTile(Z.z,Z.x,Z.y);if(!se)return void U(null,null);const ge=new xt(se.features);let pe=gn(ge);pe.byteOffset===0&&pe.byteLength===pe.buffer.byteLength||(pe=new Uint8Array(pe)),U(null,{vectorTile:ge,rawData:pe.buffer})}class lc extends ze{constructor(U,Z,se,ge,pe,we,Te){super(U,Z,se,ge,pe,Pu,Te),we&&(this.loadGeoJSON=we),this._dynamicIndex=new Wt}loadData(U,Z){const se=U&&U.request,ge=se&&se.collectResourceTiming;this.loadGeoJSON(U,(pe,we)=>{if(pe||!we)return Z(pe);if(typeof we!="object")return Z(new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`));{try{if(U.filter){const Ae=o.X(U.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Ae.result==="error")throw new Error(Ae.value.map(Be=>`${Be.key}: ${Be.message}`).join(", "));we.features=we.features.filter(Be=>Ae.value.evaluate({zoom:0},Be))}U.dynamic?(we.type==="Feature"&&(we={type:"FeatureCollection",features:[we]}),U.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(we.features,this.loaded),U.cluster&&(we.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=U.cluster?new gr(function({superclusterOptions:Ae,clusterProperties:Be}){if(!Be||!Ae)return Ae;const qe={},Oe={},mt={accumulated:null,zoom:0},bt={properties:null},Rt=Object.keys(Be);for(const Qt of Rt){const[ni,hi]=Be[Qt],_i=o.X(hi),Rr=o.X(typeof ni=="string"?[ni,["accumulated"],["get",Qt]]:ni);qe[Qt]=_i.value,Oe[Qt]=Rr.value}return Ae.map=Qt=>{bt.properties=Qt;const ni={};for(const hi of Rt)ni[hi]=qe[hi].evaluate(mt,bt);return ni},Ae.reduce=(Qt,ni)=>{bt.properties=ni;for(const hi of Rt)mt.accumulated=Qt[hi],Qt[hi]=Oe[hi].evaluate(mt,bt)},Ae}(U)).load(we.features):U.dynamic?this._dynamicIndex:function(Ae,Be){return new fo(Ae,Be)}(we,U.geojsonVtOptions)}catch(Ae){return Z(Ae)}const Te={};if(ge){const Ae=re(se);Ae&&(Te.resourceTiming={},Te.resourceTiming[U.source]=JSON.parse(JSON.stringify(Ae)))}Z(null,Te)}})}reloadTile(U,Z){const se=this.loaded;return se&&se[U.uid]?U.partial?Z(null,void 0):super.reloadTile(U,Z):this.loadTile(U,Z)}loadGeoJSON(U,Z){if(U.request)o.n(U.request,Z);else{if(typeof U.data!="string")return Z(new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`));try{return Z(null,JSON.parse(U.data))}catch{return Z(new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(U,Z){try{Z(null,this._geoJSONIndex.getClusterExpansionZoom(U.clusterId))}catch(se){Z(se)}}getClusterChildren(U,Z){try{Z(null,this._geoJSONIndex.getChildren(U.clusterId))}catch(se){Z(se)}}getClusterLeaves(U,Z){try{Z(null,this._geoJSONIndex.getLeaves(U.clusterId,U.limit,U.offset))}catch(se){Z(se)}}}class ft{constructor(U,Z){this.tileID=new o.aM(U.tileID.overscaledZ,U.tileID.wrap,U.tileID.canonical.z,U.tileID.canonical.x,U.tileID.canonical.y),this.tileZoom=U.tileZoom,this.uid=U.uid,this.zoom=U.zoom,this.canonical=U.tileID.canonical,this.pixelRatio=U.pixelRatio,this.tileSize=U.tileSize,this.source=U.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=U.projection,this.brightness=Z}parse(U,Z,se,ge){this.status="parsing";const pe=new o.aM(se.tileID.overscaledZ,se.tileID.wrap,se.tileID.canonical.z,se.tileID.canonical.x,se.tileID.canonical.y),we=[],Te=Z.familiesBySource[se.source],Ae=new o.f0(pe,se.promoteId);Ae.bucketLayerIDs=[],Ae.is3DTile=!0,o.fi(U).then(Be=>{if(!Be)return ge(new Error("Could not parse tile"));const qe=o.fj(Be,1/o.cT(se.tileID.canonical)),Oe=Be.json.extensionsUsed&&Be.json.extensionsUsed.includes("MAPBOX_mesh_features")||Be.json.asset.extras&&Be.json.asset.extras.MAPBOX_mesh_features,mt=Be.json.extensionsUsed&&Be.json.extensionsUsed.includes("EXT_meshopt_compression"),bt=new o.aa(this.zoom,{brightness:this.brightness});for(const Rt in Te)for(const Qt of Te[Rt]){const ni=Qt[0];Ae.bucketLayerIDs.push(Qt.map(_i=>o.C(_i.id,_i.scope))),ni.recalculate(bt,[]);const hi=new o.fk(Qt,qe,pe,Oe,mt,this.brightness,Ae);Oe||(hi.needsUpload=!0),we.push(hi),hi.evaluate(ni)}this.status="done",ge(null,{buckets:we,featureIndex:Ae,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Be=>ge(new Error(Be.message)))}}class ds{constructor(U,Z,se,ge,pe,we,Te){this.actor=U,this.layerIndex=Z,this.availableImages=se,this.availableModels=ge,this.brightness=Te,this.loading={},this.loaded={}}loadTile(U,Z){const se=U.uid,ge=this.loading[se]=new ft(U,this.brightness);o.br(U.request,(pe,we)=>{const Te=!this.loading[se];return delete this.loading[se],Te||pe?(ge.status="done",Te||(this.loaded[se]=ge),Z(pe)):we&&we.byteLength!==0?void ge.parse(we,this.layerIndex,U,(Ae,Be)=>{ge.status="done",this.loaded=this.loaded||{},this.loaded[se]=ge,Ae||!Be?Z(Ae):Z(null,Be)}):(ge.status="done",this.loaded[se]=ge,Z())})}reloadTile(U,Z){const se=this.loaded,ge=U.uid;if(se&&se[ge]){const pe=se[ge];pe.projection=U.projection,pe.brightness=U.brightness;const we=(Te,Ae)=>{pe.reloadCallback&&(delete pe.reloadCallback,this.loadTile(U,Z)),Z(Te,Ae)};pe.status==="parsing"?pe.reloadCallback=we:pe.status==="done"&&this.loadTile(U,Z)}}abortTile(U,Z){const se=U.uid;this.loading[se]&&delete this.loading[se],Z()}removeTile(U,Z){const se=this.loaded,ge=U.uid;se&&se[ge]&&delete se[ge],Z()}}class Du{constructor(U){this.self=U,this.actor=new o.fm(U,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new o.y,this.projections={},this.defaultProjection=o.ce({name:"mercator"}),this.workerSourceTypes={vector:ze,geojson:lc,"raster-dem":Se,"raster-array":nt,"batched-model":ds},this.workerSources={},this.self.registerWorkerSource=(Z,se)=>{if(this.workerSourceTypes[Z])throw new Error(`Worker source with name "${Z}" already registered.`);this.workerSourceTypes[Z]=se},this.self.registerRTLTextPlugin=Z=>{if(o.fn.isParsed())throw new Error("RTL text plugin already registered.");o.fn.applyArabicShaping=Z.applyArabicShaping,o.fn.processBidirectionalText=Z.processBidirectionalText,o.fn.processStyledBidirectionalText=Z.processStyledBidirectionalText}}clearCaches(U,Z,se){delete this.layerIndexes[U],delete this.availableImages[U],delete this.availableModels[U],delete this.workerSources[U],se()}checkIfReady(U,Z,se){se()}setReferrer(U,Z){this.referrer=Z}spriteLoaded(U,Z){this.isSpriteLoaded[U]||(this.isSpriteLoaded[U]={});const{scope:se,isLoaded:ge}=Z;if(this.isSpriteLoaded[U][se]=ge,this.workerSources[U]&&this.workerSources[U][se])for(const pe in this.workerSources[U][se]){const we=this.workerSources[U][se][pe];for(const Te in we){const Ae=we[Te];Ae instanceof ze&&(Ae.isSpriteLoaded=ge,Ae.fire(new o.A("isSpriteLoaded")))}}}setImages(U,Z,se){this.availableImages[U]||(this.availableImages[U]={});const{scope:ge,images:pe}=Z;if(this.availableImages[U][ge]=pe,this.workerSources[U]&&this.workerSources[U][ge]){for(const we in this.workerSources[U][ge]){const Te=this.workerSources[U][ge][we];for(const Ae in Te)Te[Ae].availableImages=pe}se()}else se()}setModels(U,{scope:Z,models:se},ge){if(this.availableModels[U]||(this.availableModels[U]={}),this.availableModels[U][Z]=se,this.workerSources[U]&&this.workerSources[U][Z]){for(const pe in this.workerSources[U][Z]){const we=this.workerSources[U][Z][pe];for(const Te in we)we[Te].availableModels=se}ge()}else ge()}setProjection(U,Z){this.projections[U]=o.ce(Z)}setBrightness(U,Z,se){this.brightness=Z,se()}setLayers(U,Z,se){this.getLayerIndex(U,Z.scope).replace(Z.layers,Z.options),se()}updateLayers(U,Z,se){this.getLayerIndex(U,Z.scope).update(Z.layers,Z.removedIds,Z.options),se()}loadTile(U,Z,se){Z.projection=this.projections[U]||this.defaultProjection,this.getWorkerSource(U,Z.type,Z.source,Z.scope).loadTile(Z,se)}decodeRasterArray(U,Z,se){this.getWorkerSource(U,Z.type,Z.source,Z.scope).decodeRasterArray(Z,se)}reloadTile(U,Z,se){Z.projection=this.projections[U]||this.defaultProjection,this.getWorkerSource(U,Z.type,Z.source,Z.scope).reloadTile(Z,se)}abortTile(U,Z,se){this.getWorkerSource(U,Z.type,Z.source,Z.scope).abortTile(Z,se)}removeTile(U,Z,se){this.getWorkerSource(U,Z.type,Z.source,Z.scope).removeTile(Z,se)}removeSource(U,Z,se){if(!(this.workerSources[U]&&this.workerSources[U][Z.scope]&&this.workerSources[U][Z.scope][Z.type]&&this.workerSources[U][Z.scope][Z.type][Z.source]))return;const ge=this.workerSources[U][Z.scope][Z.type][Z.source];delete this.workerSources[U][Z.scope][Z.type][Z.source],ge.removeSource!==void 0?ge.removeSource(Z,se):se()}loadWorkerSource(U,Z,se){try{this.self.importScripts(Z.url),se()}catch(ge){se(ge.toString())}}syncRTLPluginState(U,Z,se){try{o.fn.setState(Z);const ge=o.fn.getPluginURL();if(o.fn.isLoaded()&&!o.fn.isParsed()&&ge!=null){this.self.importScripts(ge);const pe=o.fn.isParsed();se(pe?void 0:new Error(`RTL Text Plugin failed to import scripts from ${ge}`),pe)}}catch(ge){se(ge.toString())}}setDracoUrl(U,Z){this.dracoUrl=Z}getAvailableImages(U,Z){this.availableImages[U]||(this.availableImages[U]={});let se=this.availableImages[U][Z];return se||(se=[]),se}getAvailableModels(U,Z){this.availableModels[U]||(this.availableModels[U]={});let se=this.availableModels[U][Z];return se||(se={}),se}getLayerIndex(U,Z){this.layerIndexes[U]||(this.layerIndexes[U]={});let se=this.layerIndexes[U][Z];return se||(se=this.layerIndexes[U][Z]=new oe,se.scope=Z),se}getWorkerSource(U,Z,se,ge){const pe=this.workerSources;return pe[U]||(pe[U]={}),pe[U][ge]||(pe[U][ge]={}),pe[U][ge][Z]||(pe[U][ge][Z]={}),this.isSpriteLoaded[U]||(this.isSpriteLoaded[U]={}),pe[U][ge][Z][se]||(pe[U][ge][Z][se]=new this.workerSourceTypes[Z]({send:(we,Te,Ae,Be,qe,Oe)=>this.actor.send(we,Te,Ae,U,qe,Oe),scheduler:this.actor.scheduler},this.getLayerIndex(U,ge),this.getAvailableImages(U,ge),this.getAvailableModels(U,ge),this.isSpriteLoaded[U][ge],void 0,this.brightness)),pe[U][ge][Z][se]}rasterizeImagesWorker(U,Z,se){const ge=new Map;for(const[pe,{image:we,imageVariant:Te}]of Z.tasks.entries()){const Ae=this.imageRasterizer.rasterize(Te,we,Z.scope,U);ge.set(pe,Ae)}se(void 0,ge)}removeRasterizedImages(U,Z,se){this.imageRasterizer.removeImagesFromCacheByIds(Z.imageIds,Z.scope,U),se()}enforceCacheSizeLimit(U,Z){o.fo(Z)}getWorkerPerformanceMetrics(U,Z,se){se(void 0,void 0)}}return o.fl(self)&&(self.worker=new Du(self)),Du}),k(["./shared"],function(o){var re="3.12.0";const fe={create:"create",load:"load",fullLoad:"fullLoad"},xe={mark(l){performance.mark(l)},measure(l,t,n){performance.measure(l,t,n)}};function oe(l){const t=l.name.split("?")[0];return o.a(t)&&t.includes("mapbox-gl.js")?"javascript":o.a(t)&&t.includes("mapbox-gl.css")?"css":o.b(t)?"fontRange":o.c(t)?"sprite":o.i(t)?"style":o.d(t)?"tilejson":"other"}var Ee,be={},Pe=function(){if(Ee)return be;function l(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var f,_,y=new Blob([""],{type:"text/javascript"}),b=URL.createObjectURL(y);try{_=new Worker(b),f=!0}catch{f=!1}return _&&_.terminate(),URL.revokeObjectURL(b),f}()?function(){var f=document.createElement("canvas");f.width=f.height=1;var _=f.getContext("2d");if(!_)return!1;var y=_.getImageData(0,0,1,1);return y&&y.width===f.width}()?(n[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(n[d]=function(f){var _,y=function(b){var E=document.createElement("canvas"),I=Object.create(l.webGLContextAttributes);return I.failIfMajorPerformanceCaveat=b,E.getContext("webgl2",I)}(f);if(!y)return!1;try{_=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!_||y.isContextLost())&&(y.shaderSource(_,"void main() {}"),y.compileShader(_),y.getShaderParameter(_,y.COMPILE_STATUS)===!0)}(d)),n[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}Ee=1,be.supported=l,be.notSupportedReason=t;var n={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},be}();function _e(l,t,n){const c=document.createElement(l);return t!=null&&(c.className=t),n&&n.appendChild(c),c}function ze(l,t,n){const c=document.createElementNS("http://www.w3.org/2000/svg",l);for(const d of Object.keys(t))c.setAttributeNS(null,d,String(t[d]));return n&&n.appendChild(c),c}const Se=typeof document<"u"?document.documentElement&&document.documentElement.style:null,st=Se&&Se.userSelect!==void 0?"userSelect":"WebkitUserSelect";let nt;function Xe(){Se&&st&&(nt=Se[st],Se[st]="none")}function ct(){Se&&st&&(Se[st]=nt)}function xt(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",xt,!0)}function $t(){window.addEventListener("click",xt,!0),window.setTimeout(()=>{window.removeEventListener("click",xt,!0)},0)}function kt(l,t){const n=l.getBoundingClientRect();return mi(l,n,t)}function Wt(l,t){const n=l.getBoundingClientRect(),c=[];for(let d=0;d<t.length;d++)c.push(mi(l,n,t[d]));return c}function Ai(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function mi(l,t,n){const c=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new o.P((n.clientX-t.left)*c,(n.clientY-t.top)*c)}const bi="01",Jt="NO_ACCESS_TOKEN";class Bt{constructor(t,n,c){this._transformRequestFn=t,this._customAccessToken=n,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const t=function(){let n="";for(let c=0;c<10;c++)n+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",bi,n].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeStyleURL(t,n){if(!o.f(t))return t;const c=ri(t);return c.params.push(`sdk=js-${re}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeGlyphsURL(t,n){if(!o.f(t))return t;const c=ri(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeModelURL(t,n){if(!o.f(t))return t;const c=ri(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeSourceURL(t,n,c,d){if(!o.f(t))return t;const f=ri(t);return f.path=`/v4/${f.authority}.json`,f.params.push("secure"),c&&f.params.push(`language=${c}`),d&&f.params.push(`worldview=${d}`),this._makeAPIURL(f,this._customAccessToken||n)}normalizeIconsetURL(t,n){const c=ri(t);return o.f(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||n)):ui(c)}normalizeSpriteURL(t,n,c,d){const f=ri(t);return o.f(t)?(f.path=`/styles/v1${f.path}/sprite${n}${c}`,this._makeAPIURL(f,this._customAccessToken||d)):(f.path+=`${n}${c}`,ui(f))}normalizeTileURL(t,n,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!o.f(t))return t;const d=ri(t);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${n||c&&d.authority!=="raster"&&c===512?"@2x":""}${o.m.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${o.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${o.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${o.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${o.e.TILE_URL_VERSION}${d.path}`);const f=this._customAccessToken||function(_){for(const y of _){const b=y.match(/^access_token=(.*)$/);if(b)return b[1]}return null}(d.params)||o.e.ACCESS_TOKEN;return o.e.REQUIRE_ACCESS_TOKEN&&f&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,f)}canonicalizeTileURL(t,n){const c=ri(t);if(!c.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!c.path.match(/\.[\w]+$/))return t;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${o.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${c.path.replace(`/${o.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${o.e.TILE_URL_VERSION}/`,"")}`;let f=c.params;return n&&(f=f.filter(_=>!_.match(/^access_token=/))),f.length&&(d+=`?${f.join("&")}`),d}canonicalizeTileset(t,n){const c=!!n&&o.f(n),d=[];for(const f of t.tiles||[])o.h(f)?d.push(this.canonicalizeTileURL(f,c)):d.push(f);return d}_makeAPIURL(t,n){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=ri(o.e.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const f=t.params.indexOf("secure");f>=0&&t.params.splice(f,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!o.e.REQUIRE_ACCESS_TOKEN)return ui(t);if(n=n||o.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!n)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);if(n[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return t.params=t.params.filter(f=>f.indexOf("access_token")===-1),t.params.push(`access_token=${n||""}`),ui(t)}}const vi=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ri(l){const t=l.match(vi);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function ui(l){const t=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${t}`}const pr="mapbox.eventData";function _r(l){if(!l)return null;const t=l.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(o.j(t[1]))}catch{return null}}class Ii{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const n=_r(o.e.ACCESS_TOKEN);let c="";return c=n&&n.u?o.k(n.u):o.e.ACCESS_TOKEN||"",t?`${pr}.${t}:${c}`:`${pr}:${c}`}fetchEventData(){const t=o.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid");if(t)try{const d=localStorage.getItem(n);d&&(this.eventData=JSON.parse(d));const f=localStorage.getItem(c);f&&(this.anonId=f)}catch{o.w("Unable to read from LocalStorage")}}saveEventData(){const t=o.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.anonId;if(t&&d)try{localStorage.setItem(c,d),Object.keys(this.eventData).length>=1&&localStorage.setItem(n,JSON.stringify(this.eventData))}catch{o.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,n,c,d){if(!o.e.EVENTS_URL)return;const f=ri(o.e.EVENTS_URL);f.params.push(`access_token=${d||o.e.ACCESS_TOKEN||""}`);const _={event:this.type,created:new Date(t).toISOString()},y=n?o.l(_,n):_,b={url:ui(f),headers:{"Content-Type":"text/plain"},body:JSON.stringify([y])};this.pendingRequest=o.p(b,E=>{this.pendingRequest=null,c(E),this.saveEventData(),this.processRequests(d)})}queueRequest(t,n){this.queue.push(t),this.processRequests(n)}}const $r=new class extends Ii{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,t){o.e.EVENTS_URL&&o.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some(n=>o.f(n)||o.h(n))&&this.queueRequest(Date.now(),t)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=_r(o.e.ACCESS_TOKEN),n=t?t.u:o.e.ACCESS_TOKEN;let c=n!==this.eventData.tokenU;o.v(this.anonId)||(this.anonId=o.u(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const f=new Date(this.eventData.lastSuccess),_=new Date(d),y=(d-this.eventData.lastSuccess)/864e5;c=c||y>=1||y<-1||f.getDate()!==_.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:re,skuId:bi,"enabled.telemetry":!1,userId:this.anonId},f=>{f||(this.eventData.lastSuccess=d,this.eventData.tokenU=n)},l):this.processRequests()}},gn=$r.postTurnstileEvent.bind($r),Yn=new class extends Ii{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,t,n,c){this.skuToken=t,this.errorCb=c,o.e.EVENTS_URL&&(n||o.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(Jt)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),o.v(this.anonId)||(this.anonId=o.u()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:re,skuId:bi,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l))}remove(){this.errorCb=null}},ho=Yn.postMapLoadEvent.bind(Yn),Ui=new class extends Ii{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let t=this.mapInstanceIdMap.get(l);return t||(t=o.u(),this.mapInstanceIdMap.set(l,t)),t}getEventId(l){const t=this.eventIdPerMapInstanceMap.get(l)||0;return this.eventIdPerMapInstanceMap.set(l,t+1),t}postStyleLoadEvent(l,t){const{map:n,style:c,importedStyles:d}=t;if(!o.e.EVENTS_URL||!l&&!o.e.ACCESS_TOKEN)return;const f=this.getMapInstanceId(n),_={mapInstanceId:f,eventId:this.getEventId(f),style:c};d.length&&(_.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:_},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:n}=this.queue.shift();this.postEvent(t,n,()=>{},l)}},Zi=Ui.postStyleLoadEvent.bind(Ui),Lr=new class extends Ii{constructor(){super("gljs.performance")}postPerformanceEvent(l,t){o.e.EVENTS_URL&&(l||o.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:n}=this.queue.shift(),c=function(d){const f=performance.getEntriesByType("resource"),_=performance.getEntriesByType("mark"),y=function(z){const N={};if(z){for(const B in z)if(B!=="other")for(const G of z[B]){const V=`${B}ResolveRangeMin`,X=`${B}ResolveRangeMax`,Q=`${B}RequestCount`,ie=`${B}RequestCachedCount`;N[V]=Math.min(N[V]||1/0,G.startTime),N[X]=Math.max(N[X]||-1/0,G.responseEnd);const ue=ae=>{N[ae]===void 0&&(N[ae]=0),++N[ae]};G.transferSize!==void 0&&G.transferSize===0&&ue(ie),ue(Q)}}return N}(function(z,N){const B={};if(z)for(const G of z){const V=N(G);B[V]===void 0&&(B[V]=[]),B[V].push(G)}return B}(f,oe)),b=window.devicePixelRatio,E=navigator.connection||navigator.mozConnection||navigator.webkitConnection,I=E?E.effectiveType:void 0,P={counters:[],metadata:[],attributes:[]},M=(z,N,B)=>{B!=null&&z.push({name:N,value:B.toString()})};for(const z in y)M(P.counters,z,y[z]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(M(P.counters,"interactionRangeMin",d.interactionRange[0]),M(P.counters,"interactionRangeMax",d.interactionRange[1])),_)for(const z of Object.keys(fe)){const N=fe[z],B=_.find(G=>G.name===N);B&&M(P.counters,N,B.startTime)}return M(P.counters,"visibilityHidden",d.visibilityHidden),M(P.attributes,"style",function(z){if(z)for(const N of z){const B=N.name.split("?")[0];if(o.i(B)){const G=B.split("/").slice(-2);if(G.length===2)return`mapbox://styles/${G[0]}/${G[1]}`}}}(f)),M(P.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),M(P.attributes,"fogEnabled",d.fogEnabled?"true":"false"),M(P.attributes,"projection",d.projection),M(P.attributes,"zoom",d.zoom),M(P.metadata,"devicePixelRatio",b),M(P.metadata,"connectionEffectiveType",I),M(P.metadata,"navigatorUserAgent",navigator.userAgent),M(P.metadata,"screenWidth",window.screen.width),M(P.metadata,"screenHeight",window.screen.height),M(P.metadata,"windowWidth",window.innerWidth),M(P.metadata,"windowHeight",window.innerHeight),M(P.metadata,"mapWidth",d.width/b),M(P.metadata,"mapHeight",d.height/b),M(P.metadata,"webglRenderer",d.renderer),M(P.metadata,"webglVendor",d.vendor),M(P.metadata,"sdkVersion",re),M(P.metadata,"sdkIdentifier","mapbox-gl-js"),P}(n);for(const d of c.metadata);for(const d of c.counters);for(const d of c.attributes);this.postEvent(t,c,()=>{},l)}},Uo=Lr.postPerformanceEvent.bind(Lr),gr=new class extends Ii{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,t,n,c){if(!o.e.API_URL||!o.e.SESSION_PATH)return;const d=ri(o.e.API_URL+o.e.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||o.e.ACCESS_TOKEN||""}`);const f={url:ui(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=o.g(f,_=>{this.pendingRequest=null,n(_),this.saveEventData(),this.processRequests(c)})}getSessionAPI(l,t,n,c){this.skuToken=t,this.errorCb=c,o.e.SESSION_PATH&&o.e.API_URL&&(n||o.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(Jt)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||this.getSession(n,this.skuToken,c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l)}remove(){this.errorCb=null}},Kn=gr.getSessionAPI.bind(gr),oo=new Set;function Qi(l,t){t?oo.add(l):oo.delete(l)}class Ei{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,n){this._updatedSourceCaches[t]=n,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const n=t.scope;this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._updatedLayers[n].add(t.id),this.setDirty()}removeLayer(t){const n=t.scope;this._removedLayers[n]=this._removedLayers[n]||{},this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._removedLayers[n][t.id]=t,this._updatedLayers[n].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const n in this._updatedLayers)t[n]=t[n]||{},t[n].updatedIds=Array.from(this._updatedLayers[n].values());for(const n in this._removedLayers)t[n]=t[n]||{},t[n].removedIds=Object.keys(this._removedLayers[n]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(t){return this._updatedImages[t]?Array.from(this._updatedImages[t].values()):[]}updateImage(t,n){this._updatedImages[n]=this._updatedImages[n]||new Set,this._updatedImages[n].add(o.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function un(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class wr extends o.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,t!=="raster"&&o.t()&&(this.imageRasterizerDispatcher=new o.D(o.x(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new o.r({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const n=this.atlasTexture.get(t);n&&(n.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,n){this.imageProviders.has(n)||this.imageProviders.set(n,new Map),this.imageProviders.get(n).set(t.id,t)}removeImageProvider(t,n){this.imageProviders.has(n)&&this.imageProviders.get(n).delete(t)}getPendingImageProviders(){const t=[];for(const n of this.imageProviders.values())for(const c of n.values())c.hasPendingRequests()&&t.push(c);return t}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new o.y),this._imageRasterizer}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,n){if(this.loaded.get(n)!==t&&(this.loaded.set(n,t),t)){for(const{ids:c,callback:d}of this.requestors)this._notify(c,n,d);this.requestors=[]}}hasImage(t,n){return!!this.getImage(t,n)}getImage(t,n){return this.images.get(n).get(t.toString())}addImage(t,n,c){this._validate(t,c)&&this.images.get(n).set(t.toString(),c)}_validate(t,n){let c=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(n.content,n)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,n){if(!t)return!0;let c=0;for(const d of t){if(d[0]<c||d[1]<d[0]||n<d[1])return!1;c=d[1]}return!0}_validateContent(t,n){return t?t.length!==4||!n.usvg&&(t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,n,c){const d=this.images.get(n).get(t.toString());c.version=d.version+1,this.images.get(n).set(t.toString(),c),this.updatedImages.get(n).add(t),this.removeFromImageRasterizerCache(t,n)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,n){this.spriteFormat!=="raster"&&(o.t()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:n}):this.imageRasterizer.removeImagesFromCacheByIds([t],n))}removeImage(t,n){const c=this.images.get(n),d=c.get(t.toString());c.delete(t.toString()),this.patterns.get(n).delete(t.toString()),this.removeFromImageRasterizerCache(t,n),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(n=>o.I.from(n))}getImages(t,n,c){const d=[],f=[],_=this.imageProviders.get(n);for(const I of t){if(!I.iconsetId){d.push(I);continue}const P=_.get(I.iconsetId);P&&(this.getImage(I,n)?f.push(I):P.addPendingRequest(I))}if(d.length===0)return void this._notify(f,n,c);let y=!0;const b=!!this.loaded.get(n),E=this.images.get(n);if(!b)for(const I of d)E.has(I.toString())||(y=!1);b||y?this._notify(d,n,c):this.requestors.push({ids:d,scope:n,callback:c})}rasterizeImages(t,n){const c=new Map,{tasks:d,scope:f}=t;for(const[_,y]of d.entries()){const b=this.getImage(y.id,f);b&&c.set(_,{image:b,imageVariant:y})}this._rasterizeImages(f,c,n)}_rasterizeImages(t,n,c){if(o.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:n,scope:t},c);else{const d=new Map;for(const[f,{image:_,imageVariant:y}]of n.entries())d.set(f,this.imageRasterizer.rasterize(y,_,t,0));c(void 0,d)}}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,n,c){const d=this.images.get(n),f=new Map;for(const _ of t){if(!d.get(_.toString())){if(_.iconsetId)continue;this.fire(new o.A("styleimagemissing",{id:_.name}))}const y=d.get(_.toString());if(!y){o.w(`Image "${_.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const b={data:y.usvg?null:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,usvg:y.usvg,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:!!(y.userImage&&y.userImage.render)};y.usvg&&Object.assign(b,{width:y.icon.usvg_tree.width,height:y.icon.usvg_tree.height}),f.set(o.I.toString(_),b)}c(null,f)}getPixelSize(t){const{width:n,height:c}=this.atlasImage.get(t);return{width:n,height:c}}getPattern(t,n,c){const d=t.toString(),f=this.patterns.get(n),_=f.get(d),y=this.getImage(t,n);if(!y)return null;if(_){if(_.position.version===y.version)return _.position;_.position.version=y.version}else{if(y.usvg&&!y.data){const b=this.getPatternInFlightId(d,n);if(this.patternsInFlight.has(b))return null;this.patternsInFlight.add(b);const E=new o.B(t).scaleSelf(o.q.devicePixelRatio),I=new Map([[E.toString(),{image:y,imageVariant:E}]]);return this._rasterizeImages(n,I,(P,M)=>this.storePatternImage(E,n,y,c,M)),null}this.storePattern(t,n,y)}return this._updatePatternAtlas(n,c),f.get(d).position}getPatternInFlightId(t,n){return o.C(t,n)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,n,c,d,f){const _=t.toString(),y=f?f.get(_):void 0;y&&(c.data=y,this.storePattern(t.id,n,c),this._updatePatternAtlas(n,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),n)))}storePattern(t,n,c){const d={w:c.data.width+2*o.F,h:c.data.height+2*o.F,x:0,y:0},f=new o.G(d,c,o.F);this.patterns.get(n).set(t.toString(),{bin:d,position:f})}bind(t,n){const c=t.gl;let d=this.atlasTexture.get(n);d?this.dirty&&(d.update(this.atlasImage.get(n)),this.dirty=!1):(d=new o.T(t,this.atlasImage.get(n),c.RGBA8),this.atlasTexture.set(n,d)),d.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,n){const c=this.patterns.get(t),d=Array.from(c.values()).map(({bin:E})=>E),{w:f,h:_}=o.H(d),y=this.atlasImage.get(t);y.resize({width:f||1,height:_||1});const b=this.images.get(t);for(const[E,{bin:I,position:P}]of c.entries()){let M=P.padding;const z=I.x+M,N=I.y+M,B=b.get(E).data,G=B.width,V=B.height;M=M>1?M-1:M,o.r.copy(B,y,{x:0,y:0},{x:z,y:N},{width:G,height:V},n),o.r.copy(B,y,{x:0,y:V-M},{x:z,y:N-M},{width:G,height:M},n),o.r.copy(B,y,{x:0,y:0},{x:z,y:N+V},{width:G,height:M},n),o.r.copy(B,y,{x:G-M,y:0},{x:z-M,y:N},{width:M,height:V},n),o.r.copy(B,y,{x:0,y:0},{x:z+G,y:N},{width:M,height:V},n),o.r.copy(B,y,{x:G-M,y:V-M},{x:z-M,y:N-M},{width:M,height:M},n),o.r.copy(B,y,{x:0,y:V-M},{x:z+G,y:N-M},{width:M,height:M},n),o.r.copy(B,y,{x:0,y:0},{x:z+G,y:N+V},{width:M,height:M},n),o.r.copy(B,y,{x:G-M,y:0},{x:z-M,y:N+V},{width:M,height:M},n)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}dispatchRenderCallbacks(t,n){const c=this.images.get(n);for(const d of t){if(this.callbackDispatchedThisFrame.get(n).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(n).add(d.toString());const f=c.get(d.toString());un(f)&&this.updateImage(d,n,f)}}}function Br(l){const t=l.key,n=l.value,c=l.valueSpec||{},d=l.objectElementValidators||{},f=l.style,_=l.styleSpec;let y=[];const b=o.K(n);if(b!=="object")return[new o.V(t,n,`object expected, ${b} found`)];for(const E in n){const I=E.split(".")[0];let P;d[I]?P=d[I]:c[I]?P=Ar:d["*"]?P=d["*"]:c["*"]&&(P=Ar),P?y=y.concat(P({key:(t&&`${t}.`)+E,value:n[E],valueSpec:c[I]||c["*"],style:f,styleSpec:_,object:n,objectKey:E},n)):y.push(new o.J(t,n[E],`unknown property "${E}"`))}for(const E in c)d[E]||c[E].required&&c[E].default===void 0&&n[E]===void 0&&y.push(new o.V(t,n,`missing required property "${E}"`));return y}function En(l){const t=l.value,n=l.valueSpec,c=l.style,d=l.styleSpec,f=l.key,_=l.arrayElementValidator||Ar;if(o.K(t)!=="array")return[new o.V(f,t,`array expected, ${o.K(t)} found`)];if(n.length&&t.length!==n.length)return[new o.V(f,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new o.V(f,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let y={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};d.$version<7&&(y.function=n.function),o.K(n.value)==="object"&&(y=n.value);let b=[];for(let E=0;E<t.length;E++)b=b.concat(_({array:t,arrayIndex:E,value:t[E],valueSpec:y,style:c,styleSpec:d,key:`${f}[${E}]`},!0));return b}function Gr(l){const t=l.key,n=l.value,c=l.valueSpec;let d=o.K(n);if(d==="number"&&n!=n&&(d="NaN"),d!=="number")return[new o.V(t,n,`number expected, ${d} found`)];if("minimum"in c){let f=c.minimum;if(o.K(c.minimum)==="array"&&(f=c.minimum[l.arrayIndex]),n<f)return[new o.V(t,n,`${n} is less than the minimum value ${f}`)]}if("maximum"in c){let f=c.maximum;if(o.K(c.maximum)==="array"&&(f=c.maximum[l.arrayIndex]),n>f)return[new o.V(t,n,`${n} is greater than the maximum value ${f}`)]}return[]}function Dr(l){const t=l.valueSpec,n=o.M(l.value.type);let c,d,f,_={};const y=n!=="categorical"&&l.value.property===void 0,b=!y,E=o.K(l.value.stops)==="array"&&o.K(l.value.stops[0])==="array"&&o.K(l.value.stops[0][0])==="object",I=Br({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(z){if(n==="identity")return[new o.V(z.key,z.value,'identity function may not have a "stops" property')];let N=[];const B=z.value;return N=N.concat(En({key:z.key,value:B,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:P})),o.K(B)==="array"&&B.length===0&&N.push(new o.V(z.key,B,"array must have at least one stop")),N},default:function(z){return Ar({key:z.key,value:z.value,valueSpec:t,style:z.style,styleSpec:z.styleSpec})}}});return n==="identity"&&y&&I.push(new o.V(l.key,l.value,'missing required property "property"')),n==="identity"||l.value.stops||I.push(new o.V(l.key,l.value,'missing required property "stops"')),n==="exponential"&&l.valueSpec.expression&&!o.N(l.valueSpec)&&I.push(new o.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(b&&!o.O(l.valueSpec)?I.push(new o.V(l.key,l.value,"property functions not supported")):y&&!o.Q(l.valueSpec)&&I.push(new o.V(l.key,l.value,"zoom functions not supported"))),n!=="categorical"&&!E||l.value.property!==void 0||I.push(new o.V(l.key,l.value,'"property" property is required')),I;function P(z){let N=[];const B=z.value,G=z.key;if(o.K(B)!=="array")return[new o.V(G,B,`array expected, ${o.K(B)} found`)];if(B.length!==2)return[new o.V(G,B,`array length 2 expected, length ${B.length} found`)];if(E){if(o.K(B[0])!=="object")return[new o.V(G,B,`object expected, ${o.K(B[0])} found`)];if(B[0].zoom===void 0)return[new o.V(G,B,"object stop key must have zoom")];if(B[0].value===void 0)return[new o.V(G,B,"object stop key must have value")];const V=o.M(B[0].zoom);if(typeof V!="number")return[new o.V(G,B[0].zoom,"stop zoom values must be numbers")];if(f&&f>V)return[new o.V(G,B[0].zoom,"stop zoom values must appear in ascending order")];V!==f&&(f=V,d=void 0,_={}),N=N.concat(Br({key:`${G}[0]`,value:B[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:Gr,value:M}}))}else N=N.concat(M({key:`${G}[0]`,value:B[0],valueSpec:{},style:z.style,styleSpec:z.styleSpec},B));return o.S(o.U(B[1]))?N.concat([new o.V(`${G}[1]`,B[1],"expressions are not allowed in function stops.")]):N.concat(Ar({key:`${G}[1]`,value:B[1],valueSpec:t,style:z.style,styleSpec:z.styleSpec}))}function M(z,N){const B=o.K(z.value),G=o.M(z.value),V=z.value!==null?z.value:N;if(c){if(B!==c)return[new o.V(z.key,V,`${B} stop domain type must match previous stop domain type ${c}`)]}else c=B;if(B!=="number"&&B!=="string"&&B!=="boolean"&&typeof G!="number"&&typeof G!="string"&&typeof G!="boolean")return[new o.V(z.key,V,"stop domain value must be a number, string, or boolean")];if(B!=="number"&&n!=="categorical"){let X=`number expected, ${B} found`;return o.O(t)&&n===void 0&&(X+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new o.V(z.key,V,X)]}return n!=="categorical"||B!=="number"||typeof G=="number"&&isFinite(G)&&Math.floor(G)===G?n!=="categorical"&&B==="number"&&typeof G=="number"&&typeof d=="number"&&d!==void 0&&G<d?[new o.V(z.key,V,"stop domain values must appear in ascending order")]:(d=G,n==="categorical"&&G in _?[new o.V(z.key,V,"stop domain values must be unique")]:(_[G]=!0,[])):[new o.V(z.key,V,`integer expected, found ${String(G)}`)]}}function an(l){const t=(l.expressionContext==="property"?o.W:o.X)(o.U(l.value),l.valueSpec);if(t.result==="error")return t.value.map(c=>new o.V(`${l.key}${c.key}`,l.value,c.message));const n=t.value.expression||t.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!n.outputDefined())return[new o.V(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!o.Y(n))return[new o.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return On(n,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!o.Z(n,["zoom","feature-state"]))return[new o.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!o._(n))return[new o.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function On(l,t){const n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)n.delete(d);if(n.size===0)return[];const c=[];return l instanceof o.$&&n.has(l.name)?[new o.V(t.key,t.value,`["${l.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(l.eachChild(d=>{c.push(...On(d,t))}),c)}function po(l){const t=l.key,n=l.value,c=l.valueSpec,d=[];return Array.isArray(c.values)?c.values.indexOf(o.M(n))===-1&&d.push(new o.V(t,n,`expected one of [${c.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(c.values).indexOf(o.M(n))===-1&&d.push(new o.V(t,n,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(n)} found`)),d}function $o(l){return o.a1(o.U(l.value))?an(o.L({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):Hr(l)}function Hr(l){const t=l.value,n=l.key;if(o.K(t)!=="array")return[new o.V(n,t,`array expected, ${o.K(t)} found`)];const c=l.styleSpec;let d,f=[];if(t.length<1)return[new o.V(n,t,"filter array must have at least 1 element")];switch(f=f.concat(po({key:`${n}[0]`,value:t[0],valueSpec:c.filter_operator,style:l.style,styleSpec:l.styleSpec})),o.M(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&o.M(t[1])==="$type"&&f.push(new o.V(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&f.push(new o.V(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(d=o.K(t[1]),d!=="string"&&f.push(new o.V(`${n}[1]`,t[1],`string expected, ${d} found`)));for(let _=2;_<t.length;_++)d=o.K(t[_]),o.M(t[1])==="$type"?f=f.concat(po({key:`${n}[${_}]`,value:t[_],valueSpec:c.geometry_type,style:l.style,styleSpec:l.styleSpec})):d!=="string"&&d!=="number"&&d!=="boolean"&&f.push(new o.V(`${n}[${_}]`,t[_],`string, number, or boolean expected, ${d} found`));break;case"any":case"all":case"none":for(let _=1;_<t.length;_++)f=f.concat(Hr({key:`${n}[${_}]`,value:t[_],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":d=o.K(t[1]),t.length!==2?f.push(new o.V(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):d!=="string"&&f.push(new o.V(`${n}[1]`,t[1],`string expected, ${d} found`))}return f}function ln(l,t){const n=l.key,c=l.style,d=l.layer,f=l.styleSpec,_=l.value,y=l.objectKey,b=f[`${t}_${l.layerType}`];if(!b)return[];const E=y.match(/^(.*)-use-theme$/);if(t==="paint"&&E&&b[E[1]])return o.S(_)?[].concat(Ar({key:l.key,value:_,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:f,expressionContext:"property",propertyType:t,propertyKey:y})):Ar({key:n,value:_,valueSpec:{type:"string"},style:c,styleSpec:f});const I=y.match(/^(.*)-transition$/);if(t==="paint"&&I&&b[I[1]]&&b[I[1]].transition)return Ar({key:n,value:_,valueSpec:f.transition,style:c,styleSpec:f});const P=l.valueSpec||b[y];if(!P)return[new o.J(n,_,`unknown property "${y}"`)];let M;if(o.K(_)==="string"&&o.O(P)&&!P.tokens&&(M=/^{([^}]+)}$/.exec(_))){const N=`\`{ "type": "identity", "property": ${M?JSON.stringify(M[1]):'"_"'} }\``;return[new o.V(n,_,`"${y}" does not support interpolation syntax
|
|
74
|
+
*/function a_(r,e,i,s){const a=[],u=s===0?(h,m,g,v,w,S)=>{h.push(new ft(S,g+(S-m)/(v-m)*(w-g)))}:(h,m,g,v,w,S)=>{h.push(new ft(m+(S-g)/(w-g)*(v-m),S))};for(const h of r){const m=[];for(const g of h){if(g.length<=2)continue;const v=[];for(let A=0;A<g.length-1;A++){const D=g[A].x,R=g[A].y,O=g[A+1].x,$=g[A+1].y,H=s===0?D:R,K=s===0?O:$;H<e?K>e&&u(v,D,R,O,$,e):H>i?K<i&&u(v,D,R,O,$,i):v.push(g[A]),K<e&&H>=e&&u(v,D,R,O,$,e),K>i&&H<=i&&u(v,D,R,O,$,i)}let w=g[g.length-1];const S=s===0?w.x:w.y;S>=e&&S<=i&&v.push(w),v.length&&(w=v[v.length-1],v[0].x===w.x&&v[0].y===w.y||v.push(v[0]),m.push(v))}m.length&&a.push(m)}return a}function t3(r,e){const i=_0(r),s=_0([e]),a=jw.intersection(i,s);return a==null?[]:Vw(a)}function i3(r,e){let s=_0(r,65536);for(;e.valid();e.next()){const[a,u]=e.get(),h=a.x*65536,m=a.y*65536,g=u.x*65536,v=u.y*65536,w=g-h,S=v-m,A=Math.hypot(w,S),D=Math.trunc(S/A*3),R=-Math.trunc(w/A*3);s=jw.diff(s,[[[h,m],[g,v],[g+D,v+R],[h+D,m+R],[h,m]]])}return Vw(s,1/65536)}function _0(r,e=1){return[r.map(i=>i.map(s=>[s.x*e,s.y*e]))]}function Vw(r,e=1){return r.map(i=>i.map((s,a)=>{const u=s.map(h=>new ft(h[0]*e,h[1]*e).round());return a>0&&u.reverse(),u}))}class g0{constructor(e,i){this.layoutVertexArray=new xs,this.indexArray=new fn,this.lineIndexArray=new ea,this.triangleSegments=new Cr,this.lineSegments=new Cr,this.programConfigurations=new Ha(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new Rl)}update(e,i,s,a,u,h,m){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,FL.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,BL.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,s,a,u,h){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,s,a,u,h)}}class y0{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.bufferData=new g0(e,!1),this.elevationBufferData=new g0(e,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference")}updateFootprints(e,i){}populate(e,i,s,a){this.hasPattern=c0("fill",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:m,id:g,index:v,sourceLayerIndex:w}of e){const S=this.layers[0]._featureFilter.needGeometry,A=Lt(m,S);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),A,s))continue;const D=u?u.evaluate(A,{},s,i.availableImages):void 0,R={id:g,properties:m.properties,type:m.type,sourceLayerIndex:w,index:v,geometry:S?A.geometry:At(m,s,a),patterns:{},sortKey:D};h.push(R)}u&&h.sort((m,g)=>m.sortKey-g.sortKey);for(const m of h){const{geometry:g,index:v,sourceLayerIndex:w}=m;if(this.hasPattern){const S=u0("fill",this.layers,m,this.zoom,this.pixelRatio,i);this.patternFeatures.push(S)}else this.addFeature(m,g,v,s,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[v].feature,g,v,w,this.index)}}update(e,i,s,a,u,h,m){this.bufferData.update(e,i,s,a,u,h,m),this.elevationBufferData.update(e,i,s,a,u,h,m)}addFeatures(e,i,s,a,u,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,i,s,a,h,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,i,s,a,u,h=[],m,g){const v=o_(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,v,a,s,g):this.addGeometry(v,this.bufferData),this.bufferData.populatePaintArrays(e,s,u,h,a,m),this.elevationBufferData.populatePaintArrays(e,s,u,h,a,m)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e){this.elevatedStructures&&this.elevatedStructures.construct(e)}addElevatedRoadFeature(e,i,s,a,u){const h=new Array,m=m0.getElevationFeature(e,u);if(m){{const g=this.clipPolygonsToTile(i,1);g.length>0&&h.push({polygons:g,elevationFeature:m,elevationTileID:s})}for(const g of h)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new wo(g.elevationTileID));const w=g.elevationFeature.isTunnel();let S=0;e.properties.hasOwnProperty(zw)&&(S=+e.properties[zw]);for(const A of g.polygons)this.elevatedStructures.addPortalCandidates(g.elevationFeature.id,A,w,g.elevationFeature,S)}g.elevationFeature.constantHeight==null&&(g.polygons=this.prepareElevatedPolygons(g.polygons,g.elevationFeature,g.elevationTileID));const v=new Ow(s,g.elevationTileID);this.addElevatedGeometry(g.polygons,v,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,a)}}else this.addGeometry(i,this.bufferData)}addElevatedGeometry(e,i,s,a,u){const h={elevation:s,elevationSampler:i,bias:a,index:u},[m,g]=this.addGeometry(e,this.elevationBufferData,h);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:m,max:g}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,m),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,g))}addGeometry(e,i,s){let a=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,h=null;s&&(h=s.elevationSampler.constantElevation(s.elevation,s.bias),h!=null&&(a=h,u=h));const m=(g,v,w)=>{if(s!=null)if(v.push(g),h!=null)i.elevatedLayoutVertexArray.emplaceBack(h),w.push(h);else{const S=s.elevationSampler.pointElevation(g,s.elevation,s.bias);i.elevatedLayoutVertexArray.emplaceBack(S),w.push(S),a=Math.min(a,S),u=Math.max(u,S)}};for(const g of e){let v=0;for(const W of g)v+=W.length;const w=i.triangleSegments.prepareSegment(v,i.layoutVertexArray,i.indexArray),S=w.vertexLength,A=[],D=[],R=[],O=[],$=[],H=i.layoutVertexArray.length;for(const W of g){if(W.length===0)continue;W!==g[0]&&D.push(A.length/2);const F=i.lineSegments.prepareSegment(W.length,i.layoutVertexArray,i.lineIndexArray),q=F.vertexLength;s&&$.push(i.layoutVertexArray.length-H),m(W[0],R,O),i.layoutVertexArray.emplaceBack(W[0].x,W[0].y),i.lineIndexArray.emplaceBack(q+W.length-1,q),A.push(W[0].x),A.push(W[0].y);for(let Y=1;Y<W.length;Y++)m(W[Y],R,O),i.layoutVertexArray.emplaceBack(W[Y].x,W[Y].y),i.lineIndexArray.emplaceBack(q+Y-1,q+Y),A.push(W[Y].x),A.push(W[Y].y);F.vertexLength+=W.length,F.primitiveLength+=W.length}const K=Ip(A,D);for(let W=0;W<K.length;W+=3)i.indexArray.emplaceBack(S+K[W],S+K[W+1],S+K[W+2]);if(K.length>0&&s&&this.elevationMode==="hd-road-base"){const W=s.elevation.isTunnel(),F=s.elevation.safeArea,q=this.elevatedStructures.addVertices(R,O);this.elevatedStructures.addTriangles(K,q,W);const Y=$.length;if(Y>0){for(let ee=0;ee<Y-1;ee++)this.elevatedStructures.addRenderableRing(s.index,$[ee]+q,$[ee+1]-$[ee],W,F);this.elevatedStructures.addRenderableRing(s.index,$[Y-1]+q,R.length-$[Y-1],W,F)}}w.vertexLength+=v,w.primitiveLength+=K.length/3}return[a,u]}prepareElevatedPolygons(e,i,s){const a=1/De(s),u=[];for(const h of e){const m=i3(h,new kw(i,a));u.push(...m)}return u}clipPolygonsToTile(e,i){const s=-i,a=-i,u=_t+i,h=_t+i;let m=0;const g=[],v=[];for(;m<e.length;m++){const A=e[m],D=Cd(A);(D.min.x>=s&&D.max.x<=u&&D.min.y>=a&&D.max.y<=h?g:v).push(A)}if(g.length===e.length)return e;const w=[new ft(s,a),new ft(u,a),new ft(u,h),new ft(s,h),new ft(s,a)],S=g;for(const A of v)S.push(...t3(A,w));return S}}let Uw,$w,Gw,Hw;Tt(y0,"FillBucket",{omit:["layers","patternFeatures"]}),Tt(g0,"FillBufferData"),Tt(wo,"ElevatedStructures");class v0{constructor(e,i,s,a){if(this.triangleCount=i.length/3,this.min=new ft(0,0),this.max=new ft(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[u,h]=[e[0].clone(),e[0].clone()];for(let S=1;S<e.length;++S){const A=e[S];u.x=Math.min(u.x,A.x),u.y=Math.min(u.y,A.y),h.x=Math.max(h.x,A.x),h.y=Math.max(h.y,A.y)}if(a){const S=Math.ceil(Math.max(h.x-u.x,h.y-u.y)/a);s=Math.max(s,S)}if(s===0)return;this.min=u,this.max=h;const m=this.max.sub(this.min);m.x=Math.max(m.x,1),m.y=Math.max(m.y,1);const g=Math.max(m.x,m.y)/s;this.cellsX=Math.max(1,Math.ceil(m.x/g)),this.cellsY=Math.max(1,Math.ceil(m.y/g)),this.xScale=1/g,this.yScale=1/g;const v=[];for(let S=0;S<this.triangleCount;S++){const A=e[i[3*S+0]].sub(this.min),D=e[i[3*S+1]].sub(this.min),R=e[i[3*S+2]].sub(this.min),O=na(Math.floor(Math.min(A.x,D.x,R.x)),this.xScale,this.cellsX),$=na(Math.floor(Math.max(A.x,D.x,R.x)),this.xScale,this.cellsX),H=na(Math.floor(Math.min(A.y,D.y,R.y)),this.yScale,this.cellsY),K=na(Math.floor(Math.max(A.y,D.y,R.y)),this.yScale,this.cellsY),W=new ft(0,0),F=new ft(0,0),q=new ft(0,0),Y=new ft(0,0);for(let ee=H;ee<=K;++ee){W.y=F.y=ee*g,q.y=Y.y=(ee+1)*g;for(let he=O;he<=$;++he)W.x=q.x=he*g,F.x=Y.x=(he+1)*g,(Sr(A,D,R,W,F,Y)||Sr(A,D,R,W,Y,q))&&v.push({cellIdx:ee*this.cellsX+he,triIdx:S})}}if(v.length===0)return;v.sort((S,A)=>S.cellIdx-A.cellIdx||S.triIdx-A.triIdx);let w=0;for(;w<v.length;){const S=v[w].cellIdx,A={start:this.payload.length,len:0};for(;w<v.length&&v[w].cellIdx===S;)++A.len,this.payload.push(v[w++].triIdx);this.cells[S]=A}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const s=na(e.x-this.min.x,this.xScale,this.cellsX),a=na(e.y-this.min.y,this.yScale,this.cellsY),u=this.cells[a*this.cellsX+s];if(u){this._lazyInitLookup();for(let h=0;h<u.len;h++){const m=this.payload[u.start+h],g=Math.floor(m/8),v=1<<m%8;if(!(this.lookup[g]&v)&&(this.lookup[g]|=v,i.push(m),i.length===this.triangleCount))return}}}query(e,i,s){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const a=na(e.x-this.min.x,this.xScale,this.cellsX),u=na(i.x-this.min.x,this.xScale,this.cellsX),h=na(e.y-this.min.y,this.yScale,this.cellsY),m=na(i.y-this.min.y,this.yScale,this.cellsY);for(let g=h;g<=m;g++)for(let v=a;v<=u;v++){const w=this.cells[g*this.cellsX+v];if(w)for(let S=0;S<w.len;S++){const A=this.payload[w.start+S],D=Math.floor(A/8),R=1<<A%8;if(!(this.lookup[D]&R)&&(this.lookup[D]|=R,s.push(A),s.length===this.triangleCount))return}}}}function na(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}Tt(v0,"TriangleGridIndex");class qw{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[]}updateFootprints(e,i){for(const s of this.footprints)i.push({footprint:s,id:e})}populate(e,i,s,a){const u=[];for(const{feature:h,id:m,index:g,sourceLayerIndex:v}of e){const w=this.layers[0]._featureFilter.needGeometry,S=Lt(h,w);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),S,s))continue;const A={id:m,properties:h.properties,type:h.type,sourceLayerIndex:v,index:g,geometry:w?S.geometry:At(h,s,a),patterns:{}};u.push(A)}for(const h of u){const{geometry:m,index:g,sourceLayerIndex:v}=h;this.addFeature(h,m,g,s,{},i.availableImages,i.brightness),i.featureIndex.insert(e[g].feature,m,g,v,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,s,a,u,h,m){}destroy(){}addFeature(e,i,s,a,u,h=[],m){for(const g of o_(i,2)){const v=[],w=[],S=[],A=new ft(1/0,1/0),D=new ft(-1/0,-1/0);for(const $ of g)if($.length!==0){$!==g[0]&&S.push(w.length/2);for(let H=0;H<$.length;H++)w.push($[H].x),w.push($[H].y),v.push($[H]),A.x=Math.min(A.x,$[H].x),A.y=Math.min(A.y,$[H].y),D.x=Math.max(D.x,$[H].x),D.y=Math.max(D.y,$[H].y)}const R=Ip(w,S),O=new v0(v,R,8,256);this.footprints.push({vertices:v,indices:R,grid:O,min:A,max:D})}}}Tt(qw,"ClipBucket",{omit:["layers"]});const r3=ki([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),n3=ki([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),o3=ki([{name:"a_centroid_pos",components:2,type:"Uint16"}]),s3=ki([{name:"a_join_normal_inside",components:3,type:"Int16"}]),a3=ki([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),l3=ki([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:c3}=r3,l_=Number.MAX_SAFE_INTEGER;function Zw(r,e,i,s){return r.order<e||r.order===l_||!(r.clipMask&i)||function(a,u){return u.length!==0&&u.find(h=>h===a)===void 0}(s,r.clipScope)}function c_(r,e){return r.x-e.x||r.y-e.y}function Ww(r,e){return c_(r.min,e.min)===0&&c_(r.max,e.max)===0}function x0(r,e){return!(r.min.x>e.max.x||r.max.x<e.min.x||r.min.y>e.max.y||r.max.y<e.min.y)}function b0(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!Ww(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!ds(r[i].clipScope,e[i].clipScope))return!1;return!0}function Xw(r,e,i){const s=1/_t,a=1/(1<<i.canonical.z),u=(e.x*s+i.canonical.x)*a+i.wrap,h=(e.y*s+i.canonical.y)*a;return{min:new ft((r.x*s+i.canonical.x)*a+i.wrap,(r.y*s+i.canonical.y)*a),max:new ft(u,h)}}function u3(r,e,i){const s=1<<i.canonical.z,a=((e.x-i.wrap)*s-i.canonical.x)*_t,u=(e.y*s-i.canonical.y)*_t;return{min:new ft(((r.x-i.wrap)*s-i.canonical.x)*_t,(r.y*s-i.canonical.y)*_t),max:new ft(a,u)}}function Yw(r,e,i,s,a,u,h){const m=r.indices,g=r.vertices,v=[];for(let w=s;w<s+a;w+=3){const S=e[i[w+0]+u],A=e[i[w+1]+u],D=e[i[w+2]+u],R=Math.min(S.x,A.x,D.x),O=Math.max(S.x,A.x,D.x),$=Math.min(S.y,A.y,D.y),H=Math.max(S.y,A.y,D.y);v.length=0,r.grid.query(new ft(R,$),new ft(O,H),v);for(let K=0;K<v.length;K++){const W=v[K];if(Sr(g[m[3*W+0]],g[m[3*W+1]],g[m[3*W+2]],S,A,D,h))return!0}}return!1}function Kw(r,e,i,s){if(!r||!i)return!1;let a=r.vertices;if(!e.canonical.equals(s.canonical)||e.wrap!==s.wrap){if(i.vertices.length<r.vertices.length)return Kw(i,s,r,e);const u=e.canonical,h=s.canonical,m=Math.pow(2,h.z-u.z);a=r.vertices.map(g=>new ft((g.x+u.x*_t)*m-h.x*_t,(g.y+u.y*_t)*m-h.y*_t))}return Yw(i,a,r.indices,0,r.indices.length,0,0)}function Jw(r,e,i,s){const a=Math.pow(2,s.z-i.z);return new ft((r+i.x*_t)*a-s.x*_t,(e+i.y*_t)*a-s.y*_t)}function Qw(r,e){const i=[];e.grid.queryPoint(r,i);const s=e.indices,a=e.vertices;for(let u=0;u<i.length;u++){const h=i[u];if(Yi([a[s[3*h+0]],a[s[3*h+1]],a[s[3*h+2]]],r))return!0}return!1}const w0=[new ft(0,0),new ft(_t,0),new ft(_t,_t),new ft(0,_t)];function e2(r,e){const i=[];let s=[];if(!e||r.length<2)return[r];if(r.length===2)return jr(r[0],r[1],w0)?[r]:[];for(let a=0;a<r.length+2;a++){const u=r[a%r.length],h=r[(a+1)%r.length],m=jr(a===0?r[r.length-1]:r[(a-1)%r.length],u,w0),g=jr(u,h,w0),v=m||g;v&&s.push(u),v&&g||s.length>0&&(s.length>1&&i.push(s),s=[])}return s.length>1&&i.push(s),i}const T0=$l.VectorTileFeature.types,h3=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],d3=["fill-extrusion-flood-light-ground-radius"],p3=Math.pow(2,13),f3=Math.pow(2,15)-1,t2=new ft(0,1),Gl=2147483648;function Rp(r,e,i,s,a,u,h,m){r.emplaceBack((e<<1)+h,(i<<1)+u,(Math.floor(s*p3)<<1)+a,Math.round(m))}function zp(r,e,i){r.emplaceBack(e.x*_t,e.y*_t,i?1:0)}function u_(r,e,i,s,a,u){r.emplaceBack(e.x,e.y,(i.x<<1)+s,(i.y<<1)+a,u)}function Lp(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class i2{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class r2{constructor(){this.centroidXY=new ft(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new ft(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new ft(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new ft(this.max.x-this.min.x,this.max.y-this.min.y)}}class n2{constructor(){this.acc=new ft(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,s){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((i.x===0||i.x===_t)&&i.x===s.x)!=((i.y===0||i.y===_t)&&i.y===s.y)&&this.processBorderOverlap(i,s),a&&this.checkBorderIntersection(i,s)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,Nt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>_t!=e.x>_t&&this.addBorderIntersection(1,Nt(i.y,e.y,(_t-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,Nt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>_t!=e.y>_t&&this.addBorderIntersection(3,Nt(i.x,e.x,(_t-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const s=this.borders[e];i<s[0]&&(s[0]=i),i>s[1]&&(s[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const s=e.x===0?0:1;this.addBorderIntersection(s,i.y),this.addBorderIntersection(s,e.y)}else{const s=e.y===0?2:3;this.addBorderIntersection(s,i.x),this.addBorderIntersection(s,e.x)}}centroid(){return this.accCount===0?new ft(0,0):new ft(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function o2(r,e){const i=r.add(e)._unit(),s=Te(r.x*i.x+r.y*i.y,-1,1);var a,u,h;return a=Math.acos(s),Math.min(4,Math.max(-4,Math.tan(a)))/4*f3*((u=r).x*(h=e).y-u.y*h.x<0?-1:1)}const m3=[r=>r.x<0,r=>r.x>_t,r=>r.y<0,r=>r.y>_t];function _3(r,e,i,s){const a=[4];if(s===0)return a;i._mult(s);const u=r.sub(i),h=e.sub(i),m=[r,e,u,h];for(let g=0;g<4;g++)for(const v of m)if(m3[g](v)){a.push(g);break}return a}class s2{constructor(e){this.vertexArray=new dp,this.indexArray=new fn,this.programConfigurations=new Ha(e.layers,{zoom:e.zoom,lut:e.lut},i=>d3.includes(i)),this._segments=new Cr,this.hiddenByLandmarkVertexArray=new Ih,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Cr}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,s,a=!1){const u=e.length;if(u>2){let h=Math.max(0,this._segments.get().length-1);const m=this._segments._prepareSegment(4*u,this.vertexArray.length,2*this._segmentToGroundQuads[h].length);let g;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const v=e[0],w=e[1];g=o2(v.sub(e[u-1])._perp()._unit(),w.sub(v)._perp()._unit())}for(let v=0;v<u;v++){const w=v===u-1?0:v+1,S=e[v],A=e[w],D=e[w===u-1?0:w+1],R=A.sub(S)._perp()._unit(),O=o2(R,D.sub(A)._perp()._unit()),$=g,H=O;if(S0(S,A,i)||a&&c2(S,i)&&c2(A,i)){g=O;continue}const K=m.vertexLength;u_(this.vertexArray,S,A,1,1,$),u_(this.vertexArray,S,A,1,0,$),u_(this.vertexArray,S,A,0,1,H),u_(this.vertexArray,S,A,0,0,H),m.vertexLength+=4;const W=_3(S,A,R,s);for(const F of W)this._segmentToGroundQuads[h].push({id:K,region:F}),this._segmentToRegionTriCounts[h][F]+=2,m.primitiveLength+=2;g=O}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let s=0;s<i;s++)this._segmentToGroundQuads[s].sort((a,u)=>a.region-u.region);for(let s=0;s<i;s++){const a=this._segmentToGroundQuads[s],u=e[s],h=this._segmentToRegionTriCounts[s];h.reduce((g,v)=>g+v,0);let m=0;for(let g=0;g<=4;g++){const v=h[g];if(v!==0){let w=this.regionSegments[g];w||(w=this.regionSegments[g]=new Cr);const S={vertexOffset:u.vertexOffset,primitiveOffset:u.primitiveOffset+m,vertexLength:u.vertexLength,primitiveLength:v};w.get().push(S)}m+=v}for(let g=0;g<a.length;g++){const v=a[g].id;this.indexArray.emplaceBack(v,v+1,v+3),this.indexArray.emplaceBack(v,v+3,v+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,s,a,u,h){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,s,a,u,h)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,n3.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,s,a,u,h,m){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,s,a,u,h,m)}updateHiddenByLandmark(e){if(!this.hasData())return;const i=e.groundVertexCount+e.groundVertexArrayOffset;if(e.groundVertexCount===0)return;const s=e.flags&Gl?1:0;for(let a=e.groundVertexArrayOffset;a<i;++a)this.hiddenByLandmarkVertexArray.emplace(a,s);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,a3.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class h_{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new fn,this.footprintVertices=new xs,this.footprintSegments=[],this.layoutVertexArray=new Ua,this.centroidVertexArray=new Zm,this.wallVertexArray=new Xm,this.indexArray=new fn,this.programConfigurations=new Ha(e.layers,{zoom:e.zoom,lut:e.lut},i=>h3.includes(i)),this.segments=new Cr,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new s2(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,i){}populate(e,i,s,a){this.features=[],this.hasPattern=c0("fill-extrusion",this.layers,this.pixelRatio,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=De(s),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:u,id:h,index:m,sourceLayerIndex:g}of e){const v=this.layers[0]._featureFilter.needGeometry,w=Lt(u,v);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),w,s))continue;const S={id:h,sourceLayerIndex:g,index:m,geometry:v?w.geometry:At(u,s,a),properties:u.properties,type:u.type,patterns:{}},A=this.layoutVertexArray.length,D=T0[S.type]==="Polygon";if(this.hasPattern)this.features.push(u0("fill-extrusion",this.layers,S,this.zoom,this.pixelRatio,i));else if(this.wallMode)for(const R of S.geometry)for(const O of e2(R,D))this.addFeature(S,[O],m,s,{},i.availableImages,a,i.brightness);else this.addFeature(S,S.geometry,m,s,{},i.availableImages,a,i.brightness);i.featureIndex.insert(u,S.geometry,m,g,this.index,A)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,s,a,u,h){for(const m of this.features){const g=T0[m.type]==="Polygon",{geometry:v}=m;if(this.wallMode)for(const w of v)for(const S of e2(w,g))this.addFeature(m,[S],m.index,i,s,a,u,h);else this.addFeature(m,v,m.index,i,s,a,u,h)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,s,a,u,h,m){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m),this.groundEffect.update(e,i,u,s,a,h,m)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,c3),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,s3.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,l3.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,o3.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,s,a,u,h,m,g){const v=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,w=[new ft(0,0),new ft(_t,_t)],S=m.projection,A=S.name==="globe",D=this.wallMode||T0[e.type]==="Polygon",R=new n2;R.centroidDataIndex=this.centroidData.length;const O=new r2,$=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},a)<=0,H=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},a);let K;if(O.height=H,O.vertexArrayOffset=this.layoutVertexArray.length,O.groundVertexArrayOffset=this.groundEffect.vertexArray.length,A&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new $a),this.wallMode){if(A)return void yi("Non zero fill-extrusion-line-width is not yet supported on globe.");if(i.length!==1)return;K=function(ve){const Ce=ve[0].x===ve[ve.length-1].x&&ve[0].y===ve[ve.length-1].y;(function(gt){let at=0;const Xt=gt.length;for(let Mt=0;Mt<Xt;Mt++)at+=(gt[(Mt+1)%Xt].x-gt[Mt].x)*(gt[(Mt+1)%Xt].y+gt[Mt].y);return at>=0})(ve)||(ve=ve.reverse());const et={geometry:[],joinNormals:[],indices:[]},Ye=[],Qe=[],ot=[];let je=ve.length;for(;je>=2&&ve[je-1].equals(ve[je-2]);)je--;if(je<(Ce?3:2))return et;let Je,Fe,Ve,lt,ut,zt=0;for(;zt<je-1&&ve[zt].equals(ve[zt+1]);)zt++;Ce&&(Je=ve[je-2],ut=ve[zt].sub(Je)._unit()._perp());for(let gt=zt;gt<je;gt++){if(Ve=gt===je-1?Ce?ve[zt+1]:void 0:ve[gt+1],Ve&&ve[gt].equals(Ve))continue;ut&&(lt=ut),Je&&(Fe=Je),Je=ve[gt],ut=Ve?Ve.sub(Je)._unit()._perp():lt,lt=lt||ut;let at=lt.add(ut);at.x===0&&at.y===0||at._unit();const Xt=at.x*ut.x+at.y*ut.y,Mt=Xt!==0?1/Xt:1/0,Pt=lt.x*ut.y-lt.y*ut.x>0;let Ht="miter";const ii=2;Ht==="miter"&&Mt>ii&&(Ht="bevel"),Ht==="bevel"&&(Mt>100&&(Ht="flipbevel"),Mt<ii&&(Ht="miter"));const oi=(fi,ci,ai,tr)=>{const ur=new ft(fi.x,fi.y),J=new ft(fi.x,fi.y);ur.x+=ci.x*tr,ur.y+=ci.y*tr,J.x-=ci.x*Math.max(ai,1),J.y-=ci.y*Math.max(ai,1),ot.push(ci),Ye.push(ur),Qe.push(J)};if(Ht==="miter")at._mult(Mt),oi(Je,at,0,0);else if(Ht==="flipbevel")at=ut.mult(-1),oi(Je,at,0,0),oi(Je,at.mult(-1),0,0);else{const fi=-Math.sqrt(Mt*Mt-1),ci=Pt?fi:0,ai=Pt?0:fi;Fe&&oi(Je,lt,ci,ai),Ve&&oi(Je,ut,ci,ai)}}et.geometry=[...Ye,...Qe.reverse(),Ye[0]],et.joinNormals=[...ot,...ot.reverse(),ot[ot.length-1]];const Et=et.geometry.length-1;for(let gt=0;gt<Et/2;gt++)if(gt+1<Et/2){let at=gt,Xt=gt+1,Mt=Et-1-gt,Pt=Et-2-gt;at=at===0?Et-1:at-1,Xt=Xt===0?Et-1:Xt-1,Mt=Mt===0?Et-1:Mt-1,Pt=Pt===0?Et-1:Pt-1,et.indices.push(Mt),et.indices.push(Xt),et.indices.push(at),et.indices.push(Mt),et.indices.push(Pt),et.indices.push(Xt)}return et}(i[0]),i=[K.geometry]}const W=(ve,Ce)=>ve<(Ce.length-1)/2||ve===Ce.length-1,F=this.wallMode?[i]:o_(i,500);for(let ve=F.length-1;ve>=0;ve--){const Ce=F[ve];(Ce.length===0||(q=Ce[0]).every(Ue=>Ue.x<=0)||q.every(Ue=>Ue.x>=_t)||q.every(Ue=>Ue.y<=0)||q.every(Ue=>Ue.y>=_t))&&F.splice(ve,1)}var q;let Y;if(A)Y=p2(F,w,a);else{Y=[];for(const ve of F)Y.push({polygon:ve,bounds:w})}const ee=D?this.edgeRadius:0,he=ee>0&&this.zoom<17,ye=(ve,Ce)=>{if(ve.length===0)return!1;const Ue=ve[ve.length-1];return Ce.x===Ue.x&&Ce.y===Ue.y};for(const{polygon:ve,bounds:Ce}of Y){let Ue=0,et=0;for(const je of ve)D&&!je[0].equals(je[je.length-1])&&je.push(je[0]),et+=D?je.length-1:je.length;const Ye=this.segments.prepareSegment((D?5:4)*et,this.layoutVertexArray,this.indexArray);O.footprintSegIdx<0&&(O.footprintSegIdx=this.footprintSegments.length),O.polygonSegIdx<0&&(O.polygonSegIdx=this.polygonSegments.length);const Qe={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},ot=new i2;if(ot.vertexOffset=this.footprintVertices.length,ot.indexOffset=3*this.footprintIndices.length,ot.ringIndices=[],D){const je=[],Je=[];Ue=Ye.vertexLength;for(let Ve=0;Ve<ve.length;Ve++){const lt=ve[Ve];lt.length&&Ve!==0&&Je.push(je.length/2);const ut=[];let zt,Et;zt=lt[1].sub(lt[0])._perp()._unit(),ot.ringIndices.push(lt.length-1);for(let gt=1;gt<lt.length;gt++){const at=lt[gt],Xt=lt[gt===lt.length-1?1:gt+1],Mt=at.clone();if(ee){Et=Xt.sub(at)._perp()._unit();const Pt=zt.add(Et)._unit(),Ht=ee*Math.min(4,1/(zt.x*Pt.x+zt.y*Pt.y));Mt.x+=Ht*Pt.x,Mt.y+=Ht*Pt.y,Mt.x=Math.round(Mt.x),Mt.y=Math.round(Mt.y),zt=Et}if(!$||ee!==0&&!he||ye(ut,Mt)||ut.push(Mt),Rp(this.layoutVertexArray,Mt.x,Mt.y,0,0,1,1,0),this.wallMode){const Pt=W(gt,lt);zp(this.wallVertexArray,K.joinNormals[gt],!Pt)}Ye.vertexLength++,this.footprintVertices.emplaceBack(at.x,at.y),je.push(at.x,at.y),A&&Lp(this.layoutVertexExtArray,S.projectTilePoint(Mt.x,Mt.y,a),S.upVector(a,Mt.x,Mt.y))}$&&(ee===0||he)&&(ut.length!==0&&ye(ut,ut[0])&&ut.pop(),this.groundEffect.addData(ut,Ce,v))}const Fe=this.wallMode?K.indices:Ip(je,Je);for(let Ve=0;Ve<Fe.length;Ve+=3)this.footprintIndices.emplaceBack(ot.vertexOffset+Fe[Ve+0],ot.vertexOffset+Fe[Ve+1],ot.vertexOffset+Fe[Ve+2]),this.indexArray.emplaceBack(Ue+Fe[Ve],Ue+Fe[Ve+2],Ue+Fe[Ve+1]),Ye.primitiveLength++;ot.indexCount+=Fe.length,ot.vertexCount+=this.footprintVertices.length-ot.vertexOffset}for(let je=0;je<ve.length;je++){const Je=ve[je];R.startRing(O,Je[0]);let Fe=Je.length>4&&u2(Je[Je.length-2],Je[0],Je[1]),Ve=ee?g3(Je[Je.length-2],Je[0],Je[1],ee):0;const lt=[];let ut,zt,Et;zt=Je[1].sub(Je[0])._perp()._unit();let gt=!0;for(let at=1,Xt=0;at<Je.length;at++){let Mt=Je[at-1],Pt=Je[at];const Ht=Je[at===Je.length-1?1:at+1];if(R.appendEdge(O,Pt,Mt),S0(Pt,Mt,Ce)){ee&&(zt=Ht.sub(Pt)._perp()._unit(),gt=!gt);continue}const ii=Pt.sub(Mt)._perp(),oi=ii.x/(Math.abs(ii.x)+Math.abs(ii.y)),fi=ii.y>0?1:0,ci=Mt.dist(Pt);if(Xt+ci>32768&&(Xt=0),ee){Et=Ht.sub(Pt)._perp()._unit();let J=l2(Mt,Pt,Ht,a2(zt,Et),ee);isNaN(J)&&(J=0);const te=Pt.sub(Mt)._unit();Mt=Mt.add(te.mult(Ve))._round(),Pt=Pt.add(te.mult(-J))._round(),Ve=J,zt=Et,$&&this.zoom>=17&&(ye(lt,Mt)||lt.push(Mt),ye(lt,Pt)||lt.push(Pt))}const ai=Ye.vertexLength,tr=Je.length>4&&u2(Mt,Pt,Ht);let ur=h2(Xt,Fe,gt);if(Rp(this.layoutVertexArray,Mt.x,Mt.y,oi,fi,0,0,ur),Rp(this.layoutVertexArray,Mt.x,Mt.y,oi,fi,0,1,ur),this.wallMode){const J=W(at-1,Je),te=K.joinNormals[at-1];zp(this.wallVertexArray,te,J),zp(this.wallVertexArray,te,J)}if(Xt+=ci,ur=h2(Xt,tr,!gt),Fe=tr,Rp(this.layoutVertexArray,Pt.x,Pt.y,oi,fi,0,0,ur),Rp(this.layoutVertexArray,Pt.x,Pt.y,oi,fi,0,1,ur),this.wallMode){const J=W(at,Je),te=K.joinNormals[at];zp(this.wallVertexArray,te,J),zp(this.wallVertexArray,te,J)}if(Ye.vertexLength+=4,this.indexArray.emplaceBack(ai+0,ai+1,ai+2),this.indexArray.emplaceBack(ai+1,ai+3,ai+2),Ye.primitiveLength+=2,ee){const J=Ue+(at===1?Je.length-2:at-2),te=at===1?Ue:J+1;if(this.indexArray.emplaceBack(ai+1,J,ai+3),this.indexArray.emplaceBack(J,te,ai+3),Ye.primitiveLength+=2,ut===void 0&&(ut=ai),!S0(Ht,Je[at],Ce)){const Ge=at===Je.length-1?ut:Ye.vertexLength;this.indexArray.emplaceBack(ai+2,ai+3,Ge),this.indexArray.emplaceBack(ai+3,Ge+1,Ge),this.indexArray.emplaceBack(ai+3,te,Ge+1),Ye.primitiveLength+=3}gt=!gt}if(A){const J=this.layoutVertexExtArray,te=S.projectTilePoint(Mt.x,Mt.y,a),Ge=S.projectTilePoint(Pt.x,Pt.y,a),pt=S.upVector(a,Mt.x,Mt.y),vt=S.upVector(a,Pt.x,Pt.y);Lp(J,te,pt),Lp(J,te,pt),Lp(J,Ge,vt),Lp(J,Ge,vt)}}D&&(Ue+=Je.length-1),$&&ee&&this.zoom>=17&&(lt.length!==0&&ye(lt,lt[0])&<.pop(),this.groundEffect.addData(lt,Ce,v,ee>0))}this.footprintSegments.push(ot),Qe.triangleCount=this.indexArray.length-Qe.triangleArrayOffset,this.polygonSegments.push(Qe),++O.footprintSegLen,++O.polygonSegLen}if(O.vertexCount=this.layoutVertexArray.length-O.vertexArrayOffset,O.groundVertexCount=this.groundEffect.vertexArray.length-O.groundVertexArrayOffset,O.vertexCount!==0){if(O.centroidXY=R.borders?t2:this.encodeCentroid(R,O),this.centroidData.push(O),R.borders){this.featuresOnBorder.push(R);const ve=this.featuresOnBorder.length-1;for(let Ce=0;Ce<R.borders.length;Ce++)R.borders[Ce][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[Ce].push(ve)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,h,a,g),this.groundEffect.addPaintPropertiesData(e,s,u,h,a,g),this.maxHeight=Math.max(this.maxHeight,H)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,s)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[s].borders[e][0])}splitToSubtiles(){const e=[];for(let m=0;m<this.centroidData.length;m++){const g=this.centroidData[m],v=+(g.min.y+g.max.y>_t),w=2*v+(+(g.min.x+g.max.x>_t)^v);for(let S=0;S<g.polygonSegLen;S++){const A=g.polygonSegIdx+S;e.push({centroidIdx:m,subtile:w,polygonSegmentIdx:A,triangleSegmentIdx:this.polygonSegments[A].triangleSegIdx})}}const i=new fn;e.sort((m,g)=>m.triangleSegmentIdx===g.triangleSegmentIdx?m.subtile-g.subtile:m.triangleSegmentIdx-g.triangleSegmentIdx);let s=0,a=0,u=0;for(const m of e){if(m.triangleSegmentIdx!==s)break;u++}const h=e.length;for(;a!==e.length;){s=e[a].triangleSegmentIdx;let m=0,g=a,v=a;for(let w=g;w<u&&e[w].subtile===m;w++)v++;for(;g!==u;){const w=e[g];m=w.subtile;const S=this.centroidData[w.centroidIdx].min.clone(),A=this.centroidData[w.centroidIdx].max.clone(),D={vertexOffset:this.segments.segments[s].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[s].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let R=g;R<v;R++){const O=e[R],$=this.polygonSegments[O.polygonSegmentIdx],H=this.centroidData[O.centroidIdx].min,K=this.centroidData[O.centroidIdx].max,W=this.indexArray.uint16;for(let F=$.triangleArrayOffset;F<$.triangleArrayOffset+$.triangleCount;F++)i.emplaceBack(W[3*F],W[3*F+1],W[3*F+2]);D.primitiveLength+=$.triangleCount,S.x=Math.min(S.x,H.x),S.y=Math.min(S.y,H.y),A.x=Math.max(A.x,K.x),A.y=Math.max(A.y,K.y)}D.primitiveLength>0&&this.triangleSubSegments.push({segment:D,min:S,max:A}),g=v;for(let R=g;R<u&&e[R].subtile===e[g].subtile;R++)v++}a=u;for(let w=a;w<h&&e[w].triangleSegmentIdx===e[a].triangleSegmentIdx;w++)u++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,s){const a=new Cr;if(this.wallMode){for(const O of this.triangleSubSegments)a.segments.push(O.segment);return a}let u=0,h=0;const m=1<<e.canonical.z;if(i){const O=i.getMinMaxForTile(e);O&&(u=O.min,h=O.max)}h+=this.maxHeight;const g=e.toUnwrapped();let v;const w=[g.canonical.x/m+g.wrap,g.canonical.y/m],S=[(g.canonical.x+1)/m+g.wrap,(g.canonical.y+1)/m],A=(O,$,H)=>[O[0]*(1-H[0])+$[0]*H[0],O[1]*(1-H[1])+$[1]*H[1]],D=[],R=[];for(const O of this.triangleSubSegments){D[0]=O.min.x/_t,D[1]=O.min.y/_t,R[0]=O.max.x/_t,R[1]=O.max.y/_t;const $=A(w,S,D),H=A(w,S,R);if(new xr([$[0],$[1],u],[H[0],H[1],h]).intersectsPrecise(s)===0){v&&(a.segments.push(v),v=void 0);continue}const K=O.segment;v&&v.vertexOffset!==K.vertexOffset&&(a.segments.push(v),v=void 0),v?(v.vertexLength+=K.vertexLength,v.primitiveLength+=K.primitiveLength):v={vertexOffset:K.vertexOffset,primitiveLength:K.primitiveLength,vertexLength:K.vertexLength,primitiveOffset:K.primitiveOffset,sortKey:void 0,vaos:{}}}return v&&a.segments.push(v),a}encodeCentroid(e,i){const s=e.centroid(),a=i.span(),u=Math.min(7,Math.round(a.x*this.tileToMeter/10)),h=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new ft(Te(s.x,1,_t-1)<<3|u,Te(s.y,1,_t-1)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new ft(0,0);const i=e.borders,s=Number.MAX_VALUE;if(i[0][0]!==s||i[1][0]!==s){const a=i[0][0]!==s?0:1;return new ft(6|(i[0][0]!==s?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==s?2:3;return new ft((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==s?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=Gl,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,s=e.vertexCount+e.vertexArrayOffset,a=e.flags&Gl?t2:e.centroidXY,u=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||u!==a.x){for(let h=i;h<s;++h)this.centroidVertexArray.emplace(h,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i,s){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(b0(this.activeReplacements,a))return;if(this.activeReplacements=a,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const h of this.centroidData)h.flags&=2147483647;const u=[];for(const h of this.activeReplacements){if(h.order<s)continue;const m=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));for(const g of this.centroidData)if(!(g.flags&Gl||h.min.x>g.max.x||g.min.x>h.max.x||h.min.y>g.max.y||g.min.y>h.max.y))for(let v=0;v<g.footprintSegLen;v++){const w=this.footprintSegments[g.footprintSegIdx+v];if(u.length=0,y3(this.footprintVertices,w.vertexOffset,w.vertexCount,h.footprintTileId.canonical,e.canonical,u),Yw(h.footprint,u,this.footprintIndices.uint16,w.indexOffset,w.indexCount,-w.vertexOffset,-m)){g.flags|=Gl;break}}}for(const h of this.centroidData)this.writeCentroidToBuffer(h);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,s){let a=!1;for(let u=0;u<s.footprintSegLen;u++){const h=this.footprintSegments[s.footprintSegIdx+u];let m=0;for(const g of h.ringIndices){for(let v=m,w=g+m-1;v<g+m;w=v++){const S=this.footprintVertices.int16[2*(v+h.vertexOffset)+0],A=this.footprintVertices.int16[2*(v+h.vertexOffset)+1],D=this.footprintVertices.int16[2*(w+h.vertexOffset)+1];A>i!=D>i&&e<(this.footprintVertices.int16[2*(w+h.vertexOffset)+0]-S)*(i-A)/(D-A)+S&&(a=!a)}m=g}}return a}getHeightAtTileCoord(e,i){let s=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+_t)*_t+(i+_t);if(this.partLookup.hasOwnProperty(u)){const h=this.partLookup[u];return h?{height:h.height,hidden:!!(h.flags&Gl)}:void 0}for(const h of this.centroidData)e>h.max.x||h.min.x>e||i>h.max.y||h.min.y>i||this.footprintContainsPoint(e,i,h)&&h&&h.height>s&&(s=h.height,this.partLookup[u]=h,a=!!(h.flags&Gl));if(s!==Number.NEGATIVE_INFINITY)return{height:s,hidden:a};this.partLookup[u]=void 0}}function a2(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function g3(r,e,i,s){const a=e.sub(r)._perp()._unit(),u=i.sub(e)._perp()._unit();return l2(r,e,i,a2(a,u),s)}function l2(r,e,i,s,a){const u=Math.sqrt(1-s*s);return Math.min(r.dist(e)/3,e.dist(i)/3,a*u/s)}function S0(r,e,i){return r.x<i[0].x&&e.x<i[0].x||r.x>i[1].x&&e.x>i[1].x||r.y<i[0].y&&e.y<i[0].y||r.y>i[1].y&&e.y>i[1].y}function c2(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function u2(r,e,i){if(r.x<0||r.x>=_t||e.x<0||e.x>=_t||i.x<0||i.x>=_t)return!1;const s=i.sub(e),a=s.perp(),u=r.sub(e);return(s.x*u.x+s.y*u.y)/Math.sqrt((s.x*s.x+s.y*s.y)*(u.x*u.x+u.y*u.y))>-.866&&a.x*u.x+a.y*u.y<0}function h2(r,e,i){const s=e?2|r:-3&r;return i?1|s:-2&s}function d2(){const r=Math.PI/32,e=Math.tan(r),i=B;return i*Math.sqrt(1+2*e*e)-i}function p2(r,e,i){const s=1<<i.z,a=de(i.x/s),u=de((i.x+1)/s),h=me(i.y/s),m=me((i.y+1)/s);return function(g,v,w,S,A=0,D){const R=[];if(!g.length||!w||!S)return R;const O=(Y,ee)=>{for(const he of Y)R.push({polygon:he,bounds:ee})},$=Math.ceil(Math.log2(w)),H=Math.ceil(Math.log2(S)),K=$-H,W=[];for(let Y=0;Y<Math.abs(K);Y++)W.push(K>0?0:1);for(let Y=0;Y<Math.min($,H);Y++)W.push(0),W.push(1);let F=g;if(F=a_(F,v[0].y-A,v[1].y+A,1),F=a_(F,v[0].x-A,v[1].x+A,0),!F.length)return R;const q=[];for(W.length?q.push({polygons:F,bounds:v,depth:0}):O(F,v);q.length;){const Y=q.pop(),ee=Y.depth,he=W[ee],ye=Y.bounds[0],ve=Y.bounds[1],Ce=he===0?ye.x:ye.y,Ue=he===0?ve.x:ve.y,et=D?D(he,Ce,Ue):.5*(Ce+Ue),Ye=a_(Y.polygons,Ce-A,et+A,he),Qe=a_(Y.polygons,et-A,Ue+A,he);if(Ye.length){const ot=[ye,new ft(he===0?et:ve.x,he===1?et:ve.y)];W.length>ee+1?q.push({polygons:Ye,bounds:ot,depth:ee+1}):O(Ye,ot)}if(Qe.length){const ot=[new ft(he===0?et:ye.x,he===1?et:ye.y),ve];W.length>ee+1?q.push({polygons:Qe,bounds:ot,depth:ee+1}):O(Qe,ot)}}return R}(r,e,Math.ceil((u-a)/11.25),Math.ceil((h-m)/11.25),1,(g,v,w)=>{if(g===0)return .5*(v+w);{const S=me((i.y+v/_t)/s);return(le(.5*(me((i.y+w/_t)/s)+S))*s-i.y)*_t}})}function y3(r,e,i,s,a,u){const h=Math.pow(2,s.z-a.z);for(let m=0;m<i;m++){let g=r.int16[2*(m+e)+0],v=r.int16[2*(m+e)+1];g=(g+a.x*_t)*h-s.x*_t,v=(v+a.y*_t)*h-s.y*_t,u.push(new ft(g,v))}}let f2,m2;Tt(h_,"FillExtrusionBucket",{omit:["layers","features"]}),Tt(r2,"PartData"),Tt(i2,"FootprintSegment"),Tt(n2,"BorderCentroidData"),Tt(s2,"GroundEffect");class eu extends ft{constructor(e,i,s){super(e,i),this.z=s}}class _2 extends eu{constructor(e,i,s,a){super(e,i,s),this.w=a}}function g2(r,e,i,s){const a=i==="x"?"y":"x",u=(s-r[i])/(e[i]-r[i]);r[a]=Math.round(r[a]+(e[a]-r[a])*u),r[i]=s,r.hasOwnProperty("z")&&(r.z=Nt(r.z,e.z,u)),r.hasOwnProperty("w")&&(r.w=Nt(r.w,e.w,u))}function y2(r,e,i,s){const a=i,u=s;for(const h of["x","y"]){let m=r,g=e;m[h]>=g[h]&&(m=e,g=r),m[h]<a&&g[h]>a&&g2(m,g,h,a),m[h]<u&&g[h]>u&&g2(g,m,h,u)}}function d_(r,e,i,s,a,u){const h=[];for(let m=0;m<r.length;m++){const g=r[m];let v;const w=h.length;let S=0;for(let A=0;A<g.length-1;A++){let D=g[A],R=g[A+1],O=0;const $=S;let H,K;u&&(O=Math.hypot(R.x-D.x,R.y-D.y),S+=O,H=D,K=R),D.x<e&&R.x<e||(D.x<e?D=new ft(e,D.y+(e-D.x)/(R.x-D.x)*(R.y-D.y))._round():R.x<e&&(R=new ft(e,D.y+(e-D.x)/(R.x-D.x)*(R.y-D.y))._round()),D.y<i&&R.y<i||(D.y<i?D=new ft(D.x+(i-D.y)/(R.y-D.y)*(R.x-D.x),i)._round():R.y<i&&(R=new ft(D.x+(i-D.y)/(R.y-D.y)*(R.x-D.x),i)._round()),D.x>=s&&R.x>=s||(D.x>=s?D=new ft(s,D.y+(s-D.x)/(R.x-D.x)*(R.y-D.y))._round():R.x>=s&&(R=new ft(s,D.y+(s-D.x)/(R.x-D.x)*(R.y-D.y))._round()),D.y>=a&&R.y>=a||(D.y>=a?D=new ft(D.x+(a-D.y)/(R.y-D.y)*(R.x-D.x),a)._round():R.y>=a&&(R=new ft(D.x+(a-D.y)/(R.y-D.y)*(R.x-D.x),a)._round()),v&&D.equals(v[v.length-1])||(v=[D],h.push(v),u&&u.push({progress:{min:$+v2(H,K,D)*O,max:1},parentIndex:m,prevPoint:H,nextPoint:K})),v.push(R),u&&(u[u.length-1].progress.max=$+v2(H,K,R)*O,u[u.length-1].nextPoint=K)))))}if(u&&S>0)for(let A=w;A<h.length;A++)u[A].progress.min/=S,u[A].progress.max/=S}return h}function v3(r,e,i,s,a){if(r.length<2)return void s.push(r);const u=[];for(;e.valid();){const[v,w]=e.get();for(let S=0;S<r.length-1;S++){const A=r[S],D=r[S+1],R=Ir(A,D,v,w);if(R){const[O]=R,$=new ft(Nt(A.x,D.x,O),Nt(A.y,D.y,O));u.push({t:S+O,distance:0,point:$})}}e.next()}if(u.length===0)return void s.push(r);u.sort((v,w)=>v.t-w.t);let h=0,m=0,g=[];for(s.push(g);h!==r.length;){if(m===u.length){for(;h!==r.length;)g.length!==0&&g[g.length-1].equals(r[h])||g.push(r[h]),h++;break}u[m].t<=h?(g.length!==0&&g[g.length-1].equals(u[m].point)||g.push(u[m].point),Math.trunc(u[m].t),m++):(g.length!==0&&g[g.length-1].equals(r[h])||g.push(r[h]),h++)}}function v2(r,e,i){return r.x!==e.x?(i.x-r.x)/(e.x-r.x):r.y!==e.y?(i.y-r.y)/(e.y-r.y):0}function kp(r,e){return r.x*e.x+r.y*e.y}function x2(r,e){if(r.length===1){let i=0;const s=e[i++];let a;for(;!a||s.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const u=e[i],h=r[0],m=a.sub(s),g=u.sub(s),v=h.sub(s),w=kp(m,m),S=kp(m,g),A=kp(g,g),D=kp(v,m),R=kp(v,g),O=w*A-S*S,$=(A*D-S*R)/O,H=(w*R-S*D)/O,K=s.z*(1-$-H)+a.z*$+u.z*H;if(isFinite(K))return K}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}function b2(r,e,i,s,a,u,h,m){const g=h*a.getElevationAt(r,e,!0,!0),v=u[0]!==0,w=v?u[1]===0?h*(u[0]/7-450):h*function(S,A,D){const R=Math.floor(A[0]/8),O=Math.floor(A[1]/8),$=10*(A[0]-8*R),H=10*(A[1]-8*O),K=S.getElevationAt(R,O,!0,!0),W=S.getMeterToDEM(D),F=Math.floor(.5*($*W-1)),q=Math.floor(.5*(H*W-1)),Y=S.tileCoordToPixel(R,O),ee=2*F+1,he=2*q+1,ye=function(Qe,ot,je,Je,Fe){return[Qe.getElevationAtPixel(ot,je,!0),Qe.getElevationAtPixel(ot+Fe,je,!0),Qe.getElevationAtPixel(ot,je+Fe,!0),Qe.getElevationAtPixel(ot+Je,je+Fe,!0)]}(S,Y.x-F,Y.y-q,ee,he),ve=Math.abs(ye[0]-ye[1]),Ce=Math.abs(ye[2]-ye[3]),Ue=Math.abs(ye[0]-ye[2])+Math.abs(ye[1]-ye[3]),et=Math.min(.25,.5*W*(ve+Ce)/ee),Ye=Math.min(.25,.5*W*Ue/he);return K+Math.max(et*$,Ye*H)}(a,u,m):g;return{base:g+(i===0?-1:i),top:v?Math.max(w+s,g+i+2):g+s}}const x3=ki([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),b3=ki([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:w3}=x3,T3=ki([{name:"a_packed",components:3,type:"Float32"}]),{members:S3}=T3,E3=ki([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:A3}=E3;class w2{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new Ul({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const s=this.getKey(e,i);return this.positions[s]}trim(){const e=this.width,i=this.height=Rt(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,s){const a=[];let u=e.length%2==1?-e[e.length-1]*s:0,h=e[0]*s,m=!0;a.push({left:u,right:h,isDash:m,zeroLength:e[0]===0});let g=e[0];for(let v=1;v<e.length;v++){m=!m;const w=e[v];u=g*s,g+=w,h=g*s,a.push({left:u,right:h,isDash:m,zeroLength:w===0})}return a}addRoundDash(e,i,s){const a=i/2;for(let u=-s;u<=s;u++){const h=this.width*(this.nextRow+s+u);let m=0,g=e[m];for(let v=0;v<this.width;v++){v/g.right>1&&(g=e[++m]);const w=Math.abs(v-g.left),S=Math.abs(v-g.right),A=Math.min(w,S);let D;const R=u/s*(a+1);if(g.isDash){const O=a-Math.abs(R);D=Math.sqrt(A*A+O*O)}else D=a-Math.sqrt(A*A+R*R);this.image.data[h+v]=Math.max(0,Math.min(255,D+128))}}}addRegularDash(e,i){for(let g=e.length-1;g>=0;--g){const v=e[g],w=e[g+1];v.zeroLength?e.splice(g,1):w&&w.isDash===v.isDash&&(w.left=v.left,e.splice(g,1))}const s=e[0],a=e[e.length-1];s.isDash===a.isDash&&(s.left=a.left-this.width,a.right=s.right+this.width);const u=this.width*this.nextRow;let h=0,m=e[h];for(let g=0;g<this.width;g++){g/m.right>1&&(m=e[++h]);const v=Math.abs(g-m.left),w=Math.abs(g-m.right),S=Math.min(v,w);this.image.data[u+g]=Math.max(0,Math.min(255,(m.isDash?S:-S)+i+128))}}addDash(e,i){const s=this.getKey(e,i);if(this.positions[s])return this.positions[s];const a=i==="round",u=a?7:0,h=2*u+1;if(this.nextRow+h>this.height)return yi("LineAtlas out of space"),null;e.length===0&&e.push(1);let m=0;for(let w=0;w<e.length;w++)e[w]<0&&(yi("Negative value is found in line dasharray, replacing values with 0"),e[w]=0),m+=e[w];if(m!==0){const w=this.width/m,S=this.getDashRanges(e,this.width,w);a?this.addRoundDash(S,w,u):this.addRegularDash(S,i==="square"?.5*w:0)}const g=this.nextRow+u;this.nextRow+=h;const v={tl:[g,u],br:[m,0]};return this.positions[s]=v,v}}Tt(w2,"LineAtlas");const I3=$l.VectorTileFeature.types,C3=Math.cos(Math.PI/180*37.5),M3=Math.cos(Math.PI/180*5);class E0{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new pp,this.layoutVertexArray2=new Yo,this.patternVertexArray=new Yo,this.indexArray=new fn,this.programConfigurations=new Ha(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Cr,this.maxLineLength=0,this.zOffsetVertexArray=new Yo,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:_t/64}updateFootprints(e,i){}populate(e,i,s,a){this.hasPattern=c0("line",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("line-sort-key");this.tileToMeter=De(s);const h=this.layers[0].layout.get("line-elevation-reference");if(h==="hd-road-markup")this.elevationType="road";else{const A=this.layers[0].layout.get("line-z-offset"),D=A.isConstant()&&!A.constantOr(0);this.elevationType=h!=="sea"&&h!=="ground"&&D?"none":"offset",this.elevationType==="offset"&&h==="none"&&yi(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const m=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&m!==void 0;const g=[];for(const{feature:A,id:D,index:R,sourceLayerIndex:O}of e){const $=this.layers[0]._featureFilter.needGeometry,H=Lt(A,$);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),H,s))continue;const K=u?u.evaluate(H,{},s):void 0,W={id:D,properties:A.properties,type:A.type,sourceLayerIndex:O,index:R,geometry:$?H.geometry:At(A,s,a),patterns:{},sortKey:K};g.push(W)}u&&g.sort((A,D)=>A.sortKey-D.sortKey);const{lineAtlas:v,featureIndex:w}=i,S=this.addConstantDashes(v);for(const A of g){const{geometry:D,index:R,sourceLayerIndex:O}=A;if(S&&this.addFeatureDashes(A,v),this.hasPattern){const $=u0("line",this.layers,A,this.zoom,this.pixelRatio,i);this.patternFeatures.push($)}else this.addFeature(A,D,R,s,v.positions,i.availableImages,i.brightness,i.elevationFeatures);w.insert(e[R].feature,D,R,O,this.index)}}addConstantDashes(e){let i=!1;for(const s of this.layers){const a=s.paint.get("line-dasharray").value,u=s.layout.get("line-cap").value;if(a.kind!=="constant"||u.kind!=="constant")i=!0;else{const h=u.value,m=a.value;if(!m)continue;e.addDash(m,h)}}return i}addFeatureDashes(e,i){const s=this.zoom;for(const a of this.layers){const u=a.paint.get("line-dasharray").value,h=a.layout.get("line-cap").value;if(u.kind==="constant"&&h.kind==="constant")continue;let m,g;if(u.kind==="constant"){if(m=u.value,!m)continue}else m=u.evaluate({zoom:s},e);g=h.kind==="constant"?h.value:h.evaluate({zoom:s},e),i.addDash(m,g),e.patterns[a.id]=[i.getKey(m,g)]}}update(e,i,s,a,u,h,m){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m)}addFeatures(e,i,s,a,u,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,i,s,a,h)}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,S3)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,A3)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,b3.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,w3),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,s,a,u,h,m,g){const v=this.layers[0].layout,w=v.get("line-join").evaluate(e,{}),S=v.get("line-cap").evaluate(e,{}),A=v.get("line-miter-limit"),D=v.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=v.get("line-z-offset").value;const R=this.layers[0].paint.get("line-width").value;if(R.kind!=="constant"&&R.isLineProgressConstant===!1&&(this.variableWidthValue=R),this.elevationType==="road"){const O=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,g,w,S,A,D)){const[$,H]=this.clipRuntimeLinesToTile(i,1);for(let K=0;K<$.length;K++){const W=$[K],F=H[K],q={progress:{min:F.progress.min,max:F.progress.max},nextDir:this.computeSegNextDir(F,W),prevDir:this.computeSegPrevDir(F,W)};this.addLine(W,e,a,w,S,A,D,q)}this.fillNonElevatedRoadSegment(O)}}else for(const O of i)this.addLine(O,e,a,w,S,A,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,h,a,m)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return d_(e,-i,-i,_t+i,_t+i)}clipRuntimeLinesToTile(e,i){const s=[];return[d_(e,-i,-i,_t+i,_t+i,s),s]}addElevatedRoadFeature(e,i,s,a,u,h,m,g){const v=[],w=m0.getElevationFeature(e,a);if(w){const S=this.clipLinesToTile(i,1),A=this.prepareElevatedLines(S,w,s);for(const D of A)v.push({geometry:D,elevation:w,elevationTileID:s,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(v.length===0)return!1;for(const S of v){const A=this.layoutVertexArray.length;this.addLine(S.geometry,e,s,u,h,m,g);const D=new Ow(s,S.elevationTileID);if(S.elevation)for(let R=A;R<this.layoutVertexArray.length;R++){const O=new ft(this.layoutVertexArray.int16[6*R]>>1,this.layoutVertexArray.int16[6*R+1]>>1),$=D.pointElevation(O,S.elevation,.05);this.updateHeightRange($),this.zOffsetVertexArray.emplaceBack($,0,0)}else this.fillNonElevatedRoadSegment(A)}return!0}prepareElevatedLines(e,i,s){if(i.constantHeight!=null)return e;const a=[],u=1/De(s);for(const h of e)v3(h,new kw(i,u),0,a);return a}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,i,s,a,u,h,m,g){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0;const v=a==="none";this.patternJoinNone=this.hasPattern&&v,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const w=g&&g.progress.min>0,S=g&&g.progress.max<1;if(this.lineClips){let he={min:this.lineClips.start,max:this.lineClips.end},ye=1;if(g){const Ue=this.lineClips.end-this.lineClips.start;he=function(et,Ye,Qe){return{min:yn(et.min,Ye,Qe),max:yn(et.max,Ye,Qe)}}(g.progress,{min:0,max:1},he),Ue>0&&(ye=(he.max-he.min)/Ue)}const ve=+i.properties.mapbox_clip_feature_len,Ce=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(ve)||Number.isNaN(Ce)){for(let et=0;et<e.length-1;et++)this.totalDistance+=e[et].dist(e[et+1]);const Ue=this.totalDistance/(he.max-he.min);this.totalFeatureLength=Number.isFinite(Ue)?Ue:0,this.lineClips.start=he.min,this.lineClips.end=he.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=ve,this.distance=Ce*ye,this.lineClips.start=he.min,this.lineClips.end=he.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const A=I3[i.type]==="Polygon";let D=e.length;for(;D>=2&&e[D-1].equals(e[D-2]);)D--;let R=0;for(;R<D-1&&e[R].equals(e[R+1]);)R++;if(D<(A?3:2))return;a==="bevel"&&(h=1.05);const O=this.segments.prepareSegment(10*D,this.layoutVertexArray,this.indexArray);let $,H,K,W,F,q,Y,ee;g&&g.prevDir&&(q=g.prevDir.perp()),g&&g.nextDir&&(Y=g.nextDir.perp()),this.e1=this.e2=-1,A&&($=e[D-2],F=e[R].sub($)._unit()._perp());for(let he=R;he<D;he++){if(K=he===D-1?A?e[R+1]:void 0:e[he+1],K&&e[he].equals(K))continue;F&&(W=F),$&&(H=$),$=e[he],ee=this.evaluateLineProgressFeatures(H?H.dist($):0),F=K?K.sub($)._unit()._perp():W,W=W||F;const ye=H&&K;let ve=ye?a:A||v?"butt":u;const Ce=W.x*F.x+W.y*F.y;if(v){const Fe=function(Ve){if(Ve.patternJoinNone){const lt=Ve.segmentPoints.length/2,ut=Ve.lineSoFar-Ve.segmentStart;for(let zt=0;zt<lt;++zt){const Et=Ve.segmentPoints[2*zt+1],gt=Math.round(Ve.segmentPoints[2*zt])+.5+.25*Et;Ve.patternVertexArray.emplaceBack(gt,ut,Ve.segmentStart),Ve.patternVertexArray.emplaceBack(gt,ut,Ve.segmentStart)}Ve.segmentPoints.length=0}Ve.e1=Ve.e2=-1};if(ye&&Ce<M3){this.updateDistance(H,$),this.addCurrentVertex($,W,1,1,O,ee),Fe(this),this.addCurrentVertex($,F,-1,-1,O,ee);continue}if(H){if(!K){this.updateDistance(H,$),this.addCurrentVertex($,W,1,1,O,ee),Fe(this);continue}ve="miter"}}let Ue=W.add(F);Ue.x===0&&Ue.y===0||Ue._unit();const et=Ue.x*F.x+Ue.y*F.y,Ye=et!==0?1/et:1/0,Qe=2*Math.sqrt(2-2*et),ot=et<C3&&H&&K,je=W.x*F.y-W.y*F.x>0,Je=this.overscaling<=16?15*_t/(512*this.overscaling):0;if(ye&&ve==="round"){if(Ye<m)ve="miter";else if(Ye<=2){const Fe=A0($,-10,_t+10);ve=this.elevationType==="offset"&&(Fe||this.hasCrossSlope)?"miter":"fakeround"}}if(ve==="miter"&&Ye>h&&(ve="bevel"),ve==="bevel"&&(Ye>2&&(ve="flipbevel"),Ye<h&&(ve="miter")),H&&!(ve==="miter"&&ot)&&this.updateDistance(H,$),ve==="miter")if(ot){const Fe=$.dist(H);if(Fe>2*Je){const lt=$.sub($.sub(H)._mult(Je/Fe)._round());this.updateDistance(H,lt),this.addCurrentVertex(lt,W,0,0,O,ee),H=lt}this.updateDistance(H,$),Ue._mult(Ye),this.addCurrentVertex($,Ue,0,0,O,ee);const Ve=$.dist(K);if(Ve>2*Je){const lt=$.add(K.sub($)._mult(Je/Ve)._round());this.updateDistance($,lt),this.addCurrentVertex(lt,F,0,0,O,ee),$=lt}}else Ue._mult(Ye),this.addCurrentVertex($,Ue,0,0,O,ee);else if(ve==="flipbevel"){if(Ye>100)Ue=F.mult(-1);else{const Fe=Ye*W.add(F).mag()/W.sub(F).mag();Ue._perp()._mult(Fe*(je?-1:1))}this.addCurrentVertex($,Ue,0,0,O,ee),this.addCurrentVertex($,Ue.mult(-1),0,0,O,ee)}else if(ve==="bevel"||ve==="fakeround"){ee!=null&&H&&this.addCurrentVertex($,Y||W,-1,-1,O,ee);const Fe=$.dist(H)<=2*Je&&ve!=="bevel",Ve=Ue.mult(je?1:-1);Ve._mult(Ye);const lt=F.mult(je?-1:1),ut=W.mult(je?-1:1),zt=this.evaluateLineProgressFeatures(this.distance);if(ee==null&&(this.addHalfVertex($,Ve.x,Ve.y,!1,!je,0,O,zt),Fe||this.addHalfVertex($,Ve.x+2*ut.x,Ve.y+2*ut.y,!1,je,0,O,zt)),ve==="fakeround"){const Et=Math.round(180*Qe/Math.PI/20);this.addHalfVertex($,ut.x,ut.y,!1,je,0,O,zt);for(let gt=0;gt<Et;gt++){let at=gt/Et;if(at!==.5){const Mt=at-.5;at+=at*Mt*(at-1)*((1.0904+Ce*(Ce*(3.55645-1.43519*Ce)-3.2452))*Mt*Mt+(.848013+Ce*(.215638*Ce-1.06021)))}const Xt=lt.sub(ut)._mult(at)._add(ut)._unit();this.addHalfVertex($,Xt.x,Xt.y,!1,je,0,O,zt)}this.addHalfVertex($,lt.x,lt.y,!1,je,0,O,zt)}Fe||ee!=null||this.addHalfVertex($,Ve.x+2*lt.x,Ve.y+2*lt.y,!1,je,0,O,zt),ee!=null&&K&&this.addCurrentVertex($,q||F,1,1,O,ee)}else if(ve==="butt")this.addCurrentVertex($,Ue,0,0,O,ee);else if(ve==="square"){if(!H){const Fe=w?0:-1;this.addCurrentVertex($,Ue,Fe,Fe,O,ee)}if(this.addCurrentVertex($,Ue,0,0,O,ee),H){const Fe=S?0:1;this.addCurrentVertex($,Ue,Fe,Fe,O,ee)}}else if(ve==="round"){if(H){const Fe=!ye&&Y?Y:W;this.addCurrentVertex($,Fe,0,0,O,ee),!ye&&S||this.addCurrentVertex($,Fe,1,1,O,ee,!0)}if(K){const Fe=!ye&&q?q:F;!ye&&w||this.addCurrentVertex($,Fe,-1,-1,O,ee,!0),this.addCurrentVertex($,Fe,0,0,O,ee)}}}}addVerticesTo(e,i,s,a,u,h,m,g,v,w){const S=(i.w-e.w)/this.tessellationStep|0;let A=0;const D=this.scaledDistance;if(S>1){this.lineSoFar=e.w;const O=(i.x-e.x)/S,$=(i.y-e.y)/S,H=(i.z-e.z)/S,K=(i.w-e.w)/S;for(let W=1;W<S;++W){e.x+=O,e.y+=$,e.z+=H,this.lineSoFar+=K,A+=K;const F=this.evaluateLineProgressFeatures(this.prevDistance+A);this.scaledDistance=(this.prevDistance+A)/this.totalDistance,this.addHalfVertex(e,s,a,w,!1,m,v,F),this.addHalfVertex(e,u,h,w,!0,-g,v,F)}}this.lineSoFar=i.w,this.scaledDistance=D;const R=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,s,a,w,!1,m,v,R),this.addHalfVertex(i,u,h,w,!0,-g,v,R)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):yi(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:i}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}}addCurrentVertex(e,i,s,a,u,h,m=!1){const g=i.x+i.y*s,v=i.y-i.x*s,w=i.y*a-i.x,S=-i.y-i.x*a;if(h!=null){const A=this.elevationType==="offset",D=-10,R=_t+10,O=h.zOffset,$=new _2(e.x,e.y,O,this.lineSoFar),H=!!A&&A0(e,D,R),K=this.lineSoFar,W=this.distance;if(this.currentVertex)if(H){const F=this.currentVertexIsOutside,q=this.currentVertex,Y=new _2(e.x,e.y,O,this.lineSoFar);if(y2(q,Y,D,R),!A0(Y,D,R)){if(F){this.e1=this.e2=-1,this.distance-=q.dist($),this.lineSoFar=q.w;const ee=this.evaluateLineProgressFeatures(q.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(q,g,v,m,!1,s,u,ee),this.addHalfVertex(q,w,S,m,!0,-a,u,ee),this.prevDistance=this.distance}this.distance=this.prevDistance+q.dist(Y),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(q,Y,g,v,w,S,s,a,u,m),this.distance=W,this.scaledDistance=this.distance/this.totalDistance}}else{const F=this.currentVertex;if(this.currentVertexIsOutside){y2(F,$,D,R),this.e1=this.e2=-1,this.distance-=F.dist($),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=F.w;const q=this.evaluateLineProgressFeatures(F.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(F,g,v,m,!1,s,u,q),this.addHalfVertex(F,w,S,m,!0,-a,u,q),this.prevDistance=this.distance,this.distance=W,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(F,$,g,v,w,S,s,a,u,m)}else H||(this.addHalfVertex(e,g,v,m,!1,s,u,h),this.addHalfVertex(e,w,S,m,!0,-a,u,h));this.currentVertex=$,this.currentVertexIsOutside=H,this.lineSoFar=K}else this.addHalfVertex(e,g,v,m,!1,s,u,h),this.addHalfVertex(e,w,S,m,!0,-a,u,h)}addHalfVertex({x:e,y:i},s,a,u,h,m,g,v){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),h||this.segmentPoints.push(this.lineSoFar-this.segmentStart,m)),this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(i<<1)+(h?1:0),Math.round(63*s)+128,Math.round(63*a)+128,1+(m===0?0:m<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const S=Nt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,S)}const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),h?this.e2=w:this.e1=w,v!=null&&this.zOffsetVertexArray.emplaceBack(v.zOffset,v.variableWidth,v.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function A0(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}let T2,S2;function E2(r,e,i){return e*(_t/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}Tt(E0,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const A2=(r,e,i)=>(1-i)*r+i*e;function I2(r,e){return 1/E2(r,1,e.tileZoom)}function C2(r,e,i,s){return r.translatePosMatrix(s||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const M2=r=>{const e=[];P2(r)&&e.push("RENDER_LINE_DASH"),r.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=r.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),r.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const s=r.layout.get("line-join").constantOr("miter")==="none",a=!!r.paint.get("line-pattern").constantOr(1);return s&&a&&e.push("LINE_JOIN_NONE"),e};function P2(r){const e=r.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}let I0;const D2=()=>I0||(I0={layout:T2||(T2=new Nr({"line-cap":new wt(Re.layout_line["line-cap"]),"line-join":new wt(Re.layout_line["line-join"]),"line-miter-limit":new dt(Re.layout_line["line-miter-limit"]),"line-round-limit":new dt(Re.layout_line["line-round-limit"]),"line-sort-key":new wt(Re.layout_line["line-sort-key"]),"line-z-offset":new wt(Re.layout_line["line-z-offset"]),"line-elevation-reference":new dt(Re.layout_line["line-elevation-reference"]),"line-cross-slope":new dt(Re.layout_line["line-cross-slope"]),visibility:new dt(Re.layout_line.visibility),"line-width-unit":new dt(Re.layout_line["line-width-unit"])})),paint:S2||(S2=new Nr({"line-opacity":new wt(Re.paint_line["line-opacity"]),"line-color":new wt(Re.paint_line["line-color"]),"line-translate":new dt(Re.paint_line["line-translate"]),"line-translate-anchor":new dt(Re.paint_line["line-translate-anchor"]),"line-width":new wt(Re.paint_line["line-width"]),"line-gap-width":new wt(Re.paint_line["line-gap-width"]),"line-offset":new wt(Re.paint_line["line-offset"]),"line-blur":new wt(Re.paint_line["line-blur"]),"line-dasharray":new wt(Re.paint_line["line-dasharray"]),"line-pattern":new wt(Re.paint_line["line-pattern"]),"line-pattern-cross-fade":new dt(Re.paint_line["line-pattern-cross-fade"]),"line-gradient":new ja(Re.paint_line["line-gradient"]),"line-trim-offset":new dt(Re.paint_line["line-trim-offset"]),"line-trim-fade-range":new dt(Re.paint_line["line-trim-fade-range"]),"line-trim-color":new dt(Re.paint_line["line-trim-color"]),"line-emissive-strength":new dt(Re.paint_line["line-emissive-strength"]),"line-border-width":new wt(Re.paint_line["line-border-width"]),"line-border-color":new wt(Re.paint_line["line-border-color"]),"line-occlusion-opacity":new dt(Re.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},I0);class P3 extends wt{possiblyEvaluate(e,i){return i=new Wi(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,a){return i=Oe({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,a)}}let Op;function R2(r,e){return e>0?e+2*r:r}const D3=ki([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),R3=ki([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),z3=ki([{name:"a_projected_pos",components:4,type:"Float32"}],4);ki([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const L3=ki([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),k3=ki([{name:"a_texb",components:2,type:"Uint16"}]),O3=ki([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),F3=ki([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);ki([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const z2=ki([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),B3=ki([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ki([{name:"triangle",components:3,type:"Uint16"}]),ki([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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:"Uint8",name:"flipState"}]),ki([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}]),ki([{type:"Float32",name:"offsetX"}]),ki([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var xn=24;function N3(r,e,i){return r.sections.forEach(s=>{s.text=function(a,u,h){const m=u.layout.get("text-transform").evaluate(h,{});return m==="uppercase"?a=a.toLocaleUpperCase():m==="lowercase"&&(a=a.toLocaleLowerCase()),vo.applyArabicShaping&&(a=vo.applyArabicShaping(a)),a}(s.text,e,i)}),r}const Fp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function j3(r){return r==="︶"||r==="﹈"||r==="︸"||r==="﹄"||r==="﹂"||r==="︾"||r==="︼"||r==="︺"||r==="︘"||r==="﹀"||r==="︐"||r==="︓"||r==="︔"||r==="`"||r===" ̄"||r==="︑"||r==="︒"}function V3(r){return r==="︵"||r==="﹇"||r==="︷"||r==="﹃"||r==="﹁"||r==="︽"||r==="︻"||r==="︹"||r==="︗"||r==="︿"}var L2,C0,k2,M0={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function U3(){return L2||(L2=1,M0.read=function(r,e,i,s,a){var u,h,m=8*a-s-1,g=(1<<m)-1,v=g>>1,w=-7,S=i?a-1:0,A=i?-1:1,D=r[e+S];for(S+=A,u=D&(1<<-w)-1,D>>=-w,w+=m;w>0;u=256*u+r[e+S],S+=A,w-=8);for(h=u&(1<<-w)-1,u>>=-w,w+=s;w>0;h=256*h+r[e+S],S+=A,w-=8);if(u===0)u=1-v;else{if(u===g)return h?NaN:1/0*(D?-1:1);h+=Math.pow(2,s),u-=v}return(D?-1:1)*h*Math.pow(2,u-s)},M0.write=function(r,e,i,s,a,u){var h,m,g,v=8*u-a-1,w=(1<<v)-1,S=w>>1,A=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=s?0:u-1,R=s?1:-1,O=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,h=w):(h=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-h))<1&&(h--,g*=2),(e+=h+S>=1?A/g:A*Math.pow(2,1-S))*g>=2&&(h++,g/=2),h+S>=w?(m=0,h=w):h+S>=1?(m=(e*g-1)*Math.pow(2,a),h+=S):(m=e*Math.pow(2,S-1)*Math.pow(2,a),h=0));a>=8;r[i+D]=255&m,D+=R,m/=256,a-=8);for(h=h<<a|m,v+=a;v>0;r[i+D]=255&h,D+=R,h/=256,v-=8);r[i+D-R]|=128*O}),M0}function O2(){if(k2)return C0;k2=1,C0=e;var r=U3();function e(F){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(F)?F:new Uint8Array(F||0),this.pos=0,this.type=0,this.length=this.buf.length}e.Varint=0,e.Fixed64=1,e.Bytes=2,e.Fixed32=5;var i=4294967296,s=1/i,a=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function u(F){return F.type===e.Bytes?F.readVarint()+F.pos:F.pos+1}function h(F,q,Y){return Y?4294967296*q+(F>>>0):4294967296*(q>>>0)+(F>>>0)}function m(F,q,Y){var ee=q<=16383?1:q<=2097151?2:q<=268435455?3:Math.floor(Math.log(q)/(7*Math.LN2));Y.realloc(ee);for(var he=Y.pos-1;he>=F;he--)Y.buf[he+ee]=Y.buf[he]}function g(F,q){for(var Y=0;Y<F.length;Y++)q.writeVarint(F[Y])}function v(F,q){for(var Y=0;Y<F.length;Y++)q.writeSVarint(F[Y])}function w(F,q){for(var Y=0;Y<F.length;Y++)q.writeFloat(F[Y])}function S(F,q){for(var Y=0;Y<F.length;Y++)q.writeDouble(F[Y])}function A(F,q){for(var Y=0;Y<F.length;Y++)q.writeBoolean(F[Y])}function D(F,q){for(var Y=0;Y<F.length;Y++)q.writeFixed32(F[Y])}function R(F,q){for(var Y=0;Y<F.length;Y++)q.writeSFixed32(F[Y])}function O(F,q){for(var Y=0;Y<F.length;Y++)q.writeFixed64(F[Y])}function $(F,q){for(var Y=0;Y<F.length;Y++)q.writeSFixed64(F[Y])}function H(F,q){return(F[q]|F[q+1]<<8|F[q+2]<<16)+16777216*F[q+3]}function K(F,q,Y){F[Y]=q,F[Y+1]=q>>>8,F[Y+2]=q>>>16,F[Y+3]=q>>>24}function W(F,q){return(F[q]|F[q+1]<<8|F[q+2]<<16)+(F[q+3]<<24)}return e.prototype={destroy:function(){this.buf=null},readFields:function(F,q,Y){for(Y=Y||this.length;this.pos<Y;){var ee=this.readVarint(),he=ee>>3,ye=this.pos;this.type=7&ee,F(he,q,this),this.pos===ye&&this.skip(ee)}return q},readMessage:function(F,q){return this.readFields(F,q,this.readVarint()+this.pos)},readFixed32:function(){var F=H(this.buf,this.pos);return this.pos+=4,F},readSFixed32:function(){var F=W(this.buf,this.pos);return this.pos+=4,F},readFixed64:function(){var F=H(this.buf,this.pos)+H(this.buf,this.pos+4)*i;return this.pos+=8,F},readSFixed64:function(){var F=H(this.buf,this.pos)+W(this.buf,this.pos+4)*i;return this.pos+=8,F},readFloat:function(){var F=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,F},readDouble:function(){var F=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,F},readVarint:function(F){var q,Y,ee=this.buf;return q=127&(Y=ee[this.pos++]),Y<128?q:(q|=(127&(Y=ee[this.pos++]))<<7,Y<128?q:(q|=(127&(Y=ee[this.pos++]))<<14,Y<128?q:(q|=(127&(Y=ee[this.pos++]))<<21,Y<128?q:function(he,ye,ve){var Ce,Ue,et=ve.buf;if(Ce=(112&(Ue=et[ve.pos++]))>>4,Ue<128||(Ce|=(127&(Ue=et[ve.pos++]))<<3,Ue<128)||(Ce|=(127&(Ue=et[ve.pos++]))<<10,Ue<128)||(Ce|=(127&(Ue=et[ve.pos++]))<<17,Ue<128)||(Ce|=(127&(Ue=et[ve.pos++]))<<24,Ue<128)||(Ce|=(1&(Ue=et[ve.pos++]))<<31,Ue<128))return h(he,Ce,ye);throw new Error("Expected varint not more than 10 bytes")}(q|=(15&(Y=ee[this.pos]))<<28,F,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var F=this.readVarint();return F%2==1?(F+1)/-2:F/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var F=this.readVarint()+this.pos,q=this.pos;return this.pos=F,F-q>=12&&a?function(Y,ee,he){return a.decode(Y.subarray(ee,he))}(this.buf,q,F):function(Y,ee,he){for(var ye="",ve=ee;ve<he;){var Ce,Ue,et,Ye=Y[ve],Qe=null,ot=Ye>239?4:Ye>223?3:Ye>191?2:1;if(ve+ot>he)break;ot===1?Ye<128&&(Qe=Ye):ot===2?(192&(Ce=Y[ve+1]))==128&&(Qe=(31&Ye)<<6|63&Ce)<=127&&(Qe=null):ot===3?(Ue=Y[ve+2],(192&(Ce=Y[ve+1]))==128&&(192&Ue)==128&&((Qe=(15&Ye)<<12|(63&Ce)<<6|63&Ue)<=2047||Qe>=55296&&Qe<=57343)&&(Qe=null)):ot===4&&(Ue=Y[ve+2],et=Y[ve+3],(192&(Ce=Y[ve+1]))==128&&(192&Ue)==128&&(192&et)==128&&((Qe=(15&Ye)<<18|(63&Ce)<<12|(63&Ue)<<6|63&et)<=65535||Qe>=1114112)&&(Qe=null)),Qe===null?(Qe=65533,ot=1):Qe>65535&&(Qe-=65536,ye+=String.fromCharCode(Qe>>>10&1023|55296),Qe=56320|1023&Qe),ye+=String.fromCharCode(Qe),ve+=ot}return ye}(this.buf,q,F)},readBytes:function(){var F=this.readVarint()+this.pos,q=this.buf.subarray(this.pos,F);return this.pos=F,q},readPackedVarint:function(F,q){if(this.type!==e.Bytes)return F.push(this.readVarint(q));var Y=u(this);for(F=F||[];this.pos<Y;)F.push(this.readVarint(q));return F},readPackedSVarint:function(F){if(this.type!==e.Bytes)return F.push(this.readSVarint());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readSVarint());return F},readPackedBoolean:function(F){if(this.type!==e.Bytes)return F.push(this.readBoolean());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readBoolean());return F},readPackedFloat:function(F){if(this.type!==e.Bytes)return F.push(this.readFloat());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readFloat());return F},readPackedDouble:function(F){if(this.type!==e.Bytes)return F.push(this.readDouble());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readDouble());return F},readPackedFixed32:function(F){if(this.type!==e.Bytes)return F.push(this.readFixed32());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readFixed32());return F},readPackedSFixed32:function(F){if(this.type!==e.Bytes)return F.push(this.readSFixed32());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readSFixed32());return F},readPackedFixed64:function(F){if(this.type!==e.Bytes)return F.push(this.readFixed64());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readFixed64());return F},readPackedSFixed64:function(F){if(this.type!==e.Bytes)return F.push(this.readSFixed64());var q=u(this);for(F=F||[];this.pos<q;)F.push(this.readSFixed64());return F},skip:function(F){var q=7&F;if(q===e.Varint)for(;this.buf[this.pos++]>127;);else if(q===e.Bytes)this.pos=this.readVarint()+this.pos;else if(q===e.Fixed32)this.pos+=4;else{if(q!==e.Fixed64)throw new Error("Unimplemented type: "+q);this.pos+=8}},writeTag:function(F,q){this.writeVarint(F<<3|q)},realloc:function(F){for(var q=this.length||16;q<this.pos+F;)q*=2;if(q!==this.length){var Y=new Uint8Array(q);Y.set(this.buf),this.buf=Y,this.length=q}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(F){this.realloc(4),K(this.buf,F,this.pos),this.pos+=4},writeSFixed32:function(F){this.realloc(4),K(this.buf,F,this.pos),this.pos+=4},writeFixed64:function(F){this.realloc(8),K(this.buf,-1&F,this.pos),K(this.buf,Math.floor(F*s),this.pos+4),this.pos+=8},writeSFixed64:function(F){this.realloc(8),K(this.buf,-1&F,this.pos),K(this.buf,Math.floor(F*s),this.pos+4),this.pos+=8},writeVarint:function(F){(F=+F||0)>268435455||F<0?function(q,Y){var ee,he;if(q>=0?(ee=q%4294967296|0,he=q/4294967296|0):(he=~(-q/4294967296),4294967295^(ee=~(-q%4294967296))?ee=ee+1|0:(ee=0,he=he+1|0)),q>=18446744073709552e3||q<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");Y.realloc(10),function(ye,ve,Ce){Ce.buf[Ce.pos++]=127&ye|128,ye>>>=7,Ce.buf[Ce.pos++]=127&ye|128,ye>>>=7,Ce.buf[Ce.pos++]=127&ye|128,ye>>>=7,Ce.buf[Ce.pos++]=127&ye|128,Ce.buf[Ce.pos]=127&(ye>>>=7)}(ee,0,Y),function(ye,ve){var Ce=(7&ye)<<4;ve.buf[ve.pos++]|=Ce|((ye>>>=3)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye)))))}(he,Y)}(F,this):(this.realloc(4),this.buf[this.pos++]=127&F|(F>127?128:0),F<=127||(this.buf[this.pos++]=127&(F>>>=7)|(F>127?128:0),F<=127||(this.buf[this.pos++]=127&(F>>>=7)|(F>127?128:0),F<=127||(this.buf[this.pos++]=F>>>7&127))))},writeSVarint:function(F){this.writeVarint(F<0?2*-F-1:2*F)},writeBoolean:function(F){this.writeVarint(!!F)},writeString:function(F){F=String(F),this.realloc(4*F.length),this.pos++;var q=this.pos;this.pos=function(ee,he,ye){for(var ve,Ce,Ue=0;Ue<he.length;Ue++){if((ve=he.charCodeAt(Ue))>55295&&ve<57344){if(!Ce){ve>56319||Ue+1===he.length?(ee[ye++]=239,ee[ye++]=191,ee[ye++]=189):Ce=ve;continue}if(ve<56320){ee[ye++]=239,ee[ye++]=191,ee[ye++]=189,Ce=ve;continue}ve=Ce-55296<<10|ve-56320|65536,Ce=null}else Ce&&(ee[ye++]=239,ee[ye++]=191,ee[ye++]=189,Ce=null);ve<128?ee[ye++]=ve:(ve<2048?ee[ye++]=ve>>6|192:(ve<65536?ee[ye++]=ve>>12|224:(ee[ye++]=ve>>18|240,ee[ye++]=ve>>12&63|128),ee[ye++]=ve>>6&63|128),ee[ye++]=63&ve|128)}return ye}(this.buf,F,this.pos);var Y=this.pos-q;Y>=128&&m(q,Y,this),this.pos=q-1,this.writeVarint(Y),this.pos+=Y},writeFloat:function(F){this.realloc(4),r.write(this.buf,F,this.pos,!0,23,4),this.pos+=4},writeDouble:function(F){this.realloc(8),r.write(this.buf,F,this.pos,!0,52,8),this.pos+=8},writeBytes:function(F){var q=F.length;this.writeVarint(q),this.realloc(q);for(var Y=0;Y<q;Y++)this.buf[this.pos++]=F[Y]},writeRawMessage:function(F,q){this.pos++;var Y=this.pos;F(q,this);var ee=this.pos-Y;ee>=128&&m(Y,ee,this),this.pos=Y-1,this.writeVarint(ee),this.pos+=ee},writeMessage:function(F,q,Y){this.writeTag(F,e.Bytes),this.writeRawMessage(q,Y)},writePackedVarint:function(F,q){q.length&&this.writeMessage(F,g,q)},writePackedSVarint:function(F,q){q.length&&this.writeMessage(F,v,q)},writePackedBoolean:function(F,q){q.length&&this.writeMessage(F,A,q)},writePackedFloat:function(F,q){q.length&&this.writeMessage(F,w,q)},writePackedDouble:function(F,q){q.length&&this.writeMessage(F,S,q)},writePackedFixed32:function(F,q){q.length&&this.writeMessage(F,D,q)},writePackedSFixed32:function(F,q){q.length&&this.writeMessage(F,R,q)},writePackedFixed64:function(F,q){q.length&&this.writeMessage(F,O,q)},writePackedSFixed64:function(F,q){q.length&&this.writeMessage(F,$,q)},writeBytesField:function(F,q){this.writeTag(F,e.Bytes),this.writeBytes(q)},writeFixed32Field:function(F,q){this.writeTag(F,e.Fixed32),this.writeFixed32(q)},writeSFixed32Field:function(F,q){this.writeTag(F,e.Fixed32),this.writeSFixed32(q)},writeFixed64Field:function(F,q){this.writeTag(F,e.Fixed64),this.writeFixed64(q)},writeSFixed64Field:function(F,q){this.writeTag(F,e.Fixed64),this.writeSFixed64(q)},writeVarintField:function(F,q){this.writeTag(F,e.Varint),this.writeVarint(q)},writeSVarintField:function(F,q){this.writeTag(F,e.Varint),this.writeSVarint(q)},writeStringField:function(F,q){this.writeTag(F,e.Bytes),this.writeString(q)},writeFloatField:function(F,q){this.writeTag(F,e.Fixed32),this.writeFloat(q)},writeDoubleField:function(F,q){this.writeTag(F,e.Fixed64),this.writeDouble(q)},writeBooleanField:function(F,q){this.writeVarintField(F,!!q)}},C0}var p_=Zo(O2());const P0=3;function $3(r,e,i){e.glyphs=[],r===1&&i.readMessage(G3,e)}function G3(r,e,i){if(r===3){const{id:s,bitmap:a,width:u,height:h,left:m,top:g,advance:v}=i.readMessage(H3,{});e.glyphs.push({id:s,bitmap:new Ul({width:u+2*P0,height:h+2*P0},a),metrics:{width:u,height:h,left:m,top:g,advance:v}})}else r===4?e.ascender=i.readSVarint():r===5&&(e.descender=i.readSVarint())}function H3(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}const F2=P0,lo={horizontal:1,vertical:2,horizontalOnly:3};class Bp{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const s=new Bp;return s.scale=e||1,s.fontStack=i,s}static forImage(e){const i=new Bp;return i.image=e,i}}class Oh{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,s){const a=new Oh;for(let u=0;u<e.sections.length;u++){const h=e.sections[u];h.image?a.addImageSection(h,s):a.addTextSection(h,i)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(i,s){let a="";for(let u=0;u<i.length;u++){const h=i.charCodeAt(u+1)||null,m=i.charCodeAt(u-1)||null;a+=!s&&(h&&Mm(h)&&!Fp[i[u+1]]||m&&Mm(m)&&!Fp[i[u-1]])||!Fp[i[u]]?i[u]:Fp[i[u]]}return a}(this.text,e)}trim(){let e=0;for(let s=0;s<this.text.length&&f_[this.text.charCodeAt(s)];s++)e++;let i=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&f_[this.text.charCodeAt(s)];s--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const s=new Oh;return s.text=this.text.substring(e,i),s.sectionIndex=this.sectionIndex.slice(e,i),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(Bp.forText(e.scale,e.fontStack||i));const s=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(s)}addImageSection(e,i){const s=e.image?e.image.getPrimary():null;if(!s)return void yi("Can't add FormattedSection with an empty image.");s.scaleSelf(i);const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(Bp.forImage(s)),this.sectionIndex.push(this.sections.length-1)):yi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function D0(r,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O=1){const $=Oh.fromFeature(r,a,O);S===lo.vertical&&$.verticalizePunctuation(A);let H=[];const K=function(ee,he,ye,ve,Ce,Ue){if(!ee)return[];const et=[],Ye=function(Je,Fe,Ve,lt,ut,zt){let Et=0;for(let gt=0;gt<Je.length();gt++){const at=Je.getSection(gt);Et+=B2(Je.getCodePoint(gt),at,lt,ut,Fe,zt)}return Et/Math.max(1,Math.ceil(Et/Ve))}(ee,he,ye,ve,Ce,Ue),Qe=ee.text.indexOf("")>=0;let ot=0;for(let Je=0;Je<ee.length();Je++){const Fe=ee.getSection(Je),Ve=ee.getCodePoint(Je);if(f_[Ve]||(ot+=B2(Ve,Fe,ve,Ce,he,Ue)),Je<ee.length()-1){const lt=!((je=Ve)<11904||!(jt["Bopomofo Extended"](je)||jt.Bopomofo(je)||jt["CJK Compatibility Forms"](je)||jt["CJK Compatibility Ideographs"](je)||jt["CJK Compatibility"](je)||jt["CJK Radicals Supplement"](je)||jt["CJK Strokes"](je)||jt["CJK Symbols and Punctuation"](je)||jt["CJK Unified Ideographs Extension A"](je)||jt["CJK Unified Ideographs"](je)||jt["Enclosed CJK Letters and Months"](je)||jt["Halfwidth and Fullwidth Forms"](je)||jt.Hiragana(je)||jt["Ideographic Description Characters"](je)||jt["Kangxi Radicals"](je)||jt["Katakana Phonetic Extensions"](je)||jt.Katakana(je)||jt["Vertical Forms"](je)||jt["Yi Radicals"](je)||jt["Yi Syllables"](je)));(q3[Ve]||lt||Fe.image)&&et.push(j2(Je+1,ot,Ye,et,Z3(Ve,ee.getCodePoint(Je+1),lt&&Qe),!1))}}var je;return V2(j2(ee.length(),ot,Ye,et,0,!0))}($,v,u,e,s,D),{processBidirectionalText:W,processStyledBidirectionalText:F}=vo;if(W&&$.sections.length===1){const ee=W($.toString(),K);for(const he of ee){const ye=new Oh;ye.text=he,ye.sections=$.sections;for(let ve=0;ve<he.length;ve++)ye.sectionIndex.push(0);H.push(ye)}}else if(F){const ee=F($.text,$.sectionIndex,K);for(const he of ee){const ye=new Oh;ye.text=he[0],ye.sectionIndex=he[1],ye.sections=$.sections,H.push(ye)}}else H=function(ee,he){const ye=[],ve=ee.text;let Ce=0;for(const Ue of he)ye.push(ee.substring(Ce,Ue)),Ce=Ue;return Ce<ve.length&&ye.push(ee.substring(Ce,ve.length)),ye}($,K);const q=[],Y={positionedLines:q,text:$.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:S,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(ee,he,ye,ve,Ce,Ue,et,Ye,Qe,ot,je,Je){let Fe=0,Ve=0,lt=0;const ut=Ye==="right"?1:Ye==="left"?0:.5;let zt=!1;for(const Pt of Ce){const Ht=Pt.getSections();for(const ii of Ht){if(ii.image)continue;const oi=he[ii.fontStack];if(oi&&(zt=oi.ascender!==void 0&&oi.descender!==void 0,!zt))break}if(!zt)break}let Et=0;for(const Pt of Ce){Pt.trim();const Ht=Pt.getMaxScale(),ii=(Ht-1)*xn,oi={positionedGlyphs:[],lineOffset:0};ee.positionedLines[Et]=oi;const fi=oi.positionedGlyphs;let ci=0;if(!Pt.length()){Ve+=Ue,++Et;continue}let ai=0,tr=0;for(let J=0;J<Pt.length();J++){const te=Pt.getSection(J),Ge=Pt.getSectionIndex(J),pt=Pt.getCodePoint(J);let vt=te.scale,yt=null,Dt=null,Gt=null,wi=xn,Ti=0;Qe===lo.vertical&&((gt=pt)===12312||gt===12313||gt===12316||gt===12540||gt===12448)&&(Qe=lo.horizontal);const li=!(Qe===lo.horizontal||!je&&!Oc(pt)||je&&(f_[pt]||$y(pt)));if(te.image){const Hi=ve.get(te.image.toString());if(!Hi)continue;Gt=te.image,ee.iconsInText=ee.iconsInText||!0,Dt=Hi.paddedRect;const sr=Hi.displaySize;vt=vt*xn/Je,yt={width:sr[0],height:sr[1],left:0,top:-F2,advance:li?sr[1]:sr[0],localGlyph:!1},Ti=zt?-yt.height*vt:Ht*xn-17-sr[1]*vt,wi=yt.advance;const Si=(li?sr[0]:sr[1])*vt-xn*Ht;Si>0&&Si>ci&&(ci=Si)}else{const Hi=ye[te.fontStack];if(!Hi)continue;Hi[pt]&&(Dt=Hi[pt]);const sr=he[te.fontStack];if(!sr)continue;const Si=sr.glyphs[pt];if(!Si)continue;if(yt=Si.metrics,wi=pt!==8203?xn:0,zt){const Mr=sr.ascender!==void 0?Math.abs(sr.ascender):0,hr=sr.descender!==void 0?Math.abs(sr.descender):0,Vi=(Mr+hr)*vt;ai<Vi&&(ai=Vi,tr=(Mr-hr)/2*vt),Ti=-Mr*vt}else Ti=(Ht-vt)*xn-17}li?(ee.verticalizable=!0,fi.push({glyph:pt,image:Gt,x:Fe,y:Ve+Ti,vertical:li,scale:vt,localGlyph:yt.localGlyph,fontStack:te.fontStack,sectionIndex:Ge,metrics:yt,rect:Dt}),Fe+=wi*vt+ot):(fi.push({glyph:pt,image:Gt,x:Fe,y:Ve+Ti,vertical:li,scale:vt,localGlyph:yt.localGlyph,fontStack:te.fontStack,sectionIndex:Ge,metrics:yt,rect:Dt}),Fe+=yt.advance*vt+ot)}fi.length!==0&&(lt=Math.max(Fe-ot,lt),zt?U2(fi,ut,ci,tr,Ue*Ht/2):U2(fi,ut,ci,0,Ue/2)),Fe=0;const ur=Ue*Ht+ci;oi.lineOffset=Math.max(ci,ii),Ve+=ur,++Et}var gt;const at=Ve,{horizontalAlign:Xt,verticalAlign:Mt}=R0(et);(function(Pt,Ht,ii,oi,fi,ci){const ai=(Ht-ii)*fi,tr=-ci*oi;for(const ur of Pt)for(const J of ur.positionedGlyphs)J.x+=ai,J.y+=tr})(ee.positionedLines,ut,Xt,Mt,lt,at),ee.top+=-Mt*at,ee.bottom=ee.top+at,ee.left+=-Xt*lt,ee.right=ee.left+lt,ee.hasBaseline=zt}(Y,e,i,s,H,h,m,g,S,v,A,R),!function(ee){for(const he of ee)if(he.positionedGlyphs.length!==0)return!1;return!0}(q))return Y}const f_={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},q3={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function B2(r,e,i,s,a,u){if(e.image){const h=s.get(e.image.toString());return h?h.displaySize[0]*e.scale*xn/u+a:0}{const h=i[e.fontStack],m=h&&h.glyphs[r];return m?m.metrics.advance*e.scale+a:0}}function N2(r,e,i,s){const a=Math.pow(r-e,2);return s?r<e?a/2:2*a:a+Math.abs(i)*i}function Z3(r,e,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function j2(r,e,i,s,a,u){let h=null,m=N2(e,i,a,u);for(const g of s){const v=N2(e-g.x,i,a,u)+g.badness;v<=m&&(h=g,m=v)}return{index:r,x:e,priorBreak:h,badness:m}}function V2(r){return r?V2(r.priorBreak).concat(r.index):[]}function R0(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function U2(r,e,i,s,a){if(!(e||i||s||a))return;const u=r.length-1,h=r[u],m=(h.x+h.metrics.advance*h.scale)*e;for(let g=0;g<=u;g++)r[g].x-=m,r[g].y+=i+s+a}function $2(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function W3(r,e,i,s){const{horizontalAlign:a,verticalAlign:u}=R0(s),h=i[0]-r.displaySize[0]*a,m=i[1]-r.displaySize[1]*u;return{imagePrimary:r,imageSecondary:e,top:m,bottom:m+r.displaySize[1],left:h,right:h+r.displaySize[0]}}function G2(r,e,i,s,a,u){const h=r.imagePrimary;let m;if(h.content){const $=h.content,H=h.pixelRatio||1;m=[$[0]/H,$[1]/H,h.displaySize[0]-$[2]/H,h.displaySize[1]-$[3]/H]}const g=e.left*u,v=e.right*u;let w,S,A,D;i==="width"||i==="both"?(D=a[0]+g-s[3],S=a[0]+v+s[1]):(D=a[0]+(g+v-h.displaySize[0])/2,S=D+h.displaySize[0]);const R=e.top*u,O=e.bottom*u;return i==="height"||i==="both"?(w=a[1]+R-s[0],A=a[1]+O+s[2]):(w=a[1]+(R+O-h.displaySize[1])/2,A=w+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:w,right:S,bottom:A,left:D,collisionPadding:m}}function H2(r){return!r.imagePrimary.stretchX}function q2(r){return!r.imagePrimary.stretchY}function Z2(r){return{width:r.right-r.left,height:r.bottom-r.top}}const oa=128;function W2(r,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new Wi(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:a}=i;let u=0;for(;u<s.length&&s[u]<=r;)u++;u=Math.max(0,u-1);let h=u;for(;h<s.length&&s[h]<r+1;)h++;h=Math.min(s.length-1,h);const m=s[u],g=s[h];return i.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:a}:{kind:"camera",minZoom:m,maxZoom:g,minSize:i.evaluate(new Wi(m)),maxSize:i.evaluate(new Wi(g)),interpolationType:a}}}function z0(r,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:a}){return r.kind==="source"?s/oa:r.kind==="composite"?Nt(s/oa,a/oa,i):e}function Np(r,e,i=1){let s=0,a=0;if(r.kind==="constant")a=r.layoutSize*i;else if(r.kind!=="source"){const{interpolationType:u,minZoom:h,maxZoom:m}=r,g=u?Te(Wn.interpolationFactor(u,e,h,m),0,1):0;r.kind==="camera"?a=Nt(r.minSize,r.maxSize,g)*i:s=g*i}return{uSizeT:s,uSize:a}}class Wa extends ft{constructor(e,i,s,a,u){super(e,i),this.angle=a,this.z=s,u!==void 0&&(this.segment=u)}clone(){return new Wa(this.x,this.y,this.z,this.angle,this.segment)}}function X2(r,e,i,s,a){if(e.segment===void 0)return!0;let u=e,h=e.segment+1,m=0;for(;m>-i/2;){if(h--,h<0)return!1;m-=r[h].dist(u),u=r[h]}m+=r[h].dist(r[h+1]),h++;const g=[];let v=0;for(;m<i/2;){const w=r[h],S=r[h+1];if(!S)return!1;let A=r[h-1].angleTo(w)-w.angleTo(S);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:A}),v+=A;m-g[0].distance>s;)v-=g.shift().angleDelta;if(v>a)return!1;h++,m+=w.dist(S)}return!0}function Y2(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function K2(r,e,i){return r?.6*e*i:0}function J2(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function X3(r,e,i,s,a,u){const h=K2(i,a,u),m=J2(i,s)*u;let g=0;const v=Y2(r)/2;for(let w=0;w<r.length-1;w++){const S=r[w],A=r[w+1],D=S.dist(A);if(g+D>v){const R=(v-g)/D,O=Nt(S.x,A.x,R),$=Nt(S.y,A.y,R),H=new Wa(O,$,0,A.angleTo(S),w);return!h||X2(r,H,m,h,e)?H:void 0}g+=D}}function Y3(r,e,i,s,a,u,h,m,g){const v=K2(s,u,h),w=J2(s,a),S=w*h,A=r[0].x===0||r[0].x===g||r[0].y===0||r[0].y===g;return e-S<e/4&&(e=S+e/4),Q2(r,A?e/2*m%e:(w/2+2*u)*h*m%e,e,v,i,S,A,!1,g)}function Q2(r,e,i,s,a,u,h,m,g){const v=u/2,w=Y2(r);let S=0,A=e-i,D=[];for(let R=0;R<r.length-1;R++){const O=r[R],$=r[R+1],H=O.dist($),K=$.angleTo(O);for(;A+i<S+H;){A+=i;const W=(A-S)/H,F=Nt(O.x,$.x,W),q=Nt(O.y,$.y,W);if(F>=0&&F<g&&q>=0&&q<g&&A-v>=0&&A+v<=w){const Y=new Wa(F,q,0,K,R);s&&!X2(r,Y,u,s,a)||D.push(Y)}}S+=H}return m||D.length||h||(D=Q2(r,S/2,i,s,a,u,h,!0,g)),D}function eT(r){let e=0,i=0;for(const h of r)e+=h.w*h.h,i=Math.max(i,h.w);r.sort((h,m)=>m.h-h.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,u=0;for(const h of r)for(let m=s.length-1;m>=0;m--){const g=s[m];if(!(h.w>g.w||h.h>g.h)){if(h.x=g.x,h.y=g.y,u=Math.max(u,h.y+h.h),a=Math.max(a,h.x+h.w),h.w===g.w&&h.h===g.h){const v=s.pop();m<s.length&&(s[m]=v)}else h.h===g.h?(g.x+=h.w,g.w-=h.w):h.w===g.w?(g.y+=h.h,g.h-=h.h):(s.push({x:g.x+h.w,y:g.y,w:g.w-h.w,h:h.h}),g.y+=h.h,g.h-=h.h);break}}return{w:a,h:u,fill:e/(a*u)||0}}Tt(Wa,"Anchor");const tu=1;class jp{static getImagePositionScale(e,i,s){if(i&&e&&e.options&&e.options.transform){const a=e.options.transform;return{x:a.a,y:a.d}}return{x:s,y:s}}constructor(e,i,s,a){this.paddedRect=e;const{pixelRatio:u,version:h,stretchX:m,stretchY:g,content:v,sdf:w,usvg:S}=i;this.pixelRatio=u,this.stretchX=m,this.stretchY=g,this.content=v,this.version=h,this.padding=s,this.sdf=w,this.scale=jp.getImagePositionScale(a,S,u)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function L0(r,e,i){const s=Po.parse(r),a=function(u,h,m=[1,1]){return{x:0,y:0,w:(u.data?u.data.width:u.width*m[0])+2*h,h:(u.data?u.data.height:u.height*m[1])+2*h}}(e,i,[s.options.transform.a,s.options.transform.d]);return{bin:a,imagePosition:new jp(a,e,i,s),imageVariant:s}}class tT{constructor(e,i,s){const a=new Map,u=new Map;this.haveRenderCallbacks=[];const h=[];this.addImages(e,a,tu,h),this.addImages(i,u,2,h);const{w:m,h:g}=eT(h),v=new In({width:m||1,height:g||1});for(const[w,S]of e.entries()){const A=a.get(w).paddedRect;In.copy(S.data,v,{x:0,y:0},{x:A.x+tu,y:A.y+tu},S.data,s,S.sdf)}for(const[w,S]of i.entries()){const A=u.get(w),D=A.paddedRect;let R=A.padding;const O=D.x+R,$=D.y+R,H=S.data.width,K=S.data.height;R=R>1?R-1:R,In.copy(S.data,v,{x:0,y:0},{x:O,y:$},S.data,s),In.copy(S.data,v,{x:0,y:K-R},{x:O,y:$-R},{width:H,height:R},s),In.copy(S.data,v,{x:0,y:0},{x:O,y:$+K},{width:H,height:R},s),In.copy(S.data,v,{x:H-R,y:0},{x:O-R,y:$},{width:R,height:K},s),In.copy(S.data,v,{x:0,y:0},{x:O+H,y:$},{width:R,height:K},s),In.copy(S.data,v,{x:H-R,y:K-R},{x:O-R,y:$-R},{width:R,height:R},s),In.copy(S.data,v,{x:0,y:K-R},{x:O+H,y:$-R},{width:R,height:R},s),In.copy(S.data,v,{x:0,y:0},{x:O+H,y:$+K},{width:R,height:R},s),In.copy(S.data,v,{x:H-R,y:0},{x:O-R,y:$+K},{width:R,height:R},s)}this.lut=s,this.image=v,this.iconPositions=a,this.patternPositions=u}addImages(e,i,s,a){for(const[u,h]of e.entries()){const{bin:m,imagePosition:g,imageVariant:v}=L0(u,h,s);i.set(u,g),a.push(m),h.hasRenderCallback&&this.haveRenderCallbacks.push(v.id)}}patchUpdatedImages(e,i,s){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(a=>e.hasImage(a,s)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,s);for(const a of e.getUpdatedImages(s)){for(const u of this.iconPositions.keys()){const h=Po.parse(u);if(eo.isEqual(h.id,a)){const m=e.getImage(a,s);this.patchUpdatedImage(this.iconPositions.get(u),m,i)}}for(const u of this.patternPositions.keys()){const h=Po.parse(u);if(eo.isEqual(h.id,a)){const m=e.getImage(a,s);this.patchUpdatedImage(this.patternPositions.get(u),m,i)}}}}patchUpdatedImage(e,i,s){if(!e||!i||e.version===i.version)return;e.version=i.version;const[a,u]=e.tl,h=e.sdf;if(this.lut||h){const m={width:i.data.width,height:i.data.height},g=new In(m);In.copy(i.data,g,{x:0,y:0},{x:0,y:0},m,this.lut,h),s.update(g,{position:{x:a,y:u}})}else s.update(i.data,{position:{x:a,y:u}})}}Tt(jp,"ImagePosition"),Tt(tT,"ImageAtlas");const Vp=1e20;function iT(r,e,i,s,a,u,h,m,g){for(let v=e;v<e+s;v++)rT(r,i*u+v,u,a,h,m,g);for(let v=i;v<i+a;v++)rT(r,v*u+e,1,s,h,m,g)}function rT(r,e,i,s,a,u,h){u[0]=0,h[0]=-Vp,h[1]=Vp,a[0]=r[e];for(let m=1,g=0,v=0;m<s;m++){a[m]=r[e+m*i];const w=m*m;do{const S=u[g];v=(a[m]-a[S]+w-S*S)/(m-S)/2}while(v<=h[g]&&--g>-1);g++,u[g]=m,h[g]=v,h[g+1]=Vp}for(let m=0,g=0;m<s;m++){for(;h[g+1]<m;)g++;const v=u[g],w=m-v;r[e+m*i]=a[v]+w*w}}const Ss=2,k0={none:0,ideographs:1,all:2};class Fh{constructor(e,i,s){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=s,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,s){const a=[],u=this.urls[i]||An.GLYPHS_URL;for(const h in e)for(const m of e[h])a.push({stack:h,id:m});qe(a,({stack:h,id:m},g)=>{let v=this.entries[h];v||(v=this.entries[h]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let w=v.glyphs[m];if(w!==void 0)return void g(null,{stack:h,id:m,glyph:w});if(w=this._tinySDF(v,h,m),w)return v.glyphs[m]=w,void g(null,{stack:h,id:m,glyph:w});const S=Math.floor(m/256);if(256*S>65535)return yi("glyphs > 65535 not supported"),void g(null,{stack:h,id:m,glyph:w});if(v.ranges[S])return void g(null,{stack:h,id:m,glyph:w});let A=v.requests[S];A||(A=v.requests[S]=[],Fh.loadGlyphRange(h,S,u,this.requestManager,(D,R)=>{if(R){v.ascender=R.ascender,v.descender=R.descender;for(const O in R.glyphs)this._doesCharSupportLocalGlyph(+O)||(v.glyphs[+O]=R.glyphs[+O]);v.ranges[S]=!0}for(const O of A)O(D,R);delete v.requests[S]})),A.push((D,R)=>{D?g(D):R&&g(null,{stack:h,id:m,glyph:R.glyphs[m]||null})})},(h,m)=>{if(h)s(h);else if(m){const g={};for(const{stack:v,id:w,glyph:S}of m)g[v]===void 0&&(g[v]={}),g[v].glyphs===void 0&&(g[v].glyphs={}),g[v].glyphs[w]=S&&{id:S.id,bitmap:S.bitmap.clone(),metrics:S.metrics},g[v].ascender=this.entries[v].ascender,g[v].descender=this.entries[v].descender;s(null,g)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==k0.none&&(this.localGlyphMode===k0.all?!!this.localFontFamily:!!this.localFontFamily&&(jt["CJK Unified Ideographs"](e)||jt["Hangul Syllables"](e)||jt.Hiragana(e)||jt.Katakana(e)||jt["CJK Symbols and Punctuation"](e)||jt["CJK Unified Ideographs Extension A"](e)||jt["CJK Unified Ideographs Extension B"](e)||jt.Osage(e)))}_tinySDF(e,i,s){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(s))return;let u=e.tinySDF;if(!u){let O="400";/bold/i.test(i)?O="900":/medium/i.test(i)?O="500":/light/i.test(i)&&(O="200"),u=e.tinySDF=new Fh.TinySDF({fontFamily:a,fontWeight:O,fontSize:24*Ss,buffer:3*Ss,radius:8*Ss}),u.fontWeight=O}if(this.localGlyphs[u.fontWeight][s])return this.localGlyphs[u.fontWeight][s];const h=String.fromCodePoint(s),{data:m,width:g,height:v,glyphWidth:w,glyphHeight:S,glyphLeft:A,glyphTop:D,glyphAdvance:R}=u.draw(h);return this.localGlyphs[u.fontWeight][s]={id:s,bitmap:new Ul({width:g,height:v},m),metrics:{width:w/Ss,height:S/Ss,left:A/Ss,top:D/Ss-27,advance:R/Ss,localGlyph:!0}}}}Fh.loadGlyphRange=function(r,e,i,s,a){const u=256*e,h=u+255,m=s.transformRequest(s.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${u}-${h}`),ku.Glyphs);cl(m,(g,v)=>{if(g)a(g);else if(v){const w={},S=function(A){return new p_(A).readFields($3,{})}(v);for(const A of S.glyphs)w[A.id]=A;a(null,{glyphs:w,ascender:S.ascender,descender:S.descender})}})},Fh.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:a="sans-serif",fontWeight:u="normal",fontStyle:h="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const m=this.size=r+4*e,g=this._createCanvas(m),v=this.ctx=g.getContext("2d",{willReadFrequently:!0});v.font=`${h} ${u} ${r}px ${a}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(m*m),this.gridInner=new Float64Array(m*m),this.f=new Float64Array(m),this.z=new Float64Array(m+1),this.v=new Uint16Array(m)}_createCanvas(r){const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:a,actualBoundingBoxRight:u}=this.ctx.measureText(r),h=Math.ceil(i),m=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-a))),g=Math.min(this.size-this.buffer,h+Math.ceil(s)),v=m+2*this.buffer,w=g+2*this.buffer,S=Math.max(v*w,0),A=new Uint8ClampedArray(S),D={data:A,width:v,height:w,glyphWidth:m,glyphHeight:g,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(m===0||g===0)return D;const{ctx:R,buffer:O,gridInner:$,gridOuter:H}=this;R.clearRect(O,O,m,g),R.fillText(r,O,O+h);const K=R.getImageData(O,O,m,g);H.fill(Vp,0,S),$.fill(0,0,S);for(let W=0;W<g;W++)for(let F=0;F<m;F++){const q=K.data[4*(W*m+F)+3]/255;if(q===0)continue;const Y=(W+O)*v+F+O;if(q===1)H[Y]=0,$[Y]=Vp;else{const ee=.5-q;H[Y]=ee>0?ee*ee:0,$[Y]=ee<0?ee*ee:0}}iT(H,0,0,v,w,v,this.f,this.v,this.z),iT($,O,O,m,g,v,this.f,this.v,this.z);for(let W=0;W<S;W++){const F=Math.sqrt(H[W])-Math.sqrt($[W]);A[W]=Math.round(255-255*(F/this.radius+this.cutoff))}return D}};const Hl=tu;function nT(r,e){return r+e[1]-e[0]}function oT(r,e,i,s,a=1){const u=[],h=r.imagePrimary,m=h.pixelRatio,g=h.paddedRect.w-2*Hl,v=h.paddedRect.h-2*Hl,w=(r.right-r.left)*a,S=(r.bottom-r.top)*a,A=h.stretchX||[[0,g]],D=h.stretchY||[[0,v]],R=A.reduce(nT,0),O=D.reduce(nT,0),$=g-R,H=v-O;let K=0,W=R,F=0,q=O,Y=0,ee=$,he=0,ye=H;if(h.content&&s){const Ce=h.content;K=m_(A,0,Ce[0]),F=m_(D,0,Ce[1]),W=m_(A,Ce[0],Ce[2]),q=m_(D,Ce[1],Ce[3]),Y=Ce[0]-K,he=Ce[1]-F,ee=Ce[2]-Ce[0]-W,ye=Ce[3]-Ce[1]-q}const ve=(Ce,Ue,et,Ye)=>{const Qe=__(Ce.stretch-K,W,w,r.left*a),ot=g_(Ce.fixed-Y,ee,Ce.stretch,R),je=__(Ue.stretch-F,q,S,r.top*a),Je=g_(Ue.fixed-he,ye,Ue.stretch,O),Fe=__(et.stretch-K,W,w,r.left*a),Ve=g_(et.fixed-Y,ee,et.stretch,R),lt=__(Ye.stretch-F,q,S,r.top*a),ut=g_(Ye.fixed-he,ye,Ye.stretch,O),zt=new ft(Qe,je),Et=new ft(Fe,je),gt=new ft(Fe,lt),at=new ft(Qe,lt),Xt=new ft(ot/m,Je/m),Mt=new ft(Ve/m,ut/m),Pt=e*Math.PI/180;if(Pt){const ai=Math.sin(Pt),tr=Math.cos(Pt),ur=[tr,-ai,ai,tr];zt._matMult(ur),Et._matMult(ur),at._matMult(ur),gt._matMult(ur)}const Ht=Ce.stretch+Ce.fixed,ii=et.stretch+et.fixed,oi=Ue.stretch+Ue.fixed,fi=Ye.stretch+Ye.fixed,ci=r.imageSecondary;return{tl:zt,tr:Et,bl:at,br:gt,texPrimary:{x:h.paddedRect.x+Hl+Ht,y:h.paddedRect.y+Hl+oi,w:ii-Ht,h:fi-oi},texSecondary:ci?{x:ci.paddedRect.x+Hl+Ht,y:ci.paddedRect.y+Hl+oi,w:ii-Ht,h:fi-oi}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Xt,pixelOffsetBR:Mt,minFontScaleX:ee/m/w,minFontScaleY:ye/m/S,isSDF:i}};if(s&&(h.stretchX||h.stretchY)){const Ce=sT(A,$,R),Ue=sT(D,H,O);for(let et=0;et<Ce.length-1;et++){const Ye=Ce[et],Qe=Ce[et+1];for(let ot=0;ot<Ue.length-1;ot++)u.push(ve(Ye,Ue[ot],Qe,Ue[ot+1]))}}else u.push(ve({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:g+1},{fixed:0,stretch:v+1}));return u}function m_(r,e,i){let s=0;for(const a of r)s+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return s}function sT(r,e,i){const s=[{fixed:-Hl,stretch:0}];for(const[a,u]of r){const h=s[s.length-1];s.push({fixed:a-h.stretch,stretch:h.stretch}),s.push({fixed:a-h.stretch,stretch:h.stretch+(u-a)})}return s.push({fixed:e+Hl,stretch:i}),s}function __(r,e,i,s){return r/e*i+s}function g_(r,e,i,s){return r-e*i/s}function K3(r,e,i,s){const a=e+r.positionedLines[s].lineOffset;return s===0?i+a/2:i+(a+(e+r.positionedLines[s-1].lineOffset))/2}function J3(r,e=1,i=!1){let s=1/0,a=1/0,u=-1/0,h=-1/0;const m=r[0];for(let D=0;D<m.length;D++){const R=m[D];(!D||R.x<s)&&(s=R.x),(!D||R.y<a)&&(a=R.y),(!D||R.x>u)&&(u=R.x),(!D||R.y>h)&&(h=R.y)}const g=Math.min(u-s,h-a);let v=g/2;const w=new qu([],Q3);if(g===0)return new ft(s,a);for(let D=s;D<u;D+=g)for(let R=a;R<h;R+=g)w.push(new Bh(D+v,R+v,v,r));let S=function(D){let R=0,O=0,$=0;const H=D[0];for(let K=0,W=H.length,F=W-1;K<W;F=K++){const q=H[K],Y=H[F],ee=q.x*Y.y-Y.x*q.y;O+=(q.x+Y.x)*ee,$+=(q.y+Y.y)*ee,R+=3*ee}return new Bh(O/R,$/R,0,D)}(r),A=w.length;for(;w.length;){const D=w.pop();(D.d>S.d||!S.d)&&(S=D,i&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,A)),D.max-S.d<=e||(v=D.h/2,w.push(new Bh(D.p.x-v,D.p.y-v,v,r)),w.push(new Bh(D.p.x+v,D.p.y-v,v,r)),w.push(new Bh(D.p.x-v,D.p.y+v,v,r)),w.push(new Bh(D.p.x+v,D.p.y+v,v,r)),A+=4)}return i&&(console.log(`num probes: ${A}`),console.log(`best distance: ${S.d}`)),S.p}function Q3(r,e){return e.max-r.max}class Bh{constructor(e,i,s,a){this.p=new ft(e,i),this.h=s,this.d=function(u,h){let m=!1,g=1/0;for(let v=0;v<h.length;v++){const w=h[v];for(let S=0,A=w.length,D=A-1;S<A;D=S++){const R=w[S],O=w[D];R.y>u.y!=O.y>u.y&&u.x<(O.x-R.x)*(u.y-R.y)/(O.y-R.y)+R.x&&(m=!m),g=Math.min(g,Ci(u,R,O))}}return(m?1:-1)*Math.sqrt(g)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const ek=Object.keys,O0=Number.POSITIVE_INFINITY,tk=Math.sqrt(2);function aT(r,[e,i]){let s=0,a=0;if(i===O0){e<0&&(e=0);const u=e/tk;switch(r){case"top-right":case"top-left":a=u-7;break;case"bottom-right":case"bottom-left":a=7-u;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(r){case"top-right":case"bottom-right":s=-u;break;case"top-left":case"bottom-left":s=u;break;case"left":s=e;break;case"right":s=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),r){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(r){case"top-right":case"bottom-right":case"right":s=-e;break;case"top-left":case"bottom-left":case"left":s=e}}return[s,a]}function y_(r,e,i,s,a,u,h,m,g){if(!e||!e.usvg)return;const v=Z2(s),w=Z2(a),S=u!=="both"&&u!=="width"||!H2(s)?1:Math.max(1,w.width/v.width),A=u!=="both"&&u!=="height"||!q2(s)?1:Math.max(1,w.height/v.height);i.scaleSelf(S,A);const D=i.toString();h.set(D,i),m.set(D,e);const{imagePosition:R}=L0(D,e,tu);g.set(D,R)}function lT(r,e,i,s,a,u,h,m){if(!r)return;const g=function(v,w,S,A,D){if(v.kind==="camera")return v.maxSize;if(v.kind==="composite"){const R=w.possiblyEvaluate(new Wi(v.maxZoom),S).evaluate(D,{},S),O=w.possiblyEvaluate(new Wi(v.minZoom),S).evaluate(D,{},S);return Math.max(R,O)}return w.possiblyEvaluate(new Wi(A)).evaluate(D,{},S)}(e,i,s,a,u);return r.scaleSelf(g*m*h)}function cT(r,e,i,s,a,u,h,m){return{iconPrimary:lT(r.getPrimary(),e,i,s,a,u,h,m),iconSecondary:lT(r.getSecondary(),e,i,s,a,u,h,m)}}function uT(r,e,i,s){if(!r)return;const a=e.get(i.toString());if(r.imagePrimary=a,s){const u=e.get(s.toString());r.imageSecondary=u}}function ik(r,e){for(const i in r.horizontal)hT(r.horizontal[i],e);hT(r.vertical,e)}function hT(r,e){if(r){for(const i of r.positionedLines)for(const s of i.positionedGlyphs)if(s.image!==null){const a=s.image.toString();s.rect=e.get(a).paddedRect}}}function F0(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function rk(r,e,i,s,a,u,h,m,g){const v=B0(u.horizontal)||u.vertical,w=i.get("icon-text-fit-padding").evaluate(s,{},a);let S,A=e;return e&&g!=="none"&&(r.allowVerticalPlacement&&u.vertical&&(S=G2(e,u.vertical,g,w,m,h)),v&&(A=G2(e,v,g,w,m,h))),{defaultShapedIcon:A,verticallyShapedIcon:S}}function nk(r,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H,K,W){let F=h.textMaxSize.evaluate(e,{},A);F===void 0?F=m*h.textScaleFactor:F*=h.textScaleFactor;const q=r.layers[0].layout,Y=B0(i.horizontal)||i.vertical,ee=D.name==="globe",he=xn,ye=r.tilePixelRatio*F/he,ve=(ot=r.overscaling,r.zoom>18&&ot>2&&(ot>>=1),Math.max(_t/(512*ot),1)*q.get("symbol-spacing")),Ce=q.get("text-padding")*r.tilePixelRatio,Ue=q.get("icon-padding")*r.tilePixelRatio,et=U(q.get("text-max-angle")),Ye=q.get("icon-rotation-alignment")==="map"&&W!=="point",Qe=ve/2;var ot;r.hasAnyIconTextFit===!1&&$!=="none"&&(r.hasAnyIconTextFit=!0);const je=e.properties?+e.properties[Kc]:null,Je=je&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(je):65535,Fe=(Ve,lt,ut)=>{if(lt.x<0||lt.x>=_t||lt.y<0||lt.y>=_t)return;let zt=null;if(ee){const{x:Et,y:gt,z:at}=D.projectTilePoint(lt.x,lt.y,ut);zt={anchor:new Wa(Et,gt,at,0,void 0),up:D.upVector(ut,lt.x,lt.y)}}(function(Et,gt,at,Xt,Mt,Pt,Ht,ii,oi,fi,ci,ai,tr,ur,J,te,Ge,pt,vt,yt,Dt,Gt,wi,Ti,li,Hi,sr,Si,Mr){const hr=Et.addToLineVertexArray(gt,Xt);let Vi,Vr,fr,ar,dr,qi,pi,Ki=0,Pr=0,Ut=0,Pi=0,mr=-1,Or=-1;const br={};let rn=Qn("");const ir=at?at.anchor:gt,Jr=Si!=="none";let ro=0,Cn=0;if(oi._unevaluatedLayout.getValue("text-radial-offset")===void 0){const nn=oi.layout.get("text-offset").evaluate(Dt,{},li);ro=nn[0]*xn,Cn=nn[1]*xn}else ro=oi.layout.get("text-radial-offset").evaluate(Dt,{},li)*xn,Cn=O0;if(Et.allowVerticalPlacement&&Mt.vertical){const nn=Mt.vertical;if(J)qi=N0(nn),ii&&(pi=N0(ii));else{const dn=oi.layout.get("text-rotate").evaluate(Dt,{},li)+90;fr=v_(fi,ir,gt,ci,ai,tr,nn,ur,dn,te),ii&&(ar=v_(fi,ir,gt,ci,ai,tr,ii,pt,dn))}}if(Pt){const nn=Et.iconSizeData,dn=oi.layout.get("icon-rotate").evaluate(Dt,{},li),Mn=oT(Pt,dn,wi,Jr,Gt.iconScaleFactor),Gn=ii?oT(ii,dn,wi,Jr,Gt.iconScaleFactor):void 0;Vr=v_(fi,ir,gt,ci,ai,tr,Pt,pt,dn,null),Ki=4*Mn.length;let Ln=null;nn.kind==="source"?(Ln=[oa*oi.layout.get("icon-size").evaluate(Dt,{},li)*Gt.iconScaleFactor],Ln[0]>ql&&yi(`${Et.layerIds[0]}: Value for "icon-size" is >= ${Up}. Reduce your "icon-size".`)):nn.kind==="composite"&&(Ln=[oa*Gt.compositeIconSizes[0].evaluate(Dt,{},li)*Gt.iconScaleFactor,oa*Gt.compositeIconSizes[1].evaluate(Dt,{},li)*Gt.iconScaleFactor],(Ln[0]>ql||Ln[1]>ql)&&yi(`${Et.layerIds[0]}: Value for "icon-size" is >= ${Up}. Reduce your "icon-size".`)),Et.addSymbols(Et.icon,Mn,Ln,yt,vt,Dt,void 0,at,gt,hr.lineStartIndex,hr.lineLength,-1,Ti,li,Hi,sr),mr=Et.icon.placedSymbolArray.length-1,Gn&&(Pr=4*Gn.length,Et.addSymbols(Et.icon,Gn,Ln,yt,vt,Dt,lo.vertical,at,gt,hr.lineStartIndex,hr.lineLength,-1,Ti,li,Hi,sr),Or=Et.icon.placedSymbolArray.length-1)}for(const nn in Mt.horizontal){const dn=nn,Mn=Mt.horizontal[dn];Vi||(rn=Qn(Mn.text),J?dr=N0(Mn):Vi=v_(fi,ir,gt,ci,ai,tr,Mn,ur,oi.layout.get("text-rotate").evaluate(Dt,{},li),te));const Gn=Mn.positionedLines.length===1;if(Ut+=dT(Et,at,gt,Mn,Ht,oi,J,Dt,te,hr,Mt.vertical?lo.horizontal:lo.horizontalOnly,Gn?ek(Mt.horizontal):[dn],br,mr,Gt,Ti,li,Hi),Gn)break}Mt.vertical&&(Pi+=dT(Et,at,gt,Mt.vertical,Ht,oi,J,Dt,te,hr,lo.vertical,["vertical"],br,Or,Gt,Ti,li,Hi));let Tn=-1;const no=(nn,dn)=>nn?Math.max(nn,dn):dn;Tn=no(dr,Tn),Tn=no(qi,Tn),Tn=no(pi,Tn);const sa=Tn>-1?1:0;Et.glyphOffsetArray.length>=65535&&yi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Dt.sortKey!==void 0&&Et.addToSortKeyRanges(Et.symbolInstances.length,Dt.sortKey),Et.symbolInstances.emplaceBack(gt.x,gt.y,ir.x,ir.y,ir.z,br.right>=0?br.right:-1,br.center>=0?br.center:-1,br.left>=0?br.left:-1,br.vertical>=0?br.vertical:-1,mr,Or,rn,Vi!==void 0?Vi:Et.collisionBoxArray.length,Vi!==void 0?Vi+1:Et.collisionBoxArray.length,fr!==void 0?fr:Et.collisionBoxArray.length,fr!==void 0?fr+1:Et.collisionBoxArray.length,Vr!==void 0?Vr:Et.collisionBoxArray.length,Vr!==void 0?Vr+1:Et.collisionBoxArray.length,ar||Et.collisionBoxArray.length,ar?ar+1:Et.collisionBoxArray.length,ci,Ut,Pi,Ki,Pr,sa,0,ro,Cn,Tn,0,Jr?1:0,Mr)})(r,lt,zt,Ve,i,s,u,a,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,Ce,K,v,0,Ue,Ye,H,e,h,w,S,A,R,O,$,Je)};if(W==="line")for(const Ve of d_(e.geometry,0,0,_t,_t)){const lt=Y3(Ve,ve,et,i.vertical||Y,s,he,ye,r.overscaling,_t);for(const ut of lt)Y&&ok(r,Y.text,Qe,ut)||Fe(Ve,ut,A)}else if(W==="line-center"){for(const Ve of e.geometry)if(Ve.length>1){const lt=X3(Ve,et,i.vertical||Y,s,he,ye);lt&&Fe(Ve,lt,A)}}else if(e.type==="Polygon")for(const Ve of o_(e.geometry,0)){const lt=J3(Ve,16);Fe(Ve[0],new Wa(lt.x,lt.y,0,0,void 0),A)}else if(e.type==="LineString")for(const Ve of e.geometry)Fe(Ve,new Wa(Ve[0].x,Ve[0].y,0,0,void 0),A);else if(e.type==="Point")for(const Ve of e.geometry)for(const lt of Ve)Fe([lt],new Wa(lt.x,lt.y,0,0,void 0),A)}const Up=255,ql=Up*oa;function dT(r,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$,H){const K=function(q,Y,ee,he,ye,ve,Ce,Ue){const et=[];if(Y.positionedLines.length===0)return et;const Ye=he.layout.get("text-rotate").evaluate(ve,{})*Math.PI/180,Qe=function(Ve){const lt=Ve[0],ut=Ve[1],zt=lt*ut;return zt>0?[lt,-ut]:zt<0?[-lt,ut]:lt===0?[ut,lt]:[ut,-lt]}(ee);let ot=Math.abs(Y.top-Y.bottom);for(const Ve of Y.positionedLines)ot-=Ve.lineOffset;const je=Y.positionedLines.length,Je=ot/je;let Fe=Y.top-ee[1];for(let Ve=0;Ve<je;++Ve){const lt=Y.positionedLines[Ve];Fe=K3(Y,Je,Fe,Ve);for(const ut of lt.positionedGlyphs){if(!ut.rect)continue;const zt=ut.rect||{};let Et=F2+1,gt=!0,at=1,Xt=0;if(ut.image){const Dt=Ce.get(ut.image.toString());if(!Dt)continue;if(Dt.sdf){yi("SDF images are not supported in formatted text and will be ignored.");continue}gt=!1,at=Dt.pixelRatio,Et=tu/at}const Mt=(ye||Ue)&&ut.vertical,Pt=ut.metrics.advance*ut.scale/2,Ht=ut.metrics,ii=ut.rect;if(ii===null)continue;Ue&&Y.verticalizable&&(Xt=ut.image?Pt-ut.metrics.width*ut.scale/2:0);const oi=ye?[ut.x+Pt,ut.y]:[0,0];let fi=[0,0],ci=[0,0],ai=!1;ye||(Mt?(ci=[ut.x+Pt+Qe[0],ut.y+Qe[1]-Xt],ai=!0):fi=[ut.x+Pt+ee[0],ut.y+ee[1]-Xt]);const tr=ii.w*ut.scale/(at*(ut.localGlyph?Ss:1)),ur=ii.h*ut.scale/(at*(ut.localGlyph?Ss:1));let J,te,Ge,pt;if(Mt){const Dt=ut.y-Fe,Gt=new ft(-Pt,Pt-Dt),wi=-Math.PI/2,Ti=new ft(...ci);J=new ft(-Pt+fi[0],fi[1]),J._rotateAround(wi,Gt)._add(Ti),J.x+=-Dt+Pt,J.y-=(Ht.left-Et)*ut.scale;const li=ut.image?Ht.advance*ut.scale:xn*ut.scale,Hi=String.fromCodePoint(ut.glyph);j3(Hi)?J.x+=(1-Et)*ut.scale:V3(Hi)?J.x+=li-Ht.height*ut.scale+(-Et-1)*ut.scale:J.x+=ut.image||Ht.width+2*Et===ii.w&&Ht.height+2*Et===ii.h?(li-ur)/2:(li-(Ht.height+2*Et)*ut.scale)/2,te=new ft(J.x,J.y-tr),Ge=new ft(J.x+ur,J.y),pt=new ft(J.x+ur,J.y-tr)}else{const Dt=(Ht.left-Et)*ut.scale-Pt+fi[0],Gt=(-Ht.top-Et)*ut.scale+fi[1],wi=Dt+tr,Ti=Gt+ur;J=new ft(Dt,Gt),te=new ft(wi,Gt),Ge=new ft(Dt,Ti),pt=new ft(wi,Ti)}if(Ye){let Dt;Dt=ye?new ft(0,0):ai?new ft(Qe[0],Qe[1]):new ft(ee[0],ee[1]),J._rotateAround(Ye,Dt),te._rotateAround(Ye,Dt),Ge._rotateAround(Ye,Dt),pt._rotateAround(Ye,Dt)}const vt=new ft(0,0),yt=new ft(0,0);et.push({tl:J,tr:te,bl:Ge,br:pt,texPrimary:zt,texSecondary:void 0,writingMode:Y.writingMode,glyphOffset:oi,sectionIndex:ut.sectionIndex,isSDF:gt,pixelOffsetTL:vt,pixelOffsetBR:yt,minFontScaleX:0,minFontScaleY:0})}}return et}(0,s,g,u,h,m,a,r.allowVerticalPlacement),W=r.textSizeData;let F=null;W.kind==="source"?(F=[oa*u.layout.get("text-size").evaluate(m,{},$)*R.textScaleFactor],F[0]>ql&&yi(`${r.layerIds[0]}: Value for "text-size" is >= ${Up}. Reduce your "text-size".`)):W.kind==="composite"&&(F=[oa*R.compositeTextSizes[0].evaluate(m,{},$)*R.textScaleFactor,oa*R.compositeTextSizes[1].evaluate(m,{},$)*R.textScaleFactor],(F[0]>ql||F[1]>ql)&&yi(`${r.layerIds[0]}: Value for "text-size" is >= ${Up}. Reduce your "text-size".`)),r.addSymbols(r.text,K,F,g,h,m,w,e,i,v.lineStartIndex,v.lineLength,D,O,$,H,!1);for(const q of S)A[q]=r.text.placedSymbolArray.length-1;return 4*K.length}function B0(r){for(const e in r)return r[e];return null}function v_(r,e,i,s,a,u,h,m,g,v){let w=h.top,S=h.bottom,A=h.left,D=h.right;if($2(h)&&h.collisionPadding){const R=h.collisionPadding;A-=R[0],w-=R[1],D+=R[2],S+=R[3]}if(g){const R=new ft(A,w),O=new ft(D,w),$=new ft(A,S),H=new ft(D,S),K=U(g);let W=new ft(0,0);v&&(W=new ft(v[0],v[1])),R._rotateAround(K,W),O._rotateAround(K,W),$._rotateAround(K,W),H._rotateAround(K,W),A=Math.min(R.x,O.x,$.x,H.x),D=Math.max(R.x,O.x,$.x,H.x),w=Math.min(R.y,O.y,$.y,H.y),S=Math.max(R.y,O.y,$.y,H.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,A,w,D,S,m,s,a,u),r.length-1}function N0(r){$2(r)&&r.collisionPadding&&(r.top-=r.collisionPadding[1],r.bottom+=r.collisionPadding[3]);const e=r.bottom-r.top;return e>0?Math.max(10,e):null}function ok(r,e,i,s){const a=r.compareText;if(e in a){const u=a[e];for(let h=u.length-1;h>=0;h--)if(s.dist(u[h])<i)return!0}else a[e]=[];return a[e].push(s),!1}function pT(r,e){const i=r.fovAboveCenter,s=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,a=(r._camera.position[2]*r.worldSize-s)/Math.cos(r._pitch),u=Math.sin(i)*a/Math.sin(Math.max(Math.PI/2-r._pitch-i,.01));let h=Math.sin(r._pitch)*u+a;const m=a*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let g=Math.max(r.zoom-17,0);r.isOrthographic&&(g/=10),h*=1+g}return Math.min(1.01*h,m)}function $p(r,e){if(!e.isReprojectedInTileSpace)return{scale:1<<r.z,x:r.x,y:r.y,x2:r.x+1,y2:r.y+1,projection:e};const i=Math.pow(2,-r.z),s=r.x*i,a=(r.x+1)*i,u=r.y*i,h=(r.y+1)*i,m=de(s),g=de(a),v=me(u),w=me(h),S=e.project(m,v),A=e.project(g,v),D=e.project(g,w),R=e.project(m,w);let O=Math.min(S.x,A.x,D.x,R.x),$=Math.min(S.y,A.y,D.y,R.y),H=Math.max(S.x,A.x,D.x,R.x),K=Math.max(S.y,A.y,D.y,R.y);const W=i/16;function F(Y,ee,he,ye,ve,Ce){const Ue=(he+ve)/2,et=(ye+Ce)/2,Ye=e.project(de(Ue),me(et)),Qe=Math.max(0,O-Ye.x,$-Ye.y,Ye.x-H,Ye.y-K);O=Math.min(O,Ye.x),H=Math.max(H,Ye.x),$=Math.min($,Ye.y),K=Math.max(K,Ye.y),Qe>W&&(F(Y,Ye,he,ye,Ue,et),F(Ye,ee,Ue,et,ve,Ce))}F(S,A,s,u,a,u),F(A,D,a,u,a,h),F(D,R,a,h,s,h),F(R,S,s,h,s,u),O-=W,$-=W,H+=W,K+=W;const q=1/Math.max(H-O,K-$);return{scale:q,x:O*q,y:$*q,x2:H*q,y2:K*q,projection:e}}function fT(r,{x:e,y:i},s=0){return new ft(((e-s)*r.scale-r.x)*_t,(i*r.scale-r.y)*_t)}const sk=_e(new Float32Array(16));class Zl{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new V(0,0)}projectTilePoint(e,i,s){return{x:e,y:i,z:0}}locationPoint(e,i,s,a=!0){return e._coordinatePoint(e.locationCoordinate(i,s),a)}pixelsPerMeter(e,i){return ne(1,e)*i}pixelSpaceConversion(e,i,s){return 1}farthestPixelDistance(e){return pT(e,e.pixelsPerMeter)}pointCoordinate(e,i,s,a){const u=e.horizonLineFromTop(!1),h=new ft(i,Math.max(u,s));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,a))}pointCoordinate3D(e,i,s){const a=new ft(i,s);if(e.elevation)return e.elevation.pointCoordinate(a);{const u=this.pointCoordinate(e,a.x,a.y,0);return[u.x,u.y,u.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const s=e.horizonLineFromTop();return i.y<s}createInversionMatrix(e,i){return sk}createTileMatrix(e,i,s){let a,u,h;const m=s.canonical,g=_e(new Float64Array(16));if(this.isReprojectedInTileSpace){const v=$p(m,this);a=1,u=v.x+s.wrap*v.scale,h=v.y,nt(g,g,[a/v.scale,a/v.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(m.z),u=(m.x+Math.pow(2,m.z)*s.wrap)*a,h=m.y*a;return st(g,g,[u,h,0]),nt(g,g,[a/_t,a/_t,1]),g}upVector(e,i,s){return[0,0,1]}upVectorScale(e,i,s){return{metersToTile:1}}}class ak extends Zl{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,s]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(U(i));this.n=(a+Math.sin(U(s)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:s,c:a,r0:u}=this,h=U(e-this.center[0]),m=U(i),g=Math.sqrt(a-2*s*Math.sin(m))/s;return{x:g*Math.sin(h*s),y:g*Math.cos(h*s)-u,z:0}}unproject(e,i){const{n:s,c:a,r0:u}=this,h=u+i;let m=Math.atan2(e,Math.abs(h))*Math.sign(h);h*s<0&&(m-=Math.PI*Math.sign(e)*Math.sign(h));const g=U(this.center[0])*s;m=Be(m,-Math.PI-g,Math.PI-g);const v=Te(Z(m/s)+this.center[0],-180,180),w=Math.asin(Te((a-(e*e+h*h)*s*s)/(2*s),-1,1)),S=Te(Z(w),-Me,Me);return new V(v,S)}}const Gp=1.340264,Hp=-.081106,qp=893e-6,Zp=.003796,x_=Math.sqrt(3)/2;class lk extends Zl{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const s=Math.asin(x_*Math.sin(i)),a=s*s,u=a*a*a;return{x:.5*(e*Math.cos(s)/(x_*(Gp+3*Hp*a+u*(7*qp+9*Zp*a)))/Math.PI+.5),y:1-.5*(s*(Gp+Hp*a+u*(qp+Zp*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,a=s*s,u=a*a*a;for(let w,S,A,D=0;D<12&&(S=s*(Gp+Hp*a+u*(qp+Zp*a))-i,A=Gp+3*Hp*a+u*(7*qp+9*Zp*a),w=S/A,s=Te(s-w,-Math.PI/3,Math.PI/3),a=s*s,u=a*a*a,!(Math.abs(w)<1e-12));++D);const h=x_*e*(Gp+3*Hp*a+u*(7*qp+9*Zp*a))/Math.cos(s),m=Math.asin(Math.sin(s)/x_),g=Te(180*h/Math.PI,-180,180),v=Te(180*m/Math.PI,-Me,Me);return new V(g,v)}}class ck extends Zl{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const s=360*(e-.5),a=Te(360*(.5-i),-Me,Me);return new V(s,a)}}const Nh=Math.PI/2;function b_(r){return Math.tan((Nh+r)/2)}class uk extends Zl{constructor(e){super(e),this.center=e.center||[0,30];const[i,s]=this.parallels=e.parallels||[30,30];let a=U(i),u=U(s);this.southernCenter=a+u<0,this.southernCenter&&(a=-a,u=-u);const h=Math.cos(a),m=b_(a);this.n=a===u?Math.sin(a):Math.log(h/Math.cos(u))/Math.log(b_(u)/m),this.f=h*Math.pow(b_(a),this.n)/this.n}project(e,i){i=U(i),this.southernCenter&&(i=-i),e=U(e-this.center[0]);const s=1e-6,{n:a,f:u}=this;u>0?i<-Nh+s&&(i=-Nh+s):i>Nh-s&&(i=Nh-s);const h=u/Math.pow(b_(i),a);let m=h*Math.sin(a*e),g=u-h*Math.cos(a*e);return m=.5*(m/Math.PI+.5),g=.5*(g/Math.PI+.5),{x:m,y:this.southernCenter?g:1-g,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n:s,f:a}=this,u=a-i,h=Math.sign(u),m=Math.sign(s)*Math.sqrt(e*e+u*u);let g=Math.atan2(e,Math.abs(u))*h;u*s<0&&(g-=Math.PI*Math.sign(e)*h);const v=Te(Z(g/s)+this.center[0],-180,180),w=Te(Z(2*Math.atan(Math.pow(a/m,1/s))-Nh),-Me,Me);return new V(v,this.southernCenter?-w:w)}}class mT extends Zl{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:ae(e),y:le(i),z:0}}unproject(e,i){const s=de(e),a=me(i);return new V(s,a)}}const _T=U(Me);class hk extends Zl{project(e,i){const s=(i=U(i))*i,a=s*s;return{x:.5*((e=U(e))*(.8707-.131979*s+a*(a*(.003971*s-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+s*(.015085+a*(.028874*s-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,a=25,u=0,h=s*s;do{h=s*s;const v=h*h;u=(s*(1.007226+h*(.015085+v*(.028874*h-.044475-.005916*v)))-i)/(1.007226+h*(.045255+v*(.259866*h-.311325-.005916*11*v))),s=Te(s-u,-_T,_T)}while(Math.abs(u)>1e-6&&--a>0);h=s*s;const m=Te(Z(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),g=Z(s);return new V(m,g)}}const gT=U(Me);class dk extends Zl{project(e,i){i=U(i),e=U(e);const s=Math.cos(i),a=2/Math.PI,u=Math.acos(s*Math.cos(e/2)),h=Math.sin(u)/u,m=.5*(e*a+2*s*Math.sin(e/2)/h)||0,g=.5*(i+Math.sin(i)/h)||0;return{x:.5*(m/Math.PI+.5),y:1-.5*(g/Math.PI+1),z:0}}unproject(e,i){let s=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,u=25;const h=1e-6;let m=0,g=0;do{const v=Math.cos(a),w=Math.sin(a),S=2*w*v,A=w*w,D=v*v,R=Math.cos(s/2),O=Math.sin(s/2),$=2*R*O,H=O*O,K=1-D*R*R,W=K?1/K:0,F=K?Math.acos(v*R)*Math.sqrt(1/K):0,q=.5*(2*F*v*O+2*s/Math.PI)-e,Y=.5*(F*w+a)-i,ee=.5*W*(D*H+F*v*R*A)+1/Math.PI,he=W*($*S/4-F*w*O),ye=.125*W*(S*O-F*w*D*$),ve=.5*W*(A*R+F*H*v)+.5,Ce=he*ye-ve*ee;m=(Y*he-q*ve)/Ce,g=(q*ye-Y*ee)/Ce,s=Te(s-m,-Math.PI,Math.PI),a=Te(a-g,-gT,gT)}while((Math.abs(m)>h||Math.abs(g)>h)&&--u>0);return new V(Z(s),Z(a))}}class yT extends Zl{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(U(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:s,cosPhi:a}=this;return{x:U(e)*a*s+.5,y:-Math.sin(U(i))/a*s+.5,z:0}}unproject(e,i){const{scale:s,cosPhi:a}=this,u=-(i-.5)/s,h=Te(Z((e-.5)/s)/a,-180,180),m=Math.asin(Te(u*a,-1,1)),g=Te(Z(m),-Me,Me);return new V(h,g)}}class pk extends mT{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,s){const a=Ep(e,i,s);return gr(a,a,i_(ra(s))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,s){const a=N(i.lat,i.lng),u=Ui([],a),h=s?e._centerAltitude+s:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;$r(a,a,u,ne(1,0)*_t*h);const m=_e(new Float64Array(16));return Se(m,e.pixelMatrix,e.globeMatrix),gr(a,a,m),new ft(a[0],a[1])}pixelsPerMeter(e,i){return ne(1,0)*i}pixelSpaceConversion(e,i,s){const a=ne(1,e)*i,u=Nt(ne(1,45)*i,a,s);return this.pixelsPerMeter(e,i)/u}createTileMatrix(e,i,s){const a=r0(ra(s.canonical));return Se(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:s}=e,a=i_(ra(i));return ct(a,a,U(s.lng)),Xe(a,a,U(s.lat)),nt(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,s,a){return tw(e,i,s,!0)||new ke(0,0)}pointCoordinate3D(e,i,s){const a=this.pointCoordinate(e,i,s,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!tw(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(a,u){const h=a.cameraToCenterDistance,m=a._centerAltitude*u,g=a._camera,v=a._camera.forward(),w=vi([],Ii([],v,-h),[0,0,m]),S=a.worldSize/(2*Math.PI),A=[0,0,-S],D=a.width/a.height,R=Math.tan(a.fovAboveCenter),O=Ii([],g.up(),R),$=Ii([],g.right(),R*D),H=Ui([],vi([],vi([],v,O),$)),K=[];let W;if(new Fo(w,H).closestPointOnSphere(A,S,K)){const F=vi([],K,A),q=Ei([],F,w);W=Math.cos(a.fovAboveCenter)*Jt(q)}else{const F=Ei([],w,A),q=Ei([],A,w);Ui(q,q);const Y=Jt(F)-S;W=Math.sqrt(Y*(Y+2*S));const ee=Math.acos(W/(S+Y))-Math.acos(Zi(v,q));W*=Math.cos(ee)}return 1.01*W}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),s=Vl(e.zoom);if(s>0){const a=pT(e,ne(1,e.center.lat)*e.worldSize),u=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Nt(i,a+u*(1-Math.cos(h)),Math.pow(s,10))}return i}upVector(e,i,s){return Ep(i,s,e,1)}upVectorScale(e){return{metersToTile:jl(t_(ra(e)))}}}function vT(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(r.name){case"mercator":return new mT(r);case"equirectangular":return new ck(r);case"naturalEarth":return new hk(r);case"equalEarth":return new lk(r);case"winkelTripel":return new dk(r);case"albers":return i?new yT(r):new ak(r);case"lambertConformalConic":return i?new yT(r):new uk(r);case"globe":return new pk(r)}throw new Error(`Invalid projection name: ${r.name}`)}const fk=$l.VectorTileFeature.types,mk=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function w_(r,e,i,s,a,u,h,m,g,v,w,S,A){const D=m?Math.min(ql,Math.round(m[0])):0,R=m?Math.min(ql,Math.round(m[1])):0;r.emplaceBack(e,i,Math.round(32*s),Math.round(32*a),u,h,(D<<1)+(g?1:0),R,16*v,16*w,256*S,256*A)}function T_(r,e,i){r.emplaceBack(e,i)}function S_(r,e,i,s,a,u,h){r.emplaceBack(e,i,s,a,u,h)}function E_(r,e,i,s,a){r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a)}function _k(r){for(const e of r.sections)if(Hy(e.text))return!0;return!1}class j0{constructor(e){this.layoutVertexArray=new Ll,this.indexArray=new fn,this.programConfigurations=e,this.segments=new Cr,this.dynamicLayoutVertexArray=new Ko,this.opacityVertexArray=new fp,this.placedSymbolArray=new Vm,this.iconTransitioningVertexArray=new ea,this.globeExtVertexArray=new Xn,this.zOffsetVertexArray=new Rl}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,s,a,u){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,D3.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,z3.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,mk,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,k3.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,R3.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||u)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,L3.members,!0)),this.opacityVertexBuffer.itemSize=1),(s||a)&&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(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}Tt(j0,"SymbolBuffers");class V0{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new Cr,this.collisionVertexArray=new _p,this.collisionVertexArrayExt=new Ko}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,O3.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,F3.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Tt(V0,"CollisionBuffers");class A_{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=_e([]),this.placementViewportMatrix=_e([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=W2(this.zoom,i["text-size"]),this.iconSizeData=W2(this.zoom,i["icon-size"]);const s=this.layers[0].layout,a=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=s.get("text-allow-overlap")||s.get("icon-allow-overlap")||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=s.get("text-writing-mode").map(h=>lo[h]),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new j0(new Ha(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new j0(new Ha(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new wp,this.lineVertexArray=new Gm,this.symbolInstances=new $m}calculateGlyphDependencies(e,i,s,a,u){for(const h of e){const m=h.codePointAt(0);if(m===void 0)break;if(i[m]=!0,a&&u&&m<=65535){const g=Fp[h];g&&(i[g.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!b0(this.activeReplacements,s)&&(this.activeReplacements=s,!0)}populate(e,i,s,a){const u=this.layers[0],h=u.layout,m=this.projection.name==="globe",g=h.get("text-font"),v=h.get("text-field"),w=h.get("icon-image"),[S,A]=h.get("icon-size-scale-range"),D=Te(i.scaleFactor||1,S,A),R=(v.value.kind!=="constant"||v.value.value instanceof Nn&&!v.value.value.isEmpty()||v.value.value.toString().length>0)&&(g.value.kind!=="constant"||g.value.value.length>0),O=w.value.kind!=="constant"||!!w.value.value||Object.keys(w.parameters).length>0,$=h.get("symbol-sort-key");if(this.features=[],!R&&!O)return;const H=i.iconDependencies,K=i.glyphDependencies,W=i.availableImages,F=new Wi(this.zoom);for(const{feature:q,id:Y,index:ee,sourceLayerIndex:he}of e){const ye=u._featureFilter.needGeometry,ve=Lt(q,ye);if(!u._featureFilter.filter(F,ve,s))continue;if(ye||(ve.geometry=At(q,s,a)),m&&q.type!==1&&s.z<=5){const Qe=ve.geometry,ot=.98078528056,je=(Je,Fe)=>Zi(Ep(Je.x,Je.y,s,1),Ep(Fe.x,Fe.y,s,1))<ot;for(let Je=0;Je<Qe.length;Je++)Qe[Je]=tt(Qe[Je],je)}let Ce,Ue;if(R){const Qe=u.getValueAndResolveTokens("text-field",ve,s,W),ot=Nn.factory(Qe);_k(ot)&&(this.hasRTLText=!0),(!this.hasRTLText||Ml()==="unavailable"||this.hasRTLText&&vo.isParsed())&&(Ce=N3(ot,u,ve))}if(O){const Qe=u.getValueAndResolveTokens("icon-image",ve,s,W);Ue=typeof Qe=="string"?Zn.build(Qe):Qe}if(!Ce&&!Ue)continue;const et=this.sortFeaturesByKey?$.evaluate(ve,{},s):void 0,Ye={id:Y,text:Ce,icon:Ue,index:ee,sourceLayerIndex:he,geometry:ve.geometry,properties:q.properties,type:fk[q.type],sortKey:et};if(this.features.push(Ye),Ue){const Qe=this.layers[0]._unevaluatedLayout._values,{iconPrimary:ot,iconSecondary:je}=cT(Ue,this.iconSizeData,Qe["icon-size"],s,this.zoom,Ye,this.pixelRatio,D),Je=ot.id.toString();if(H.has(Je)?H.get(Je).push(ot):H.set(Je,[ot]),je){const Fe=je.id.toString();H.has(Fe)?H.get(Fe).push(je):H.set(Fe,[je])}}if(Ce){const Qe=g.evaluate(ve,{},s).join(","),ot=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(lo.vertical)>=0;for(const je of Ce.sections)if(je.image){const Je=je.image.getPrimary().scaleSelf(this.pixelRatio),Fe=Je.id.toString(),Ve=H.get(Fe)||[];Ve.push(Je),H.set(Fe,Ve)}else{const Je=ip(Ce.toString()),Fe=je.fontStack||Qe,Ve=K[Fe]=K[Fe]||{};this.calculateGlyphDependencies(je.text,Ve,ot,this.allowVerticalPlacement,Je)}}}if(h.get("symbol-placement")==="line"&&(this.features=function(q){const Y={},ee={},he=[];let ye=0;function ve(Ye){he.push(q[Ye]),ye++}function Ce(Ye,Qe,ot){const je=ee[Ye];return delete ee[Ye],ee[Qe]=je,he[je].geometry[0].pop(),he[je].geometry[0]=he[je].geometry[0].concat(ot[0]),je}function Ue(Ye,Qe,ot){const je=Y[Qe];return delete Y[Qe],Y[Ye]=je,he[je].geometry[0].shift(),he[je].geometry[0]=ot[0].concat(he[je].geometry[0]),je}function et(Ye,Qe,ot){const je=ot?Qe[0][Qe[0].length-1]:Qe[0][0];return`${Ye}:${je.x}:${je.y}`}for(let Ye=0;Ye<q.length;Ye++){const Qe=q[Ye],ot=Qe.geometry,je=Qe.text?Qe.text.toString():null;if(!je){ve(Ye);continue}const Je=et(je,ot),Fe=et(je,ot,!0);if(Je in ee&&Fe in Y&&ee[Je]!==Y[Fe]){const Ve=Ue(Je,Fe,ot),lt=Ce(Je,Fe,he[Ve].geometry);delete Y[Je],delete ee[Fe],ee[et(je,he[lt].geometry,!0)]=lt,he[Ve].geometry=null}else Je in ee?Ce(Je,Fe,ot):Fe in Y?Ue(Je,Fe,ot):(ve(Ye),Y[Je]=ye-1,ee[Fe]=ye-1)}return he.filter(Ye=>Ye.geometry)}(this.features)),h.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const q of i.elevationFeatures)this.elevationFeatureIdToIndex.set(q.id,this.elevationFeatures.length),this.elevationFeatures.push(q)}}else h.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((q,Y)=>q.sortKey-Y.sortKey)}update(e,i,s,a,u,h,m){this.text.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m),this.icon.programConfigurations.updatePaintArrays(e,i,u,s,a,h,m)}updateRoadElevation(){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let e=!1;for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);if(s.elevationFeatureIndex===65535)continue;const a=this.elevationFeatures[s.elevationFeatureIndex];if(a){const u=.05+a.pointElevation(new ft(s.tileAnchorX,s.tileAnchorY));s.zOffset!==u&&(e=!0,s.zOffset=u)}}e&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(u,h,m)=>{s+=h,s>u.length&&u.resize(s);for(let g=-h;g<0;g++)u.emplace(g+s,m)},i=(u,h,m)=>{a+=h,a>u.length&&u.resize(a);for(let g=-h;g<0;g++)u.emplace(g+a,m)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let s=0,a=0;for(let u=0;u<this.symbolInstances.length;u++){const h=this.symbolInstances.get(u),{numHorizontalGlyphVertices:m,numVerticalGlyphVertices:g,numIconVertices:v}=h,w=h.zOffset,S=v>0;if((m>0||g>0)&&(e(this.text.zOffsetVertexArray,m,w),e(this.text.zOffsetVertexArray,g,w)),S){const{placedIconSymbolIndex:A,verticalPlacedIconSymbolIndex:D}=h;A>=0&&i(this.icon.zOffsetVertexArray,v,w),D>=0&&i(this.icon.zOffsetVertexArray,h.numVerticalIconVertices,w)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}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.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=vT(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const s=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:u}of i)this.lineVertexArray.emplaceBack(a,u);return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,a,u,h,m,g,v,w,S,A,D,R,O,$){const H=e.indexArray,K=e.layoutVertexArray,W=e.globeExtVertexArray,F=e.segments.prepareSegment(4*i.length,K,H,this.canOverlap?h.sortKey:void 0),q=this.glyphOffsetArray.length,Y=F.vertexLength,ee=this.allowVerticalPlacement&&m===lo.vertical?Math.PI/2:0,he=h.text&&h.text.sections;for(let ve=0;ve<i.length;ve++){const{tl:Ce,tr:Ue,bl:et,br:Ye,texPrimary:Qe,texSecondary:ot,pixelOffsetTL:je,pixelOffsetBR:Je,minFontScaleX:Fe,minFontScaleY:Ve,glyphOffset:lt,isSDF:ut,sectionIndex:zt}=i[ve],Et=F.vertexLength,gt=lt[1];if(w_(K,v.x,v.y,Ce.x,gt+Ce.y,Qe.x,Qe.y,s,ut,je.x,je.y,Fe,Ve),w_(K,v.x,v.y,Ue.x,gt+Ue.y,Qe.x+Qe.w,Qe.y,s,ut,Je.x,je.y,Fe,Ve),w_(K,v.x,v.y,et.x,gt+et.y,Qe.x,Qe.y+Qe.h,s,ut,je.x,Je.y,Fe,Ve),w_(K,v.x,v.y,Ye.x,gt+Ye.y,Qe.x+Qe.w,Qe.y+Qe.h,s,ut,Je.x,Je.y,Fe,Ve),g){const{x:at,y:Xt,z:Mt}=g.anchor,[Pt,Ht,ii]=g.up;S_(W,at,Xt,Mt,Pt,Ht,ii),S_(W,at,Xt,Mt,Pt,Ht,ii),S_(W,at,Xt,Mt,Pt,Ht,ii),S_(W,at,Xt,Mt,Pt,Ht,ii),E_(e.dynamicLayoutVertexArray,at,Xt,Mt,ee)}else E_(e.dynamicLayoutVertexArray,v.x,v.y,v.z,ee);if($){const at=ot||Qe;T_(e.iconTransitioningVertexArray,at.x,at.y),T_(e.iconTransitioningVertexArray,at.x+at.w,at.y),T_(e.iconTransitioningVertexArray,at.x,at.y+at.h),T_(e.iconTransitioningVertexArray,at.x+at.w,at.y+at.h)}H.emplaceBack(Et,Et+1,Et+2),H.emplaceBack(Et+1,Et+2,Et+3),F.vertexLength+=4,F.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(lt[0]),ve!==i.length-1&&zt===i[ve+1].sectionIndex||e.programConfigurations.populatePaintArrays(K.length,h,h.index,{},D,R,O,he&&he[zt])}const ye=g?g.anchor:v;e.placedSymbolArray.emplaceBack(ye.x,ye.y,ye.z,v.x,v.y,q,this.glyphOffsetArray.length-q,Y,w,S,v.segment,s?s[0]:0,s?s[1]:0,a[0],a[1],m,0,0,0,A,0)}_commitLayoutVertex(e,i,s,a,u,h,m){e.emplaceBack(i,s,a,u,h,Math.round(m.x),Math.round(m.y))}_addCollisionDebugVertices(e,i,s,a,u,h,m){const g=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),v=g.vertexLength,w=m.tileAnchorX,S=m.tileAnchorY;for(let D=0;D<4;D++)s.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(s.collisionVertexArrayExt,i,e.padding,m.zOffset),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,w,S,new ft(e.x1,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,w,S,new ft(e.x2,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,w,S,new ft(e.x2,e.y2)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,w,S,new ft(e.x1,e.y2)),g.vertexLength+=4;const A=s.indexArray;A.emplaceBack(v,v+1),A.emplaceBack(v+1,v+2),A.emplaceBack(v+2,v+3),A.emplaceBack(v+3,v),g.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,s,a,u,h){for(let m=a;m<u;m++){const g=s.get(m),v=this.getSymbolInstanceTextSize(e,h,i,m);this._addCollisionDebugVertices(g,v,this.textCollisionBox,g.projectedAnchorX,g.projectedAnchorY,g.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,i,s,a,u,h){for(let m=a;m<u;m++){const g=s.get(m),v=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._addCollisionDebugVertices(g,v,this.iconCollisionBox,g.projectedAnchorX,g.projectedAnchorY,g.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,i,s){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new V0(Eh,z2.members,ea),this.iconCollisionBox=new V0(Eh,z2.members,ea);const a=Np(this.iconSizeData,e),u=Np(this.textSizeData,e,s);for(let h=0;h<this.symbolInstances.length;h++){const m=this.symbolInstances.get(h);this._addTextDebugCollisionBoxes(u,e,i,m.textBoxStartIndex,m.textBoxEndIndex,m),this._addTextDebugCollisionBoxes(u,e,i,m.verticalTextBoxStartIndex,m.verticalTextBoxEndIndex,m),this._addIconDebugCollisionBoxes(a,e,i,m.iconBoxStartIndex,m.iconBoxEndIndex,m),this._addIconDebugCollisionBoxes(a,e,i,m.verticalIconBoxStartIndex,m.verticalIconBoxEndIndex,m)}}getSymbolInstanceTextSize(e,i,s,a){const u=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),h=z0(this.textSizeData,e,u)/xn;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,i,s){const a=this.icon.placedSymbolArray.get(s),u=z0(this.iconSizeData,e,a);return this.tilePixelRatio*u}_commitDebugCollisionVertexUpdate(e,i,s,a){e.emplaceBack(i,-s,-s,a),e.emplaceBack(i,s,-s,a),e.emplaceBack(i,s,s,a),e.emplaceBack(i,-s,s,a)}_updateTextDebugCollisionBoxes(e,i,s,a,u,h,m){for(let g=a;g<u;g++){const v=s.get(g),w=this.getSymbolInstanceTextSize(e,h,i,g);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,w,v.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,i,s,a,u,h,m){for(let g=a;g<u;g++){const v=s.get(g),w=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,w,v.padding,h.zOffset)}}updateCollisionDebugBuffers(e,i,s,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const u=Np(this.iconSizeData,e,a),h=Np(this.textSizeData,e,s);for(let m=0;m<this.symbolInstances.length;m++){const g=this.symbolInstances.get(m);this._updateTextDebugCollisionBoxes(h,e,i,g.textBoxStartIndex,g.textBoxEndIndex,g,s),this._updateTextDebugCollisionBoxes(h,e,i,g.verticalTextBoxStartIndex,g.verticalTextBoxEndIndex,g,s),this._updateIconDebugCollisionBoxes(u,e,i,g.iconBoxStartIndex,g.iconBoxEndIndex,g,a),this._updateIconDebugCollisionBoxes(u,e,i,g.verticalIconBoxStartIndex,g.verticalIconBoxEndIndex,g,a)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,s,a,u,h,m,g,v){const w={};if(i<s){const{x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F,featureIndex:q}=e.get(i);w.textBox={x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F},w.textFeatureIndex=q}if(a<u){const{x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F,featureIndex:q}=e.get(a);w.verticalTextBox={x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F},w.verticalTextFeatureIndex=q}if(h<m){const{x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F,featureIndex:q}=e.get(h);w.iconBox={x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F},w.iconFeatureIndex=q}if(g<v){const{x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F,featureIndex:q}=e.get(g);w.verticalIconBox={x1:S,y1:A,x2:D,y2:R,padding:O,projectedAnchorX:$,projectedAnchorY:H,projectedAnchorZ:K,tileAnchorX:W,tileAnchorY:F},w.verticalIconFeatureIndex=q}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const s=e.placedSymbolArray.get(i),a=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;u<a;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),s=Math.cos(e),a=[],u=[],h=[];for(let m=0;m<this.symbolInstances.length;++m){h.push(m);const g=this.symbolInstances.get(m);a.push(0|Math.round(i*g.tileAnchorX+s*g.tileAnchorY)),u.push(g.featureIndex)}return h.sort((m,g)=>a[m]-a[g]||u[g]-u[m]),h}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,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(const i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:u,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:m,placedIconSymbolIndex:g,verticalPlacedIconSymbolIndex:v}=s;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),u>=0&&u!==a&&this.addIndicesForPlacedSymbol(this.text,u),h>=0&&h!==u&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),m>=0&&this.addIndicesForPlacedSymbol(this.text,m),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g),v>=0&&this.addIndicesForPlacedSymbol(this.icon,v)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let xT,bT,U0;Tt(A_,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),A_.addDynamicAttributes=E_;class wT{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Vs,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Tt(wT,"FormatSectionOverride",{omit:["defaultValue"]});const $0=()=>U0||(U0={layout:xT||(xT=new Nr({"symbol-placement":new dt(Re.layout_symbol["symbol-placement"]),"symbol-spacing":new dt(Re.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new dt(Re.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new wt(Re.layout_symbol["symbol-sort-key"]),"symbol-z-order":new dt(Re.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new dt(Re.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new dt(Re.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new dt(Re.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new dt(Re.layout_symbol["icon-ignore-placement"]),"icon-optional":new dt(Re.layout_symbol["icon-optional"]),"icon-rotation-alignment":new dt(Re.layout_symbol["icon-rotation-alignment"]),"icon-size":new wt(Re.layout_symbol["icon-size"]),"icon-size-scale-range":new dt(Re.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new wt(Re.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new wt(Re.layout_symbol["icon-text-fit-padding"]),"icon-image":new wt(Re.layout_symbol["icon-image"]),"icon-rotate":new wt(Re.layout_symbol["icon-rotate"]),"icon-padding":new dt(Re.layout_symbol["icon-padding"]),"icon-keep-upright":new dt(Re.layout_symbol["icon-keep-upright"]),"icon-offset":new wt(Re.layout_symbol["icon-offset"]),"icon-anchor":new wt(Re.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new dt(Re.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new dt(Re.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new dt(Re.layout_symbol["text-rotation-alignment"]),"text-field":new wt(Re.layout_symbol["text-field"]),"text-font":new wt(Re.layout_symbol["text-font"]),"text-size":new wt(Re.layout_symbol["text-size"]),"text-size-scale-range":new dt(Re.layout_symbol["text-size-scale-range"]),"text-max-width":new wt(Re.layout_symbol["text-max-width"]),"text-line-height":new wt(Re.layout_symbol["text-line-height"]),"text-letter-spacing":new wt(Re.layout_symbol["text-letter-spacing"]),"text-justify":new wt(Re.layout_symbol["text-justify"]),"text-radial-offset":new wt(Re.layout_symbol["text-radial-offset"]),"text-variable-anchor":new dt(Re.layout_symbol["text-variable-anchor"]),"text-anchor":new wt(Re.layout_symbol["text-anchor"]),"text-max-angle":new dt(Re.layout_symbol["text-max-angle"]),"text-writing-mode":new dt(Re.layout_symbol["text-writing-mode"]),"text-rotate":new wt(Re.layout_symbol["text-rotate"]),"text-padding":new dt(Re.layout_symbol["text-padding"]),"text-keep-upright":new dt(Re.layout_symbol["text-keep-upright"]),"text-transform":new wt(Re.layout_symbol["text-transform"]),"text-offset":new wt(Re.layout_symbol["text-offset"]),"text-allow-overlap":new dt(Re.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new dt(Re.layout_symbol["text-ignore-placement"]),"text-optional":new dt(Re.layout_symbol["text-optional"]),visibility:new dt(Re.layout_symbol.visibility)})),paint:bT||(bT=new Nr({"icon-opacity":new wt(Re.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new wt(Re.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new wt(Re.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new wt(Re.paint_symbol["text-emissive-strength"]),"icon-color":new wt(Re.paint_symbol["icon-color"]),"icon-halo-color":new wt(Re.paint_symbol["icon-halo-color"]),"icon-halo-width":new wt(Re.paint_symbol["icon-halo-width"]),"icon-halo-blur":new wt(Re.paint_symbol["icon-halo-blur"]),"icon-translate":new dt(Re.paint_symbol["icon-translate"]),"icon-translate-anchor":new dt(Re.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new dt(Re.paint_symbol["icon-image-cross-fade"]),"text-opacity":new wt(Re.paint_symbol["text-opacity"]),"text-occlusion-opacity":new wt(Re.paint_symbol["text-occlusion-opacity"]),"text-color":new wt(Re.paint_symbol["text-color"],{runtimeType:qn,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new wt(Re.paint_symbol["text-halo-color"]),"text-halo-width":new wt(Re.paint_symbol["text-halo-width"]),"text-halo-blur":new wt(Re.paint_symbol["text-halo-blur"]),"text-translate":new dt(Re.paint_symbol["text-translate"]),"text-translate-anchor":new dt(Re.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new dt(Re.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new dt(Re.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new dt(Re.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new dt(Re.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new wt(Re.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},U0);class I_ extends $n{constructor(e,i,s,a){super(e,$0(),i,s,a),this._colorAdjustmentMatrix=_e([]),this.hasInitialOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const s=this.layout.get("text-writing-mode");if(s){const a=[];for(const u of s)a.indexOf(u)<0&&a.push(u);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,s,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===s&&this._brightnessMax===a||(this._colorAdjustmentMatrix=function(u,h,m,g){u=Rn(u),h=Dn(h);const v=Pe(),w=u/3,S=1-2*w,A=[S,w,w,0,w,S,w,0,w,w,S,0,0,0,0,1],D=.5-.5*h,R=g-m;return Se(v,[R,0,0,0,0,R,0,0,0,0,R,0,m,m,m,1],[h,0,0,0,0,h,0,0,0,0,h,0,D,D,D,1]),Se(v,v,A),v}(e,i,s,a),this._saturation=e,this._contrast=i,this._brightnessMin=s,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,s,a){const u=this.layout.get(e).evaluate(i,{},s,a),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||ph(h.value)||!u?u:function(m,g){return g.replace(/{([^{}]+)}/g,(v,w)=>w in m?String(m[w]):"")}(i.properties,u)}createBucket(e){return new A_(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of $0().paint.overridableProperties){if(!I_.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new wT(i),a=new Qd(s,i.property.specification,this.scope,this.options);let u=null;u=i.value.kind==="constant"||i.value.kind==="source"?new Oa("source",a):new Il("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new Pl(i.property,u,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&I_.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),a=$0().paint.properties[i];let u=!1;const h=m=>{for(const g of m)if(a.overrides&&a.overrides.hasOverride(g))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Nn)h(s.value.value.sections);else if(s.value.kind==="source"){const m=v=>{u||(v instanceof di&&hn(v.value)===yc?h(v.value.sections):v instanceof Ia?h(v.sections):v.eachChild(m))},g=s.value;g._styleExpression&&m(g._styleExpression.expression)}return u}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,s){return{config:new ia(this,{zoom:i,lut:s}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let TT,ST,ET,AT;var G0=ki([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function H0(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function q0(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class Z0{constructor(e,i,s,a){this.context=e,this.format=s,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const s=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:u}=this,{gl:h}=u,{x:m,y:g}=i&&i.position?i.position:{x:0,y:0},v=m+s,w=g+a;!this.size||this.size[0]===v&&this.size[1]===w||(h.bindTexture(h.TEXTURE_2D,null),h.deleteTexture(this.texture),this.texture=h.createTexture(),this.size=null),h.bindTexture(h.TEXTURE_2D,this.texture),u.pixelStoreUnpackFlipY.set(!1),u.pixelStoreUnpack.set(1),u.pixelStoreUnpackPremultiplyAlpha.set(this.format===h.RGBA8&&(!i||i.premultiply!==!1));const S=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&v>0&&w>0){const A=this.useMipmap?Math.floor(Math.log2(Math.max(v,w)))+1:1;h.texStorage2D(h.TEXTURE_2D,A,this.format,v,w),this.size=[v,w]}if(this.size)if(S)h.texSubImage2D(h.TEXTURE_2D,0,m,g,H0(this.format),q0(this.format),e);else{const A=e.data;A&&h.texSubImage2D(h.TEXTURE_2D,0,m,g,s,a,H0(this.format),q0(this.format),A)}this.useMipmap&&h.generateMipmap(h.TEXTURE_2D)}bind(e,i,s=!1){const{context:a}=this,{gl:u}=a;u.bindTexture(u.TEXTURE_2D,this.texture),e!==this.minFilter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,this.useMipmap&&!s?e===u.NEAREST?u.NEAREST_MIPMAP_NEAREST:u.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,s,a){const{context:u}=this,{gl:h}=u;h.bindTexture(h.TEXTURE_2D,this.texture),i!==this.magFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,this.useMipmap?e===h.NEAREST?h.NEAREST_MIPMAP_NEAREST:h.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),s!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,s),this.wrapS=s),a!==this.wrapT&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,a),this.wrapT=a)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class C_{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:s}=this,{gl:a}=s;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}function M_(r,e,i,s,a,u,h,m){const g=[r,e,1,i,s,1,a,u,1],v=[h,m,1],w=Ee([],g),[S,A,D]=Kn(v,v,w);return be(g,g,[S,0,0,0,A,0,0,0,D])}function IT(r,e,i,s,a,u,h,m){const g=function(v,w,S,A,D,R,O,$){const H=M_(0,0,1,0,1,1,0,1),K=M_(v,w,S,A,D,R,O,$);return be(K,K,Ee([],H))}(r,e,i,s,a,u,h,m);return[g[2]/g[8]/_t,g[5]/g[8]/_t]}function P_(r){return[r[0],Math.min(Math.max(r[1],-Me),Me)]}class CT extends Sa{constructor(e,i,s,a){super(),this.id=e,this.dispatcher=s,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new js("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=ul(this.map._requestManager.transformRequest(this.url,ku.Image),(s,a)=>{this._imageRequest=null,this._loaded=!0,s?this.fire(new Td(s)):a&&(this.image=a instanceof HTMLImageElement?Io.getImageData(a):a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new C_(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new js("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof C_||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],s=e[0][1];for(const u of e)u[1]>s&&(s=u[1]),u[1]<i&&(i=u[1]);const a=(s+i)/2;if(a>Me?this.onNorthPole=!0:a<-Me&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const u=e.map(ke.fromLngLat);this.tileID=function(h){let m=1/0,g=1/0,v=-1/0,w=-1/0;for(const O of h)m=Math.min(m,O.x),g=Math.min(g,O.y),v=Math.max(v,O.x),w=Math.max(w,O.y);const S=Math.max(v-m,w-g),A=Math.max(0,Math.floor(-Math.log(S)/Math.LN2)),D=Math.pow(2,A);let R=Math.floor((m+v)/2*D);return R>1&&(R-=1),new cr(A,R,Math.floor((g+w)/2*D))}(u),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new js("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const H in this.tiles){const K=this.tiles[H];K.state!=="loaded"&&(K.state="loaded",K.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=$p(new cr(0,0,0),this.map.transform.projection),s=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(H){const K=H[1].x-H[0].x,W=H[1].y-H[0].y,F=H[2].x-H[1].x,q=H[2].y-H[1].y,Y=H[3].x-H[2].x,ee=H[3].y-H[2].y,he=H[0].x-H[3].x,ye=H[0].y-H[3].y,ve=K*q-F*W,Ce=F*ee-Y*q,Ue=Y*ye-he*ee,et=he*W-K*ye;return ve>0&&Ce>0&&Ue>0&&et>0||ve<0&&Ce<0&&Ue<0&&et<0}(s))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=$p(this.tileID,this.map.transform.projection),[u,h,m,g]=this.coordinates.map(H=>{const K=a.projection.project(H[0],H[1]);return fT(a,K)._round()});this.perspectiveTransform=IT(u.x,u.y,h.x,h.y,m.x,m.y,g.x,g.y);const v=this._boundsArray=new Ua;v.emplaceBack(u.x,u.y,0,0),v.emplaceBack(h.x,h.y,_t,0),v.emplaceBack(g.x,g.y,0,_t),v.emplaceBack(m.x,m.y,_t,_t),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(v,G0.members),this.boundsSegments=Cr.simpleSegment(0,0,4,2);const w=[],S=[P_((A=this.coordinates)[0]),P_(A[1]),P_(A[2]),P_(A[3])];var A;const[D,R,O,$]=function(H){let K=H[0][0],W=K,F=H[0][1],q=F;for(let Y=1;Y<H.length;Y++)H[Y][0]<K?K=H[Y][0]:H[Y][0]>W&&(W=H[Y][0]),H[Y][1]<F?F=H[Y][1]:H[Y][1]>q&&(q=H[Y][1]);return[K,F,W-K,q-F]}(S);{const H=new Ua,[K,W,F,q]=function(je){let Je=je[0].x,Fe=Je,Ve=je[0].y,lt=Ve;for(let ut=1;ut<je.length;ut++)je[ut].x<Je?Je=je[ut].x:je[ut].x>Fe&&(Fe=je[ut].x),je[ut].y<Ve?Ve=je[ut].y:je[ut].y>lt&&(lt=je[ut].y);return[Je,Ve,Fe-Je,lt-Ve]}(s),Y=je=>[(je.x-K)/F,(je.y-W)/q],[ee,he,ye,ve]=s.map(Y),Ce=function(je,Je,Fe,Ve,lt,ut,zt,Et){const gt=M_(0,0,1,0,1,1,0,1);return be(gt,gt,Ee([],M_(je,Je,Fe,Ve,lt,ut,zt,Et)))}(ee[0],ee[1],he[0],he[1],ye[0],ye[1],ve[0],ve[1]);this.elevatedGlobePerspectiveTransform=IT(ee[0],ee[1],he[0],he[1],ye[0],ye[1],ve[0],ve[1]);const Ue=(je,Je)=>{w.push(je.lng);const Fe=Math.round((je.lng-D)/O*_t),Ve=Math.round((je.lat-R)/$*_t),lt=Y(Je),ut=Kn([],[lt[0],lt[1],1],Ce),zt=Math.round(ut[0]/ut[2]*_t),Et=Math.round(ut[1]/ut[2]*_t);H.emplaceBack(Fe,Ve,zt,Et)},et=s[3].x-s[0].x,Ye=s[3].y-s[0].y,Qe=s[2].x-s[1].x,ot=s[2].y-s[1].y;for(let je=0;je<65;je++){const Je=je/64,Fe=[s[0].x+Je*et,s[0].y+Je*Ye],Ve=[s[1].x+Je*Qe,s[1].y+Je*ot],lt=Ve[0]-Fe[0],ut=Ve[1]-Fe[1];for(let zt=0;zt<65;zt++){const Et=zt/64,gt={x:Fe[0]+lt*Et,y:Fe[1]+ut*Et,z:0};Ue(i.projection.unproject(gt.x,gt.y),gt)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(H,G0.members)}{this.maxLongitudeTriangleSize=0;let H=[],K=new fn;const W=(F,q,Y)=>{K.emplaceBack(F,q,Y);const ee=w[F],he=w[q],ye=w[Y],ve=Math.min(Math.min(ee,he),ye),Ce=Math.max(Math.max(ee,he),ye)-ve;Ce>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Ce),H.push(ve+Ce/2)};for(let F=0;F<64;F++)for(let q=0;q<64;q++){const Y=65*F+q,ee=Y+1,he=Y+65,ye=he+1;W(Y,he,ee),W(ee,he,ye)}[H,K]=function(F,q){const Y=Array.from({length:F.length},(ye,ve)=>ve);Y.sort((ye,ve)=>F[ye]-F[ve]);const ee=[],he=new fn;for(let ye=0;ye<Y.length;ye++){const ve=Y[ye];ee.push(F[ve]);const Ce=3*ve,Ue=Ce+1;he.emplaceBack(q.uint16[Ce],q.uint16[Ue],q.uint16[Ue+1])}return[ee,he]}(H,K),this.elevatedGlobeTrianglesCenterLongitudes=H,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(K)}this.elevatedGlobeSegments=Cr.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,O/_t,0,$/_t,0,0,R,D,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,s=i.gl;!this._dirty||this.texture instanceof C_||(this.texture?this.texture.update(this.image):(this.texture=new Z0(i,this.image,s.RGBA8),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const s=this.elevatedGlobeTrianglesCenterLongitudes;let a=(u=e+180)+360*Math.round((s[0]-u)/360);var u;const h=new Cr,m=(S,A)=>{h.segments.push({vertexOffset:0,primitiveOffset:S,vertexLength:i.segments[0].vertexLength,primitiveLength:A,sortKey:void 0,vaos:{}})},g=.51*this.maxLongitudeTriangleSize;if(Math.abs(s[0]-a)<=g){const S=ps(s,0,s.length,a+g);return S===s.length||m(S,bn(s,S+1,s.length,a+360-g)-S),h}a<s[0]&&(a+=360);const v=bn(s,0,s.length,a-g);if(v===s.length)return m(0,s.length),h;m(0,v-0);const w=ps(s,v+1,s.length,a+g);return w!==s.length&&m(w,s.length-w),h}}const gk=(Math.pow(256,2)-1)/16907520;class MT extends $n{constructor(e,i,s,a){super(e,{layout:ET||(ET=new Nr({visibility:new dt(Re.layout_raster.visibility)})),paint:AT||(AT=new Nr({"raster-opacity":new dt(Re.paint_raster["raster-opacity"]),"raster-color":new ja(Re.paint_raster["raster-color"]),"raster-color-mix":new dt(Re.paint_raster["raster-color-mix"]),"raster-color-range":new dt(Re.paint_raster["raster-color-range"]),"raster-hue-rotate":new dt(Re.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new dt(Re.paint_raster["raster-brightness-min"]),"raster-brightness-max":new dt(Re.paint_raster["raster-brightness-max"]),"raster-saturation":new dt(Re.paint_raster["raster-saturation"]),"raster-contrast":new dt(Re.paint_raster["raster-contrast"]),"raster-resampling":new dt(Re.paint_raster["raster-resampling"]),"raster-fade-duration":new dt(Re.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new dt(Re.paint_raster["raster-emissive-strength"]),"raster-array-band":new dt(Re.paint_raster["raster-array-band"]),"raster-elevation":new dt(Re.paint_raster["raster-elevation"]),"raster-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},i,s,a),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof CT&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[s,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(s)&&isNaN(a)||s===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=Ap({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:s,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[s,a])}}let PT,DT,RT,zT,LT;class kT extends $n{constructor(e,i,s,a){super(e,{layout:PT||(PT=new Nr({visibility:new dt(Re["layout_raster-particle"].visibility)})),paint:DT||(DT=new Nr({"raster-particle-array-band":new dt(Re["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new dt(Re["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new ja(Re["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new dt(Re["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new dt(Re["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new dt(Re["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new dt(Re["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new dt(Re["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},i,s,a),this._updateColorRamp(),this.lastInvalidatedAt=Io.now()}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Ap({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Io.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class yk extends $n{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function W0(r,e,i){const s=[0,0,1],a=On([]);return $o(a,a,i?-U(r)+Math.PI:U(r)),po(a,a,-U(e)),oo(s,s,a),Ui(s,s)}function OT(r,e){const i=D_(r.projection,r.zoom,r.width,r.height),s=function(u,h,m,g,v){const w=new V(m.lng-180*Wl,m.lat),S=new V(m.lng+180*Wl,m.lat),A=u.project(w.lng,w.lat),D=u.project(S.lng,S.lat),R=-Math.atan2(D.y-A.y,D.x-A.x),O=ke.fromLngLat(m);O.y=Te(O.y,-1+Wl,1-Wl);const $=O.toLngLat(),H=u.project($.lng,$.lat),K=ke.fromLngLat($);K.x+=Wl;const W=K.toLngLat(),F=u.project(W.lng,W.lat),q=BT(F.x-H.x,F.y-H.y,R),Y=ke.fromLngLat($);Y.y+=Wl;const ee=Y.toLngLat(),he=u.project(ee.lng,ee.lat),ye=BT(he.x-H.x,he.y-H.y,R),ve=Math.abs(q.x)/Math.abs(ye.y),Ce=_e([]);xt(Ce,Ce,-R*(1-(v?0:g)));const Ue=_e([]);return nt(Ue,Ue,[1,1-(1-ve)*g,1]),Ue[4]=-ye.x/ye.y*g,xt(Ue,Ue,R),Se(Ue,Ce,Ue),Ue}(r.projection,0,r.center,i,e),a=FT(r);return nt(s,s,[a,a,1]),s}function FT(r){const e=r.projection,i=D_(r.projection,r.zoom,r.width,r.height),s=X0(e,r.center),a=X0(e,V.convert(e.center));return Math.pow(2,s*i+(1-i)*a)}function D_(r,e,i,s,a=1/0){const u=r.range;if(!u)return 0;const h=Math.min(a,Math.max(i,s)),m=Math.log(h/1024)/Math.LN2;return Ae(u[0]+m,u[1]+m,e)}const Wl=1/4e4;function X0(r,e){const i=Te(e.lat,-Me,Me),s=new V(e.lng-180*Wl,i),a=new V(e.lng+180*Wl,i),u=r.project(s.lng,i),h=r.project(a.lng,i),m=ke.fromLngLat(s),g=ke.fromLngLat(a),v=h.x-u.x,w=h.y-u.y,S=g.x-m.x,A=g.y-m.y,D=Math.sqrt((S*S+A*A)/(v*v+w*w));return Math.log(D)/Math.LN2}function BT(r,e,i){const s=Math.cos(i),a=Math.sin(i);return{x:r*s-e*a,y:r*a+e*s}}function NT(r,e,i){_e(r),xt(r,r,U(e[2])),Xe(r,r,U(e[0])),ct(r,r,U(e[1])),nt(r,r,i),Se(r,r,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function R_(r,e,i,s,a,u,h,m){const g=[i[0]-e[0],i[1]-e[1],0],v=[s[0]-e[0],s[1]-e[1],0];if(Jt(g)<1e-12||Jt(v)<1e-12)return On(r);const w=Lr([],g,v);Ui(w,w),ri(v,s,e),g[2]=(u-a)*m,v[2]=(h-a)*m;const S=g;return Lr(S,g,v),Ui(S,S),hs(r,w,S)}function Y0(r,e,i=!1){const s=Vl(e.zoom),a=function(u,h,m){const g=h.worldSize,v=[u[12],u[13],u[14]],w=me(v[1]/g),S=de(v[0]/g),A=_e([]),D=ne(1,w)*g,R=ne(1,0)*g*He(w,h.zoom),O=1/n0(g);let $=R*O;if(m){const F=D_(h.projection,h.zoom,h.width,h.height,1024);$=O*h.projection.pixelSpaceConversion(h.center.lat,g,F)}const H=N(w,S);vi(H,H,Ii([],Ui([],H),D*$*v[2]));const K=function(F){const q=[F[0],F[1],F[2]];let Y=[0,1,0];const ee=Lr([],Y,q);return Lr(Y,q,ee),Yn(Y)===0&&(Y=[0,1,0],Lr(ee,q,Y)),Ui(ee,ee),Ui(Y,Y),Ui(q,q),[ee[0],ee[1],ee[2],0,Y[0],Y[1],Y[2],0,q[0],q[1],q[2],0,F[0],F[1],F[2],1]}(H);nt(A,A,[$,$,$*D]),st(A,A,[-v[0],-v[1],-v[2]]);const W=Se([],h.globeMatrix,K);return Se(W,W,A),Se(W,W,u),W}(r,e,i);if(s>0){const u=function(h,m){const g=m.worldSize,v=ne(1,0)*g*He(m.center.lat,m.zoom)/n0(g),w=ne(1,m.center.lat)*g,S=_e([]);return ct(S,S,U(m.center.lng)),Xe(S,S,U(m.center.lat)),st(S,S,[0,0,f]),nt(S,S,[v,v,v*w]),st(S,S,[m.point.x-.5*g,m.point.y-.5*g,0]),Se(S,S,h),Se(S,m.globeMatrix,S)}(r,e);return function(h,m,g){const v=(R,O,$)=>{const H=Jt(R),K=Jt(O),W=Za(R,O,$);return Ii(W,W,1/Jt(W)*Nt(H,K,$))},w=v([h[0],h[1],h[2]],[m[0],m[1],m[2]],g),S=v([h[4],h[5],h[6]],[m[4],m[5],m[6]],g),A=v([h[8],h[9],h[10]],[m[8],m[9],m[10]],g),D=Za([h[12],h[13],h[14]],[m[12],m[13],m[14]],g);return[w[0],w[1],w[2],0,S[0],S[1],S[2],0,A[0],A[1],A[2],0,D[0],D[1],D[2],1]}(a,u,s)}return a}function jT(r,e,i,s){const a=xr.projectAabbCorners(s,i);let u=Number.MAX_VALUE,h=-1;for(let v=0;v<a.length;++v){const w=a[v];w[0]=(.5*w[0]+.5)*e.width,w[1]=(.5-.5*w[1])*e.height,w[2]<u&&(h=v,u=w[2])}const m=v=>new ft(a[v][0],a[v][1]);let g;switch(h){case 0:case 6:g=[m(1),m(5),m(4),m(7),m(3),m(2),m(1)];break;case 1:case 7:g=[m(0),m(4),m(5),m(6),m(2),m(3),m(0)];break;case 3:case 5:g=[m(1),m(0),m(4),m(7),m(6),m(2),m(1)];break;default:g=[m(1),m(5),m(6),m(7),m(3),m(0),m(1)]}if(Vt(r,g))return u}const vk=ki([{name:"a_pos_3f",components:3,type:"Float32"}]),xk=ki([{name:"a_color_3f",components:3,type:"Float32"}]),bk=ki([{name:"a_color_4f",components:4,type:"Float32"}]),wk=ki([{name:"a_uv_2f",components:2,type:"Float32"}]),Tk=ki([{name:"a_normal_3f",components:3,type:"Float32"}]),Sk=ki([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),Ek=ki([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),VT={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7};class z_{constructor(e,i,s,a){this.message=(e?`${e}: `:"")+s,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function K0(r,e){const i=r.indexOf("://")===-1;try{return new URL(r,i&&e?"http://example.com":void 0),!0}catch{return!1}}class UT{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class $T{constructor(){this.instancedDataArray=new kl,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class J0{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs}updateFootprints(e,i){}populate(e,i,s,a){this.tileToMeter=De(s);const u=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:h,id:m,index:g,sourceLayerIndex:v}of e){const w=m??(h.properties&&h.properties.hasOwnProperty("id")?h.properties.id:void 0),S=Lt(h,u);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom),S,s))continue;const A={id:w,sourceLayerIndex:v,index:g,geometry:u?S.geometry:At(h,s,a),properties:h.properties,type:h.type,patterns:{}},D=this.addFeature(A,A.geometry,S);D&&i.featureIndex.insert(h,A.geometry,g,v,this.index,this.instancesPerModel[D].instancedDataArray.length,_t/32)}this.lookup=null}update(e,i,s,a){for(const u in this.instancesPerModel){const h=this.instancesPerModel[u];for(const m in e)h.idToFeaturesIndex.hasOwnProperty(m)&&(this.evaluate(h.features[h.idToFeaturesIndex[m]],e[m],h,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];for(const a of s.features){const u=this.layers[0],h=a.feature,m=this.canonical,g=u.paint.get("model-rotation").evaluate(h,{},m),v=u.paint.get("model-scale").evaluate(h,{},m),w=u.paint.get("model-translation").evaluate(h,{},m);Qi(a.rotation,g)&&Qi(a.scale,v)&&Qi(a.translation,w)||(this.evaluate(a,a.featureStates,s,!0),e=!0)}}return e}updateReplacement(e,i,s,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const u=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(b0(this.activeReplacements,u))return!1;this.activeReplacements=u;let h=!1;for(const m in this.instancesPerModel){const g=this.instancesPerModel[m],v=g.instancedDataArray;for(const w of g.features){const S=w.instancedDataOffset,A=w.instancedDataCount;for(let D=0;D<A;D++){const R=16*(D+S);let O=v.float32[R+0];const $=O>_t;O=$?O-_t:O;const H=Math.floor(O),K=v.float32[R+1];let W=!1;for(const F of this.activeReplacements)if(!Zw(F,s,VT.Model,a)&&!(F.min.x>H||H>F.max.x||F.min.y>K||K>F.max.y)&&(W=Qw(Jw(H,K,e.canonical,F.footprintTileId.canonical),F.footprint),W))break;v.float32[R]=W?O+_t:O,h=h||W!==$}}}return h}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];s.instancedDataArray.length<0||s.instancedDataArray.length===0||(s.instancedDataBuffer?s.instancedDataBuffer.updateData(s.instancedDataArray):s.instancedDataBuffer=e.createVertexBuffer(s.instancedDataArray,Sk.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];s.instancedDataArray.length!==0&&s.instancedDataBuffer&&s.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris&&this.modelsRequested)for(const i of this.modelUris)e.removeModel(i,"",!0)}addFeature(e,i,s){const a=this.layers[0],u=a.layout.get("model-id").evaluate(s,{},this.canonical);if(!u)return yi(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),u;(K0(u,!1)||this.styleDefinedModelURLs[u]!==void 0)&&(this.modelUris.includes(u)||this.modelUris.push(u)),this.instancesPerModel[u]||(this.instancesPerModel[u]=new $T);const h=this.instancesPerModel[u],m=h.instancedDataArray,g=new UT(s,m.length);for(const v of i)for(const w of v){if(w.x<0||w.x>=_t||w.y<0||w.y>=_t)continue;const S=(this.lookupDim-1)/_t,A=this.lookupDim*(w.y*S|0)+w.x*S|0;if(this.lookup){if(this.lookup[A]!==0)continue;this.lookup[A]=1}this.instanceCount++;const D=m.length;m.resize(D+1),h.instancesEvaluatedElevation.push(0),m.float32[16*D]=w.x,m.float32[16*D+1]=w.y}return g.instancedDataCount=h.instancedDataArray.length-g.instancedDataOffset,g.instancedDataCount>0&&(e.id&&(h.idToFeaturesIndex[e.id]=h.features.length),h.features.push(g),this.evaluate(g,{},h,!1)),u}getModelUris(){return this.modelUris}evaluate(e,i,s,a){const u=this.layers[0],h=e.feature,m=this.canonical,g=e.rotation=u.paint.get("model-rotation").evaluate(h,i,m),v=e.scale=u.paint.get("model-scale").evaluate(h,i,m),w=e.translation=u.paint.get("model-translation").evaluate(h,i,m),S=u.paint.get("model-color").evaluate(h,i,m);S.a=u.paint.get("model-color-mix-intensity").evaluate(h,i,m);const A=[];this.maxVerticalOffset<w[2]&&(this.maxVerticalOffset=w[2]),this.maxScale=Math.max(Math.max(this.maxScale,v[0]),Math.max(v[1],v[2])),NT(A,g,v);const D=Math.round(100*S.a)+S.b/1.05;for(let R=0;R<e.instancedDataCount;++R){const O=e.instancedDataOffset+R,$=16*O,H=s.instancedDataArray.float32;let K=0;a&&(K=H[$+6]-s.instancesEvaluatedElevation[O]);const W=0|H[$+1];H[$]=(0|H[$])+S.r/1.05,H[$+1]=W+S.g/1.05,H[$+2]=D,H[$+3]=1/(m.z>10?this.tileToMeter:De(m,W)),H[$+4]=w[0],H[$+5]=w[1],H[$+6]=w[2]+K,H[$+7]=A[0],H[$+8]=A[1],H[$+9]=A[2],H[$+10]=A[4],H[$+11]=A[5],H[$+12]=A[6],H[$+13]=A[8],H[$+14]=A[9],H[$+15]=A[10],s.instancesEvaluatedElevation[O]=w[2]}}}let GT,HT;Tt(J0,"ModelBucket",{omit:["layers"]}),Tt($T,"PerModelAttributes"),Tt(UT,"ModelFeature");const iu=64,jh={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function qT(r,e,i,s,a,u,h,m,g,v=!1){const w=i.zoom,S=i.project(s),A=He(s.lat,w),D=1/A;_e(r),st(r,r,[S.x+h[0]*D,S.y+h[1]*D,h[2]]);let R=1,O=1;const $=i.worldSize;if(v){if(i.projection.name==="mercator"){let F=0;i.elevation&&(F=i.elevation.getAtPointOrZero(new ke(S.x/$,S.y/$),0));const q=Dr([],[S.x,S.y,F,1],i.projMatrix)[3]/i.cameraToCenterDistance;R=q,O=q*He(i.center.lat,w)}else if(i.projection.name==="globe"){const F=Y0(r,i),q=[0,0,0,1];Dr(q,q,Se([],i.projMatrix,F));const Y=q[3]/i.cameraToCenterDistance,ee=Vl(w),he=i.projection.pixelsPerMeter(s.lat,$)*He(s.lat,w),ye=i.projection.pixelsPerMeter(i.center.lat,$)*He(i.center.lat,w);R=Y/Nt(he,Ze(i.center.lat),ee),O=Y*A/he,R*=ye,O*=ye}}else R=D;nt(r,r,[R,R,O]);const H=[...r],K=e.orientation,W=[];if(NT(W,[K[0]+a[0],K[1]+a[1],K[2]+a[2]],u),Se(r,H,W),m&&i.elevation){let F=0;const q=[];if(g&&i.elevation){F=function(ee,he,ye,ve,Ce){const Ue=he.elevation;if(!Ue)return 0;const et=xr.projectAabbCorners(ye,ve),Ye=ne(1,Ce.lat)*he.worldSize,Qe=function(at,Xt){const Mt=[0,0,1],Pt=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const Ht of Pt){const ii=at[Ht.corners[0]],oi=at[Ht.corners[1]],fi=at[Ht.corners[2]],ci=[oi[0]-ii[0],oi[1]-ii[1],Xt*(oi[2]-ii[2])],ai=Lr(ci,ci,[fi[0]-ii[0],fi[1]-ii[1],Xt*(fi[2]-ii[2])]);Ui(ai,ai),Ht.dotProductWithUp=Zi(ai,Mt)}return Pt.sort((Ht,ii)=>Ht.dotProductWithUp-ii.dotProductWithUp),Pt[0].corners}(et,Ye),ot=et[Qe[0]],je=et[Qe[1]],Je=et[Qe[2]],Fe=et[Qe[3]],Ve=Ue.getAtPointOrZero(new ke(ot[0]/he.worldSize,ot[1]/he.worldSize),0),lt=Ue.getAtPointOrZero(new ke(je[0]/he.worldSize,je[1]/he.worldSize),0),ut=Ue.getAtPointOrZero(new ke(Je[0]/he.worldSize,Je[1]/he.worldSize),0),zt=Ue.getAtPointOrZero(new ke(Fe[0]/he.worldSize,Fe[1]/he.worldSize),0),Et=(Ve+zt)/2,gt=(lt+ut)/2;return Et>gt?lt<ut?R_(ee,je,Fe,ot,lt,zt,Ve,Ye):R_(ee,Je,ot,Fe,ut,Ve,zt,Ye):Ve<zt?R_(ee,ot,je,Je,Ve,lt,ut,Ye):R_(ee,Fe,Je,je,zt,ut,lt,Ye),Math.max(Et,gt)}(q,i,e.aabb,r,s);const Y=Se([],Wt([],q),W);Se(r,H,Y)}else F=i.elevation.getAtPointOrZero(new ke(S.x/$,S.y/$),0);F!==0&&(r[14]+=F)}}function Wp(r,e,i=!1){r.uploaded||(r.gfxTexture=new Z0(e,r.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:r.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),r.uploaded=!0,r.image=null)}function Ak(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,vk.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,Tk.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,wk.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?xk:bk).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,Ek.members,!0)),r.segments=Cr.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const s=r.material;s.pbrMetallicRoughness.baseColorTexture&&Wp(s.pbrMetallicRoughness.baseColorTexture,e),s.pbrMetallicRoughness.metallicRoughnessTexture&&Wp(s.pbrMetallicRoughness.metallicRoughnessTexture,e),s.normalTexture&&Wp(s.normalTexture,e),s.occlusionTexture&&Wp(s.occlusionTexture,e,i),s.emissionTexture&&Wp(s.emissionTexture,e)}function Q0(r,e,i){if(r.meshes)for(const s of r.meshes)Ak(s,e,i);if(r.children)for(const s of r.children)Q0(s,e,i)}function L_(r){if(r.meshes)for(const e of r.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(r.children)for(const e of r.children)L_(e)}function ev(r){if(r.meshes)for(const i of r.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(r.children)for(const i of r.children)ev(i)}class Vh{constructor(e,i,s){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=s}static create(e,i,s){const a=s||e.findDEMTileFor(i);if(!a||!a.dem)return;const u=a.dem,h=a.tileID,m=1<<i.canonical.z-h.canonical.z;return new Vh(a,u.dim/_t/m,[(i.canonical.x/m-h.canonical.x)*u.dim,(i.canonical.y/m-h.canonical.y)*u.dim])}tileCoordToPixel(e,i){const s=i*this._scale+this._offset[1],a=Math.floor(e*this._scale+this._offset[0]),u=Math.floor(s);return new ft(a,u)}getElevationAt(e,i,s,a){const u=e*this._scale+this._offset[0],h=i*this._scale+this._offset[1],m=Math.floor(u),g=Math.floor(h),v=this._dem;return a=!!a,s?Nt(Nt(v.get(m,g,a),v.get(m,g+1,a),h-g),Nt(v.get(m+1,g,a),v.get(m+1,g+1,a),h-g),u-m):v.get(m,g,a)}getElevationAtPixel(e,i,s){return this._dem.get(e,i,!!s)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*ne(1,e)*this._dem.stride}}const tv=new Float32Array(262144),ru=new Uint8Array(262144);function ZT(r){let e=0;if(r.meshes)for(const i of r.meshes)e=Math.max(e,i.aabb.max[2]);if(r.children)for(const i of r.children)e=Math.max(e,ZT(i));return e}function WT(r,e,i){if(r.meshes)for(const s of r.meshes){if(s.aabb.min[0]===1/0)continue;const a=xr.applyTransform(s.aabb,r.matrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(r.children)for(const s of r.children)WT(s,e,i)}const XT=["","wall","door","roof","window","lamp","logo"];class YT{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:ZT(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new xr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new xr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const s of this.node.meshes)this.node.lightMeshIndex!==e&&(s.transformedAabb=xr.applyTransformFast(s.aabb,this.node.matrix),i.encapsulate(s.transformedAabb)),e++;this.aabb=i}return this.aabb}}class k_{constructor(e,i,s,a,u,h,m){this.id=s,this.layers=e,this.layerIds=this.layers.map(g=>g.fqid),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.modelTraits|=jh.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=jh.HasMapboxMeshFeatures),u&&(this.modelTraits|=jh.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=h,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of i)this.nodesInfo.push(new YT(g)),WT(g,m.featureIndexArray.length,m.grid),m.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,m.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,i){for(const s of this.getNodesInfo()){const a=s.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const s=i?this.stateDependentLayers:this.layers;if(!ds(e,this.states))for(const a of s)this.evaluate(a,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const s of i){const a=s.node;this.uploaded?this.updatePbrBuffer(a):Q0(a,e,!0)}for(const s of i)L_(s.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const s of e.meshes)s.pbrBuffer&&(s.pbrBuffer.updateData(s.featureArray),i=!0);return i}needsReEvaluation(e,i,s){const a=e.transform.projectionOptions,u=e.style.getBrightness(),h=this.brightness!==u;if(!this.uploaded||this.dirty||a.name!==this.projection.name||Xp(s.paint.get("model-color").value,h)||Xp(s.paint.get("model-color-mix-intensity").value,h)||Xp(s.paint.get("model-roughness").value,h)||Xp(s.paint.get("model-emissive-strength").value,h)||Xp(s.paint.get("model-height-based-emissive-strength-multiplier").value,h)){this.projection=a,this.brightness=u;const m=this.getNodesInfo();for(const g of m)g.state=null;return!0}return!1}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const s=this.getNodesInfo(),a=this.id.canonical;for(const u of s){const h=u.feature;u.evaluatedScale=i.paint.get("model-scale").evaluate(h,{},a)}}evaluate(e,i){const s=this.getNodesInfo();for(const a of s){if(!a.node.meshes)continue;const u=a.feature,h=i&&i[u.id];if(ds(h,a.state))continue;a.state=structuredClone(h);const m=a.node.meshes&&a.node.meshes[0].featureData,g=a.evaluatedColor[2],v=a.evaluatedRMEA[2],w=this.id.canonical;if(a.hasTranslucentParts=!1,m){for(let S=0;S<XT.length;S++){const A=XT[S];A.length&&(u.properties.part=A);const D=e.paint.get("model-color").evaluate(u,h,w).toRenderColor(null),R=e.paint.get("model-color-mix-intensity").evaluate(u,h,w);a.evaluatedColor[S]=[D.r,D.g,D.b,R],a.evaluatedRMEA[S][0]=e.paint.get("model-roughness").evaluate(u,h,w),a.evaluatedRMEA[S][2]=e.paint.get("model-emissive-strength").evaluate(u,h,w),a.evaluatedRMEA[S][3]=D.a,a.emissionHeightBasedParams[S]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(u,h,w),!a.hasTranslucentParts&&D.a<1&&(a.hasTranslucentParts=!0)}delete u.properties.part,Ck(a,g!==a.evaluatedColor[2]||v!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(u,h,w);a.evaluatedScale=e.paint.get("model-scale").evaluate(u,h,w),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,s,a){const u=e.findDEMTileFor(s);if(u&&(u.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(u.dem&&u.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=u.tileID.overscaledZ;const h=Vh.create(e,s,u);if(!h)return;this.modelTraits&jh.HasMapboxMeshFeatures&&this.updateDEM(e,h,s,a);for(const m of this.getNodesInfo()){const g=m.node;if(!g.footprint||!g.footprint.vertices||!g.footprint.vertices.length)continue;const v=g.footprint.vertices;let w=h.getElevationAt(v[0].x,v[0].y,!0,!0);for(let S=1;S<v.length;S++)w=Math.min(w,h.getElevationAt(v[S].x,v[S].y,!0,!0));g.elevation=w}}this.terrainTile=u.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,s,a){let u=i._dem._modifiedForSources[a];if(u===void 0&&(i._dem._modifiedForSources[a]=[],u=i._dem._modifiedForSources[a]),u.includes(s.canonical))return;const h=i._dem.dim;u.push(s.canonical);let m=!1;for(const g of this.getNodesInfo()){const v=g.node;if(!v.footprint||!v.footprint.grid)continue;const w=v.footprint.grid,S=i.tileCoordToPixel(w.min.x,w.min.y),A=i.tileCoordToPixel(w.max.x,w.max.y),D=Math.min(Math.min(h-A.y,S.x),Math.min(S.y,h-A.x));if(D<0)continue;const R=Te(D,2,5);let O=Math.max(0,S.x-R),$=Math.max(0,S.y-R),H=Math.min(A.x+R,h-1),K=Math.min(A.y+R,h-1);for(let Y=$;Y<=K;++Y)for(let ee=O;ee<=H;++ee)ru[Y*h+ee]=255;let W=0,F=0;for(let Y=0;Y<w.cellsY;++Y)for(let ee=0;ee<w.cellsX;++ee){if(!w.cells[Y*w.cellsX+ee])continue;const he=i.tileCoordToPixel(w.min.x+ee/w.xScale,w.min.y+Y/w.yScale),ye=i.tileCoordToPixel(w.min.x+(ee+1)/w.xScale,w.min.y+(Y+1)/w.yScale);for(let ve=he.y;ve<=Math.min(ye.y+1,h-1);++ve)for(let Ce=he.x;Ce<=Math.min(ye.x+1,h-1);++Ce)ru[ve*h+Ce]===255&&(ru[ve*h+Ce]=0,W+=i.getElevationAtPixel(Ce,ve),F++)}const q=W/F;O=Math.max(1,S.x-R),$=Math.max(1,S.y-R),H=Math.min(A.x+R,h-2),K=Math.min(A.y+R,h-2),m=!0;for(let Y=$;Y<=K;++Y)for(let ee=O;ee<=H;++ee)ru[Y*h+ee]===0&&(tv[Y*h+ee]=i._dem.set(ee,Y,q));for(let Y=1;Y<R;++Y){O=Math.max(1,S.x-Y),$=Math.max(1,S.y-Y),H=Math.min(A.x+Y,h-2),K=Math.min(A.y+Y,h-2);for(let ee=$;ee<=K;++ee)for(let he=O;he<=H;++he){const ye=ee*h+he;if(ru[ye]===255){let ve=0,Ce=0,Ue=-1,et=-1;for(let Ye=-1;Ye<=1;++Ye)for(let Qe=-1;Qe<=1;++Qe){const ot=(ee+Ye)*h+he+Qe;if(ru[ot]>=Y)continue;const je=tv[ot],Je=Math.abs(je);Je>Ce&&(ve=je,Ce=Je,Ue=Qe,et=Ye)}if(Ce>.1){const Ye=1-(Y+.5*Math.abs(Ue*et))/R;let Qe=i._dem.get(he,ee)+ve*Ye;const ot=i._dem.get(he+Ue,ee+et),je=i._dem.get(he-Ue,ee-et,!0);(Qe-ot)*(Qe-je)>0&&(Qe=(ot+je)/2),tv[ye]=i._dem.set(he,ee,Qe),ru[ye]=Y}}}}}m&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Io.now())}setFilter(e){this.filter=e?ap(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new Wi(this.id.overscaledZ),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)L_(i.node),ev(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped()),a=this.getNodesInfo();for(let u=0;u<this.nodesInfo.length;u++){const h=a[u].node;a[u].hiddenByReplacement=!!h.footprint&&!s.find(m=>m.footprint===h.footprint)}}getHeightAtTileCoord(e,i){const s=this.getNodesInfo(),a=[],u=[0,0,0],h=_e([]);for(let m=0;m<this.nodesInfo.length;m++){const g=s[m],v=g.node.meshes[0],w=v.transformedAabb;if(e<w.min[0]||i<w.min[1]||e>w.max[0]||i>w.max[1])continue;if(g.node.hidden===!0)return{height:1/0,maxHeight:g.feature.properties.height,hidden:!1,verticalScale:g.evaluatedScale[2]};ze(h,g.node.matrix),u[0]=e,u[1]=i,gr(u,u,h);const S=(u[0]-v.aabb.min[0])/(v.aabb.max[0]-v.aabb.min[0])*iu|0,A=Math.min(63,(u[1]-v.aabb.min[1])/(v.aabb.max[1]-v.aabb.min[1])*iu|0)*iu+Math.min(63,S),D=v.heightmap[A];if(!(D<0&&g.node.footprint))return g.hiddenByReplacement?void 0:{height:D,maxHeight:g.feature.properties.height,hidden:!1,verticalScale:g.evaluatedScale[2]};if(g.node.footprint.grid.query(new ft(e,i),new ft(e,i),a),a.length>0)return{height:void 0,maxHeight:g.feature.properties.height,hidden:g.hiddenByReplacement,verticalScale:g.evaluatedScale[2]}}}}function Xp(r,e){return r instanceof Oa&&!r.isLightConstant&&e}function Ik(r,e,i,s,a,u,h,m){let g=(61440&e|(61440&e)>>4)>>8,v=(3840&e|(3840&e)>>4)>>4,w=240&e|(240&e)>>4;i[3]>0&&(g=Nt(g,255*i[0],i[3]),v=Nt(v,255*i[1],i[3]),w=Nt(w,255*i[2],i[3]));const S=g<<8|v,A=w<<8|Math.floor(255*s[3]),D=function(Y){const ee=Te(Y,0,2);return Math.min(Math.round(.5*ee*255),255)}(s[2])<<8|15*s[0]<<4|15*s[1],R=Te(a[0],0,1),O=Te(a[1],0,1),$=Te(a[2],0,1),H=Te(a[3],0,1);let K,W,F,q;if(R!==O&&h!==u&&O!==R){const Y=h-u;W=1/(Y*(O-R)),F=-(u+Y*R)/(Y*(O-R));const ee=Te(a[4],-1,1);q=Math.pow(10,ee),K=255*$<<8|255*H}else K=65535,W=0,F=1,q=1;if(r.emplaceBack(S,A,D,K,W,F,q),m){const Y=m.length;m.clear();for(let ee=0;ee<Y;ee++)m.emplaceBack(S,A,D,K,W,F,q)}}function Ck(r,e,i){const s=r.node;let a=0;const u=i&jh.HasMeshoptCompression;for(const h of s.meshes){if(s.lights&&s.lightMeshIndex===a||!h.featureData)continue;h.featureArray=new $c,h.featureArray.reserve(h.featureData.length);let m=e;for(const g of h.featureData){const v=u?65535&g:g>>16&65535,w=u?g>>16&65535:65535&g,S=(15&w)<8?15&w:0,A=r.evaluatedRMEA[S],D=r.evaluatedColor[S],R=r.emissionHeightBasedParams[S];let O;if(m&&S===2&&s.lights&&(O=new $c,O.resize(10*s.lights.length)),Ik(h.featureArray,v,D,A,R,h.aabb.min[2],h.aabb.max[2],O),O&&m){m=!1;const $=s.meshes[s.lightMeshIndex];$.featureArray=O,$.featureArray._trim()}}h.featureArray._trim(),a++}}function KT(r,e,i,s){const a=1<<r.z;e.lat=me((s/_t+r.y)/a),e.lng=de((i/_t+r.x)/a)}Tt(k_,"Tiled3dModelBucket",{omit:["layers"]}),Tt(YT,"Tiled3dModelFeature");const Mk={circle:class extends $n{constructor(r,e,i,s){super(r,{layout:Bi||(Bi=new Nr({"circle-sort-key":new wt(Re.layout_circle["circle-sort-key"]),"circle-elevation-reference":new dt(Re.layout_circle["circle-elevation-reference"]),visibility:new dt(Re.layout_circle.visibility)})),paint:Er||(Er=new Nr({"circle-radius":new wt(Re.paint_circle["circle-radius"]),"circle-color":new wt(Re.paint_circle["circle-color"]),"circle-blur":new wt(Re.paint_circle["circle-blur"]),"circle-opacity":new wt(Re.paint_circle["circle-opacity"]),"circle-translate":new dt(Re.paint_circle["circle-translate"]),"circle-translate-anchor":new dt(Re.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new dt(Re.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new dt(Re.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new wt(Re.paint_circle["circle-stroke-width"]),"circle-stroke-color":new wt(Re.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new wt(Re.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new dt(Re.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}createBucket(r){return new Ct(r)}queryRadius(r){const e=r;return si("circle-radius",this,e)+si("circle-stroke-width",this,e)+yr(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,s,a,u,h,m){const g=vr(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),v=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return uw(r,s,u,h,m,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",g,v)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const s=cw(this);return{config:new ia(this,{zoom:e,lut:i}),defines:s,overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends $n{createBucket(r){return new dw(r)}constructor(r,e,i,s){super(r,{layout:pw||(pw=new Nr({visibility:new dt(Re.layout_heatmap.visibility)})),paint:fw||(fw=new Nr({"heatmap-radius":new wt(Re.paint_heatmap["heatmap-radius"]),"heatmap-weight":new wt(Re.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new dt(Re.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ja(Re.paint_heatmap["heatmap-color"]),"heatmap-opacity":new dt(Re.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ap({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(r){return si("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,s,a,u,h,m){const g=this.paint.get("heatmap-radius").evaluate(e,i);return uw(r,s,u,h,m,!0,!0,new ft(0,0),g)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(r,e,i){return r==="heatmap"?{config:new ia(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends $n{constructor(r,e,i,s){super(r,{layout:mw||(mw=new Nr({visibility:new dt(Re.layout_hillshade.visibility)})),paint:_w||(_w=new Nr({"hillshade-illumination-direction":new dt(Re.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new dt(Re.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new dt(Re.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new dt(Re.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new dt(Re.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new dt(Re.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new dt(Re.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}},fill:class extends $n{constructor(r,e,i,s){super(r,{layout:Uw||(Uw=new Nr({"fill-sort-key":new wt(Re.layout_fill["fill-sort-key"]),visibility:new dt(Re.layout_fill.visibility),"fill-elevation-reference":new dt(Re.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new wt(Re.layout_fill["fill-construct-bridge-guard-rail"])})),paint:$w||($w=new Nr({"fill-antialias":new dt(Re.paint_fill["fill-antialias"]),"fill-opacity":new wt(Re.paint_fill["fill-opacity"]),"fill-color":new wt(Re.paint_fill["fill-color"]),"fill-outline-color":new wt(Re.paint_fill["fill-outline-color"]),"fill-translate":new dt(Re.paint_fill["fill-translate"]),"fill-translate-anchor":new dt(Re.paint_fill["fill-translate-anchor"]),"fill-pattern":new wt(Re.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new dt(Re.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new dt(Re.paint_fill["fill-emissive-strength"]),"fill-z-offset":new wt(Re.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new wt(Re.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new wt(Re.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}getProgramIds(){const r=this.paint.get("fill-pattern"),e=r&&r.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(r,e,i){return{config:new ia(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(r,e){super.recalculate(r,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(r){return new y0(r)}queryRadius(){return yr(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,s,a,u){return!r.queryGeometry.isAboveHorizon&&gi(Di(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),s)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(r){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return r!=null?e&&!r:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends $n{constructor(r,e,i,s){super(r,{layout:f2||(f2=new Nr({visibility:new dt(Re["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new dt(Re["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:m2||(m2=new Nr({"fill-extrusion-opacity":new dt(Re["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new wt(Re["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new dt(Re["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new dt(Re["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new wt(Re["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new dt(Re["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new wt(Re["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new wt(Re["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new dt(Re["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new dt(Re["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new dt(Re["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new dt(Re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new dt(Re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new dt(Re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new dt(Re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new dt(Re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new dt(Re["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new dt(Re["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new wt(Re["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new wt(Re["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new dt(Re["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new dt(Re["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new dt(Re["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new dt(Re["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new wt(Re["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new wt(Re["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new dt(Re["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new h_(r)}queryRadius(){return yr(this.paint.get("fill-extrusion-translate"))}is3D(r){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(r,e,i,s,a,u,h,m,g){const v=vr(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),w=this.paint.get("fill-extrusion-height").evaluate(e,i),S=this.paint.get("fill-extrusion-base").evaluate(e,i),A=[0,0],D=m&&u.elevation,R=u.elevation?u.elevation.exaggeration():1,O=r.tile.getBucket(this);if(D&&O instanceof h_){const F=O.centroidVertexArray,q=g+1;q<F.length&&(A[0]=F.geta_centroid_pos0(q),A[1]=F.geta_centroid_pos1(q))}if(A[0]===0&&A[1]===1)return!1;u.projection.name==="globe"&&(s=p2([s],[new ft(0,0),new ft(_t,_t)],r.tileID.canonical).map(F=>F.polygon).flat());const $=D?m:null,[H,K]=function(F,q,Y,ee,he,ye,ve,Ce,Ue,et,Ye){return F.projection.name==="globe"?function(Qe,ot,je,Je,Fe,Ve,lt,ut,zt,Et,gt){const at=[],Xt=[],Mt=Qe.projection.upVectorScale(gt,Qe.center.lat,Qe.worldSize).metersToTile,Pt=[0,0,0,1],Ht=[0,0,0,1],ii=(fi,ci,ai,tr)=>{fi[0]=ci,fi[1]=ai,fi[2]=tr,fi[3]=1},oi=d2();je>0&&(je+=oi),Je+=oi;for(const fi of ot){const ci=[],ai=[];for(const tr of fi){const ur=tr.x+Fe.x,J=tr.y+Fe.y,te=Qe.projection.projectTilePoint(ur,J,gt),Ge=Qe.projection.upVector(gt,tr.x,tr.y);let pt=je,vt=Je;if(lt){const yt=b2(ur,J,je,Je,lt,ut,zt,Et);pt+=yt.base,vt+=yt.top}je!==0?ii(Pt,te.x+Ge[0]*Mt*pt,te.y+Ge[1]*Mt*pt,te.z+Ge[2]*Mt*pt):ii(Pt,te.x,te.y,te.z),ii(Ht,te.x+Ge[0]*Mt*vt,te.y+Ge[1]*Mt*vt,te.z+Ge[2]*Mt*vt),gr(Pt,Pt,Ve),gr(Ht,Ht,Ve),ci.push(new eu(Pt[0],Pt[1],Pt[2])),ai.push(new eu(Ht[0],Ht[1],Ht[2]))}at.push(ci),Xt.push(ai)}return[at,Xt]}(F,q,Y,ee,he,ye,ve,Ce,Ue,et,Ye):ve?function(Qe,ot,je,Je,Fe,Ve,lt,ut,zt){const Et=[],gt=[],at=[0,0,0,1];for(const Xt of Qe){const Mt=[],Pt=[];for(const Ht of Xt){const ii=Ht.x+Je.x,oi=Ht.y+Je.y,fi=b2(ii,oi,ot,je,Ve,lt,ut,zt);at[0]=ii,at[1]=oi,at[2]=fi.base,at[3]=1,Dr(at,at,Fe),at[3]=Math.max(at[3],1e-5);const ci=new eu(at[0]/at[3],at[1]/at[3],at[2]/at[3]);at[0]=ii,at[1]=oi,at[2]=fi.top,at[3]=1,Dr(at,at,Fe),at[3]=Math.max(at[3],1e-5);const ai=new eu(at[0]/at[3],at[1]/at[3],at[2]/at[3]);Mt.push(ci),Pt.push(ai)}Et.push(Mt),gt.push(Pt)}return[Et,gt]}(q,Y,ee,he,ye,ve,Ce,Ue,et):function(Qe,ot,je,Je,Fe){const Ve=[],lt=[],ut=Fe[8]*ot,zt=Fe[9]*ot,Et=Fe[10]*ot,gt=Fe[11]*ot,at=Fe[8]*je,Xt=Fe[9]*je,Mt=Fe[10]*je,Pt=Fe[11]*je;for(const Ht of Qe){const ii=[],oi=[];for(const fi of Ht){const ci=fi.x+Je.x,ai=fi.y+Je.y,tr=Fe[0]*ci+Fe[4]*ai+Fe[12],ur=Fe[1]*ci+Fe[5]*ai+Fe[13],J=Fe[2]*ci+Fe[6]*ai+Fe[14],te=Fe[3]*ci+Fe[7]*ai+Fe[15],Ge=tr+ut,pt=ur+zt,vt=J+Et,yt=Math.max(te+gt,1e-5),Dt=tr+at,Gt=ur+Xt,wi=J+Mt,Ti=Math.max(te+Pt,1e-5);ii.push(new eu(Ge/yt,pt/yt,vt/yt)),oi.push(new eu(Dt/Ti,Gt/Ti,wi/Ti))}Ve.push(ii),lt.push(oi)}return[Ve,lt]}(q,Y,ee,he,ye)}(u,s,S,w,v,h,$,A,R,u.center.lat,r.tileID.canonical),W=r.queryGeometry;return function(F,q,Y){let ee=1/0;gi(Y,q)&&(ee=x2(Y,q[0]));for(let he=0;he<q.length;he++){const ye=q[he],ve=F[he];for(let Ce=0;Ce<ye.length-1;Ce++){const Ue=ye[Ce],et=[Ue,ye[Ce+1],ve[Ce+1],ve[Ce],Ue];Vt(Y,et)&&(ee=Math.min(ee,x2(Y,et)))}}return ee!==1/0&&ee}(H,K,W.isPointQuery()?W.screenBounds:W.screenGeometry)}},line:class extends $n{constructor(r,e,i,s){const a=D2();super(r,a,e,i,s),a.layout&&(this.layout=new Na(a.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Ic,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(r,e){super.recalculate(r,e),this.paint._values["line-floorwidth"]=(()=>{if(Op)return Op;const i=D2();return Op=new P3(i.paint.properties["line-width"].specification),Op.useIntegerZoom=!0,Op})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new E0(r)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(r,e,i){const s=M2(this);return{config:new ia(this,{zoom:e,lut:i}),defines:s,overrideFog:!1}}queryRadius(r){const e=r,i=R2(si("line-width",this,e),si("line-gap-width",this,e)),s=si("line-offset",this,e);return i/2+Math.abs(s)+yr(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,s,a,u){if(r.queryGeometry.isAboveHorizon)return!1;const h=Di(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),m=r.pixelToTileUnitsFactor/2*R2(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),g=this.paint.get("line-offset").evaluate(e,i);return g&&(s=function(v,w){const S=[],A=new ft(0,0);for(let D=0;D<v.length;D++){const R=v[D],O=[];for(let $=0;$<R.length;$++){const H=R[$],K=R[$+1],W=$===0?A:H.sub(R[$-1])._unit()._perp(),F=$===R.length-1?A:K.sub(H)._unit()._perp(),q=W._add(F)._unit();q._mult(1/(q.x*F.x+q.y*F.y)),O.push(q._mult(w)._add(H))}S.push(O)}return S}(s,g*r.pixelToTileUnitsFactor)),function(v,w,S){for(let A=0;A<w.length;A++){const D=w[A];if(v.length>=3){for(let R=0;R<D.length;R++)if(Yi(v,D[R]))return!0}if(Xi(v,D,S))return!0}return!1}(h,s,m)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(r){return!this.hasElevatedBuckets}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:I_,background:class extends $n{constructor(r,e,i,s){super(r,{layout:TT||(TT=new Nr({visibility:new dt(Re.layout_background.visibility)})),paint:ST||(ST=new Nr({"background-pitch-alignment":new dt(Re.paint_background["background-pitch-alignment"]),"background-color":new dt(Re.paint_background["background-color"]),"background-pattern":new dt(Re.paint_background["background-pattern"]),"background-opacity":new dt(Re.paint_background["background-opacity"]),"background-emissive-strength":new dt(Re.paint_background["background-emissive-strength"]),"background-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}is3D(r){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:MT,"raster-particle":kT,sky:class extends $n{constructor(r,e,i,s){super(r,{layout:RT||(RT=new Nr({visibility:new dt(Re.layout_sky.visibility)})),paint:zT||(zT=new Nr({"sky-type":new dt(Re.paint_sky["sky-type"]),"sky-atmosphere-sun":new dt(Re.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new dt(Re.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new dt(Re.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new dt(Re.paint_sky["sky-gradient-radius"]),"sky-gradient":new ja(Re.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new dt(Re.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new dt(Re.paint_sky["sky-atmosphere-color"]),"sky-opacity":new dt(Re.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="sky-gradient"?this._updateColorRamp():r!=="sky-atmosphere-sun"&&r!=="sky-atmosphere-halo-color"&&r!=="sky-atmosphere-color"&&r!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Ap({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(r){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=r.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(r,e){if(this.paint.get("sky-type")==="atmosphere"){const s=this.paint.get("sky-atmosphere-sun"),a=!s,u=r.style.light,h=u.properties.get("position");return a&&u.properties.get("anchor")==="viewport"&&yi("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?W0(h.azimuthal,90-h.polar,e):W0(s[0],90-s[1],e)}const i=this.paint.get("sky-gradient-center");return W0(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(r){this._skyboxInvalidated=!1,this._lightPosition=r.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const r=this.paint.get("sky-type");return r==="atmosphere"?["skyboxCapture","skybox"]:r==="gradient"?["skyboxGradient"]:null}},slot:class extends $n{constructor(r,e,i,s){super(r,{paint:LT||(LT=new Nr({}))},e,null)}},model:class extends $n{constructor(r,e,i,s){super(r,{layout:GT||(GT=new Nr({visibility:new dt(Re.layout_model.visibility),"model-id":new wt(Re.layout_model["model-id"])})),paint:HT||(HT=new Nr({"model-opacity":new wt(Re.paint_model["model-opacity"]),"model-rotation":new wt(Re.paint_model["model-rotation"]),"model-scale":new wt(Re.paint_model["model-scale"]),"model-translation":new wt(Re.paint_model["model-translation"]),"model-color":new wt(Re.paint_model["model-color"]),"model-color-mix-intensity":new wt(Re.paint_model["model-color-mix-intensity"]),"model-type":new dt(Re.paint_model["model-type"]),"model-cast-shadows":new dt(Re.paint_model["model-cast-shadows"]),"model-receive-shadows":new dt(Re.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new dt(Re.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new wt(Re.paint_model["model-emissive-strength"]),"model-roughness":new wt(Re.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new wt(Re.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new dt(Re.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new dt(Re.paint_model["model-front-cutoff"]),"model-color-use-theme":new wt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new J0(r)}getProgramIds(){return["model"]}is3D(r){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(r){return r instanceof k_?_t-1:0}queryIntersectsFeature(r,e,i,s,a,u){if(!this.modelManager)return!1;const h=this.modelManager,m=r.tile.getBucket(this);if(!(m&&m instanceof J0))return!1;for(const g in m.instancesPerModel){const v=m.instancesPerModel[g],w=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(v.idToFeaturesIndex.hasOwnProperty(w)){const S=v.features[v.idToFeaturesIndex[w]],A=h.getModel(g,this.scope);if(!A)return!1;let D=Pe();const R=new V(0,0),O=m.canonical;let $=Number.MAX_VALUE;for(let H=0;H<S.instancedDataCount;++H){const K=16*(S.instancedDataOffset+H),W=v.instancedDataArray.float32,F=[W[K+4],W[K+5],W[K+6]];KT(O,R,W[K],0|W[K+1]),qT(D,A,u,R,S.rotation,S.scale,F,!1,!1,!1),u.projection.name==="globe"&&(D=Y0(D,u));const q=Se([],u.projMatrix,D),Y=r.queryGeometry,ee=jT(Y.isPointQuery()?Y.screenBounds:Y.screenGeometry,u,q,A.aabb);ee!=null&&($=Math.min(ee,$))}return $!==Number.MAX_VALUE&&$}}return!1}_handleOverridablePaintPropertyUpdate(r,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||r!=="model-color"&&r!=="model-color-mix-intensity"&&r!=="model-rotation"&&r!=="model-scale"&&r!=="model-translation"&&r!=="model-emissive-strength")}_isPropertyZoomDependent(r){const e=this._transitionablePaint._values[r];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof Il}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends $n{constructor(r,e,i,s){super(r,{layout:Gw||(Gw=new Nr({"clip-layer-types":new dt(Re.layout_clip["clip-layer-types"]),"clip-layer-scope":new dt(Re.layout_clip["clip-layer-scope"])})),paint:Hw||(Hw=new Nr({}))},e,i,s)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new qw(r)}is3D(r){return!0}}};class Pk{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class Dk{constructor(){this.tasks={},this.taskQueue=[],Qt(["process"],this),this.invoker=new Pk(this.process),this.nextId=0}add(e,i){const s=this.nextId++,a=function({type:u,isSymbolTile:h,zoom:m}){return m=m||0,u==="message"?0:u!=="maybePrepare"||h?u!=="parseTile"||h?u==="parseTile"&&h?300-m:u==="maybePrepare"&&h?400-m:500:200-m:100-m}(i);if(a===0){try{e()}finally{}return null}return this.tasks[s]={fn:e,metadata:i,priority:a,id:s},this.taskQueue.push(s),this.invoker.trigger(),{cancel:()=>{delete this.tasks[s]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(s=>!!this.tasks[s]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let a=0;a<this.taskQueue.length;a++){const u=this.tasks[this.taskQueue[a]];u.priority<i&&(i=u.priority,e=a)}if(e===null)return null;const s=this.taskQueue[e];return this.taskQueue.splice(e,1),s}remove(){this.invoker.remove()}}class JT{constructor(e,i,s){this.target=e,this.parent=i,this.mapId=s,this.callbacks={},this.cancelCallbacks={},Qt(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new Dk}send(e,i,s,a,u=!1,h){const m=Math.round(1e18*Math.random()).toString(36).substring(0,10);s&&(s.metadata=h,this.callbacks[m]=s);const g=new Set;return this.target.postMessage({id:m,type:e,hasCallback:!!s,targetMapId:a,mustQueue:u,sourceMapId:this.mapId,data:Xs(i,g)},g),{cancel:()=>{s&&delete this.callbacks[m],this.target.postMessage({id:m,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const s=i.id;if(s&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[s];delete this.cancelCallbacks[s],a&&a.cancel()}else if(i.mustQueue||lr(self)){const a=this.callbacks[s],u=this.scheduler.add(()=>this.processTask(s,i),a&&a.metadata||{type:"message"});u&&(this.cancelCallbacks[s]=u)}else this.processTask(s,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const s=this.callbacks[e];delete this.callbacks[e],s&&(i.error?s(Ys(i.error)):s(null,Ys(i.data)))}else{const s=new Set,a=i.hasCallback?(h,m)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:h?Xs(h):null,data:Xs(m,s)},s)}:()=>{},u=Ys(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,u,a);else if(this.parent.getWorkerSource){const h=i.type.split("."),{source:m,scope:g}=u;this.parent.getWorkerSource(i.sourceMapId,h[0],m,g)[h[1]](u,a)}else a(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Yp={workerUrl:"",workerClass:null,workerParams:void 0};const iv="mapboxgl_preloaded_worker_pool";class nu{constructor(){this.active={}}acquire(e,i=nu.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;)this.workers.push(Yp.workerClass!=null?new Yp.workerClass:new self.Worker(Yp.workerUrl,Yp.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[iv]}numActive(){return Object.keys(this.active).length}}nu.workerCount=2;class Uh{constructor(e,i,s="Worker",a=nu.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=bt();const u=this.workerPool.acquire(this.id,a);for(let h=0;h<u.length;h++){const m=new Uh.Actor(u[h],i,this.id);m.name=`${s} ${h}`,this.actors.push(m)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,s){qe(this.actors,(a,u)=>{a.send(e,i,u)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let Kp,rv;function O_(){return Kp||(Kp=new nu),Kp}Uh.Actor=JT;const nv=new Fi(0,0,0),ov={PATH_RULE_UNSPECIFIED:0,PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},sv={LINE_CAP_UNSPECIFIED:0,LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},F_={LINE_JOIN_UNSPECIFIED:0,LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},Rk={PAINT_ORDER_UNSPECIFIED:0,PAINT_ORDER_FILL_AND_STROKE:1,PAINT_ORDER_STROKE_AND_FILL:2},Jp={PATH_COMMAND_UNSPECIFIED:0,PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},QT={MASK_TYPE_UNSPECIFIED:0,MASK_TYPE_LUMINANCE:1,MASK_TYPE_ALPHA:2};function zk(r,e,i){r===1&&e.icons.push(function(s,a){return function(u){if(u.usvg_tree.height||(u.usvg_tree.height=u.usvg_tree.width),!u.metadata)return u;const{metadata:h}=u;if(h.content_area){const{content_area:m}=h;m.top==null&&(m.top=m.left),m.width==null&&(m.width=u.usvg_tree.width),m.height==null&&(m.height=m.width)}return h.stretch_x&&h.stretch_x.length&&eS(h,"x"),h.stretch_y&&h.stretch_y.length&&eS(h,"y"),u}(s.readFields(Lk,{name:void 0},a))}(i,i.readVarint()+i.pos))}function eS(r,e){const i=[],s=r[`stretch_${e}`];let a=null;for(let u=0;u<s.length;u++)a===null?a=i.length===0?s[0]:i[i.length-1][1]+s[u]:(i.push([a,a+s[u]]),a=null);r[`stretch_${e}_areas`]=i}function Lk(r,e,i){r===1?e.name=i.readString():r===2?e.metadata=function(s,a){return s.readFields(kk,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},a)}(i,i.readVarint()+i.pos):r===3&&(e.usvg_tree=function(s,a){return s.readFields(Bk,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},a)}(i,i.readVarint()+i.pos),e.data="usvg_tree")}function kk(r,e,i){r===1?e.stretch_x=i.readPackedVarint():r===2?e.stretch_y=i.readPackedVarint():r===3?e.content_area=function(s,a){return s.readFields(Ok,{left:0},a)}(i,i.readVarint()+i.pos):r===4&&e.variables.push(function(s,a){return s.readFields(Fk,{name:void 0},a)}(i,i.readVarint()+i.pos))}function Ok(r,e,i){r===1?e.left=i.readVarint():r===2?e.width=i.readVarint():r===3?e.top=i.readVarint():r===4&&(e.height=i.readVarint())}function Fk(r,e,i){r===1?e.name=i.readString():r===2&&(e.rgb_color=j_(i.readVarint()),e.value="rgb_color")}function Bk(r,e,i){r===1?e.width=e.height=i.readVarint():r===2?e.height=i.readVarint():r===3?e.children.push(B_(i,i.readVarint()+i.pos)):r===4?e.linear_gradients.push(function(s,a){return s.readFields(Hk,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},a)}(i,i.readVarint()+i.pos)):r===5?e.radial_gradients.push(function(s,a){return s.readFields(Zk,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},a)}(i,i.readVarint()+i.pos)):r===7?e.clip_paths.push(function(s,a){return s.readFields(Wk,{children:[]},a)}(i,i.readVarint()+i.pos)):r===8&&e.masks.push(function(s,a){const u=s.readFields(Xk,{left:0,width:20,mask_type:QT.MASK_TYPE_LUMINANCE,children:[]},a);return u.height==null&&(u.height=u.width),u.top==null&&(u.top=u.left),u}(i,i.readVarint()+i.pos))}function B_(r,e){return r.readFields(Nk,{},e)}function Nk(r,e,i){r===1?(e.group=function(s,a){return s.readFields(jk,{opacity:255,children:[]},a)}(i,i.readVarint()+i.pos),e.node="group"):r===2&&(e.path=function(s,a){return s.readFields(Uk,{paint_order:1,commands:[],step:1,diffs:[],rule:ov.PATH_RULE_NON_ZERO},a)}(i,i.readVarint()+i.pos),e.node="path")}function jk(r,e,i){r===1?e.transform=N_(i,i.readVarint()+i.pos):r===2?e.opacity=i.readVarint():r===5?e.clip_path_idx=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(B_(i,i.readVarint()+i.pos))}function N_(r,e){return r.readFields(Vk,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function Vk(r,e,i){r===1?e.sx=i.readFloat():r===2?e.ky=i.readFloat():r===3?e.kx=i.readFloat():r===4?e.sy=i.readFloat():r===5?e.tx=i.readFloat():r===6&&(e.ty=i.readFloat())}function Uk(r,e,i){r===1?e.fill=function(s,a){return s.readFields($k,{rgb_color:nv,paint:"rgb_color",opacity:255},a)}(i,i.readVarint()+i.pos):r===2?e.stroke=function(s,a){return s.readFields(Gk,{rgb_color:nv,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},a)}(i,i.readVarint()+i.pos):r===3?e.paint_order=i.readVarint():r===5?i.readPackedVarint(e.commands):r===6?e.step=i.readFloat():r===7?i.readPackedSVarint(e.diffs):r===8&&(e.rule=i.readVarint())}function $k(r,e,i){r===1?(e.rgb_color=j_(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5&&(e.opacity=i.readVarint())}function j_(r){return new Fi((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function Gk(r,e,i){r===1?(e.rgb_color=j_(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5?i.readPackedFloat(e.dasharray):r===6?e.dashoffset=i.readFloat():r===7?e.miterlimit=i.readFloat():r===8?e.opacity=i.readVarint():r===9?e.width=i.readFloat():r===10?e.linecap=i.readVarint():r===11&&(e.linejoin=i.readVarint())}function Hk(r,e,i){r===1?e.transform=N_(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(tS(i,i.readVarint()+i.pos)):r===4?e.x1=i.readFloat():r===5?e.y1=i.readFloat():r===6?e.x2=i.readFloat():r===7&&(e.y2=i.readFloat())}function tS(r,e){return r.readFields(qk,{offset:0,opacity:255,rgb_color:nv},e)}function qk(r,e,i){r===1?e.offset=i.readFloat():r===2?e.opacity=i.readVarint():r===3&&(e.rgb_color=j_(i.readVarint()))}function Zk(r,e,i){r===1?e.transform=N_(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(tS(i,i.readVarint()+i.pos)):r===4?e.cx=i.readFloat():r===5?e.cy=i.readFloat():r===6?e.r=i.readFloat():r===7?e.fx=i.readFloat():r===8?e.fy=i.readFloat():r===9&&(e.fr=i.readFloat())}function Wk(r,e,i){r===1?e.transform=N_(i,i.readVarint()+i.pos):r===2?e.clip_path_idx=i.readVarint():r===3&&e.children.push(B_(i,i.readVarint()+i.pos))}function Xk(r,e,i){r===1?e.left=e.top=i.readFloat():r===2?e.width=e.height=i.readFloat():r===3?e.top=i.readFloat():r===4?e.height=i.readFloat():r===5?e.mask_type=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(B_(i,i.readVarint()+i.pos))}class Yk{static calculate(e={},i=[]){const s=new Map,a=new Map;if(Object.keys(e).length===0)return s;i.forEach(u=>{a.set(u.name,u.rgb_color||new Fi(0,0,0))});for(const[u,h]of Object.entries(e))a.has(u)?s.set(a.get(u).toStringPremultipliedAlpha(),h):console.warn(`Ignoring unknown image variable "${u}"`);return s}}function $h(r,e=255,i){const s=e/255,a=r.toStringPremultipliedAlpha(),u=i.has(a)?i.get(a).clone():r.clone();return u.a*=s,u.toString()}function Qp(r,e){if(!gd()){const i=document.createElement("canvas");return i.width=r,i.height=e,i}return new OffscreenCanvas(r,e)}function Kk(r,e){const i=Yk.calculate(e.params,r.metadata?r.metadata.variables:[]),s=r.usvg_tree,a=s.width,u=s.height,h=e.transform?e.transform:new DOMMatrix,m=Math.max(1,Math.round(a*h.a)),g=Math.max(1,Math.round(u*h.d)),v=new DOMMatrix([m/a,0,0,g/u,0,0]),w=Qp(m,g).getContext("2d");return av(w,v,s,s,i),w.getImageData(0,0,m,g)}function av(r,e,i,s,a){for(const u of s.children)iS(r,e,i,u,a)}function iS(r,e,i,s,a){s.group?(r.save(),function(u,h,m,g,v){const w=g.mask_idx!=null?m.masks[g.mask_idx]:null,S=g.clip_path_idx!=null?m.clip_paths[g.clip_path_idx]:null;if(g.transform&&(h=V_(g.transform).preMultiplySelf(h)),!function(R,O,$){return R.opacity!==255||O||$}(g,S!=null,w!=null))return void av(u,h,m,g,v);const A=Qp(u.canvas.width,u.canvas.height),D=A.getContext("2d");av(D,h,m,g,v),S&&cS(D,h,m,S),w&&uS(D,h,m,w,v),u.globalAlpha=g.opacity/255,u.drawImage(A,0,0)}(r,e,i,s.group,a),r.restore()):s.path&&(r.save(),function(u,h,m,g,v){const w=hS(g);u.setTransform(h),g.paint_order===Rk.PAINT_ORDER_FILL_AND_STROKE?(rS(u,m,g,w,v),oS(u,m,g,w,v)):(oS(u,m,g,w,v),rS(u,m,g,w,v))}(r,e,i,s.path,a),r.restore())}function rS(r,e,i,s,a){const u=i.fill;if(!u)return;const h=u.opacity/255;switch(u.paint){case"rgb_color":r.fillStyle=$h(u.rgb_color,u.opacity,a);break;case"linear_gradient_idx":r.fillStyle=sS(r,e.linear_gradients[u.linear_gradient_idx],h,a);break;case"radial_gradient_idx":r.fillStyle=aS(r,e.radial_gradients[u.radial_gradient_idx],h,a)}r.fill(s,nS(i))}function nS(r){return r.rule===ov.PATH_RULE_NON_ZERO?"nonzero":r.rule===ov.PATH_RULE_EVEN_ODD?"evenodd":void 0}function oS(r,e,i,s,a){const u=i.stroke;if(!u)return;r.lineWidth=u.width,r.miterLimit=u.miterlimit,r.setLineDash(u.dasharray),r.lineDashOffset=u.dashoffset;const h=u.opacity/255;switch(u.paint){case"rgb_color":r.strokeStyle=$h(u.rgb_color,u.opacity,a);break;case"linear_gradient_idx":r.strokeStyle=sS(r,e.linear_gradients[u.linear_gradient_idx],h,a);break;case"radial_gradient_idx":r.strokeStyle=aS(r,e.radial_gradients[u.radial_gradient_idx],h,a)}switch(u.linejoin){case F_.LINE_JOIN_MITER_CLIP:case F_.LINE_JOIN_MITER:r.lineJoin="miter";break;case F_.LINE_JOIN_ROUND:r.lineJoin="round";break;case F_.LINE_JOIN_BEVEL:r.lineJoin="bevel"}switch(u.linecap){case sv.LINE_CAP_BUTT:r.lineCap="butt";break;case sv.LINE_CAP_ROUND:r.lineCap="round";break;case sv.LINE_CAP_SQUARE:r.lineCap="square"}r.stroke(s)}function sS(r,e,i,s){if(e.stops.length===1){const A=e.stops[0];return $h(A.rgb_color,A.opacity*i,s)}const a=V_(e.transform),{x1:u,y1:h,x2:m,y2:g}=e,v=a.transformPoint(new DOMPoint(u,h)),w=a.transformPoint(new DOMPoint(m,g)),S=r.createLinearGradient(v.x,v.y,w.x,w.y);for(const A of e.stops)S.addColorStop(A.offset,$h(A.rgb_color,A.opacity*i,s));return S}function aS(r,e,i,s){if(e.stops.length===1){const A=e.stops[0];return $h(A.rgb_color,A.opacity*i,s)}const a=V_(e.transform),{fx:u,fy:h,cx:m,cy:g}=e,v=a.transformPoint(new DOMPoint(u,h)),w=a.transformPoint(new DOMPoint(m,g)),S=r.createRadialGradient(v.x,v.y,0,w.x,w.y,e.r*((a.a+a.d)/2));for(const A of e.stops)S.addColorStop(A.offset,$h(A.rgb_color,A.opacity*i,s));return S}function lS(r,e,i,s){const a=s.transform?V_(s.transform).preMultiplySelf(e):e,u=Qp(r.canvas.width,r.canvas.height),h=u.getContext("2d");for(const g of s.children)if(g.group)lS(h,a,i,g.group);else if(g.path){const v=g.path,w=new Path2D;w.addPath(hS(v),a),h.fill(w,nS(v))}const m=s.clip_path_idx!=null?i.clip_paths[s.clip_path_idx]:null;m&&cS(h,a,i,m),r.globalCompositeOperation="source-over",r.drawImage(u,0,0)}function cS(r,e,i,s){const a=Qp(r.canvas.width,r.canvas.height);lS(a.getContext("2d"),e,i,s),r.globalCompositeOperation="destination-in",r.drawImage(a,0,0)}function uS(r,e,i,s,a){if(s.children.length===0)return;const u=s.mask_idx!=null?i.masks[s.mask_idx]:null;u&&uS(r,e,i,u,a);const h=r.canvas.width,m=r.canvas.height,g=Qp(h,m),v=g.getContext("2d"),w=s.width,S=s.height,A=s.left,D=s.top,R=new Path2D,O=new Path2D;O.rect(A,D,w,S),R.addPath(O,e),v.clip(R);for(const K of s.children)iS(v,e,i,K,a);const $=v.getImageData(0,0,h,m),H=$.data;if(s.mask_type===QT.MASK_TYPE_LUMINANCE)for(let K=0;K<H.length;K+=4)H[K+3]=H[K+3]/255*(.2126*H[K]+.7152*H[K+1]+.0722*H[K+2]);v.putImageData($,0,0),r.globalCompositeOperation="destination-in",r.drawImage(g,0,0)}function V_(r){return r?new DOMMatrix([r.sx,r.ky,r.kx,r.sy,r.tx,r.ty]):new DOMMatrix}function hS(r){const e=new Path2D,i=r.step;let s=r.diffs[0]*i,a=r.diffs[1]*i;e.moveTo(s,a);for(let u=0,h=2;u<r.commands.length;u++)switch(r.commands[u]){case Jp.PATH_COMMAND_MOVE:s+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.moveTo(s,a);break;case Jp.PATH_COMMAND_LINE:s+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.lineTo(s,a);break;case Jp.PATH_COMMAND_QUAD:{const m=s+r.diffs[h++]*i,g=a+r.diffs[h++]*i;s=m+r.diffs[h++]*i,a=g+r.diffs[h++]*i,e.quadraticCurveTo(m,g,s,a);break}case Jp.PATH_COMMAND_CUBIC:{const m=s+r.diffs[h++]*i,g=a+r.diffs[h++]*i,v=m+r.diffs[h++]*i,w=g+r.diffs[h++]*i;s=v+r.diffs[h++]*i,a=w+r.diffs[h++]*i,e.bezierCurveTo(m,g,v,w,s,a);break}case Jp.PATH_COMMAND_CLOSE:e.closePath()}return e}class U_{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}delete(e){this.cache.delete(e)}}Tt(U_,"LRUCache");class lv{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new In(e,e.data)}getFromCache(e,i,s){return this.cacheMap.has(s)||this.cacheMap.set(s,new U_(150)),this.cacheMap.get(s).get(Va(e.toString(),i))}setInCache(e,i,s,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new U_(150));const u=this.cacheDependenciesMap.get(a),h=Va(e.id.toString(),s);u.get(h)||u.set(h,new Set);const m=this.cacheMap.get(a),g=e.toString();u.get(h).add(g),m.put(Va(e.toString(),s),i)}removeImagesFromCacheByIds(e,i,s=0){if(!this.cacheMap.has(s)||!this.cacheDependenciesMap.has(s))return;const a=this.cacheMap.get(s),u=this.cacheDependenciesMap.get(s);for(const h of e){const m=Va(h.toString(),i);if(u.has(m)){for(const g of u.get(m))a.delete(g);u.delete(m)}}}rasterize(e,i,s,a,u=Kk){const h=this.getFromCache(e,s,a);if(h)return h.clone();const m=u(i.icon,e.options),g=lv._getImage(m);return this.setInCache(e,g,s,a),g.clone()}}class dS{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const s=this.toIdx(e,i);return{min:this.minimums[s],max:this.maximums[s]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function pS(r,e,i,s){let a=0,u=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(s[h])<1e-15){if(i[h]<r[h]||i[h]>e[h])return null}else{const m=1/s[h];let g=(r[h]-i[h])*m,v=(e[h]-i[h])*m;if(g>v){const w=g;g=v,v=w}if(g>a&&(a=g),v<u&&(u=v),a>u)return null}return a}function fS(r,e,i,s,a,u,h,m,g,v,w){const S=s-r,A=a-e,D=u-i,R=h-r,O=m-e,$=g-i,H=w[1]*$-w[2]*O,K=w[2]*R-w[0]*$,W=w[0]*O-w[1]*R,F=S*H+A*K+D*W;if(Math.abs(F)<1e-15)return null;const q=1/F,Y=v[0]-r,ee=v[1]-e,he=v[2]-i,ye=(Y*H+ee*K+he*W)*q;if(ye<0||ye>1)return null;const ve=ee*D-he*A,Ce=he*S-Y*D,Ue=Y*A-ee*S,et=(w[0]*ve+w[1]*Ce+w[2]*Ue)*q;return et<0||ye+et>1?null:(R*ve+O*Ce+$*Ue)*q}function mS(r,e,i){return(r-e)/(i-e)}function _S(r,e,i,s,a,u,h,m,g){const v=1<<i,w=u-s,S=h-a,A=(r+1)/v*w+s,D=(e+0)/v*S+a,R=(e+1)/v*S+a;m[0]=(r+0)/v*w+s,m[1]=D,g[0]=A,g[1]=R}class gS{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(u){const h=Math.ceil(Math.log2(u.dim/8)),m=[];let g=Math.ceil(Math.pow(2,h));const v=1/g,w=(D,R,O,$,H)=>{const K=$?1:0,W=(D+1)*O-K,F=R*O,q=(R+1)*O-K;H[0]=D*O,H[1]=F,H[2]=W,H[3]=q};let S=new dS(g);const A=[];for(let D=0;D<g*g;D++){w(D%g,Math.floor(D/g),v,!1,A);const R=Xl(A[0],A[1],u),O=Xl(A[2],A[1],u),$=Xl(A[2],A[3],u),H=Xl(A[0],A[3],u);S.minimums.push(Math.min(R,O,$,H)),S.maximums.push(Math.max(R,O,$,H)),S.leaves.push(1)}for(m.push(S),g/=2;g>=1;g/=2){const D=m[m.length-1];S=new dS(g);for(let R=0;R<g*g;R++){w(R%g,Math.floor(R/g),2,!0,A);const O=D.getElevation(A[0],A[1]),$=D.getElevation(A[2],A[1]),H=D.getElevation(A[2],A[3]),K=D.getElevation(A[0],A[3]),W=D.isLeaf(A[0],A[1]),F=D.isLeaf(A[2],A[1]),q=D.isLeaf(A[2],A[3]),Y=D.isLeaf(A[0],A[3]),ee=Math.min(O.min,$.min,H.min,K.min),he=Math.max(O.max,$.max,H.max,K.max),ye=W&&F&&q&&Y;S.maximums.push(he),S.minimums.push(ee),S.leaves.push(he-ee<=5&&ye?1:0)}m.push(S)}return m}(this.dem),s=i.length-1,a=i[s];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,s,0)}raycastRoot(e,i,s,a,u,h,m=1){return pS([e,i,-100],[s,a,this.maximums[0]*m],u,h)}raycast(e,i,s,a,u,h,m=1){if(!this.nodeCount)return null;const g=this.raycastRoot(e,i,s,a,u,h,m);if(g==null)return null;const v=[],w=[],S=[],A=[],D=[{idx:0,t:g,nodex:0,nodey:0,depth:0}];for(;D.length>0;){const{idx:R,t:O,nodex:$,nodey:H,depth:K}=D.pop();if(this.leaves[R]){_S($,H,K,e,i,s,a,S,A);const F=1<<K,q=($+0)/F,Y=($+1)/F,ee=(H+0)/F,he=(H+1)/F,ye=Xl(q,ee,this.dem)*m,ve=Xl(Y,ee,this.dem)*m,Ce=Xl(Y,he,this.dem)*m,Ue=Xl(q,he,this.dem)*m,et=fS(S[0],S[1],ye,A[0],S[1],ve,A[0],A[1],Ce,u,h),Ye=fS(A[0],A[1],Ce,S[0],A[1],Ue,S[0],S[1],ye,u,h),Qe=Math.min(et!==null?et:Number.MAX_VALUE,Ye!==null?Ye:Number.MAX_VALUE);if(Qe!==Number.MAX_VALUE)return Qe;{const ot=$r([],u,h,O);if(yS(ye,ve,Ue,Ce,mS(ot[0],S[0],A[0]),mS(ot[1],S[1],A[1]))>=ot[2])return O}continue}let W=0;for(let F=0;F<this._siblingOffset.length;F++){_S(($<<1)+this._siblingOffset[F][0],(H<<1)+this._siblingOffset[F][1],K+1,e,i,s,a,S,A),S[2]=-100,A[2]=this.maximums[this.childOffsets[R]+F]*m;const q=pS(S,A,u,h);if(q!=null){const Y=q;v[F]=Y;let ee=!1;for(let he=0;he<W&&!ee;he++)Y>=v[w[he]]&&(w.splice(he,0,F),ee=!0);ee||(w[W]=F),W++}}for(let F=0;F<W;F++){const q=w[F];D.push({idx:this.childOffsets[R]+q,t:v[q],nodex:($<<1)+this._siblingOffset[q][0],nodey:(H<<1)+this._siblingOffset[q][1],depth:K+1})}}return null}_addNode(e,i,s){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(s),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,s,a,u){if(e[a].isLeaf(i,s)===1)return;this.childOffsets[u]||(this.childOffsets[u]=this.nodeCount);const h=a-1,m=e[h];let g=0,v=0;for(let w=0;w<this._siblingOffset.length;w++){const S=2*i+this._siblingOffset[w][0],A=2*s+this._siblingOffset[w][1],D=m.getElevation(S,A),R=m.isLeaf(S,A),O=this._addNode(D.min,D.max,R);R&&(g|=1<<w),v||(v=O)}for(let w=0;w<this._siblingOffset.length;w++)g&1<<w||this._construct(e,2*i+this._siblingOffset[w][0],2*s+this._siblingOffset[w][1],h,v+w)}}function yS(r,e,i,s,a,u){return Nt(Nt(r,i,u),Nt(e,s,u),a)}function Xl(r,e,i){const s=i.dim,a=Te(r*s-.5,0,s-1),u=Te(e*s-.5,0,s-1),h=Math.floor(a),m=Math.floor(u),g=Math.min(h+1,s-1),v=Math.min(m+1,s-1);return yS(i.get(h,m),i.get(g,m),i.get(h,v),i.get(g,v),a-h,u-m)}const Jk={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function Qk(r,e,i){return(256*r*256+256*e+i)/10-1e4}function eO(r,e,i){return 256*r+e+i/256-32768}class $_{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,s,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&s!=="mapbox"&&s!=="terrarium")return void yi(`"${s}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const u=this.dim=i.height-2,h=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let g=0;g<u;g++)h[this._idx(-1,g)]=h[this._idx(0,g)],h[this._idx(u,g)]=h[this._idx(u-1,g)],h[this._idx(g,-1)]=h[this._idx(g,0)],h[this._idx(g,u)]=h[this._idx(g,u-1)];h[this._idx(-1,-1)]=h[this._idx(0,0)],h[this._idx(u,-1)]=h[this._idx(u-1,0)],h[this._idx(-1,u)]=h[this._idx(0,u-1)],h[this._idx(u,u)]=h[this._idx(u-1,u-1)]}const m=s==="terrarium"?eO:Qk;for(let g=0;g<h.length;++g){const v=4*g;this.floatView[g]=m(this.pixels[v],this.pixels[v+1],this.pixels[v+2])}this._timestamp=Io.now()}_buildQuadTree(){this._tree=new gS(this)}get(e,i,s=!1){s&&(e=Te(e,-1,this.dim),i=Te(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,s){const a=this._idx(e,i),u=this.floatView[a];return this.floatView[a]=s,s-u}static getUnpackVector(e){return Jk[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const s=[0,0,0,0],a=$_.getUnpackVector(i);let u=Math.floor((e+a[3])/a[2]);return s[2]=u%256,u=Math.floor(u/256),s[1]=u%256,u=Math.floor(u/256),s[0]=u,s}getPixels(){return new vw({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,u=i*this.dim+this.dim,h=s*this.dim,m=s*this.dim+this.dim;switch(i){case-1:a=u-1;break;case 1:u=a+1}switch(s){case-1:h=m-1;break;case 1:m=h+1}const g=-i*this.dim,v=-s*this.dim;for(let w=h;w<m;w++)for(let S=a;S<u;S++){const A=4*this._idx(S,w),D=4*this._idx(S+g,w+v);this.pixels[A+0]=e.pixels[D+0],this.pixels[A+1]=e.pixels[D+1],this.pixels[A+2]=e.pixels[D+2],this.pixels[A+3]=e.pixels[D+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function tO(r,e,i){r===1?e.headerLength=i.readFixed32():r===2?e.x=i.readVarint():r===3?e.y=i.readVarint():r===4?e.z=i.readVarint():r===5&&e.layers.push(function(s,a){return s.readFields(sO,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)}(i,i.readVarint()+i.pos))}function iO(r,e,i){r===1?(e.delta_filter=function(s,a){return s.readFields(rO,{blockSize:0},a)}(i,i.readVarint()+i.pos),e.filter="delta_filter"):r===2?(i.readVarint(),e.filter="zigzag_filter"):r===3?(i.readVarint(),e.filter="bitshuffle_filter"):r===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function rO(r,e,i){r===1&&(e.blockSize=i.readVarint())}function nO(r,e,i){r===1?(i.readVarint(),e.codec="gzip_data"):r===2?(i.readVarint(),e.codec="jpeg_image"):r===3?(i.readVarint(),e.codec="webp_image"):r===4&&(i.readVarint(),e.codec="png_image")}function oO(r,e,i){let s=0,a=0;r===1?e.firstByte=i.readFixed64():r===2?e.lastByte=i.readFixed64():r===3?e.filters.push(function(u,h){return u.readFields(iO,{},h)}(i,i.readVarint()+i.pos)):r===4?e.codec=function(u,h){return u.readFields(nO,{},h)}(i,i.readVarint()+i.pos):r===5?a=i.readFloat():r===6?s=i.readFloat():r===7?e.bands.push(i.readString()):r===8?e.offset=i.readDouble():r===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=a),e.scale===0&&(e.scale=s)}function sO(r,e,i){r===1?e.version=i.readVarint():r===2?e.name=i.readString():r===3?e.units=i.readString():r===4?e.tileSize=i.readVarint():r===5?e.buffer=i.readVarint():r===6?e.pixelFormat=i.readVarint():r===7&&e.dataIndex.push(function(s,a){return s.readFields(oO,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)}(i,i.readVarint()+i.pos))}function aO(r,e,i){if(r===2)(function(s,a,u){s.readFields(lO,u,a)})(i,i.readVarint()+i.pos,e);else if(r===3)throw new Error("Not implemented")}function lO(r,e,i){if(r===1){let s=0;const a=i.readVarint()+i.pos;for(;i.pos<a;)e[s++]=i.readVarint()}}function cO(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let s=2;s>=1;s--){const a=s===1?1:0,u=s===2?1:0;for(let h=0;h<e[0];h++){const m=e[1]*h;for(let g=a;g<e[1];g++){const v=e[2]*(g+m);for(let w=u;w<e[2];w++){const S=e[3]*(w+v);for(let A=0;A<e[3];A++){const D=S+A;r[D]+=r[D-i]}}}}i*=e[s]}return r}function uO(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function hO(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const s=r[i],a=r[i+1];r[i]=(240&s)>>4|(61440&s)>>8|(240&a)<<4|61440&a,r[i+1]=15&s|(3840&s)>>4|(15&a)<<8|(3840&a)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const s=r[i],a=r[i+1],u=r[i+2],h=r[i+3];r[i+0]=(192&s)>>6|(192&a)>>4|(192&u)>>2|192&h,r[i+1]=(48&s)>>4|(48&a)>>2|48&u|(48&h)<<2,r[i+2]=(12&s)>>2|12&a|(12&u)<<2|(12&h)<<4,r[i+3]=3&s|(3&a)<<2|(3&u)<<4|(3&h)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}Tt($_,"DEMData"),Tt(gS,"DemMinMaxQuadTree",{omit:["dem"]});var Bo=Uint8Array,ef=Uint16Array,dO=Int32Array,vS=new Bo([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),xS=new Bo([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pO=new Bo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bS=function(r,e){for(var i=new ef(31),s=0;s<31;++s)i[s]=e+=1<<r[s-1];var a=new dO(i[30]);for(s=1;s<30;++s)for(var u=i[s];u<i[s+1];++u)a[u]=u-i[s]<<5|s;return{b:i,r:a}},wS=bS(vS,2),TS=wS.b,fO=wS.r;TS[28]=258,fO[258]=28;for(var mO=bS(xS,0).b,SS=new ef(32768),cn=0;cn<32768;++cn){var Gh=(43690&cn)>>1|(21845&cn)<<1;SS[cn]=((65280&(Gh=(61680&(Gh=(52428&Gh)>>2|(13107&Gh)<<2))>>4|(3855&Gh)<<4))>>8|(255&Gh)<<8)>>1}var tf=function(r,e,i){for(var s=r.length,a=0,u=new ef(e);a<s;++a)r[a]&&++u[r[a]-1];var h,m=new ef(e);for(a=1;a<e;++a)m[a]=m[a-1]+u[a-1]<<1;h=new ef(1<<e);var g=15-e;for(a=0;a<s;++a)if(r[a])for(var v=a<<4|r[a],w=e-r[a],S=m[r[a]-1]++<<w,A=S|(1<<w)-1;S<=A;++S)h[SS[S]>>g]=v;return h},rf=new Bo(288);for(cn=0;cn<144;++cn)rf[cn]=8;for(cn=144;cn<256;++cn)rf[cn]=9;for(cn=256;cn<280;++cn)rf[cn]=7;for(cn=280;cn<288;++cn)rf[cn]=8;var ES=new Bo(32);for(cn=0;cn<32;++cn)ES[cn]=5;var _O=tf(rf,9),gO=tf(ES,5),cv=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},Es=function(r,e,i){var s=e/8|0;return(r[s]|r[s+1]<<8)>>(7&e)&i},uv=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)},yO=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],As=function(r,e,i){var s=new Error(e||yO[r]);if(s.code=r,Error.captureStackTrace&&Error.captureStackTrace(s,As),!i)throw s;return s},vO=new Bo(0),xO=typeof TextDecoder<"u"&&new TextDecoder;try{xO.decode(vO,{stream:!0})}catch{}const bO={gzip_data:"gzip"};class ts extends Error{constructor(e){super(e),this.name="MRTError"}}const wO={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},AS={uint32:1,uint16:2,uint8:4},TO={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let hv;class G_{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new ts(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),s=new DataView(e);if(i[0]!==13)throw new ts("File is not a valid MRT.");return s.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),s=this.getHeaderLength(e);if(i.length<s)throw new ts(`Expected header with length >= ${s} but got buffer of length ${i.length}`);const a=function(u,h){return u.readFields(tO,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0)}(new hv(i.subarray(0,s)));if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new ts(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=a.x,this.y=a.y,this.z=a.z;for(const u of a.layers)this.layers[u.name]=new IS(u,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],s=this.getLayer(e.layerName);for(let a of e.blockIndices){const u=s.dataIndex[a],h=u.firstByte-e.firstByte,m=u.lastByte-e.firstByte;if(s._blocksInProgress.has(a))continue;const g={layerName:s.name,firstByte:h,lastByte:m,pixelFormat:s.pixelFormat,blockIndex:a,blockShape:[u.bands.length].concat(s.bandShape),buffer:s.buffer,codec:u.codec.codec,filters:u.filters.map(v=>v.filter)};s._blocksInProgress.add(a),i.push(g)}return new CS(i,()=>{i.forEach(a=>s._blocksInProgress.delete(a.blockIndex))},(a,u)=>{if(i.forEach(h=>s._blocksInProgress.delete(h.blockIndex)),a)throw a;u.forEach(h=>{this.getLayer(h.layerName).processDecodedData(h)})})}}class IS{constructor({version:e,name:i,units:s,tileSize:a,pixelFormat:u,buffer:h,dataIndex:m},g){if(this.version=e,this.version!==1)throw new ts(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=s,this.tileSize=a,this.buffer=h,this.pixelFormat=wO[u],this.dataIndex=m,this.bandShape=[a+2*h,a+2*h,AS[this.pixelFormat]],this._decodedBlocks=new U_(g?g.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return AS[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[s,a]of this.dataIndex.entries()){for(const[u,h]of a.bands.entries())if(h===e)return{bandIndex:i+u,blockIndex:s,blockBandIndex:u};i+=a.bands.length}break;case"number":for(const[s,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:s,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new ts(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,s=-1/0;const a=[],u=new Set;for(const h of e){const{blockIndex:m}=this.getBlockForBand(h);if(m<0)throw new ts(`Invalid band: ${JSON.stringify(h)}`);const g=this.dataIndex[m];a.includes(m)||a.push(m),u.add(m),i=Math.min(i,g.firstByte),s=Math.max(s,g.lastByte)}if(u.size>this.cacheSize)throw new ts(`Number of blocks to decode (${u.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:s,blockIndices:a}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:s}=this.getBlockForBand(e);if(i<0)throw new ts(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new ts(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const u=this.dataIndex[i],h=this.bandShape.reduce((v,w)=>v*w,1),m=s*h,g=a.subarray(m,m+h);return{data:g,bytes:new Uint8Array(g.buffer).subarray(g.byteOffset,g.byteOffset+g.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:u.offset,scale:u.scale}}}G_.setPbf=function(r){hv=r};class CS{constructor(e,i,s){this.tasks=e,this._onCancel=i,this._onComplete=s,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}G_.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map(s=>{const{layerName:a,firstByte:u,lastByte:h,pixelFormat:m,blockShape:g,blockIndex:v,filters:w,codec:S}=s,A=i.subarray(u,h+1),D=new Uint32Array(g[0]*g[1]*g[2]);let R;if(S!=="gzip_data")throw new ts(`Unhandled codec: ${S}`);return R=function(O,$){if(!globalThis.DecompressionStream&&$==="gzip_data")return Promise.resolve(((F=function(ee){ee[0]==31&&ee[1]==139&&ee[2]==8||As(6,"invalid gzip data");var he=ee[3],ye=10;4&he&&(ye+=2+(ee[10]|ee[11]<<8));for(var ve=(he>>3&1)+(he>>4&1);ve>0;ve-=!ee[ye++]);return ye+(2&he)}(W=O))+8>W.length&&As(6,"invalid gzip data"),function(ee,he,ye,ve){var Ce=ee.length;if(!Ce||he.f&&!he.l)return ye||new Bo(0);var Ue=!ye,et=Ue||he.i!=2,Ye=he.i;Ue&&(ye=new Bo(3*Ce));var Qe,ot,je=function(Vr){var fr=ye.length;if(Vr>fr){var ar=new Bo(Math.max(2*fr,Vr));ar.set(ye),ye=ar}},Je=he.f||0,Fe=he.p||0,Ve=he.b||0,lt=he.l,ut=he.d,zt=he.m,Et=he.n,gt=8*Ce;do{if(!lt){Je=Es(ee,Fe,1);var at=Es(ee,Fe+1,3);if(Fe+=3,!at){var Xt=ee[(J=4+((Fe+7)/8|0))-4]|ee[J-3]<<8,Mt=J+Xt;if(Mt>Ce){Ye&&As(0);break}et&&je(Ve+Xt),ye.set(ee.subarray(J,Mt),Ve),he.b=Ve+=Xt,he.p=Fe=8*Mt,he.f=Je;continue}if(at==1)lt=_O,ut=gO,zt=9,Et=5;else if(at==2){var Pt=Es(ee,Fe,31)+257,Ht=Es(ee,Fe+10,15)+4,ii=Pt+Es(ee,Fe+5,31)+1;Fe+=14;for(var oi=new Bo(ii),fi=new Bo(19),ci=0;ci<Ht;++ci)fi[pO[ci]]=Es(ee,Fe+3*ci,7);Fe+=3*Ht;var ai=cv(fi),tr=(1<<ai)-1,ur=tf(fi,ai);for(ci=0;ci<ii;){var J,te=ur[Es(ee,Fe,tr)];if(Fe+=15&te,(J=te>>4)<16)oi[ci++]=J;else{var Ge=0,pt=0;for(J==16?(pt=3+Es(ee,Fe,3),Fe+=2,Ge=oi[ci-1]):J==17?(pt=3+Es(ee,Fe,7),Fe+=3):J==18&&(pt=11+Es(ee,Fe,127),Fe+=7);pt--;)oi[ci++]=Ge}}var vt=oi.subarray(0,Pt),yt=oi.subarray(Pt);zt=cv(vt),Et=cv(yt),lt=tf(vt,zt),ut=tf(yt,Et)}else As(1);if(Fe>gt){Ye&&As(0);break}}et&&je(Ve+131072);for(var Dt=(1<<zt)-1,Gt=(1<<Et)-1,wi=Fe;;wi=Fe){var Ti=(Ge=lt[uv(ee,Fe)&Dt])>>4;if((Fe+=15&Ge)>gt){Ye&&As(0);break}if(Ge||As(2),Ti<256)ye[Ve++]=Ti;else{if(Ti==256){wi=Fe,lt=null;break}var li=Ti-254;Ti>264&&(li=Es(ee,Fe,(1<<(Si=vS[ci=Ti-257]))-1)+TS[ci],Fe+=Si);var Hi=ut[uv(ee,Fe)&Gt],sr=Hi>>4;if(Hi||As(3),Fe+=15&Hi,yt=mO[sr],sr>3){var Si=xS[sr];yt+=uv(ee,Fe)&(1<<Si)-1,Fe+=Si}if(Fe>gt){Ye&&As(0);break}et&&je(Ve+131072);var Mr=Ve+li;if(Ve<yt){var hr=0-yt,Vi=Math.min(yt,Mr);for(hr+Ve<0&&As(3);Ve<Vi;++Ve)ye[Ve]=(void 0)[hr+Ve]}for(;Ve<Mr;++Ve)ye[Ve]=ye[Ve-yt]}}he.l=lt,he.p=wi,he.b=Ve,he.f=Je,lt&&(Je=1,he.m=zt,he.d=ut,he.n=Et)}while(!Je);return Ve!=ye.length&&Ue?(Qe=ye,((ot=Ve)==null||ot>Qe.length)&&(ot=Qe.length),new Bo(Qe.subarray(0,ot))):ye.subarray(0,Ve)}(W.subarray(F,-8),{i:2},new Bo(((H=W)[(K=H.length)-4]|H[K-3]<<8|H[K-2]<<16|H[K-1]<<24)>>>0))));var H,K,W,F;const q=bO[$];if(!q)throw new Error(`Unhandled codec: ${$}`);const Y=new globalThis.DecompressionStream(q);return new Response(new Blob([O]).stream().pipeThrough(Y)).arrayBuffer().then(ee=>new Uint8Array(ee))}(A,S).then(O=>(function($,H){$.readFields(aO,H)}(new hv(O),D),new TO[m](D.buffer))),R.then(O=>{for(let $=w.length-1;$>=0;$--)switch(w[$]){case"delta_filter":cO(O,g);break;case"zigzag_filter":uO(O);break;case"bitshuffle_filter":hO(O,m);break;default:throw new ts(`Unhandled filter "${w[$]}"`)}return{layerName:a,blockIndex:v,data:O}}).catch(O=>{throw O})}))},Tt(CS,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Tt(G_,"MapboxRasterTile"),Tt(IS,"MapboxRasterLayer",{omit:["_blocksInProgress"]});let nf,dv,Is,Hh,pv,qh=null;function MS(){return lr(self)&&self.worker.dracoUrl?self.worker.dracoUrl:dv||An.DRACO_URL}function PS(){if(lr(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Hh)return Hh;const r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return Hh=WebAssembly.validate(r)?An.MESHOPT_SIMD_URL:An.MESHOPT_URL,Hh}const H_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},SO={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},of={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function DS(r,e,i){const s=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=s,i.json.bufferViews[s]={buffer:a,byteLength:r.byteLength},i.buffers[a]=r}const fv="KHR_draco_mesh_compression";function EO(r,e){const i=r.extensions&&r.extensions[fv];if(!i)return;const s=new Is.Decoder,a=kS(e,i.bufferView),u=new Is.Mesh;if(!s.DecodeArrayToMesh(a,a.byteLength,u))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[r.indices],m=H_[h.componentType],g=h.count*m.BYTES_PER_ELEMENT,v=Is._malloc(g);m===Uint16Array?s.GetTrianglesUInt16Array(u,g,v):s.GetTrianglesUInt32Array(u,g,v),DS(Is.memory.buffer.slice(v,v+g),h,e),Is._free(v);for(const w of Object.keys(i.attributes)){const S=s.GetAttributeByUniqueId(u,i.attributes[w]),A=e.json.accessors[r.attributes[w]],D=SO[A.componentType],R=A.count*of[A.type]*H_[A.componentType].BYTES_PER_ELEMENT,O=Is._malloc(R);s.GetAttributeDataArrayForAllPoints(u,S,Is[D],R,O),DS(Is.memory.buffer.slice(O,O+R),A,e),Is._free(O)}s.destroy(),u.destroy(),delete r.extensions[fv]}const q_="EXT_meshopt_compression";function AO(r,e){if(!r.extensions||!r.extensions[q_])return;const i=r.extensions[q_],s=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);pv.decodeGltfBuffer(a,i.count,i.byteStride,s,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=a.buffer,delete r.extensions[q_]}const RS=1179937895,zS=new TextDecoder("utf8");function LS(r,e){return new URL(r,e).href}function IO(r,e,i,s){return fetch(LS(r.uri,s)).then(a=>a.arrayBuffer()).then(a=>{e.buffers[i]=a})}function kS(r,e){const i=r.json.bufferViews[e];return new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function CO(r,e,i,s){if(r.uri){const a=LS(r.uri,s);return fetch(a).then(u=>u.blob()).then(u=>createImageBitmap(u)).then(u=>{e.images[i]=u})}if(r.bufferView!==void 0){const a=kS(e,r.bufferView),u=new Blob([a],{type:r.mimeType});return createImageBitmap(u).then(h=>{e.images[i]=h})}}function OS(r,e=0,i){const s={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===RS){const w=new Uint32Array(r,e);let S=2;const A=(w[S++]>>2)-3,D=w[S++]>>2;if(S++,s.json=JSON.parse(zS.decode(w.subarray(S,S+D))),S+=D,S<A){const R=w[S++];S++;const O=e+(S<<2);s.buffers[0]=r.slice(O,O+R)}}else s.json=JSON.parse(zS.decode(new Uint8Array(r,e)));const{buffers:a,images:u,meshes:h,extensionsUsed:m,bufferViews:g}=s.json;let v=Promise.resolve();if(a){const w=[];for(let S=0;S<a.length;S++){const A=a[S];A.uri?w.push(IO(A,s,S,i)):s.buffers[S]||(s.buffers[S]=null)}v=Promise.all(w)}return v.then(()=>{const w=[],S=m&&m.includes(fv),A=m&&m.includes(q_);if(S&&w.push(function(){if(!Is)return nf??(nf=function(D){let R,O=null;function $(){R=new Uint8Array(O.buffer)}function H(){throw new Error("Unexpected Draco error.")}const K={a:{a:H,d:function(W,F,q){return R.copyWithin(W,F,F+q)},c:function(W){const F=R.length,q=Math.max(W>>>0,Math.ceil(1.2*F)),Y=Math.ceil((q-F)/65536);try{return O.grow(Y),$(),!0}catch{return!1}},b:H}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(D,K):D.then(W=>W.arrayBuffer()).then(W=>WebAssembly.instantiate(W,K))).then(W=>{const{Rb:F,Qb:q,P:Y,T:ee,X:he,Ja:ye,La:ve,Qa:Ce,Va:Ue,Wa:et,eb:Ye,jb:Qe,f:ot,e:je,yb:Je,zb:Fe,Ab:Ve,Bb:lt,Db:ut,Gb:zt}=W.instance.exports;O=je;const Et=(()=>{let gt=0,at=0,Xt=0,Mt=0;return Pt=>{Xt&&(F(Mt),F(gt),at+=Xt,Xt=gt=0),gt||(at+=128,gt=q(at));const Ht=Pt.length+7&-8;let ii=gt;Ht>=at&&(Xt=Ht,ii=Mt=q(Ht));for(let oi=0;oi<Pt.length;oi++)R[ii+oi]=Pt[oi];return ii}})();return $(),ot(),{memory:je,_free:F,_malloc:q,Mesh:class{constructor(){this.ptr=Y()}destroy(){ee(this.ptr)}},Decoder:class{constructor(){this.ptr=ye()}destroy(){Qe(this.ptr)}DecodeArrayToMesh(gt,at,Xt){const Mt=Et(gt),Pt=ve(this.ptr,Mt,at,Xt.ptr);return!!he(Pt)}GetAttributeByUniqueId(gt,at){return{ptr:Ce(this.ptr,gt.ptr,at)}}GetTrianglesUInt16Array(gt,at,Xt){Ue(this.ptr,gt.ptr,at,Xt)}GetTrianglesUInt32Array(gt,at,Xt){et(this.ptr,gt.ptr,at,Xt)}GetAttributeDataArrayForAllPoints(gt,at,Xt,Mt,Pt){Ye(this.ptr,gt.ptr,at.ptr,Xt,Mt,Pt)}},DT_INT8:Je(),DT_UINT8:Fe(),DT_INT16:Ve(),DT_UINT16:lt(),DT_UINT32:ut(),DT_FLOAT32:zt()}})}(fetch(MS())),nf.then(D=>{Is=D,nf=void 0}))}()),A&&w.push(function(){if(pv)return;const D=function(R){let O;const $=WebAssembly.instantiateStreaming(R,{}).then(W=>{O=W.instance,O.exports.__wasm_call_ctors()}),H={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},K={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:$,supported:!0,decodeGltfBuffer(W,F,q,Y,ee,he){(function(ye,ve,Ce,Ue,et,Ye,Qe){const ot=ye.exports.sbrk,je=Ue+3&-4,Je=ot(je*et),Fe=ot(Ye.length),Ve=new Uint8Array(ye.exports.memory.buffer);Ve.set(Ye,Fe);const lt=ve(Je,Ue,et,Fe,Ye.length);if(lt===0&&Qe&&Qe(Je,je,et),Ce.set(Ve.subarray(Je,Je+Ue*et)),ot(Je-ot(0)),lt!==0)throw new Error(`Malformed buffer data: ${lt}`)})(O,O.exports[K[ee]],W,F,q,Y,O.exports[H[he]])}}}(fetch(PS()));return D.ready.then(()=>{pv=D})}()),u)for(let D=0;D<u.length;D++)w.push(CO(u[D],s,D,i));return(w.length?Promise.all(w):Promise.resolve()).then(()=>{if(S&&h)for(const{primitives:D}of h)for(const R of D)EO(R,s);if(A&&h&&g)for(const D of g)AO(D,s);return s})})}function ou(r,e){const i=r.json.bufferViews[e.bufferView],s=H_[e.componentType];return new s(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==of[e.type]*s.BYTES_PER_ELEMENT?i.byteStride/s.BYTES_PER_ELEMENT:of[e.type]))}function mv(r,e,i,s){const a=H_[e.componentType],u=function(w){switch(w){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(a),h=r.json.bufferViews[e.bufferView],m=h.byteStride?h.byteStride/a.BYTES_PER_ELEMENT:of[e.type],g=i.float32,v=g.length/i.capacity;for(let w=0,S=0;w<e.count*m;w+=m,S+=v)for(let A=0;A<v;A++)g[S+A]=s[w+A]*u;i._trim()}function MO(r,e,i){const s=r.indices,a=r.attributes,u={};u.indexArray=new fn;const h=e.json.accessors[s],m=h.count/3;u.indexArray.reserve(m);const g=ou(e,h);for(let A=0;A<m;A++)u.indexArray.emplaceBack(g[3*A],g[3*A+1],g[3*A+2]);u.indexArray._trim(),u.vertexArray=new Yo;const v=e.json.accessors[a.POSITION];u.vertexArray.reserve(v.count);const w=ou(e,v);for(let A=0;A<v.count;A++)u.vertexArray.emplaceBack(w[3*A],w[3*A+1],w[3*A+2]);if(u.vertexArray._trim(),u.aabb=new xr(v.min,v.max),u.centroid=function(A,D){const R=[0,0,0],O=A.length;if(O>0){for(let $=0;$<O;$++){const H=3*A[$];R[0]+=D[H],R[1]+=D[H+1],R[2]+=D[H+2]}R[0]/=O,R[1]/=O,R[2]/=O}return R}(g,w),a.COLOR_0!==void 0){const A=e.json.accessors[a.COLOR_0],D=of[A.type],R=ou(e,A);u.colorArray=D===3?new Yo:new Ko,u.colorArray.resize(A.count),mv(e,A,u.colorArray,R)}if(a.NORMAL!==void 0){u.normalArray=new Yo;const A=e.json.accessors[a.NORMAL];u.normalArray.resize(A.count);const D=ou(e,A);mv(e,A,u.normalArray,D)}if(a.TEXCOORD_0!==void 0&&i.length>0){u.texcoordArray=new Ga;const A=e.json.accessors[a.TEXCOORD_0];u.texcoordArray.resize(A.count);const D=ou(e,A);mv(e,A,u.texcoordArray,D)}if(a._FEATURE_ID_RGBA4444!==void 0){const A=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(u.featureData=ou(e,A))}a._FEATURE_RGBA4444!==void 0&&(u.featureData=new Uint32Array(ou(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const S=r.material;return u.material=function(A,D){const{emissiveFactor:R=[0,0,0],alphaMode:O="OPAQUE",alphaCutoff:$=.5,normalTexture:H,occlusionTexture:K,emissiveTexture:W,doubleSided:F}=A,{baseColorFactor:q=[1,1,1,1],metallicFactor:Y=1,roughnessFactor:ee=1,baseColorTexture:he,metallicRoughnessTexture:ye}=A.pbrMetallicRoughness||{},ve=K?D[K.index]:void 0;if(K&&K.extensions&&K.extensions.KHR_texture_transform&&ve){const Ce=K.extensions.KHR_texture_transform;ve.offsetScale=[Ce.offset[0],Ce.offset[1],Ce.scale[0],Ce.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Fi(...q),metallicFactor:Y,roughnessFactor:ee,baseColorTexture:he?D[he.index]:void 0,metallicRoughnessTexture:ye?D[ye.index]:void 0},doubleSided:F,emissiveFactor:R,alphaMode:O,alphaCutoff:$,normalTexture:H?D[H.index]:void 0,occlusionTexture:ve,emissionTexture:W?D[W.index]:void 0,defined:A.defined===void 0}}(S!==void 0?e.json.materials[S]:{defined:!1},i),u}function FS(r,e,i){const{matrix:s,rotation:a,translation:u,scale:h,mesh:m,extras:g,children:v}=r,w={};if(w.matrix=s||function(S,A,D,R){var O=A[0],$=A[1],H=A[2],K=A[3],W=O+O,F=$+$,q=H+H,Y=O*W,ee=O*F,he=O*q,ye=$*F,ve=$*q,Ce=H*q,Ue=K*W,et=K*F,Ye=K*q,Qe=R[0],ot=R[1],je=R[2];return S[0]=(1-(ye+Ce))*Qe,S[1]=(ee+Ye)*Qe,S[2]=(he-et)*Qe,S[3]=0,S[4]=(ee-Ye)*ot,S[5]=(1-(Y+Ce))*ot,S[6]=(ve+Ue)*ot,S[7]=0,S[8]=(he+et)*je,S[9]=(ve-Ue)*je,S[10]=(1-(Y+ye))*je,S[11]=0,S[12]=D[0],S[13]=D[1],S[14]=D[2],S[15]=1,S}([],a||[0,0,0,1],u||[0,0,0],h||[1,1,1]),m!==void 0){w.meshes=i[m];const S=w.anchor=[0,0];for(const A of w.meshes){const{min:D,max:R}=A.aabb;S[0]+=D[0]+R[0],S[1]+=D[1]+R[1]}S[0]=Math.floor(S[0]/w.meshes.length/2),S[1]=Math.floor(S[1]/w.meshes.length/2)}if(g&&(g.id&&(w.id=g.id),g.lights&&(w.lights=function(S){if(!S.length)return[];const A=function(H){const K=atob(H),W=new Uint8Array(K.length);for(let F=0;F<K.length;F++)W[F]=K.codePointAt(F);return W}(S),D=[],R=A.length/24,O=new Uint16Array(A.buffer),$=new Float32Array(A.buffer);for(let H=0;H<R;H++){const K=O[2*H*6]/30,W=O[2*H*6+1]/30,F=O[2*H*6+10]/100,q=$[6*H+1],Y=$[6*H+2],ee=$[6*H+3],he=$[6*H+4],ye=ee-q,ve=he-Y,Ce=Math.hypot(ye,ve);D.push({pos:[q+.5*ye,Y+.5*ve,W],normal:[ve/Ce,-ye/Ce,0],width:Ce,height:K,depth:F,points:[q,Y,ee,he]})}return D}(g.lights))),v){const S=[];for(const A of v)S.push(FS(e.json.nodes[A],e,i));w.children=S}return w}function PO(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new v0(r.vertices,r.indices,8,256),[i,s]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:s}}function DO(r){if(!r.extras||!r.extras.ground)return null;const e=r.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const s=[];for(const h of i){if(!Array.isArray(h)||h.length!==2)continue;const m=h[0],g=h[1];typeof m=="number"&&typeof g=="number"&&s.push(new ft(m,g))}if(s.length<3)return null;s.length>1&&s[s.length-1].equals(s[0])&&s.pop();let a=0;for(let h=0;h<s.length;h++){const m=s[h],g=s[(h+1)%s.length],v=s[(h+2)%s.length];a+=(m.x-g.x)*(v.y-g.y)-(v.x-g.x)*(m.y-g.y)}a>0&&s.reverse();const u=Ip(s.flatMap(h=>[h.x,h.y]),[]);return u.length===0?null:{vertices:s,indices:u}}function RO(r,e){const i=[],s=[];let a=0;const u=[];for(const h of r){a=i.length;const m=h.vertexArray.float32,g=h.indexArray.uint16;for(let v=0;v<h.vertexArray.length;v++)u[0]=m[3*v+0],u[1]=m[3*v+1],u[2]=m[3*v+2],gr(u,u,e),i.push(new ft(u[0],u[1]));for(let v=0;v<3*h.indexArray.length;v++)s.push(g[v]+a)}if(s.length%3!=0)return null;for(let h=0;h<s.length;h+=3){const m=i[s[h+0]],g=i[s[h+1]],v=i[s[h+2]];(m.x-g.x)*(v.y-g.y)-(v.x-g.x)*(m.y-g.y)>0&&([s[h+1],s[h+2]]=[s[h+2],s[h+1]])}return{vertices:i,indices:s}}function BS(r){const e=function(g,v){const w=[],S=WebGL2RenderingContext;if(g.json.textures)for(const A of g.json.textures){const D={magFilter:S.LINEAR,minFilter:S.NEAREST,wrapS:S.REPEAT,wrapT:S.REPEAT};A.sampler!==void 0&&Object.assign(D,g.json.samplers[A.sampler]),w.push({image:v[A.source],sampler:D,uploaded:!1})}return w}(r,r.images),i=function(g,v){const w=[];for(const S of g.json.meshes){const A=[];for(const D of S.primitives)A.push(MO(D,g,v));w.push(A)}return w}(r,e),{scenes:s,scene:a,nodes:u}=r.json,h=s?s[a||0].nodes:u,m=[];for(const g of h)m.push(FS(u[g],r,i));return function(g,v,w){const S={},A=new Set;for(let D=0;D<g.length;D++){const R=w[v[D]];if(!R.extras)continue;const O=R.extras["mapbox:footprint:version"],$=R.extras["mapbox:footprint:id"];(O||$)&&A.add(D),O==="1.0.0"&&$&&(S[$]=D)}for(let D=0;D<g.length;D++){if(A.has(D))continue;const R=g[D],O=w[v[D]];if(!O.extras)continue;let $=null;R.id in S&&($=RO(g[S[R.id]].meshes,R.matrix)),$||($=DO(O)),$&&(R.footprint=PO($))}if(A.size>0){const D=Array.from(A.values()).sort((R,O)=>R-O);for(let R=D.length-1;R>=0;R--)g.splice(D[R],1)}}(m,h,r.json.nodes),m}function zO(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,s=r.aabb.min[1]-1,a=iu/(r.aabb.max[0]-i+2),u=iu/(r.aabb.max[1]-s+2);for(let h=0;h<e.length;h+=3){const m=e[h+2],g=(e[h+0]-i)*a|0,v=(e[h+1]-s)*u|0;m>r.heightmap[v*iu+g]&&(r.heightmap[v*iu+g]=m)}}function LO(r,e){const i={};i.indexArray=new fn,i.indexArray.reserve(4*r.length),i.vertexArray=new Yo,i.vertexArray.reserve(10*r.length),i.colorArray=new Ko,i.vertexArray.reserve(10*r.length);let s=0;for(const h of r){const m=Math.min(10,Math.max(4,1.3*h.height))*e,g=[-h.normal[1],h.normal[0],0],v=Math.min(.29,.1*h.width/h.depth),w=h.width-2*h.depth*e*(v+.01),S=$r([],h.pos,g,w/2),A=$r([],h.pos,g,-w/2),D=[S[0],S[1],S[2]+h.height],R=[A[0],A[1],A[2]+h.height],O=$r([],h.normal,g,v);Ii(O,O,m);const $=$r([],h.normal,g,-v);Ii($,$,m),vi(O,S,O),vi($,A,$),S[2]+=.1,A[2]+=.1,i.vertexArray.emplaceBack(O[0],O[1],O[2]),i.vertexArray.emplaceBack($[0],$[1],$[2]),i.vertexArray.emplaceBack(S[0],S[1],S[2]),i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(D[0],D[1],D[2]),i.vertexArray.emplaceBack(R[0],R[1],R[2]),i.vertexArray.emplaceBack(S[0],S[1],S[2]),i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(O[0],O[1],O[2]),i.vertexArray.emplaceBack($[0],$[1],$[2]);const H=w/m/2;i.colorArray.emplaceBack(-H-v,-1,H,.8),i.colorArray.emplaceBack(H+v,-1,H,.8),i.colorArray.emplaceBack(-H,0,H,1.3),i.colorArray.emplaceBack(H,0,H,1.3),i.colorArray.emplaceBack(H+v,-.8,H,.7),i.colorArray.emplaceBack(H+v,-.8,H,.7),i.colorArray.emplaceBack(0,0,H,1.3),i.colorArray.emplaceBack(0,0,H,1.3),i.colorArray.emplaceBack(H+v,-1.2,H,.8),i.colorArray.emplaceBack(H+v,-1.2,H,.8),i.indexArray.emplaceBack(6+s,4+s,8+s),i.indexArray.emplaceBack(7+s,9+s,5+s),i.indexArray.emplaceBack(0+s,1+s,2+s),i.indexArray.emplaceBack(1+s,3+s,2+s),s+=10}const a={defined:!0,emissiveFactor:[0,0,0]},u={};return u.baseColorFactor=Fi.white,a.pbrMetallicRoughness=u,i.material=a,i.aabb=new xr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}class NS{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const s=e[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const kO=["id","tile","layer","source","sourceLayer","state"];class Zh{constructor(e,i,s,a,u){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=s,this._y=a,this.properties=e.properties,this.id=u}clone(){const e=new Zh(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of kO)this[i]!==void 0&&(e[i]=this[i]);return e}}class jS{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Cl(_t,16,0),this.featureIndexArray=new qm,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,s,a,u,h=0,m=0){const g=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,a,u,h);const v=this.grid;for(let w=0;w<i.length;w++){const S=i[w],A=[1/0,1/0,-1/0,-1/0];for(let D=0;D<S.length;D++){const R=S[D];A[0]=Math.min(A[0],R.x),A[1]=Math.min(A[1],R.y),A[2]=Math.max(A[2],R.x),A[3]=Math.max(A[3],R.y)}m!==0&&(A[0]-=m,A[1]-=m,A[2]+=m,A[3]+=m),A[0]<_t&&A[1]<_t&&A[2]>=0&&A[3]>=0&&v.insert(g,A[0],A[1],A[2],A[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new $l.VectorTile(new p_(this.rawTileData)).layers,this.sourceLayerCoder=new NS(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:s,transform:a,tileTransform:u,pixelPosMatrix:h,availableImages:m}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const g=s.bufferedTilespaceBounds,v=this.grid.query(g.min.x,g.min.y,g.max.x,g.max.y,(D,R,O,$)=>Kr(s.bufferedTilespaceGeometry,D,R,O,$));v.sort(OO);let w=null;a.elevation&&v.length>0&&(w=Vh.create(a.elevation,this.tileID));const S={};let A;for(let D=0;D<v.length;D++){const R=v[D];if(R===A)continue;A=R;const O=this.featureIndexArray.get(R);let $=null;this.is3DTile?this.loadMatchingModelFeature(S,O,e,s,a):this.loadMatchingFeature(S,O,e,m,(H,K,W,F=0)=>($||($=At(H,this.tileID.canonical,u)),K.queryIntersectsFeature(s,H,W,$,this.z,a,h,w,F)))}return S}loadMatchingFeature(e,i,s,a,u){const{featureIndex:h,bucketIndex:m,sourceLayerIndex:g,layoutVertexArrayOffset:v}=i,w=this.bucketLayerIDs[m],S=s.layers,A=Object.keys(S);if(A.length&&!function(H,K){for(let W=0;W<H.length;W++)if(K.indexOf(H[W])>=0)return!0;return!1}(A,w))return;const D=s.sourceCache,R=this.sourceLayerCoder.decode(g),O=this.vtLayers[R].feature(h),$=this.getId(O,R);for(let H=0;H<w.length;H++){const K=w[H];if(!S[K])continue;const{styleLayer:W,targets:F}=S[K];let q={};$!==void 0&&(q=D.getFeatureState(W.sourceLayer,$));const Y=!u||u(O,W,q,v);if(!Y)continue;const ee=new Zh(O,this.z,this.x,this.y,$);ee.tile=this.tileID.canonical,ee.state=q;let he=this.serializedLayersCache.get(K);he||(he=W.serialize(),he.id=K,this.serializedLayersCache.set(K,he)),ee.source=he.source,ee.sourceLayer=he["source-layer"],ee.layer=Oe({},he),ee.layer.paint=VS(he.paint,W.paint,O,q,a),ee.layer.layout=VS(he.layout,W.layout,O,q,a);let ye=!1;for(const ve of F){this.updateFeatureProperties(ee,ve);const{filter:Ce}=ve;if(Ce){if(O.properties=ee.properties,Ce.needGeometry){const Ue=Lt(O,!0);if(!Ce.filter(new Wi(this.tileID.overscaledZ),Ue,this.tileID.canonical))continue}else if(!Ce.filter(new Wi(this.tileID.overscaledZ),O))continue}ye=!0,ve.targetId&&this.addFeatureVariant(ee,ve)}ye&&this.appendToResult(e,K,h,ee,Y)}}loadMatchingModelFeature(e,i,s,a,u){const h=this.bucketLayerIDs[0][0],m=s.layers;if(!m[h])return;const{styleLayer:g,targets:v}=m[h];if(g.type!=="model")return;const w=a.tile,S=i.featureIndex,A=w.getBucket(g);if(!(A&&A instanceof k_))return;const D=function(he,ye,ve,Ce){const Ue=he.getNodesInfo()[ye];if(Ue.hiddenByReplacement||!Ue.node.meshes)return;let et=Number.MAX_VALUE;const Ye=Ue.node,Qe=ve.tile,ot=Ce.calculatePosMatrix(Qe.tileID.toUnwrapped(),Ce.worldSize),je=Ue.evaluatedScale;let Je=0;Ce.elevation&&Ye.elevation&&(Je=Ye.elevation*Ce.elevation.exaggeration()),st(ot,ot,[(Ye.anchor?Ye.anchor[0]:0)*(je[0]-1),(Ye.anchor?Ye.anchor[1]:0)*(je[1]-1),Je]),nt(ot,ot,je);const Fe=ve.queryGeometry,Ve=Fe.isPointQuery()?Fe.screenBounds:Fe.screenGeometry,lt=function(zt){const Et=Se([],ot,zt.matrix);Se(Et,Ce.expandedFarZProjMatrix,Et);for(let gt=0;gt<zt.meshes.length;++gt){const at=zt.meshes[gt];if(gt===zt.lightMeshIndex)continue;const Xt=jT(Ve,Ce,Et,at.aabb);Xt!=null&&(et=Math.min(Xt,et))}if(zt.children)for(const gt of zt.children)lt(gt)};if(lt(Ye),et===Number.MAX_VALUE)return;const ut=new V(0,0);return KT(Qe.tileID.canonical,ut,Ue.node.anchor[0],Ue.node.anchor[1]),{intersectionZ:et,position:ut,feature:Ue.feature}}(A,S,a,u);if(!D)return;const{z:R,x:O,y:$}=w.tileID.canonical,{feature:H,intersectionZ:K,position:W}=D;let F={};H.id!==void 0&&(F=s.sourceCache.getFeatureState(g.sourceLayer,H.id));const q=new Zh({},R,O,$,H.id);q.tile=this.tileID.canonical,q.state=F,q.properties=H.properties,q.geometry={type:"Point",coordinates:[W.lng,W.lat]};let Y=this.serializedLayersCache.get(h);Y||(Y=g.serialize(),Y.id=h,this.serializedLayersCache.set(h,Y)),q.source=Y.source,q.sourceLayer=Y["source-layer"],q.layer=Oe({},Y);let ee=!1;for(const he of v){this.updateFeatureProperties(q,he);const{filter:ye}=he;if(ye){if(H.properties=q.properties,ye.needGeometry){if(!ye.filter(new Wi(this.tileID.overscaledZ),H,this.tileID.canonical))continue}else if(!ye.filter(new Wi(this.tileID.overscaledZ),H))continue}ee=!0,he.targetId&&this.addFeatureVariant(q,he)}ee&&this.appendToResult(e,h,S,q,K)}updateFeatureProperties(e,i,s){if(i.properties){const a={};for(const u in i.properties){const h=i.properties[u].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,s);h!=null&&(a[u]=h)}e.properties=a}}addFeatureVariant(e,i,s){const a={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,s,a,u){let h=e[i];h===void 0&&(h=e[i]=[]),h.push({featureIndex:s,feature:a,intersectionZ:u})}lookupSymbolFeatures(e,i,s,a,u){const h={};this.loadVTLayers();for(const m of e)this.loadMatchingFeature(h,{bucketIndex:i,sourceLayerIndex:s,featureIndex:m,layoutVertexArrayOffset:0},a,u);return h}loadFeature(e){const{featureIndex:i,sourceLayerIndex:s}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(s),u=this.vtFeatures[a];if(u[i])return u[i];const h=this.vtLayers[a].feature(i);return u[i]=h,h}hasLayer(e){for(const i of this.bucketLayerIDs)for(const s of i)if(e===s)return!0;return!1}getId(e,i){let s=e.id;if(this.promoteId){const a=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(a!=null)if(Array.isArray(a)){if(!this.promoteIdExpression){const u=Al(a);if(u.result!=="success"){const h=u.value.map(m=>`${m.key}: ${m.message}`).join(", ");return void yi(`Failed to create expression for promoteId: ${h}`)}this.promoteIdExpression=u.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new $u),s=this.promoteIdExpression.evaluate({zoom:0},e)}else s=e.properties[a];typeof s=="boolean"&&(s=Number(s))}return s}}function VS(r,e,i,s,a){return ni(r,(u,h)=>{const m=e instanceof Na?e.get(h):null;return m&&m.evaluate?m.evaluate(i,s,void 0,a):m})}function OO(r,e){return e-r}Tt(jS,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const US=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class _v{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=s>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const u=US[15&s];if(!u)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[m]=new Uint32Array(e,4,1);return new _v(m,h,u,e)}constructor(e,i=64,s=Float64Array,a){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=US.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,m=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-m%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+m+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=i,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return gv(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:h,nodeSize:m}=this,g=[0,u.length-1,0],v=[];for(;g.length;){const w=g.pop()||0,S=g.pop()||0,A=g.pop()||0;if(S-A<=m){for(let $=A;$<=S;$++){const H=h[2*$],K=h[2*$+1];H>=e&&H<=s&&K>=i&&K<=a&&v.push(u[$])}continue}const D=A+S>>1,R=h[2*D],O=h[2*D+1];R>=e&&R<=s&&O>=i&&O<=a&&v.push(u[D]),(w===0?e<=R:i<=O)&&(g.push(A),g.push(D-1),g.push(1-w)),(w===0?s>=R:a>=O)&&(g.push(D+1),g.push(S),g.push(1-w))}return v}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:u,nodeSize:h}=this,m=[0,a.length-1,0],g=[],v=s*s;for(;m.length;){const w=m.pop()||0,S=m.pop()||0,A=m.pop()||0;if(S-A<=h){for(let $=A;$<=S;$++)GS(u[2*$],u[2*$+1],e,i)<=v&&g.push(a[$]);continue}const D=A+S>>1,R=u[2*D],O=u[2*D+1];GS(R,O,e,i)<=v&&g.push(a[D]),(w===0?e-s<=R:i-s<=O)&&(m.push(A),m.push(D-1),m.push(1-w)),(w===0?e+s>=R:i+s>=O)&&(m.push(D+1),m.push(S),m.push(1-w))}return g}}function gv(r,e,i,s,a,u){if(a-s<=i)return;const h=s+a>>1;$S(r,e,h,s,a,u),gv(r,e,i,s,h-1,1-u),gv(r,e,i,h+1,a,1-u)}function $S(r,e,i,s,a,u){for(;a>s;){if(a-s>600){const v=a-s+1,w=i-s+1,S=Math.log(v),A=.5*Math.exp(2*S/3),D=.5*Math.sqrt(S*A*(v-A)/v)*(w-v/2<0?-1:1);$S(r,e,i,Math.max(s,Math.floor(i-w*A/v+D)),Math.min(a,Math.floor(i+(v-w)*A/v+D)),u)}const h=e[2*i+u];let m=s,g=a;for(sf(r,e,s,i),e[2*a+u]>h&&sf(r,e,s,a);m<g;){for(sf(r,e,m,g),m++,g--;e[2*m+u]<h;)m++;for(;e[2*g+u]>h;)g--}e[2*s+u]===h?sf(r,e,s,g):(g++,sf(r,e,g,a)),g<=i&&(s=g+1),i<=g&&(a=g-1)}}function sf(r,e,i,s){yv(r,i,s),yv(e,2*i,2*s),yv(e,2*i+1,2*s+1)}function yv(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function GS(r,e,i,s){const a=r-i,u=e-s;return a*a+u*u}o.$=zn,o.A=js,o.B=Po,o.C=Va,o.D=Uh,o.E=Sa,o.F=2,o.G=jp,o.H=eT,o.I=eo,o.J=class extends z_{},o.K=Zt,o.L=gc,o.M=Ro,o.N=uh,o.O=ch,o.P=ft,o.Q=Jd,o.R=ku,o.S=ph,o.T=Z0,o.U=yh,o.V=z_,o.W=Rc,o.X=Al,o.Y=Ku,o.Z=bl,o._=Ac,o.a=function(r){return An.API_CDN_URL_REGEX.test(r)},o.a$=bt,o.a0=_c,o.a1=vh,o.a2=hh,o.a3=Em,o.a4=function(r){const e=r.value;let i=[];if(!e)return i;const s=Zt(e);return s!=="string"?(i=i.concat([new z_(r.key,e,`string expected, "${s}" found`)]),i):(K0(e,!0)||(i=i.concat([new z_(r.key,e,`invalid url "${e}"`)])),i)},o.a5=Re,o.a6=Rm,o.a7=Nr,o.a8=dt,o.a9=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return or(r.expression.evaluate(e))}interpolate(r,e,i){return{x:Nt(r.x,e.x,i),y:Nt(r.y,e.y,i),z:Nt(r.z,e.z,i),azimuthal:Nt(r.azimuthal,e.azimuthal,i),polar:Nt(r.polar,e.polar,i)}}},o.aA=Dr,o.aB=Yi,o.aC=Ke,o.aD=Te,o.aE=f,o.aF=function(r,e){const i={};for(let s=0;s<e.length;s++){const a=e[s];a in r&&(i[a]=r[a])}return i},o.aG=X,o.aH=le,o.aI=class{constructor(r){this.entries={},this.scheduler=r}request(r,e,i,s){const a=this.entries[r]=this.entries[r]||{callbacks:[]};if(a.result){const[u,h]=a.result;return this.scheduler?this.scheduler.add(()=>{s(u,h)},e):s(u,h),()=>{}}return a.callbacks.push(s),a.cancel||(a.cancel=i((u,h)=>{a.result=[u,h];for(const m of a.callbacks)this.scheduler?this.scheduler.add(()=>{m(u,h)},e):m(u,h);setTimeout(()=>delete this.entries[r],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(u=>u!==s),a.callbacks.length||(a.cancel(),delete this.entries[r]))}}},o.aJ=function(r,e,i){const s=JSON.stringify(r.request);return r.data&&(this.deduped.entries[s]={result:[null,r.data]}),this.deduped.request(s,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom},a=>{const u=cl(r.request,(h,m,g,v)=>{h?a(h):m&&a(null,{vectorTile:i?void 0:new $l.VectorTile(new p_(m)),rawData:m,cacheControl:g,expires:v})});return()=>{u.cancel(),a()}},e)},o.aK=function(r){pc++,pc>Mo&&(r.getActor().send("enforceCacheSizeLimit",fs),pc=0)},o.aL=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log(r)/Math.LN2))},o.aM=Zr,o.aN=MT,o.aO=kT,o.aP=CT,o.aQ=function(r,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let s=0;s<r.length;s++){const a=document.createElement("source");wy(r[s])||(i.crossOrigin="Anonymous"),a.src=r[s],i.appendChild(a)}return{cancel:()=>{}}},o.aR=C_,o.aS=function(r){return fetch(r).then(e=>e.arrayBuffer()).then(e=>OS(e,0,r))},o.aT=BS,o.aU=class{constructor(r,e,i,s){this.id=r,this.position=e!=null?new V(e[0],e[1]):new V(0,0),this.orientation=i??[0,0,0],this.nodes=s,this.uploaded=!1,this.aabb=new xr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(r,e){if(Se(r.matrix,e,r.matrix),r.meshes)for(const i of r.meshes){const s=xr.applyTransformFast(i.aabb,r.matrix);this.aabb.encapsulate(s)}if(r.children)for(const i of r.children)this._applyTransformations(i,r.matrix)}computeBoundsAndApplyParent(){const r=_e([]);for(const e of this.nodes)this._applyTransformations(e,r)}computeModelMatrix(r,e,i,s,a,u,h=!1){qT(this.matrix,this,r.transform,this.position,e,i,s,a,u,h)}upload(r){if(!this.uploaded){for(const e of this.nodes)Q0(e,r);for(const e of this.nodes)L_(e);this.uploaded=!0}}destroy(){for(const r of this.nodes)ev(r)}},o.aV=Qt,o.aW=$p,o.aX=de,o.aY=me,o.aZ=Ua,o.a_=fn,o.aa=Wi,o.ab=Il,o.ac=ke,o.ad=gr,o.ae=Jt,o.af=Ae,o.ag=Na,o.ah=Vl,o.ai=Nt,o.aj=_t,o.ak=Qf,o.al=U,o.am=Fi,o.an=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return function([i,s]){const a=or([1,i,s]);return{x:a.x,y:a.y,z:a.z}}(r.expression.evaluate(e))}interpolate(r,e,i){return{x:Nt(r.x,e.x,i),y:Nt(r.y,e.y,i),z:Nt(r.z,e.z,i)}}},o.ao=function(r,e,i=0,s=!0){const a=new ft(i,i),u=r.sub(a),h=e.add(a),m=[u,new ft(h.x,u.y),h,new ft(u.x,h.y)];return s&&m.push(u.clone()),m},o.ap=function(r,e){const i=[];for(let s=0;s<r.length;s++){const a=Be(s-1,-1,r.length-1),u=Be(s+1,-1,r.length-1),h=r[s],m=r[u],g=r[a].sub(h).unit(),v=m.sub(h).unit(),w=v.angleWithSep(g.x,g.y),S=g.add(v).unit().mult(-1*e/Math.sin(w/2));i.push(h.add(S))}return i},o.aq=fT,o.ar=Kr,o.as=function(r,e,i=0){return Bt(((e.x-i)*r.scale-r.x)*_t,(e.y*r.scale-r.y)*_t,Le(e.z,e.y))},o.at=Ei,o.au=Ui,o.av=Fo,o.aw=E2,o.ax=function(r){let e=1/0,i=1/0,s=-1/0,a=-1/0;for(const u of r)e=Math.min(e,u.x),i=Math.min(i,u.y),s=Math.max(s,u.x),a=Math.max(a,u.y);return{min:new ft(e,i),max:new ft(s,a)}},o.ay=ae,o.az=Se,o.b=function(r){return An.API_FONTS_REGEX.test(r)},o.b$=Ii,o.b0=Ch,o.b1=A_,o.b2=function(){vo.isLoading()||vo.isLoaded()||Ml()!=="deferred"||Dm()},o.b3=ap,o.b4=Lt,o.b5=Zh,o.b6=qr,o.b7=E0,o.b8=y0,o.b9=At,o.bA=function(r,e){const{x:i,y:s}=r.point,a=sw(i,s,r.worldSize/r._pixelsPerMercatorPixel,0,0);return Se(a,a,r0(ra(e)))},o.bB=xe,o.bC=function(r){return r[0]=0,r[1]=0,r[2]=0,r},o.bD=function(r,e){return Math.hypot(e[0]-r[0],e[1]-r[1],e[2]-r[2])},o.bE=Zi,o.bF=$r,o.bG=Lr,o.bH=Np,o.bI=lo,o.bJ=z0,o.bK=function(r,e,i,s,a){const u=5*e+2;r.float32[u+0]=i,r.float32[u+1]=s,r.float32[u+2]=a},o.bL=E_,o.bM=d_,o.bN=Vt,o.bO=xn,o.bP=Zw,o.bQ=VT,o.bR=Jw,o.bS=Qw,o.bT=F0,o.bU=aT,o.bV=R0,o.bW=_v,o.bX=Be,o.bY=On,o.bZ=function(r,e,i){i*=.5;var s=e[0],a=e[1],u=e[2],h=e[3],m=Math.sin(i),g=Math.cos(i);return r[0]=s*g+a*m,r[1]=a*g-s*m,r[2]=u*g+h*m,r[3]=h*g-u*m,r},o.b_=po,o.ba=xs,o.bb=Uc,o.bc=Qo,o.bd=Cr,o.be=Ip,o.bf=G0,o.bg=function(r,e){const i=Vl(e.zoom);if(i===0)return ra(r);const s=e_(r),a=i0(s),u=ae(s.getWest())*e.worldSize,h=ae(s.getEast())*e.worldSize,m=le(s.getNorth())*e.worldSize,g=le(s.getSouth())*e.worldSize,v=[u,m,0],w=[h,m,0],S=[u,g,0],A=[h,g,0],D=ze([],e.globeMatrix);return gr(v,v,D),gr(w,w,D),gr(S,S,D),gr(A,A,D),a[0]=Za(a[0],S,i),a[1]=Za(a[1],A,i),a[2]=Za(a[2],w,i),a[3]=Za(a[3],v,i),xr.fromPoints(a)},o.bh=i_,o.bi=ze,o.bj=Ep,o.bk=Za,o.bl=wh,o.bm=bo,o.bn=$t,o.bo=st,o.bp=G_,o.bq=p_,o.br=cl,o.bs=function(r,e){const i=[];for(const s in r)s in e||i.push(s);return i},o.bt=qe,o.bu=["type","source","source-layer","minzoom","maxzoom","filter","layout"],o.bv=ds,o.bw=function(r){var e=new fe(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},o.bx=_e,o.by=xt,o.bz=Pe,o.c=xa,o.c$=function(r){return r({pluginStatus:to,pluginURL:Ks}),gh.on("pluginStateChange",r),r},o.c0=wr,o.c1=pn,o.c2=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},o.c3=Wt,o.c4=function(r,e,i,s,a){var u,h=1/Math.tan(e/2);return r[0]=h/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0?(r[10]=(a+s)*(u=1/(s-a)),r[14]=2*a*s*u):(r[10]=-1,r[14]=-2*s),r},o.c5=function(r,e,i,s,a,u,h){var m=1/(e-i),g=1/(s-a),v=1/(u-h);return r[0]=-2*m,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*g,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*v,r[11]=0,r[12]=(e+i)*m,r[13]=(a+s)*g,r[14]=(h+u)*v,r[15]=1,r},o.c6=ne,o.c7=function(r,e,i){r[4*e+0]=i[0],r[4*e+1]=i[1],r[4*e+2]=i[2],r[4*e+3]=i[3]},o.c8=qc,o.c9=zo,o.cA=D_,o.cB=Ai,o.cC=OT,o.cD=function(r){const e=OT(r,!0);return xe([],[e[0],e[1],e[4],e[5]])},o.cE=nt,o.cF=Nl,o.cG=Xe,o.cH=function(r){const{x:e,y:i}=r.point,{lng:s,lat:a}=r._center;return sw(e,i,r.worldSize,s,a)},o.cI=ui,o.cJ=Z,o.cK=wn,o.cL=_,o.cM=function(r,e,i){let s=0;for(let a=0;a<2;++a)r[a]>0&&(s+=(r[a]-0)*(r[a]-0)),e[a]<0&&(s+=(0-e[a])*(0-e[a]));return s},o.cN=45,o.cO=ju,o.cP=ue,o.cQ=Dh,o.cR=function(r,e,i){const s=Math.sqrt(r*r+e*e+i*i),a=s>0?Math.acos(i/s)*$e:0;let u=r!==0||e!==0?Math.atan2(-e,-r)*$e+90:0;return u<0&&(u+=360),[s,u,a]},o.cS=Bt,o.cT=De,o.cU=vi,o.cV=xr,o.cW=or,o.cX=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},o.cY=ri,o.cZ=K0,o.c_=function(r,e){return r.readFields(zk,{icons:[]},e)},o.ca=Hc,o.cb=Wr,o.cc=Ph,o.cd=V,o.ce=vT,o.cf=function(){var r=new fe(4);return fe!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r},o.cg=function(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3],m=Math.sin(i),g=Math.cos(i);return r[0]=s*g+u*m,r[1]=a*g+h*m,r[2]=s*-m+u*g,r[3]=a*-m+h*g,r},o.ch=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},o.ci=Qi,o.cj=function(r){return Math.hypot(r[0],r[1],r[2],r[3])},o.ck=Ho,o.cl=oo,o.cm=vn,o.cn=Xc,o.co=FT,o.cp=cr,o.cq=rw,o.cr=function(r,e,i,s,a,u,h,m,g){if(g.name==="globe")return rw(r,e,new cr(i,s,a),!1);const v=$p({z:i,x:s,y:a},g);return new xr([(u+v.x/v.scale)*e,e*(v.y/v.scale),h],[(u+v.x2/v.scale)*e,e*(v.y2/v.scale),m])},o.cs=function(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r[3]=Math.min(e[3],i[3]),r},o.ct=function(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r[3]=Math.max(e[3],i[3]),r},o.cu=function(r){const e=Math.round((r+45+360)%360/90)%4;return se[e]},o.cv=Me,o.cw=En,o.cx=y,o.cy=function(r){const e=_e(new Float64Array(16));Se(e,r.pixelMatrix,r.globeMatrix);const i=[0,P,0],s=[0,M,0];return gr(i,i,e),gr(s,s,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!o0(r,new V(r.center.lat,90)),s[0]>0&&s[0]<=r.width&&s[1]>0&&s[1]<=r.height&&!o0(r,new V(r.center.lat,-90))]},o.cz=function(r,e){const{scale:i}=r.tileTransform,s=i*_t/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return function(a,u,h){var m=u[1],g=u[2],v=u[3],w=h[0],S=h[1];return a[0]=u[0]*w,a[1]=m*w,a[2]=g*S,a[3]=v*S,a}(new Float32Array(4),e.inverseAdjustmentMatrix,[s,s])},o.d=function(r){return An.API_TILEJSON_REGEX.test(r)},o.d$=bp,o.d0=O_,o.d1=Fh,o.d2=k0,o.d3=Ri,o.d4=Ba,o.d5=Jn,o.d6=Qn,o.d7=_i,o.d8=function(r){const e=r.indexOf(Bc);return e>=0?r.slice(0,e):r},o.d9=function(r){return r.indexOf(Bc)>=0},o.dA=ow,o.dB=Rn,o.dC=Dn,o.dD=256,o.dE=function(r,e){const i=[0,0,0];return gr(i,i,i_(ra(e.canonical))),gr(i,i,r),i},o.dF=r=>({u_camera_to_center_distance:new Wr(r),u_extrude_scale:new xo(r),u_device_pixel_ratio:new Wr(r),u_matrix:new qc(r),u_inv_rot_matrix:new qc(r),u_merc_center:new zo(r),u_tile_id:new Hc(r),u_zoom_transition:new Wr(r),u_up_dir:new Hc(r),u_emissive_strength:new Wr(r)}),o.dG=r=>({u_matrix:new qc(r),u_pixels_to_tile_units:new xo(r),u_device_pixel_ratio:new Wr(r),u_width_scale:new Wr(r),u_floor_width_scale:new Wr(r),u_units_to_pixels:new zo(r),u_dash_image:new Ph(r),u_gradient_image:new Ph(r),u_image_height:new Wr(r),u_texsize:new zo(r),u_tile_units_to_pixels:new Wr(r),u_alpha_discard_threshold:new Wr(r),u_trim_offset:new zo(r),u_trim_fade_range:new zo(r),u_trim_color:new Dh(r),u_emissive_strength:new Wr(r),u_zbias_factor:new Wr(r),u_tile_to_meter:new Wr(r),u_ground_shadow_factor:new Hc(r)}),o.dH=r=>({u_matrix:new qc(r),u_texsize:new zo(r),u_pixels_to_tile_units:new xo(r),u_device_pixel_ratio:new Wr(r),u_width_scale:new Wr(r),u_floor_width_scale:new Wr(r),u_image:new Ph(r),u_units_to_pixels:new zo(r),u_tile_units_to_pixels:new Wr(r),u_alpha_discard_threshold:new Wr(r),u_trim_offset:new zo(r),u_trim_fade_range:new zo(r),u_trim_color:new Dh(r),u_emissive_strength:new Wr(r),u_zbias_factor:new Wr(r),u_tile_to_meter:new Wr(r),u_ground_shadow_factor:new Hc(r),u_pattern_transition:new Wr(r)}),o.dI=jc,o.dJ=B3,o.dK=cw,o.dL=(r,e,i,s,a,u)=>{const h=r.transform,m=h.projection.name==="globe";let g;if(u.paint.get("circle-pitch-alignment")==="map")if(m){const w=ow(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;g=Float32Array.from([w,0,0,w])}else g=h.calculatePixelsToTileUnitsMatrix(i);else g=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const v={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(h.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Io.devicePixelRatio,u_extrude_scale:g,u_inv_rot_matrix:zL,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:u.paint.get("circle-emissive-strength")};if(m){v.u_inv_rot_matrix=s,v.u_merc_center=a,v.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],v.u_zoom_transition=Vl(h.zoom);const w=a[0]*_t,S=a[1]*_t;v.u_up_dir=h.projection.upVector(new cr(0,0,0),w,S)}return v},o.dM=M2,o.dN=Zn,o.dO=(r,e,i,s,a,u,h,m,g,v)=>{const w=r.transform,S=w.pitch<15?A2(.07,.7,Te((14-w.zoom)/5,0,1)):.07,A=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:C2(r,e,i,s),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:w.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_width_scale:u,u_floor_width_scale:h,u_image:0,u_tile_units_to_pixels:I2(e,w),u_units_to_pixels:[1/w.pixelsToGLUnits[0],1/w.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:m,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(A?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:S,u_tile_to_meter:De(e.tileID.canonical,0),u_ground_shadow_factor:g,u_pattern_transition:v}},o.dP=(r,e,i,s,a,u,h,m,g,v)=>{const w=r.transform,S=w.calculatePixelsToTileUnitsMatrix(e),A=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",D=w.pitch<15?A2(.07,.7,Te((14-w.zoom)/5,0,1)):.07;return{u_matrix:C2(r,e,i,s),u_pixels_to_tile_units:S,u_device_pixel_ratio:u,u_width_scale:h,u_floor_width_scale:m,u_units_to_pixels:[1/w.pixelsToGLUnits[0],1/w.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:P2(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:I2(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:g,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(A?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:D,u_tile_to_meter:De(e.tileID.canonical,0),u_ground_shadow_factor:v}},o.dQ=Rt,o.dR=Ap,o.dS=Le,o.dT=d2,o.dU=Oo,o.dV=h_,o.dW=Gl,o.dX=450,o.dY=7,o.dZ=gk,o.d_=ki,o.da=function(r){const e=r.lastIndexOf(Bc);return e>=0?r.slice(e+1):""},o.db=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},o.dc=function(r,e,i,s){return r.type==="custom"?new yk(r,e):new Mk[r.type](r,e,i,s)},o.dd=hi,o.de=function(r){const e=r.indexOf(Bc);return e>=0?r.slice(e+1):""},o.df=class extends Zh{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state=Object.assign({},r.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=r.source,this.sourceLayer=r.sourceLayer,this.layer=r.layer)}toJSON(){const r=super.toJSON();return r.target=this.target,r.namespace=this.namespace,r}},o.dg=gh,o.dh=ll,o.di=Jm,o.dj=class extends Jo{constructor(r){super(r),this.current=Qm}set(r,e,i){if(this.fetchUniformLocation(r,e)){for(let s=0;s<9;s++)if(i[s]!==this.current[s]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},o.dk=ge,o.dl=function(r,e,i){const s=Vl(i.zoom),a=r.style.map._antialias,u=r.terrain&&r.terrain.exaggeration()>0;return s===0&&!a&&!u},o.dm=function(r){const e=r.pixelsPerMeter,i=e/ne(1,r.center.lat),s=_e(new Float64Array(16));return st(s,s,[r.point.x,r.point.y,0]),nt(s,s,[i,i,e]),Float32Array.from(s)},o.dn=e_,o.dp=function(r){const e=Me-5;r=Te(r,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(U(r))),3);return Math.round(i*(I.length-1))},o.dq=function(r,e,i,s){const a=e.getNorth(),u=e.getSouth(),h=e.getWest(),m=e.getEast(),g=1<<r.z,v=m-h,w=a-u,S=v/E,A=-w/I[i],D=[0,S,0,A,0,0,a,h,0];if(r.z>0){const R=180/s;be(D,D,[R/v+1,0,0,0,R/w+1,0,-.5*R/S,.5*R/A,1])}return D[2]=g,D[5]=r.x,D[8]=r.y,D},o.dr=ra,o.ds=function(r,e,i){const s=_e(new Float64Array(16)),a=(e/(1<<r)-.5)*Math.PI*2;return ct(s,i.globeMatrix,a),Float32Array.from(s)},o.dt=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,s=1<<i,a=Math.floor(r.x),u=Math.floor((r.x-a)*s),h=Math.floor(r.y*s),m=this.findDEMTileFor(new Zr(i,a,i,u,h));return!(!m||!m.dem)}getAtPointOrZero(r,e=0){return this.getAtPoint(r,e)||0}getAtPoint(r,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const s=this._source();if(!s||r.y<0||r.y>1)return e;const a=s.getSource().maxzoom,u=1<<a,h=Math.floor(r.x),m=r.x-h,g=new Zr(a,h,a,Math.floor(m*u),Math.floor(r.y*u)),v=this.findDEMTileFor(g);if(!v||!v.dem)return e;const w=v.dem,S=1<<v.tileID.canonical.z,A=(m*S-v.tileID.canonical.x)*w.dim,D=(r.y*S-v.tileID.canonical.y)*w.dim,R=Math.floor(A),O=Math.floor(D);return(i?this.exaggeration():1)*Nt(Nt(w.get(R,O),w.get(R,O+1),D-O),Nt(w.get(R+1,O),w.get(R+1,O+1),D-O),A-R)}getAtTileOffset(r,e,i){const s=1<<r.canonical.z;return this.getAtPointOrZero(new ke(r.wrap+(r.canonical.x+e/_t)/s,(r.canonical.y+i/_t)/s))}getAtTileOffsetFunc(r,e,i,s){return a=>{const u=this.getAtTileOffset(r,a.x,a.y),h=s.upVector(r.canonical,a.x,a.y);return Ii(h,h,u*s.upVectorScale(r.canonical,e,i).metersToTile),h}}getForTilePoints(r,e,i,s){if(this.isUsingMockSource())return!1;const a=Vh.create(this,r,s);return!!a&&(e.forEach(u=>{u[2]=this.exaggeration()*a.getElevationAt(u[0],u[1],i)}),!0)}getMinMaxForTile(r){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(r);if(!e||!e.dem)return null;const i=e.dem.tree,s=e.tileID,a=1<<r.canonical.z-s.canonical.z;let u=r.canonical.x/a-s.canonical.x,h=r.canonical.y/a-s.canonical.y,m=0;for(let g=0;g<r.canonical.z-s.canonical.z&&!i.leaves[m];g++){u*=2,h*=2;const v=2*Math.floor(h)+Math.floor(u);m=i.childOffsets[m]+v,u%=1,h%=1}return{min:this.exaggeration()*i.minimums[m],max:this.exaggeration()*i.maximums[m]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(r,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(r){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(r){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const r=this.visibleDemTiles;if(r.length===0)return null;let e=!1,i=Number.MAX_VALUE,s=Number.MIN_VALUE;for(const a of r){const u=this.getMinMaxForTile(a.tileID);u&&(i=Math.min(i,u.min),s=Math.max(s,u.max),e=!0)}return e?{min:i,max:s}:null}},o.du=vw,o.dv=jl,o.dw=function(r,e){return[Math.pow(r[0],2.2)*e,Math.pow(r[1],2.2)*e,Math.pow(r[2],2.2)*e]},o.dx=oe,o.dy=function(r,e){var i=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=i,r[2]=0,r[3]=-i,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},o.dz=Kn,o.e=An,o.e$=NS,o.e0=256,o.e1=r0,o.e2=Yo,o.e3=ct,o.e4=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r},o.e5=ta,o.e6=Vc,o.e7=function(r,e,i,s,a){return Te((r-e)/(i-e)*(a-s)+s,s,a)},o.e8=$o,o.e9=function(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=e[4],m=e[5],g=e[6],v=e[7],w=e[8],S=w*h-m*v,A=-w*u+m*g,D=v*u-h*g,R=i*S+s*A+a*D;return R?(r[0]=S*(R=1/R),r[1]=(-w*s+a*v)*R,r[2]=(m*s-a*h)*R,r[3]=A*R,r[4]=(w*i-a*g)*R,r[5]=(-m*i+a*u)*R,r[6]=D*R,r[7]=(-v*i+s*g)*R,r[8]=(h*i-s*u)*R,r):null},o.eA=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},o.eB=un,o.eC=N,o.eD=Yn,o.eE=function(r,e,i,s){return r[0]=e,r[1]=i,r[2]=s,r},o.eF=function([r,e,i]){const s=Math.hypot(r,e,i),a=Math.atan2(r,i),u=.5*Math.PI-Math.acos(-e/s);return new V(Z(a),Z(u))},o.eG=Gr,o.eH=X0,o.eI=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!function(i){if(en==null){const s=i.navigator?i.navigator.userAgent:null;en=!!i.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return en}(r)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},o.eJ=function(r,e){fs=r,Mo=e},o.eK=o0,o.eL=aw,o.eM=function(r){const e=[0,0,0],i=_e(new Float64Array(16));return Se(i,r.pixelMatrix,r.globeMatrix),gr(e,e,i),new ft(e[0],e[1])},o.eN=function(r,e,i=!1){if(to===rp||to===np||to===op)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ks=Io.resolveURL(r),to=rp,sp=e,_h(),i||Dm()},o.eO=Ml,o.eP=function(){O_().acquire(iv)},o.eQ=function(){const r=Kp;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(iv),Kp=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},o.eR=nu,o.eS=function(r){const e=vd();if(!e)return;const i=e.delete(Co);r&&i.then(()=>r()).catch(r)},o.eT=Yp,o.eU=MS,o.eV=function(r){dv=Io.resolveURL(r),qh||(qh=new Uh(O_(),new Sa)),qh.broadcast("setDracoUrl",dv)},o.eW=PS,o.eX=function(r){Hh=Io.resolveURL(r),qh||(qh=new Uh(O_(),new Sa)),qh.broadcast("setMeshoptUrl",Hh)},o.eY=Tt,o.eZ=Ul,o.e_=Ss,o.ea=bm,o.eb=ho,o.ec=He,o.ed=class{constructor(r,e,i,s){this.context=r,this.format=s,this.size=i,this.texture=r.gl.createTexture();const[a,u,h]=this.size,{gl:m}=r;m.bindTexture(m.TEXTURE_3D,this.texture),r.pixelStoreUnpackFlipY.set(!1),r.pixelStoreUnpack.set(1),r.pixelStoreUnpackPremultiplyAlpha.set(!1),m.texImage3D(m.TEXTURE_3D,0,this.format,a,u,h,0,H0(this.format),q0(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:s}=i;s.bindTexture(s.TEXTURE_3D,this.texture),r!==this.minFilter&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MAG_FILTER,r),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_S,e),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},o.ee=function(r,e){if(r===e){var i=e[1],s=e[2],a=e[3],u=e[6],h=e[7],m=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=i,r[6]=e[9],r[7]=e[13],r[8]=s,r[9]=u,r[11]=e[14],r[12]=a,r[13]=h,r[14]=m}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r},o.ef=Y0,o.eg=mi,o.eh=[1,1,1],o.ei=function(r,e,i,s){var a=new fe(4);return a[0]=r,a[1]=e,a[2]=i,a[3]=s,a},o.ej=Br,o.ek=function(r,e,i,s){var a=e[0],u=e[1],h=e[2],m=e[3];return r[0]=a+s*(i[0]-a),r[1]=u+s*(i[1]-u),r[2]=h+s*(i[2]-h),r[3]=m+s*(i[3]-m),r},o.el=Vh,o.em=jh,o.en=ea,o.eo=Ga,o.ep=function(r,e,i,s,a,u,h,m,g,v,w,S,A,D,R,O){var $=new fe(16);return $[0]=r,$[1]=e,$[2]=i,$[3]=s,$[4]=a,$[5]=u,$[6]=h,$[7]=m,$[8]=g,$[9]=v,$[10]=w,$[11]=S,$[12]=A,$[13]=D,$[14]=R,$[15]=O,$},o.eq=B,o.er=Ah,o.es=vp,o.et=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new ft(1/0,1/0),max:new ft(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(r,e=!1){const i=Xw(new ft(0,0),new ft(_t,_t),r),s=[];if(e&&!x0(i,this._globalClipBounds))return s;for(const a of this._activeRegions){if(a.hiddenByOverlap||!x0(i,a))continue;const u=u3(a.min,a.max,r);s.push({min:u.min,max:u.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId,order:a.order,clipMask:a.clipMask,clipScope:a.clipScope})}return s}setSources(r){this._setSources(r.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const s of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(s).buckets[e.layer];a&&a.updateFootprints(s.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(r){const e=r.getFootprints();if(e.length===0)return;const i=r.getOrder(),s=r.getClipMask(),a=r.getClipScope();for(const u of e){if(!u.footprint)continue;const h=Xw(u.footprint.min,u.footprint.max,u.id);this._activeRegions.push({min:h.min,max:h.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:u.id,footprint:u.footprint,order:i,clipMask:s,clipScope:a})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||c_(e.min,i.min)||c_(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(s,a){const u=(h,m)=>h+m;return s.length-a.length||s.reduce(u,"").localeCompare(a.reduce(u,""))}(e.clipScope,i.clipScope));let r=this._activeRegions.length!==this._prevRegions.length;if(!r){let e=0;for(;!r&&e!==this._activeRegions.length;){const i=this._activeRegions[e],s=this._prevRegions[e];r=i.priority!==s.priority||!Ww(i,s)||i.order!==s.order||i.clipMask!==s.clipMask||!ds(i.clipScope,s.clipScope),++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==l_&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const s=this._activeRegions;if(i>=s.length)return i;const a=s[i].priority;for(;i<s.length&&s[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,s=e(i);for(;i!==s;){let a=i;const u=i;for(;a!==s;){const h=this._activeRegions[a];h.hiddenByOverlap=!1;for(let m=0;m<u;m++){const g=this._activeRegions[m];if(!g.hiddenByOverlap&&h.order===l_&&x0(h,g)&&(h.hiddenByOverlap=Kw(h.footprint,h.tileId,g.footprint,g.tileId),h.hiddenByOverlap))break}++a}i=s,s=e(i)}}}}_setSources(r){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=r.length-1;e>=0;e--)this._addSource(r[e]);this._computeReplacement()}},o.eu=class{constructor(r){this._createGrid(r),this._createPoles(r)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const r of this._poleSegments)r.destroy();for(const r of this._gridSegments)r.withSkirts.destroy(),r.withoutSkirts.destroy()}_fillGridMeshWithLods(r,e){const i=new xs,s=new fn,a=[],u=r+1+2,h=e[0]+1,m=e[0]+1+(1+e.length),g=(v,w,S)=>{let A=v===u-1?v-2:v===0?v:v-1;return A+=S?24575:0,[A,w]};for(let v=0;v<u;++v)i.emplaceBack(...g(v,0,!0));for(let v=0;v<h;++v)for(let w=0;w<u;++w)i.emplaceBack(...g(w,v,(w===0||w===u-1)&&!0));for(let v=0;v<e.length;++v){const w=e[v];for(let S=0;S<u;++S)i.emplaceBack(...g(S,w,!0))}for(let v=0;v<e.length;++v){const w=s.length,S=e[v]+1+2,A=new fn;for(let O=0;O<S-1;O++){const $=O===S-2,H=$?u*(m-e.length+v-O):u;for(let K=0;K<u-1;K++){const W=O*u+K;O===0||$||K===0||K===u-2?(A.emplaceBack(W+1,W,W+H),A.emplaceBack(W+H,W+H+1,W+1)):(s.emplaceBack(W+1,W,W+H),s.emplaceBack(W+H,W+H+1,W+1))}}const D=Cr.simpleSegment(0,w,i.length,s.length-w);for(let O=0;O<A.uint16.length;O+=3)s.emplaceBack(A.uint16[O],A.uint16[O+1],A.uint16[O+2]);const R=Cr.simpleSegment(0,w,i.length,s.length-w);a.push({withoutSkirts:D,withSkirts:R})}return{vertices:i,indices:s,segments:a}}_createGrid(r){const e=this._fillGridMeshWithLods(E,I);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,Qo.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new fn;for(let h=0;h<=E;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new ta,s=new ta,a=new ta,u=new ta;this._poleSegments=[];for(let h=0,m=0;h<_;h++){const g=360/(1<<h);i.emplaceBack(0,-f,0,.5,0),s.emplaceBack(0,-f,0,.5,1),a.emplaceBack(0,-f,0,.5,.5),u.emplaceBack(0,-f,0,.5,.5);for(let v=0;v<=E;v++){let w=v/E,S=0;const A=Nt(0,g,w),[D,R,O]=z(DL,RL,A,f);i.emplaceBack(D,R,O,w,S),s.emplaceBack(D,R,O,w,1-S);const $=U(A);w=.5+.5*Math.sin($),S=.5+.5*Math.cos($),a.emplaceBack(D,R,O,w,S),u.emplaceBack(D,R,O,w,1-S)}this._poleSegments.push(Cr.simpleSegment(m,0,66,64)),m+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,io,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(s,io,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(a,io,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(u,io,!1)}getGridBuffers(r,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[r].withSkirts:this._gridSegments[r].withoutSkirts]}getPoleBuffers(r,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[r]]}},o.ev=l_,o.ew=pe,o.ex=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},o.ey=we,o.ez=ht,o.f=function(r){return r.indexOf("mapbox:")===0},o.f0=jS,o.f1=w2,o.f2=Kc,o.f3="hd_road_elevation",o.f4=m0,o.f5=ni,o.f6=Qc,o.f7=L0,o.f8=tu,o.f9=function(r,e,i,s,a,u,h,m=1,g,v){r.createArrays(),r.tilePixelRatio=_t/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const w=r.layers[0].layout,S=r.layers[0]._unevaluatedLayout._values,A={};A.scaleFactor=m,A.textSizeScaleRange=w.get("text-size-scale-range"),A.iconSizeScaleRange=w.get("icon-size-scale-range");const[D,R]=A.textSizeScaleRange,[O,$]=A.iconSizeScaleRange;A.textScaleFactor=Te(A.scaleFactor,D,R),A.iconScaleFactor=Te(A.scaleFactor,O,$);const H=S["text-size"],K=S["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:he,maxZoom:ye}=r.textSizeData;A.compositeTextSizes=[H.possiblyEvaluate(new Wi(he),u),H.possiblyEvaluate(new Wi(ye),u)]}if(r.iconSizeData.kind==="composite"){const{minZoom:he,maxZoom:ye}=r.iconSizeData;A.compositeIconSizes=[K.possiblyEvaluate(new Wi(he),u),K.possiblyEvaluate(new Wi(ye),u)]}A.layoutTextSize=H.possiblyEvaluate(new Wi(h+1),u),A.layoutIconSize=K.possiblyEvaluate(new Wi(h+1),u),A.textMaxSize=H.possiblyEvaluate(new Wi(18),u);const W=w.get("symbol-placement"),F=w.get("text-rotation-alignment")==="map"&&W!=="point",q=w.get("text-size");let Y=!1;const ee=[];for(const he of r.features){const ye=w.get("text-font").evaluate(he,{},u).join(","),ve=q.evaluate(he,{},u)*A.textScaleFactor,Ce=A.layoutTextSize.evaluate(he,{},u)*A.textScaleFactor,Ue=A.layoutIconSize.evaluate(he,{},u)*A.iconScaleFactor,et={horizontal:{},vertical:void 0},Ye=he.text;let Qe,ot=[0,0];if(Ye){const Pt=Ye.toString(),Ht=w.get("text-letter-spacing").evaluate(he,{},u)*xn,ii=w.get("text-line-height").evaluate(he,{},u)*xn,oi=Uy(Pt)?Ht:0,fi=w.get("text-anchor").evaluate(he,{},u),ci=w.get("text-variable-anchor");if(!ci){const te=w.get("text-radial-offset").evaluate(he,{},u);if(te)ot=aT(fi,[te*xn,O0]);else{const Ge=w.get("text-offset").evaluate(he,{},u);ot=[Ge[0]*xn,Ge[1]*xn]}}let ai=F?"center":w.get("text-justify").evaluate(he,{},u);const tr=W==="point",ur=tr?w.get("text-max-width").evaluate(he,{},u)*xn:1/0,J=te=>{r.allowVerticalPlacement&&ip(Pt)&&(et.vertical=D0(Ye,e,i,a,ye,ur,ii,fi,te,oi,ot,lo.vertical,!0,Ce,ve,g))};if(!F&&ci){const te=ai==="auto"?ci.map(pt=>F0(pt)):[ai];let Ge=!1;for(let pt=0;pt<te.length;pt++){const vt=te[pt];if(!et.horizontal[vt])if(Ge)et.horizontal[vt]=et.horizontal[0];else{const yt=D0(Ye,e,i,a,ye,ur,ii,"center",vt,oi,ot,lo.horizontal,!1,Ce,ve,g);yt&&(et.horizontal[vt]=yt,Ge=yt.positionedLines.length===1)}}J("left")}else{if(ai==="auto"&&(ai=F0(fi)),tr||w.get("text-writing-mode").indexOf("horizontal")>=0||!ip(Pt)){const te=D0(Ye,e,i,a,ye,ur,ii,fi,ai,oi,ot,lo.horizontal,!1,Ce,ve,g);te&&(et.horizontal[ai]=te)}J(tr?"left":ai)}}let je,Je,Fe,Ve,lt,ut,zt,Et=!1;if(he.icon&&he.icon.hasPrimary()){const Pt=cT(he.icon,r.iconSizeData,S["icon-size"],u,r.zoom,he,g,A.iconScaleFactor);je=Pt.iconPrimary,Fe=Pt.iconSecondary;const Ht=je.toString();if(Je=s.get(Ht),Je&&(lt=w.get("icon-offset").evaluate(he,{},u),ut=w.get("icon-anchor").evaluate(he,{},u),zt=w.get("icon-text-fit").evaluate(he,{},u),Qe=W3(a.get(Ht),Fe?a.get(Fe.toString()):void 0,lt,ut),Et=Je.sdf,r.sdfIcons===void 0?r.sdfIcons=Je.sdf:r.sdfIcons!==Je.sdf&&yi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Je.pixelRatio!==r.pixelRatio||w.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),Fe){const ii=Fe.toString();Ve=s.get(ii)}}Y=Y||!(!he.icon||!he.icon.hasSecondary());const gt=B0(et.horizontal)||et.vertical;r.iconsInText||(r.iconsInText=!!gt&>.iconsInText);const at=Ce*A.textScaleFactor/xn,{defaultShapedIcon:Xt,verticallyShapedIcon:Mt}=rk(r,Qe,w,he,u,et,at,lt,zt);zt!=="none"&&Qe&&(H2(Qe)||q2(Qe))&&(y_(0,Je,je,Qe,Xt,zt,v,s,a),y_(0,Ve,Fe,Qe,Xt,zt,v,s,a),Mt&&(y_(0,Je,je,Qe,Mt,zt,v,s,a),y_(0,Ve,Fe,Qe,Mt,zt,v,s,a))),Qe=Xt,ee.push({feature:he,shapedTextOrientations:et,shapedText:gt,shapedIcon:Qe,iconPrimary:je,iconSecondary:Fe,iconOffset:lt,iconAnchor:ut,verticallyShapedIcon:Mt,layoutTextSize:Ce,layoutIconSize:Ue,textOffset:ot,isSDFIcon:Et,iconTextFit:zt})}return{featureData:ee,sizes:A,hasAnySecondaryIcon:Y,textAlongLine:F,symbolPlacement:W}},o.fa=tT,o.fb=function(r,e,i,s,a,u,h,m,g,v){const{featureData:w,hasAnySecondaryIcon:S,sizes:A,textAlongLine:D,symbolPlacement:R}=e;for(const O of w){const{shapedIcon:$,verticallyShapedIcon:H,feature:K,shapedTextOrientations:W,shapedText:F,layoutTextSize:q,textOffset:Y,isSDFIcon:ee,iconPrimary:he,iconSecondary:ye,iconTextFit:ve,iconOffset:Ce}=O;uT($,v.iconPositions,he,ye),uT(H,v.iconPositions,he,ye),ik(W,v.iconPositions),(F||$)&&nk(r,K,W,$,H,g,A,q,0,Y,ee,s,a,h,m,S,ve,Ce,D,R)}i&&r.generateCollisionDebugBuffers(u,r.collisionBoxArray,A.textScaleFactor)},o.fc=$l,o.fd=$_,o.fe=lc,o.ff=Rw,o.fg=O2,o.fh=Zo,o.fi=function(r){let e=0;if(new Uint32Array(r,0,1)[0]!==RS){const i=new Uint32Array(r,0,7),[,,s,a,u,h]=i;e=i.byteLength+a+u+h+u,(s!==r.byteLength||e>=r.byteLength)&&yi("Invalid b3dm header information.")}return OS(r,e)},o.fj=function(r,e){const i=BS(r);for(const s of i){for(const a of s.meshes)zO(a);s.lights&&(s.lightMeshIndex=s.meshes.length,s.meshes.push(LO(s.lights,e)))}return i},o.fk=k_,o.fl=lr,o.fm=JT,o.fn=vo,o.fo=function(r){_s(),mo!=null&&mo.then(e=>{e.keys().then(i=>{for(let s=0;s<i.length-r;s++)e.delete(i[s]).catch(a=>yi(a.message))}).catch(i=>yi(i.message))}).catch(e=>yi(e.message))},o.g=function(r,e){return ll(Oe(r,{method:"GET"}),e)},o.h=Wo,o.i=function(r){return An.API_STYLE_REGEX.test(r)&&!xa(r)},o.j=function(r){return decodeURIComponent(atob(r).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},o.k=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},o.l=Oe,o.m=xd,o.n=function(r,e){return ll(Oe(r,{type:"json"}),e)},o.o=ul,o.p=function(r,e){return ll(Oe(r,{method:"POST"}),e)},o.q=Io,o.r=In,o.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},o.t=gd,o.u=function(){return function r(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,r)}()},o.v=function(r){return!!r&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)},o.w=yi,o.x=function(){return rv||(rv=new nu),rv},o.y=lv,o.z=Td}),k(["./shared"],function(o){function re($e){const U=$e?$e.url.toString():void 0;return U?performance.getEntriesByName(U):[]}function fe($e){if(typeof $e=="number"||typeof $e=="boolean"||typeof $e=="string"||$e==null)return JSON.stringify($e);if(Array.isArray($e)){let Z="[";for(const se of $e)Z+=`${fe(se)},`;return`${Z}]`}let U="{";for(const Z of Object.keys($e).sort())U+=`${Z}:${fe($e[Z])},`;return`${U}}`}function xe($e){let U="";for(const Z of o.bu)($e.type!=="model"||Z!=="minzoom"&&Z!=="maxzoom")&&(U+=`/${fe($e[Z])}`);return U}class oe{constructor(U){this.keyCache={},this._layers={},this._layerConfigs={},U&&this.replace(U)}replace(U,Z){this._layerConfigs={},this._layers={},this.update(U,[],Z)}update(U,Z,se){this._options=se;for(const pe of U)this._layerConfigs[pe.id]=pe,(this._layers[pe.id]=o.dc(pe,this.scope,null,this._options)).compileFilter(se),this.keyCache[pe.id]&&delete this.keyCache[pe.id];for(const pe of Z)delete this.keyCache[pe],delete this._layerConfigs[pe],delete this._layers[pe];this.familiesBySource={};const ge=function(pe,we){const Te={};for(let Be=0;Be<pe.length;Be++){const qe=pe[Be];let Oe=we&&we[qe.id];Oe||(qe.type==="symbol"?Oe=qe.id:(Oe=xe(qe),qe.type==="line"&&qe.paint&&function bt(Rt){return typeof Rt=="string"&&Rt==="line-progress"||(Array.isArray(Rt)?Rt.some(bt):!(!Rt||typeof Rt!="object")&&Object.values(Rt).some(bt))}(qe.paint["line-width"])&&(Oe+=`/${fe(qe.paint["line-width"])}`))),we&&(we[qe.id]=Oe);let mt=Te[Oe];mt||(mt=Te[Oe]=[]),mt.push(qe)}const Ae=[];for(const Be in Te)Ae.push(Te[Be]);return Ae}(Object.values(this._layerConfigs),this.keyCache);for(const pe of ge){const we=pe.map(mt=>this._layers[mt.id]),Te=we[0];if(Te.visibility==="none")continue;const Ae=Te.source||"";let Be=this.familiesBySource[Ae];Be||(Be=this.familiesBySource[Ae]={});const qe=Te.sourceLayer||"_geojsonTileLayer";let Oe=Be[qe];Oe||(Oe=Be[qe]=[]),Oe.push(we)}}}const Ee=1*o.e_;class be{constructor(U){const Z={},se=[];for(const Te in U){const Ae=U[Te],Be=Z[Te]={};for(const qe in Ae.glyphs){const Oe=Ae.glyphs[+qe];if(!Oe||Oe.bitmap.width===0||Oe.bitmap.height===0)continue;const mt=Oe.metrics.localGlyph?Ee:1,bt={x:0,y:0,w:Oe.bitmap.width+2*mt,h:Oe.bitmap.height+2*mt};se.push(bt),Be[qe]=bt}}const{w:ge,h:pe}=o.H(se),we=new o.eZ({width:ge||1,height:pe||1});for(const Te in U){const Ae=U[Te];for(const Be in Ae.glyphs){const qe=Ae.glyphs[+Be];if(!qe||qe.bitmap.width===0||qe.bitmap.height===0)continue;const Oe=Z[Te][Be],mt=qe.metrics.localGlyph?Ee:1;o.eZ.copy(qe.bitmap,we,{x:0,y:0},{x:Oe.x+mt,y:Oe.y+mt},qe.bitmap)}}this.image=we,this.positions=Z}}o.eY(be,"GlyphAtlas");class Pe{constructor(U){this.tileID=new o.aM(U.tileID.overscaledZ,U.tileID.wrap,U.tileID.canonical.z,U.tileID.canonical.x,U.tileID.canonical.y),this.tileZoom=U.tileZoom,this.uid=U.uid,this.zoom=U.zoom,this.lut=U.lut,this.canonical=U.tileID.canonical,this.pixelRatio=U.pixelRatio,this.tileSize=U.tileSize,this.source=U.source,this.scope=U.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=U.showCollisionBoxes,this.collectResourceTiming=!!U.request&&U.request.collectResourceTiming,this.promoteId=U.promoteId,this.isSymbolTile=U.isSymbolTile,this.tileTransform=o.aW(U.tileID.canonical,U.projection),this.projection=U.projection,this.worldview=U.worldview,this.localizableLayerIds=U.localizableLayerIds,this.brightness=U.brightness,this.extraShadowCaster=!!U.extraShadowCaster,this.tessellationStep=U.tessellationStep,this.scaleFactor=U.scaleFactor}parse(U,Z,se,ge,pe,we){this.status="parsing",this.data=U,this.collisionBoxArray=new o.b0;const Te=new o.e$(Object.keys(U.layers).sort()),Ae=new o.f0(this.tileID,this.promoteId);Ae.bucketLayerIDs=[];const Be={},qe=new o.f1(256,256),Oe={featureIndex:Ae,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:qe,availableImages:se,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},mt=Z.familiesBySource[this.source];for(const Li in mt){const or=U.layers[Li];if(!or)continue;let lr=!1,qr=!1,en=!1;for(const Dn of mt[Li])Dn[0].type==="symbol"?lr=!0:qr=!0,Dn[0].is3D()&&Dn[0].type!=="model"&&(en=!0);if(this.extraShadowCaster&&!en||this.isSymbolTile===!0&&!lr||this.isSymbolTile===!1&&!qr)continue;or.version===1&&o.w(`Vector tile source "${this.source}" layer "${Li}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const pn=Te.encode(Li),bn=[];let ps=!1;for(let Dn=0,Rn=0;Dn<or.length;Dn++){const yn=or.feature(Dn),An=Ae.getId(yn,Li);if(this.localizableLayerIds&&this.localizableLayerIds.has(Li)){const Wo=yn.properties?yn.properties.worldview:null;if(this.worldview&&typeof Wo=="string")if(Wo==="all")yn.properties.$localized=!0;else{if(!Wo.split(",").includes(this.worldview))continue;yn.properties.$localized=!0,yn.properties.worldview=this.worldview}}!ps&&yn.properties&&yn.properties.hasOwnProperty(o.f2)&&(ps=!0),bn.push({feature:yn,id:An,index:Rn,sourceLayerIndex:pn}),Rn++}ps&&!Oe.elevationFeatures&&U.layers.hasOwnProperty(o.f3)&&(Oe.elevationFeatures=o.f4.parseFrom(U.layers[o.f3],this.canonical));for(const Dn of mt[Li]){const Rn=Dn[0];(!this.extraShadowCaster||Rn.is3D()&&Rn.type!=="model")&&(this.isSymbolTile!==void 0&&Rn.type==="symbol"!==this.isSymbolTile||Rn.minzoom&&this.zoom<Math.floor(Rn.minzoom)||Rn.maxzoom&&this.zoom>=Rn.maxzoom||Rn.visibility!=="none"&&(_e(Dn,this.zoom,Oe.brightness,se),(Be[Rn.id]=Rn.createBucket({index:Ae.bucketLayerIDs.length,layers:Dn,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:pn,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:ge})).populate(bn,Oe,this.tileID.canonical,this.tileTransform),Ae.bucketLayerIDs.push(Dn.map(yn=>o.C(yn.id,yn.scope)))))}}let bt,Rt,Qt,ni,hi,_i;qe.trim();const Rr={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},yi=()=>{if(bt)return this.status="done",we(bt);if(this.extraShadowCaster)this.status="done",we(null,{buckets:Object.values(Be).filter(Li=>!Li.isEmpty()),featureIndex:Ae,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Oe.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Rt&&Qt&&ni){const Li=new be(Rt),or=new Map;for(const[en,pn]of Qt.entries()){const{imagePosition:bn}=o.f7(en,pn,o.f8);or.set(en,bn)}const lr={};for(const en in Be){const pn=Be[en];pn instanceof o.b1&&(_e(pn.layers,this.zoom,Oe.brightness,se),lr[en]=o.f9(pn,Rt,Li.positions,Qt,or,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,hi))}const qr={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(pe,Qt,hi,()=>{qr.iconsPending=!1,nr(lr,Li,qr)}),this.rasterizeIfNeeded(pe,ni,_i,()=>{qr.patternsPending=!1,nr(lr,Li,qr)})}},nr=(Li,or,lr,qr)=>{if(lr.iconsPending||lr.patternsPending)return;const en=new o.fa(Qt,ni,this.lut);for(const pn in Be){const bn=Be[pn];if(pn in Li)o.fb(bn,Li[pn],this.showCollisionBoxes,se,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Qt,en);else if(bn.hasPattern&&(bn instanceof o.b7||bn instanceof o.b8||bn instanceof o.dV)){_e(bn.layers,this.zoom,Oe.brightness,se);const ps=Object.fromEntries(en.patternPositions);bn.addFeatures(Oe,this.tileID.canonical,ps,se,this.tileTransform,this.brightness)}}this.status="done",we(null,{buckets:Object.values(Be).filter(pn=>!pn.isEmpty()),featureIndex:Ae,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:or.image,lineAtlas:qe,imageAtlas:en,brightness:Oe.brightness})};if(!this.extraShadowCaster){const Li=o.f5(Oe.glyphDependencies,qr=>Object.keys(qr).map(Number));Object.keys(Li).length?pe.send("getGlyphs",{uid:this.uid,stacks:Li,scope:this.scope},(qr,en)=>{bt||(bt=qr,Rt=en,yi())},void 0,!1,Rr):Rt={};const or=Array.from(Oe.iconDependencies.keys()).map(qr=>o.I.parse(qr));or.length?pe.send("getImages",{images:or,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(qr,en)=>{bt||(bt=qr,Qt=new Map,hi=this.updateImageMapAndGetImageTaskQueue(Qt,en,Oe.iconDependencies),yi())},void 0,!1,Rr):(Qt=new Map,hi=new Map);const lr=Array.from(Oe.patternDependencies.keys()).map(qr=>o.I.parse(qr));lr.length?pe.send("getImages",{images:lr,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(qr,en)=>{bt||(bt=qr,ni=new Map,_i=this.updateImageMapAndGetImageTaskQueue(ni,en,Oe.patternDependencies),yi())},void 0,!1,Rr):(ni=new Map,_i=new Map)}if(Oe.elevationFeatures&&Oe.elevationFeatures.length>0){const Li=[];for(const lr of Object.values(Be))if(lr instanceof o.b8){const qr=lr.getUnevaluatedPortalGraph();qr&&Li.push(qr)}const or=o.f6.evaluate(Li);for(const lr of Object.values(Be))lr instanceof o.b8&&lr.setEvaluatedPortalGraph(or)}yi()}rasterizeIfNeeded(U,Z,se,ge){Array.from(Z.values()).some(pe=>pe.usvg)?this.rasterize(U,Z,se,ge):ge()}updateImageMapAndGetImageTaskQueue(U,Z,se){const ge=new Map;for(const pe of Z.keys()){const we=se.get(pe)||[];for(const Te of we){const Ae=Te.toString(),Be=Z.get(Te.id.toString());Be.usvg?ge.has(Ae)||(ge.set(Ae,Te),U.set(Ae,Object.assign({},Be))):U.set(Ae,Be)}}return ge}rasterize(U,Z,se,ge){this.rasterizeTask=U.send("rasterizeImages",{scope:this.scope,tasks:se},(pe,we)=>{if(!pe)for(const[Te,Ae]of we.entries()){const Be=Object.assign(Z.get(Te),{data:Ae});Z.set(Te,Be)}ge()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function _e($e,U,Z,se){const ge=new o.aa(U,{brightness:Z});for(const pe of $e)pe.recalculate(ge,se)}class ze extends o.E{constructor(U,Z,se,ge,pe,we,Te){super(),this.actor=U,this.layerIndex=Z,this.availableImages=se,this.availableModels=ge,this.loadVectorData=we||o.aJ,this.loading={},this.loaded={},this.deduped=new o.aI(U.scheduler),this.isSpriteLoaded=pe,this.scheduler=U.scheduler,this.brightness=Te}loadTile(U,Z){const se=U.uid,ge=U&&U.request,pe=ge&&ge.collectResourceTiming,we=this.loading[se]=new Pe(U);we.abort=this.loadVectorData(U,(Te,Ae)=>{const Be=!this.loading[se];if(delete this.loading[se],we.cancelRasterize(),Be||Te||!Ae)return we.status="done",Be||(this.loaded[se]=we),Z(Te);const qe=Ae.rawData,Oe={};Ae.expires&&(Oe.expires=Ae.expires),Ae.cacheControl&&(Oe.cacheControl=Ae.cacheControl),we.vectorTile=Ae.vectorTile||new o.fc.VectorTile(new o.bq(qe));const mt=()=>{we.parse(we.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(bt,Rt)=>{if(bt||!Rt)return Z(bt);const Qt={};if(pe){const ni=re(ge);ni.length>0&&(Qt.resourceTiming=JSON.parse(JSON.stringify(ni)))}Z(null,o.l({rawTileData:qe.slice(0)},Rt,Oe,Qt))})};this.isSpriteLoaded?mt():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(mt,{type:"parseTile",isSymbolTile:U.isSymbolTile,zoom:U.tileZoom}):mt()}),this.loaded=this.loaded||{},this.loaded[se]=we})}reloadTile(U,Z){const se=this.loaded,ge=U.uid;if(se&&se[ge]){const pe=se[ge];pe.scaleFactor=U.scaleFactor,pe.showCollisionBoxes=U.showCollisionBoxes,pe.projection=U.projection,pe.brightness=U.brightness,pe.tileTransform=o.aW(U.tileID.canonical,U.projection),pe.extraShadowCaster=U.extraShadowCaster,pe.lut=U.lut;const we=(Te,Ae)=>{const Be=pe.reloadCallback;Be&&(delete pe.reloadCallback,pe.parse(pe.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Be)),Z(Te,Ae)};pe.status==="parsing"?pe.reloadCallback=we:pe.status==="done"&&(pe.vectorTile?pe.parse(pe.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,we):we())}else Z(null,void 0)}abortTile(U,Z){const se=U.uid,ge=this.loading[se];ge&&(ge.abort&&ge.abort(),delete this.loading[se]),Z()}removeTile(U,Z){const se=this.loaded,ge=U.uid;se&&se[ge]&&delete se[ge],Z()}}class Se{loadTile(U,Z){const{uid:se,encoding:ge,rawImageData:pe,padding:we}=U,Te=ImageBitmap&&pe instanceof ImageBitmap?this.getImageData(pe,we):pe;Z(null,new o.fd(se,Te,ge,we<1))}reloadTile(U,Z){Z(null,null)}abortTile(U,Z){Z()}removeTile(U,Z){Z()}getImageData(U,Z){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(U.width,U.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=U.width,this.offscreenCanvas.height=U.height,this.offscreenCanvasContext.drawImage(U,0,0,U.width,U.height);const se=this.offscreenCanvasContext.getImageData(-Z,-Z,U.width+2*Z,U.height+2*Z);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),se}}o.bp.setPbf(o.bq);class st{constructor(U){this._mrt=new o.bp(U.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=U.uid,this.tileID=U.tileID,this.source=U.source}parse(U,Z){const se=this._mrt;this.status="parsing",this._entireBuffer=U;try{se.parseHeader(U),this._isHeaderLoaded=!0;const ge=[];for(const pe in se.layers){const we=se.getLayer(pe),Te=we.getDataRange(we.getBandList()),Ae=se.createDecodingTask(Te),Be=U.slice(Te.firstByte,Te.lastByte+1),qe=o.bp.performDecoding(Be,Ae).then(Oe=>Ae.complete(null,Oe)).catch(Oe=>Ae.complete(Oe,null));ge.push(qe)}Promise.allSettled(ge).then(()=>Z(null,se)).catch(pe=>Z(pe))}catch(ge){Z(ge)}}}class nt{constructor(U){this.actor=U,this.loading={},this.loaded={}}loadTile(U,Z){const se=U.uid,ge=U.request,pe=this.loading[se]=new st(U),{cancel:we}=o.br(ge,(Te,Ae,Be,qe)=>{const Oe=!this.loading[se];if(delete this.loading[se],Oe||Te||!Ae)return pe.status="done",Oe||(this.loaded[se]=pe),Z(Te);pe.parse(Ae,(mt,bt)=>{if(mt||!bt)return Z(mt);Z(null,bt,Be,qe)}),this.loaded[se]=pe});pe.abort=we}reloadTile(U,Z){Z(null,void 0)}abortTile(U,Z){const se=U.uid,ge=this.loading[se];ge&&(ge.abort&&ge.abort(),delete this.loading[se]),Z()}removeTile(U,Z){const se=U.uid;this.loaded[se]&&delete this.loaded[se],Z()}decodeRasterArray(U,Z){o.bp.performDecoding(U.buffer,U.task).then(se=>Z(null,se)).catch(se=>Z(se))}}const Xe=o.fc.VectorTileFeature.prototype.toGeoJSON;class ct{constructor(U){this._feature=U,this.extent=o.aj,this.type=U.type,this.properties=U.tags,"id"in U&&!isNaN(U.id)&&(this.id=parseInt(U.id,10))}loadGeometry(){if(this._feature.type===1){const U=[];for(const Z of this._feature.geometry)U.push([new o.P(Z[0],Z[1])]);return U}{const U=[];for(const Z of this._feature.geometry){const se=[];for(const ge of Z)se.push(new o.P(ge[0],ge[1]));U.push(se)}return U}}toGeoJSON(U,Z,se){return Xe.call(this,U,Z,se)}}class xt{constructor(U){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=o.aj,this.length=U.length,this._features=U}feature(U){return new ct(this._features[U])}}const $t=64/4096,kt=128;class Wt{constructor(){this.features=new Map}clear(){this.features.clear()}load(U=[],Z){for(const se of U){const ge=se.id;if(ge==null)continue;let pe=this.features.get(ge);pe&&this.updateCache(pe,Z),se.geometry?(pe=mi(se),this.updateCache(pe,Z),this.features.set(ge,pe)):this.features.delete(ge),this.updateCache(pe,Z)}}updateCache(U,Z){for(const{canonical:se,uid:ge}of Object.values(Z)){const{z:pe,x:we,y:Te}=se;Ai(U,Math.pow(2,pe),we,Te)&&delete Z[ge]}}getTile(U,Z,se){const ge=Math.pow(2,U),pe=[];for(const we of this.features.values())Ai(we,ge,Z,se)&&pe.push(vi(we,ge,Z,se));return{features:pe}}getFeatures(){return[...this.features.values()]}}function Ai({minX:$e,minY:U,maxX:Z,maxY:se},ge,pe,we){return $e<(pe+1+$t)/ge&&U<(we+1+$t)/ge&&Z>(pe-$t)/ge&&se>(we-$t)/ge}function mi($e){const{id:U,geometry:Z,properties:se}=$e;if(!Z)return;if(Z.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:ge,coordinates:pe}=Z,we={id:U,type:1,geometry:[],tags:se,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Te=we.geometry;if(ge==="Point")bi(pe,Te,we);else if(ge==="MultiPoint")for(const Ae of pe)bi(Ae,Te,we);else if(ge==="LineString")we.type=2,Jt(pe,Te,we);else if(ge==="MultiLineString")we.type=2,Bt(pe,Te,we);else if(ge==="Polygon")we.type=3,Bt(pe,Te,we,!0);else{if(ge!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");we.type=3;for(const Ae of pe)Bt(Ae,Te,we,!0)}return we}function bi([$e,U],Z,se){const ge=o.ay($e);let pe=o.aH(U);pe=pe<0?0:pe>1?1:pe,Z.push(ge,pe),se.minX=Math.min(se.minX,ge),se.minY=Math.min(se.minY,pe),se.maxX=Math.max(se.maxX,ge),se.maxY=Math.max(se.maxY,pe)}function Jt($e,U,Z,se=!1,ge=!1){const pe=[];for(const we of $e)bi(we,pe,Z);U.push(pe),se&&function(we,Te){let Ae=0;for(let Be=0,qe=we.length,Oe=qe-2;Be<qe;Oe=Be,Be+=2)Ae+=(we[Be]-we[Oe])*(we[Be+1]+we[Oe+1]);if(Ae>0===Te)for(let Be=0,qe=we.length;Be<qe/2;Be+=2){const Oe=we[Be],mt=we[Be+1];we[Be]=we[qe-2-Be],we[Be+1]=we[qe-1-Be],we[qe-2-Be]=Oe,we[qe-1-Be]=mt}}(pe,ge)}function Bt($e,U,Z,se=!1){for(let ge=0;ge<$e.length;ge++)Jt($e[ge],U,Z,se,ge===0)}function vi($e,U,Z,se){const{id:ge,type:pe,geometry:we,tags:Te}=$e,Ae=[];if(pe===1)(function(Be,qe,Oe,mt,bt){for(let Rt=0;Rt<Be.length;Rt+=2){const Qt=Math.round(o.aj*(Be[Rt+0]*qe-Oe)),ni=Math.round(o.aj*(Be[Rt+1]*qe-mt));bt.push([Qt,ni])}})(we,U,Z,se,Ae);else for(const Be of we)ri(Be,U,Z,se,Ae);return{id:ge,type:pe,geometry:Ae,tags:Te}}function ri($e,U,Z,se,ge){const pe=-kt,we=o.aj+kt;let Te;for(let Ae=0;Ae<$e.length-2;Ae+=2){let Be=Math.round(o.aj*($e[Ae+0]*U-Z)),qe=Math.round(o.aj*($e[Ae+1]*U-se)),Oe=Math.round(o.aj*($e[Ae+2]*U-Z)),mt=Math.round(o.aj*($e[Ae+3]*U-se));const bt=Oe-Be,Rt=mt-qe;Be<pe&&Oe<pe||(Be<pe?(qe+=Math.round(Rt*((pe-Be)/bt)),Be=pe):Oe<pe&&(mt=qe+Math.round(Rt*((pe-Be)/bt)),Oe=pe),qe<pe&&mt<pe||(qe<pe?(Be+=Math.round(bt*((pe-qe)/Rt)),qe=pe):mt<pe&&(Oe=Be+Math.round(bt*((pe-qe)/Rt)),mt=pe),Be>=we&&Oe>=we||(Be>=we?(qe+=Math.round(Rt*((we-Be)/bt)),Be=we):Oe>=we&&(mt=qe+Math.round(Rt*((we-Be)/bt)),Oe=we),qe>=we&&mt>=we||(qe>=we?(Be+=Math.round(bt*((we-qe)/Rt)),qe=we):mt>=we&&(Oe=Be+Math.round(bt*((we-qe)/Rt)),mt=we),Te&&Be===Te[Te.length-1][0]&&qe===Te[Te.length-1][1]||(Te=[[Be,qe]],ge.push(Te)),Te.push([Oe,mt])))))}}var ui,pr,_r,Ii={exports:{}},$r=function(){if(_r)return Ii.exports;_r=1;var $e=o.fg(),U=function(){if(pr)return ui;pr=1;var qe=o.fe(),Oe=o.ff().VectorTileFeature;function mt(Rt,Qt){this.options=Qt||{},this.features=Rt,this.length=Rt.length}function bt(Rt,Qt){this.id=typeof Rt.id=="number"?Rt.id:void 0,this.type=Rt.type,this.rawGeometry=Rt.type===1?[Rt.geometry]:Rt.geometry,this.properties=Rt.tags,this.extent=Qt||4096}return ui=mt,mt.prototype.feature=function(Rt){return new bt(this.features[Rt],this.options.extent)},bt.prototype.loadGeometry=function(){var Rt=this.rawGeometry;this.geometry=[];for(var Qt=0;Qt<Rt.length;Qt++){for(var ni=Rt[Qt],hi=[],_i=0;_i<ni.length;_i++)hi.push(new qe(ni[_i][0],ni[_i][1]));this.geometry.push(hi)}return this.geometry},bt.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Rt=this.geometry,Qt=1/0,ni=-1/0,hi=1/0,_i=-1/0,Rr=0;Rr<Rt.length;Rr++)for(var yi=Rt[Rr],nr=0;nr<yi.length;nr++){var Li=yi[nr];Qt=Math.min(Qt,Li.x),ni=Math.max(ni,Li.x),hi=Math.min(hi,Li.y),_i=Math.max(_i,Li.y)}return[Qt,hi,ni,_i]},bt.prototype.toGeoJSON=Oe.prototype.toGeoJSON,ui}();function Z(qe){var Oe=new $e;return function(mt,bt){for(var Rt in mt.layers)bt.writeMessage(3,se,mt.layers[Rt])}(qe,Oe),Oe.finish()}function se(qe,Oe){var mt;Oe.writeVarintField(15,qe.version||1),Oe.writeStringField(1,qe.name||""),Oe.writeVarintField(5,qe.extent||4096);var bt={keys:[],values:[],keycache:{},valuecache:{}};for(mt=0;mt<qe.length;mt++)bt.feature=qe.feature(mt),Oe.writeMessage(2,ge,bt);var Rt=bt.keys;for(mt=0;mt<Rt.length;mt++)Oe.writeStringField(3,Rt[mt]);var Qt=bt.values;for(mt=0;mt<Qt.length;mt++)Oe.writeMessage(4,Be,Qt[mt])}function ge(qe,Oe){var mt=qe.feature;mt.id!==void 0&&Oe.writeVarintField(1,mt.id),Oe.writeMessage(2,pe,qe),Oe.writeVarintField(3,mt.type),Oe.writeMessage(4,Ae,mt)}function pe(qe,Oe){var mt=qe.feature,bt=qe.keys,Rt=qe.values,Qt=qe.keycache,ni=qe.valuecache;for(var hi in mt.properties){var _i=mt.properties[hi],Rr=Qt[hi];if(_i!==null){Rr===void 0&&(bt.push(hi),Qt[hi]=Rr=bt.length-1),Oe.writeVarint(Rr);var yi=typeof _i;yi!=="string"&&yi!=="boolean"&&yi!=="number"&&(_i=JSON.stringify(_i));var nr=yi+":"+_i,Li=ni[nr];Li===void 0&&(Rt.push(_i),ni[nr]=Li=Rt.length-1),Oe.writeVarint(Li)}}}function we(qe,Oe){return(Oe<<3)+(7&qe)}function Te(qe){return qe<<1^qe>>31}function Ae(qe,Oe){for(var mt=qe.loadGeometry(),bt=qe.type,Rt=0,Qt=0,ni=mt.length,hi=0;hi<ni;hi++){var _i=mt[hi],Rr=1;bt===1&&(Rr=_i.length),Oe.writeVarint(we(1,Rr));for(var yi=bt===3?_i.length-1:_i.length,nr=0;nr<yi;nr++){nr===1&&bt!==1&&Oe.writeVarint(we(2,yi-1));var Li=_i[nr].x-Rt,or=_i[nr].y-Qt;Oe.writeVarint(Te(Li)),Oe.writeVarint(Te(or)),Rt+=Li,Qt+=or}bt===3&&Oe.writeVarint(we(7,1))}}function Be(qe,Oe){var mt=typeof qe;mt==="string"?Oe.writeStringField(1,qe):mt==="boolean"?Oe.writeBooleanField(7,qe):mt==="number"&&(qe%1!=0?Oe.writeDoubleField(3,qe):qe<0?Oe.writeSVarintField(6,qe):Oe.writeVarintField(5,qe))}return Ii.exports=Z,Ii.exports.fromVectorTileJs=Z,Ii.exports.fromGeojsonVt=function(qe,Oe){Oe=Oe||{};var mt={};for(var bt in qe)mt[bt]=new U(qe[bt].features,Oe),mt[bt].name=bt,mt[bt].version=Oe.version,mt[bt].extent=Oe.extent;return Z({layers:mt})},Ii.exports.GeoJSONWrapper=U,Ii.exports}(),gn=o.fh($r);const Yn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:$e=>$e},ho=Math.fround||(Ui=new Float32Array(1),$e=>(Ui[0]=+$e,Ui[0]));var Ui;const Zi=3,Lr=5,Uo=6;class gr{constructor(U){this.options=Object.assign(Object.create(Yn),U),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(U){const{log:Z,minZoom:se,maxZoom:ge}=this.options;Z&&console.time("total time");const pe=`prepare ${U.length} points`;Z&&console.time(pe),this.points=U;const we=[];for(let Ae=0;Ae<U.length;Ae++){const Be=U[Ae];if(!Be.geometry)continue;const[qe,Oe]=Be.geometry.coordinates,mt=ho(Qi(qe)),bt=ho(Ei(Oe));we.push(mt,bt,1/0,Ae,-1,1),this.options.reduce&&we.push(0)}let Te=this.trees[ge+1]=this._createTree(we);Z&&console.timeEnd(pe);for(let Ae=ge;Ae>=se;Ae--){const Be=+Date.now();Te=this.trees[Ae]=this._createTree(this._cluster(Te,Ae)),Z&&console.log("z%d: %d clusters in %dms",Ae,Te.numItems,+Date.now()-Be)}return Z&&console.timeEnd("total time"),this}getClusters(U,Z){let se=((U[0]+180)%360+360)%360-180;const ge=Math.max(-90,Math.min(90,U[1]));let pe=U[2]===180?180:((U[2]+180)%360+360)%360-180;const we=Math.max(-90,Math.min(90,U[3]));if(U[2]-U[0]>=360)se=-180,pe=180;else if(se>pe){const Oe=this.getClusters([se,ge,180,we],Z),mt=this.getClusters([-180,ge,pe,we],Z);return Oe.concat(mt)}const Te=this.trees[this._limitZoom(Z)],Ae=Te.range(Qi(se),Ei(we),Qi(pe),Ei(ge)),Be=Te.data,qe=[];for(const Oe of Ae){const mt=this.stride*Oe;qe.push(Be[mt+Lr]>1?Kn(Be,mt,this.clusterProps):this.points[Be[mt+Zi]])}return qe}getChildren(U){const Z=this._getOriginId(U),se=this._getOriginZoom(U),ge="No cluster with the specified id.",pe=this.trees[se];if(!pe)throw new Error(ge);const we=pe.data;if(Z*this.stride>=we.length)throw new Error(ge);const Te=this.options.radius/(this.options.extent*Math.pow(2,se-1)),Ae=pe.within(we[Z*this.stride],we[Z*this.stride+1],Te),Be=[];for(const qe of Ae){const Oe=qe*this.stride;we[Oe+4]===U&&Be.push(we[Oe+Lr]>1?Kn(we,Oe,this.clusterProps):this.points[we[Oe+Zi]])}if(Be.length===0)throw new Error(ge);return Be}getLeaves(U,Z,se){const ge=[];return this._appendLeaves(ge,U,Z=Z||10,se=se||0,0),ge}getTile(U,Z,se){const ge=this.trees[this._limitZoom(U)],pe=Math.pow(2,U),{extent:we,radius:Te}=this.options,Ae=Te/we,Be=(se-Ae)/pe,qe=(se+1+Ae)/pe,Oe={features:[]};return this._addTileFeatures(ge.range((Z-Ae)/pe,Be,(Z+1+Ae)/pe,qe),ge.data,Z,se,pe,Oe),Z===0&&this._addTileFeatures(ge.range(1-Ae/pe,Be,1,qe),ge.data,pe,se,pe,Oe),Z===pe-1&&this._addTileFeatures(ge.range(0,Be,Ae/pe,qe),ge.data,-1,se,pe,Oe),Oe.features.length?Oe:null}getClusterExpansionZoom(U){let Z=this._getOriginZoom(U)-1;for(;Z<=this.options.maxZoom;){const se=this.getChildren(U);if(Z++,se.length!==1)break;U=se[0].properties.cluster_id}return Z}_appendLeaves(U,Z,se,ge,pe){const we=this.getChildren(Z);for(const Te of we){const Ae=Te.properties;if(Ae&&Ae.cluster?pe+Ae.point_count<=ge?pe+=Ae.point_count:pe=this._appendLeaves(U,Ae.cluster_id,se,ge,pe):pe<ge?pe++:U.push(Te),U.length===se)break}return pe}_createTree(U){const Z=new o.bW(U.length/this.stride|0,this.options.nodeSize,Float32Array);for(let se=0;se<U.length;se+=this.stride)Z.add(U[se],U[se+1]);return Z.finish(),Z.data=U,Z}_addTileFeatures(U,Z,se,ge,pe,we){for(const Te of U){const Ae=Te*this.stride,Be=Z[Ae+Lr]>1;let qe,Oe,mt;if(Be)qe=oo(Z,Ae,this.clusterProps),Oe=Z[Ae],mt=Z[Ae+1];else{const Qt=this.points[Z[Ae+Zi]];qe=Qt.properties;const[ni,hi]=Qt.geometry.coordinates;Oe=Qi(ni),mt=Ei(hi)}const bt={type:1,geometry:[[Math.round(this.options.extent*(Oe*pe-se)),Math.round(this.options.extent*(mt*pe-ge))]],tags:qe};let Rt;Rt=Be||this.options.generateId?Z[Ae+Zi]:this.points[Z[Ae+Zi]].id,Rt!==void 0&&(bt.id=Rt),we.features.push(bt)}}_limitZoom(U){return Math.max(this.options.minZoom,Math.min(Math.floor(+U),this.options.maxZoom+1))}_cluster(U,Z){const{radius:se,extent:ge,reduce:pe,minPoints:we}=this.options,Te=se/(ge*Math.pow(2,Z)),Ae=U.data,Be=[],qe=this.stride;for(let Oe=0;Oe<Ae.length;Oe+=qe){if(Ae[Oe+2]<=Z)continue;Ae[Oe+2]=Z;const mt=Ae[Oe],bt=Ae[Oe+1],Rt=U.within(Ae[Oe],Ae[Oe+1],Te),Qt=Ae[Oe+Lr];let ni=Qt;for(const hi of Rt){const _i=hi*qe;Ae[_i+2]>Z&&(ni+=Ae[_i+Lr])}if(ni>Qt&&ni>=we){let hi,_i=mt*Qt,Rr=bt*Qt,yi=-1;const nr=(Oe/qe<<5)+(Z+1)+this.points.length;for(const Li of Rt){const or=Li*qe;if(Ae[or+2]<=Z)continue;Ae[or+2]=Z;const lr=Ae[or+Lr];_i+=Ae[or]*lr,Rr+=Ae[or+1]*lr,Ae[or+4]=nr,pe&&(hi||(hi=this._map(Ae,Oe,!0),yi=this.clusterProps.length,this.clusterProps.push(hi)),pe(hi,this._map(Ae,or)))}Ae[Oe+4]=nr,Be.push(_i/ni,Rr/ni,1/0,nr,-1,ni),pe&&Be.push(yi)}else{for(let hi=0;hi<qe;hi++)Be.push(Ae[Oe+hi]);if(ni>1)for(const hi of Rt){const _i=hi*qe;if(!(Ae[_i+2]<=Z)){Ae[_i+2]=Z;for(let Rr=0;Rr<qe;Rr++)Be.push(Ae[_i+Rr])}}}}return Be}_getOriginId(U){return U-this.points.length>>5}_getOriginZoom(U){return(U-this.points.length)%32}_map(U,Z,se){if(U[Z+Lr]>1){const we=this.clusterProps[U[Z+Uo]];return se?Object.assign({},we):we}const ge=this.points[U[Z+Zi]].properties,pe=this.options.map(ge);return se&&pe===ge?Object.assign({},pe):pe}}function Kn($e,U,Z){return{type:"Feature",id:$e[U+Zi],properties:oo($e,U,Z),geometry:{type:"Point",coordinates:[(se=$e[U],360*(se-.5)),un($e[U+1])]}};var se}function oo($e,U,Z){const se=$e[U+Lr],ge=se>=1e4?`${Math.round(se/1e3)}k`:se>=1e3?Math.round(se/100)/10+"k":se,pe=$e[U+Uo],we=pe===-1?{}:Object.assign({},Z[pe]);return Object.assign(we,{cluster:!0,cluster_id:$e[U+Zi],point_count:se,point_count_abbreviated:ge})}function Qi($e){return $e/360+.5}function Ei($e){const U=Math.sin($e*Math.PI/180),Z=.5-.25*Math.log((1+U)/(1-U))/Math.PI;return Z<0?0:Z>1?1:Z}function un($e){const U=(180-360*$e)*Math.PI/180;return 360*Math.atan(Math.exp(U))/Math.PI-90}function wr($e,U,Z,se){let ge=se;const pe=U+(Z-U>>1);let we,Te=Z-U;const Ae=$e[U],Be=$e[U+1],qe=$e[Z],Oe=$e[Z+1];for(let mt=U+3;mt<Z;mt+=3){const bt=Br($e[mt],$e[mt+1],Ae,Be,qe,Oe);if(bt>ge)we=mt,ge=bt;else if(bt===ge){const Rt=Math.abs(mt-pe);Rt<Te&&(we=mt,Te=Rt)}}ge>se&&(we-U>3&&wr($e,U,we,se),$e[we+2]=ge,Z-we>3&&wr($e,we,Z,se))}function Br($e,U,Z,se,ge,pe){let we=ge-Z,Te=pe-se;if(we!==0||Te!==0){const Ae=(($e-Z)*we+(U-se)*Te)/(we*we+Te*Te);Ae>1?(Z=ge,se=pe):Ae>0&&(Z+=we*Ae,se+=Te*Ae)}return we=$e-Z,Te=U-se,we*we+Te*Te}function En($e,U,Z,se){const ge={id:$e??null,type:U,geometry:Z,tags:se,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(U==="Point"||U==="MultiPoint"||U==="LineString")Gr(ge,Z);else if(U==="Polygon")Gr(ge,Z[0]);else if(U==="MultiLineString")for(const pe of Z)Gr(ge,pe);else if(U==="MultiPolygon")for(const pe of Z)Gr(ge,pe[0]);return ge}function Gr($e,U){for(let Z=0;Z<U.length;Z+=3)$e.minX=Math.min($e.minX,U[Z]),$e.minY=Math.min($e.minY,U[Z+1]),$e.maxX=Math.max($e.maxX,U[Z]),$e.maxY=Math.max($e.maxY,U[Z+1])}function Dr($e,U,Z,se){if(!U.geometry)return;const ge=U.geometry.coordinates;if(ge&&ge.length===0)return;const pe=U.geometry.type,we=Math.pow(Z.tolerance/((1<<Z.maxZoom)*Z.extent),2);let Te=[],Ae=U.id;if(Z.promoteId?Ae=U.properties[Z.promoteId]:Z.generateId&&(Ae=se||0),pe==="Point")an(ge,Te);else if(pe==="MultiPoint")for(const Be of ge)an(Be,Te);else if(pe==="LineString")On(ge,Te,we,!1);else if(pe==="MultiLineString"){if(Z.lineMetrics){for(const Be of ge)Te=[],On(Be,Te,we,!1),$e.push(En(Ae,"LineString",Te,U.properties));return}po(ge,Te,we,!1)}else if(pe==="Polygon")po(ge,Te,we,!0);else{if(pe!=="MultiPolygon"){if(pe==="GeometryCollection"){for(const Be of U.geometry.geometries)Dr($e,{id:Ae,geometry:Be,properties:U.properties},Z,se);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Be of ge){const qe=[];po(Be,qe,we,!0),Te.push(qe)}}$e.push(En(Ae,pe,Te,U.properties))}function an($e,U){U.push($o($e[0]),Hr($e[1]),0)}function On($e,U,Z,se){let ge,pe,we=0;for(let Ae=0;Ae<$e.length;Ae++){const Be=$o($e[Ae][0]),qe=Hr($e[Ae][1]);U.push(Be,qe,0),Ae>0&&(we+=se?(ge*qe-Be*pe)/2:Math.sqrt(Math.pow(Be-ge,2)+Math.pow(qe-pe,2))),ge=Be,pe=qe}const Te=U.length-3;U[2]=1,wr(U,0,Te,Z),U[Te+2]=1,U.size=Math.abs(we),U.start=0,U.end=U.size}function po($e,U,Z,se){for(let ge=0;ge<$e.length;ge++){const pe=[];On($e[ge],pe,Z,se),U.push(pe)}}function $o($e){return $e/360+.5}function Hr($e){const U=Math.sin($e*Math.PI/180),Z=.5-.25*Math.log((1+U)/(1-U))/Math.PI;return Z<0?0:Z>1?1:Z}function ln($e,U,Z,se,ge,pe,we,Te){if(se/=U,pe>=(Z/=U)&&we<se)return $e;if(we<Z||pe>=se)return null;const Ae=[];for(const Be of $e){const qe=Be.geometry;let Oe=Be.type;const mt=ge===0?Be.minX:Be.minY,bt=ge===0?Be.maxX:Be.maxY;if(mt>=Z&&bt<se){Ae.push(Be);continue}if(bt<Z||mt>=se)continue;let Rt=[];if(Oe==="Point"||Oe==="MultiPoint")cs(qe,Rt,Z,se,ge);else if(Oe==="LineString")us(qe,Rt,Z,se,ge,!1,Te.lineMetrics);else if(Oe==="MultiLineString")Ho(qe,Rt,Z,se,ge,!1);else if(Oe==="Polygon")Ho(qe,Rt,Z,se,ge,!0);else if(Oe==="MultiPolygon")for(const Qt of qe){const ni=[];Ho(Qt,ni,Z,se,ge,!0),ni.length&&Rt.push(ni)}if(Rt.length){if(Te.lineMetrics&&Oe==="LineString"){for(const Qt of Rt)Ae.push(En(Be.id,Oe,Qt,Be.tags));continue}Oe!=="LineString"&&Oe!=="MultiLineString"||(Rt.length===1?(Oe="LineString",Rt=Rt[0]):Oe="MultiLineString"),Oe!=="Point"&&Oe!=="MultiPoint"||(Oe=Rt.length===3?"Point":"MultiPoint"),Ae.push(En(Be.id,Oe,Rt,Be.tags))}}return Ae.length?Ae:null}function cs($e,U,Z,se,ge){for(let pe=0;pe<$e.length;pe+=3){const we=$e[pe+ge];we>=Z&&we<=se&&hs(U,$e[pe],$e[pe+1],$e[pe+2])}}function us($e,U,Z,se,ge,pe,we){let Te=Go($e);const Ae=ge===0?Hn:ga;let Be,qe,Oe=$e.start;for(let ni=0;ni<$e.length-3;ni+=3){const hi=$e[ni],_i=$e[ni+1],Rr=$e[ni+2],yi=$e[ni+3],nr=$e[ni+4],Li=ge===0?hi:_i,or=ge===0?yi:nr;let lr=!1;we&&(Be=Math.sqrt(Math.pow(hi-yi,2)+Math.pow(_i-nr,2))),Li<Z?or>Z&&(qe=Ae(Te,hi,_i,yi,nr,Z),we&&(Te.start=Oe+Be*qe)):Li>se?or<se&&(qe=Ae(Te,hi,_i,yi,nr,se),we&&(Te.start=Oe+Be*qe)):hs(Te,hi,_i,Rr),or<Z&&Li>=Z&&(qe=Ae(Te,hi,_i,yi,nr,Z),lr=!0),or>se&&Li<=se&&(qe=Ae(Te,hi,_i,yi,nr,se),lr=!0),!pe&&lr&&(we&&(Te.end=Oe+Be*qe),U.push(Te),Te=Go($e)),we&&(Oe+=Be)}let mt=$e.length-3;const bt=$e[mt],Rt=$e[mt+1],Qt=ge===0?bt:Rt;Qt>=Z&&Qt<=se&&hs(Te,bt,Rt,$e[mt+2]),mt=Te.length-3,pe&&mt>=3&&(Te[mt]!==Te[0]||Te[mt+1]!==Te[1])&&hs(Te,Te[0],Te[1],Te[2]),Te.length&&U.push(Te)}function Go($e){const U=[];return U.size=$e.size,U.start=$e.start,U.end=$e.end,U}function Ho($e,U,Z,se,ge,pe){for(const we of $e)us(we,U,Z,se,ge,pe,!1)}function hs($e,U,Z,se){$e.push(U,Z,se)}function Hn($e,U,Z,se,ge,pe){const we=(pe-U)/(se-U);return hs($e,pe,Z+(ge-Z)*we,1),we}function ga($e,U,Z,se,ge,pe){const we=(pe-Z)/(ge-Z);return hs($e,U+(se-U)*we,pe,1),we}function Bs($e,U){const Z=[];for(let se=0;se<$e.length;se++){const ge=$e[se],pe=ge.type;let we;if(pe==="Point"||pe==="MultiPoint"||pe==="LineString")we=qo(ge.geometry,U);else if(pe==="MultiLineString"||pe==="Polygon"){we=[];for(const Te of ge.geometry)we.push(qo(Te,U))}else if(pe==="MultiPolygon"){we=[];for(const Te of ge.geometry){const Ae=[];for(const Be of Te)Ae.push(qo(Be,U));we.push(Ae)}}Z.push(En(ge.id,pe,we,ge.tags))}return Z}function qo($e,U){const Z=[];Z.size=$e.size,$e.start!==void 0&&(Z.start=$e.start,Z.end=$e.end);for(let se=0;se<$e.length;se+=3)Z.push($e[se]+U,$e[se+1],$e[se+2]);return Z}function ya($e,U){if($e.transformed)return $e;const Z=1<<$e.z,se=$e.x,ge=$e.y;for(const pe of $e.features){const we=pe.geometry,Te=pe.type;if(pe.geometry=[],Te===1)for(let Ae=0;Ae<we.length;Ae+=2)pe.geometry.push(va(we[Ae],we[Ae+1],U,Z,se,ge));else for(let Ae=0;Ae<we.length;Ae++){const Be=[];for(let qe=0;qe<we[Ae].length;qe+=2)Be.push(va(we[Ae][qe],we[Ae][qe+1],U,Z,se,ge));pe.geometry.push(Be)}}return $e.transformed=!0,$e}function va($e,U,Z,se,ge,pe){return[Math.round(Z*($e*se-ge)),Math.round(Z*(U*se-pe))]}function sc($e,U,Z,se,ge){const pe=U===ge.maxZoom?0:ge.tolerance/((1<<U)*ge.extent),we={features:[],numPoints:0,numSimplified:0,numFeatures:$e.length,source:null,x:Z,y:se,z:U,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Te of $e)Ar(we,Te,pe,ge);return we}function Ar($e,U,Z,se){const ge=U.geometry,pe=U.type,we=[];if($e.minX=Math.min($e.minX,U.minX),$e.minY=Math.min($e.minY,U.minY),$e.maxX=Math.max($e.maxX,U.maxX),$e.maxY=Math.max($e.maxY,U.maxY),pe==="Point"||pe==="MultiPoint")for(let Te=0;Te<ge.length;Te+=3)we.push(ge[Te],ge[Te+1]),$e.numPoints++,$e.numSimplified++;else if(pe==="LineString")Zo(we,ge,$e,Z,!1,!1);else if(pe==="MultiLineString"||pe==="Polygon")for(let Te=0;Te<ge.length;Te++)Zo(we,ge[Te],$e,Z,pe==="Polygon",Te===0);else if(pe==="MultiPolygon")for(let Te=0;Te<ge.length;Te++){const Ae=ge[Te];for(let Be=0;Be<Ae.length;Be++)Zo(we,Ae[Be],$e,Z,!0,Be===0)}if(we.length){let Te=U.tags||null;if(pe==="LineString"&&se.lineMetrics){Te={};for(const Be in U.tags)Te[Be]=U.tags[Be];Te.mapbox_clip_start=ge.start/ge.size,Te.mapbox_clip_end=ge.end/ge.size}const Ae={geometry:we,type:pe==="Polygon"||pe==="MultiPolygon"?3:pe==="LineString"||pe==="MultiLineString"?2:1,tags:Te};U.id!==null&&(Ae.id=U.id),$e.features.push(Ae)}}function Zo($e,U,Z,se,ge,pe){const we=se*se;if(se>0&&U.size<(ge?we:se))return void(Z.numPoints+=U.length/3);const Te=[];for(let Ae=0;Ae<U.length;Ae+=3)(se===0||U[Ae+2]>we)&&(Z.numSimplified++,Te.push(U[Ae],U[Ae+1])),Z.numPoints++;ge&&function(Ae,Be){let qe=0;for(let Oe=0,mt=Ae.length,bt=mt-2;Oe<mt;bt=Oe,Oe+=2)qe+=(Ae[Oe]-Ae[bt])*(Ae[Oe+1]+Ae[bt+1]);if(qe>0===Be)for(let Oe=0,mt=Ae.length;Oe<mt/2;Oe+=2){const bt=Ae[Oe],Rt=Ae[Oe+1];Ae[Oe]=Ae[mt-2-Oe],Ae[Oe+1]=Ae[mt-1-Oe],Ae[mt-2-Oe]=bt,Ae[mt-1-Oe]=Rt}}(Te,pe),$e.push(Te)}const ol={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class fo{constructor(U,Z){const se=(Z=this.options=function(pe,we){for(const Te in we)pe[Te]=we[Te];return pe}(Object.create(ol),Z)).debug;if(se&&console.time("preprocess data"),Z.maxZoom<0||Z.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Z.promoteId&&Z.generateId)throw new Error("promoteId and generateId cannot be used together.");let ge=function(pe,we){const Te=[];if(pe.type==="FeatureCollection")for(let Ae=0;Ae<pe.features.length;Ae++)Dr(Te,pe.features[Ae],we,Ae);else Dr(Te,pe.type==="Feature"?pe:{geometry:pe},we);return Te}(U,Z);this.tiles={},this.tileCoords=[],se&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Z.indexMaxZoom,Z.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ge=function(pe,we){const Te=we.buffer/we.extent;let Ae=pe;const Be=ln(pe,1,-1-Te,Te,0,-1,2,we),qe=ln(pe,1,1-Te,2+Te,0,-1,2,we);return(Be||qe)&&(Ae=ln(pe,1,-Te,1+Te,0,-1,2,we)||[],Be&&(Ae=Bs(Be,1).concat(Ae)),qe&&(Ae=Ae.concat(Bs(qe,-1)))),Ae}(ge,Z),ge.length&&this.splitTile(ge,0,0,0),se&&(ge.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(U,Z,se,ge,pe,we,Te){const Ae=[U,Z,se,ge],Be=this.options,qe=Be.debug;for(;Ae.length;){ge=Ae.pop(),se=Ae.pop(),Z=Ae.pop(),U=Ae.pop();const Oe=1<<Z,mt=ac(Z,se,ge);let bt=this.tiles[mt];if(!bt&&(qe>1&&console.time("creation"),bt=this.tiles[mt]=sc(U,Z,se,ge,Be),this.tileCoords.push({z:Z,x:se,y:ge}),qe)){qe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Z,se,ge,bt.numFeatures,bt.numPoints,bt.numSimplified),console.timeEnd("creation"));const lr=`z${Z}`;this.stats[lr]=(this.stats[lr]||0)+1,this.total++}if(bt.source=U,pe==null){if(Z===Be.indexMaxZoom||bt.numPoints<=Be.indexMaxPoints)continue}else{if(Z===Be.maxZoom||Z===pe)continue;if(pe!=null){const lr=pe-Z;if(se!==we>>lr||ge!==Te>>lr)continue}}if(bt.source=null,U.length===0)continue;qe>1&&console.time("clipping");const Rt=.5*Be.buffer/Be.extent,Qt=.5-Rt,ni=.5+Rt,hi=1+Rt;let _i=null,Rr=null,yi=null,nr=null,Li=ln(U,Oe,se-Rt,se+ni,0,bt.minX,bt.maxX,Be),or=ln(U,Oe,se+Qt,se+hi,0,bt.minX,bt.maxX,Be);U=null,Li&&(_i=ln(Li,Oe,ge-Rt,ge+ni,1,bt.minY,bt.maxY,Be),Rr=ln(Li,Oe,ge+Qt,ge+hi,1,bt.minY,bt.maxY,Be),Li=null),or&&(yi=ln(or,Oe,ge-Rt,ge+ni,1,bt.minY,bt.maxY,Be),nr=ln(or,Oe,ge+Qt,ge+hi,1,bt.minY,bt.maxY,Be),or=null),qe>1&&console.timeEnd("clipping"),Ae.push(_i||[],Z+1,2*se,2*ge),Ae.push(Rr||[],Z+1,2*se,2*ge+1),Ae.push(yi||[],Z+1,2*se+1,2*ge),Ae.push(nr||[],Z+1,2*se+1,2*ge+1)}}getTile(U,Z,se){U=+U,Z=+Z,se=+se;const ge=this.options,{extent:pe,debug:we}=ge;if(U<0||U>24)return null;const Te=1<<U,Ae=ac(U,Z=Z+Te&Te-1,se);if(this.tiles[Ae])return ya(this.tiles[Ae],pe);we>1&&console.log("drilling down to z%d-%d-%d",U,Z,se);let Be,qe=U,Oe=Z,mt=se;for(;!Be&&qe>0;)qe--,Oe>>=1,mt>>=1,Be=this.tiles[ac(qe,Oe,mt)];return Be&&Be.source?(we>1&&(console.log("found parent tile z%d-%d-%d",qe,Oe,mt),console.time("drilling down")),this.splitTile(Be.source,qe,Oe,mt,U,Z,se),we>1&&console.timeEnd("drilling down"),this.tiles[Ae]?ya(this.tiles[Ae],pe):null):null}}function ac($e,U,Z){return 32*((1<<$e)*Z+U)+$e}function Pu($e,U){const Z=$e.tileID.canonical;if(!this._geoJSONIndex)return void U(null,null);const se=this._geoJSONIndex.getTile(Z.z,Z.x,Z.y);if(!se)return void U(null,null);const ge=new xt(se.features);let pe=gn(ge);pe.byteOffset===0&&pe.byteLength===pe.buffer.byteLength||(pe=new Uint8Array(pe)),U(null,{vectorTile:ge,rawData:pe.buffer})}class lc extends ze{constructor(U,Z,se,ge,pe,we,Te){super(U,Z,se,ge,pe,Pu,Te),we&&(this.loadGeoJSON=we),this._dynamicIndex=new Wt}loadData(U,Z){const se=U&&U.request,ge=se&&se.collectResourceTiming;this.loadGeoJSON(U,(pe,we)=>{if(pe||!we)return Z(pe);if(typeof we!="object")return Z(new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`));{try{if(U.filter){const Ae=o.X(U.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Ae.result==="error")throw new Error(Ae.value.map(Be=>`${Be.key}: ${Be.message}`).join(", "));we.features=we.features.filter(Be=>Ae.value.evaluate({zoom:0},Be))}U.dynamic?(we.type==="Feature"&&(we={type:"FeatureCollection",features:[we]}),U.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(we.features,this.loaded),U.cluster&&(we.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=U.cluster?new gr(function({superclusterOptions:Ae,clusterProperties:Be}){if(!Be||!Ae)return Ae;const qe={},Oe={},mt={accumulated:null,zoom:0},bt={properties:null},Rt=Object.keys(Be);for(const Qt of Rt){const[ni,hi]=Be[Qt],_i=o.X(hi),Rr=o.X(typeof ni=="string"?[ni,["accumulated"],["get",Qt]]:ni);qe[Qt]=_i.value,Oe[Qt]=Rr.value}return Ae.map=Qt=>{bt.properties=Qt;const ni={};for(const hi of Rt)ni[hi]=qe[hi].evaluate(mt,bt);return ni},Ae.reduce=(Qt,ni)=>{bt.properties=ni;for(const hi of Rt)mt.accumulated=Qt[hi],Qt[hi]=Oe[hi].evaluate(mt,bt)},Ae}(U)).load(we.features):U.dynamic?this._dynamicIndex:function(Ae,Be){return new fo(Ae,Be)}(we,U.geojsonVtOptions)}catch(Ae){return Z(Ae)}const Te={};if(ge){const Ae=re(se);Ae&&(Te.resourceTiming={},Te.resourceTiming[U.source]=JSON.parse(JSON.stringify(Ae)))}Z(null,Te)}})}reloadTile(U,Z){const se=this.loaded;return se&&se[U.uid]?U.partial?Z(null,void 0):super.reloadTile(U,Z):this.loadTile(U,Z)}loadGeoJSON(U,Z){if(U.request)o.n(U.request,Z);else{if(typeof U.data!="string")return Z(new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`));try{return Z(null,JSON.parse(U.data))}catch{return Z(new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(U,Z){try{Z(null,this._geoJSONIndex.getClusterExpansionZoom(U.clusterId))}catch(se){Z(se)}}getClusterChildren(U,Z){try{Z(null,this._geoJSONIndex.getChildren(U.clusterId))}catch(se){Z(se)}}getClusterLeaves(U,Z){try{Z(null,this._geoJSONIndex.getLeaves(U.clusterId,U.limit,U.offset))}catch(se){Z(se)}}}class ft{constructor(U,Z){this.tileID=new o.aM(U.tileID.overscaledZ,U.tileID.wrap,U.tileID.canonical.z,U.tileID.canonical.x,U.tileID.canonical.y),this.tileZoom=U.tileZoom,this.uid=U.uid,this.zoom=U.zoom,this.canonical=U.tileID.canonical,this.pixelRatio=U.pixelRatio,this.tileSize=U.tileSize,this.source=U.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=U.projection,this.brightness=Z}parse(U,Z,se,ge){this.status="parsing";const pe=new o.aM(se.tileID.overscaledZ,se.tileID.wrap,se.tileID.canonical.z,se.tileID.canonical.x,se.tileID.canonical.y),we=[],Te=Z.familiesBySource[se.source],Ae=new o.f0(pe,se.promoteId);Ae.bucketLayerIDs=[],Ae.is3DTile=!0,o.fi(U).then(Be=>{if(!Be)return ge(new Error("Could not parse tile"));const qe=o.fj(Be,1/o.cT(se.tileID.canonical)),Oe=Be.json.extensionsUsed&&Be.json.extensionsUsed.includes("MAPBOX_mesh_features")||Be.json.asset.extras&&Be.json.asset.extras.MAPBOX_mesh_features,mt=Be.json.extensionsUsed&&Be.json.extensionsUsed.includes("EXT_meshopt_compression"),bt=new o.aa(this.zoom,{brightness:this.brightness});for(const Rt in Te)for(const Qt of Te[Rt]){const ni=Qt[0];Ae.bucketLayerIDs.push(Qt.map(_i=>o.C(_i.id,_i.scope))),ni.recalculate(bt,[]);const hi=new o.fk(Qt,qe,pe,Oe,mt,this.brightness,Ae);Oe||(hi.needsUpload=!0),we.push(hi),hi.evaluate(ni)}this.status="done",ge(null,{buckets:we,featureIndex:Ae,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Be=>ge(new Error(Be.message)))}}class ds{constructor(U,Z,se,ge,pe,we,Te){this.actor=U,this.layerIndex=Z,this.availableImages=se,this.availableModels=ge,this.brightness=Te,this.loading={},this.loaded={}}loadTile(U,Z){const se=U.uid,ge=this.loading[se]=new ft(U,this.brightness);o.br(U.request,(pe,we)=>{const Te=!this.loading[se];return delete this.loading[se],Te||pe?(ge.status="done",Te||(this.loaded[se]=ge),Z(pe)):we&&we.byteLength!==0?void ge.parse(we,this.layerIndex,U,(Ae,Be)=>{ge.status="done",this.loaded=this.loaded||{},this.loaded[se]=ge,Ae||!Be?Z(Ae):Z(null,Be)}):(ge.status="done",this.loaded[se]=ge,Z())})}reloadTile(U,Z){const se=this.loaded,ge=U.uid;if(se&&se[ge]){const pe=se[ge];pe.projection=U.projection,pe.brightness=U.brightness;const we=(Te,Ae)=>{pe.reloadCallback&&(delete pe.reloadCallback,this.loadTile(U,Z)),Z(Te,Ae)};pe.status==="parsing"?pe.reloadCallback=we:pe.status==="done"&&this.loadTile(U,Z)}}abortTile(U,Z){const se=U.uid;this.loading[se]&&delete this.loading[se],Z()}removeTile(U,Z){const se=this.loaded,ge=U.uid;se&&se[ge]&&delete se[ge],Z()}}class Du{constructor(U){this.self=U,this.actor=new o.fm(U,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new o.y,this.projections={},this.defaultProjection=o.ce({name:"mercator"}),this.workerSourceTypes={vector:ze,geojson:lc,"raster-dem":Se,"raster-array":nt,"batched-model":ds},this.workerSources={},this.self.registerWorkerSource=(Z,se)=>{if(this.workerSourceTypes[Z])throw new Error(`Worker source with name "${Z}" already registered.`);this.workerSourceTypes[Z]=se},this.self.registerRTLTextPlugin=Z=>{if(o.fn.isParsed())throw new Error("RTL text plugin already registered.");o.fn.applyArabicShaping=Z.applyArabicShaping,o.fn.processBidirectionalText=Z.processBidirectionalText,o.fn.processStyledBidirectionalText=Z.processStyledBidirectionalText}}clearCaches(U,Z,se){delete this.layerIndexes[U],delete this.availableImages[U],delete this.availableModels[U],delete this.workerSources[U],se()}checkIfReady(U,Z,se){se()}setReferrer(U,Z){this.referrer=Z}spriteLoaded(U,Z){this.isSpriteLoaded[U]||(this.isSpriteLoaded[U]={});const{scope:se,isLoaded:ge}=Z;if(this.isSpriteLoaded[U][se]=ge,this.workerSources[U]&&this.workerSources[U][se])for(const pe in this.workerSources[U][se]){const we=this.workerSources[U][se][pe];for(const Te in we){const Ae=we[Te];Ae instanceof ze&&(Ae.isSpriteLoaded=ge,Ae.fire(new o.A("isSpriteLoaded")))}}}setImages(U,Z,se){this.availableImages[U]||(this.availableImages[U]={});const{scope:ge,images:pe}=Z;if(this.availableImages[U][ge]=pe,this.workerSources[U]&&this.workerSources[U][ge]){for(const we in this.workerSources[U][ge]){const Te=this.workerSources[U][ge][we];for(const Ae in Te)Te[Ae].availableImages=pe}se()}else se()}setModels(U,{scope:Z,models:se},ge){if(this.availableModels[U]||(this.availableModels[U]={}),this.availableModels[U][Z]=se,this.workerSources[U]&&this.workerSources[U][Z]){for(const pe in this.workerSources[U][Z]){const we=this.workerSources[U][Z][pe];for(const Te in we)we[Te].availableModels=se}ge()}else ge()}setProjection(U,Z){this.projections[U]=o.ce(Z)}setBrightness(U,Z,se){this.brightness=Z,se()}setLayers(U,Z,se){this.getLayerIndex(U,Z.scope).replace(Z.layers,Z.options),se()}updateLayers(U,Z,se){this.getLayerIndex(U,Z.scope).update(Z.layers,Z.removedIds,Z.options),se()}loadTile(U,Z,se){Z.projection=this.projections[U]||this.defaultProjection,this.getWorkerSource(U,Z.type,Z.source,Z.scope).loadTile(Z,se)}decodeRasterArray(U,Z,se){this.getWorkerSource(U,Z.type,Z.source,Z.scope).decodeRasterArray(Z,se)}reloadTile(U,Z,se){Z.projection=this.projections[U]||this.defaultProjection,this.getWorkerSource(U,Z.type,Z.source,Z.scope).reloadTile(Z,se)}abortTile(U,Z,se){this.getWorkerSource(U,Z.type,Z.source,Z.scope).abortTile(Z,se)}removeTile(U,Z,se){this.getWorkerSource(U,Z.type,Z.source,Z.scope).removeTile(Z,se)}removeSource(U,Z,se){if(!(this.workerSources[U]&&this.workerSources[U][Z.scope]&&this.workerSources[U][Z.scope][Z.type]&&this.workerSources[U][Z.scope][Z.type][Z.source]))return;const ge=this.workerSources[U][Z.scope][Z.type][Z.source];delete this.workerSources[U][Z.scope][Z.type][Z.source],ge.removeSource!==void 0?ge.removeSource(Z,se):se()}loadWorkerSource(U,Z,se){try{this.self.importScripts(Z.url),se()}catch(ge){se(ge.toString())}}syncRTLPluginState(U,Z,se){try{o.fn.setState(Z);const ge=o.fn.getPluginURL();if(o.fn.isLoaded()&&!o.fn.isParsed()&&ge!=null){this.self.importScripts(ge);const pe=o.fn.isParsed();se(pe?void 0:new Error(`RTL Text Plugin failed to import scripts from ${ge}`),pe)}}catch(ge){se(ge.toString())}}setDracoUrl(U,Z){this.dracoUrl=Z}getAvailableImages(U,Z){this.availableImages[U]||(this.availableImages[U]={});let se=this.availableImages[U][Z];return se||(se=[]),se}getAvailableModels(U,Z){this.availableModels[U]||(this.availableModels[U]={});let se=this.availableModels[U][Z];return se||(se={}),se}getLayerIndex(U,Z){this.layerIndexes[U]||(this.layerIndexes[U]={});let se=this.layerIndexes[U][Z];return se||(se=this.layerIndexes[U][Z]=new oe,se.scope=Z),se}getWorkerSource(U,Z,se,ge){const pe=this.workerSources;return pe[U]||(pe[U]={}),pe[U][ge]||(pe[U][ge]={}),pe[U][ge][Z]||(pe[U][ge][Z]={}),this.isSpriteLoaded[U]||(this.isSpriteLoaded[U]={}),pe[U][ge][Z][se]||(pe[U][ge][Z][se]=new this.workerSourceTypes[Z]({send:(we,Te,Ae,Be,qe,Oe)=>this.actor.send(we,Te,Ae,U,qe,Oe),scheduler:this.actor.scheduler},this.getLayerIndex(U,ge),this.getAvailableImages(U,ge),this.getAvailableModels(U,ge),this.isSpriteLoaded[U][ge],void 0,this.brightness)),pe[U][ge][Z][se]}rasterizeImagesWorker(U,Z,se){const ge=new Map;for(const[pe,{image:we,imageVariant:Te}]of Z.tasks.entries()){const Ae=this.imageRasterizer.rasterize(Te,we,Z.scope,U);ge.set(pe,Ae)}se(void 0,ge)}removeRasterizedImages(U,Z,se){this.imageRasterizer.removeImagesFromCacheByIds(Z.imageIds,Z.scope,U),se()}enforceCacheSizeLimit(U,Z){o.fo(Z)}getWorkerPerformanceMetrics(U,Z,se){se(void 0,void 0)}}return o.fl(self)&&(self.worker=new Du(self)),Du}),k(["./shared"],function(o){var re="3.12.0";const fe={create:"create",load:"load",fullLoad:"fullLoad"},xe={mark(l){performance.mark(l)},measure(l,t,n){performance.measure(l,t,n)}};function oe(l){const t=l.name.split("?")[0];return o.a(t)&&t.includes("mapbox-gl.js")?"javascript":o.a(t)&&t.includes("mapbox-gl.css")?"css":o.b(t)?"fontRange":o.c(t)?"sprite":o.i(t)?"style":o.d(t)?"tilejson":"other"}var Ee,be={},Pe=function(){if(Ee)return be;function l(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var f,_,y=new Blob([""],{type:"text/javascript"}),b=URL.createObjectURL(y);try{_=new Worker(b),f=!0}catch{f=!1}return _&&_.terminate(),URL.revokeObjectURL(b),f}()?function(){var f=document.createElement("canvas");f.width=f.height=1;var _=f.getContext("2d");if(!_)return!1;var y=_.getImageData(0,0,1,1);return y&&y.width===f.width}()?(n[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(n[d]=function(f){var _,y=function(b){var E=document.createElement("canvas"),I=Object.create(l.webGLContextAttributes);return I.failIfMajorPerformanceCaveat=b,E.getContext("webgl2",I)}(f);if(!y)return!1;try{_=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!_||y.isContextLost())&&(y.shaderSource(_,"void main() {}"),y.compileShader(_),y.getShaderParameter(_,y.COMPILE_STATUS)===!0)}(d)),n[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}Ee=1,be.supported=l,be.notSupportedReason=t;var n={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},be}();function _e(l,t,n){const c=document.createElement(l);return t!=null&&(c.className=t),n&&n.appendChild(c),c}function ze(l,t,n){const c=document.createElementNS("http://www.w3.org/2000/svg",l);for(const d of Object.keys(t))c.setAttributeNS(null,d,String(t[d]));return n&&n.appendChild(c),c}const Se=typeof document<"u"?document.documentElement&&document.documentElement.style:null,st=Se&&Se.userSelect!==void 0?"userSelect":"WebkitUserSelect";let nt;function Xe(){Se&&st&&(nt=Se[st],Se[st]="none")}function ct(){Se&&st&&(Se[st]=nt)}function xt(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",xt,!0)}function $t(){window.addEventListener("click",xt,!0),window.setTimeout(()=>{window.removeEventListener("click",xt,!0)},0)}function kt(l,t){const n=l.getBoundingClientRect();return mi(l,n,t)}function Wt(l,t){const n=l.getBoundingClientRect(),c=[];for(let d=0;d<t.length;d++)c.push(mi(l,n,t[d]));return c}function Ai(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function mi(l,t,n){const c=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new o.P((n.clientX-t.left)*c,(n.clientY-t.top)*c)}const bi="01",Jt="NO_ACCESS_TOKEN";class Bt{constructor(t,n,c){this._transformRequestFn=t,this._customAccessToken=n,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const t=function(){let n="";for(let c=0;c<10;c++)n+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",bi,n].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeStyleURL(t,n){if(!o.f(t))return t;const c=ri(t);return c.params.push(`sdk=js-${re}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeGlyphsURL(t,n){if(!o.f(t))return t;const c=ri(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeModelURL(t,n){if(!o.f(t))return t;const c=ri(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeSourceURL(t,n,c,d){if(!o.f(t))return t;const f=ri(t);return f.path=`/v4/${f.authority}.json`,f.params.push("secure"),c&&f.params.push(`language=${c}`),d&&f.params.push(`worldview=${d}`),this._makeAPIURL(f,this._customAccessToken||n)}normalizeIconsetURL(t,n){const c=ri(t);return o.f(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||n)):ui(c)}normalizeSpriteURL(t,n,c,d){const f=ri(t);return o.f(t)?(f.path=`/styles/v1${f.path}/sprite${n}${c}`,this._makeAPIURL(f,this._customAccessToken||d)):(f.path+=`${n}${c}`,ui(f))}normalizeTileURL(t,n,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!o.f(t))return t;const d=ri(t);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${n||c&&d.authority!=="raster"&&c===512?"@2x":""}${o.m.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${o.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${o.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${o.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${o.e.TILE_URL_VERSION}${d.path}`);const f=this._customAccessToken||function(_){for(const y of _){const b=y.match(/^access_token=(.*)$/);if(b)return b[1]}return null}(d.params)||o.e.ACCESS_TOKEN;return o.e.REQUIRE_ACCESS_TOKEN&&f&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,f)}canonicalizeTileURL(t,n){const c=ri(t);if(!c.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!c.path.match(/\.[\w]+$/))return t;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${o.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${c.path.replace(`/${o.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${o.e.TILE_URL_VERSION}/`,"")}`;let f=c.params;return n&&(f=f.filter(_=>!_.match(/^access_token=/))),f.length&&(d+=`?${f.join("&")}`),d}canonicalizeTileset(t,n){const c=!!n&&o.f(n),d=[];for(const f of t.tiles||[])o.h(f)?d.push(this.canonicalizeTileURL(f,c)):d.push(f);return d}_makeAPIURL(t,n){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=ri(o.e.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const f=t.params.indexOf("secure");f>=0&&t.params.splice(f,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!o.e.REQUIRE_ACCESS_TOKEN)return ui(t);if(n=n||o.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!n)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);if(n[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return t.params=t.params.filter(f=>f.indexOf("access_token")===-1),t.params.push(`access_token=${n||""}`),ui(t)}}const vi=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ri(l){const t=l.match(vi);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function ui(l){const t=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${t}`}const pr="mapbox.eventData";function _r(l){if(!l)return null;const t=l.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(o.j(t[1]))}catch{return null}}class Ii{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const n=_r(o.e.ACCESS_TOKEN);let c="";return c=n&&n.u?o.k(n.u):o.e.ACCESS_TOKEN||"",t?`${pr}.${t}:${c}`:`${pr}:${c}`}fetchEventData(){const t=o.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid");if(t)try{const d=localStorage.getItem(n);d&&(this.eventData=JSON.parse(d));const f=localStorage.getItem(c);f&&(this.anonId=f)}catch{o.w("Unable to read from LocalStorage")}}saveEventData(){const t=o.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.anonId;if(t&&d)try{localStorage.setItem(c,d),Object.keys(this.eventData).length>=1&&localStorage.setItem(n,JSON.stringify(this.eventData))}catch{o.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,n,c,d){if(!o.e.EVENTS_URL)return;const f=ri(o.e.EVENTS_URL);f.params.push(`access_token=${d||o.e.ACCESS_TOKEN||""}`);const _={event:this.type,created:new Date(t).toISOString()},y=n?o.l(_,n):_,b={url:ui(f),headers:{"Content-Type":"text/plain"},body:JSON.stringify([y])};this.pendingRequest=o.p(b,E=>{this.pendingRequest=null,c(E),this.saveEventData(),this.processRequests(d)})}queueRequest(t,n){this.queue.push(t),this.processRequests(n)}}const $r=new class extends Ii{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,t){o.e.EVENTS_URL&&o.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some(n=>o.f(n)||o.h(n))&&this.queueRequest(Date.now(),t)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=_r(o.e.ACCESS_TOKEN),n=t?t.u:o.e.ACCESS_TOKEN;let c=n!==this.eventData.tokenU;o.v(this.anonId)||(this.anonId=o.u(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const f=new Date(this.eventData.lastSuccess),_=new Date(d),y=(d-this.eventData.lastSuccess)/864e5;c=c||y>=1||y<-1||f.getDate()!==_.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:re,skuId:bi,"enabled.telemetry":!1,userId:this.anonId},f=>{f||(this.eventData.lastSuccess=d,this.eventData.tokenU=n)},l):this.processRequests()}},gn=$r.postTurnstileEvent.bind($r),Yn=new class extends Ii{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,t,n,c){this.skuToken=t,this.errorCb=c,o.e.EVENTS_URL&&(n||o.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(Jt)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),o.v(this.anonId)||(this.anonId=o.u()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:re,skuId:bi,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l))}remove(){this.errorCb=null}},ho=Yn.postMapLoadEvent.bind(Yn),Ui=new class extends Ii{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let t=this.mapInstanceIdMap.get(l);return t||(t=o.u(),this.mapInstanceIdMap.set(l,t)),t}getEventId(l){const t=this.eventIdPerMapInstanceMap.get(l)||0;return this.eventIdPerMapInstanceMap.set(l,t+1),t}postStyleLoadEvent(l,t){const{map:n,style:c,importedStyles:d}=t;if(!o.e.EVENTS_URL||!l&&!o.e.ACCESS_TOKEN)return;const f=this.getMapInstanceId(n),_={mapInstanceId:f,eventId:this.getEventId(f),style:c};d.length&&(_.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:_},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:n}=this.queue.shift();this.postEvent(t,n,()=>{},l)}},Zi=Ui.postStyleLoadEvent.bind(Ui),Lr=new class extends Ii{constructor(){super("gljs.performance")}postPerformanceEvent(l,t){o.e.EVENTS_URL&&(l||o.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:n}=this.queue.shift(),c=function(d){const f=performance.getEntriesByType("resource"),_=performance.getEntriesByType("mark"),y=function(z){const N={};if(z){for(const B in z)if(B!=="other")for(const G of z[B]){const V=`${B}ResolveRangeMin`,X=`${B}ResolveRangeMax`,Q=`${B}RequestCount`,ie=`${B}RequestCachedCount`;N[V]=Math.min(N[V]||1/0,G.startTime),N[X]=Math.max(N[X]||-1/0,G.responseEnd);const ue=ae=>{N[ae]===void 0&&(N[ae]=0),++N[ae]};G.transferSize!==void 0&&G.transferSize===0&&ue(ie),ue(Q)}}return N}(function(z,N){const B={};if(z)for(const G of z){const V=N(G);B[V]===void 0&&(B[V]=[]),B[V].push(G)}return B}(f,oe)),b=window.devicePixelRatio,E=navigator.connection||navigator.mozConnection||navigator.webkitConnection,I=E?E.effectiveType:void 0,P={counters:[],metadata:[],attributes:[]},M=(z,N,B)=>{B!=null&&z.push({name:N,value:B.toString()})};for(const z in y)M(P.counters,z,y[z]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(M(P.counters,"interactionRangeMin",d.interactionRange[0]),M(P.counters,"interactionRangeMax",d.interactionRange[1])),_)for(const z of Object.keys(fe)){const N=fe[z],B=_.find(G=>G.name===N);B&&M(P.counters,N,B.startTime)}return M(P.counters,"visibilityHidden",d.visibilityHidden),M(P.attributes,"style",function(z){if(z)for(const N of z){const B=N.name.split("?")[0];if(o.i(B)){const G=B.split("/").slice(-2);if(G.length===2)return`mapbox://styles/${G[0]}/${G[1]}`}}}(f)),M(P.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),M(P.attributes,"fogEnabled",d.fogEnabled?"true":"false"),M(P.attributes,"projection",d.projection),M(P.attributes,"zoom",d.zoom),M(P.metadata,"devicePixelRatio",b),M(P.metadata,"connectionEffectiveType",I),M(P.metadata,"navigatorUserAgent",navigator.userAgent),M(P.metadata,"screenWidth",window.screen.width),M(P.metadata,"screenHeight",window.screen.height),M(P.metadata,"windowWidth",window.innerWidth),M(P.metadata,"windowHeight",window.innerHeight),M(P.metadata,"mapWidth",d.width/b),M(P.metadata,"mapHeight",d.height/b),M(P.metadata,"webglRenderer",d.renderer),M(P.metadata,"webglVendor",d.vendor),M(P.metadata,"sdkVersion",re),M(P.metadata,"sdkIdentifier","mapbox-gl-js"),P}(n);for(const d of c.metadata);for(const d of c.counters);for(const d of c.attributes);this.postEvent(t,c,()=>{},l)}},Uo=Lr.postPerformanceEvent.bind(Lr),gr=new class extends Ii{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,t,n,c){if(!o.e.API_URL||!o.e.SESSION_PATH)return;const d=ri(o.e.API_URL+o.e.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||o.e.ACCESS_TOKEN||""}`);const f={url:ui(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=o.g(f,_=>{this.pendingRequest=null,n(_),this.saveEventData(),this.processRequests(c)})}getSessionAPI(l,t,n,c){this.skuToken=t,this.errorCb=c,o.e.SESSION_PATH&&o.e.API_URL&&(n||o.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(Jt)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||this.getSession(n,this.skuToken,c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l)}remove(){this.errorCb=null}},Kn=gr.getSessionAPI.bind(gr),oo=new Set;function Qi(l,t){t?oo.add(l):oo.delete(l)}class Ei{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,n){this._updatedSourceCaches[t]=n,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const n=t.scope;this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._updatedLayers[n].add(t.id),this.setDirty()}removeLayer(t){const n=t.scope;this._removedLayers[n]=this._removedLayers[n]||{},this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._removedLayers[n][t.id]=t,this._updatedLayers[n].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const n in this._updatedLayers)t[n]=t[n]||{},t[n].updatedIds=Array.from(this._updatedLayers[n].values());for(const n in this._removedLayers)t[n]=t[n]||{},t[n].removedIds=Object.keys(this._removedLayers[n]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(t){return this._updatedImages[t]?Array.from(this._updatedImages[t].values()):[]}updateImage(t,n){this._updatedImages[n]=this._updatedImages[n]||new Set,this._updatedImages[n].add(o.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function un(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class wr extends o.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,t!=="raster"&&o.t()&&(this.imageRasterizerDispatcher=new o.D(o.x(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new o.r({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const n=this.atlasTexture.get(t);n&&(n.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,n){this.imageProviders.has(n)||this.imageProviders.set(n,new Map),this.imageProviders.get(n).set(t.id,t)}removeImageProvider(t,n){this.imageProviders.has(n)&&this.imageProviders.get(n).delete(t)}getPendingImageProviders(){const t=[];for(const n of this.imageProviders.values())for(const c of n.values())c.hasPendingRequests()&&t.push(c);return t}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new o.y),this._imageRasterizer}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,n){if(this.loaded.get(n)!==t&&(this.loaded.set(n,t),t)){for(const{ids:c,callback:d}of this.requestors)this._notify(c,n,d);this.requestors=[]}}hasImage(t,n){return!!this.getImage(t,n)}getImage(t,n){return this.images.get(n).get(t.toString())}addImage(t,n,c){this._validate(t,c)&&this.images.get(n).set(t.toString(),c)}_validate(t,n){let c=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(n.content,n)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,n){if(!t)return!0;let c=0;for(const d of t){if(d[0]<c||d[1]<d[0]||n<d[1])return!1;c=d[1]}return!0}_validateContent(t,n){return t?t.length!==4||!n.usvg&&(t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,n,c){const d=this.images.get(n).get(t.toString());c.version=d.version+1,this.images.get(n).set(t.toString(),c),this.updatedImages.get(n).add(t),this.removeFromImageRasterizerCache(t,n)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,n){this.spriteFormat!=="raster"&&(o.t()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:n}):this.imageRasterizer.removeImagesFromCacheByIds([t],n))}removeImage(t,n){const c=this.images.get(n),d=c.get(t.toString());c.delete(t.toString()),this.patterns.get(n).delete(t.toString()),this.removeFromImageRasterizerCache(t,n),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(n=>o.I.from(n))}getImages(t,n,c){const d=[],f=[],_=this.imageProviders.get(n);for(const I of t){if(!I.iconsetId){d.push(I);continue}const P=_.get(I.iconsetId);P&&(this.getImage(I,n)?f.push(I):P.addPendingRequest(I))}if(d.length===0)return void this._notify(f,n,c);let y=!0;const b=!!this.loaded.get(n),E=this.images.get(n);if(!b)for(const I of d)E.has(I.toString())||(y=!1);b||y?this._notify(d,n,c):this.requestors.push({ids:d,scope:n,callback:c})}rasterizeImages(t,n){const c=new Map,{tasks:d,scope:f}=t;for(const[_,y]of d.entries()){const b=this.getImage(y.id,f);b&&c.set(_,{image:b,imageVariant:y})}this._rasterizeImages(f,c,n)}_rasterizeImages(t,n,c){if(o.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:n,scope:t},c);else{const d=new Map;for(const[f,{image:_,imageVariant:y}]of n.entries())d.set(f,this.imageRasterizer.rasterize(y,_,t,0));c(void 0,d)}}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,n,c){const d=this.images.get(n),f=new Map;for(const _ of t){if(!d.get(_.toString())){if(_.iconsetId)continue;this.fire(new o.A("styleimagemissing",{id:_.name}))}const y=d.get(_.toString());if(!y){o.w(`Image "${_.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const b={data:y.usvg?null:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,usvg:y.usvg,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:!!(y.userImage&&y.userImage.render)};y.usvg&&Object.assign(b,{width:y.icon.usvg_tree.width,height:y.icon.usvg_tree.height}),f.set(o.I.toString(_),b)}c(null,f)}getPixelSize(t){const{width:n,height:c}=this.atlasImage.get(t);return{width:n,height:c}}getPattern(t,n,c){const d=t.toString(),f=this.patterns.get(n),_=f.get(d),y=this.getImage(t,n);if(!y)return null;if(_){if(_.position.version===y.version)return _.position;_.position.version=y.version}else{if(y.usvg&&!y.data){const b=this.getPatternInFlightId(d,n);if(this.patternsInFlight.has(b))return null;this.patternsInFlight.add(b);const E=new o.B(t).scaleSelf(o.q.devicePixelRatio),I=new Map([[E.toString(),{image:y,imageVariant:E}]]);return this._rasterizeImages(n,I,(P,M)=>this.storePatternImage(E,n,y,c,M)),null}this.storePattern(t,n,y)}return this._updatePatternAtlas(n,c),f.get(d).position}getPatternInFlightId(t,n){return o.C(t,n)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,n,c,d,f){const _=t.toString(),y=f?f.get(_):void 0;y&&(c.data=y,this.storePattern(t.id,n,c),this._updatePatternAtlas(n,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),n)))}storePattern(t,n,c){const d={w:c.data.width+2*o.F,h:c.data.height+2*o.F,x:0,y:0},f=new o.G(d,c,o.F);this.patterns.get(n).set(t.toString(),{bin:d,position:f})}bind(t,n){const c=t.gl;let d=this.atlasTexture.get(n);d?this.dirty&&(d.update(this.atlasImage.get(n)),this.dirty=!1):(d=new o.T(t,this.atlasImage.get(n),c.RGBA8),this.atlasTexture.set(n,d)),d.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,n){const c=this.patterns.get(t),d=Array.from(c.values()).map(({bin:E})=>E),{w:f,h:_}=o.H(d),y=this.atlasImage.get(t);y.resize({width:f||1,height:_||1});const b=this.images.get(t);for(const[E,{bin:I,position:P}]of c.entries()){let M=P.padding;const z=I.x+M,N=I.y+M,B=b.get(E).data,G=B.width,V=B.height;M=M>1?M-1:M,o.r.copy(B,y,{x:0,y:0},{x:z,y:N},{width:G,height:V},n),o.r.copy(B,y,{x:0,y:V-M},{x:z,y:N-M},{width:G,height:M},n),o.r.copy(B,y,{x:0,y:0},{x:z,y:N+V},{width:G,height:M},n),o.r.copy(B,y,{x:G-M,y:0},{x:z-M,y:N},{width:M,height:V},n),o.r.copy(B,y,{x:0,y:0},{x:z+G,y:N},{width:M,height:V},n),o.r.copy(B,y,{x:G-M,y:V-M},{x:z-M,y:N-M},{width:M,height:M},n),o.r.copy(B,y,{x:0,y:V-M},{x:z+G,y:N-M},{width:M,height:M},n),o.r.copy(B,y,{x:0,y:0},{x:z+G,y:N+V},{width:M,height:M},n),o.r.copy(B,y,{x:G-M,y:0},{x:z-M,y:N+V},{width:M,height:M},n)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}dispatchRenderCallbacks(t,n){const c=this.images.get(n);for(const d of t){if(this.callbackDispatchedThisFrame.get(n).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(n).add(d.toString());const f=c.get(d.toString());un(f)&&this.updateImage(d,n,f)}}}function Br(l){const t=l.key,n=l.value,c=l.valueSpec||{},d=l.objectElementValidators||{},f=l.style,_=l.styleSpec;let y=[];const b=o.K(n);if(b!=="object")return[new o.V(t,n,`object expected, ${b} found`)];for(const E in n){const I=E.split(".")[0];let P;d[I]?P=d[I]:c[I]?P=Ar:d["*"]?P=d["*"]:c["*"]&&(P=Ar),P?y=y.concat(P({key:(t&&`${t}.`)+E,value:n[E],valueSpec:c[I]||c["*"],style:f,styleSpec:_,object:n,objectKey:E},n)):y.push(new o.J(t,n[E],`unknown property "${E}"`))}for(const E in c)d[E]||c[E].required&&c[E].default===void 0&&n[E]===void 0&&y.push(new o.V(t,n,`missing required property "${E}"`));return y}function En(l){const t=l.value,n=l.valueSpec,c=l.style,d=l.styleSpec,f=l.key,_=l.arrayElementValidator||Ar;if(o.K(t)!=="array")return[new o.V(f,t,`array expected, ${o.K(t)} found`)];if(n.length&&t.length!==n.length)return[new o.V(f,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new o.V(f,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let y={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};d.$version<7&&(y.function=n.function),o.K(n.value)==="object"&&(y=n.value);let b=[];for(let E=0;E<t.length;E++)b=b.concat(_({array:t,arrayIndex:E,value:t[E],valueSpec:y,style:c,styleSpec:d,key:`${f}[${E}]`},!0));return b}function Gr(l){const t=l.key,n=l.value,c=l.valueSpec;let d=o.K(n);if(d==="number"&&n!=n&&(d="NaN"),d!=="number")return[new o.V(t,n,`number expected, ${d} found`)];if("minimum"in c){let f=c.minimum;if(o.K(c.minimum)==="array"&&(f=c.minimum[l.arrayIndex]),n<f)return[new o.V(t,n,`${n} is less than the minimum value ${f}`)]}if("maximum"in c){let f=c.maximum;if(o.K(c.maximum)==="array"&&(f=c.maximum[l.arrayIndex]),n>f)return[new o.V(t,n,`${n} is greater than the maximum value ${f}`)]}return[]}function Dr(l){const t=l.valueSpec,n=o.M(l.value.type);let c,d,f,_={};const y=n!=="categorical"&&l.value.property===void 0,b=!y,E=o.K(l.value.stops)==="array"&&o.K(l.value.stops[0])==="array"&&o.K(l.value.stops[0][0])==="object",I=Br({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(z){if(n==="identity")return[new o.V(z.key,z.value,'identity function may not have a "stops" property')];let N=[];const B=z.value;return N=N.concat(En({key:z.key,value:B,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:P})),o.K(B)==="array"&&B.length===0&&N.push(new o.V(z.key,B,"array must have at least one stop")),N},default:function(z){return Ar({key:z.key,value:z.value,valueSpec:t,style:z.style,styleSpec:z.styleSpec})}}});return n==="identity"&&y&&I.push(new o.V(l.key,l.value,'missing required property "property"')),n==="identity"||l.value.stops||I.push(new o.V(l.key,l.value,'missing required property "stops"')),n==="exponential"&&l.valueSpec.expression&&!o.N(l.valueSpec)&&I.push(new o.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(b&&!o.O(l.valueSpec)?I.push(new o.V(l.key,l.value,"property functions not supported")):y&&!o.Q(l.valueSpec)&&I.push(new o.V(l.key,l.value,"zoom functions not supported"))),n!=="categorical"&&!E||l.value.property!==void 0||I.push(new o.V(l.key,l.value,'"property" property is required')),I;function P(z){let N=[];const B=z.value,G=z.key;if(o.K(B)!=="array")return[new o.V(G,B,`array expected, ${o.K(B)} found`)];if(B.length!==2)return[new o.V(G,B,`array length 2 expected, length ${B.length} found`)];if(E){if(o.K(B[0])!=="object")return[new o.V(G,B,`object expected, ${o.K(B[0])} found`)];if(B[0].zoom===void 0)return[new o.V(G,B,"object stop key must have zoom")];if(B[0].value===void 0)return[new o.V(G,B,"object stop key must have value")];const V=o.M(B[0].zoom);if(typeof V!="number")return[new o.V(G,B[0].zoom,"stop zoom values must be numbers")];if(f&&f>V)return[new o.V(G,B[0].zoom,"stop zoom values must appear in ascending order")];V!==f&&(f=V,d=void 0,_={}),N=N.concat(Br({key:`${G}[0]`,value:B[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:Gr,value:M}}))}else N=N.concat(M({key:`${G}[0]`,value:B[0],valueSpec:{},style:z.style,styleSpec:z.styleSpec},B));return o.S(o.U(B[1]))?N.concat([new o.V(`${G}[1]`,B[1],"expressions are not allowed in function stops.")]):N.concat(Ar({key:`${G}[1]`,value:B[1],valueSpec:t,style:z.style,styleSpec:z.styleSpec}))}function M(z,N){const B=o.K(z.value),G=o.M(z.value),V=z.value!==null?z.value:N;if(c){if(B!==c)return[new o.V(z.key,V,`${B} stop domain type must match previous stop domain type ${c}`)]}else c=B;if(B!=="number"&&B!=="string"&&B!=="boolean"&&typeof G!="number"&&typeof G!="string"&&typeof G!="boolean")return[new o.V(z.key,V,"stop domain value must be a number, string, or boolean")];if(B!=="number"&&n!=="categorical"){let X=`number expected, ${B} found`;return o.O(t)&&n===void 0&&(X+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new o.V(z.key,V,X)]}return n!=="categorical"||B!=="number"||typeof G=="number"&&isFinite(G)&&Math.floor(G)===G?n!=="categorical"&&B==="number"&&typeof G=="number"&&typeof d=="number"&&d!==void 0&&G<d?[new o.V(z.key,V,"stop domain values must appear in ascending order")]:(d=G,n==="categorical"&&G in _?[new o.V(z.key,V,"stop domain values must be unique")]:(_[G]=!0,[])):[new o.V(z.key,V,`integer expected, found ${String(G)}`)]}}function an(l){const t=(l.expressionContext==="property"?o.W:o.X)(o.U(l.value),l.valueSpec);if(t.result==="error")return t.value.map(c=>new o.V(`${l.key}${c.key}`,l.value,c.message));const n=t.value.expression||t.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!n.outputDefined())return[new o.V(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!o.Y(n))return[new o.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return On(n,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!o.Z(n,["zoom","feature-state"]))return[new o.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!o._(n))return[new o.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function On(l,t){const n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)n.delete(d);if(n.size===0)return[];const c=[];return l instanceof o.$&&n.has(l.name)?[new o.V(t.key,t.value,`["${l.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(l.eachChild(d=>{c.push(...On(d,t))}),c)}function po(l){const t=l.key,n=l.value,c=l.valueSpec,d=[];return Array.isArray(c.values)?c.values.indexOf(o.M(n))===-1&&d.push(new o.V(t,n,`expected one of [${c.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(c.values).indexOf(o.M(n))===-1&&d.push(new o.V(t,n,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(n)} found`)),d}function $o(l){return o.a1(o.U(l.value))?an(o.L({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):Hr(l)}function Hr(l){const t=l.value,n=l.key;if(o.K(t)!=="array")return[new o.V(n,t,`array expected, ${o.K(t)} found`)];const c=l.styleSpec;let d,f=[];if(t.length<1)return[new o.V(n,t,"filter array must have at least 1 element")];switch(f=f.concat(po({key:`${n}[0]`,value:t[0],valueSpec:c.filter_operator,style:l.style,styleSpec:l.styleSpec})),o.M(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&o.M(t[1])==="$type"&&f.push(new o.V(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&f.push(new o.V(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(d=o.K(t[1]),d!=="string"&&f.push(new o.V(`${n}[1]`,t[1],`string expected, ${d} found`)));for(let _=2;_<t.length;_++)d=o.K(t[_]),o.M(t[1])==="$type"?f=f.concat(po({key:`${n}[${_}]`,value:t[_],valueSpec:c.geometry_type,style:l.style,styleSpec:l.styleSpec})):d!=="string"&&d!=="number"&&d!=="boolean"&&f.push(new o.V(`${n}[${_}]`,t[_],`string, number, or boolean expected, ${d} found`));break;case"any":case"all":case"none":for(let _=1;_<t.length;_++)f=f.concat(Hr({key:`${n}[${_}]`,value:t[_],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":d=o.K(t[1]),t.length!==2?f.push(new o.V(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):d!=="string"&&f.push(new o.V(`${n}[1]`,t[1],`string expected, ${d} found`))}return f}function ln(l,t){const n=l.key,c=l.style,d=l.layer,f=l.styleSpec,_=l.value,y=l.objectKey,b=f[`${t}_${l.layerType}`];if(!b)return[];const E=y.match(/^(.*)-use-theme$/);if(t==="paint"&&E&&b[E[1]])return o.S(_)?[].concat(Ar({key:l.key,value:_,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:f,expressionContext:"property",propertyType:t,propertyKey:y})):Ar({key:n,value:_,valueSpec:{type:"string"},style:c,styleSpec:f});const I=y.match(/^(.*)-transition$/);if(t==="paint"&&I&&b[I[1]]&&b[I[1]].transition)return Ar({key:n,value:_,valueSpec:f.transition,style:c,styleSpec:f});const P=l.valueSpec||b[y];if(!P)return[new o.J(n,_,`unknown property "${y}"`)];let M;if(o.K(_)==="string"&&o.O(P)&&!P.tokens&&(M=/^{([^}]+)}$/.exec(_))){const N=`\`{ "type": "identity", "property": ${M?JSON.stringify(M[1]):'"_"'} }\``;return[new o.V(n,_,`"${y}" does not support interpolation syntax
|
|
75
75
|
Use an identity property function instead: ${N}.`)]}const z=[];if(l.layerType==="symbol")y!=="text-field"||!c||c.glyphs||c.imports||z.push(new o.V(n,_,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&o.a2(o.U(_))&&o.M(_.type)==="identity"&&z.push(new o.V(n,_,'"text-font" does not support identity functions'));else if(l.layerType==="model"&&t==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&o.O(P)&&(o.a3(P)||o.Q(P))){const N=o.W(o.U(_),P),B=N.value.expression||N.value._styleExpression.expression;B&&!o.Z(B,["measure-light"])&&(y==="model-emissive-strength"&&o._(B)&&o.Y(B)||z.push(new o.V(n,_,`${y} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return z.concat(Ar({key:l.key,value:_,valueSpec:P,style:c,styleSpec:f,expressionContext:"property",propertyType:t,propertyKey:y}))}function cs(l){return ln(l,"paint")}function us(l){return ln(l,"layout")}function Go(l){let t=[];const n=l.value,c=l.key,d=l.style,f=l.styleSpec;n.type||n.ref||t.push(new o.V(c,n,'either "type" or "ref" is required'));let _=o.M(n.type);const y=o.M(n.ref);if(n.id){const b=o.M(n.id);for(let E=0;E<l.arrayIndex;E++){const I=d.layers[E];o.M(I.id)===b&&t.push(new o.V(c,n.id,`duplicate layer id "${n.id}", previously used at line ${I.id.__line__}`))}}if("ref"in n){let b;["type","source","source-layer","filter","layout"].forEach(E=>{E in n&&t.push(new o.V(c,n[E],`"${E}" is prohibited for ref layers`))}),d.layers.forEach(E=>{o.M(E.id)===y&&(b=E)}),b?b.ref?t.push(new o.V(c,n.ref,"ref cannot reference another ref layer")):_=o.M(b.type):typeof y=="string"&&t.push(new o.V(c,n.ref,`ref layer "${y}" not found`))}else if(_!=="background"&&_!=="sky"&&_!=="slot")if(n.source){const b=d.sources&&d.sources[n.source],E=b&&o.M(b.type);b?E==="vector"&&_==="raster"?t.push(new o.V(c,n.source,`layer "${n.id}" requires a raster source`)):E==="raster"&&_!=="raster"?t.push(new o.V(c,n.source,`layer "${n.id}" requires a vector source`)):E!=="vector"||n["source-layer"]?E==="raster-dem"&&_!=="hillshade"?t.push(new o.V(c,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):E!=="raster-array"||["raster","raster-particle"].includes(_)?_==="line"&&n.paint&&(n.paint["line-gradient"]||n.paint["line-trim-offset"])&&E==="geojson"&&!b.lineMetrics?t.push(new o.V(c,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):_==="raster-particle"&&E!=="raster-array"&&t.push(new o.V(c,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):t.push(new o.V(c,n.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new o.V(c,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new o.V(c,n.source,`source "${n.source}" not found`))}else t.push(new o.V(c,n,'missing required property "source"'));return t=t.concat(Br({key:c,value:n,valueSpec:f.layer,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ar({key:`${c}.type`,value:n.type,valueSpec:f.layer.type,style:l.style,styleSpec:l.styleSpec,object:n,objectKey:"type"}),filter:b=>$o(o.L({layerType:_},b)),layout:b=>Br({layer:n,key:b.key,value:b.value,valueSpec:{},style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":E=>us(o.L({layerType:_},E))}}),paint:b=>Br({layer:n,key:b.key,value:b.value,valueSpec:{},style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":E=>cs(o.L({layerType:_,layer:n},E))}})}})),t}function Ho(l){const t=l.value,n=l.key,c=o.K(t);return c!=="string"?[new o.V(n,t,`string expected, ${c} found`)]:[]}const hs={promoteId:function l({key:t,value:n}){if(o.K(n)==="string")return Ho({key:t,value:n});if(Array.isArray(n)){const c=[],d=o.U(n),f=o.X(d);return f.result==="error"&&f.value.forEach(_=>{c.push(new o.V(`${t}${_.key}`,null,`${_.message}`))}),o.Z(f.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||c.push(new o.V(`${t}`,null,"promoteId expression should be only feature dependent")),c}{const c=[];for(const d in n)c.push(...l({key:`${t}.${d}`,value:n[d]}));return c}}};function Hn(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new o.V(n,t,'"type" is required')];const f=o.M(t.type);let _=[];switch(["vector","raster","raster-dem","raster-array"].includes(f)&&(t.url||t.tiles||_.push(new o.J(n,t,'Either "url" or "tiles" is required.'))),f){case"vector":case"raster":case"raster-dem":case"raster-array":return _=_.concat(Br({key:n,value:t,valueSpec:c[`source_${f.replace("-","_")}`],style:l.style,styleSpec:c,objectElementValidators:hs})),_;case"geojson":if(_=Br({key:n,value:t,valueSpec:c.source_geojson,style:d,styleSpec:c,objectElementValidators:hs}),t.cluster)for(const y in t.clusterProperties){const[b,E]=t.clusterProperties[y],I=typeof b=="string"?[b,["accumulated"],["get",y]]:b;_.push(...an({key:`${n}.${y}.map`,value:E,expressionContext:"cluster-map"})),_.push(...an({key:`${n}.${y}.reduce`,value:I,expressionContext:"cluster-reduce"}))}return _;case"video":return Br({key:n,value:t,valueSpec:c.source_video,style:d,styleSpec:c});case"image":return Br({key:n,value:t,valueSpec:c.source_image,style:d,styleSpec:c});case"canvas":return[new o.V(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return po({key:`${n}.type`,value:t.type,valueSpec:{values:ga(c)},style:d,styleSpec:c})}}function ga(l){return l.source.reduce((t,n)=>{const c=l[n];return c.type.type==="enum"&&(t=t.concat(Object.keys(c.type.values))),t},[])}function Bs(l){const t=l.value,n=l.styleSpec,c=n.light,d=l.style;let f=[];const _=o.K(t);if(t===void 0)return f;if(_!=="object")return f=f.concat([new o.V("light",t,`object expected, ${_} found`)]),f;for(const y in t){const b=y.match(/^(.*)-transition$/),E=y.match(/^(.*)-use-theme$/);f=f.concat(E&&c[E[1]]?Ar({key:y,value:t[y],valueSpec:{type:"string"},style:d,styleSpec:n}):b&&c[b[1]]&&c[b[1]].transition?Ar({key:y,value:t[y],valueSpec:n.transition,style:d,styleSpec:n}):c[y]?Ar({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}):[new o.V(y,t[y],`unknown property "${y}"`)])}return f}function qo(l){const t=l.value;let n=[];if(!t)return n;const c=o.K(t);if(c!=="object")return n=n.concat([new o.V("light-3d",t,`object expected, ${c} found`)]),n;const d=l.styleSpec,f=d["light-3d"],_=l.key,y=l.style,b=l.style.lights;for(const P of["type","id"])if(!(P in t))return n=n.concat([new o.V("light-3d",t,`missing property ${P} on light`)]),n;if(t.type&&b)for(let P=0;P<l.arrayIndex;P++){const M=o.M(t.type),z=b[P];o.M(z.type)===M&&n.push(new o.V(_,t.id,`duplicate light type "${t.type}", previously defined at line ${z.id.__line__}`))}const E=`properties_light_${t.type}`;if(!(E in d))return n=n.concat([new o.V("light-3d",t,`Invalid light type ${t.type}`)]),n;const I=d[E];for(const P in t)if(P==="properties"){const M=t[P],z=o.K(M);if(z!=="object")return n=n.concat([new o.V("properties",M,`object expected, ${z} found`)]),n;for(const N in M)n=n.concat(I[N]?Ar({key:N,value:M[N],valueSpec:I[N],style:y,styleSpec:d}):[new o.J(l.key,M[N],`unknown property "${N}"`)])}else{const M=P.match(/^(.*)-transition$/),z=P.match(/^(.*)-use-theme$/);n=n.concat(z&&f[z[1]]?Ar({key:P,value:t[P],valueSpec:{type:"string"},style:y,styleSpec:d}):M&&f[M[1]]&&f[M[1]].transition?Ar({key:P,value:t[P],valueSpec:d.transition,style:y,styleSpec:d}):f[P]?Ar({key:P,value:t[P],valueSpec:f[P],style:y,styleSpec:d}):[new o.J(P,t[P],`unknown property "${P}"`)])}return n}function ya(l){const t=l.value,n=l.key,c=l.style,d=l.styleSpec,f=d.terrain;let _=[];const y=o.K(t);if(t===void 0||y==="null")return _;if(y!=="object")return _=_.concat([new o.V("terrain",t,`object expected, ${y} found`)]),_;for(const b in t){const E=b.match(/^(.*)-transition$/),I=b.match(/^(.*)-use-theme$/);_=_.concat(I&&f[I[1]]?Ar({key:b,value:t[b],valueSpec:{type:"string"},style:c,styleSpec:d}):E&&f[E[1]]&&f[E[1]].transition?Ar({key:b,value:t[b],valueSpec:d.transition,style:c,styleSpec:d}):f[b]?Ar({key:b,value:t[b],valueSpec:f[b],style:c,styleSpec:d}):[new o.J(b,t[b],`unknown property "${b}"`)])}if(t.source){const b=c.sources&&c.sources[t.source],E=b&&o.M(b.type);b?E!=="raster-dem"&&_.push(new o.V(n,t.source,`terrain cannot be used with a source of type ${String(E)}, it only be used with a "raster-dem" source type`)):_.push(new o.V(n,t.source,`source "${t.source}" not found`))}else _.push(new o.V(n,t,'terrain is missing required property "source"'));return _}function va(l){const t=l.value,n=l.style,c=l.styleSpec,d=c.fog;let f=[];const _=o.K(t);if(t===void 0)return f;if(_!=="object")return f=f.concat([new o.V("fog",t,`object expected, ${_} found`)]),f;for(const y in t){const b=y.match(/^(.*)-transition$/),E=y.match(/^(.*)-use-theme$/);f=f.concat(E&&d[E[1]]?Ar({key:y,value:t[y],valueSpec:{type:"string"},style:n,styleSpec:c}):b&&d[b[1]]&&d[b[1]].transition?Ar({key:y,value:t[y],valueSpec:c.transition,style:n,styleSpec:c}):d[y]?Ar({key:y,value:t[y],valueSpec:d[y],style:n,styleSpec:c}):[new o.J(y,t[y],`unknown property "${y}"`)])}return f}const sc={"*":()=>[],array:En,boolean:function(l){const t=l.value,n=l.key,c=o.K(t);return c!=="boolean"?[new o.V(n,t,`boolean expected, ${c} found`)]:[]},number:Gr,color:function(l){const t=l.key,n=l.value,c=o.K(n);return c!=="string"?[new o.V(t,n,`color expected, ${c} found`)]:o.a0.parseCSSColor(n)===null?[new o.V(t,n,`color expected, "${n}" found`)]:[]},enum:po,filter:$o,function:Dr,layer:Go,object:Br,source:Hn,model:o.a4,light:Bs,"light-3d":qo,terrain:ya,fog:va,string:Ho,formatted:function(l){return Ho(l).length===0?[]:an(l)},resolvedImage:function(l){return Ho(l).length===0?[]:an(l)},projection:function(l){const t=l.value,n=l.styleSpec,c=n.projection,d=l.style;let f=[];const _=o.K(t);if(_==="object")for(const y in t)f=f.concat(Ar({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}));else _!=="string"&&(f=f.concat([new o.V("projection",t,`object or string expected, ${_} found`)]));return f},import:function(l){const{value:t,styleSpec:n}=l,{data:c,...d}=t;Object.defineProperty(d,"__line__",{value:t.__line__,enumerable:!1});let f=Br(o.L({},l,{value:d,valueSpec:n.import}));return o.M(d.id)===""&&f.push(new o.V(`${l.key}.id`,d,"import id can't be an empty string")),c&&(f=f.concat(ol(c,n,{key:`${l.key}.data`}))),f},iconset:function(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new o.V(n,t,'"type" is required')];const f=o.M(t.type);let _=[];if(_=_.concat(Br({key:n,value:t,valueSpec:c[`iconset_${f}`],style:d,styleSpec:c})),f==="source"&&t.source){const y=d.sources&&d.sources[t.source],b=y&&o.M(y.type);y?b!=="raster-array"&&_.push(new o.V(n,t.source,`iconset cannot be used with a source of type ${String(b)}, it only be used with a "raster-array" source type`)):_.push(new o.V(n,t.source,`source "${t.source}" not found`))}return _}};function Ar(l,t=!1){const n=l.value,c=l.valueSpec,d=l.styleSpec;if(c.expression&&o.a2(o.M(n)))return Dr(l);if(c.expression&&o.S(o.U(n)))return an(l);if(c.type&&sc[c.type]){const f=sc[c.type](l);return t===!0&&f.length>0&&o.K(l.value)==="array"?an(l):f}return Br(o.L({},l,{valueSpec:c.type?d[c.type]:c}))}function Zo(l){const t=l.value,n=l.key,c=Ho(l);return c.length||(t.indexOf("{fontstack}")===-1&&c.push(new o.V(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&c.push(new o.V(n,t,'"glyphs" url must include a "{range}" token'))),c}function ol(l,t=o.a5,n={}){return Ar({key:n.key||"",value:l,valueSpec:t.$root,styleSpec:t,style:l,objectElementValidators:{glyphs:Zo,"*":()=>[]}})}function fo(l,t=o.a5){return we(ol(l,t))}const ac=l=>we(Hn(l)),Pu=l=>we(Bs(l)),lc=l=>we(qo(l)),ft=l=>we(ya(l)),ds=l=>we(va(l)),Du=l=>we(function(t){const n=t.value,c=t.style,d=t.styleSpec,f=d.snow;let _=[];const y=o.K(n);if(n===void 0)return _;if(y!=="object")return _=_.concat([new o.V("snow",n,`object expected, ${y} found`)]),_;for(const b in n){const E=b.match(/^(.*)-transition$/);_=_.concat(E&&f[E[1]]&&f[E[1]].transition?Ar({key:b,value:n[b],valueSpec:d.transition,style:c,styleSpec:d}):f[b]?Ar({key:b,value:n[b],valueSpec:f[b],style:c,styleSpec:d}):[new o.J(b,n[b],`unknown property "${b}"`)])}return _}(l)),$e=l=>we(function(t){const n=t.value,c=t.style,d=t.styleSpec,f=d.rain;let _=[];const y=o.K(n);if(n===void 0)return _;if(y!=="object")return _=_.concat([new o.V("rain",n,`object expected, ${y} found`)]),_;for(const b in n){const E=b.match(/^(.*)-transition$/);_=_.concat(E&&f[E[1]]&&f[E[1]].transition?Ar({key:b,value:n[b],valueSpec:d.transition,style:c,styleSpec:d}):f[b]?Ar({key:b,value:n[b],valueSpec:f[b],style:c,styleSpec:d}):[new o.J(b,n[b],`unknown property "${b}"`)])}return _}(l)),U=l=>we(Go(l)),Z=l=>we($o(l)),se=l=>we(cs(l)),ge=l=>we(us(l)),pe=l=>we(o.a4(l));function we(l){return l.slice().sort((t,n)=>t.line&&n.line?t.line-n.line:0)}function Te(l,t){let n=!1;if(t&&t.length)for(const c of t)c instanceof o.J?o.w(c.message):(l.fire(new o.z(new Error(c.message))),n=!0);return n}let Ae;class Be extends o.E{constructor(t,n="flat"){super(),this._transitionable=new o.a6(Ae||(Ae=new o.a7({anchor:new o.a8(o.a5.light.anchor),position:new o.a9(o.a5.light.position),color:new o.a8(o.a5.light.color),intensity:new o.a8(o.a5.light.intensity)}))),this.setLight(t,n),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n,c={}){this._validate(Pu,t,c)||(this._transitionable.setTransitionOrValue(t),this.id=n)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,c){return(!c||c.validate!==!1)&&Te(this,t.call(fo,o.l({value:n,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}}let qe=class extends o.E{constructor(l,t,n,c){super(),this.scope=n,this._transitionable=new o.a6(new o.a7({source:new o.a8(o.a5.terrain.source),exaggeration:new o.a8(o.a5.terrain.exaggeration)}),n,c),this._transitionable.setTransitionOrValue(l,c),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t}get(){return this._transitionable.serialize()}set(l,t){this._transitionable.setTransitionOrValue(l,t)}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}getExaggeration(l){return this._transitioning.possiblyEvaluate(new o.aa(l)).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const l=this._transitionable._values.exaggeration;if(!l)return null;const t=l.value.expression;if(!t)return null;let n=-1,c=-1,d=1;for(const f of t.zoomStops)d=t.evaluate(new o.aa(f)),d>.01?(n=f,c=-1):c=f;return d<.01&&n>0&&c>n?[n,c]:null}isZoomDependent(){const l=this._transitionable._values.exaggeration;return l!=null&&l.value!=null&&l.value.expression!=null&&l.value.expression instanceof o.ab}};const Oe=45,mt=65,bt=.05;function Rt(l,t,n,c){const d=o.af(Oe,mt,n),[f,_]=Qt(l,c);let y=1-Math.min(1,Math.exp((t-f)/(_-f)*-6));return y*=y*y,y=Math.min(1,1.00747*y),y*d*l.alpha}function Qt(l,t){const n=.5/Math.tan(.5*t);return[l.range[0]+n,l.range[1]+n]}function ni(l,t,n,c,d){const f=o.ad([],[t,n,c],d.mercatorFogMatrix);return Rt(l,o.ae(f),d.pitch,d._fov)}function hi(l,t,n,c,d,f,_){const y=[[n,c,0],[d,c,0],[d,f,0],[n,f,0]];let b=Number.MAX_VALUE,E=-Number.MAX_VALUE;for(const I of y){const P=o.ad([],I,t),M=o.ae(P);b=Math.min(b,M),E=Math.max(E,M)}return[Rt(l,b,_.pitch,_._fov),Rt(l,E,_.pitch,_._fov)]}class _i extends o.E{constructor(t,n,c,d){super();const f=new o.a7({range:new o.a8(o.a5.fog.range),color:new o.a8(o.a5.fog.color),"color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new o.a8(o.a5.fog["high-color"]),"high-color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new o.a8(o.a5.fog["space-color"]),"space-color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new o.a8(o.a5.fog["horizon-blend"]),"star-intensity":new o.a8(o.a5.fog["star-intensity"]),"vertical-range":new o.a8(o.a5.fog["vertical-range"])});this._transitionable=new o.a6(f,c,new Map(d)),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=n,this.properties=new o.ag(f),this.scope=c}get state(){const t=this._transform,n=t.projection.name==="globe",c=o.ah(t.zoom),d=this.properties.get("range"),f=[.5,3];return{range:n?[o.ai(f[0],d[0],c),o.ai(f[1],d[1],c)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,n,c={}){if(this._validate(ds,t,c))return;const d=o.l({},t);for(const f of Object.keys(o.a5.fog))d[f]===void 0&&(d[f]=o.a5.fog[f].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,n)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const n=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:o.af(Oe,mt,t))*n.a}getOpacityAtLatLng(t,n){return this._transform.projection.supportsFog?function(c,d,f){const _=o.ac.fromLngLat(d),y=f.elevation?f.elevation.getAtPointOrZero(_):0;return ni(c,_.x,_.y,y,f)}(this.state,t,n):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const n=this._transform.calculateFogTileMatrix(t.toUnwrapped());return hi(this.state,n,0,0,o.aj,o.aj,this._transform)}getOpacityForBounds(t,n,c,d,f){return this._transform.projection.supportsFog?hi(this.state,t,n,c,d,f,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?Qt(this.state,t):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const n=[4,5,6,7];for(const c of n){const d=t.points[c];let f;if(d[2]>=0)f=d;else{const _=t.points[c-4];f=o.ak(_,d,_[2]/(_[2]-d[2]))}if(ni(this.state,f[0],f[1],0,this._transform)>=bt)return!0}return!1}updateConfig(t){this._transitionable.setTransitionOrValue(this._options,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,c){return(!c||c.validate!==!1)&&Te(this,t.call(fo,o.l({value:n,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}}let Rr,yi,nr,Li,or=class extends o.E{constructor(l,t,n,c){super();const d=Rr||(Rr=new o.a7({density:new o.a8(o.a5.snow.density),intensity:new o.a8(o.a5.snow.intensity),color:new o.a8(o.a5.snow.color),opacity:new o.a8(o.a5.snow.opacity),vignette:new o.a8(o.a5.snow.vignette),"vignette-color":new o.a8(o.a5.snow["vignette-color"]),"center-thinning":new o.a8(o.a5.snow["center-thinning"]),direction:new o.a8(o.a5.snow.direction),"flake-size":new o.a8(o.a5.snow["flake-size"])}));this._transitionable=new o.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=o.al(n[0]),d=-Math.max(o.al(n[1]),.01),f=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],_=this.properties.get("vignette"),y=this.properties.get("vignette-color");return y.a=_,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new o.am(t.r,t.g,t.b,t.a*l),direction:f,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:y}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(Du,l,n))return;const c=o.l({},l);for(const d of Object.keys(o.a5.snow))c[d]===void 0&&(c[d]=o.a5.snow[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&Te(this,l.call(fo,o.l({value:t,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}},lr=class extends o.E{constructor(l,t,n,c){super();const d=yi||(yi=new o.a7({density:new o.a8(o.a5.rain.density),intensity:new o.a8(o.a5.rain.intensity),color:new o.a8(o.a5.rain.color),opacity:new o.a8(o.a5.rain.opacity),vignette:new o.a8(o.a5.rain.vignette),"vignette-color":new o.a8(o.a5.rain["vignette-color"]),"center-thinning":new o.a8(o.a5.rain["center-thinning"]),direction:new o.a8(o.a5.rain.direction),"droplet-size":new o.a8(o.a5.rain["droplet-size"]),"distortion-strength":new o.a8(o.a5.rain["distortion-strength"])}));this._transitionable=new o.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=o.al(n[0]),d=-Math.max(o.al(n[1]),.01),f=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],_=this.properties.get("vignette-color");return _.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new o.am(t.r,t.g,t.b,t.a*l),direction:f,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:_}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate($e,l,n))return;const c=o.l({},l);for(const d of Object.keys(o.a5.rain))c[d]===void 0&&(c[d]=o.a5.rain[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&Te(this,l.call(fo,o.l({value:t,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}};class qr extends o.E{constructor(t,n,c,d){super(),this.scope=c,this._options=t,this.properties=new o.ag(n),this._transitionable=new o.a6(n,c,new Map(d)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,n){this._options=t,this._transitionable.setTransitionOrValue(t.properties,n)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class en{constructor(t,n,c,d){this.screenBounds=t,this.cameraPoint=n,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=c,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,d)}static createFromScreenPoints(t,n){let c,d;if(t instanceof o.P||typeof t[0]=="number"){const f=o.P.convert(t);c=[f],d=n.isPointAboveHorizon(f)}else{const f=o.P.convert(t[0]),_=o.P.convert(t[1]),y=f.add(_)._div(2);c=[f,_],d=o.ao(f,_).every(b=>n.isPointAboveHorizon(b))&&n.isPointAboveHorizon(y)}return new en(c,n.getCameraPoint(),d,n)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return o.ao(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.ao(n,c,0,!1);return this.cameraPoint.y>c.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x<c.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=c.x?d[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(d[3]=this.cameraPoint)),o.ap(d,t)}bufferedCameraGeometryGlobe(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.ao(n,c,t),f=this.cameraPoint.clone();switch(3*((f.y>n.y)+(f.y>c.y))+((f.x>n.x)+(f.x>c.x))){case 0:d[0]=f,d[4]=f.clone();break;case 1:d.splice(1,0,f);break;case 2:d[1]=f;break;case 3:d.splice(4,0,f);break;case 5:d.splice(2,0,f);break;case 6:d[3]=f;break;case 7:d.splice(3,0,f);break;case 8:d[2]=f}return d}containsTile(t,n,c,d=0){const f=t.queryPadding/n._pixelsPerMercatorPixel+1,_=c?this._bufferedCameraMercator(f,n):this._bufferedScreenMercator(f,n);let y=t.tileID.wrap+(_.unwrapped?d:0);const b=_.polygon.map(G=>o.aq(t.tileTransform,G,y));if(!o.ar(b,0,0,o.aj,o.aj))return;y=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const E=this.screenGeometryMercator.polygon.map(G=>o.as(t.tileTransform,G,y)),I=E.map(G=>new o.P(G[0],G[1])),P=n.getFreeCameraOptions().position||new o.ac(0,0,0),M=o.as(t.tileTransform,P,y),z=E.map(G=>{const V=o.at(G,G,M);return o.au(V,V),new o.av(M,V)}),N=o.aw(t,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:I,tilespaceRays:z,bufferedTilespaceGeometry:b,bufferedTilespaceBounds:(B=o.ax(b),B.min.x=o.aD(B.min.x,0,o.aj),B.min.y=o.aD(B.min.y,0,o.aj),B.max.x=o.aD(B.max.x,0,o.aj),B.max.y=o.aD(B.max.y,0,o.aj),B),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:N};var B}_bufferedScreenMercator(t,n){const c=ps(t);if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),n):{polygon:this.bufferedScreenGeometry(t).map(f=>n.pointCoordinate3D(f)),unwrapped:!0},this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(t,n){const c=ps(t);if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),n):{polygon:this.bufferedCameraGeometry(t).map(f=>n.pointCoordinate3D(f)),unwrapped:!0},this._cameraRaycastCache[c]=d,d}}_projectAndResample(t,n){const c=function(f,_){const y=o.az([],_.pixelMatrix,_.globeMatrix),b=[0,-o.aE,0,1],E=[0,o.aE,0,1],I=[0,0,0,1];o.aA(b,b,y),o.aA(E,E,y),o.aA(I,I,y);const P=new o.P(b[0]/b[3],b[1]/b[3]),M=new o.P(E[0]/E[3],E[1]/E[3]),z=o.aB(f,P)&&b[3]<I[3],N=o.aB(f,M)&&E[3]<I[3];if(!z&&!N)return null;const B=function(le,ne,de){for(let me=1;me<le.length;me++){const Le=bn(ne.pointCoordinate3D(le[me-1]).x),Me=bn(ne.pointCoordinate3D(le[me]).x);if(de<0){if(Le<Me)return{idx:me,t:-Le/(Me-1-Le)}}else if(Me<Le)return{idx:me,t:(1-Le)/(Me+1-Le)}}return null}(f,_,z?-1:1);if(!B)return null;const{idx:G,t:V}=B;let X=G>1?pn(f.slice(0,G),_):[],Q=G<f.length?pn(f.slice(G),_):[];X=X.map(le=>new o.P(bn(le.x),le.y)),Q=Q.map(le=>new o.P(bn(le.x),le.y));const ie=[...X];ie.length===0&&ie.push(Q[Q.length-1]);const ue=o.ai(ie[ie.length-1].y,(Q.length===0?X[0]:Q[0]).y,V);let ae;return ae=z?[new o.P(0,ue),new o.P(0,0),new o.P(1,0),new o.P(1,ue)]:[new o.P(1,ue),new o.P(1,1),new o.P(0,1),new o.P(0,ue)],ie.push(...ae),Q.length===0?ie.push(X[0]):ie.push(...Q),{polygon:ie.map(le=>new o.ac(le.x,le.y)),unwrapped:!1}}(t,n);if(c)return c;const d=function(f,_){let y=!1,b=-1/0,E=0;for(let P=0;P<f.length-1;P++)f[P].x>b&&(b=f[P].x,E=P);for(let P=0;P<f.length-1;P++){const M=(E+P)%(f.length-1),z=f[M],N=f[M+1];Math.abs(z.x-N.x)>.5&&(z.x<N.x?(z.x+=1,M===0&&(f[f.length-1].x+=1)):(N.x+=1,M+1===f.length-1&&(f[0].x+=1)),y=!0)}const I=o.ay(_.center.lng);return y&&I<Math.abs(I-1)&&f.forEach(P=>{P.x-=1}),{polygon:f,unwrapped:y}}(pn(t,n).map(f=>new o.P(bn(f.x),f.y)),n);return{polygon:d.polygon.map(f=>new o.ac(f.x,f.y)),unwrapped:d.unwrapped}}}function pn(l,t){return o.aC(l,n=>{const c=t.pointCoordinate3D(n);n.x=c.x,n.y=c.y},1/256)}function bn(l){return l<0?1+l%1:l%1}function ps(l){return 100*l|0}function Dn(l,t,n,c,d){const f=function(y,b){if(y)return d(y);if(b){if(l.url&&b.tiles&&l.tiles&&delete l.tiles,b.variants){if(!Array.isArray(b.variants))return d(new Error("variants must be an array"));for(const I of b.variants){if(I==null||typeof I!="object"||I.constructor!==Object)return d(new Error("variant must be an object"));if(!Array.isArray(I.capabilities))return d(new Error("capabilities must be an array"));if(I.capabilities.length===1&&I.capabilities[0]==="meshopt"){b=o.l(b,I);break}}}const E=o.aF(o.l({},b,l),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);E.tiles=t.canonicalizeTileset(E,l.url),d(null,E)}},_=function(y,b,E){if(!y)return null;if(!b&&!E)return y;E=E||y.worldview_default;const I=Object.values(y.language||{});if(I.length===0)return null;const P=Object.values(y.worldview||{});if(P.length===0)return null;const M=I.every(N=>N===b),z=P.every(N=>N===E);return M&&z?y:b in(y.language_options||{})||E in(y.worldview_options||{})?null:y.language_options&&y.worldview_options?y:null}(l.data,n,c);return _?o.q.frame(()=>f(null,_)):l.url?o.n(t.transformRequest(t.normalizeSourceURL(l.url,null,n,c),o.R.Source),f):o.q.frame(()=>{const{data:y,...b}=l;f(null,b)})}function Rn(l,t){const n=Math.pow(2,t.z),c=Math.floor(o.ay(l.getWest())*n),d=Math.floor(o.aH(l.getNorth())*n),f=Math.ceil(o.ay(l.getEast())*n),_=Math.ceil(o.aH(l.getSouth())*n);return t.x>=c&&t.x<f&&t.y>=d&&t.y<_}class yn{constructor(t,n,c){this.bounds=t?o.aG.convert(this.validateBounds(t)):null,this.minzoom=n||0,this.maxzoom=c||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const n of t)this.extraBounds.push(o.aG.convert(this.validateBounds(n)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!Rn(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const n of this.extraBounds)if(Rn(n,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const n=new yn(t.bounds,t.minzoom,t.maxzoom);return n.addExtraBounds(t.extra_bounds),n}}class An extends o.E{constructor(t,n,c,d){if(super(),this.id=t,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.l(this,o.aF(n,["url","scheme","tileSize","promoteId"])),this._options=o.l({type:"vector"},n),this._collectResourceTiming=!!n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new o.aI}load(t){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const n=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview();this._tileJSONRequest=Dn(this._options,this.map._requestManager,n,c,(d,f)=>{if(this._tileJSONRequest=null,this._loaded=!0,d)n&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${n}`),c&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${c}`),this.fire(new o.z(d));else if(f){if(o.l(this,f),this.hasWorldviews=!!f.worldview_options,f.worldview_default&&(this.worldviewDefault=f.worldview_default),f.vector_layers){this.vectorLayers=f.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const _ of f.vector_layers)this.vectorLayerIds.push(_.id),f.worldview&&f.worldview[_.source]&&this.localizableLayerIds.add(_.id)}this.tileBounds=yn.fromTileJSON(f),gn(f.tiles,this.map._requestManager._customAccessToken),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}t&&t(d)})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return o.l({},this._options)}loadTile(t,n){const c=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(c),f=this.map._requestManager.transformRequest(d,o.R.Tile),_=this.map.style?this.map.style.getLut(this.scope):null,y=_?{image:_.image.clone()}:null,b={request:f,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:y,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:o.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor()};if(this.hasWorldviews&&o.f(c)&&(b.worldview=this.map.getWorldview()||this.worldviewDefault,b.localizableLayerIds=this.localizableLayerIds),b.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",b,E.bind(this));else if(t.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",b,E.bind(this),void 0,!0);else{const I=o.aJ.call({deduped:this._deduped},b,(P,M)=>{P||!M?E.call(this,P):(b.data={cacheControl:M.cacheControl,expires:M.expires,rawData:M.rawData.slice(0)},t.actor&&t.actor.send("loadTile",b,E.bind(this),void 0,!0))},!0);t.request={cancel:I}}function E(I,P){return delete t.request,t.aborted?n(null):I&&I.status!==404?n(I):(P&&P.resourceTiming&&(t.resourceTiming=P.resourceTiming),this.map._refreshExpiredTiles&&P&&t.setExpiryData(P),t.loadVectorData(P,this.map.painter),o.aK(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,n){t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Wo extends o.E{constructor(t,n,c,d){super(),this.id=t,this.dispatcher=c,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.l({type:"raster"},n),o.l(this,o.aF(n,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"})),this._tileJSONRequest=Dn(this._options,this.map._requestManager,null,null,(n,c)=>{this._tileJSONRequest=null,this._loaded=!0,n?this.fire(new o.z(n)):c&&(o.l(this,c),c.raster_layers&&(this.rasterLayers=c.raster_layers,this.rasterLayerIds=this.rasterLayers.map(d=>d.id)),this.tileBounds=yn.fromTileJSON(c),gn(c.tiles),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(n)})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return o.l({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const c=o.q.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);t.request=o.o(this.map._requestManager.transformRequest(d,o.R.Tile),(f,_,y,b)=>(delete t.request,t.aborted?(t.state="unloaded",n(null)):f?(t.state="errored",n(f)):_?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:y,expires:b}),t.setTexture(_,this.map.painter),t.state="loaded",o.aK(this.dispatcher),void n(null)):n(null)))}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n&&n()}unloadTile(t,n){t.texture&&t.texture instanceof o.T?(t.destroy(!0),t.texture&&t.texture instanceof o.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),n&&n()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class xa extends Wo{constructor(t,n,c,d){super(t,n,c,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._options=o.l({type:"raster-array"},n)}triggerRepaint(t){const n=this.map.painter._terrain,c=this.map.style.getSourceCache(this.id);n&&n.enabled&&c&&n._clearRenderCacheForTile(c.id,t.tileID),this.map.triggerRepaint()}loadTile(t,n){const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,o.R.Tile),f={request:d,uid:t.uid,tileID:t.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=d,t.actor||(t.actor=this.dispatcher.getActor());const _=(y,b,E,I)=>{if(delete t.request,t.aborted)return t.state="unloaded",n(null);if(y)return y.name==="AbortError"?void 0:(t.state="errored",n(y));if(this.map._refreshExpiredTiles&&b&&t.setExpiryData({cacheControl:E,expires:I}),this.partial)t.state="empty";else{if(!b)return n(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=b}n(null)};t.request=this.partial?t.fetchHeader(void 0,_.bind(this)):t.actor.send("loadTile",f,_.bind(this),void 0,!0)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,n){const c=t.texture;c&&c instanceof o.T?(t.destroy(!0),this.map.painter.saveTileTexture(c)):(t.destroy(),t.flushQueues(),t._isHeaderLoaded=!1,delete t._mrt,delete t.textureDescriptor),t.fbo&&(t.fbo.destroy(),delete t.fbo),delete t.request,delete t.requestParams,delete t.neighboringTiles,t.state="unloaded"}prepareTile(t,n,c){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBand(n,c,(d,f)=>{if(d)return t.state="errored",this.fire(new o.z(d)),void this.triggerRepaint(t);f&&(t._isHeaderLoaded=!0,t.setTexture(f,this.map.painter),t.state="loaded",this.triggerRepaint(t))}))}getInitialBand(t){if(!this.rasterLayers)return 0;const n=this.rasterLayers.find(({id:f})=>f===t),c=n&&n.fields,d=c&&c.bands&&c.bands;return d?d[0]:0}getTextureDescriptor(t,n,c){if(!t)return;const d=n.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let f=null;n instanceof o.aN?f=n.paint.get("raster-array-band"):n instanceof o.aO&&(f=n.paint.get("raster-particle-array-band"));const _=f||this.getInitialBand(d);if(_!=null)if(t.textureDescriptor){if(!t.updateNeeded(d,_)||c)return Object.assign({},t.textureDescriptor,{texture:t.texture})}else this.prepareTile(t,d,_)}getImages(t,n){const c=new Map;for(const d of t)for(const f of n){const[_,y]=f.split("/"),b=d.getLayer(_);if(!b||!b.hasBand(y)||!b.hasDataForBand(y))continue;const{bytes:E,tileSize:I,buffer:P}=b.getBandView(y),M=I+2*P,z={data:new o.r({width:M,height:M},E),pixelRatio:2,sdf:!1,usvg:!1,version:0};c.set(f,z)}return c}}const cc={vector:An,raster:Wo,"raster-dem":class extends Wo{constructor(l,t,n,c){super(l,t,n,c),this.type="raster-dem",this.maxzoom=22,this._options=o.l({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function c(d,f){d&&(l.state="errored",t(d)),f&&(l.dem=f,l.dem.onDeserialize(),l.needsHillshadePrepare=!0,l.needsDEMTextureUpload=!0,l.state="loaded",t(null))}l.request=o.o(this.map._requestManager.transformRequest(n,o.R.Tile),(function(d,f,_,y){if(delete l.request,l.aborted)l.state="unloaded",t(null);else if(d)l.state="errored",t(d);else if(f){this.map._refreshExpiredTiles&&l.setExpiryData({cacheControl:_,expires:y});const b=ImageBitmap&&f instanceof ImageBitmap&&o.t(),E=1-(f.width-o.aL(f.width))/2;E<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const I=b?f:o.q.getImageData(f,E),P={uid:l.uid,tileID:l.tileID,source:this.id,type:this.type,scope:this.scope,rawImageData:I,encoding:this.encoding,padding:E};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadTile",P,c.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(l){const t=l.canonical,n=Math.pow(2,t.z),c=(t.x-1+n)%n,d=t.x===0?l.wrap-1:l.wrap,f=(t.x+1+n)%n,_=t.x+1===n?l.wrap+1:l.wrap,y={};return y[new o.aM(l.overscaledZ,d,t.z,c,t.y).key]={backfilled:!1},y[new o.aM(l.overscaledZ,_,t.z,f,t.y).key]={backfilled:!1},t.y>0&&(y[new o.aM(l.overscaledZ,d,t.z,c,t.y-1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,_,t.z,f,t.y-1).key]={backfilled:!1}),t.y+1<n&&(y[new o.aM(l.overscaledZ,d,t.z,c,t.y+1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,_,t.z,f,t.y+1).key]={backfilled:!1}),y}},"raster-array":xa,geojson:class extends o.E{constructor(l,t,n,c){super(),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=n.getActor(),this.setEventedParent(c),this._data=t.data,this._options=o.l({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const d=o.aj/this.tileSize;this.workerOptions=o.l({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*d,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*d,extent:o.aj,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:o.aj,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*d,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(l){this.map=l,this.setData(this._data)}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){if(!this._options.dynamic)return this.fire(new o.z(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof l!="string"&&(l.type==="Feature"&&(l={type:"FeatureCollection",features:[l]}),l.type!=="FeatureCollection"))return this.fire(new o.z(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof l!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const n of this._data.features)t.set(n.id,n);for(const n of l.features)t.set(n.id,n);this._data.features=[...t.values()]}else this._data=l;return this._updateWorkerData(!0),this}getClusterExpansionZoom(l,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterChildren(l,t){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterLeaves(l,t,n,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:l,limit:t,offset:n},c),this}_updateWorkerData(l=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new o.A("dataloading",{dataType:"source"})),this._loaded=!1;const t=o.l({append:l},this.workerOptions);t.scope=this.scope;const n=this._data;typeof n=="string"?(t.request=this.map._requestManager.transformRequest(o.q.resolveURL(n),o.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(n),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,(c,d)=>{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new o.z(c));else{const f={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(f.resourceTiming=d.resourceTiming[this.id]),l&&(this._partialReload=!0),this.fire(new o.A("data",f)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(l),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const l=o.C(this.id,this.scope);this.map.style.clearSource(l),this._updateWorkerData()}loadTile(l,t){const n=l.actor?"reloadTile":"loadTile";l.actor=this.actor;const c=this.map.style?this.map.style.getLut(this.scope):null,d=c?{image:c.image.clone()}:null,f=this._partialReload,_={type:this.type,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:d,scope:this.scope,pixelRatio:o.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:l.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:f};l.request=this.actor.send(n,_,(y,b)=>f&&!b?(l.state="loaded",t(null)):(delete l.request,l.destroy(),l.aborted?t(null):y?t(y):(l.loadVectorData(b,this.map.painter,n==="reloadTile"),t(null))),void 0,n==="loadTile")}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l,t){this.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id,scope:this.scope}),l.destroy()}onRemove(l){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return o.l({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends o.aP{constructor(l,t,n,c){super(l,t,n,c),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const l=this.options;this.urls=[];for(const t of l.urls)this.urls.push(this.map._requestManager.transformRequest(t,o.R.Source).url);o.aQ(this.urls,(t,n)=>{this._loaded=!0,t?this.fire(new o.z(t)):n&&(this.video=n,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){const t=this.video.seekable;l<t.start(0)||l>t.end(0)?this.fire(new o.z(new o.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const l=this.map.painter.context,t=l.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new o.T(l,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(l)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:o.aP,model:class extends o.E{constructor(l,t,n,c){super(),this.id=l,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const l=[];for(const t in this._options.models){const n=this._options.models[t],c=o.aS(this.map._requestManager.transformRequest(n.uri,o.R.Model).url).then(d=>{if(!d)return;const f=o.aT(d),_=new o.aU(t,n.position,n.orientation,f);_.computeBoundsAndApplyParent(),this.models.push(_)}).catch(d=>{this.fire(new o.z(new Error(`Could not load model ${t} from ${n.uri}: ${d.message}`)))});l.push(c)}Promise.allSettled(l).then(()=>{this._loaded=!0,this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(t=>{this._loaded=!0,this.fire(new o.z(new Error(`Could not load models: ${t.message}`)))})}onAdd(l){this.map=l,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(l,t){}serialize(){return this._options}},"batched-model":class extends o.E{constructor(l,t,n,c){super(),this.type="batched-model",this.id=l,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=n,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(c)}onAdd(l){this.map=l,this.load()}reload(){this.cancelTileJSONRequest();const l=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(l))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(l){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=Dn(this._options,this.map._requestManager,t,n,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),n&&n.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new o.z(c))):d&&(o.l(this,d),d.bounds&&(this.tileBounds=new yn(d.bounds,this.minzoom,this.maxzoom)),gn(d.tiles,this.map._requestManager._customAccessToken),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))),l&&l(c)})}hasTransition(){return!1}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loaded(){return this._loaded}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(n,o.R.Tile),data:void 0,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:l.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:o.q.devicePixelRatio,promoteId:this.promoteId};if(l.actor&&l.state!=="expired")if(l.state==="loading")l.reloadCallback=t;else{if(l.buckets){const f=Object.values(l.buckets);for(const _ of f)_.dirty=!0;return void(l.state="loaded")}l.request=l.actor.send("reloadTile",c,d.bind(this))}else l.actor=this.dispatcher.getActor(),l.request=l.actor.send("loadTile",c,d.bind(this),void 0,!0);function d(f,_){return l.aborted?t(null):f&&f.status!==404?t(f):(this.map._refreshExpiredTiles&&_&&l.setExpiryData(_),l.loadModelData(_,this.map.painter),l.state="loaded",void t(null))}}serialize(){return o.l({},this._options)}},canvas:class extends o.aP{constructor(l,t,n,c){super(l,t,n,c),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(f=>typeof f!="number"))||this.fire(new o.z(new o.V(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.z(new o.V(`sources.${l}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new o.z(new o.V(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new o.z(new o.V(`sources.${l}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new o.z(new o.V(`sources.${l}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.z(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(l){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!l&&!this._playing||this.texture instanceof o.aR||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new o.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}},custom:class extends o.E{constructor(l,t,n,c){super(),this.id=l,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=t,this.setEventedParent(c),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new o.z(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new o.z(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new yn(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),o.l(this,o.aF(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return o.aF(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this.map=l,this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(l),this.load()}onRemove(l){this._implementation.onRemove&&this._implementation.onRemove(l)}hasTile(l){if(this._implementation.hasTile){const{x:t,y:n,z:c}=l.canonical;return this._implementation.hasTile({x:t,y:n,z:c})}return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,t){const{x:n,y:c,z:d}=l.tileID.canonical,f=new AbortController;l.request=Promise.resolve(this._implementation.loadTile({x:n,y:c,z:d},{signal:f.signal})).then((function(_){return delete l.request,l.aborted?(l.state="unloaded",t(null)):_===void 0?(l.state="errored",t(null)):_===null?(this.loadTileData(l,{width:this.tileSize,height:this.tileSize,data:null}),l.state="loaded",t(null)):function(y){return y instanceof ImageData||y instanceof HTMLCanvasElement||y instanceof ImageBitmap||y instanceof HTMLImageElement}(_)?(this.loadTileData(l,_),l.state="loaded",void t(null)):(l.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(_=>{_.name!=="AbortError"&&(l.state="errored",t(_))}),l.request.cancel=()=>f.abort()}loadTileData(l,t){l.setTexture(t,this.map.painter)}unloadTile(l,t){if(l.texture&&l.texture instanceof o.T?(l.destroy(!0),l.texture&&l.texture instanceof o.T&&this.map.painter.saveTileTexture(l.texture)):l.destroy(),this._implementation.unloadTile){const{x:n,y:c,z:d}=l.tileID.canonical;this._implementation.unloadTile({x:n,y:c,z:d})}t&&t()}abortTile(l,t){l.request&&l.request.cancel&&(l.request.cancel(),delete l.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(l=>({x:l.canonical.x,y:l.canonical.y,z:l.canonical.z}))}_clearTiles(){const l=o.C(this.id,this.scope);this.map.style.clearSource(l)}_update(){this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}}},sl=function(l,t,n,c){const d=new cc[t.type](l,t,n,c);if(d.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${d.id}`);return o.aV(["load","abort","unload","serialize","prepare"],d),d};function Ru(l,t,n=""){return`${n}:${t.id||""}:${t.layer.id}:${function(c){if("layerId"in c)return`layer:${c.layerId}`;{const{featuresetId:d,importId:f}=c;return`featureset:${d}${f?`:import:${f}`:""}`}}(l.target)}`}function uc(l,t,n,c=""){if(l.uniqueFeatureID){const d=Ru(l,t,c);if(n.has(d))return!0;n.add(d)}return!1}function ba(l,t,n,c,d=!1){const f=t.sourceCache.transform,_=t.sourceCache.tilesIn(l,t.has3DLayers,d);_.sort(Io);const y=[];for(const b of _){const E=b.tile.queryRenderedFeatures(t,b,n,c,f,d);Object.keys(E).length&&y.push({wrappedTileID:b.tile.tileID.wrapped().key,queryResults:E})}return y.length===0?{}:function(b){const E={},I={};for(const P of b){const M=P.queryResults,z=P.wrappedTileID,N=I[z]=I[z]||{};for(const B in M){const G=M[B],V=N[B]=N[B]||{},X=E[B]=E[B]||[];for(const Q of G)V[Q.featureIndex]||(V[Q.featureIndex]=!0,X.push(Q))}}return E}(y)}function hc(l,t,n,c,d){const f={},_=c.queryRenderedSymbols(l),y=[];for(const b of Object.keys(_).map(Number))y.push(d[b]);y.sort(Io);for(const b of y){const E=b.featureIndex.lookupSymbolFeatures(_[b.bucketInstanceId],b.bucketIndex,b.sourceLayerIndex,t,n);for(const I in E){const P=f[I]=f[I]||[],M=E[I];M.sort((z,N)=>{const B=b.featureSortOrder;if(B){const G=B.indexOf(z.featureIndex);return B.indexOf(N.featureIndex)-G}return N.featureIndex-z.featureIndex});for(const z of M)P.push(z)}}return f}function gd(l,t){const n=l.getRenderableIds().map(f=>l.getTileByID(f)),c=[],d={};for(let f=0;f<n.length;f++){const _=n[f],y=_.tileID.canonical.key;d[y]||(d[y]=!0,_.querySourceFeatures(c,t))}return c}function Io(l,t){const n=l.tileID,c=t.tileID;return n.overscaledZ-c.overscaledZ||n.canonical.y-c.canonical.y||n.wrap-c.wrap||n.canonical.x-c.canonical.x}function yd(l,t){const n={};if(!t)return n;for(const c of l){const d=c.layerIds.map(f=>t.getLayer(f)).filter(Boolean);if(d.length!==0){c.layers=d,c.stateDependentLayerIds&&(c.stateDependentLayers=c.stateDependentLayerIds.map(f=>d.filter(_=>_.id===f)[0]));for(const f of d)n[f.fqid]=c}}return n}const Jn=32,Co=33,fs=new Uint16Array(8184);for(let l=0;l<2046;l++){let t=l+2,n=0,c=0,d=0,f=0,_=0,y=0;for(1&t?d=f=_=Jn:n=c=y=Jn;(t>>=1)>1;){const E=n+d>>1,I=c+f>>1;1&t?(d=n,f=c,n=_,c=y):(n=d,c=f,d=_,f=y),_=E,y=I}const b=4*l;fs[b+0]=n,fs[b+1]=c,fs[b+2]=d,fs[b+3]=f}const Mo=new Uint16Array(2178),ms=new Uint8Array(1089),mo=new Uint16Array(1089);function dc(l){return l===0?-.03125:l===32?.03125:0}const vd=(()=>({type:2,extent:o.aj,loadGeometry:()=>[[new o.P(0,0),new o.P(o.aj+1,0),new o.P(o.aj+1,o.aj+1),new o.P(0,o.aj+1),new o.P(0,0)]]}))();class _s{constructor(t,n,c,d,f){this.tileID=t,this.uid=o.a$(),this.uses=0,this.tileSize=n,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=f,d&&d.style&&(this._lastUpdatedBrightness=d.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection)}registerFadeDuration(t){const n=t+this.timeAdded;n<o.q.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=o.aW(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,n,c){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=yd(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const f=this.buckets[d];if(f instanceof o.b1){if(this.hasSymbolBuckets=!0,!c)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const f=this.buckets[d];if(f instanceof o.b1&&f.hasRTLText){this.hasRTLText=!0,o.b2();break}}this.queryPadding=0;for(const d in this.buckets){const f=this.buckets[d],_=n.style.getOwnLayer(d);if(!_)continue;const y=_.queryRadius(f);this.queryPadding=Math.max(this.queryPadding,y)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new o.b0}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(t,n,c){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,yd(t.buckets,n.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t){for(const d in this.buckets){const f=this.buckets[d];f.uploadPending()&&f.upload(t)}const n=t.gl,c=this.imageAtlas;c&&!c.uploaded&&(this.imageAtlasTexture=new o.T(t,c.image,n.RGBA8,{useMipmap:!!c.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new o.T(t,this.glyphAtlasImage,n.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new o.T(t,this.lineAtlas.image,n.R8),this.lineAtlas.uploaded=!0)}prepare(t,n,c){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,c),!n||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=n.style.getBrightness();(this._lastUpdatedBrightness||d)&&(this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this.updateBuckets(n,this._lastUpdatedBrightness!==d),this._lastUpdatedBrightness=d))}queryRenderedFeatures(t,n,c,d,f,_){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const y=function(b,E){const I=o.bn([],[.5*b.width,.5*-b.height,1]);return o.bo(I,I,[1,-1,0]),o.az(I,I,b.calculateProjMatrix(E.toUnwrapped())),Float32Array.from(I)}(f,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:n,pixelPosMatrix:y,transform:d,availableImages:c,tileTransform:this.tileTransform})}querySourceFeatures(t,n){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),f=n?n.sourceLayer:"",_=d._geojsonTileLayer||d[f];if(!_)return;const y=o.b3(n&&n.filter),{z:b,x:E,y:I}=this.tileID.canonical,P={z:b,x:E,y:I};for(let M=0;M<_.length;M++){const z=_.feature(M);if(y.needGeometry){const G=o.b4(z,!0);if(!y.filter(new o.aa(this.tileID.overscaledZ),G,this.tileID.canonical))continue}else if(!y.filter(new o.aa(this.tileID.overscaledZ),z))continue;const N=c.getId(z,f),B=new o.b5(z,b,E,I,N);B.tile=P,t.push(B)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const c=o.b6(t.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const c=Date.now();let d=!1;if(this.expirationTime>c)d=!1;else if(n)if(this.expirationTime<n)d=!0;else{const f=this.expirationTime-n;f?this.expirationTime=c+Math.max(f,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}refreshFeatureState(t){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&t&&this.updateBuckets(t)}updateBuckets(t,n){if(!this.latestFeatureIndex||!t.style)return;const c=this.latestFeatureIndex.loadVTLayers(),d=t.style.listImages(),f=t.style.getBrightness();for(const _ in this.buckets){if(!t.style.hasLayer(_))continue;const y=this.buckets[_],b=y.layers[0],E=b.sourceLayer||"_geojsonTileLayer",I=c[E],P=t.style.getLayerSourceCache(b);let M={};P&&(M=P._state.getState(E,void 0));const z=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},N=Object.keys(M).length>0&&!n;N&&!y.stateDependentLayers.length&&!n||y.update(M,I,d,z,N?y.stateDependentLayers:y.layers,n,f),(y instanceof o.b7||y instanceof o.b8)&&t._terrain&&t._terrain.enabled&&P&&y.uploadPending()&&t._terrain._clearRenderCacheForTile(P.id,this.tileID);const B=t&&t.style&&t.style.getOwnLayer(_);B&&(this.queryPadding=Math.max(this.queryPadding,B.queryRadius(y)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<o.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=o.q.now()+t}setTexture(t,n){const c=n.context,d=c.gl;this.texture=this.texture||n.getTileTexture(t.width),this.texture&&this.texture instanceof o.T?this.texture.update(t):(this.texture=new o.T(c,t,d.RGBA8,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}setDependencies(t,n){const c={};for(const d of n)c[d]=!0;this.dependencies[t]=c}hasDependency(t,n){for(const c of t){const d=this.dependencies[c];if(d){for(const f of n)if(d[f])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,n){if(!n||n.name==="mercator"||this._tileDebugBuffer)return;const c=o.b9(vd,this.tileID.canonical,this.tileTransform)[0],d=new o.ba,f=new o.bb;for(let _=0;_<c.length;_++){const{x:y,y:b}=c[_];d.emplaceBack(y,b),f.emplaceBack(_)}f.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(f),this._tileDebugBuffer=t.createVertexBuffer(d,o.bc.members),this._tileDebugSegments=o.bd.simpleSegment(0,0,d.length,f.length)}_makeTileBoundsBuffers(t,n){if(this._tileBoundsBuffer||!n||n.name==="mercator")return;const c=o.b9(vd,this.tileID.canonical,this.tileTransform)[0];let d,f;if(this.isRaster){const _=function(y,b){const E=o.aW(y,b),I=Math.pow(2,y.z);for(let G=0;G<Co;G++)for(let V=0;V<Co;V++){const X=o.aX((y.x+(V+dc(V))/Jn)/I),Q=o.aY((y.y+(G+dc(G))/Jn)/I),ie=b.project(X,Q),ue=G*Co+V;Mo[2*ue+0]=Math.round((ie.x*E.scale-E.x)*o.aj),Mo[2*ue+1]=Math.round((ie.y*E.scale-E.y)*o.aj)}ms.fill(0),mo.fill(0);for(let G=2045;G>=0;G--){const V=4*G,X=fs[V+0],Q=fs[V+1],ie=fs[V+2],ue=fs[V+3],ae=X+ie>>1,le=Q+ue>>1,ne=ae+le-Q,de=le+X-ae,me=Q*Co+X,Le=ue*Co+ie,Me=le*Co+ae,Ze=Math.hypot((Mo[2*me+0]+Mo[2*Le+0])/2-Mo[2*Me+0],(Mo[2*me+1]+Mo[2*Le+1])/2-Mo[2*Me+1])>=16;ms[Me]=ms[Me]||(Ze?1:0),G<1022&&(ms[Me]=ms[Me]||ms[(Q+de>>1)*Co+(X+ne>>1)]||ms[(ue+de>>1)*Co+(ie+ne>>1)])}const P=new o.aZ,M=new o.a_;let z=0;function N(G,V){const X=V*Co+G;return mo[X]===0&&(P.emplaceBack(Mo[2*X+0],Mo[2*X+1],G*o.aj/Jn,V*o.aj/Jn),mo[X]=++z),mo[X]-1}function B(G,V,X,Q,ie,ue){const ae=G+X>>1,le=V+Q>>1;if(Math.abs(G-ie)+Math.abs(V-ue)>1&&ms[le*Co+ae])B(ie,ue,G,V,ae,le),B(X,Q,ie,ue,ae,le);else{const ne=N(G,V),de=N(X,Q),me=N(ie,ue);M.emplaceBack(ne,de,me)}}return B(0,0,Jn,Jn,Jn,0),B(Jn,Jn,0,0,0,Jn),{vertices:P,indices:M}}(this.tileID.canonical,n);d=_.vertices,f=_.indices}else{d=new o.aZ,f=new o.a_;for(const{x:y,y:b}of c)d.emplaceBack(y,b,0,0);const _=o.be(d.int16.subarray(0,4*d.length),void 0,4);for(let y=0;y<_.length;y+=3)f.emplaceBack(_[y],_[y+1],_[y+2])}this._tileBoundsBuffer=t.createVertexBuffer(d,o.bf.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(f),this._tileBoundsSegments=o.bd.simpleSegment(0,0,d.length,f.length)}_makeGlobeTileDebugBuffers(t,n){const c=n.projection;if(!c||c.name!=="globe"||n.freezeTileCoverage)return;const d=this.tileID.canonical,f=o.bg(d,n),_=o.bh(f),y=o.ah(n.zoom);let b;y>0&&(b=o.bi(new Float64Array(16),n.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,d,n,_,b,y),this._makeGlobeTileDebugTextBuffer(t,d,n,_,b,y)}_globePoint(t,n,c,d,f,_,y){let b=o.bj(t,n,c);if(_){const E=1<<c.z,I=o.ay(d.center.lng),P=o.aH(d.center.lat),M=(c.x+.5)/E-I;let z=0;M>.5?z=-1:M<-.5&&(z=1);let N=(t/o.aj+c.x)/E+z,B=(n/o.aj+c.y)/E;N=(N-I)*d._pixelsPerMercatorPixel+I,B=(B-P)*d._pixelsPerMercatorPixel+P;const G=[N*d.worldSize,B*d.worldSize,0];o.ad(G,G,_),b=o.bk(b,G,y)}return o.ad(b,b,f)}_makeGlobeTileDebugBorderBuffer(t,n,c,d,f,_){const y=new o.ba,b=new o.bb,E=new o.bl,I=(M,z,N,B,G)=>{const V=(N-M)/(G-1),X=(B-z)/(G-1),Q=y.length;for(let ie=0;ie<G;ie++){const ue=M+ie*V,ae=z+ie*X;y.emplaceBack(ue,ae);const le=this._globePoint(ue,ae,n,c,d,f,_);E.emplaceBack(le[0],le[1],le[2]),b.emplaceBack(Q+ie)}},P=o.aj;I(0,0,P,0,16),I(P,0,P,P,16),I(P,P,0,P,16),I(0,P,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(b),this._tileDebugBuffer=t.createVertexBuffer(y,o.bc.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(E,o.bm.members),this._tileDebugSegments=o.bd.simpleSegment(0,0,y.length,b.length)}_makeGlobeTileDebugTextBuffer(t,n,c,d,f,_){const y=o.aj/4,b=new o.ba,E=new o.a_,I=new o.bl,P=25;E.reserve(32),b.reserve(P),I.reserve(P);const M=(z,N)=>P*z+N;for(let z=0;z<P;z++){const N=z*y;for(let B=0;B<P;B++){const G=B*y;b.emplaceBack(G,N);const V=this._globePoint(G,N,n,c,d,f,_);I.emplaceBack(V[0],V[1],V[2])}}for(let z=0;z<4;z++)for(let N=0;N<4;N++){const B=M(z,N),G=M(z,N+1),V=M(z+1,N),X=M(z+1,N+1);E.emplaceBack(B,G,V),E.emplaceBack(V,G,X)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(E),this._tileDebugTextBuffer=t.createVertexBuffer(b,o.bc.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(I,o.bm.members),this._tileDebugTextSegments=o.bd.simpleSegment(0,0,P,32)}destroy(t=!1){for(const n in this.buckets)this.buckets[n].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!t&&this.texture&&this.texture instanceof o.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}o.bp.setPbf(o.bq);class pc extends _s{constructor(t,n,c,d,f){super(t,n,c,d,f),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexture(t,n){const c=n.context,d=c.gl;this.texture=this.texture||n.getTileTexture(t.width),this.texture&&this.texture instanceof o.T?this.texture.update(t,{premultiply:!1}):this.texture=new o.T(c,t,d.RGBA8,{premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(t=16384,n){const c=this._mrt=new o.bp(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=o.br(d,(f,_,y,b)=>{if(f)n(f);else try{const E=c.getHeaderLength(_);if(E>t)return void(this.request=this.fetchHeader(E,n));c.parseHeader(_),this._isHeaderLoaded=!0;let I=0;for(const P of Object.values(c.layers))I=Math.max(I,P.dataIndex[P.dataIndex.length-1].lastByte);_.byteLength>=I&&(this.entireBuffer=_),n(null,this.entireBuffer||_,y,b)}catch(E){n(E)}}),this.request}fetchBand(t,n,c){const d=this._mrt;if(!this._isHeaderLoaded||!d)return void c(new Error("Tile header is not ready"));const f=this.actor;if(!f)return void c(new Error("Can't fetch tile band without an actor"));let _;const y=(P,M)=>{_.complete(P,M),P?c(P):(this.updateTextureDescriptor(t,n),c(null,this.textureDescriptor&&this.textureDescriptor.img))},b=(P,M)=>{if(P)return c(P);const z=f.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:M,task:_},y,void 0,!0);this._workQueue.push(()=>{z&&z.cancel(),_.cancel()})},E=d.getLayer(t);if(!E)return void c(new Error(`Unknown sourceLayer "${t}"`));if(E.hasDataForBand(n))return this.updateTextureDescriptor(t,n),void c(null,this.textureDescriptor?this.textureDescriptor.img:null);const I=E.getDataRange([n]);if(_=d.createDecodingTask(I),!_||_.tasks.length)if(this.flushQueues(),this.entireBuffer)b(null,this.entireBuffer.slice(I.firstByte,I.lastByte+1));else{const P=Object.assign({},this.requestParams,{headers:{Range:`bytes=${I.firstByte}-${I.lastByte}`}}),M=o.br(P,b);this._fetchQueue.push(()=>{M.cancel(),_.cancel()})}else c(null)}updateNeeded(t,n){return(!this.textureDescriptor||this.textureDescriptor.band!==n||this.textureDescriptor.layer!==t)&&this.state!=="errored"}updateTextureDescriptor(t,n){if(!this._mrt)return;const c=this._mrt.getLayer(t);if(!c||!c.hasBand(n)||!c.hasDataForBand(n))return;const{bytes:d,tileSize:f,buffer:_,offset:y,scale:b}=c.getBandView(n),E=f+2*_,I=new o.r({width:E,height:E},d),P=this.texture;P&&P instanceof o.T&&P.update(I,{premultiply:!1}),this.textureDescriptor={layer:t,band:n,img:I,buffer:_,offset:y,tileSize:f,format:c.pixelFormat,mix:[b,256*b,65536*b,16777216*b]}}}class xd{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,c){const d=t.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const f={value:n,timeout:void 0};if(c!==void 0&&(f.timeout=setTimeout(()=>{this.remove(t,f)},c)),this.data[d].push(f),this.order.push(d),this.order.length>this.max){const _=this._getAndRemoveByKey(this.order[0]);_&&this.onRemove(_)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const c=t.wrapped().key,d=n===void 0?0:this.data[c].indexOf(n),f=this.data[c][d];return this.data[c].splice(d,1),f.timeout&&clearTimeout(f.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(f.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const c in this.data)for(const d of this.data[c])t(d.value)||n.push(d);for(const c of n)this.remove(c.value.tileID,c)}}class fc{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,c){const d=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},o.l(this.stateChanges[t][d],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const f in this.state[t])f!==d&&(this.deletedStates[t][f]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const f in this.state[t][d])c[f]||(this.deletedStates[t][d][f]=null)}else for(const f in c)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][f]===null&&delete this.deletedStates[t][d][f]}removeFeatureState(t,n,c){if(this.deletedStates[t]===null)return;const d=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},c&&n!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||{},this.deletedStates[t][d][c]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][d])for(c in this.deletedStates[t][d]={},this.stateChanges[t][d])this.deletedStates[t][d][c]=null;else this.deletedStates[t][d]=null;else this.deletedStates[t]=null}getState(t,n){const c=this.state[t]||{},d=this.stateChanges[t]||{},f=this.deletedStates[t];if(f===null)return{};if(n!==void 0){const y=String(n),b=o.l({},c[y],d[y]);if(f){const E=f[n];if(E===null)return{};for(const I in E)delete b[I]}return b}const _=o.l({},c,d);if(f)for(const y in f)delete _[y];return _}initializeTileState(t,n){t.refreshFeatureState(n)}coalesceChanges(t,n){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const f={};for(const _ in this.stateChanges[d])this.state[d][_]||(this.state[d][_]={}),o.l(this.state[d][_],this.stateChanges[d][_]),f[_]=this.state[d][_];c[d]=f}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const f={};if(this.deletedStates[d]===null)for(const _ in this.state[d])f[_]={},this.state[d][_]={};else for(const _ in this.deletedStates[d]){if(this.deletedStates[d][_]===null)this.state[d][_]={};else if(this.state[d][_])for(const y of Object.keys(this.deletedStates[d][_]))delete this.state[d][_][y];f[_]=this.state[d][_]}c[d]=c[d]||{},o.l(c[d],f)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const d in t)t[d].refreshFeatureState(n)}}class Fn extends o.E{constructor(t,n,c){super(),this.id=t,this._onlySymbols=c,n.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),n.on("error",()=>{this._sourceErrored=!0}),this._source=n,this._tiles={},this._cache=new xd(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=n.minTileCacheSize,this._maxTileCacheSize=n.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new fc,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles)if(!this._tiles[t].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,n){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t)}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t)}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const c=this._tiles[n];c.upload(t),c.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(zu).map(t=>t.key)}getRenderableIds(t,n){const c=[];for(const d in this._tiles)this._isIdRenderable(+d,t,n)&&c.push(this._tiles[d]);return t?c.sort((d,f)=>{const _=d.tileID,y=f.tileID,b=new o.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle),E=new o.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return _.overscaledZ-y.overscaledZ||E.y-b.y||E.x-b.x}).map(d=>d.tileID.key):c.map(d=>d.tileID).sort(zu).map(d=>d.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())&&(c||!this._shadowCasterTiles[t])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(+t,"reloading")}}_reloadTile(t,n){const c=this._tiles[t];c&&(c.state!=="loading"&&(c.state=n),this._loadTile(c,this._tileLoaded.bind(this,c,t,n)))}_tileLoaded(t,n,c,d){if(d)if(t.state="errored",d.status!==404)this._source.fire(new o.z(d,{tile:t}));else{if(this._source.fire(new o.A("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const f=this.map.painter.terrain;this.update(this.transform,f.getScaledDemTileSize(),!0),f.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=o.q.now(),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new o.A("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const n=this.getRenderableIds();for(let d=0;d<n.length;d++){const f=n[d];if(t.neighboringTiles&&t.neighboringTiles[f]){const _=this.getTileByID(f);c(t,_),c(_,t)}}function c(d,f){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let _=f.tileID.canonical.x-d.tileID.canonical.x;const y=f.tileID.canonical.y-d.tileID.canonical.y,b=Math.pow(2,d.tileID.canonical.z),E=f.tileID.key;_===0&&y===0||Math.abs(y)>1||(Math.abs(_)>1&&(Math.abs(_+b)===1?_+=b:Math.abs(_-b)===1&&(_-=b)),f.dem&&d.dem&&(d.dem.backfillBorder(f.dem,_,y),d.neighboringTiles&&d.neighboringTiles[E]&&(d.neighboringTiles[E].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,c,d){for(const f in this._tiles){let _=this._tiles[f];if(d[f]||!_.hasData()||_.tileID.overscaledZ<=n||_.tileID.overscaledZ>c)continue;let y=_.tileID;for(;_&&_.tileID.overscaledZ>n+1;){const E=_.tileID.scaledTo(_.tileID.overscaledZ-1);_=this._tiles[E.key],_&&_.hasData()&&(y=E)}let b=y;for(;b.overscaledZ>n;)if(b=b.scaledTo(b.overscaledZ-1),t[b.key]){d[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const c=this._loadedParentTiles[t.key];return c&&c.tileID.overscaledZ>=n?c:null}for(let c=t.overscaledZ-1;c>=n;c--){const d=t.scaledTo(c),f=this._getLoadedTile(d);if(f)return f}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,n){n=n||this._source.tileSize;const c=Math.ceil(t.width/n)+1,d=Math.ceil(t.height/n)+1,f=Math.floor(c*d*5),_=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,f):f,y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,_):_;this._cache.setMaxSize(y)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const c={};for(const d in this._tiles){const f=this._tiles[d];f.tileID=f.tileID.unwrapTo(f.tileID.wrap+n),c[f.tileID.key]=f}this._tiles=c;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(+d,this._tiles[d])}}update(t,n,c,d,f){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;this.updateCacheSize(t,n),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const _=this._source.type==="batched-model";let y,b=this._source.maxzoom;const E=this.map&&this.map.painter?this.map.painter._terrain:null;if(E&&E.sourceCache===this&&E.attenuationRange()){const M=E.attenuationRange()[0],z=Math.floor(M)-Math.log2(E.getDemUpscale());b>z&&(b=z)}if(this.used||this.usedForTerrain){if(this._source.tileID)y=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(M=>new o.aM(M.canonical.z,M.wrap,M.canonical.z,M.canonical.x,M.canonical.y));else if(this.tileCoverLift!==0){const M=t.clone();M.tileCoverLift=this.tileCoverLift,y=M.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:b,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:_}),this._source.minzoom<=1&&t.projection.name==="globe"&&(y.push(new o.aM(1,0,1,0,0)),y.push(new o.aM(1,0,1,1,0)),y.push(new o.aM(1,0,1,0,1)),y.push(new o.aM(1,0,1,1,1)))}else if(y=t.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:b,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:_}),this._source.hasTile){const M=this._source.hasTile.bind(this._source);y=y.filter(z=>M(z))}}else y=[];if(y.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Lu(this._source.type)){const M=t.coveringZoomLevel({tileSize:n||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),z=Math.min(M,this._source.maxzoom);if(_){const N=t.extendTileCover(y,z);for(const B of N)y.push(B)}else if(f){const N=t.extendTileCover(y,z,this.transform._camera.forward());for(const B of N)y.push(B)}else if(this.castsShadows&&d){const N=t.extendTileCover(y,z,d);for(const B of N)this._shadowCasterTiles[B.key]=!0,y.push(B)}}const I=this._updateRetainedTiles(y);if(Lu(this._source.type)&&y.length!==0){const M={},z={},N=Object.keys(I);for(const G of N){const V=I[G],X=this._tiles[G];if(!X||X.fadeEndTime&&X.fadeEndTime<=o.q.now())continue;const Q=this.findLoadedParent(V,Math.max(V.overscaledZ-Fn.maxOverzooming,this._source.minzoom));Q&&(this._addTile(Q.tileID),M[Q.tileID.key]=Q.tileID),z[G]=V}const B=y[y.length-1].overscaledZ;for(const G in this._tiles){const V=this._tiles[G];if(I[G]||!V.hasData())continue;let X=V.tileID;for(;X.overscaledZ>B;){X=X.scaledTo(X.overscaledZ-1);const Q=this._tiles[X.key];if(Q&&Q.hasData()&&z[X.key]){I[G]=V.tileID;break}}}for(const G in M)I[G]||(this._coveredTiles[G]=!0,I[G]=M[G])}for(const M in I)this._tiles[M].clearFadeHold();const P=o.bs(this._tiles,I);for(const M of P){const z=this._tiles[M];z.hasSymbolBuckets&&!z.holdingForFade()?z.setHoldDuration(this.map._fadeDuration):z.hasSymbolBuckets&&!z.symbolFadeFinished()||this._removeTile(+M)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const n={};if(t.length===0)return n;const c={},d=t.reduce((E,I)=>Math.min(E,I.overscaledZ),1/0),f=t[0].overscaledZ,_=Math.max(f-Fn.maxOverzooming,this._source.minzoom),y=Math.max(f+Fn.maxUnderzooming,this._source.minzoom),b={};for(const E of t){const I=this._addTile(E);n[E.key]=E,I.hasData()||d<this._source.maxzoom&&(b[E.key]=E)}this._retainLoadedChildren(b,d,y,n);for(const E of t){let I=this._tiles[E.key];if(I.hasData())continue;if(E.canonical.z>=this._source.maxzoom){const M=E.children(this._source.maxzoom)[0],z=this.getTile(M);if(z&&z.hasData()){n[M.key]=M;continue}}else{const M=E.children(this._source.maxzoom);if(n[M[0].key]&&n[M[1].key]&&n[M[2].key]&&n[M[3].key])continue}let P=I.wasRequested();for(let M=E.overscaledZ-1;M>=_;--M){const z=E.scaledTo(M);if(c[z.key]||(c[z.key]=!0,I=this.getTile(z),!I&&P&&(I=this._addTile(z)),I&&(n[z.key]=z,P=I.wasRequested(),I.hasData())))break}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let c,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}n.push(d.key);const f=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(f),c)break;d=f}for(const f of n)this._loadedParentTiles[f]=c}}_addTile(t){let n=this._tiles[t.key];if(n)return n.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const c=!!n;if(!c){const d=this.map?this.map.painter:null,f=this._source.tileSize*t.overscaleFactor();n=this._source.type==="raster-array"?new pc(t,f,this.transform.tileZoom,d,this._isRaster):new _s(t,f,this.transform.tileZoom,d,this._isRaster),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))}return n.uses++,this._tiles[t.key]=n,c||this._source.fire(new o.A("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const c=n.getExpiryTimeout();c&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},c))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"||n.state==="empty"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,n,c){const d=[],f=this.transform;if(!f)return d;const _=f.projection.name==="globe",y=o.ay(f.center.lng);for(const b in this._tiles){const E=this._tiles[b];if(c&&E.clearQueryDebugViz(),E.holdingForFade())continue;let I;if(_){const P=E.tileID.canonical;if(P.z===0){const M=[Math.abs(o.aD(y,...al(P,-1))-y),Math.abs(o.aD(y,...al(P,1))-y)];I=[0,2*M.indexOf(Math.min(...M))-1]}else{const M=[Math.abs(o.aD(y,...al(P,-1))-y),Math.abs(o.aD(y,...al(P,0))-y),Math.abs(o.aD(y,...al(P,1))-y)];I=[M.indexOf(Math.min(...M))-1]}}else I=[0];for(const P of I){const M=t.containsTile(E,f,n,P);M&&d.push(M)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,n){const c=this.getRenderableIds(t,n).map(f=>this._tiles[f].tileID),d=this.transform.projection.name==="globe";for(const f of c)f.projMatrix=this.transform.calculateProjMatrix(f.toUnwrapped()),f.expandedProjMatrix=d?this.transform.calculateProjMatrix(f.toUnwrapped(),!1,!0):f.projMatrix;return c}sortCoordinatesByDistance(t){const n=t.slice(),c=this.transform._camera.position,d=this.transform._camera.forward(),f={};for(const _ of n){const y=1/(1<<_.canonical.z);f[_.key]=((_.canonical.x+.5)*y+_.wrap-c[0])*d[0]+((_.canonical.y+.5)*y-c[1])*d[1]-c[2]*d[2]}return n.sort((_,y)=>f[_.key]-f[y.key]),n}hasTransition(){if(this._source.hasTransition())return!0;if(Lu(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=o.q.now())return!0}return!1}setFeatureState(t,n,c){this._state.updateState(t=t||"_geojsonTileLayer",n,c)}removeFeatureState(t,n,c){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,c)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,c){const d=this._tiles[t];d&&d.setDependencies(n,c)}reloadTilesForDependencies(t,n){for(const c in this._tiles)this._tiles[c].hasDependency(t,n)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(t,n))}_preloadTiles(t,n){if(!this._sourceLoaded){const b=()=>{this._sourceLoaded&&(this._source.off("data",b),this._preloadTiles(t,n))};return void this._source.on("data",b)}const c=new Map,d=Array.isArray(t)?t:[t],f=this.map.painter.terrain,_=this.usedForTerrain&&f?f.getScaledDemTileSize():this._source.tileSize;for(const b of d){const E=b.coveringTiles({tileSize:_,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const I of E)c.set(I.key,I);this.usedForTerrain&&b.updateElevation(!1)}const y=Array.from(c.values());o.bt(y,(b,E)=>{const I=new _s(b,this._source.tileSize*b.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(I,P=>{this._source.type==="raster-dem"&&I.dem&&this._backfillDEM(I),E(P,I)})},n)}}function zu(l,t){const n=Math.abs(2*l.wrap)-+(l.wrap<0),c=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||c-n||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function Lu(l){return l==="raster"||l==="image"||l==="video"||l==="custom"}function al(l,t){const n=1<<l.z;return[l.x/n+t,(l.x+1)/n+t]}Fn.maxOverzooming=10,Fn.maxUnderzooming=3;class Xf{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,n=!1;for(const c in this.style._mergedLayers){const d=this.style._mergedLayers[c];if(d.type==="fill-extrusion")this.layers.push({layer:d,visible:t,visibilityChanged:n});else if(d.type==="model"){const f=this.style.getLayerSource(d);f&&f.type==="batched-model"&&this.layers.push({layer:d,visible:t,visibilityChanged:n})}}}onNewFrame(t){this.layersGotHidden=!1;for(const n of this.layers){const c=n.layer;let d=!1;c.type==="fill-extrusion"?d=!c.isHidden(t)&&c.paint.get("fill-extrusion-opacity")>0:c.type==="model"&&(d=!c.isHidden(t)&&c.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!d&&n.visible,n.visible=d}}updateZOffset(t,n){this.currentBuildingBuckets=[];for(const d of this.layers){const f=d.layer,_=this.style.getLayerSourceCache(f);let y=1;f.type==="fill-extrusion"&&(y=d.visible?f.paint.get("fill-extrusion-vertical-scale"):0);let b=_?_.getTile(n):null;if(!b&&_&&n.canonical.z>_.getSource().minzoom){let E=n.scaledTo(Math.min(_.getSource().maxzoom,n.overscaledZ-1));for(;E.overscaledZ>=_.getSource().minzoom&&(b=_.getTile(E),!b&&E.overscaledZ!==0);)E=E.scaledTo(E.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:b?b.getBucket(f):null,tileID:b?b.tileID:n,verticalScale:y})}t.hasAnyZOffset=!1;let c=!1;for(let d=0;d<t.symbolInstances.length;d++){const f=t.symbolInstances.get(d),_=f.zOffset,y=this._getHeightAtTileOffset(n,f.tileAnchorX,f.tileAnchorY);f.zOffset=y!==Number.NEGATIVE_INFINITY?y:_,c||_===f.zOffset||(c=!0),t.hasAnyZOffset||f.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,n,c,d){let f=n,_=c;if(t.canonical.z!==d.canonical.z){const y=d.canonical,b=1/(1<<t.canonical.z-y.z);f=(n+t.canonical.x*o.aj)*b-y.x*o.aj|0,_=(c+t.canonical.y*o.aj)*b-y.y*o.aj|0}return{tileX:f,tileY:_}}_getHeightAtTileOffset(t,n,c){let d,f;for(let _=0;_<this.layers.length;++_){if(this.layers[_].layer.type!=="fill-extrusion")continue;const{bucket:y,tileID:b,verticalScale:E}=this.currentBuildingBuckets[_];if(!y)continue;const{tileX:I,tileY:P}=this._mapCoordToOverlappingTile(t,n,c,b),M=y.getHeightAtTileCoord(I,P);M&&M.height!==void 0&&(M.hidden?d=M.height:f=Math.max(M.height*E,f||0))}if(f!==void 0)return f;for(let _=0;_<this.layers.length;++_){const y=this.layers[_];if(y.layer.type!=="model"||!y.visible)continue;const{bucket:b,tileID:E}=this.currentBuildingBuckets[_];if(!b)continue;const{tileX:I,tileY:P}=this._mapCoordToOverlappingTile(t,n,c,E),M=b.getHeightAtTileCoord(I,P);if(M&&!M.hidden)return M.height===void 0&&d!==void 0?Math.min(M.maxHeight,d)*M.verticalScale:M.height?M.height*M.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function ku(l,t){const n={};for(const c in l)c!=="ref"&&(n[c]=l[c]);return o.bu.forEach(c=>{c in t&&(n[c]=t[c])}),n}function Ou(l){l=l.slice();const t=Object.create(null);for(let n=0;n<l.length;n++)t[l[n].id]=l[n];for(let n=0;n<l.length;n++)"ref"in l[n]&&(l[n]=ku(l[n],t[l[n].ref]));return l}const Ri={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function ll(l,t,n){n.push({command:Ri.addSource,args:[l,t[l]]})}function cl(l,t,n){t.push({command:Ri.removeSource,args:[l]}),n[l]=!0}function wy(l,t,n,c){cl(l,n,c),ll(l,t,n)}function Yf(l,t,n){let c;for(c in l[n])if(l[n].hasOwnProperty(c)&&c!=="data"&&!o.bv(l[n][c],t[n][c]))return!1;for(c in t[n])if(t[n].hasOwnProperty(c)&&c!=="data"&&!o.bv(l[n][c],t[n][c]))return!1;return!0}function wa(l,t,n,c,d,f){let _;for(_ in t=t||{},l=l||{})l.hasOwnProperty(_)&&(o.bv(l[_],t[_])||n.push({command:f,args:[c,_,t[_],d]}));for(_ in t)t.hasOwnProperty(_)&&!l.hasOwnProperty(_)&&(o.bv(l[_],t[_])||n.push({command:f,args:[c,_,t[_],d]}))}function Ns(l){return l.id}function ul(l,t){return l[t.id]=t,l}class Kf{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=o.aD(t,0,1);let n=1,c=this._distances[n];const d=t*this.paddedLength+this.padding;for(;c<d&&n<this._distances.length;)c=this._distances[++n];const f=n-1,_=this._distances[f],y=c-_,b=y>0?(d-_)/y:0;return this.points[f].mult(1-b).add(this.points[n].mult(b))}}class bd{constructor(t,n,c){const d=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(t/c),this.yCellCount=Math.ceil(n/c);for(let _=0;_<this.xCellCount*this.yCellCount;_++)d.push([]),f.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,c,d,f){this._forEachCell(n,c,d,f,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(f)}insertCircle(t,n,c,d){this._forEachCell(n-d,c-d,n+d,c+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(c),this.circles.push(d)}_insertBoxCell(t,n,c,d,f,_){this.boxCells[f].push(_)}_insertCircleCell(t,n,c,d,f,_){this.circleCells[f].push(_)}_query(t,n,c,d,f,_){if(c<0||t>this.width||d<0||n>this.height)return!f&&[];const y=[];if(t<=0&&n<=0&&this.width<=c&&this.height<=d){if(f)return!0;for(let b=0;b<this.boxKeys.length;b++)y.push({key:this.boxKeys[b],x1:this.bboxes[4*b],y1:this.bboxes[4*b+1],x2:this.bboxes[4*b+2],y2:this.bboxes[4*b+3]});for(let b=0;b<this.circleKeys.length;b++){const E=this.circles[3*b],I=this.circles[3*b+1],P=this.circles[3*b+2];y.push({key:this.circleKeys[b],x1:E-P,y1:I-P,x2:E+P,y2:I+P})}return _?y.filter(_):y}return this._forEachCell(t,n,c,d,this._queryCell,y,{hitTest:f,seenUids:{box:{},circle:{}}},_),f?y.length>0:y}_queryCircle(t,n,c,d,f){const _=t-c,y=t+c,b=n-c,E=n+c;if(y<0||_>this.width||E<0||b>this.height)return!d&&[];const I=[];return this._forEachCell(_,b,y,E,this._queryCellCircle,I,{hitTest:d,circle:{x:t,y:n,radius:c},seenUids:{box:{},circle:{}}},f),d?I.length>0:I}query(t,n,c,d,f){return this._query(t,n,c,d,!1,f)}hitTest(t,n,c,d,f){return this._query(t,n,c,d,!0,f)}hitTestCircle(t,n,c,d){return this._queryCircle(t,n,c,!0,d)}_queryCell(t,n,c,d,f,_,y,b){const E=y.seenUids,I=this.boxCells[f];if(I!==null){const M=this.bboxes;for(const z of I)if(!E.box[z]){E.box[z]=!0;const N=4*z;if(t<=M[N+2]&&n<=M[N+3]&&c>=M[N+0]&&d>=M[N+1]&&(!b||b(this.boxKeys[z]))){if(y.hitTest)return _.push(!0),!0;_.push({key:this.boxKeys[z],x1:M[N],y1:M[N+1],x2:M[N+2],y2:M[N+3]})}}}const P=this.circleCells[f];if(P!==null){const M=this.circles;for(const z of P)if(!E.circle[z]){E.circle[z]=!0;const N=3*z;if(this._circleAndRectCollide(M[N],M[N+1],M[N+2],t,n,c,d)&&(!b||b(this.circleKeys[z]))){if(y.hitTest)return _.push(!0),!0;{const B=M[N],G=M[N+1],V=M[N+2];_.push({key:this.circleKeys[z],x1:B-V,y1:G-V,x2:B+V,y2:G+V})}}}}}_queryCellCircle(t,n,c,d,f,_,y,b){const E=y.circle,I=y.seenUids,P=this.boxCells[f];if(P!==null){const z=this.bboxes;for(const N of P)if(!I.box[N]){I.box[N]=!0;const B=4*N;if(this._circleAndRectCollide(E.x,E.y,E.radius,z[B+0],z[B+1],z[B+2],z[B+3])&&(!b||b(this.boxKeys[N])))return _.push(!0),!0}}const M=this.circleCells[f];if(M!==null){const z=this.circles;for(const N of M)if(!I.circle[N]){I.circle[N]=!0;const B=3*N;if(this._circlesCollide(z[B],z[B+1],z[B+2],E.x,E.y,E.radius)&&(!b||b(this.circleKeys[N])))return _.push(!0),!0}}}_forEachCell(t,n,c,d,f,_,y,b){const E=this._convertToXCellCoord(t),I=this._convertToYCellCoord(n),P=this._convertToXCellCoord(c),M=this._convertToYCellCoord(d);for(let z=E;z<=P;z++)for(let N=I;N<=M;N++)if(f.call(this,t,n,c,d,this.xCellCount*N+z,_,y,b))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,c,d,f,_){const y=d-t,b=f-n,E=c+_;return E*E>y*y+b*b}_circleAndRectCollide(t,n,c,d,f,_,y){const b=(_-d)/2,E=Math.abs(t-(d+b));if(E>b+c)return!1;const I=(y-f)/2,P=Math.abs(n-(f+I));if(P>I+c)return!1;if(E<=b||P<=I)return!0;const M=E-b,z=P-I;return M*M+z*z<=c*c}}const Ta={unknown:0,flipRequired:1,flipNotRequired:2},mc=Math.tan(85*Math.PI/180);function hl(l,t,n,c,d,f,_){const y=o.bz();if(n)if(f.name==="globe"){const b=o.bA(d,t);o.az(y,y,b)}else{const b=o.bB([],_);y[0]=b[0],y[1]=b[1],y[4]=b[2],y[5]=b[3],c||o.by(y,y,d.angle)}else o.az(y,d.labelPlaneMatrix,l);return y}function Fu(l,t,n,c,d,f,_){const y=hl(l,t,n,c,d,f,_);return f.name==="globe"&&n||(y[2]=y[6]=y[10]=y[14]=0),y}function wd(l,t,n,c,d,f,_){if(n){if(f.name==="globe"){const y=hl(l,t,n,c,d,f,_);return o.bi(y,y),o.az(y,l,y),y}{const y=o.bw(l),b=o.bx([]);return b[0]=_[0],b[1]=_[1],b[4]=_[2],b[5]=_[3],o.az(y,y,b),c||o.by(y,y,-d.angle),y}}return d.glCoordMatrix}function Qn(l,t,n,c){const d=[l,t,n,1];n?o.aA(d,d,c):Jf(d,d,c);const f=d[3];return d[0]/=f,d[1]/=f,d[2]/=f,d}function js(l,t){return Math.min(.5+l/t*.5,1.5)}function Td(l,t){const n=l[0]/l[3],c=l[1]/l[3];return n>=-t[0]&&n<=t[0]&&c>=-t[1]&&c<=t[1]}function Sd(l,t,n,c,d,f,_,y,b,E){const I=n.transform,P=c?l.textSizeData:l.iconSizeData,M=o.bH(P,n.transform.zoom),z=I.projection.name==="globe",N=[256/n.width*2+1,256/n.height*2+1],B=c?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;B.clear();let G=null;z&&(G=c?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const V=l.lineVertexArray,X=c?l.text.placedSymbolArray:l.icon.placedSymbolArray,Q=n.transform.width/n.transform.height;let ie,ue=!1;for(let ae=0;ae<X.length;ae++){const le=X.get(ae),{numGlyphs:ne,writingMode:de}=le;if(de!==o.bI.vertical||ue||ie===o.bI.horizontal||(ue=!0),ie=de,(le.hidden||de===o.bI.vertical)&&!ue){Fi(ne,B);continue}ue=!1;const me=new o.P(le.tileAnchorX,le.tileAnchorY);let{x:Le,y:Me,z:Ze}=I.projection.projectTilePoint(me.x,me.y,E.canonical);if(b){const[At,Lt,St]=b(me);Le+=At,Me+=Lt,Ze+=St}const He=[Le,Me,Ze,1];if(o.aA(He,He,t),!Td(He,N)){Fi(ne,B);continue}const ht=He[3],De=js(n.transform.getCameraToCenterDistance(I.projection),ht),ke=o.bJ(P,M,le),Ie=_?ke/De:ke*De,Ke=Qn(Le,Me,Ze,d);if(Ke[3]<=0){Fi(ne,B);continue}let Ne={};const tt=o.al(l.layers[0].layout.get("text-max-angle")),We=Math.cos(tt),it=_?null:b,rt=eo(le,Ie,!1,y,t,d,f,l.glyphOffsetArray,V,B,G,Ke,me,Ne,Q,it,I.projection,E,_,We);ue=rt.useVertical,it&&rt.needsFlipping&&(Ne={}),(rt.notEnoughRoom||ue||rt.needsFlipping&&eo(le,Ie,!0,y,t,d,f,l.glyphOffsetArray,V,B,G,Ke,me,Ne,Q,it,I.projection,E,_,We).notEnoughRoom)&&Fi(ne,B)}c?(l.text.dynamicLayoutVertexBuffer.updateData(B),G&&l.text.globeExtVertexBuffer&&l.text.globeExtVertexBuffer.updateData(G)):(l.icon.dynamicLayoutVertexBuffer.updateData(B),G&&l.icon.globeExtVertexBuffer&&l.icon.globeExtVertexBuffer.updateData(G))}function Bu(l,t,n,c,d,f,_,y,b,E,I,P,M,z,N,B,G){const{lineStartIndex:V,glyphStartIndex:X,segment:Q}=y,ie=X+y.numGlyphs,ue=V+y.lineLength,ae=t.getoffsetX(X),le=t.getoffsetX(ie-1),ne=_c(l*ae,n,c,d,f,_,Q,V,ue,b,E,I,P,M,!0,z,N,B,G);if(!ne)return null;const de=_c(l*le,n,c,d,f,_,Q,V,ue,b,E,I,P,M,!0,z,N,B,G);return de?{first:ne,last:de}:null}function Sa(l,t,n,c){return l===o.bI.horizontal&&Math.abs(c)>Math.abs(n)?{useVertical:!0}:l===o.bI.vertical?c>0?{needsFlipping:!0}:null:t!==Ta.unknown&&function(d,f){return d===0||Math.abs(f/d)>mc}(n,c)?t===Ta.flipRequired?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function eo(l,t,n,c,d,f,_,y,b,E,I,P,M,z,N,B,G,V,X,Q){const ie=t/24,ue=l.lineOffsetX*ie,ae=l.lineOffsetY*ie,{lineStartIndex:le,glyphStartIndex:ne,numGlyphs:de,segment:me,writingMode:Le,flipState:Me}=l,Ze=le+l.lineLength,He=ht=>{if(I){const[Ke,Ne,tt]=ht.up,We=E.length;o.bK(I,We+0,Ke,Ne,tt),o.bK(I,We+1,Ke,Ne,tt),o.bK(I,We+2,Ke,Ne,tt),o.bK(I,We+3,Ke,Ne,tt)}const[De,ke,Ie]=ht.point;o.bL(E,De,ke,Ie,ht.angle)};if(de>1){const ht=Bu(ie,y,ue,ae,n,P,M,l,b,f,z,B,!1,G,V,X,Q);if(!ht)return{notEnoughRoom:!0};if(c&&!n){let[De,ke,Ie]=ht.first.point,[Ke,Ne,tt]=ht.last.point;[De,ke]=Qn(De,ke,Ie,_),[Ke,Ne]=Qn(Ke,Ne,tt,_);const We=Sa(Le,Me,(Ke-De)*N,Ne-ke);if(l.flipState=We&&We.needsFlipping?Ta.flipRequired:Ta.flipNotRequired,We)return We}He(ht.first);for(let De=ne+1;De<ne+de-1;De++){const ke=_c(ie*y.getoffsetX(De),ue,ae,n,P,M,me,le,Ze,b,f,z,B,!1,!1,G,V,X,Q);if(!ke)return E.length-=4*(De-ne),{notEnoughRoom:!0};He(ke)}He(ht.last)}else{if(c&&!n){const De=Qn(M.x,M.y,0,d),ke=le+me+1,Ie=new o.P(b.getx(ke),b.gety(ke)),Ke=Qn(Ie.x,Ie.y,0,d),Ne=Ke[3]>0?Ke:Nu(M,Ie,De,1,d,void 0,G,V.canonical),tt=Sa(Le,Me,(Ne[0]-De[0])*N,Ne[1]-De[1]);if(l.flipState=tt&&tt.needsFlipping?Ta.flipRequired:Ta.flipNotRequired,tt)return tt}const ht=_c(ie*y.getoffsetX(ne),ue,ae,n,P,M,me,le,Ze,b,f,z,B,!1,!1,G,V,X,Q);if(!ht)return{notEnoughRoom:!0};He(ht)}return{}}function Ed(l,t,n,c,d){const{x:f,y:_,z:y}=c.projectTilePoint(l.x,l.y,t);if(!d)return Qn(f,_,y,n);const[b,E,I]=d(l);return Qn(f+b,_+E,y+I,n)}function Nu(l,t,n,c,d,f,_,y){const b=Ed(l.sub(t)._unit()._add(l),y,d,_,f);return o.at(b,n,b),o.au(b,b),o.bF(b,n,b,c)}function _c(l,t,n,c,d,f,_,y,b,E,I,P,M,z,N,B,G,V,X){const Q=c?l-t:l+t;let ie=Q>0?1:-1,ue=0;c&&(ie*=-1,ue=Math.PI),ie<0&&(ue+=Math.PI);let ae=y+_+(ie>0?0:1)|0,le=d,ne=d,de=0,me=0;const Le=Math.abs(Q),Me=[],Ze=[];let He=f,ht=He,De=o.bC([]);const ke=()=>Nu(ht,He,ne,Le-de+1,I,M,B,G.canonical);for(;de+me<=Le;){if(ae+=ie,ae<y||ae>=b)return null;if(ne=le,ht=He,Me.push(ne),z&&Ze.push(ht),He=new o.P(E.getx(ae),E.gety(ae)),le=P[ae],!le){const St=Ed(He,G.canonical,I,B,M);le=St[3]>0?P[ae]=St:ke()}de+=me;const At=o.at([],le,ne),Lt=o.bD(ne,le);if(n&&Lt>0&&me>0&&o.bE(De,At)/(me*Lt)<X)return null;me=Lt,De=At}N&&M&&(P[ae]&&(le=ke(),me=o.bD(ne,le),De=o.at([],le,ne)),P[ae]=le);const Ie=(Le-de)/me,Ke=He.sub(ht)._mult(Ie)._add(ht),Ne=o.bF([],ne,De,Ie);let tt=[0,0,1],We=De[0],it=De[1];if(V&&(tt=B.upVector(G.canonical,Ke.x,Ke.y),tt[0]!==0||tt[1]!==0||tt[2]!==1)){const At=[tt[2],0,-tt[0]],Lt=o.bG([],tt,At);o.au(At,At),o.au(Lt,Lt),We=o.bE(De,At),it=o.bE(De,Lt)}if(n){const At=o.bG([],tt,De);o.au(At,At),o.bF(Ne,Ne,At,n*ie)}const rt=ue+Math.atan2(it,We);return Me.push(Ne),z&&Ze.push(Ke),{point:Ne,angle:rt,path:Me,tilePath:Ze,up:tt}}function Fi(l,t){const n=t.length,c=n+4*l;t.resize(c),t.float32.fill(-1/0,4*n,4*c)}function Jf(l,t,n){const c=t[0],d=t[1];return l[0]=n[0]*c+n[4]*d+n[12],l[1]=n[1]*c+n[5]*d+n[13],l[3]=n[3]*c+n[7]*d+n[15],l}const Nt=100;class Qf{constructor(t,n,c=new bd(t.width+200,t.height+200,25),d=new bd(t.width+200,t.height+200,25)){this.transform=t,this.grid=c,this.ignoredGrid=d,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Nt,this.screenBottomBoundary=t.height+Nt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=n}placeCollisionBox(t,n,c,d,f,_,y,b){let E=c.projectedAnchorX,I=c.projectedAnchorY,P=c.projectedAnchorZ;const M=c.elevation,z=c.tileID,N=t.getProjection();if(M&&z){const[ae,le,ne]=N.upVector(z.canonical,c.tileAnchorX,c.tileAnchorY),de=N.upVectorScale(z.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;E+=ae*M*de,I+=le*M*de,P+=ne*M*de}const B=this.projectAndGetPerspectiveRatio(y,E,I,P,c.tileID,N.name==="globe"||!!M||this.transform.pitch>0,N),G=_*B.perspectiveRatio,V=(c.x1*n+d.x-c.padding)*G+B.point.x,X=(c.y1*n+d.y-c.padding)*G+B.point.y,Q=(c.x2*n+d.x+c.padding)*G+B.point.x,ie=(c.y2*n+d.y+c.padding)*G+B.point.y,ue=B.perspectiveRatio<=.55||B.occluded;return!this.isInsideGrid(V,X,Q,ie)||!f&&this.grid.hitTest(V,X,Q,ie,b)||ue?{box:[],offscreen:!1,occluded:B.occluded}:{box:[V,X,Q,ie],offscreen:this.isOffscreen(V,X,Q,ie),occluded:!1}}placeCollisionCircles(t,n,c,d,f,_,y,b,E,I,P,M,z,N,B){const G=[],V=this.transform.elevation,X=t.getProjection(),Q=V?V.getAtTileOffsetFunc(B,this.transform.center.lat,this.transform.worldSize,X):null,ie=new o.P(c.tileAnchorX,c.tileAnchorY);let{x:ue,y:ae,z:le}=X.projectTilePoint(ie.x,ie.y,B.canonical);if(Q){const[tt,We,it]=Q(ie);ue+=tt,ae+=We,le+=it}const ne=X.name==="globe",de=this.projectAndGetPerspectiveRatio(y,ue,ae,le,B,ne||!!V||this.transform.pitch>0,X),{perspectiveRatio:me}=de,Le=(P?_/me:_*me)/o.bO,Me=Qn(ue,ae,le,b),Ze=c.lineOffsetX*Le,He=c.lineOffsetY*Le,ht=o.al(t.layers[0].layout.get("text-max-angle")),De=Math.cos(ht),ke=de.signedDistanceFromCamera>0?Bu(Le,f,Ze,He,!1,Me,ie,c,d,b,{},V&&!P?Q:null,P&&!!V,X,B,P,De):null;let Ie=!1,Ke=!1,Ne=!0;if(ke&&!de.occluded){const tt=.5*z*me+N,We=new o.P(-100,-100),it=new o.P(this.screenRightBoundary,this.screenBottomBoundary),rt=new Kf,{first:At,last:Lt}=ke,St=At.path.length;let Ot=[];for(let Yt=St-1;Yt>=1;Yt--)Ot.push(At.path[Yt]);for(let Yt=1;Yt<Lt.path.length;Yt++)Ot.push(Lt.path[Yt]);const Ct=2.5*tt;E&&(Ot=Ot.map(([Yt,gi,Xi],Gi)=>(Q&&!ne&&(Xi=Q(Gi<St-1?At.tilePath[St-1-Gi]:Lt.tilePath[Gi-St+2])[2]),Qn(Yt,gi,Xi,E))),Ot.some(Yt=>Yt[3]<=0)&&(Ot=[]));let Vt=[];if(Ot.length>0){let Yt=1/0,gi=-1/0,Xi=1/0,Gi=-1/0;for(const xi of Ot)Yt=Math.min(Yt,xi[0]),Xi=Math.min(Xi,xi[1]),gi=Math.max(gi,xi[0]),Gi=Math.max(Gi,xi[1]);gi>=We.x&&Yt<=it.x&&Gi>=We.y&&Xi<=it.y&&(Vt=[Ot.map(xi=>new o.P(xi[0],xi[1]))],(Yt<We.x||gi>it.x||Xi<We.y||Gi>it.y)&&(Vt=o.bM(Vt,We.x,We.y,it.x,it.y)))}for(const Yt of Vt){rt.reset(Yt,.25*tt);let gi=0;gi=rt.length<=.5*tt?1:Math.ceil(rt.paddedLength/Ct)+1;for(let Xi=0;Xi<gi;Xi++){const Gi=Xi/Math.max(gi-1,1),xi=rt.lerp(Gi),kr=xi.x+Nt,Ir=xi.y+Nt;G.push(kr,Ir,tt,0);const ti=kr-tt,Ci=Ir-tt,zi=kr+tt,Yi=Ir+tt;if(Ne=Ne&&this.isOffscreen(ti,Ci,zi,Yi),Ke=Ke||this.isInsideGrid(ti,Ci,zi,Yi),!n&&this.grid.hitTestCircle(kr,Ir,tt,M)&&(Ie=!0,!I))return{circles:[],offscreen:!1,collisionDetected:Ie,occluded:!1}}}}return{circles:!I&&Ie||!Ke?[]:G,offscreen:Ne,collisionDetected:Ie,occluded:de.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let c=1/0,d=1/0,f=-1/0,_=-1/0;for(const I of t){const P=new o.P(I.x+Nt,I.y+Nt);c=Math.min(c,P.x),d=Math.min(d,P.y),f=Math.max(f,P.x),_=Math.max(_,P.y),n.push(P)}const y=this.grid.query(c,d,f,_).concat(this.ignoredGrid.query(c,d,f,_)),b={},E={};for(const I of y){const P=I.key;if(b[P.bucketInstanceId]===void 0&&(b[P.bucketInstanceId]={}),b[P.bucketInstanceId][P.featureIndex])continue;const M=[new o.P(I.x1,I.y1),new o.P(I.x2,I.y1),new o.P(I.x2,I.y2),new o.P(I.x1,I.y2)];o.bN(n,M)&&(b[P.bucketInstanceId][P.featureIndex]=!0,E[P.bucketInstanceId]===void 0&&(E[P.bucketInstanceId]=[]),E[P.bucketInstanceId].push(P.featureIndex))}return E}insertCollisionBox(t,n,c,d,f){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:d,collisionGroupID:f},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,c,d,f){const _=n?this.ignoredGrid:this.grid,y={bucketInstanceId:c,featureIndex:d,collisionGroupID:f};for(let b=0;b<t.length;b+=4)_.insertCircle(y,t[b],t[b+1],t[b+2])}projectAndGetPerspectiveRatio(t,n,c,d,f,_,y){const b=[n,c,d,1];let E=!1;d||this.transform.pitch>0?(o.aA(b,b,t),this.fogState&&f&&y.name!=="globe"&&(E=function(M,z,N,B,G,V){const X=V.calculateFogTileMatrix(G),Q=[z,N,B];return o.ad(Q,Q,X),Rt(M,o.ae(Q),V.pitch,V._fov)}(this.fogState,n,c,d,f.toUnwrapped(),this.transform)>.9)):Jf(b,b,t);const I=b[3];return{point:new o.P((b[0]/I+1)/2*this.transform.width+Nt,(-b[1]/I+1)/2*this.transform.height+Nt),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(y)/I*.5,1.5),signedDistanceFromCamera:I,occluded:_&&b[2]>I||E}}isOffscreen(t,n,c,d){return c<Nt||t>=this.screenRightBoundary||d<Nt||n>this.screenBottomBoundary}isInsideGrid(t,n,c,d){return c>=0&&t<this.gridRightBoundary&&d>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=o.bx([]);return o.bo(t,t,[-100,-100,0]),t}}function ju(l,t,n){const c=t.createTileMatrix(l,l.worldSize,n.toUnwrapped());return o.az(new Float32Array(16),l.projMatrix,c)}function Vu(l,t,n){if(t.projection.name===n.projection.name)return l.projMatrix;const c=n.clone();return c.setProjection(t.projection),ju(c,t.getProjection(),l)}function gc(l,t,n){return t.name===n.projection.name?l.projMatrix:ju(n,t,l)}class _o{constructor(t,n,c,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class Ea{constructor(t,n,c,d,f,_=!1){this.text=new _o(t?t.text:null,n,c,f),this.icon=new _o(t?t.icon:null,n,d,f),this.clipped=_}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Vs{constructor(t,n,c,d=!1){this.text=t,this.icon=n,this.skipFade=c,this.clipped=d}}class Ft{constructor(){this.invProjMatrix=o.bz(),this.viewportMatrix=o.bz(),this.circles=[]}}class er{constructor(t,n,c,d,f){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=f}}class $i{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:c=>c.collisionGroupID===n}}return this.collisionGroups[t]}}function qn(l,t,n,c,d){const{horizontalAlign:f,verticalAlign:_}=o.bV(l),y=-(f-.5)*t,b=-(_-.5)*n,E=o.bU(l,c);return new o.P(y+E[0]*d,b+E[1]*d)}function Us(l,t,n,c,d){const f=new o.P(l,t);return n&&f._rotate(c?d:-d),f}class ji{constructor(t,n,c,d,f,_){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new Qf(this.transform,f),this.buildingIndex=_,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new $i(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,c,d,f=1){const _=c.getBucket(n),y=c.latestFeatureIndex;if(!_||!y||n.fqid!==_.layerIds[0])return;const b=_.layers[0].layout,E=_.layers[0].paint,I=c.collisionBoxArray,P=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ),M=c.tileSize/o.aj,z=c.tileID.toUnwrapped();this.transform.setProjection(_.projection);const N=(B=c.tileID,G=_.getProjection(),V=this.transform,G.name===this.projection?V.calculateProjMatrix(B.toUnwrapped()):ju(V,G,B));var B,G,V;const X=b.get("text-pitch-alignment")==="map",Q=b.get("text-rotation-alignment")==="map";n.compileFilter(n.options);const ie=n.dynamicFilter(),ue=n.dynamicFilterNeedsFeature(),ae=this.transform.calculatePixelsToTileUnitsMatrix(c),le=Fu(N,c.tileID.canonical,X,Q,this.transform,_.getProjection(),ae);let ne=null;if(X){const ke=wd(N,c.tileID.canonical,X,Q,this.transform,_.getProjection(),ae);ne=o.az([],this.transform.labelPlaneMatrix,ke)}let de=null;ie&&c.latestFeatureIndex&&(de={unwrappedTileID:z,dynamicFilter:ie,dynamicFilterNeedsFeature:ue}),this.retainedQueryData[_.bucketInstanceId]=new er(_.bucketInstanceId,y,_.sourceLayerIndex,_.index,c.tileID);const[me,Le]=_.layers[0].layout.get("text-size-scale-range"),Me=o.aD(f,me,Le),[Ze,He]=b.get("icon-size-scale-range"),ht=o.aD(f,Ze,He),De={bucket:_,layout:b,paint:E,posMatrix:N,textLabelPlaneMatrix:le,labelToScreenMatrix:ne,clippingData:de,scale:P,textPixelRatio:M,holdingForFade:c.holdingForFade(),collisionBoxArray:I,partiallyEvaluatedTextSize:o.bH(_.textSizeData,this.transform.zoom,Me),partiallyEvaluatedIconSize:o.bH(_.iconSizeData,this.transform.zoom,ht),collisionGroup:this.collisionGroups.get(_.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(d)for(const ke of _.sortKeyRanges){const{sortKey:Ie,symbolInstanceStart:Ke,symbolInstanceEnd:Ne}=ke;t.push({sortKey:Ie,symbolInstanceStart:Ke,symbolInstanceEnd:Ne,parameters:De})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:_.symbolInstances.length,parameters:De})}attemptAnchorPlacement(t,n,c,d,f,_,y,b,E,I,P,M,z,N,B,G,V,X){const{textOffset0:Q,textOffset1:ie,crossTileID:ue}=M,ae=[Q,ie],le=qn(t,c,d,ae,f),ne=this.collisionIndex.placeCollisionBox(N,f,n,Us(le.x,le.y,_,y,this.transform.angle),P,b,E,I.predicate);if(G){const de=N.getSymbolInstanceIconSize(X,this.transform.zoom,M.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(N,de,G,Us(le.x,le.y,_,y,this.transform.angle),P,b,E,I.predicate).box.length===0)return}if(ne.box.length>0){let de;return this.prevPlacement&&this.prevPlacement.variableOffsets[ue]&&this.prevPlacement.placements[ue]&&this.prevPlacement.placements[ue].text&&(de=this.prevPlacement.variableOffsets[ue].anchor),this.variableOffsets[ue]={textOffset:ae,width:c,height:d,anchor:t,textScale:f,prevAnchor:de},this.markUsedJustification(N,t,M,B),N.allowVerticalPlacement&&(this.markUsedOrientation(N,B,M),this.placedOrientations[ue]=B),{shift:le,placedGlyphBoxes:ne}}}placeLayerBucketPart(t,n,c,d,f=1){const{bucket:_,layout:y,paint:b,posMatrix:E,textLabelPlaneMatrix:I,labelToScreenMatrix:P,clippingData:M,textPixelRatio:z,holdingForFade:N,collisionBoxArray:B,partiallyEvaluatedTextSize:G,partiallyEvaluatedIconSize:V,collisionGroup:X,latestFeatureIndex:Q}=t.parameters,ie=y.get("text-optional"),ue=y.get("icon-optional"),ae=y.get("text-allow-overlap"),le=y.get("icon-allow-overlap"),ne=y.get("text-rotation-alignment")==="map",de=y.get("text-pitch-alignment")==="map",me=b.get("symbol-z-offset"),Le=y.get("symbol-elevation-reference")==="sea",[Me,Ze]=y.get("text-size-scale-range"),[He,ht]=y.get("icon-size-scale-range"),De=o.aD(f,Me,Ze),ke=o.aD(f,He,ht);this.transform.setProjection(_.projection);let Ie=ae&&(le||!_.hasIconData()||ue),Ke=le&&(ae||!_.hasTextData()||ie);const Ne=!me.isConstant();!_.collisionArrays&&B&&_.deserializeCollisionBoxes(B),c&&d&&_.updateCollisionDebugBuffers(this.transform.zoom,B,De,ke);const tt=(We,it,rt)=>{const{crossTileID:At,numVerticalGlyphVertices:Lt}=We;let St=null;if(M&&M.dynamicFilterNeedsFeature||Ne){const Di=this.retainedQueryData[_.bucketInstanceId];St=Q.loadFeature({featureIndex:We.featureIndex,bucketIndex:Di.bucketIndex,sourceLayerIndex:Di.sourceLayerIndex,layoutVertexArrayOffset:0})}if(M&&!(0,M.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},St,this.retainedQueryData[_.bucketInstanceId].tileID.canonical,new o.P(We.tileAnchorX,We.tileAnchorY),this.transform.calculateDistanceTileData(M.unwrappedTileID)))return this.placements[At]=new Vs(!1,!1,!1,!0),void n.add(At);const Ot=me.evaluate(St,{});if(n.has(At))return;if(N)return void(this.placements[At]=new Vs(!1,!1,!1));let Ct=!1,Vt=!1,Yt=!0,gi=!1,Xi=!1,Gi=null,xi={box:null,offscreen:null,occluded:null},kr={box:null,offscreen:null,occluded:null},Ir=null,ti=null,Ci=null,zi=0,Yi=0,Kr=0;rt.textFeatureIndex?zi=rt.textFeatureIndex:We.useRuntimeCollisionCircles&&(zi=We.featureIndex),rt.verticalTextFeatureIndex&&(Yi=rt.verticalTextFeatureIndex);const jr=Di=>{Di.tileID=this.retainedQueryData[_.bucketInstanceId].tileID;const vr=this.transform.elevation;Di.elevation=Le?Ot:Ot+(vr?vr.getAtTileOffset(Di.tileID,Di.tileAnchorX,Di.tileAnchorY):0),Di.elevation+=We.zOffset},Xr=rt.textBox;if(Xr){jr(Xr);const Di=Bi=>{let Er=o.bI.horizontal;if(_.allowVerticalPlacement&&!Bi&&this.prevPlacement){const mn=this.prevPlacement.placedOrientations[At];mn&&(this.placedOrientations[At]=mn,Er=mn,this.markUsedOrientation(_,Er,We))}return Er},vr=(Bi,Er)=>{if(_.allowVerticalPlacement&&Lt>0&&rt.verticalTextBox){for(const mn of _.writingModes)if(mn===o.bI.vertical?(xi=Er(),kr=xi):xi=Bi(),xi&&xi.box&&xi.box.length)break}else xi=Bi()};if(y.get("text-variable-anchor")){let Bi=y.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[At]){const cr=this.prevPlacement.variableOffsets[At];Bi.indexOf(cr.anchor)>0&&(Bi=Bi.filter(vn=>vn!==cr.anchor),Bi.unshift(cr.anchor))}const Er=(cr,vn,Zr)=>{const wn=_.getSymbolInstanceTextSize(G,We,this.transform.zoom,it),Oo=(cr.x2-cr.x1)*wn+2*cr.padding,Ts=(cr.y2-cr.y1)*wn+2*cr.padding,io=We.hasIconTextFit&&!le?vn:null;io&&jr(io);let bo={box:[],offscreen:!1,occluded:!1};const Qo=ae?2*Bi.length:Bi.length;for(let es=0;es<Qo;++es){const Fo=this.attemptAnchorPlacement(Bi[es%Bi.length],cr,Oo,Ts,wn,ne,de,z,E,X,es>=Bi.length,We,it,_,Zr,io,G,V);if(Fo&&(bo=Fo.placedGlyphBoxes,bo&&bo.box&&bo.box.length)){Ct=!0,Gi=Fo.shift;break}}return bo};vr(()=>Er(Xr,rt.iconBox,o.bI.horizontal),()=>{const cr=rt.verticalTextBox;return cr&&jr(cr),_.allowVerticalPlacement&&!(xi&&xi.box&&xi.box.length)&&Lt>0&&cr?Er(cr,rt.verticalIconBox,o.bI.vertical):{box:null,offscreen:null,occluded:null}}),xi&&(Ct=xi.box,Yt=xi.offscreen,gi=xi.occluded);const mn=Di(!(!xi||!xi.box));if(!Ct&&this.prevPlacement){const cr=this.prevPlacement.variableOffsets[At];cr&&(this.variableOffsets[At]=cr,this.markUsedJustification(_,cr.anchor,We,mn))}}else{const Bi=(Er,mn)=>{const cr=_.getSymbolInstanceTextSize(G,We,this.transform.zoom,it,f),vn=this.collisionIndex.placeCollisionBox(_,cr,Er,new o.P(0,0),ae,z,E,X.predicate);return vn&&vn.box&&vn.box.length&&(this.markUsedOrientation(_,mn,We),this.placedOrientations[At]=mn),vn};vr(()=>Bi(Xr,o.bI.horizontal),()=>{const Er=rt.verticalTextBox;return _.allowVerticalPlacement&&Lt>0&&Er?(jr(Er),Bi(Er,o.bI.vertical)):{box:null,offscreen:null,occluded:null}}),Di(!!(xi&&xi.box&&xi.box.length))}}if(Ir=xi,Ct=Ir&&Ir.box&&Ir.box.length>0,Yt=Ir&&Ir.offscreen,gi=Ir&&Ir.occluded,We.useRuntimeCollisionCircles){const Di=_.text.placedSymbolArray.get(We.centerJustifiedTextSymbolIndex>=0?We.centerJustifiedTextSymbolIndex:We.verticalPlacedTextSymbolIndex),vr=o.bJ(_.textSizeData,G,Di),Bi=y.get("text-padding");ti=this.collisionIndex.placeCollisionCircles(_,ae,Di,_.lineVertexArray,_.glyphOffsetArray,vr,E,I,P,c,de,X.predicate,We.collisionCircleDiameter*vr/o.bO,Bi,this.retainedQueryData[_.bucketInstanceId].tileID),Ct=ae||ti.circles.length>0&&!ti.collisionDetected,Yt=Yt&&ti.offscreen,gi=ti.occluded}if(rt.iconFeatureIndex&&(Kr=rt.iconFeatureIndex),rt.iconBox){const Di=vr=>{jr(vr);const Bi=We.hasIconTextFit&&Gi?Us(Gi.x,Gi.y,ne,de,this.transform.angle):new o.P(0,0),Er=_.getSymbolInstanceIconSize(V,this.transform.zoom,We.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(_,Er,vr,Bi,le,z,E,X.predicate)};kr&&kr.box&&kr.box.length&&rt.verticalIconBox?(Ci=Di(rt.verticalIconBox),Vt=Ci.box.length>0):(Ci=Di(rt.iconBox),Vt=Ci.box.length>0),Yt=Yt&&Ci.offscreen,Xi=Ci.occluded}const Sr=ie||We.numHorizontalGlyphVertices===0&&Lt===0,si=ue||We.numIconVertices===0;if(Sr||si?si?Sr||(Vt=Vt&&Ct):Ct=Vt&&Ct:Vt=Ct=Vt&&Ct,Ct&&Ir&&Ir.box&&this.collisionIndex.insertCollisionBox(Ir.box,y.get("text-ignore-placement"),_.bucketInstanceId,kr&&kr.box&&Yi?Yi:zi,X.ID),Vt&&Ci&&this.collisionIndex.insertCollisionBox(Ci.box,y.get("icon-ignore-placement"),_.bucketInstanceId,Kr,X.ID),ti&&(Ct&&this.collisionIndex.insertCollisionCircles(ti.circles,y.get("text-ignore-placement"),_.bucketInstanceId,zi,X.ID),c)){const Di=_.bucketInstanceId;let vr=this.collisionCircleArrays[Di];vr===void 0&&(vr=this.collisionCircleArrays[Di]=new Ft);for(let Bi=0;Bi<ti.circles.length;Bi+=4)vr.circles.push(ti.circles[Bi+0]),vr.circles.push(ti.circles[Bi+1]),vr.circles.push(ti.circles[Bi+2]),vr.circles.push(ti.collisionDetected?1:0)}const yr=_.projection.name!=="globe";Ie=Ie&&(yr||!gi),Ke=Ke&&(yr||!Xi),this.placements[At]=new Vs(Ct||Ie,Vt||Ke,Yt||_.justReloaded),n.add(At)};if(_.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(_,this.retainedQueryData[_.bucketInstanceId].tileID),_.elevationType==="road"&&_.updateRoadElevation(),_.updateZOffset(),_.sortFeaturesByY){const We=_.getSortedSymbolIndexes(this.transform.angle);for(let it=We.length-1;it>=0;--it){const rt=We[it];tt(_.symbolInstances.get(rt),rt,_.collisionArrays[rt])}_.hasAnyZOffset&&o.w(`${_.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(_.hasAnyZOffset){const We=_.getSortedIndexesByZOffset();for(let it=0;it<We.length;++it){const rt=We[it];tt(_.symbolInstances.get(rt),rt,_.collisionArrays[rt])}}else for(let We=t.symbolInstanceStart;We<t.symbolInstanceEnd;We++)tt(_.symbolInstances.get(We),We,_.collisionArrays[We]);if(c&&_.bucketInstanceId in this.collisionCircleArrays){const We=this.collisionCircleArrays[_.bucketInstanceId];o.bi(We.invProjMatrix,E),We.viewportMatrix=this.collisionIndex.getViewportMatrix()}_.justReloaded=!1}markUsedJustification(t,n,c,d){const{leftJustifiedTextSymbolIndex:f,centerJustifiedTextSymbolIndex:_,rightJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:b,crossTileID:E}=c,I=o.bT(n),P=d===o.bI.vertical?b:I==="left"?f:I==="center"?_:I==="right"?y:-1;f>=0&&(t.text.placedSymbolArray.get(f).crossTileID=P>=0&&f!==P?0:E),_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=P>=0&&_!==P?0:E),y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=P>=0&&y!==P?0:E),b>=0&&(t.text.placedSymbolArray.get(b).crossTileID=P>=0&&b!==P?0:E)}markUsedOrientation(t,n,c){const d=n===o.bI.horizontal||n===o.bI.horizontalOnly?n:0,f=n===o.bI.vertical?n:0,{leftJustifiedTextSymbolIndex:_,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:b,verticalPlacedTextSymbolIndex:E}=c,I=t.text.placedSymbolArray;_>=0&&(I.get(_).placedOrientation=d),y>=0&&(I.get(y).placedOrientation=d),b>=0&&(I.get(b).placedOrientation=d),E>=0&&(I.get(E).placedOrientation=f)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let c=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const d=n?n.symbolFadeChange(t):1,f=n?n.opacities:{},_=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const b in this.placements){const E=this.placements[b],I=f[b];I?(this.opacities[b]=new Ea(I,d,E.text,E.icon,null,E.clipped),c=c||E.text!==I.text.placed||E.icon!==I.icon.placed):(this.opacities[b]=new Ea(null,d,E.text,E.icon,E.skipFade,E.clipped),c=c||E.text||E.icon)}for(const b in f){const E=f[b];if(!this.opacities[b]){const I=new Ea(E,d,!1,!1);I.isHidden()||(this.opacities[b]=I,c=c||E.text.placed||E.icon.placed)}}for(const b in _)this.variableOffsets[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.variableOffsets[b]=_[b]);for(const b in y)this.placedOrientations[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.placedOrientations[b]=y[b]);c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n,c,d){const f=new Set;for(const _ of n){const y=_.getBucket(t);y&&_.latestFeatureIndex&&t.fqid===y.layerIds[0]&&(this.updateBucketOpacities(y,f,_,_.collisionBoxArray,c,d,_.tileID,t.scope),y.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(y,_.tileID),y.elevationType==="road"&&y.updateRoadElevation(),y.updateZOffset())}}updateBucketOpacities(t,n,c,d,f,_,y,b){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const E=t.layers[0].layout,I=t.layers[0].paint,P=!!t.layers[0].dynamicFilter(),M=new Ea(null,0,!1,!1,!0),z=E.get("text-allow-overlap"),N=E.get("icon-allow-overlap"),B=E.get("text-variable-anchor"),G=E.get("text-rotation-alignment")==="map",V=E.get("text-pitch-alignment")==="map",X=I.get("symbol-z-offset"),Q=E.get("symbol-elevation-reference")==="sea",ie=!X.isConstant(),ue=new Ea(null,0,z&&(N||!t.hasIconData()||E.get("icon-optional")),N&&(z||!t.hasTextData()||E.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const ae=(ne,de,me)=>{for(let Le=0;Le<de/4;Le++)ne.opacityVertexArray.emplaceBack(me)};let le=0;_&&t.updateReplacement(y,_);for(let ne=0;ne<t.symbolInstances.length;ne++){const de=t.symbolInstances.get(ne),{numHorizontalGlyphVertices:me,numVerticalGlyphVertices:Le,crossTileID:Me,numIconVertices:Ze,tileAnchorX:He,tileAnchorY:ht}=de;let De=null;const ke=this.retainedQueryData[t.bucketInstanceId];ie&&de&&ke&&(De=c.latestFeatureIndex.loadFeature({featureIndex:de.featureIndex,bucketIndex:ke.bucketIndex,sourceLayerIndex:ke.sourceLayerIndex,layoutVertexArrayOffset:0}));const Ie=X.evaluate(De,{}),Ke=n.has(Me);let Ne=this.opacities[Me];Ke?Ne=M:Ne||(Ne=ue,this.opacities[Me]=Ne),n.add(Me);const tt=me>0||Le>0,We=Ze>0,it=this.placedOrientations[Me],rt=it===o.bI.vertical,At=it===o.bI.horizontal||it===o.bI.horizontalOnly;!tt&&!We||Ne.isHidden()||le++;let Lt=!1;if((tt||We)&&_)for(const St of t.activeReplacements){if(o.bP(St,f,o.bQ.Symbol,b)||St.min.x>He||He>St.max.x||St.min.y>ht||ht>St.max.y)continue;const Ot=o.bR(He,ht,y.canonical,St.footprintTileId.canonical);if(Lt=o.bS(Ot,St.footprint),Lt)break}if(tt){const St=Lt?$s:dl(Ne.text);ae(t.text,me,rt?$s:St),ae(t.text,Le,At?$s:St);const Ot=Ne.text.isHidden(),{leftJustifiedTextSymbolIndex:Ct,centerJustifiedTextSymbolIndex:Vt,rightJustifiedTextSymbolIndex:Yt,verticalPlacedTextSymbolIndex:gi}=de,Xi=t.text.placedSymbolArray,Gi=Ot||rt?1:0;Ct>=0&&(Xi.get(Ct).hidden=Gi),Vt>=0&&(Xi.get(Vt).hidden=Gi),Yt>=0&&(Xi.get(Yt).hidden=Gi),gi>=0&&(Xi.get(gi).hidden=Ot||At?1:0);const xi=this.variableOffsets[Me];xi&&this.markUsedJustification(t,xi.anchor,de,it);const kr=this.placedOrientations[Me];kr&&(this.markUsedJustification(t,"left",de,kr),this.markUsedOrientation(t,kr,de))}if(We){const St=Lt?$s:dl(Ne.icon),{placedIconSymbolIndex:Ot,verticalPlacedIconSymbolIndex:Ct}=de,Vt=t.icon.placedSymbolArray,Yt=Ne.icon.isHidden()?1:0;Ot>=0&&(ae(t.icon,Ze,rt?$s:St),Vt.get(Ot).hidden=Yt),Ct>=0&&(ae(t.icon,de.numVerticalIconVertices,At?$s:St),Vt.get(Ct).hidden=Yt)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const St=t.collisionArrays[ne];if(St){let Ot=new o.P(0,0),Ct=!0;if(St.textBox||St.verticalTextBox){if(B){const Yt=this.variableOffsets[Me];Yt?(Ot=qn(Yt.anchor,Yt.width,Yt.height,Yt.textOffset,Yt.textScale),G&&Ot._rotate(V?this.transform.angle:-this.transform.angle)):Ct=!1}P&&(Ct=!Ne.clipped),St.textBox&&Aa(t.textCollisionBox.collisionVertexArray,Ne.text.placed,!Ct||rt,Ie,Q,Ot.x,Ot.y),St.verticalTextBox&&Aa(t.textCollisionBox.collisionVertexArray,Ne.text.placed,!Ct||At,Ie,Q,Ot.x,Ot.y)}const Vt=Ct&&!!(!At&&St.verticalIconBox);St.iconBox&&Aa(t.iconCollisionBox.collisionVertexArray,Ne.icon.placed,Vt,Ie,Q,de.hasIconTextFit?Ot.x:0,de.hasIconTextFit?Ot.y:0),St.verticalIconBox&&Aa(t.iconCollisionBox.collisionVertexArray,Ne.icon.placed,!Vt,Ie,Q,de.hasIconTextFit?Ot.x:0,de.hasIconTextFit?Ot.y:0)}}}if(t.fullyClipped=le===0,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const ne=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=ne.invProjMatrix,t.placementViewportMatrix=ne.viewportMatrix,t.collisionCircleArray=ne.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const c=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*c>t}setStale(){this.stale=!0}}function Aa(l,t,n,c,d,f,_){l.emplaceBack(t?1:0,n?1:0,f||0,_||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,f||0,_||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,f||0,_||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,f||0,_||0,c,d?1:0)}const yc=Math.pow(2,25),vc=Math.pow(2,24),Bn=Math.pow(2,17),tn=Math.pow(2,16),Ty=Math.pow(2,9),xc=Math.pow(2,8),Ad=Math.pow(2,1);function dl(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,n=Math.floor(127*l.opacity);return n*yc+t*vc+n*Bn+t*tn+n*Ty+t*xc+n*Ad+t}const $s=0;class Uu{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(t,n,c,d,f,_){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(y,d,t[this._currentTileIndex],this._sortAcrossTiles,_),this._currentTileIndex++,f())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort((b,E)=>b.sortKey-E.sortKey));this._currentPartIndex<y.length;){const b=y[this._currentPartIndex];if(n.placeLayerBucketPart(b,this._seenCrossTileIDs,c,b.symbolInstanceStart===0,_),this._currentPartIndex++,f())return!0}return!1}}class Nn{constructor(t,n,c,d,f,_,y,b,E){this.placement=new ji(t,f,_,y,b,E),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,c,d,f){const _=o.q.now(),y=()=>{const b=o.q.now()-_;return!this._forceFullPlacement&&b>2};for(;this._currentPlacementIndex>=0;){const b=n[t[this._currentPlacementIndex]],E=this.placement.collisionIndex.transform.zoom;if(b.type==="symbol"&&(!b.minzoom||b.minzoom<=E)&&(!b.maxzoom||b.maxzoom>E)){const I=b,P=I.layout.get("symbol-z-elevate"),M=I.layout.get("symbol-sort-key").constantOr(1)!==void 0,z=I.layout.get("symbol-z-order"),N=z==="viewport-y"||z==="auto"&&!(z!=="viewport-y"&&M),B=I.layout.get("text-allow-overlap")||I.layout.get("icon-allow-overlap")||I.layout.get("text-ignore-placement")||I.layout.get("icon-ignore-placement"),G=N&&B,V=this._inProgressLayer=this._inProgressLayer||new Uu(I),X=o.C(b.source,b.scope);if(V.continuePlacement(P||G?d[X]:c[X],this.placement,this._showCollisionBoxes,b,y,f))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Po=512/o.aj/2;class Zn{constructor(t,n,c){this.tileID=t,this.bucketInstanceId=c,this.index=new o.bW(n.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*o.aj,f=t.canonical.y*o.aj;for(let _=0;_<n.length;_++){const{key:y,crossTileID:b,tileAnchorX:E,tileAnchorY:I}=n.get(_),P=Math.floor((d+E)*Po),M=Math.floor((f+I)*Po);this.index.add(P,M),this.keys.push(y),this.crossTileIDs.push(b)}this.index.finish()}findMatches(t,n,c){const d=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z),f=Po/Math.pow(2,n.canonical.z-this.tileID.canonical.z),_=n.canonical.x*o.aj,y=n.canonical.y*o.aj;for(let b=0;b<t.length;b++){const E=t.get(b);if(E.crossTileID)continue;const{key:I,tileAnchorX:P,tileAnchorY:M}=E,z=Math.floor((_+P)*f),N=Math.floor((y+M)*f),B=this.index.range(z-d,N-d,z+d,N+d).sort((G,V)=>G-V);for(const G of B){const V=this.crossTileIDs[G];if(this.keys[G]===I&&!c.has(V)){c.add(V),E.crossTileID=V;break}}}}}class em{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class pl{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const c in this.indexes){const d=this.indexes[c],f={};for(const _ in d){const y=d[_];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),f[y.tileID.key]=y}this.indexes[c]=f}this.lng=t}addBucket(t,n,c){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let f=0;f<n.symbolInstances.length;f++)n.symbolInstances.get(f).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const d=this.usedCrossTileIDs[t.overscaledZ];for(const f in this.indexes){const _=this.indexes[f];if(Number(f)>t.overscaledZ)for(const y in _){const b=_[y];b.tileID.isChildOf(t)&&b.findMatches(n.symbolInstances,t,d)}else{const y=_[t.scaledTo(Number(f)).key];y&&y.findMatches(n.symbolInstances,t,d)}}for(let f=0;f<n.symbolInstances.length;f++){const _=n.symbolInstances.get(f);_.crossTileID||(_.crossTileID=c.generate(),d.add(_.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Zn(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const c of n.crossTileIDs)this.usedCrossTileIDs[t].delete(c)}removeStaleBuckets(t){let n=!1;for(const c in this.indexes){const d=this.indexes[c];for(const f in d)t[d[f].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[f]),delete d[f],n=!0)}return n}}class hn{constructor(){this.layerIndexes={},this.crossTileIDs=new em,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,c,d){let f=this.layerIndexes[t.fqid];f===void 0&&(f=this.layerIndexes[t.fqid]=new pl);let _=!1;const y={};d.name!=="globe"&&f.handleWrapJump(c);for(const b of n){const E=b.getBucket(t);E&&t.fqid===E.layerIds[0]&&(E.bucketInstanceId||(E.bucketInstanceId=++this.maxBucketInstanceId),f.addBucket(b.tileID,E,this.crossTileIDs)&&(_=!0),y[E.bucketInstanceId]=!0)}return f.removeStaleBuckets(y)&&(_=!0),_}pruneUnusedLayers(t){const n={};t.forEach(c=>{n[c]=!0});for(const c in this.layerIndexes)n[c]||delete this.layerIndexes[c]}}const jn=771;class di{constructor(t,n,c,d){this.blendFunction=t,this.blendColor=n,this.mask=c,this.blendEquation=d}}di.Replace=[1,0,1,0],di.disabled=new di(di.Replace,o.am.transparent,[!1,!1,!1,!1]),di.unblended=new di(di.Replace,o.am.transparent,[!0,!0,!0,!0]),di.alphaBlended=new di([1,jn,1,jn],o.am.transparent,[!0,!0,!0,!0]),di.alphaBlendedNonPremultiplied=new di([770,jn,770,jn],o.am.transparent,[!0,!0,!0,!0]),di.multiply=new di([774,0,774,0],o.am.transparent,[!0,!0,!0,!0]);class It{constructor(t,n,c){this.func=t,this.mask=n,this.range=c}}It.ReadOnly=!1,It.ReadWrite=!0,It.disabled=new It(519,It.ReadOnly,[0,1]);const bc=7680;class qt{constructor(t,n,c,d,f,_){this.test=t,this.ref=n,this.mask=c,this.fail=d,this.depthFail=f,this.pass=_}}qt.disabled=new qt({func:519,mask:0},0,0,bc,bc,bc);const Ia=1029,fl=2305;class Zt{constructor(t,n,c){this.enable=t,this.mode=n,this.frontFace=c}}function tm(l,t){const n=o.c1(l,3);o.c3(l,t),o.c7(l,3,n)}function Do(l,t){const n=o.bY([]);return o.bZ(n,n,-t),o.b_(n,n,-l),n}function im(l,t){const n=[l[0],l[1],0],c=[t[0],t[1],0];if(o.ae(n)>=1e-15){const _=o.au([],n);o.b$(c,_,o.bE(c,_)),t[0]=c[0],t[1]=c[1]}const d=o.bG([],t,l);if(o.c0(d)<1e-15)return null;const f=Math.atan2(-d[1],d[0]);return Do(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),f)}Zt.disabled=new Zt(!1,Ia,fl),Zt.backCCW=new Zt(!0,Ia,fl),Zt.backCW=new Zt(!0,Ia,2304),Zt.frontCW=new Zt(!0,1028,2304),Zt.frontCCW=new Zt(!0,1028,fl);class $u{constructor(t,n){this.position=t,this.orientation=n}get position(){return this._position}set position(t){if(t){const n=t instanceof o.ac?t:new o.ac(t[0],t[1],t[2]);this._renderWorldCopies&&(n.x=o.bX(n.x,0,1)),this._position=n}else this._position=null}lookAtPoint(t,n){if(this.orientation=null,!this.position)return;const c=this.position,d=this._elevation?this._elevation.getAtPointOrZero(o.ac.fromLngLat(t)):0,f=o.ac.fromLngLat(t,d),_=[f.x-c.x,f.y-c.y,f.z-c.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=im(_,n)}setPitchBearing(t,n){this.orientation=Do(o.al(t),o.al(-n))}}class zn{constructor(t,n){this._transform=o.bx([]),this.orientation=n,this.position=t}get mercatorPosition(){const t=this.position;return new o.ac(t[0],t[1],t[2])}get position(){const t=o.c1(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var n;t&&o.c7(this._transform,3,[(n=t)[0],n[1],n[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||o.bY([]),t&&tm(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),n=this.right();return{bearing:Math.atan2(-n[1],n[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,n){this._orientation=Do(t,n),tm(this._transform,this._orientation)}forward(){const t=o.c1(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=o.c1(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=o.c1(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,n){const c=new Float64Array(16);return o.bi(c,this.getWorldToCamera(t,n)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,n,c){const d=this.position;o.b$(d,d,-t);const f=new Float64Array(16);return o.bn(f,[c,c,c]),o.bo(f,f,d),f[10]*=n,f}getWorldToCamera(t,n){const c=new Float64Array(16),d=new Float64Array(4),f=this.position;return o.c2(d,this._orientation),o.b$(f,f,-t),o.c3(c,d),o.bo(c,c,f),c[1]*=-1,c[5]*=-1,c[9]*=-1,c[13]*=-1,c[8]*=n,c[9]*=n,c[10]*=n,c[11]*=n,c}getCameraToClipPerspective(t,n,c,d){const f=new Float64Array(16);return o.c4(f,t,n,c,d),f}getCameraToClipOrthographic(t,n,c,d,f,_){const y=new Float64Array(16);return o.c5(y,t,n,c,d,f,_),y}getDistanceToElevation(t,n=!1){const c=t===0?0:o.c6(t,n?o.aY(this.position[1]):this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new zn([...this.position],[...this.orientation])}}const Vn={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class ml{constructor(t=0,n=0,c=0,d=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=c,this.right=d}interpolate(t,n,c){return n.top!=null&&t.top!=null&&(this.top=o.ai(t.top,n.top,c)),n.bottom!=null&&t.bottom!=null&&(this.bottom=o.ai(t.bottom,n.bottom,c)),n.left!=null&&t.left!=null&&(this.left=o.ai(t.left,n.left,c)),n.right!=null&&t.right!=null&&(this.right=o.ai(t.right,n.right,c)),this}getCenter(t,n){const c=o.aD((this.left+t-this.right)/2,0,t),d=o.aD((this.top+n-this.bottom)/2,0,n);return new o.P(c,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ml(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Gs=15;class Ca{constructor(t,n,c,d,f,_,y){this.tileSize=512,this._renderWorldCopies=f===void 0||f,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=c??0,this._maxPitch=d??60,this.setProjection(_),this.setMaxBounds(y),this.width=0,this.height=0,this._center=new o.cd(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new ml,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new zn,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const t=new Ca(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<Gs}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(t,n=!1){const c=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(n),this._calcMatrices()}getProjection(){return o.aF(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const n=this.projection?this.getProjection():void 0;this.projection=o.ce(this.projectionOptions);const c=this.getProjection(),d=!o.bv(n,c);return d&&this._calcMatrices(),this.mercatorFromTransition=!1,d}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&&(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=o.ce({name:"mercator"});const n=t!==this.projection.name;return n&&this._calcMatrices(),n}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return o.c6(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.P(this.width,this.height)}get bearing(){return o.bX(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const n=-t*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=o.cf(),o.cg(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=o.aD(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=o.al(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._setZoom(n),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(t){this._tileCoverLift!==t&&(this._tileCoverLift=t)}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,n=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!n||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const c=this._elevation;n||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&c.exaggeration()&&this._centerAltitudeValidForExaggeration!==c.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*c.exaggeration(),this._centerAltitudeValidForExaggeration=c.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=c.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],c=this.horizonLineFromTop();let d=0,f=0;for(let _=0;_<n.length;_++){const y=new o.P(n[_][0]*this.width,c+n[_][1]*(this.height-c)),b=t.pointCoordinate(y);if(!b)continue;const E=1/Math.hypot(b[0]-this._camera.position[0],b[1]-this._camera.position[1]);d+=b[3]*E,f+=E}return f===0?NaN:d/f}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,n=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),c=this.pixelsPerMeter/this.worldSize*n,d=this._mercatorZfromZoom(t),f=this._mercatorZfromZoom(this._maxZoom),_=Math.max(d-c,f);this._setZoom(this._zoomFromMercatorZ(_))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}computeZoomRelativeTo(t){const n=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let c;c=t.z<this._camera.position[2]?[n.x,n.y,n.z]:[t.x,t.y,t.z];const d=o.ae(o.at([],this._camera.position,c));return o.aD(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let n=!1;if(t.orientation&&!o.ch(t.orientation,this._camera.orientation)&&(n=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];o.ci(c,this._camera.position)||(this._setCameraPosition(c),n=!0)}n&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,n=new $u;return n.position=new o.ac(t[0],t[1],t[2]),n.orientation=this._camera.orientation,n._elevation=this.elevation,n._renderWorldCopies=this.renderWorldCopies,n}_setCameraOrientation(t){if(!o.cj(t))return!1;o.ck(t,t);const n=o.cl([],[0,0,-1],t),c=o.cl([],[0,-1,0],t);if(c[2]<0)return!1;const d=im(n,c);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(t){const n=this.zoomScale(this.minZoom)*this.tileSize,c=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;t[2]=o.aD(t[2],d/c,d/n),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,c){this._unmodified=!1,this._edgeInsets.interpolate(t,n,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new o.cm(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new o.P(0,0)),d=this.pointCoordinate(new o.P(this.width,0)),f=this.pointCoordinate(new o.P(this.width,this.height)),_=this.pointCoordinate(new o.P(0,this.height)),y=Math.floor(Math.min(c.x,d.x,f.x,_.x)),b=Math.floor(Math.max(c.x,d.x,f.x,_.x)),E=1;for(let I=y-E;I<=b+E;I++)I!==0&&n.push(new o.cm(I,t))}return n}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,n,c){let d=[];const f=c!=null,_=!f;if(_&&this.zoom<n||f&&c[0]===0&&c[1]===0)return d;const y=new Set,b=(I,P,M,z,N)=>{const B=o.cK(P,I,M,z,N);y.has(B)||(d.push(new o.aM(I,P,M,z,N)),y.add(B))};for(let I=0;I<t.length;I++){const P=t[I];if(_&&P.canonical.z!==n)continue;const M=P.canonical,z=P.overscaledZ,N=P.wrap,B=1<<M.z,G=M.x+1<B,V=M.x>0,X=M.y+1<B,Q=M.y>0,ie=P.wrap-(V?0:1),ue=P.wrap+(G?0:1),ae=V?M.x-1:B-1,le=G?M.x+1:0;if(f)c[0]<0?(b(z,ue,M.z,le,M.y),c[1]<0&&X&&(b(z,N,M.z,M.x,M.y+1),b(z,ue,M.z,le,M.y+1)),c[1]>0&&Q&&(b(z,N,M.z,M.x,M.y-1),b(z,ue,M.z,le,M.y-1))):c[0]>0?(b(z,ie,M.z,ae,M.y),c[1]<0&&X&&(b(z,N,M.z,M.x,M.y+1),b(z,ie,M.z,ae,M.y+1)),c[1]>0&&Q&&(b(z,N,M.z,M.x,M.y-1),b(z,ie,M.z,ae,M.y-1))):c[1]<0&&X?b(z,N,M.z,M.x,M.y+1):Q&&b(z,N,M.z,M.x,M.y-1);else{const ne=P.visibleQuadrants;1&ne&&(b(z,ie,M.z,ae,M.y),Q&&(b(z,N,M.z,M.x,M.y-1),b(z,ie,M.z,ae,M.y-1))),2&ne&&(b(z,ue,M.z,le,M.y),Q&&(b(z,N,M.z,M.x,M.y-1),b(z,ue,M.z,le,M.y-1))),4&ne&&(b(z,ie,M.z,ae,M.y),X&&(b(z,N,M.z,M.x,M.y+1),b(z,ie,M.z,ae,M.y+1))),8&ne&&(b(z,ue,M.z,le,M.y),X&&(b(z,N,M.z,M.x,M.y+1),b(z,ue,M.z,le,M.y+1)))}}const E=[];for(const I of d)d.some(P=>I.isChildOf(P))||E.push(I);if(d=E.filter(I=>!t.some(P=>!!(I.overscaledZ<n&&P.isChildOf(I))||I.equals(P)||I.isChildOf(P))),_){const I=1<<n,P=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),M=[I*P.x,I*P.y],z=4,N=z*z;d=d.filter(B=>{const G=B.canonical.x+.5-M[0],V=B.canonical.y+.5-M[1];return G*G+V*V<N})}return d}coveringTiles(t){let n=this.coveringZoomLevel(t);const c=n,d=this.elevation&&this.elevation.exaggeration(),f=d&&!t.isTerrainDEM,_=this.projection.name==="mercator";if(t.minzoom!==void 0&&n<t.minzoom)return[];t.maxzoom!==void 0&&n>t.maxzoom&&(n=t.maxzoom);const y=this.locationCoordinate(this.center),b=this.center.lat,E=1<<n,I=[E*y.x,E*y.y,0],P=this.projection.name==="globe",M=!P,z=o.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,M),N=P?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),B=E*o.c6(1,this.center.lat),G=this._camera.position[2]/o.c6(1,this.center.lat),V=[E*N.x,E*N.y,G*(M?1:B)],X=P||d,Q=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),ie=this.isLODDisabled(!0)?n:0;let ue;if(this._elevation&&t.isTerrainDEM)ue=1e4*this._elevation.exaggeration();else if(this._elevation){const Ie=this._elevation.getMinMaxForVisibleTiles();ue=Ie?Ie.max:this._centerAltitude}else ue=this._centerAltitude;const ae=t.isTerrainDEM?-ue:this._elevation?this._elevation.getMinElevationBelowMSL():0,le=this.projection.isReprojectedInTileSpace?o.co(this):1,ne=Ie=>{const Ne=new o.ac(Ie.x+25e-6,Ie.y,Ie.z),tt=new o.ac(Ie.x,Ie.y+25e-6,Ie.z),We=Ie.toLngLat(),it=Ne.toLngLat(),rt=tt.toLngLat(),At=this.locationCoordinate(We),Lt=this.locationCoordinate(it),St=this.locationCoordinate(rt),Ot=Math.hypot(Lt.x-At.x,Lt.y-At.y),Ct=Math.hypot(St.x-At.x,St.y-At.y);return Math.sqrt(Ot*Ct)*le/25e-6},de=Ie=>{const Ke=ue,Ne=ae;return{aabb:o.cr(this,E,0,0,0,Ie,Ne,Ke,this.projection),zoom:0,x:0,y:0,minZ:Ne,maxZ:Ke,wrap:Ie,fullyVisible:!1}},me=[];let Le=[];const Me=n,Ze=t.reparseOverscaled?c:n,He=(G-this._centerAltitude)*B,ht=Ie=>{if(!this._elevation||!Ie.tileID||!_)return;const Ke=this._elevation.getMinMaxForTile(Ie.tileID),Ne=Ie.aabb;Ke?(Ne.min[2]=Ke.min,Ne.max[2]=Ke.max,Ne.center[2]=(Ne.min[2]+Ne.max[2])/2):(Ie.shouldSplit=ke(Ie),Ie.shouldSplit||(Ne.min[2]=Ne.max[2]=Ne.center[2]=this._centerAltitude))},De=(Ie,Ke)=>{if(.707*Ke<Ie)return 1;const Ne=Ke/Ie;return Ne/(1.4144271570014144+(Math.pow(1.1,Ne-1.4144271570014144+1)-1)/(1.1-1)-1)},ke=Ie=>{if(Ie.zoom<ie)return!0;if(Ie.zoom===Me)return!1;if(Ie.shouldSplit!=null)return Ie.shouldSplit;const Ke=Ie.aabb.distanceX(V),Ne=Ie.aabb.distanceY(V);let tt=He,We=1;if(P){tt=Ie.aabb.distanceZ(V);const Ct=Math.pow(2,Ie.zoom),Vt=o.aY((Ie.y+1)/Ct),Yt=o.aY(Ie.y/Ct),gi=Math.min(Math.max(b,Vt),Yt),Xi=o.cP(gi)/o.cP(b);if(We=gi===b?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,Xi/this._mercatorScaleRatio),this.zoom<=o.cL&&Ie.zoom===Me-1&&Xi>=.9)return!0}else if(f&&(tt=Ie.aabb.distanceZ(V)*B),this.projection.isReprojectedInTileSpace&&c<=5){const Ct=Math.pow(2,Ie.zoom),Vt=ne(new o.ac((Ie.x+.5)/Ct,(Ie.y+.5)/Ct));We=Vt>.85?1:Vt}if(!_){const Ct=Math.sqrt(Ke*Ke+Ne*Ne+tt*tt);let Vt=(1<<Me-Ie.zoom)*Q*We;return Vt*=De(Math.max(tt,He),Ct),Ct<Vt}let it=Number.MAX_VALUE,rt=0;const At=Ie.aabb.getCorners(),Lt=[];for(const Ct of At){o.at(Lt,Ct,V),P||(f?Lt[2]*=B:Lt[2]=He);const Vt=o.bE(Lt,this._camera.forward());Vt<it&&(it=Vt,rt=Math.abs(Lt[2]))}let St=(1<<Me-Ie.zoom)*Q*We;if(St*=De(Math.max(rt,He),it),it<St)return!0;const Ot=Ie.aabb.closestPoint(I);return Ot[0]===I[0]&&Ot[1]===I[1]};if(this.renderWorldCopies)for(let Ie=1;Ie<=3;Ie++)me.push(de(-Ie)),me.push(de(Ie));for(me.push(de(0));me.length>0;){const Ie=me.pop(),Ke=Ie.x,Ne=Ie.y;let tt=Ie.fullyVisible;const We=()=>this.projection.name==="globe"&&(Ie.y===0||Ie.y===(1<<Ie.zoom)-1);if(!tt){let it=X?Ie.aabb.intersects(z):Ie.aabb.intersectsFlat(z);if(it===0&&We()){const rt=new o.cp(Ie.zoom,Ke,Ne);it=o.cq(this,E,rt,!0).intersects(z)}if(it===0)continue;tt=it===2}if(Ie.zoom!==Me&&ke(Ie))for(let it=0;it<4;it++){const rt=(Ke<<1)+it%2,At=(Ne<<1)+(it>>1),Lt={aabb:_?Ie.aabb.quadrant(it):o.cr(this,E,Ie.zoom+1,rt,At,Ie.wrap,Ie.minZ,Ie.maxZ,this.projection),zoom:Ie.zoom+1,x:rt,y:At,wrap:Ie.wrap,fullyVisible:tt,tileID:void 0,shouldSplit:void 0,minZ:Ie.minZ,maxZ:Ie.maxZ};f&&!P&&(Lt.tileID=new o.aM(Ie.zoom+1===Me?Ze:Ie.zoom+1,Ie.wrap,Ie.zoom+1,rt,At),ht(Lt)),me.push(Lt)}else{const it=Ie.zoom===Me?Ze:Ie.zoom;if(t.minzoom&&t.minzoom>it)continue;let rt=0;if(!tt){let Ot=X?Ie.aabb.intersectsPrecise(z):Ie.aabb.intersectsPreciseFlat(z);if(Ot===0&&We()){const Ct=new o.cp(Ie.zoom,Ke,Ne);Ot=o.cq(this,E,Ct,!0).intersectsPrecise(z)}if(Ot===0)continue;if(t.calculateQuadrantVisibility)if(z.containsPoint(Ie.aabb.center))rt=15;else for(let Ct=0;Ct<4;Ct++)Ie.aabb.quadrant(Ct).intersects(z)!==0&&(rt|=1<<Ct)}const At=I[0]-(.5+Ke+(Ie.wrap<<Ie.zoom))*(1<<n-Ie.zoom),Lt=I[1]-.5-Ne,St=Ie.tileID?Ie.tileID:new o.aM(it,Ie.wrap,Ie.zoom,Ke,Ne);t.calculateQuadrantVisibility&&(St.visibleQuadrants=rt),Le.push({tileID:St,distanceSq:At*At+Lt*Lt})}}if(this.fogCullDistSq){const Ie=this.fogCullDistSq,Ke=this.horizonLineFromTop();Le=Le.filter(Ne=>{const tt=[0,0,0,1],We=[o.aj,o.aj,0,1],it=this.calculateFogTileMatrix(Ne.tileID.toUnwrapped());o.aA(tt,tt,it),o.aA(We,We,it);const rt=o.cs([],tt,We),At=o.ct([],tt,We),Lt=o.cM(rt,At);if(Lt===0)return!0;let St=!1;const Ot=this._elevation;if(Ot&&Lt>Ie&&Ke!==0){const Ct=this.calculateProjMatrix(Ne.tileID.toUnwrapped());let Vt;t.isTerrainDEM||(Vt=Ot.getMinMaxForTile(Ne.tileID)),Vt||(Vt={min:ae,max:ue});const Yt=o.cu(this.rotation),gi=[Yt[0]*o.aj,Yt[1]*o.aj,Vt.max];o.ad(gi,gi,Ct),St=(1-gi[1])*this.height*.5<Ke}return Lt<Ie||St})}return Le.sort((Ie,Ke)=>Ie.distanceSq-Ke.distanceSq).map(Ie=>Ie.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=o.aD(t.lat,-o.cv,o.cv),c=this.projection.project(t.lng,n);return new o.P(c.x*this.worldSize,c.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/o.c6(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,n){let c,d;const f=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;c=(n.x-f.x)/y,d=(n.y-f.y)/y}else{const y=this.pointCoordinate(n),b=this.pointCoordinate(f);c=y.x-b.x,d=y.y-b.y}const _=this.locationCoordinate(t);this.setLocation(new o.ac(_.x-c,_.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,n){return this.projection.locationPoint(this,t,n)}locationPoint3D(t,n){return this.projection.locationPoint(this,t,n,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,n){return this.coordinateLocation(this.pointCoordinate3D(t,n))}locationCoordinate(t,n){const c=n?o.c6(n,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new o.ac(d.x,d.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,n){const c=n??this._centerAltitude,d=[t.x,t.y,0,1],f=[t.x,t.y,1,1];o.aA(d,d,this.pixelMatrixInverse),o.aA(f,f,this.pixelMatrixInverse);const _=f[3];o.cw(d,d,1/d[3]),o.cw(f,f,1/_);const y=d[2],b=f[2];return{p0:d,p1:f,t:y===b?0:(c-y)/(b-y)}}screenPointToMercatorRay(t){const n=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return o.aA(n,n,this.pixelMatrixInverse),o.aA(c,c,this.pixelMatrixInverse),o.cw(n,n,1/n[3]),o.cw(c,c,1/c[3]),n[2]=o.c6(n[2],this._center.lat)*this.worldSize,c[2]=o.c6(c[2],this._center.lat)*this.worldSize,o.cw(n,n,1/this.worldSize),o.cw(c,c,1/this.worldSize),new o.av([n[0],n[1],n[2]],o.au([],o.at([],c,n)))}rayIntersectionCoordinate(t){const{p0:n,p1:c,t:d}=t,f=o.c6(n[2],this._center.lat),_=o.c6(c[2],this._center.lat);return new o.ac(o.ai(n[0],c[0],d)/this.worldSize,o.ai(n[1],c[1],d)/this.worldSize,o.ai(f,_,d))}pointCoordinate(t,n=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,n)}pointCoordinate3D(t,n){if(!this.elevation)return this.pointCoordinate(t,n);let c=this.projection.pointCoordinate3D(this,t.x,t.y);if(c)return new o.ac(c[0],c[1],c[2]);let d=0,f=this.horizonLineFromTop();if(t.y>f)return this.pointCoordinate(t,n);const _=.02*f,y=t.clone();for(let b=0;b<10&&f-d>_;b++){y.y=o.ai(d,f,.66);const E=this.projection.pointCoordinate3D(this,y.x,y.y);E?(f=y.y,c=E):d=y.y}return c?new o.ac(c[0],c[1],c[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=o.cx)return!this.isPointAboveHorizon(t);const n=this.pointCoordinate(t);return n.y>=0&&n.y<=1}_coordinatePoint(t,n){const c=n&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,d=[t.x*this.worldSize,t.y*this.worldSize,c+t.toAltitude(),1];return o.aA(d,d,this.pixelMatrix),d[3]>0?new o.P(d[0]/d[3],d[1]/d[3]):new o.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:n}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,f=this.pointLocation3D(new o.P(n,t)),_=this.pointLocation3D(new o.P(d,t)),y=this.pointLocation3D(new o.P(d,c)),b=this.pointLocation3D(new o.P(n,c));let E=Math.min(f.lng,_.lng,y.lng,b.lng),I=Math.max(f.lng,_.lng,y.lng,b.lng),P=Math.min(f.lat,_.lat,y.lat,b.lat),M=Math.max(f.lat,_.lat,y.lat,b.lat);const z=Math.pow(2,-this.zoom)/16*270,N=this.projection.name==="globe"?1:4,B=(G,V,X,Q,ie)=>{const ue=(G+X)/2,ae=(V+Q)/2,le=new o.P(ue,ae),{lng:ne,lat:de}=this.pointLocation3D(le),me=Math.max(0,E-ne,P-de,ne-I,de-M);E=Math.min(E,ne),I=Math.max(I,ne),P=Math.min(P,de),M=Math.max(M,de),(ie<N||me>z)&&(B(G,V,ue,ae,ie+1),B(ue,ae,X,Q,ie+1))};if(B(n,t,d,t,1),B(d,t,d,c,1),B(d,c,n,c,1),B(n,c,n,t,1),this.projection.name==="globe"){const[G,V]=o.cy(this);G?(M=90,I=180,E=-180):V&&(P=-90,I=180,E=-180)}return new o.aG(new o.cd(E,P),new o.cd(I,M))}_getBoundsRectangular(t,n){const{top:c,left:d}=this._edgeInsets,f=this.height-this._edgeInsets.bottom,_=this.width-this._edgeInsets.right,y=new o.P(d,c),b=new o.P(_,c),E=new o.P(_,f),I=new o.P(d,f);let P=this.pointCoordinate(y,t),M=this.pointCoordinate(b,t);const z=this.pointCoordinate(E,n),N=this.pointCoordinate(I,n),B=(G,V)=>(V.y-G.y)/(V.x-G.x);return P.y>1&&M.y>=0?P=new o.ac((1-N.y)/B(N,P)+N.x,1):P.y<0&&M.y<=1&&(P=new o.ac(-N.y/B(N,P)+N.x,0)),M.y>1&&P.y>=0?M=new o.ac((1-z.y)/B(z,M)+z.x,1):M.y<0&&P.y<=1&&(M=new o.ac(-z.y/B(z,M)+z.x,0)),new o.aG().extend(this.coordinateLocation(P)).extend(this.coordinateLocation(M)).extend(this.coordinateLocation(N)).extend(this.coordinateLocation(z))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const n=t.visibleDemTiles.reduce((c,d)=>{if(d.dem){const f=d.dem.tree;c.min=Math.min(c.min,f.minimums[0]),c.max=Math.max(c.max,f.maximums[0])}return c},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(n.min*t.exaggeration(),n.max*t.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(t=!0){const n=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,c=this.height/2-n*(1-this._horizonShift);return t?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-o.cv,this.maxLat=o.cv,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=o.ay(this.minLng)*this.tileSize,this.worldMaxX=o.ay(this.maxLng)*this.tileSize,this.worldMinY=o.aH(this.maxLat)*this.tileSize,this.worldMaxY=o.aH(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,n){return this.projection.createTileMatrix(this,n,t)}calculateDistanceTileData(t){const n=t.key,c=this._distanceTileDataCache;if(c[n])return c[n];const d=t.canonical,f=1/this.height,_=this.cameraWorldSize,y=_/this.zoomScale(d.z),b=(d.x+Math.pow(2,d.z)*t.wrap)*y,E=d.y*y,I=this.point;I.x*=_/this.worldSize,I.y*=_/this.worldSize;const P=this.angle,M=Math.sin(-P),z=-Math.cos(-P);return c[n]={bearing:[M,z],center:[(I.x-b)*f,(I.y-E)*f],scale:y/o.aj*f},c[n]}calculateFogTileMatrix(t){const n=t.key,c=this._fogTileMatrixCache;if(c[n])return c[n];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return o.az(d,this.worldToFogMatrix,d),c[n]=new Float32Array(d),c[n]}calculateProjMatrix(t,n=!1,c=!1){const d=t.key;let f;if(f=c?this._expandedProjMatrixCache:n?this._alignedProjMatrixCache:this._projMatrixCache,f[d])return f[d];const _=this.calculatePosMatrix(t,this.worldSize);let y;return y=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:n?this.alignedProjMatrix:this.projMatrix,o.az(_,y,_),f[d]=new Float32Array(_),f[d]}calculatePixelsToTileUnitsMatrix(t){const n=t.tileID.key,c=this._pixelsToTileUnitsCache;if(c[n])return c[n];const d=o.cz(t,this);return c[n]=d,c[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,n=o.bn([],[t,t,t]);return o.az(n,n,this.globeMatrix),n}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const n=o.c6(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(n),d=this._camera.forward(),f=o.c6(1,this._center.lat);c[2]/=f,d[2]/=f,o.au(d,d);const _=t.raycast(c,d,t.exaggeration());if(_){const y=o.bF([],c,d,_),b=new o.ac(y[0],y[1],o.c6(y[2],o.aY(y[1]))),E=(b.z+o.ae([b.x-c[0],b.y-c[1],b.z-c[2]*f]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(E),this._centerAltitude=b.toAltitude(),this._center=this.coordinateLocation(b),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const n=this._elevation,c=o.c6(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(c),f=n.getAtPointOrZero(new o.ac(...d)),_=this.pixelsPerMeter/this.worldSize*f,y=this._minimumHeightOverTerrain(),b=d[2]-_;if(b<=y)if(b<0||t){const E=this.locationCoordinate(this._center,this._centerAltitude),I=[d[0],d[1],E.z-d[2]],P=o.ae(I);I[2]-=(y-b)/this._pixelsPerMercatorPixel;const M=o.ae(I);if(M===0)return;o.b$(I,I,P/M*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],E.z*this._pixelsPerMercatorPixel-I[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const M=this.center;return M.lat=o.aD(M.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(M.lng=o.aD(M.lng,this.minLng,this.maxLng)),this.center=M,void(this._constraining=!1)}const n=this._unmodified,{x:c,y:d}=this.point;let f=0,_=c,y=d;const b=this.width/2,E=this.height/2,I=this.worldMinY*this.scale,P=this.worldMaxY*this.scale;if(d-E<I&&(y=I+E),d+E>P&&(y=P-E),P-I<this.height&&(f=Math.max(f,this.height/(P-I)),y=(P+I)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const M=this.worldMinX*this.scale,z=this.worldMaxX*this.scale,N=this.worldSize/2-(M+z)/2;_=(c+N+this.worldSize)%this.worldSize-N,_-b<M&&(_=M+b),_+b>z&&(_=z-b),z-M<this.width&&(f=Math.max(f,this.width/(z-M)),_=(z+M)/2)}_===c&&y===d||this._allowWorldUnderZoom||(this.center=this.unproject(new o.P(_,y))),f&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(f)),this._constrainCamera(),this._unmodified=n,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.projection.name==="globe",c=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=o.c6(1,this.center.lat)/o.c6(1,o.cN));const d=o.cA(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const f=this.projection.zAxisUnit==="meters"?c:1,_=this._camera.getWorldToCamera(this.worldSize,f);let y;const b=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(b[8]=2*-t.x/this.width,b[9]=2*t.y/this.height,this.isOrthographic){let de=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),me=de*this.aspect,Le=-me,Me=-de;me-=t.x,Le-=t.x,de+=t.y,Me+=t.y,y=this._camera.getCameraToClipOrthographic(Le,me,Me,de,this._nearZ,this._farZ),((Ze,He,ht,De)=>{for(let ke=0;ke<16;ke++)Ze[ke]=o.ai(He[ke],ht[ke],De)})(y,y,b,o.cO(this.pitch>=Gs?1:this.pitch/Gs))}else y=b;const E=o.cB([],b,_);let I=o.cB([],y,_);if(this.projection.isReprojectedInTileSpace){const de=this.locationCoordinate(this.center),me=o.bx([]);o.bo(me,me,[de.x*this.worldSize,de.y*this.worldSize,0]),o.az(me,me,o.cC(this)),o.bo(me,me,[-de.x*this.worldSize,-de.y*this.worldSize,0]),o.az(I,I,me),o.az(E,E,me),this.inverseAdjustmentMatrix=o.cD(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=o.cE([],I,[this.worldSize,this.worldSize,this.worldSize/f,1]),this.projMatrix=I,this.invProjMatrix=o.bi(new Float64Array(16),this.projMatrix),n){const de=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);de[8]=2*-t.x/this.width,de[9]=2*t.y/this.height,this.expandedFarZProjMatrix=o.cB([],de,_)}else this.expandedFarZProjMatrix=this.projMatrix;const P=o.bi([],y);this.frustumCorners=o.cF.fromInvProjectionMatrix(P,this.horizonLineFromTop(),this.height),this.cameraFrustum=o.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!n);const M=new Float32Array(16);o.bx(M),o.cE(M,M,[1,-1,1]),o.cG(M,M,this._pitch),o.by(M,M,this.angle);const z=o.c4(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=o.bw(z);const N=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;z[8]=2*-t.x/this.width,z[9]=2*(t.y+N)/this.height,this.skyboxMatrix=o.az(M,z,M);const B=this.point,G=B.x,V=B.y,X=this.width%2/2,Q=this.height%2/2,ie=Math.cos(this.angle),ue=Math.sin(this.angle),ae=G-Math.round(G)+ie*X+ue*Q,le=V-Math.round(V)+ie*Q+ue*X,ne=new Float64Array(I);if(o.bo(ne,ne,[ae>.5?ae-1:ae,le>.5?le-1:le,0]),this.alignedProjMatrix=ne,I=o.bz(),o.cE(I,I,[this.width/2,-this.height/2,1]),o.bo(I,I,[1,-1,0]),this.labelPlaneMatrix=I,I=o.bz(),o.cE(I,I,[1,-1,1]),o.bo(I,I,[-1,-1,0]),o.cE(I,I,[2/this.width,2/this.height,1]),this.glCoordMatrix=I,this.pixelMatrix=o.az(new Float64Array(16),this.labelPlaneMatrix,E),this._calcFogMatrices(),this._distanceTileDataCache={},I=o.bi(new Float64Array(16),this.pixelMatrix),!I)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=I,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=o.cH(this);const de=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=o.ad(de,de,_),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=I;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,n=this.cameraPixelsPerMeter,c=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,f=[t,t,n];o.b$(f,f,d),o.b$(c,c,-1),o.cI(c,c,f);const _=o.bz();o.bo(_,_,c),o.cE(_,_,f),this.mercatorFogMatrix=_,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,n,d)}_computeCameraPosition(t){const n=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,f=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*n-t/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*f,d.y/this.worldSize-c[1]*f,t/this.worldSize*this._centerAltitude-c[2]*f]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=this._camera.position[2],d=t[2];let f=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(f=Math.min((n-c)/d,1)),this._camera.position=o.bF([],this._camera.position,t,f),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,n=this._camera.forward(),{pitch:c,bearing:d}=this._camera.getPitchBearing(),f=o.c6(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,_=this._mercatorZfromZoom(this._maxZoom)*Math.cos(o.al(this._maxPitch)),y=Math.max((t[2]-f)/Math.cos(c),_),b=this._zoomFromMercatorZ(y);o.bF(t,t,n,y),this._pitch=o.aD(c,o.al(this.minPitch),o.al(this.maxPitch)),this.angle=o.bX(d,-Math.PI,Math.PI),this._setZoom(o.aD(b,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new o.ac(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(t*this.tileSize))}zoomFromMercatorZAdjusted(t){let n=0,c=o.cx,d=0,f=1/0;for(;c-n>1e-6&&c>n;){const _=n+.5*(c-n),y=this.tileSize*Math.pow(2,_),b=this.getCameraToCenterDistance(this.projection,_,y),E=this.scaleZoom(b/(t*this.tileSize)),I=Math.abs(_-E);I<f&&(f=I,d=_),_<E?n=_:c=_}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(o.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,n){const c=Math.min(t.x,n.x),d=Math.max(t.x,n.x),f=Math.min(t.y,n.y),_=Math.max(t.y,n.y);if(f<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const y=[new o.P(c,f),new o.P(d,_),new o.P(c,_),new o.P(d,f)],b=this.renderWorldCopies?-3:0,E=this.renderWorldCopies?4:1;for(const I of y){const P=this.pointRayIntersection(I);if(P.t<0)return!0;const M=this.rayIntersectionCoordinate(P);if(M.x<b||M.y<0||M.x>E||M.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+o.cJ(this.fovAboveCenter)>88||this.anyCornerOffEdge(new o.P(0,0),new o.P(this.width,this.height))}zoomDeltaToMovement(t,n){const c=o.ae(o.at([],this._camera.position,t)),d=this._zoomFromMercatorZ(c)+n;return c-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const t=function([n,c,d],f){const _=[n,c,d,1];o.aA(_,_,f);const y=_[3]=Math.max(_[3],1e-6);return _[0]/=y,_[1]/=y,_[2]/=y,_}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new o.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.P(0,t))}}getCameraToCenterDistance(t,n=this.zoom,c=this.worldSize){const d=o.cA(t,n,this.width,this.height,1024),f=t.pixelSpaceConversion(this.center.lat,c,d);let _=.5/Math.tan(.5*this._fov)*this.height*f;return this.isOrthographic&&(_=o.ai(1,_,o.cO(this.pitch>=Gs?1:this.pitch/Gs))),_}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&o.az(t,t,this.globeMatrix),t}getFrustum(t){return o.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const Ma=(l,t)=>{if(t>0&&l.terrain&&o.w("Cutoff is currently disabled on terrain"),t<=0||l.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const n=l.transform,c=Math.max(Math.abs(n._zoom-(l.minCutoffZoom-1)),1),d=n.isLODDisabled(!1)?o.af(60,45,n.pitch):o.af(30,15,n.pitch),f=n._farZ-n._nearZ,_=t*n.height,y=((1-(b=d))*n.cameraToCenterDistance+b*(n._farZ+_))*c;var b;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(y-n._nearZ)/f,(y-_-n._nearZ)/f]}}},Un={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class wc{constructor(t,n){this.aabb=t,this.lastCascade=n}}class Tc{add(t,n){const c=this.receivers[t.key];c!==void 0?(c.aabb.min[0]=Math.min(c.aabb.min[0],n.min[0]),c.aabb.min[1]=Math.min(c.aabb.min[1],n.min[1]),c.aabb.min[2]=Math.min(c.aabb.min[2],n.min[2]),c.aabb.max[0]=Math.max(c.aabb.max[0],n.max[0]),c.aabb.max[1]=Math.max(c.aabb.max[1],n.max[1]),c.aabb.max[2]=Math.max(c.aabb.max[2],n.max[2])):this.receivers[t.key]=new wc(n,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,n,c){const d=o.cV.fromPoints(t.points);let f=0;for(const _ in this.receivers){const y=this.receivers[_];if(!y||!d.intersectsAabb(y.aabb))continue;y.aabb.min=d.closestPoint(y.aabb.min),y.aabb.max=d.closestPoint(y.aabb.max);const b=y.aabb.getCorners();for(let E=0;E<c.length;E++){let I=!0;for(const P of b){const M=[P[0]*n,P[1]*n,P[2]];if(o.ad(M,M,c[E].matrix),M[0]<-1||M[0]>1||M[1]<-1||M[1]>1){I=!1;break}}if(y.lastCascade=E,f=Math.max(f,E),I)break}}return f+1}}class Sy{constructor(t){this.painter=t,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Tc,this._depthMode=new It(t.context.gl.LEQUAL,It.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,t.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),t.tp.registerParameter(Un,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),t.tp.registerParameter(Un,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),t.tp.registerParameter(Un,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),t.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,n){const c=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!n||!n.properties)return;const d=n.properties.get("shadow-intensity");if(!n.shadowsEnabled()||d<=0||(this._shadowLayerCount=c.style.order.reduce((N,B)=>{const G=c.style._mergedLayers[B];return N+(G.hasShadowPass()&&!G.isHidden(t.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const f=c.context,_=Un.shadowMapResolution,y=Un.shadowMapResolution;if(this._cascades.length===0||Un.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let N=0;N<Un.cascadeCount;++N){const B=c._shadowMapDebug,G=f.gl,V=f.createFramebuffer(_,y,B,"texture"),X=new o.T(f,{width:_,height:y,data:null},G.DEPTH_COMPONENT16);if(V.depthAttachment.set(X.texture),B){const Q=new o.T(f,{width:_,height:y,data:null},G.RGBA8);V.colorAttachment.set(Q.texture)}this._cascades.push({framebuffer:V,texture:X,matrix:[],far:0,boundingSphereRadius:0,frustum:new o.cn,scale:0})}}this.shadowDirection=Id(n);let b=0;if(t.elevation){const N=t.elevation,B=[1e4,-1e4];N.visibleDemTiles.filter(G=>G.dem).forEach(G=>{const V=G.dem.tree;B[0]=Math.min(B[0],V.minimums[0]),B[1]=Math.max(B[1],V.maximums[0])}),B[0]!==1e4&&(b=(B[1]-B[0])*N.exaggeration())}const E=1.5*t.cameraToCenterDistance,I=3*E,P=new Float64Array(16);for(let N=0;N<this._cascades.length;++N){const B=this._cascades[N];let G=t.height/50,V=1;Un.cascadeCount===1?V=I:N===0?V=E:(G=E,V=I);const[X,Q]=Cd(t,this.shadowDirection,G,V,Un.shadowMapResolution,b);B.scale=t.scale,B.matrix=X,B.boundingSphereRadius=Q,o.bi(P,B.matrix),B.frustum=o.cn.fromInvProjectionMatrix(P,1,0,!0),B.far=V}const M=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[M].far,this._cascades[M].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/Un.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=Un.shadowMapResolution,this._uniformValues.u_shadowmap_0=Vn.ShadowMap0,this._uniformValues.u_shadowmap_1=Vn.ShadowMap0+1,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const z=c.transform.elevation;for(const N of this._groundShadowTiles){let B={min:0,max:0};if(z){const G=z.getMinMaxForTile(N);G&&(B=G)}this.addShadowReceiver(N.toUnwrapped(),B.min,B.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(t){this._enabled=t}drawShadowPass(t,n){if(!this.enabled)return;const c=this.painter,d=c.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(c.transform.getFrustum(0),c.transform.worldSize,this._cascades),d.viewport.set([0,0,Un.shadowMapResolution,Un.shadowMapResolution]);for(let f=0;f<this._numCascadesToRender;++f){c.currentShadowCascade=f,d.bindFramebuffer.set(this._cascades[f].framebuffer.framebuffer),d.clear({color:o.am.white,depth:1});for(const _ of t.order){const y=t._mergedLayers[_];if(!y.hasShadowPass()||y.isHidden(c.transform.zoom))continue;const b=t.getLayerSourceCache(y),E=b?n[b.id]:void 0;(y.type==="model"||E&&E.length)&&c.renderLayer(c,b,y,E)}}c.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,n=t.style,c=t.context,d=n.directionalLight,f=n.ambientLight;if(!d||!f)return;const _=[],y=Ma(t,t.longestCutoffRange);y.shouldRenderCutoff&&_.push("RENDER_CUTOFF"),_.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&_.push("NORMAL_OFFSET");const b=Xo(n,d,f),E=new It(c.gl.LEQUAL,It.ReadOnly,t.depthRangeFor3D);for(const I of this._groundShadowTiles){const P=I.toUnwrapped(),M=t.isTileAffectedByFog(I),z=t.getOrCreateProgram("groundShadow",{defines:_,overrideFog:M});this.setupShadows(P,z),t.uploadCommonUniforms(c,z,P,null,y);const N={u_matrix:t.transform.calculateProjMatrix(P),u_ground_shadow_factor:b};z.draw(t,c.gl.TRIANGLES,E,qt.disabled,di.multiply,Zt.disabled,N,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?di.unblended:di.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const n=this.painter.transform,c=n.calculatePosMatrix(t,n.worldSize);return o.az(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}calculateShadowPassMatrixFromMatrix(t){return o.az(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}setupShadows(t,n,c,d=0){if(!this.enabled)return;const f=this.painter.transform,_=this.painter.context,y=_.gl,b=this._uniformValues,E=new Float64Array(16),I=f.calculatePosMatrix(t,f.worldSize);for(let P=0;P<this._cascades.length;P++)o.az(E,this._cascades[P].matrix,I),b[P===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(E),_.activeTexture.set(y.TEXTURE0+Vn.ShadowMap0+P),this._cascades[P].texture.bind(y.NEAREST,y.CLAMP_TO_EDGE);if(this.useNormalOffset=!!c,this.useNormalOffset){const P=o.cT(t.canonical),M=2/f.tileSize*o.aj/Un.shadowMapResolution,z=M*this._cascades[0].boundingSphereRadius,N=M*this._cascades[this._cascades.length-1].boundingSphereRadius,B=(c==="vector-tile"?1:3)/Math.pow(2,d-t.canonical.z-(1-f.zoom+Math.floor(f.zoom)));b.u_shadow_normal_offset=[P,z*B,N*B],b.u_shadow_bias=[6e-5,.0012,.012]}else b.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(_,b)}setupShadowsFromMatrix(t,n,c=!1){if(!this.enabled)return;const d=this.painter.context,f=d.gl,_=this._uniformValues,y=new Float64Array(16);for(let b=0;b<Un.cascadeCount;b++)o.az(y,this._cascades[b].matrix,t),_[b===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(y),d.activeTexture.set(f.TEXTURE0+Vn.ShadowMap0+b),this._cascades[b].texture.bind(f.NEAREST,f.CLAMP_TO_EDGE);if(this.useNormalOffset=c,c){const b=Un.normalOffset;_.u_shadow_normal_offset=[1,b,b],_.u_shadow_bias=[6e-5,.0012,.012]}else _.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(d,_)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,n,c,d){if(d[2]>=0)return{};const f=function(b,E,I){const P=I/(1<<b.canonical.z);return new o.cV([b.canonical.x*P+b.wrap*I,b.canonical.y*P+b.wrap*I,0],[(b.canonical.x+1)*P+b.wrap*I,(b.canonical.y+1)*P+b.wrap*I,E])}(t,n,c).getCorners(),_=n/-d[2];d[0]<0?(o.cU(f[0],f[0],[d[0]*_,0,0]),o.cU(f[3],f[3],[d[0]*_,0,0])):d[0]>0&&(o.cU(f[1],f[1],[d[0]*_,0,0]),o.cU(f[2],f[2],[d[0]*_,0,0])),d[1]<0?(o.cU(f[0],f[0],[0,d[1]*_,0]),o.cU(f[1],f[1],[0,d[1]*_,0])):d[1]>0&&(o.cU(f[2],f[2],[0,d[1]*_,0]),o.cU(f[3],f[3],[0,d[1]*_,0]));const y={};return y.vertices=f,y.planes=[gs(f[1],f[0],f[4]),gs(f[2],f[1],f[5]),gs(f[3],f[2],f[6]),gs(f[0],f[3],f[7])],y}addShadowReceiver(t,n,c){this._receivers.add(t,o.cV.fromTileIdAndHeight(t,n,c))}getMaxCascadeForTile(t){const n=this._receivers.get(t);return n&&n.lastCascade?n.lastCascade:0}}function gs(l,t,n){const c=o.at([],n,t),d=o.at([],l,t),f=o.bG([],c,d),_=o.ae(f);return _===0?[0,0,1,0]:(o.b$(f,f,1/_),[f[0],f[1],f[2],-o.bE(f,t)])}function Id(l){const t=l.properties.get("direction"),n=o.cR(t.x,t.y,t.z);n[2]=o.aD(n[2],0,75);const c=o.cW([n[0],n[1],n[2]]);return o.cS(c.x,c.y,c.z)}function Xo(l,t,n){const c=t.properties.get("color-use-theme")==="none",d=t.properties.get("color"),f=t.properties.get("intensity"),_=t.properties.get("direction"),y=[_.x,_.y,_.z],b=n.properties.get("color-use-theme")==="none",E=n.properties.get("color"),I=n.properties.get("intensity"),P=Math.max(o.bE([0,0,1],y),0),M=[0,0,0];o.b$(M,E.toRenderColor(b?null:l.getLut(t.scope)).toArray01Linear().slice(0,3),I);const z=[0,0,0];return o.b$(z,d.toRenderColor(c?null:l.getLut(n.scope)).toArray01Linear().slice(0,3),P*f),o.cX([M[0]>0?M[0]/(M[0]+z[0]):0,M[1]>0?M[1]/(M[1]+z[1]):0,M[2]>0?M[2]/(M[2]+z[2]):0])}function Cd(l,t,n,c,d,f){const _=l.zoom,y=l.scale,b=l.worldSize,E=1/b,I=l.aspect,P=Math.sqrt(1+I*I)*Math.tan(.5*l.fovX),M=P*P,z=c-n,N=c+n;let B,G;M>z/N?(B=c,G=c*P):(B=.5*N*(1+M),G=.5*Math.sqrt(z*z+2*(c*c+n*n)*M+N*N*M*M));const V=l.projection.pixelsPerMeter(l.center.lat,b),X=l._camera.getCameraToWorldMercator(),Q=[0,0,-B*E];o.ad(Q,Q,X);let ie=G*E;const ue=l._edgeInsets;if(!(ue.left===0&&ue.top===0&&ue.right===0&&ue.bottom===0||ue.left===ue.right&&ue.top===ue.bottom)){const tt=l._camera.getWorldToCamera(l.worldSize,l.projection.zAxisUnit==="meters"?V:1),We=l._camera.getCameraToClipPerspective(l._fov,l.width/l.height,n,c);We[8]=2*-l.centerOffset.x/l.width,We[9]=2*l.centerOffset.y/l.height;const it=new Float64Array(16);o.cB(it,We,tt);const rt=new Float64Array(16);o.bi(rt,it);const At=o.cn.fromInvProjectionMatrix(rt,b,_,!0);for(const Lt of At.points){const St=((ae=Lt)[0]/=y,ae[1]/=y,ae[2]=o.c6(ae[2],l._center.lat),ae);ie=Math.max(ie,o.c0(o.cY([],Q,St)))}}var ae;ie*=d/(d-1);const le=Math.acos(t[2]),ne=Math.atan2(-t[0],-t[1]),de=new zn;de.position=Q,de.setPitchBearing(le,ne);const me=de.getWorldToCamera(b,V),Le=ie*b,Me=Math.min(l._mercatorZfromZoom(17)*b*-2,-2*Le),Ze=de.getCameraToClipOrthographic(-Le,Le,-Le,Le,Me,(Le+f*V)/t[2]),He=new Float64Array(16);o.az(He,Ze,me);const ht=o.cS(Math.floor(1e6*Q[0])/1e6*b,Math.floor(1e6*Q[1])/1e6*b,0),De=.5*d,ke=[0,0,0];o.ad(ke,ht,He),o.b$(ke,ke,De);const Ie=[Math.floor(ke[0]),Math.floor(ke[1]),Math.floor(ke[2])],Ke=[0,0,0];o.at(Ke,ke,Ie),o.b$(Ke,Ke,-1/De);const Ne=new Float64Array(16);return o.bx(Ne),o.bo(Ne,Ne,Ke),o.az(He,Ne,He),[He,Le]}class Hs extends o.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,n){return o.aS(this.requestManager.transformRequest(n,o.R.Model).url).then(c=>{if(!c)return;const d=o.aT(c),f=new o.aU(t,void 0,void 0,d);return f.computeBoundsAndApplyParent(),f}).catch(c=>{if(c&&c.status===404)return null;this.fire(new o.z(new Error(`Could not load model ${t} from ${n}: ${c.message}`)))})}load(t,n,c={forceReload:!1}){this.models[n]||(this.models[n]={});const d=Object.keys(t),f=[],_=[];for(const y of d){const b=t[y];this.hasURLBeenRequested(b)&&!c.forceReload||(this.modelByURL[b]={modelId:y,scope:n},f.push(this.loadModel(y,b)),_.push(y)),this.models[n][y]||(this.models[n][y]={model:null,numReferences:1})}this.numModelsLoading[n]=(this.numModelsLoading[n]||0)+_.length,Promise.allSettled(f).then(y=>{for(let b=0;b<y.length;b++){const{status:E}=y[b];if(E==="rejected")continue;const{value:I}=y[b];this.models[n][_[b]]||(this.models[n][_[b]]={model:null,numReferences:1}),this.models[n][_[b]].model=I}this.numModelsLoading[n]-=_.length,this.fire(new o.A("data",{dataType:"style"}))}).catch(y=>{this.fire(new o.z(new Error(`Could not load models: ${y.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,n,c={exactIdMatch:!1}){return!!(c.exactIdMatch?this.getModel(t,n):this.getModelByURL(this.modelUris[n][t]))}getModel(t,n){return this.models[n]||(this.models[n]={}),this.models[n][t]?this.models[n][t].model:void 0}getModelByURL(t){if(!t)return null;const n=this.modelByURL[t];return n?this.models[n.scope][n.modelId].model:null}hasModelBeenAdded(t,n){return this.models[n]&&this.models[n][t]!==void 0}getModelURIs(t){return this.modelUris[t]||{}}addModel(t,n,c){this.models[c]||(this.models[c]={}),this.modelUris[c]||(this.modelUris[c]={});const d=this.requestManager.normalizeModelURL(n);if((this.hasModel(t,c,{exactIdMatch:!0})||this.hasModelBeenAdded(t,c))&&this.modelUris[c][t]===d)this.models[c][t].numReferences++;else if(this.hasURLBeenRequested(d)){const{scope:f,modelId:_}=this.modelByURL[d];this.models[f][_].numReferences++}else this.modelUris[c][t]=d,this.load({[t]:this.modelUris[c][t]},c)}addModelURLs(t,n){this.models[n]||(this.models[n]={}),this.modelUris[n]||(this.modelUris[n]={});const c=this.modelUris[n];for(const d in t)c[d]=this.requestManager.normalizeModelURL(t[d])}reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,n){this.models[n]||(this.models[n]={}),this.modelUris[n]||(this.modelUris[n]={});const c={};for(const d of t)this.hasModel(d,n,{exactIdMatch:!0})||this.hasURLBeenRequested(d)?this.models[n][d].numReferences++:this.modelUris[n][d]&&!this.hasURLBeenRequested(d)?c[d]=this.modelUris[n][d]:!this.hasURLBeenRequested(d)&&o.cZ(d,!1)&&(this.modelUris[n][d]=this.requestManager.normalizeModelURL(d),c[d]=this.modelUris[n][d]);this.load(c,n)}hasURLBeenRequested(t){return this.modelByURL[t]!==void 0}removeModel(t,n,c=!1){if(this.models[n]&&this.models[n][t]&&(this.models[n][t].numReferences--,this.models[n][t].numReferences===0)){const d=this.modelUris[n][t];c||delete this.modelUris[n][t],delete this.modelByURL[d];const f=this.models[n][t].model;if(!f)return;delete this.models[n][t],f.destroy()}}destroy(){for(const t of Object.keys(this.models))for(const n of Object.keys(this.models[t])){const c=this.models[t][n].model;delete this.models[t][n],c&&c.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(t){return this.models[t]||(this.models[t]={}),Object.keys(this.models[t])}upload(t,n){this.models[n]||(this.models[n]={});for(const c in this.models[n])this.models[n][c].model&&this.models[n][c].model.upload(t.context)}}const Ey=new o.a7({data:new o.a8(o.a5.colorTheme.data)}),Ay={"mbx-indoor-active-floorplans":{default:["literal",[]]},"mbx-indoor-underground":{default:["literal",!1]},"mbx-indoor-loaded-levels":{default:["literal",[]]},"mbx-indoor-level-height":{default:["literal",{}]},"mbx-indoor-level-base":{default:["literal",{}]},"mbx-indoor-level-selected":{default:["literal",{}]},"mbx-indoor-level-overlapped":{default:["literal",{}]}};function rm(l){return l=l||{},Object.assign(l,Ay)}class nm extends o.E{constructor(t){super(),this.mergeFloors=!0,this._scope=void 0,this._queryFeatureSetId=void 0,this._buildingEntryFeatureSetId=void 0,this._selectedFloorplan=void 0,this._indoorData=void 0,this._selectedLevel=void 0,this._floorplanStates={},o.aV(["_onLoad","_onMove","_checkFloorplanVisible"],this),this._map=t,this._checkFloorplanVisible(!0),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=void 0}_onLoad(){this._map.style.forEachFragmentStyle(t=>{t.stylesheet.indoor&&(this._queryFeatureSetId?this.fire(new o.z(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._queryFeatureSetId=t.stylesheet.indoor.floorplanFeaturesetId,this._buildingEntryFeatureSetId=t.stylesheet.indoor.buildingFeaturesetId,this._scope=t.scope))}),this._queryFeatureSetId&&this._buildingEntryFeatureSetId&&this._map.addInteraction("mbx-indoor-buildingclick",{type:"click",target:{featuresetId:this._buildingEntryFeatureSetId,importId:this._scope},handler:t=>(t.feature&&t.feature.properties.floorplan&&this.selectFloorplan(t.feature.properties.floorplan),!0)}),this._checkFloorplanVisible(!0)}_onMove(){this._checkFloorplanVisible(!1)}_checkFloorplanVisible(t){if(!this._queryFeatureSetId||!this._map.isStyleLoaded()||this._map.transform.zoom<13)return;this._indoorData&&!function(_,y){const[b,E]=_,{center:I,radius:P}=y,[M,z]=I,N=Math.abs(b-M);return Math.sqrt((N>180?360-N:N)**2+(E-z)**2)<=P}([this._map.getCenter().lng,this._map.getCenter().lat],this._indoorData.circumCircle)&&(this._indoorData=void 0,this._selectedFloorplan=void 0,this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",["literal",[]]),this.fire(new o.A("floorplangone")));const n={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},c=new o.P(this._map.transform.width/2,this._map.transform.height/2),d=[new o.P(0,0),new o.P(this._map.transform.width,this._map.transform.height)],f=this._map.queryRenderedFeatures(t?d:c,n);f.length>0&&(this._selectedFloorplan&&f[0].properties.id===this._selectedFloorplan.properties.id||(this._selectedFloorplan=f[0],this._floorplanSelected(!1)))}_floorplanSelected(t){this._indoorData=JSON.parse(this._selectedFloorplan.properties["indoor-data"]),this._indoorData.id=this._selectedFloorplan.properties.id,this._indoorData.circumCircle=function(f){const[[_,y],[b,E]]=f,I=(b-_+360)%360,P=I>180?360-I:I;return{center:[(_+P/2+360)%360,(y+E)/2],radius:Math.sqrt(P**2+(E-y)**2)/2}}(this._indoorData.extent),this._floorplanStates[this._indoorData.id]||(this._floorplanStates[this._indoorData.id]={});const n=this._floorplanStates[this._indoorData.id].selectedBuilding,c=this._floorplanStates[this._indoorData.id].selectedLevel;let d;if(this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",this._indoorData.floorplanIDs),this._selectedLevel)for(const f of this._indoorData.levels)f.id===this._selectedLevel.id&&(d=f.id);if(this.fire(new o.A("floorplanselected",{buildings:this._indoorData.buildings,levels:this._indoorData.levels,selectedLevelId:d})),n){const f=this._indoorData.buildings.find(_=>_.id===n);this._buildingSelected(f,!1)}else this._indoorData.buildings.length>0&&this._buildingSelected(this._indoorData.buildings[0],!1);if(c){const f=this._indoorData.levels.find(_=>_.id===c);this._updateLevels(f,t)}else t&&this._indoorData["default-levels"].length>0&&this.selectLevel(this._indoorData["default-levels"][0])}_buildingSelected(t,n){n&&t&&t.extent&&this._map.fitBounds(t.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),this._floorplanStates[this._indoorData.id].selectedBuilding=t?t.id:void 0;const c=this._indoorData.levels.filter(d=>t.levels.includes(d.id));this.fire(new o.A("buildingselected",{buildingId:t.id,levels:c}))}_levelSelected(t){if(t==="overview")this._updateLevels(void 0,!0);else{const n=this._indoorData.levels.find(c=>c.id===t);this._updateLevels(n,!0)}this.fire(new o.A("levelselected",{levelId:t==="overview"?void 0:t}))}_updateLevels(t,n){if(!t)return this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",[]]),this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._floorplanStates[this._indoorData.id].selectedLevel=void 0,void(n&&this._indoorData.extent&&this._map.fitBounds(this._indoorData.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}));function c(E){const I=E.indexOf("/floor/");if(I===-1)return E;const P=I+7,M=E.indexOf("/",P);return M===-1?E.slice(P):E.slice(P,M)}this._selectedLevel=t,this._floorplanStates[this._indoorData.id].selectedLevel=t?t.id:void 0;const d=[],f={},_={},y={},b={};for(const E of this._indoorData.levels)if(d.push(E.id),f[E.id]=E.height,_[E.id]=E.base,t){if(this.mergeFloors){const I=c(t.id),P=c(E.id);y[E.id]=P===I?"true":"false"}else y[E.id]=E.id===t.id?"true":"false";b[E.id]=E.base<t.base?"true":"false"}else b[E.id]=!0;if(this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",d]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-height",["literal",f]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-base",["literal",_]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",y]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-overlapped",["literal",b]),t&&(this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!!t.isUnderground),n&&t.extent)){const E=this._map.cameraForBounds(t.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),I=this._map.getZoom(),P=E.zoom?Math.abs(I-E.zoom):0;this._map.fitBounds(t.extent,P>=1?{pitch:this._map.getPitch(),bearing:this._map.getBearing()}:{pitch:this._map.getPitch(),bearing:this._map.getBearing(),zoom:I})}}selectFloorplan(t){const n={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},c=[new o.P(0,0),new o.P(this._map.transform.width,this._map.transform.height)],d=this._map.queryRenderedFeatures(c,n);if(d.length>0){for(const f of d)if(JSON.parse(f.properties["indoor-data"]).floorplanIDs.includes(t)){this._selectedFloorplan=f,this._floorplanSelected(!0);break}}}selectBuilding(t){const n=this._indoorData.buildings.find(c=>c.id===t);this._buildingSelected(n,!0)}selectLevel(t){this._levelSelected(t)}}function Iy(l){if(!l.metadata||!l.metadata.content_area)return;const t=o.q.devicePixelRatio,{left:n,top:c,width:d,height:f}=l.metadata.content_area,_=n*t,y=c*t;return[_,y,_+d*t,y+f*t]}function Gu(l){if(l)return l.map(([t,n])=>[t*o.q.devicePixelRatio,n*o.q.devicePixelRatio])}class om{constructor(t,n,c){this.id=t,this.scope=n,this.sourceCache=c,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(t){this.missingRequests.has(t.name)||this.pendingRequests.has(t.name)||this.pendingRequests.add(t.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const n=this.sourceCache.getVisibleCoordinates();if(n.length===0)return t;const c=this.sourceCache.getSource();if(!(c instanceof xa))return t;const d=n.map(_=>this.sourceCache.getTile(_)),f=c.getImages(d,Array.from(this.pendingRequests));for(const[_,y]of f)t.set(o.I.from({name:_,iconsetId:this.id}),y),this.pendingRequests.delete(_);for(const _ of this.pendingRequests)this.missingRequests.add(_);return this.pendingRequests.clear(),t}}const qs=(l,t)=>Te(l,t&&t.filter(n=>n.identifier!=="source.canvas")),sm=o.aF(Ri,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),am=o.aF(Ri,["setCenter","setZoom","setBearing","setPitch"]),ys=new Set(["background","sky","slot","custom"]),Sc={version:8,layers:[],sources:{}},Md={duration:300,delay:0};class go extends o.E{constructor(t,n={}){super(),this.map=t,this.scope=n.scope||"",this.globalId=null,this.fragments=[],this.importDepth=n.importDepth||0,this.importsCache=n.importsCache||new Map,this.resolvedImports=n.resolvedImports||new Set,this.transition=o.l({},Md),this._buildingIndex=new Xf(this),this.crossTileSymbolIndex=new hn,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=n.styleChanges||new Ei,this.dispatcher=n.dispatcher?n.dispatcher:new o.D(o.d0(),this),n.imageManager?this.imageManager=n.imageManager:(this.imageManager=new wr(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=n.glyphManager?n.glyphManager:new o.d1(t._requestManager,n.localFontFamily?o.d2.all:n.localIdeographFontFamily?o.d2.ideographs:o.d2.none,n.localFontFamily||n.localIdeographFontFamily),n.modelManager?this.modelManager=n.modelManager:(this.modelManager=new Hs(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=n.configOptions?n.configOptions:new Map,this._configDependentLayers=n.configDependentLayers?n.configDependentLayers:new Set,this._config=n.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:n.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=n.initialConfig,this.dispatcher.broadcast("setReferrer",o.d3());const c=this;this._rtlTextPluginCallback=go.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(f,_)=>{if(o.d4(f),_&&_.every(y=>y))for(const y in c._sourceCaches){const b=c._sourceCaches[y],E=b.getSource().type;E!=="vector"&&E!=="geojson"||b.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const f=this.getOwnSource(d.sourceId);if(f&&f.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];y.source===f.id&&this._validateLayer(y)}})}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(o.f(t))return t;const n=o.d5(t);if(!n.startsWith("http"))try{return new URL(n,location.href).toString()}catch{return n}return n}return`json://${o.d6(JSON.stringify(t))}`}_diffStyle(t,n,c){this.globalId=this._getGlobalId(t);const d=(f,_)=>{try{_(null,this.setState(f,c))}catch(y){_(y,!1)}};if(typeof t=="string"){const f=this.map._requestManager.normalizeStyleURL(t),_=this.map._requestManager.transformRequest(f,o.R.Style);o.n(_,(y,b)=>{y?this.fire(new o.z(y)):b&&d(b,n)})}else typeof t=="object"&&d(t,n)}loadURL(t,n={}){this.fire(new o.A("dataloading",{dataType:"style"}));const c=typeof n.validate=="boolean"?n.validate:!o.f(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,n.accessToken),this.resolvedImports.add(t);const d=this.importsCache.get(t);if(d)return this._load(d,c);const f=this.map._requestManager.transformRequest(t,o.R.Style);this._request=o.n(f,(_,y)=>{if(this._request=null,_)this.fire(new o.z(_));else if(y)return this.importsCache.set(t,y),this._load(y,c)})}loadJSON(t,n={}){this.fire(new o.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=o.q.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new o.A("dataloading",{dataType:"style"})),this._load(Sc,!1)}_loadImports(t,n,c){if(this.importDepth>=4)return o.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const f of t){const _=this._createFragmentStyle(f),y=new Promise(I=>{_.once("style.import.load",I),_.once("error",I)}).then(()=>this.mergeAll());if(d.push(y),this.resolvedImports.has(f.url)){_.loadEmpty();continue}const b=f.data||this.importsCache.get(f.url);b?(_.loadJSON(b,{validate:n}),this._isInternalStyle(b)&&(_.globalId=null)):f.url?_.loadURL(f.url,{validate:n}):_.loadEmpty();const E={style:_,id:f.id,config:f.config};if(c){const I=this.fragments.findIndex(({id:P})=>P===c);this.fragments=this.fragments.slice(0,I).concat(E).concat(this.fragments.slice(I))}else this.fragments.push(E)}return Promise.allSettled(d)}getImportGlobalIds(t=this,n=new Set){for(const c of t.fragments)c.style.globalId&&n.add(c.style.globalId),this.getImportGlobalIds(c.style,n);return[...n.values()]}_createFragmentStyle(t){const n=this.scope?o.C(t.id,this.scope):t.id;let c;const d=this._initialConfig&&this._initialConfig[n];(t.config||d)&&(c=o.l({},t.config,d));const f=new go(this.map,{scope:n,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:c,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers});return f.setEventedParent(this.map,{style:f}),f}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,n){const c=t.indoor?rm(t.schema):t.schema;if(this._isInternalStyle(t)){const _=o.l({},Sc,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(_,n)}if(this.updateConfig(this._config,c),n&&qs(this,fo(t)))return;this._loaded=!0,this.stylesheet=o.d7(t);const d=()=>{for(const E in t.sources)this.addSource(E,t.sources[E],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const E in t.iconsets)this.addIconset(E,t.iconsets[E]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.setGlyphsUrl(t.glyphs);const _=Ou(this.stylesheet.layers);if(this._order=_.map(E=>E.id),this.stylesheet.light&&o.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const E=this.stylesheet.lights[0];this.light=new Be(E.properties,E.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Be(this.stylesheet.light)),this._layers={};for(const E of _){const I=o.dc(E,this.scope,this._styleColorTheme.lut,this.options);I.configDependencies.size!==0&&this._configDependentLayers.add(I.fqid),I.setEventedParent(this,{layer:{id:I.id}}),this._layers[I.id]=I;const P=this.getOwnLayerSourceCache(I),M=!!this.directionalLight&&this.directionalLight.shadowsEnabled();P&&I.canCastShadows()&&M&&(P.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const y=this.stylesheet.terrain;y&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(y,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new o.A("data",{dataType:"style"}));const b=this.isRootStyle();t.imports?this._loadImports(t.imports,n).then(()=>{this._reloadImports(),this.fire(new o.A(b?"style.load":"style.import.load"))}).catch(E=>{this.fire(new o.z(new Error("Failed to load imports",E))),this.fire(new o.A(b?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new o.A(b?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const f=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(f){const _=this._evaluateColorThemeData(f);this._loadColorTheme(_).then(()=>{d()}).catch(y=>{o.w(`Couldn't load color theme from the stylesheet: ${y}`),d()})}else this._styleColorTheme.lut=null,d()}isRootStyle(){return this.importDepth===0}mergeAll(){let t,n,c,d,f,_,y,b,E,I;const P={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(M=>{if(M.stylesheet){if(M.light!=null&&(t=M.light),M.stylesheet.lights)for(const z of M.stylesheet.lights)z.type==="ambient"&&M.ambientLight!=null&&(n=M.ambientLight),z.type==="directional"&&M.directionalLight!=null&&(c=M.directionalLight);d=this._prioritizeTerrain(d,M.terrain,M.stylesheet.terrain),M.stylesheet.fog&&M.fog!=null&&(f=M.fog),M.stylesheet.snow&&M.snow!=null&&(_=M.snow),M.stylesheet.rain&&M.rain!=null&&(y=M.rain),M.stylesheet.camera!=null&&(I=M.stylesheet.camera),M.stylesheet.projection!=null&&(b=M.stylesheet.projection),M.stylesheet.transition!=null&&(E=M.stylesheet.transition),P[M.scope]=M._styleColorTheme}}),this.light=t,this.ambientLight=n,this.directionalLight=c,this.fog=f,this.snow=_,this.rain=y,this._styleColorThemeForScope=P,d===null?delete this.terrain:this.terrain=d,this.camera=I||{"camera-projection":"perspective"},this.projection=b||{name:"mercator"},this.transition=o.l({},Md,E),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(t){const n=c=>{for(const d of c.fragments)n(d.style);t(c)};n(this)}_prioritizeTerrain(t,n,c){const d=t&&t.drapeRenderMode===0;return c===null?n&&n.drapeRenderMode===0?n:d?t:null:n!=null&&(!t||d||n&&n.drapeRenderMode===1)?n:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(n=>{t=this._prioritizeTerrain(t,n.terrain,n.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle(n=>{n.stylesheet.projection!=null&&(t=n.stylesheet.projection)}),this.projection=t||{name:"mercator"}}mergeSources(){const t={},n={},c={};this.forEachFragmentStyle(d=>{for(const f in d._sourceCaches){const _=o.C(f,d.scope);t[_]=d._sourceCaches[f]}for(const f in d._otherSourceCaches){const _=o.C(f,d.scope);n[_]=d._otherSourceCaches[f]}for(const f in d._symbolSourceCaches){const _=o.C(f,d.scope);c[_]=d._symbolSourceCaches[f]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=n,this._mergedSymbolSourceCaches=c}mergeLayers(){const t={},n=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(f=>{for(const _ of f._order){const y=f._layers[_];if(y.type==="slot"){const b=o.d8(_);if(t[b])continue;t[b]=[]}y.slot&&t[y.slot]?t[y.slot].push(y):n.push(y)}}),this._mergedOrder=[];const d=(f=[])=>{for(const _ of f)if(_.type==="slot"){const y=o.d8(_.id);t[y]&&d(t[y]),this._mergedSlots.push(y)}else{const y=o.C(_.id,_.scope);this._mergedOrder.push(y),c[y]=_,_.is3D(!!this.terrain)&&(this._has3DLayers=!0),_.type==="circle"&&(this._hasCircleLayers=!0),_.type==="symbol"&&(this._hasSymbolLayers=!0),_.type==="clip"&&(this._clipLayerPresent=!0)}};d(n),this._mergedOrder.sort((f,_)=>{const y=c[f],b=c[_];return y.hasInitialOcclusionOpacityProperties?b.is3D(!!this.terrain)?1:0:y.is3D(!!this.terrain)&&b.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=o.l({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(n,c,d){const f=o.l({},c);for(const y of Object.keys(o.a5.colorTheme))f[y]===void 0&&(f[y]=o.a5.colorTheme[y].default);const _=new o.a6(Ey,n,new Map(d));return _.setTransitionOrValue(f,d),_.untransitioned().possiblyEvaluate(new o.aa(0))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const n=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((c,d)=>{const f="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void c();let _=t;_.startsWith(f)||(_=f+_);const y=o.I.from("mapbox-reserved-lut"),b=new Image;b.src=_,b.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},b.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==n)return void c();this._styleColorTheme.lutLoading=!1;const{width:E,height:I,data:P}=o.q.getImageData(b);if(I>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(E!==I*I)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(y)&&this.removeImage(y),this.addImage(y,{data:new o.r({width:E,height:I},P),pixelRatio:1,sdf:!1,usvg:!1,version:0});const M=this.imageManager.getImage(y,this.scope);M?(this._styleColorTheme.lut={image:M.data,data:t},c()):d(new Error("Missing LUT image."))}})}getLut(t){const n=this._styleColorThemeForScope[t];return n?n.lut:null}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(n,c,d){let f,_,y;const b=o.q.devicePixelRatio>1?"@2x":"";let E=o.n(c.transformRequest(c.normalizeSpriteURL(n,b,".json"),o.R.SpriteJSON),(M,z)=>{E=null,y||(y=M,f=z,P())}),I=o.o(c.transformRequest(c.normalizeSpriteURL(n,b,".png"),o.R.SpriteImage),(M,z)=>{I=null,y||(y=M,_=z,P())});function P(){if(y)d(y);else if(f&&_){const M=o.q.getImageData(_),z={};for(const N in f){const{width:B,height:G,x:V,y:X,sdf:Q,pixelRatio:ie,stretchX:ue,stretchY:ae,content:le}=f[N],ne=new o.r({width:B,height:G});o.r.copy(M,ne,{x:V,y:X},{x:0,y:0},{width:B,height:G},null),z[N]={data:ne,pixelRatio:ie,sdf:Q,stretchX:ue,stretchY:ae,content:le,usvg:!1}}d(null,z)}}return{cancel(){E&&(E.cancel(),E=null),I&&(I.cancel(),I=null)}}}(t,this.map._requestManager,(n,c)=>{if(this._spriteRequest=null,n)this.fire(new o.z(n));else if(c){const d=new Map;for(const f in c)d.set(o.I.from(f),c[f]);this.addImages(d)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new o.A("data",{dataType:"style"}))})}addIconset(t,n){if(n.type==="sprite")return void this._loadSprite(n.url);const c=this.getOwnSourceCache(n.source);if(!c)return void this.fire(new o.z(new Error(`Source "${n.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const d=c.getSource();if(d.type!=="raster-array")return void this.fire(new o.z(new Error(`Source "${n.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));d.partial=!1;const f=new om(t,this.scope,c);this.imageManager.addImageProvider(f,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!o.f(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const n=this.map._spriteFormat==="auto";var c,d;this._spriteRequest=(d=(f,_)=>{if(this._spriteRequest=null,f)n?this._loadSprite(t):this.fire(new o.z(f));else if(_){const y=new Map;for(const b in _)y.set(o.I.from(b),_[b]);this.addImages(y)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new o.A("data",{dataType:"style"}))},o.br((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),o.R.Iconset),(f,_)=>{if(f)return void d(f);const y={},b=o.c_(new o.bq(_));for(const E of b.icons){const I={version:1,pixelRatio:o.q.devicePixelRatio,content:Iy(E),stretchX:E.metadata?Gu(E.metadata.stretch_x_areas):void 0,stretchY:E.metadata?Gu(E.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:E};y[E.name]=I}d(null,y)}))}_validateLayer(t){const n=this.getOwnSource(t.source);if(!n)return;const c=t.sourceLayer;c&&(n.type==="geojson"||n.vectorLayerIds&&n.vectorLayerIds.indexOf(c)===-1)&&this.fire(new o.z(new Error(`Source layer "${c}" does not exist on source "${n.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,n)=>{const c=this.fragments[n];return c&&c.style&&(t.data=c.style.serialize()),t})}_serializeSources(){const t={};for(const n in this._sourceCaches){const c=this._sourceCaches[n].getSource();t[c.id]||(t[c.id]=c.serialize())}return t}_serializeLayers(t){const n=[];for(const c of t){const d=this._layers[c];d&&d.type!=="custom"&&n.push(d.serialize())}return n}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const n=this.getOwnLayer(t);if(n)return n;this.fire(new o.z(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const n=this.getOwnSource(t);if(n)return n;this.fire(new o.z(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(t,n){const c=this.map.painter;if(c)for(let d=t.minzoom||0;d<(t.maxzoom||25.5);d++){const f=t.getProgramIds();if(f)for(const _ of f){const y=t.getDefaultProgramParams(_,n.zoom,this._styleColorTheme.lut);y&&(c.style=this,this.fog&&(c._fogVisible=!0,y.overrideFog=!0,c.getOrCreateProgram(_,y)),c._fogVisible=!1,y.overrideFog=!1,c.getOrCreateProgram(_,y),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(y.overrideRtt=!0,c.getOrCreateProgram(_,y)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const n=this.calculateLightsBrightness();t.brightness=n||0,n!==this._brightness&&(this._brightness=n,this.dispatcher.broadcast("setBrightness",n));const c=this._changes.isDirty();let d=!1;if(this._changes.isDirty()){const y=this._changes.getLayerUpdatesByScope();for(const b in y){const{updatedIds:E,removedIds:I}=y[b];(E||I)&&(this._updateWorkerLayers(b,E,I),d=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const f={};for(const y in this._mergedSourceCaches){const b=this._mergedSourceCaches[y];f[y]=b.used,b.used=!1,b.tileCoverLift=0}for(const y of this._mergedOrder){const b=this._mergedLayers[y];if(b.recalculate(t,this._availableImages),!b.isHidden(t.zoom)){const E=this.getLayerSourceCache(b);E&&(E.used=!0,E.tileCoverLift=Math.max(E.tileCoverLift,b.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(b,t)}):this.precompilePrograms(b,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&d&&this.mergeLayers();const _=this.imageManager.getPendingImageProviders();for(const y of _)y.sourceCache.used=!0;for(const y in f){const b=this._mergedSourceCaches[y];f[y]!==b.used&&b.getSource().fire(new o.A("data",{sourceDataType:"visibility",dataType:"source",sourceId:b.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),c&&this.fire(new o.A("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const n of t){const c=n.resolvePendingRequests(),d=this.getFragmentStyle(n.scope);d&&d.addImages(c)}}_updateTilesForChangedImages(){const t={};for(const n in this._mergedSourceCaches){const c=this._mergedSourceCaches[n].getSource().scope;t[c]=t[c]||this._changes.getUpdatedImages(c),t[c].length!==0&&this._mergedSourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t[c])}for(const n in t)this._changes.resetUpdatedImages(n)}_updateWorkerLayers(t,n,c){const d=this.getFragmentStyle(t);d&&this.dispatcher.broadcast("updateLayers",{layers:n?d._serializeLayers(n):[],scope:t,removedIds:c||[],options:d.options})}setState(t,n){if(this._checkLoaded(),qs(this,fo(t)))return!1;(t=o.d7(t)).layers=Ou(t.layers);const c=function(_,y){if(!_)return[{command:Ri.setStyle,args:[y]}];let b=[];try{if(!o.bv(_.version,y.version))return[{command:Ri.setStyle,args:[y]}];if(o.bv(_.center,y.center)||b.push({command:Ri.setCenter,args:[y.center]}),o.bv(_.zoom,y.zoom)||b.push({command:Ri.setZoom,args:[y.zoom]}),o.bv(_.bearing,y.bearing)||b.push({command:Ri.setBearing,args:[y.bearing]}),o.bv(_.pitch,y.pitch)||b.push({command:Ri.setPitch,args:[y.pitch]}),o.bv(_.sprite,y.sprite)||b.push({command:Ri.setSprite,args:[y.sprite]}),o.bv(_.glyphs,y.glyphs)||b.push({command:Ri.setGlyphs,args:[y.glyphs]}),o.bv(_.imports,y.imports)||function(z=[],N=[],B){N=N||[];const G=(z=z||[]).map(Ns),V=N.map(Ns),X=z.reduce(ul,{}),Q=N.reduce(ul,{}),ie=G.slice();let ue,ae,le,ne;for(ue=0,ae=0;ue<G.length;ue++)le=G[ue],Q.hasOwnProperty(le)?ae++:(B.push({command:Ri.removeImport,args:[le]}),ie.splice(ie.indexOf(le,ae),1));for(ue=0,ae=0;ue<V.length;ue++)le=V[V.length-1-ue],ie[ie.length-1-ue]!==le&&(X.hasOwnProperty(le)?(B.push({command:Ri.removeImport,args:[le]}),ie.splice(ie.lastIndexOf(le,ie.length-ae),1)):ae++,ne=ie[ie.length-ue],B.push({command:Ri.addImport,args:[Q[le],ne]}),ie.splice(ie.length-ue,0,le));for(const de of N){const me=X[de.id];me&&!o.bv(me,de)&&B.push({command:Ri.updateImport,args:[de.id,de]})}}(_.imports,y.imports,b),o.bv(_.transition,y.transition)||b.push({command:Ri.setTransition,args:[y.transition]}),o.bv(_.light,y.light)||b.push({command:Ri.setLight,args:[y.light]}),o.bv(_.fog,y.fog)||b.push({command:Ri.setFog,args:[y.fog]}),o.bv(_.snow,y.snow)||b.push({command:Ri.setSnow,args:[y.snow]}),o.bv(_.rain,y.rain)||b.push({command:Ri.setRain,args:[y.rain]}),o.bv(_.projection,y.projection)||b.push({command:Ri.setProjection,args:[y.projection]}),o.bv(_.lights,y.lights)||b.push({command:Ri.setLights,args:[y.lights]}),o.bv(_.camera,y.camera)||b.push({command:Ri.setCamera,args:[y.camera]}),o.bv(_.iconsets,y.iconsets)||function(z,N,B){let G;for(G in N=N||{},z=z||{})z.hasOwnProperty(G)&&(N.hasOwnProperty(G)||B.push({command:Ri.removeIconset,args:[G]}));for(G in N){if(!N.hasOwnProperty(G))continue;const V=N[G];z.hasOwnProperty(G)?o.bv(z[G],V)||(B.push({command:Ri.removeIconset,args:[G]}),B.push({command:Ri.addIconset,args:[G,V]})):B.push({command:Ri.addIconset,args:[G,V]})}}(_.iconsets,y.iconsets,b),!o.bv(_["color-theme"],y["color-theme"]))return[{command:Ri.setStyle,args:[y]}];const E={},I=[];(function(z,N,B,G){let V;for(V in N=N||{},z=z||{})z.hasOwnProperty(V)&&(N.hasOwnProperty(V)||cl(V,B,G));for(V in N){if(!N.hasOwnProperty(V))continue;const X=N[V];z.hasOwnProperty(V)?o.bv(z[V],X)||(z[V].type==="geojson"&&X.type==="geojson"&&Yf(z,N,V)?B.push({command:Ri.setGeoJSONSourceData,args:[V,X.data]}):wy(V,N,B,G)):ll(V,N,B)}})(_.sources,y.sources,I,E);const P=[];_.layers&&_.layers.forEach(z=>{z.source&&E[z.source]?b.push({command:Ri.removeLayer,args:[z.id]}):P.push(z)});let M=_.terrain;M&&E[M.source]&&(b.push({command:Ri.setTerrain,args:[void 0]}),M=void 0),b=b.concat(I),o.bv(M,y.terrain)||b.push({command:Ri.setTerrain,args:[y.terrain]}),function(z,N,B){N=N||[];const G=(z=z||[]).map(Ns),V=N.map(Ns),X=z.reduce(ul,{}),Q=N.reduce(ul,{}),ie=G.slice(),ue=Object.create(null);let ae,le,ne,de,me,Le,Me;for(ae=0,le=0;ae<G.length;ae++)ne=G[ae],Q.hasOwnProperty(ne)?le++:(B.push({command:Ri.removeLayer,args:[ne]}),ie.splice(ie.indexOf(ne,le),1));for(ae=0,le=0;ae<V.length;ae++)ne=V[V.length-1-ae],ie[ie.length-1-ae]!==ne&&(X.hasOwnProperty(ne)?(B.push({command:Ri.removeLayer,args:[ne]}),ie.splice(ie.lastIndexOf(ne,ie.length-le),1)):le++,Le=ie[ie.length-ae],B.push({command:Ri.addLayer,args:[Q[ne],Le]}),ie.splice(ie.length-ae,0,ne),ue[ne]=!0);for(ae=0;ae<V.length;ae++)if(ne=V[ae],de=X[ne],me=Q[ne],!ue[ne]&&!o.bv(de,me))if(o.bv(de.source,me.source)&&o.bv(de["source-layer"],me["source-layer"])&&o.bv(de.type,me.type)){for(Me in wa(de.layout,me.layout,B,ne,null,Ri.setLayoutProperty),wa(de.paint,me.paint,B,ne,null,Ri.setPaintProperty),o.bv(de.slot,me.slot)||B.push({command:Ri.setSlot,args:[ne,me.slot]}),o.bv(de.filter,me.filter)||B.push({command:Ri.setFilter,args:[ne,me.filter]}),o.bv(de.minzoom,me.minzoom)&&o.bv(de.maxzoom,me.maxzoom)||B.push({command:Ri.setLayerZoomRange,args:[ne,me.minzoom,me.maxzoom]}),de)de.hasOwnProperty(Me)&&Me!=="layout"&&Me!=="paint"&&Me!=="filter"&&Me!=="metadata"&&Me!=="minzoom"&&Me!=="maxzoom"&&Me!=="slot"&&(Me.indexOf("paint.")===0?wa(de[Me],me[Me],B,ne,Me.slice(6),Ri.setPaintProperty):o.bv(de[Me],me[Me])||B.push({command:Ri.setLayerProperty,args:[ne,Me,me[Me]]}));for(Me in me)me.hasOwnProperty(Me)&&!de.hasOwnProperty(Me)&&Me!=="layout"&&Me!=="paint"&&Me!=="filter"&&Me!=="metadata"&&Me!=="minzoom"&&Me!=="maxzoom"&&Me!=="slot"&&(Me.indexOf("paint.")===0?wa(de[Me],me[Me],B,ne,Me.slice(6),Ri.setPaintProperty):o.bv(de[Me],me[Me])||B.push({command:Ri.setLayerProperty,args:[ne,Me,me[Me]]}))}else B.push({command:Ri.removeLayer,args:[ne]}),Le=ie[ie.lastIndexOf(ne)+1],B.push({command:Ri.addLayer,args:[me,Le]})}(P,y.layers,b)}catch(E){console.warn("Unable to compute style diff:",E),b=[{command:Ri.setStyle,args:[y]}]}return b}(this.serialize(),t).filter(_=>!(_.command in am));if(c.length===0)return!1;const d=c.filter(_=>!(_.command in sm));if(d.length>0)throw new Error(`Unimplemented: ${d.map(_=>_.command).join(", ")}.`);const f=[];return c.forEach(_=>{f.push(this[_.command](..._.args))}),n&&Promise.all(f).then(n).catch(n),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t){for(const[n,c]of t.entries()){if(this.getImage(n))return this.fire(new o.z(new Error(`An image with the name "${n.name}" already exists.`)));this.imageManager.addImage(n,this.scope,c),this._changes.updateImage(n,this.scope)}return this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this}addImage(t,n){return this.getImage(t)?this.fire(new o.z(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,n),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this)}updateImage(t,n,c=!1){this.imageManager.updateImage(t,this.scope,n),c&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this):this.fire(new o.z(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModelURLs(t){return this.modelManager.addModelURLs(t,this.scope),this._updateWorkerModels(),this.fire(new o.A("data",{dataType:"style"})),this}addModel(t,n,c={}){return this._checkLoaded(),this._validate(pe,`models.${t}`,n,null,c)||(this.modelManager.addModel(t,n,this.scope),this.fire(new o.A("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope),this.fire(new o.A("data",{dataType:"style"})),this):this.fire(new o.z(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,n,c={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(ac,`sources.${t}`,n,null,c))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const d=sl(t,n,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const f=_=>{const y=(_?"symbol:":"other:")+d.id,b=o.C(y,this.scope),E=this._sourceCaches[y]=new Fn(b,d,_);(_?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=E,E.onAdd(this.map)};f(!1),n.type!=="vector"&&n.type!=="geojson"||f(!0),d.onAdd&&d.onAdd(this.map),c.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const n=this.getOwnSource(t);if(!n)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===t)return this.fire(new o.z(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new o.z(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find(([f,_])=>_.type==="source"&&_.source===t);if(d)return this.fire(new o.z(new Error(`Source "${t}" cannot be removed while iconset "${d[0]}" is using it.`)))}const c=this.getOwnSourceCaches(t);for(const d of c){const f=o.d8(d.id);delete this._sourceCaches[f],this._changes.discardSourceCacheUpdate(d.id),d.fire(new o.A("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,n){this._checkLoaded(),this.getOwnSource(t).setData(n),this._changes.setDirty()}getOwnSource(t){const n=this.getOwnSourceCache(t);return n&&n.getSource()}getOwnSources(){const t=[];for(const n in this._otherSourceCaches){const c=this.getOwnSourceCache(n);c&&t.push(c.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const n in t){const c=t[n]._tiles;for(const d in c){const f=c[d];if(f.state!=="loaded"&&f.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const n=this._getTransitionParameters();for(const d of t){if(this._validate(lc,"lights",d))return;switch(d.type){case"ambient":if(this.ambientLight){const f=this.ambientLight;f.set(d),f.updateTransitions(n)}else this.ambientLight=new qr(d,nr||(nr=new o.a7({color:new o.a8(o.a5.properties_light_ambient.color),"color-use-theme":new o.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.a8(o.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const f=this.directionalLight;f.set(d),f.updateTransitions(n)}else this.directionalLight=new qr(d,Li||(Li=new o.a7({direction:new o.an(o.a5.properties_light_directional.direction),color:new o.a8(o.a5.properties_light_directional.color),"color-use-theme":new o.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.a8(o.a5.properties_light_directional.intensity),"cast-shadows":new o.a8(o.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new o.a8(o.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new o.a8(o.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const c=new o.aa(this.z||0,n);this.ambientLight&&this.ambientLight.recalculate(c),this.directionalLight&&this.directionalLight.recalculate(c),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,n=this.ambientLight;if(!t||!n)return;const c=M=>.2126*(M[0]<=.03928?M[0]/12.92:Math.pow((M[0]+.055)/1.055,2.4))+.7152*(M[1]<=.03928?M[1]/12.92:Math.pow((M[1]+.055)/1.055,2.4))+.0722*(M[2]<=.03928?M[2]/12.92:Math.pow((M[2]+.055)/1.055,2.4)),d=t.properties.get("color").toRenderColor(null).toArray01(),f=t.properties.get("intensity"),_=t.properties.get("direction"),y=1-o.cR(_.x,_.y,_.z)[2]/90,b=c(d)*f*y,E=n.properties.get("color").toRenderColor(null).toArray01(),I=n.properties.get("intensity"),P=c(E)*I;return Number(((b+P)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&&t.push(this.directionalLight.get()),this.ambientLight&&t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(t==null||t===""&&this.isRootStyle())return this;if(o.d9(t)){const n=o.da(t),c=this.fragments.find(({id:f})=>f===n);if(!c)return;const d=o.d8(t);return c.style.getFragmentStyle(d)}{const n=this.fragments.find(({id:c})=>c===t);return n?n.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const n={},c=(d,f="")=>`${d}::${f}`;this._featuresetSelectors={};for(const d in t){const f=this._featuresetSelectors[d]=[];for(const _ of t[d].selectors){if(_.featureNamespace){const b=this.getOwnLayer(_.layer);if(!b){o.w(`Layer is undefined for selector: ${_.layer}`);continue}const E=c(b.source,b.sourceLayer);if(E in n&&n[E]!==_.featureNamespace){o.w(`"featureNamespace ${_.featureNamespace} of featureset ${d}'s selector is not associated to the same source, skip this selector`);continue}n[E]=_.featureNamespace}let y;if(_.properties)for(const b in _.properties){const E=o.X(_.properties[b]);E.result==="success"&&(y=y||{},y[b]=E.value)}f.push({layerId:_.layer,namespace:_.featureNamespace,properties:y,uniqueFeatureID:_._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const n=this.getFragmentStyle(t);if(!n||!n.stylesheet.featuresets)return[];const c=[];for(const d in n.stylesheet.featuresets)c.push({featuresetId:d,importId:n.scope?n.scope:void 0});return c}getFeaturesetLayers(t,n){const c=this.getFragmentStyle(n),d=c.stylesheet.featuresets;if(!d||!d[t])return this.fire(new o.z(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const f=[];for(const _ of d[t].selectors){const y=c.getOwnLayer(_.layer);y&&f.push(y)}return f}getConfigProperty(t,n){const c=this.getFragmentStyle(t);if(!c)return null;const d=o.C(n,c.scope),f=c.options.get(d),_=f?f.value||f.default:null;return _?_.serialize():null}setConfigProperty(t,n,c){const d=this.getFragmentStyle(t);if(!d)return;const f=d.stylesheet.indoor?rm(d.stylesheet.schema):d.stylesheet.schema;if(!f||!f[n])return;const _=o.X(c);if(_.result!=="success")return void qs(this,_.value);const y=_.value.expression,b=o.C(n,d.scope),E=d.options.get(b);if(!E)return;let I;const{minValue:P,maxValue:M,stepValue:z,type:N,values:B}=f[n],G=o.X(f[n].default);G.result==="success"&&(I=G.value.expression),I?(this.options.set(b,Object.assign({},E,{value:y,default:I,minValue:P,maxValue:M,stepValue:z,type:N,values:B})),this.updateConfigDependencies(n)):this.fire(new o.z(new Error(`No schema defined for the config option "${n}" in the "${t}" fragment.`)))}getConfig(t){const n=this.getFragmentStyle(t);if(!n)return null;const c=n.stylesheet.schema;if(!c)return null;const d={};for(const f in c){const _=o.C(f,n.scope),y=n.options.get(_),b=y?y.value||y.default:null;d[f]=b?b.serialize():null}return d}setConfig(t,n){const c=this.getFragmentStyle(t);c&&(c.updateConfig(n,c.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const n=this.getFragmentStyle(t);return n?n.stylesheet.schema:null}setSchema(t,n){const c=this.getFragmentStyle(t);c&&(c.stylesheet.schema=n,c.updateConfig(c._config,n),this.updateConfigDependencies())}updateConfig(t,n){if(this._config=t,t||n)if(n)for(const c in n){let d,f;const _=o.X(n[c].default);if(_.result==="success"&&(d=_.value.expression),t&&t[c]!==void 0){const M=o.X(t[c]);M.result==="success"&&(f=M.value.expression)}const{minValue:y,maxValue:b,stepValue:E,type:I,values:P}=n[c];if(d){const M=o.C(c,this.scope);this.options.set(M,{default:d,value:f,minValue:y,maxValue:b,stepValue:E,type:I,values:P})}else this.fire(new o.z(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new o.z(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(t){for(const n of this._configDependentLayers){const c=this.getLayer(n);if(c){if(t&&!c.configDependencies.has(t))continue;c.possiblyEvaluateVisibility(),this._updateLayer(c)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(n=>{const c=n._styleColorTheme.colorThemeOverride?n._styleColorTheme.colorThemeOverride:n._styleColorTheme.colorTheme;if(c){const d=n._evaluateColorThemeData(c);(!n._styleColorTheme.lut&&d!==""||n._styleColorTheme.lut&&d!==n._styleColorTheme.lut.data)&&n.setColorTheme(c)}}),this._changes.setDirty()}addLayer(t,n,c={}){this._checkLoaded();const d=t.id;if(this._layers[d])return void this.fire(new o.z(new Error(`Layer with id "${d}" already exists on this map`)));let f;if(t.type==="custom"){if(qs(this,o.db(t)))return;f=o.dc(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=o.d7(t),t=o.l(t,{source:d})),this._validate(U,`layers.${d}`,t,{arrayIndex:-1},c))return;f=o.dc(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(f),f.setEventedParent(this,{layer:{id:d}})}f.configDependencies.size!==0&&this._configDependentLayers.add(f.fqid);let _=this._order.length;if(n){const I=this._order.indexOf(n);if(I===-1)return void this.fire(new o.z(new Error(`Layer with id "${n}" does not exist on this map.`)));f.slot===this._layers[n].slot?_=I:o.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(_,0,d),this._layerOrderChanged=!0,this._layers[d]=f;const y=this.getOwnLayerSourceCache(f),b=!!this.directionalLight&&this.directionalLight.shadowsEnabled();y&&f.canCastShadows()&&b&&(y.castsShadows=!0);const E=this._changes.getRemovedLayer(f);if(E&&f.source&&y&&f.type!=="custom"){this._changes.discardLayerRemoval(f);const I=o.C(f.source,f.scope);E.type!==f.type?this._changes.updateSourceCache(I,"clear"):(this._changes.updateSourceCache(I,"reload"),y.pause())}this._updateLayer(f),f.onAdd&&f.onAdd(this.map),f.scope=this.scope,this.mergeLayers()}moveLayer(t,n){this._checkLoaded();const c=this._checkLayer(t);if(!c||t===n)return;const d=this._order.indexOf(t);this._order.splice(d,1);let f=this._order.length;if(n){const _=this._order.indexOf(n);if(_===-1)return void this.fire(new o.z(new Error(`Layer with id "${n}" does not exist on this map.`)));c.slot===this._layers[n].slot?f=_:o.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(f,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(t){this._checkLoaded();const n=this._checkLayer(t);if(!n)return;n.setEventedParent(null);const c=this._order.indexOf(t);this._order.splice(c,1),delete this._layers[t],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(n.fqid),this._changes.removeLayer(n);const d=this.getOwnLayerSourceCache(n);if(d&&d.castsShadows){let f=!1;for(const _ in this._layers)if(this._layers[_].source===n.source&&this._layers[_].canCastShadows()){f=!0;break}d.castsShadows=f}n.onRemove&&n.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const n in this._layers)if(this._layers[n].type===t)return!0;return!1}setLayerZoomRange(t,n,c){this._checkLoaded();const d=this._checkLayer(t);d&&(d.minzoom===n&&d.maxzoom===c||(n!=null&&(d.minzoom=n),c!=null&&(d.maxzoom=c),this._updateLayer(d)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,n){this._checkLoaded();const c=this._checkLayer(t);c&&c.slot!==n&&(c.slot=n,this._updateLayer(c))}setFilter(t,n,c={}){this._checkLoaded();const d=this._checkLayer(t);if(d&&!o.bv(d.filter,n))return n==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(Z,`layers.${d.id}.filter`,n,{layerType:d.type},c)||(d.filter=o.d7(n),this._updateLayer(d)))}getFilter(t){const n=this._checkLayer(t);if(n)return o.d7(n.filter)}setLayoutProperty(t,n,c,d={}){this._checkLoaded();const f=this._checkLayer(t);if(f&&!o.bv(f.getLayoutProperty(n),c)){if(c!=null&&(!d||d.validate!==!1)&&qs(f,ge.call(fo,{key:`layers.${t}.layout.${n}`,layerType:f.type,objectKey:n,value:c,styleSpec:o.a5,style:{glyphs:!0,sprite:!0}})))return;f.setLayoutProperty(n,c),f.configDependencies.size!==0&&this._configDependentLayers.add(f.fqid),this._updateLayer(f)}}getLayoutProperty(t,n){const c=this._checkLayer(t);if(c)return c.getLayoutProperty(n)}setPaintProperty(t,n,c,d={}){this._checkLoaded();const f=this._checkLayer(t);if(!f||o.bv(f.getPaintProperty(n),c)||c!=null&&(!d||d.validate!==!1)&&qs(f,se.call(fo,{key:`layers.${t}.paint.${n}`,layerType:f.type,objectKey:n,value:c,styleSpec:o.a5})))return;const _=f.setPaintProperty(n,c);f.configDependencies.size!==0&&this._configDependentLayers.add(f.fqid),_&&this._updateLayer(f),this._changes.updatePaintProperties(f)}getPaintProperty(t,n){const c=this._checkLayer(t);if(c)return c.getPaintProperty(n)}setFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:b,importId:E}=t.target,I=this.getFragmentStyle(E),P=I.getFeaturesetLayers(b);for(const{source:M,sourceLayer:z}of P)I.setFeatureState({id:t.id,source:M,sourceLayer:z},n)}else if("layerId"in t.target){const{layerId:b}=t.target,E=this.getLayer(b);this.setFeatureState({id:t.id,source:E.source,sourceLayer:E.sourceLayer},n)}return}const c=t.source,d=t.sourceLayer,f=this._checkSource(c);if(!f)return;const _=f.type;if(_==="geojson"&&d)return void this.fire(new o.z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(_==="vector"&&!d)return void this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new o.z(new Error("The feature id parameter must be provided.")));const y=this.getOwnSourceCaches(c);for(const b of y)b.setFeatureState(d,t.id,n)}removeFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:b,importId:E}=t.target,I=this.getFragmentStyle(E),P=I.getFeaturesetLayers(b);for(const{source:M,sourceLayer:z}of P)I.removeFeatureState({id:t.id,source:M,sourceLayer:z},n)}else if("layerId"in t.target){const{layerId:b}=t.target,E=this.getLayer(b);this.removeFeatureState({id:t.id,source:E.source,sourceLayer:E.sourceLayer},n)}return}const c=t.source,d=this._checkSource(c);if(!d)return;const f=d.type,_=f==="vector"?t.sourceLayer:void 0;if(f==="vector"&&!_)return void this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new o.z(new Error("A feature id is required to remove its specific state property.")));const y=this.getOwnSourceCaches(c);for(const b of y)b.removeFeatureState(_,t.id,n)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let f;if("featuresetId"in t.target){const{featuresetId:_,importId:y}=t.target,b=this.getFragmentStyle(y),E=b.getFeaturesetLayers(_);for(const{source:I,sourceLayer:P}of E){const M=b.getFeatureState({id:t.id,source:I,sourceLayer:P});if(M&&!f)f=M;else if(!o.bv(f,M))return void this.fire(new o.z(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:_}=t.target,y=this.getLayer(_);f=this.getFeatureState({id:t.id,source:y.source,sourceLayer:y.sourceLayer})}return f}const n=t.source,c=t.sourceLayer,d=this._checkSource(n);if(d){if(d.type!=="vector"||c)return t.id===void 0&&this.fire(new o.z(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)[0].getFeatureState(c,t.id);this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=o.l({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return o.l({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),n=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return o.dd({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:n,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},c=>c!==void 0)}_updateFilteredLayers(t){for(const n of Object.values(this._mergedLayers))t(n)&&this._updateLayer(n)}_updateLayer(t){this._changes.updateLayer(t);const n=this.getLayerSourceCache(t),c=o.C(t.source,t.scope),d=this._changes.getUpdatedSourceCaches();t.source&&!d[c]&&n&&n.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),n.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const n=y=>this._mergedLayers[y].is3D(!!this.terrain),c=this.order,d={},f=[];for(let y=c.length-1;y>=0;y--){const b=c[y];if(n(b)){d[b]=y;for(const E of t){const I=E[b];if(I)for(const P of I)f.push(P)}}}f.sort((y,b)=>b.intersectionZ-y.intersectionZ);const _=[];for(let y=c.length-1;y>=0;y--){const b=c[y];if(n(b))for(let E=f.length-1;E>=0;E--){const I=f[E].feature;if(I.layer&&d[I.layer.id]<y)break;_.push(I),f.pop()}else for(const E of t){const I=E[b];if(I)for(const P of I)_.push(P.feature)}}return _}queryRenderedFeatures(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(Z,"queryRenderedFeatures.filter",n.filter,null,n),d=o.b3(n.filter));const f={},_=I=>{if(ys.has(I.type))return;const P=this.getOwnLayerSourceCache(I),M=f[P.id]=f[P.id]||{sourceCache:P,layers:{},has3DLayers:!1};I.is3D(!!this.terrain)&&(M.has3DLayers=!0),M.layers[I.fqid]=M.layers[I.fqid]||{styleLayer:I,targets:[]},M.layers[I.fqid].targets.push({filter:d})};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new o.z(new Error("parameters.layers must be an Array."))),[];for(const I of n.layers){const P=this._layers[I];if(!P)return this.fire(new o.z(new Error(`The layer '${I}' does not exist in the map's style and cannot be queried for features.`))),[];_(P)}}else for(const I in this._layers)_(this._layers[I]);const y=this._queryRenderedFeatures(t,f,c),b=this._flattenAndSortRenderedFeatures(y),E=[];for(const I of b)o.de(I.layer.id)===this.scope&&E.push(I);return E}queryRenderedFeatureset(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(Z,"queryRenderedFeatures.filter",n.filter,null,n),d=o.b3(n.filter));const f="mock",_=[];if(n&&n.target)_.push(Object.assign({},n,{targetId:f,filter:d}));else{const I=this.getFeaturesetDescriptors();for(const P of I)_.push({targetId:f,filter:d,target:P});for(const{style:P}of this.fragments){const M=P.getFeaturesetDescriptors();for(const z of M)_.push({targetId:f,filter:d,target:z})}}const y=this.queryRenderedTargets(t,_,c),b=[],E=new Set;for(const I of y)for(const P of I.variants[f])uc(P,I,E)||b.push(new o.df(I,P));return b}queryRenderedTargets(t,n,c){const d={},f=(y,b,E,I)=>{const P=d[b.id]=d[b.id]||{sourceCache:b,layers:{},has3DLayers:!1};if(P.layers[y.fqid]=P.layers[y.fqid]||{styleLayer:y,targets:[]},y.is3D(!!this.terrain)&&(P.has3DLayers=!0),!I)return E.uniqueFeatureID=!1,void P.layers[y.fqid].targets.push(E);P.layers[y.fqid].targets.push(Object.assign({},E,{namespace:I.namespace,properties:I.properties,uniqueFeatureID:I.uniqueFeatureID}))};for(const y of n)if("featuresetId"in y.target){const{featuresetId:b,importId:E}=y.target,I=this.getFragmentStyle(E);if(!I||!I._featuresetSelectors)continue;const P=I._featuresetSelectors[b];if(!P){this.fire(new o.z(new Error(`The featureset '${b}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const M of P){const z=I.getOwnLayer(M.layerId);z&&!ys.has(z.type)&&f(z,I.getOwnLayerSourceCache(z),y,M)}}else if("layerId"in y.target){const{layerId:b}=y.target,E=this.getLayer(b);if(!E||ys.has(E.type))continue;f(E,this.getLayerSourceCache(E),y)}const _=this._queryRenderedFeatures(t,d,c);return this._flattenAndSortRenderedFeatures(_)}_queryRenderedFeatures(t,n,c){const d=[],f=!!this.map._showQueryGeometry,_=en.createFromScreenPoints(t,c);for(const y in n){const b=ba(_,n[y],this._availableImages,c,f);Object.keys(b).length&&d.push(b)}if(this.placement)for(const y in n){if(!n[y].sourceCache._onlySymbols)continue;const b=hc(_.screenGeometry,n[y],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData);Object.keys(b).length&&d.push(b)}return d}querySourceFeatures(t,n){const c=n&&n.filter;c&&this._validate(Z,"querySourceFeatures.filter",c,null,n);let d=[];const f=this.getOwnSourceCaches(t);for(const _ of f)d=d.concat(gd(_,n));return d}addSourceType(t,n,c){return go.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(go.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},c):c(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,n,c={}){this._checkLoaded();const d=this.light.getLight();let f=!1;for(const y in t)if(!o.bv(t[y],d[y])){f=!0;break}if(!f)return;const _=this._getTransitionParameters();this.light.setLight(t,n,c),this.light.updateTransitions(_)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=o.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&o.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,n=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),n===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let c=t;const d=t.source==null;if(n===1){if(this.disableElevatedTerrain)return;if(typeof c.source=="object"){const y="terrain-dem-src";this.addSource(y,c.source),c=o.d7(c),c=o.l(c,{source:y})}const f=o.l({},c),_={};if(this.terrain&&d){f.source=this.terrain.get().source;const y=this.terrain?this.getFragmentStyle(this.terrain.scope):null;y&&(_.style=y.serialize())}if(this._validate(ft,"terrain",f,_))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&n!==this.terrain.drapeRenderMode){if(!c)return;this._createTerrain(c,n),this.fire(new o.A("data",{dataType:"style"}))}else{const f=this.terrain,_=f.get();for(const y of Object.keys(o.a5.terrain))!c.hasOwnProperty(y)&&o.a5.terrain[y].default&&(c[y]=o.a5.terrain[y].default);for(const y in t)if(!o.bv(t[y],_[y])){f.set(t,this.options),this.stylesheet.terrain=t;const b=this._getTransitionParameters({duration:0});f.updateTransitions(b),this.fire(new o.A("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const n=this.fog=new _i(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_createSnow(t){const n=this.snow=new or(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_createRain(t){const n=this.rain=new lr(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const n=this.fog;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.fog=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const n=this.snow;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.snow=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const n=this.rain;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const d in this._layers)this._layers[d].lut=this._styleColorTheme.lut;for(const d in this._sourceCaches)this._sourceCaches[d].clearTiles()},n=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!n)return this._styleColorTheme.lut=null,void t();const c=this._evaluateColorThemeData(n);this._loadColorTheme(c).then(()=>{this.fire(new o.A("colorthemeset")),t()}).catch(d=>{o.w(`Couldn't set color theme: ${d}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&o.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,n){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=n,c._reloadColorTheme())}_getTransitionParameters(t){return{now:o.q.now(),transition:o.l(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],n=[];for(const c of this._mergedOrder)this.isLayerDraped(this._mergedLayers[c])?t.push(c):n.push(c);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...n)}_createTerrain(t,n){const c=this.terrain=new qe(t,n,this.scope,this.options);n===1&&(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});c.updateTransitions(d)}_force3DLayerUpdate(){for(const t in this._layers){const n=this._layers[t];n.type==="fill-extrusion"&&this._updateLayer(n)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const n=this._layers[t];n.type==="symbol"&&this._updateLayer(n)}}_validate(t,n,c,d,f={}){if(f&&f.validate===!1)return!1;const _=o.l({},this.serialize());return qs(this,t.call(fo,o.l({key:n,style:_,value:c,styleSpec:o.a5},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),o.dg.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles(),this._mergedSourceCaches[t].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(t){const n=this.getSourceCaches(t);for(const c of n)c.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}reloadSource(t){const n=this.getSourceCaches(t);for(const c of n)c.resume(),c.reload()}reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(t=>{t.modelManager.reloadModels(t.scope)})}updateSources(t){let n;this.directionalLight&&(n=Id(this.directionalLight));const c=new Set;for(const d in this._mergedLayers){const f=this._mergedLayers[d];f.hasElevation()&&!c.has(f.source)&&c.add(f.source)}for(const d in this._mergedSourceCaches){const f=this._mergedSourceCaches[d],_=c.has(f._source.id);f.update(t,void 0,void 0,n,_)}}_generateCollisionBoxes(){for(const t in this._sourceCaches){const n=this._sourceCaches[t];n.resume(),n.reload()}}_updatePlacement(t,n,c,d,f,_,y=!1){let b=!1,E=!1;const I={},P={};for(const M of this._mergedOrder){const z=this._mergedLayers[M];if(z.type!=="symbol")continue;const N=o.C(z.source,z.scope);let B=I[N];if(!B){const V=this.getLayerSourceCache(z);if(!V)continue;const X=V.getRenderableIds(!0).map(Q=>V.getTileByID(Q));P[N]=X.slice(),B=I[N]=X.sort((Q,ie)=>ie.tileID.overscaledZ-Q.tileID.overscaledZ||(Q.tileID.isLessThan(ie.tileID)?-1:1))}const G=this.crossTileSymbolIndex.addLayer(z,B,n.center.lng,n.projection);b=b||G}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),y=y||this._layerOrderChanged||d===0,this._layerOrderChanged&&this.fire(new o.A("neworder")),(y||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.q.now(),n.zoom))&&(this.pauseablePlacement=new Nn(n,this._mergedOrder,y,c,d,f,this.placement,this.fog&&n.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,I,P,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(o.q.now()),E=!0),b&&this.pauseablePlacement.placement.setStale()),E||b){this._buildingIndex.onNewFrame(n.zoom);for(let M=0;M<this._mergedOrder.length;M++){const z=this._mergedLayers[this._mergedOrder[M]];if(z.type!=="symbol")continue;const N=this.isLayerClipped(z);this.placement.updateLayerOpacities(z,I[o.C(z.source,z.scope)],M,N?_:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.q.now())}}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,n){this._checkLoaded();const c=this.stylesheet.imports=this.stylesheet.imports||[];if(c.findIndex(({id:f})=>f===t.id)!==-1)return void this.fire(new o.z(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!n)return c.push(t),this._loadImports([t],!0);const d=c.findIndex(({id:f})=>f===n);return d===-1&&this.fire(new o.z(new Error(`Import with id "${n}" does not exist on this map.`))),this.stylesheet.imports=c.slice(0,d).concat(t).concat(c.slice(d)),this._loadImports([t],!0,n)}updateImport(t,n){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);return d===-1?this:typeof n=="string"?(this.setImportUrl(t,n),this):(n.url&&n.url!==c[d].url&&this.setImportUrl(t,n.url),o.bv(n.config,c[d].config)||this.setImportConfig(t,n.config,n.data.schema),o.bv(n.data,c[d].data)||this.setImportData(t,n.data),this)}moveImport(t,n){this._checkLoaded();let c=this.stylesheet.imports||[];const d=this.getImportIndex(t);if(d===-1)return this;const f=this.getImportIndex(n);if(f===-1)return this;const _=c[d],y=this.fragments[d];return c=c.filter(({id:b})=>b!==t),this.fragments=this.fragments.filter(({id:b})=>b!==t),this.stylesheet.imports=c.slice(0,f).concat(_).concat(c.slice(f)),this.fragments=this.fragments.slice(0,f).concat(y).concat(this.fragments.slice(f)),this.mergeLayers(),this}setImportUrl(t,n){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);if(d===-1)return this;c[d].url=n;const f=this.fragments[d];return f.style=this._createFragmentStyle(c[d]),f.style.on("style.import.load",()=>this.mergeAll()),f.style.loadURL(n),this}setImportData(t,n){this._checkLoaded();const c=this.getImportIndex(t),d=this.stylesheet.imports||[];return c===-1?this:n?(this.fragments[c].style.setState(n),this._reloadImports(),this):(delete d[c].data,this.setImportUrl(t,d[c].url))}setImportConfig(t,n,c){this._checkLoaded();const d=this.getImportIndex(t),f=this.stylesheet.imports||[];if(d===-1)return this;n?f[d].config=n:delete f[d].config;const _=this.fragments[d];c&&_.style.stylesheet&&(_.style.stylesheet.schema=c);const y=_.style.stylesheet&&_.style.stylesheet.schema;return _.config=n,_.style.updateConfig(n,y),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const n=this.stylesheet.imports||[],c=this.getImportIndex(t);c!==-1&&(n.splice(c,1),this.fragments[c].style._remove(),this.fragments.splice(c,1),this._reloadImports())}getImportIndex(t){const n=(this.stylesheet.imports||[]).findIndex(c=>c.id===t);return n===-1&&this.fire(new o.z(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),n}getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const n in this._mergedOtherSourceCaches){const c=this._mergedOtherSourceCaches[n];c&&t.push(c.getSource())}return t}getSource(t,n){const c=this.getSourceCache(t,n);return c&&c.getSource()}getLayerSource(t){const n=this.getLayerSourceCache(t);return n&&n.getSource()}getSourceCache(t,n){const c=o.C(t,n);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const n=o.C(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[n]:this._mergedOtherSourceCaches[n]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const n=[];return this._mergedOtherSourceCaches[t]&&n.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&n.push(this._mergedSymbolSourceCaches[t]),n}updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const n in t){const c=t[n];c==="reload"?this.reloadSource(n):c==="clear"&&this.clearSource(n)}}updateLayers(t){const n=this._changes.getUpdatedPaintProperties();for(const c of n){const d=this.getLayer(c);d&&d.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t,this.scope)}getImages(t,n,c){this.imageManager.getImages(n.images,n.scope,c),this._updateTilesForChangedImages();const d=_=>{if(_){const y=n.images.map(b=>o.I.toString(b));_.setDependencies(n.tileID.key,n.type,y)}},f=o.C(n.source,n.scope);d(this._mergedOtherSourceCaches[f]),d(this._mergedSymbolSourceCaches[f])}rasterizeImages(t,n,c){this.imageManager.rasterizeImages(n,c)}getGlyphs(t,n,c){this.glyphManager.getGlyphs(n.stacks,n.scope,c)}getResource(t,n,c){return o.dh(n,c)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const n=[];return this._otherSourceCaches[t]&&n.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&n.push(this._symbolSourceCaches[t]),n}_isSourceCacheLoaded(t){const n=this.getOwnSourceCaches(t);return n.length===0?(this.fire(new o.z(new Error(`There is no source with ID '${t}'`))),!1):n.every(c=>c.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,n){if(!this._clipLayerPresent&&t.type!=="fill-extrusion")return!1;const c=t.type==="fill-extrusion"&&t.sourceLayer==="building";if(t.is3D(!!this.terrain)){if(c||n&&n.type==="batched-model"||t.type==="model")return!0}else if(t.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(t=>{t.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}go.getSourceType=function(l){return cc[l]},go.setSourceType=function(l,t){cc[l]=t},go.registerForPluginStateChange=o.c$;var _l=`
|
|
76
76
|
#define EPSILON 0.0000001
|
|
77
77
|
#define PI 3.141592653589793
|